chombo-discharge
Loading...
Searching...
No Matches
CD_TracerParticleStepperImplem.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_TRACERPARTICLESTEPPERIMPLEM_H
14#define CD_TRACERPARTICLESTEPPERIMPLEM_H
15
16// Chombo includes
17#include <CH_Timer.H>
18
19// Our includes
21#include <CD_Random.H>
23#include <CD_NamespaceHeader.H>
24
25using namespace Physics::TracerParticle;
26
27template <typename P>
29{
30 CH_TIME("TracerParticleStepper::TracerParticleStepper");
31
34
35 this->parseOptions();
36}
37
38template <typename P>
40{
41 CH_TIME("TracerParticleStepper::~TracerParticleStepper");
42 if (m_verbosity > 5) {
43 pout() << "TracerParticleStepper::~TracerParticleStepper" << endl;
44 }
45}
46
47template <typename P>
48inline void
50{
51 CH_TIME("TracerParticleStepper::setupSolvers()");
52 if (m_verbosity > 5) {
53 pout() << "TracerParticleStepper::setupSolvers()" << endl;
54 }
55
57
58 m_solver->setPhase(m_phase);
59 m_solver->setRealm(m_realm);
60 m_solver->parseOptions();
61}
62
63template <typename P>
64inline void
66{
67 CH_TIME("TracerParticleStepper::allocate()");
68 if (m_verbosity > 5) {
69 pout() << "TracerParticleStepper::allocate()" << endl;
70 }
71
72 m_amr->allocate(m_velocity, m_realm, m_phase, SpaceDim);
73 m_solver->allocate();
74}
75
76template <typename P>
77inline void
79{
80 CH_TIME("TracerParticleStepper::initialData()");
81 if (m_verbosity > 5) {
82 pout() << "TracerParticleStepper::initialData()" << endl;
83 }
84
85 this->setVelocity();
86 this->initialParticles();
87
88 m_solver->setVelocity(m_velocity);
89 m_solver->interpolateVelocities();
90}
91
92template <typename P>
93inline void
95{
96 CH_TIME("TracerParticleStepper::registerRealms()");
97 if (m_verbosity > 5) {
98 pout() << "TracerParticleStepper::registerRealms()" << endl;
99 }
100
101 m_amr->registerRealm(m_realm);
102}
103
104template <typename P>
105inline void
107{
108 CH_TIME("TracerParticleStepper::registerOperators()");
109 if (m_verbosity > 5) {
110 pout() << "TracerParticleStepper::registerOperators()" << endl;
111 }
112
113 m_solver->registerOperators();
114}
115
116template <typename P>
117inline void
119{
120 CH_TIME("TracerParticleStepper::parseOptions()");
121 if (m_verbosity > 5) {
122 pout() << "TracerParticleStepper::parseOptions()" << endl;
123 }
124
125 this->parseIntegrator();
126 this->parseVelocityField();
127 this->parseInitialConditions();
128}
129
130template <typename P>
131inline void
133{
134 CH_TIME("TracerParticleStepper::parseRuntimeOptions()");
135 if (m_verbosity > 5) {
136 pout() << "TracerParticleStepper::parseRuntimeOptions()" << endl;
137 }
138
139 this->parseIntegrator();
140
141 m_solver->parseRuntimeOptions();
142}
143
144template <typename P>
145inline void
147{
148 CH_TIME("TracerParticleStepper::parseIntegrator()");
149 if (m_verbosity > 5) {
150 pout() << "TracerParticleStepper::parseIntegrator()" << endl;
151 }
152
153 ParmParse pp("TracerParticleStepper");
154
156
157 pp.get("verbosity", m_verbosity);
158 pp.get("cfl", m_cfl);
159 pp.get("integration", str);
160 if (str == "euler") {
161 m_algorithm = IntegrationAlgorithm::Euler;
162 }
163 else if (str == "rk2") {
164 m_algorithm = IntegrationAlgorithm::RK2;
165 }
166 else if (str == "rk4") {
167 m_algorithm = IntegrationAlgorithm::RK4;
168 }
169 else {
170 MayDay::Error("TracerParticleStepper::parseIntegrator -- logic bust");
171 }
172}
173
174template <typename P>
175inline void
177{
178 CH_TIME("TracerParticleStepper::parseVelocityField()");
179 if (m_verbosity > 5) {
180 pout() << "TracerParticleStepper::parseVelocityField()" << endl;
181 }
182
183 ParmParse pp("TracerParticleStepper");
184
185 int v;
186 pp.get("velocity_field", v);
187
188 if (v == 0) {
189 m_velocityField = VelocityField::Diagonal;
190 }
191 else if (v == 1) {
192 m_velocityField = VelocityField::Rotational;
193 }
194 else {
195 MayDay::Error("TracerParticleStepper::parseVelocityField -- logic bust");
196 }
197}
198
199template <typename P>
200inline void
202{
203 CH_TIME("TracerParticleStepper::parseInitialConditions()");
204 if (m_verbosity > 5) {
205 pout() << "TracerParticleStepper::parseInitialConditions()" << endl;
206 }
207
208 ParmParse pp("TracerParticleStepper");
209
211 pp.get("initial_particles", numParticles);
212
213 m_numInitialParticles = size_t(std::max(0.0, numParticles));
214}
215
216#ifdef CH_USE_HDF5
217template <typename P>
218inline void
220{
221 CH_TIME("TracerParticleStepper::writeCheckpointData(HDF5Handle, int)");
222 if (m_verbosity > 5) {
223 pout() << "TracerParticleStepper::writeCheckpointData(HDF5Handle, int)" << endl;
224 }
225
226 m_solver->writeCheckpointLevel(a_handle, a_lvl);
227}
228#endif
229
230#ifdef CH_USE_HDF5
231template <typename P>
232inline void
234{
235 CH_TIME("TracerParticleStepper::readCheckpointData(HDF5Handle, int)");
236 if (m_verbosity > 5) {
237 pout() << "TracerParticleStepper::readCheckpointData(HDF5Handle, int)" << endl;
238 }
239
240 m_solver->readCheckpointLevel(a_handle, a_lvl);
241}
242#endif
243
244template <typename P>
245inline int
247{
248 CH_TIME("TracerParticleStepper::getNumberOfPlotVariables()");
249 if (m_verbosity > 5) {
250 pout() << "TracerParticleStepper::getNumberOfPlotVariables()" << endl;
251 }
252
253 return m_solver->getNumberOfPlotVariables();
254}
255
256template <typename P>
259{
260 CH_TIME("TracerParticleStepper::getPlotVariableNames()");
261 if (m_verbosity > 5) {
262 pout() << "TracerParticleStepper::getPlotVariableNames()" << endl;
263 }
264
265 return m_solver->getPlotVariableNames();
266}
267
268template <typename P>
269inline void
271 int& a_icomp,
273 const int a_level) const
274{
275 CH_TIME("TracerParticleStepper::writePlotData(EBAMRCellData, Vector<std::string>, int)");
276 if (m_verbosity > 5) {
277 pout() << "TracerParticleStepper::writePlotData(EBAMRCellData, Vector<std::string>, int)" << endl;
278 }
279
280 CH_assert(a_level >= 0);
281 CH_assert(a_level <= m_amr->getFinestLevel());
282
283 m_solver->writePlotData(a_output, a_icomp, a_outputRealm, a_level);
284}
285
286template <typename P>
287inline Real
289{
290 CH_TIME("TracerParticleStepper::computeDt()");
291 if (m_verbosity > 5) {
292 pout() << "TracerParticleStepper::computeDt()" << endl;
293 }
294
295 return m_cfl * m_solver->computeDt();
296}
297
298template <typename P>
299inline Real
301{
302 CH_TIME("TracerParticleStepper::advance(Real)");
303 if (m_verbosity > 5) {
304 pout() << "TracerParticleStepper::advance(Real)" << endl;
305 }
306
307 switch (m_algorithm) {
308 case IntegrationAlgorithm::Euler: {
309 this->advanceParticlesEuler(a_dt);
310
311 break;
312 }
313 case IntegrationAlgorithm::RK2: {
314 this->advanceParticlesRK2(a_dt);
315
316 break;
317 }
318 case IntegrationAlgorithm::RK4: {
319 this->advanceParticlesRK4(a_dt);
320
321 break;
322 }
323 default: {
324 MayDay::Error("TracerParticleStepper::advance -- logic bust");
325 }
326 }
327
328 return a_dt;
329}
330
331template <typename P>
332inline void
334{
335 CH_TIME("TracerParticleStepper::synchronizeSolverTimes");
336 if (m_verbosity > 5) {
337 pout() << "TracerParticleStepper::synchronizeSolverTimes" << endl;
338 }
339
341 m_time = a_time;
342 m_dt = a_dt;
343
344 m_solver->setTime(a_step, a_time, a_dt);
345}
346
347template <typename P>
348inline void
350{
351 CH_TIME("TracerParticleStepper::preRegrid(int, int)");
352 if (m_verbosity > 5) {
353 pout() << "TracerParticleStepper::preRegrid(int, int)" << endl;
354 }
355
356 m_solver->preRegrid(a_lmin, a_oldFinestLevel);
357}
358
359template <typename P>
360inline void
362{
363 CH_TIME("TracerParticleStepper::regrid(int, int, int)");
364 if (m_verbosity > 5) {
365 pout() << "TracerParticleStepper::regrid(int, int, int)" << endl;
366 }
367
368 // Define velocity field on the new mesh.
369 m_amr->reallocate(m_velocity, m_phase, a_lmin);
370 DataOps::setValue(m_velocity, 0.0);
371
372 // Regrid tracer particles.
373 m_solver->regrid(a_lmin, a_oldFinestLevel, a_newFinestLevel);
374}
375
376template <typename P>
377inline void
379{
380 CH_TIME("TracerParticleStepper::postRegrid()");
381 if (m_verbosity > 5) {
382 pout() << "TracerParticleStepper::postRegrid()" << endl;
383 }
384
385 // Update particle velocities.
386 this->setVelocity();
387 m_solver->interpolateVelocities();
388}
389
390template <typename P>
391inline void
393{
394 CH_TIME("TracerParticleStepper::setVelocity()");
395 if (m_verbosity > 5) {
396 pout() << "TracerParticleStepper::setVelocity()" << endl;
397 }
398
400
401 switch (m_velocityField) {
402 case VelocityField::Diagonal: {
403 velFunc = [](const RealVect& a_position) -> RealVect {
404 return RealVect::Unit;
405 };
406
407 break;
408 }
409 case VelocityField::Rotational: {
410 velFunc = [](const RealVect pos) -> RealVect {
411 const Real r = pos.vectorLength();
412 const Real theta = atan2(pos[1], pos[0]);
413
414 return RealVect(D_DECL(-r * sin(theta), r * cos(theta), 0.));
415 };
416
417 break;
418 }
419 }
420
421 DataOps::setValue(m_velocity,
422 velFunc,
423 m_amr->getProbLo(),
424 m_amr->getDx(),
425 m_amr->getMultiCutVofIterator(m_realm, m_phase));
426
427 m_amr->conservativeAverage(m_velocity, m_realm, m_phase);
428 m_amr->interpGhost(m_velocity, m_realm, m_phase);
429}
430
431template <typename P>
432inline void
434{
435 CH_TIME("TracerParticleStepper::initialParticles()");
436 if (m_verbosity > 5) {
437 pout() << "TracerParticleStepper::initialParticles()" << endl;
438 }
439
440 // TLDR: This code draws distributed particles. Thanks to our nifty ParticleManagement and Random static classes this is just
441 // a matter of defining a distribution function. We define this as a lambda that draws particles uniformly distributed
442 // inside a box.
443 //
444 // After creating the distribution we draw the particles (MPI rank distribution being taken care of under the hood) and
445 // set their weight to one. Finally, we add these particles to the ParticleContainer and remove the particles that lie inside
446 // the EB.
447
448 // Create a random distribution which draw particles uniformly distributed in the domain.
449 const RealVect probLo = m_amr->getProbLo();
450 const RealVect probHi = m_amr->getProbHi();
451
454
455 for (int dir = 0; dir < SpaceDim; dir++) {
457 }
458
459 return ret;
460 };
461
462 // Draw particles using the distribution above. Set their weight to one.
463 List<P> initialParticles;
464
465 ParticleManagement::drawRandomParticles(initialParticles, m_numInitialParticles, uniformDistribution);
466 for (ListIterator<P> lit(initialParticles); lit.ok(); ++lit) {
467 lit().weight() = 1.0;
468 }
469
470 // Put the particles in the solver particle data holder.
472 solverParticles.clearParticles();
473 solverParticles.addParticlesDestructive(initialParticles);
474
475 // Remove particles inside the EB.
476 pout() << "removing particles" << endl;
477 m_amr->removeCoveredParticlesIF(solverParticles, m_phase);
478 pout() << "done initial particles" << endl;
479}
480
481template <typename P>
482inline void
484{
485 CH_TIME("TracerParticleStepper::advanceParticlesEuler()");
486 if (m_verbosity > 5) {
487 pout() << "TracerParticleStepper::advanceParticlesEuler()" << endl;
488 }
489
490 // TLDR: The new position is just x^(k+1) = x^k + dt*v^k
491
493
494 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
495 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
496 const DataIterator& dit = dbl.dataIterator();
497
498 const int nbox = dit.size();
499
500#pragma omp parallel for schedule(runtime)
501 for (int mybox = 0; mybox < nbox; mybox++) {
502 const DataIndex& din = dit[mybox];
503
504 List<P>& particles = amrParticles[lvl][din].listItems();
505
506 for (ListIterator<P> lit(particles); lit.ok(); ++lit) {
507 P& p = lit();
508
509 p.position() += p.velocity() * a_dt;
510 }
511 }
512 }
513
515 m_amr->removeCoveredParticlesIF(amrParticles, m_phase);
516
517 m_solver->interpolateVelocities();
518}
519
520template <typename P>
521inline void
523{
524 CH_TIME("TracerParticleStepper::advanceParticlesRK2()");
525 if (m_verbosity > 5) {
526 pout() << "TracerParticleStepper::advanceParticlesRK2()" << endl;
527 }
528
529 // TLDR: The new positions are x^(k+1) = x^k + 0.5*dt*[ v(x^k) + v(x^*) ] where x^* = x^k + dt*v^k.
530
532
533 // First step. Store old position and velocity and do the Euler advance.
534 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
535 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
536 const DataIterator& dit = dbl.dataIterator();
537
538 const int nbox = dit.size();
539
540#pragma omp parallel for schedule(runtime)
541 for (int mybox = 0; mybox < nbox; mybox++) {
542 const DataIndex& din = dit[mybox];
543
544 List<P>& particles = amrParticles[lvl][din].listItems();
545
546 for (ListIterator<P> lit(particles); lit.ok(); ++lit) {
547 P& p = lit();
548
549 p.template vect<0>() = p.position();
550 p.template vect<1>() = p.velocity();
551
552 p.position() += p.velocity() * a_dt;
553 }
554 }
555 }
556
557 // Remap and interpolate the velocities again. This puts the velocity v = v(x^*) into the particles
559 m_amr->removeCoveredParticlesIF(amrParticles, m_phase);
560 m_solver->interpolateVelocities();
561
562 // Do the second RK2 stage.
563 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
564 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
565 const DataIterator& dit = dbl.dataIterator();
566
567 const int nbox = dit.size();
568
569#pragma omp parallel for schedule(runtime)
570 for (int mybox = 0; mybox < nbox; mybox++) {
571 const DataIndex& din = dit[mybox];
572
573 List<P>& particles = amrParticles[lvl][din].listItems();
574
575 for (ListIterator<P> lit(particles); lit.ok(); ++lit) {
576 P& p = lit();
577
578 // x^k+1 = x^k + dt/2 * [v(x^k) + v(x^*) ]
579 p.position() = p.template vect<0>() + 0.5 * a_dt * (p.template vect<1>() + p.velocity());
580 }
581 }
582 }
583
584 // Remap and interpolate the velocities again
586 m_amr->removeCoveredParticlesIF(amrParticles, m_phase);
587 m_solver->interpolateVelocities();
588}
589
590template <typename P>
591inline void
593{
594 CH_TIME("TracerParticleStepper::advanceParticlesRK4()");
595 if (m_verbosity > 5) {
596 pout() << "TracerParticleStepper::advanceParticlesRK4()" << endl;
597 }
598
599 // TLDR: Just the standard RK4 method.
600
602
603 const Real dtHalf = a_dt / 2.0;
604 const Real dtThird = a_dt / 3.0;
605 const Real dtSixth = a_dt / 6.0;
606
607 // k1 step.
608 {
609 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
610 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
611 const DataIterator& dit = dbl.dataIterator();
612
613 const int nbox = dit.size();
614
615#pragma omp parallel for schedule(runtime)
616 for (int mybox = 0; mybox < nbox; mybox++) {
617 const DataIndex& din = dit[mybox];
618
619 for (ListIterator<P> lit(amrParticles[lvl][din].listItems()); lit.ok(); ++lit) {
620 P& p = lit();
621
622 // Store old position.
623 p.template vect<0>() = p.position();
624
625 p.template vect<1>() = p.velocity(); // k1 = v(x^k)
626 p.position() = p.template vect<0>() + dtHalf * p.velocity(); // x = x^k + 0.5*dt*k1
627 }
628 }
629 }
630
631 // Remap and compute v = v(x)
633 m_solver->interpolateVelocities();
634 }
635
636 // k2 step.
637 {
638 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
639 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
640 const DataIterator& dit = dbl.dataIterator();
641
642 const int nbox = dit.size();
643
644#pragma omp parallel for schedule(runtime)
645 for (int mybox = 0; mybox < nbox; mybox++) {
646 const DataIndex& din = dit[mybox];
647
648 for (ListIterator<P> lit(amrParticles[lvl][din].listItems()); lit.ok(); ++lit) {
649 P& p = lit();
650
651 p.template vect<2>() = p.velocity(); // k2 = v(x^k + 0.5 * k1 * dt)
652 p.position() = p.template vect<0>() + dtHalf * p.velocity(); // x = x^k + 0.5*dt*k2
653 }
654 }
655 }
656
657 // Remap and compute v = v(x)
659 m_solver->interpolateVelocities();
660 }
661
662 // k3 step.
663 {
664 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
665 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
666 const DataIterator& dit = dbl.dataIterator();
667
668 const int nbox = dit.size();
669
670#pragma omp parallel for schedule(runtime)
671 for (int mybox = 0; mybox < nbox; mybox++) {
672 const DataIndex& din = dit[mybox];
673
674 for (ListIterator<P> lit(amrParticles[lvl][din].listItems()); lit.ok(); ++lit) {
675 P& p = lit();
676
677 p.template vect<3>() = p.velocity(); // k3 = v(x^k + 0.5 * k2 * dt)
678 p.position() = p.template vect<0>() + a_dt * p.velocity(); // x^k + k3*a_dt
679 }
680 }
681 }
682
683 // Remap and compute v = v(x)
685 m_solver->interpolateVelocities();
686 }
687
688 // Final step.
689 {
690 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
691 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
692 const DataIterator& dit = dbl.dataIterator();
693
694 const int nbox = dit.size();
695
696#pragma omp parallel for schedule(runtime)
697 for (int mybox = 0; mybox < nbox; mybox++) {
698 const DataIndex& din = dit[mybox];
699
700 for (ListIterator<P> lit(amrParticles[lvl][din].listItems()); lit.ok(); ++lit) {
701 P& p = lit();
702
703 p.position() = p.template vect<0>() + dtSixth * p.template vect<1>() + dtHalf * p.template vect<2>() +
704 dtHalf * p.template vect<3>() + dtSixth * p.velocity();
705 }
706 }
707 }
708
709 // Remap and compute v = v(x)
711 m_solver->interpolateVelocities();
712 }
713
714 m_amr->removeCoveredParticlesIF(amrParticles, m_phase);
715}
716
717#include <CD_NamespaceFooter.H>
718
719#endif
Namespace containing various particle management utilities.
File containing some useful static methods related to random number generation.
Declaration of the Physics::TracerParticle::TracerParticleStepper TimeStepper.
static void setValue(LevelData< MFInterfaceFAB< T > > &a_lhs, const T &a_value)
Set value in an MFInterfaceFAB data holder.
Definition CD_DataOpsImplem.H:24
TimeStepper for advancing tracer particles in a prescribed velocity field on an AMR mesh.
Definition CD_TracerParticleStepper.H:56
void registerRealms() override
Register realms. Primal is the only realm we need.
Definition CD_TracerParticleStepperImplem.H:94
virtual void parseInitialConditions()
Parse initial conditions.
Definition CD_TracerParticleStepperImplem.H:201
void parseRuntimeOptions() override
Parse runtime options.
Definition CD_TracerParticleStepperImplem.H:132
void initialData() override
Fill problem with initial data.
Definition CD_TracerParticleStepperImplem.H:78
void registerOperators() override
Register operators.
Definition CD_TracerParticleStepperImplem.H:106
virtual Real computeDt() override
Compute a time step to be used by Driver.
Definition CD_TracerParticleStepperImplem.H:288
int getNumberOfPlotVariables() const override
Get number of plot variables for this physics module.
Definition CD_TracerParticleStepperImplem.H:246
virtual void advanceParticlesEuler(const Real a_dt)
Advance particles using explicit Euler rule.
Definition CD_TracerParticleStepperImplem.H:483
virtual void preRegrid(const int a_lmin, const int a_oldFinestLevel) override
Perform pre-regrid operations.
Definition CD_TracerParticleStepperImplem.H:349
void allocate() override
Allocate storage for solvers and time stepper.
Definition CD_TracerParticleStepperImplem.H:65
void writePlotData(LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string &a_realm, const int a_level) const override
Write plot data to output holder.
Definition CD_TracerParticleStepperImplem.H:270
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override
Time stepper regrid method.
Definition CD_TracerParticleStepperImplem.H:361
virtual Real advance(const Real a_dt) override
Advancement method. Swaps between various kernels.
Definition CD_TracerParticleStepperImplem.H:300
void parseOptions()
Parse options.
Definition CD_TracerParticleStepperImplem.H:118
virtual void synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt) override
Synchronize solver times and time steps.
Definition CD_TracerParticleStepperImplem.H:333
virtual void advanceParticlesRK2(const Real a_dt)
Advance particles using second order Runge-Kutta.
Definition CD_TracerParticleStepperImplem.H:522
void setupSolvers() override
Instantiate the tracer particle solver.
Definition CD_TracerParticleStepperImplem.H:49
virtual ~TracerParticleStepper()
Destructor.
Definition CD_TracerParticleStepperImplem.H:39
virtual void advanceParticlesRK4(const Real a_dt)
Advance particles using fourth order Runge-Kutta.
Definition CD_TracerParticleStepperImplem.H:592
Vector< std::string > getPlotVariableNames() const override
Get plot variable names.
Definition CD_TracerParticleStepperImplem.H:258
virtual void parseVelocityField()
Parse velocity field.
Definition CD_TracerParticleStepperImplem.H:176
virtual void parseIntegrator()
Parse integration algorithm from input script.
Definition CD_TracerParticleStepperImplem.H:146
virtual void postRegrid() override
Perform post-regrid operations.
Definition CD_TracerParticleStepperImplem.H:378
virtual void initialParticles()
Fill initial particles.
Definition CD_TracerParticleStepperImplem.H:433
TracerParticleStepper()
Constructor. Does nothing.
Definition CD_TracerParticleStepperImplem.H:28
virtual void setVelocity()
Set the velocity on the mesh.
Definition CD_TracerParticleStepperImplem.H:392
static Real getUniformReal01()
Get a uniform real number on the interval [0,1].
Definition CD_RandomImplem.H:156
static const std::string Primal
Identifier for perimal realm.
Definition CD_Realm.H:39
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
virtual void remap()
Remap particles.
Definition CD_TracerParticleSolverImplem.H:339
virtual void setRealm(const std::string &a_realm)
Set the solver realm.
Definition CD_TracerParticleSolverImplem.H:233
phase::which_phase m_phase
Phase where this solver lives.
Definition CD_TracerParticleSolver.H:367
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26
virtual void setTime(const int a_step, const Real a_time, const Real a_dt)
Set the time for this solver.
Definition CD_TracerParticleSolverImplem.H:257
std::string m_realm
Realm where this solver lives.
Definition CD_TracerParticleSolver.H:352
virtual ParticleContainer< P > & getParticles()
Get all particles.
Definition CD_TracerParticleSolverImplem.H:663
int m_verbosity
Verbosity level.
Definition CD_TracerParticleSolver.H:387
RefCountedPtr< AmrMesh > m_amr
Handle to AMR mesh.
Definition CD_TracerParticleSolver.H:327
RefCountedPtr< ComputationalGeometry > m_computationalGeometry
Handle to computational geometry.
Definition CD_TracerParticleSolver.H:332
virtual void setPhase(const phase::which_phase &a_phase)
Set the solver phase.
Definition CD_TracerParticleSolverImplem.H:245
Real m_dt
Time step.
Definition CD_TracerParticleSolver.H:372
virtual void allocate()
Allocate storage for this solver.
Definition CD_TracerParticleSolverImplem.H:195
int m_timeStep
Time step.
Definition CD_TracerParticleSolver.H:382
virtual void interpolateVelocities()
Interpolate particles velocities.
Definition CD_TracerParticleSolverImplem.H:393
virtual void parseOptions()
Parse solver options.
Definition CD_TracerParticleSolverImplem.H:63
virtual void setVelocity(const EBAMRCellData &a_velocityField)
Set the tracer particle velocity field.
Definition CD_TracerParticleSolverImplem.H:295
Real m_time
Time.
Definition CD_TracerParticleSolver.H:377
EBAMRCellData m_velocityField
Mesh-based velocity field. Must be set through setVelocity.
Definition CD_TracerParticleSolver.H:407
Namespace for encapsulating physics code for tracer particles.
Definition CD_TracerParticlePhysics.H:22
@ gas
Gas phase.
Definition CD_MultiFluidIndexSpace.H:39