Cholla 3.0.1-dev
Cholla - Massively parallel hydro on GPUs
Loading...
Searching...
No Matches
average_cells.h
Go to the documentation of this file.
1
5#ifndef AVERAGE_CELLS_H
6#define AVERAGE_CELLS_H
7
8#include <math.h>
9
10#include "../global/global.h"
11
16// omit data-members if they aren't used for anything
17#ifdef AVERAGE_SLOW_CELLS
18 Real max_dti_slow, dx, dy, dz;
19#endif
20
22 __host__ __device__ SlowCellConditionChecker(Real max_dti_slow, Real dx, Real dy, Real dz)
23#ifdef AVERAGE_SLOW_CELLS
24 : max_dti_slow{max_dti_slow}, dx{dx}, dy{dy}, dz{dz}
25#endif
26 {
27 }
28
31 template <bool verbose = false>
32 __device__ bool is_slow(Real total_energy, Real density, Real density_inv, Real velocity_x, Real velocity_y,
33 Real velocity_z, Real gamma) const
34 {
35 return this->max_dti_if_slow(total_energy, density, density_inv, velocity_x, velocity_y, velocity_z, gamma) > 0.0;
36 }
37
41 __device__ Real max_dti_if_slow(Real total_energy, Real density, Real density_inv, Real velocity_x, Real velocity_y,
42 Real velocity_z, Real gamma) const;
43};
44
45#ifdef AVERAGE_SLOW_CELLS
46
47void Average_Slow_Cells(Real *dev_conserved, int nx, int ny, int nz, int n_ghost, int n_fields, Real gamma,
48 SlowCellConditionChecker slow_check, Real xbound, Real ybound, Real zbound, int nx_offset,
49 int ny_offset, int nz_offset);
50
51__global__ void Average_Slow_Cells_3D(Real *dev_conserved, int nx, int ny, int nz, int n_ghost, int n_fields,
52 Real gamma, SlowCellConditionChecker slow_check, Real xbound, Real ybound,
53 Real zbound, int nx_offset, int ny_offset, int nz_offset);
54#endif
55
56#endif /* AVERAGE_CELLS_H */
Object that checks whether a given cell meets the conditions for slow-cell averaging....
Definition average_cells.h:15
__host__ __device__ SlowCellConditionChecker(Real max_dti_slow, Real dx, Real dy, Real dz)
Construct a new object.
Definition average_cells.h:22
__device__ Real max_dti_if_slow(Real total_energy, Real density, Real density_inv, Real velocity_x, Real velocity_y, Real velocity_z, Real gamma) const
Returns the max inverse timestep of the specified cell, if it meets the criteria for being a slow cel...
Definition hydro_cuda.cu:696
__device__ bool is_slow(Real total_energy, Real density, Real density_inv, Real velocity_x, Real velocity_y, Real velocity_z, Real gamma) const
Returns whether the cell meets the condition for being considered a slow cell that must be averaged.
Definition average_cells.h:32