Skip to content

Commit 5d5e10a

Browse files
author
fournier2
committed
multigroup tracer
1 parent 29bfb46 commit 5d5e10a

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

src/tracers/tracers.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ the swarm at the new timestep, and then on the cells again to inject the tracers
4848
Due to the stochasticity of the injection, we need a deterministic RNG that will
4949
return the same random number of each cells at both par_for. Below is an attempt
5050
of generating such RNG using a cell index based seed. Comments welcomed.
51-
=============================================================================== */
51+
=============================================================================== */
5252

5353
// Generate a unique see, deterministic providing k,j,i
5454
KOKKOS_INLINE_FUNCTION
@@ -76,12 +76,10 @@ uint64_t hash(uint64_t seed) {
7676
KOKKOS_INLINE_FUNCTION
7777
double random_double(uint64_t seed) { return (hash(seed) >> 11) * (1.0 / (1ULL << 53)); }
7878

79-
8079
/* ===============================================================================
8180
EvaluateCriteria: custom function containing the criteria that cells have to ful-
8281
fill to be elligible for the injection of tracers.
83-
=============================================================================== */
84-
82+
=============================================================================== */
8583

8684
template <typename View4D>
8785
KOKKOS_INLINE_FUNCTION bool EvaluateCriteria(InjectionCriteria crit, View4D cons,
@@ -112,9 +110,9 @@ KOKKOS_INLINE_FUNCTION bool EvaluateCriteria(InjectionCriteria crit, View4D cons
112110
}
113111

114112
/* ===============================================================================
115-
Initialize: reads the input parameters, create the tracer package and create the
113+
Initialize: reads the input parameters, create the tracer package and create the
116114
swarm object of each individual populations of tracers.
117-
=============================================================================== */
115+
=============================================================================== */
118116

119117
// Initializing the tracer packages and swarms
120118
std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
@@ -231,8 +229,7 @@ filling a criterion indicated in the input parameter list. Since tracers can't b
231229
injected at all timesteps (this would lead to a divergence of the tracer population,
232230
these are injected in a stochastic way, based on a target number of tracer per cell
233231
and per unit time.
234-
=============================================================================== */
235-
232+
=============================================================================== */
236233

237234
TaskStatus InjectTracers(MeshBlockData<Real> *mbd, parthenon::SimTime &tm) {
238235

@@ -401,7 +398,7 @@ TaskStatus InjectTracers(MeshBlockData<Real> *mbd, parthenon::SimTime &tm) {
401398
/* ===============================================================================
402399
RemoveTracers: loops on tracer, check which ones have reach the end of their life-
403400
time, remove them in such case.
404-
=============================================================================== */
401+
=============================================================================== */
405402

406403
TaskStatus RemoveTracers(MeshBlockData<Real> *mbd, parthenon::SimTime &tm) {
407404

@@ -448,9 +445,9 @@ TaskStatus RemoveTracers(MeshBlockData<Real> *mbd, parthenon::SimTime &tm) {
448445

449446
/* ===============================================================================
450447
SeedInitialTracers: setting up the initial distribution of tracers in each pop. As
451-
tracers can now be dynamically injected, it might worth lifting the non zero tracer
448+
tracers can now be dynamically injected, it might worth lifting the non zero tracer
452449
condition.
453-
=============================================================================== */
450+
=============================================================================== */
454451

455452
void SeedInitialTracers(Mesh *pmesh, ParameterInput *pin, parthenon::SimTime &tm) {
456453

@@ -561,7 +558,7 @@ void SeedInitialTracers(Mesh *pmesh, ParameterInput *pin, parthenon::SimTime &tm
561558
AdvectTracers: moves the tracers in each population for the current timestep.
562559
Two methods are implemented: velocity field interpolation (method 0), or advection
563560
through face-centered velocity (recommended).
564-
=============================================================================== */
561+
=============================================================================== */
565562

566563
TaskStatus AdvectTracers(MeshBlockData<Real> *mbd, const Real dt) {
567564

@@ -692,7 +689,7 @@ TaskStatus AdvectTracers(MeshBlockData<Real> *mbd, const Real dt) {
692689
/* ===============================================================================
693690
FillTracers: calculate interpolated values of some fields (rho, vel, B, etc.) to
694691
damped into the output files.
695-
=============================================================================== */
692+
=============================================================================== */
696693

697694
TaskStatus FillTracers(MeshData<Real> *md, parthenon::SimTime &tm) {
698695
auto hydro_pkg = md->GetParentPointer()->packages.Get("Hydro");

0 commit comments

Comments
 (0)