chombo-discharge
Loading...
Searching...
No Matches
CD_MeshODESolverImplem.H
Go to the documentation of this file.
1/* chombo-discharge
2 * Copyright © 2022 SINTEF Energy Research.
3 * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4 */
5
12#ifndef CD_MeshODESolverImplem_H
13#define CD_MeshODESolverImplem_H
14
15// Chombo includes
16#include <CH_Timer.H>
17#include <ParmParse.H>
18
19// Our includes
20#include <CD_MeshODESolver.H>
21#include <CD_DischargeIO.H>
22#include <CD_BoxLoops.H>
23#include <CD_Location.H>
24#include <CD_NamespaceHeader.H>
25
26template <size_t N>
28{
29 CH_TIME("MeshODESolver::MeshODESolver()");
30
31 // Default settings.
32 m_verbosity = -1;
33 m_name = "MeshODESolver";
34 m_className = "MeshODESolver";
35 m_phase = phase::gas;
37
38 this->parseOptions();
39}
40
41template <size_t N>
43{
44 CH_TIME("MeshODESolver::MeshODESolver(AMR)");
45
46 m_amr = a_amr;
47}
48
49template <size_t N>
51{
52 CH_TIME("MeshODESolver::~MeshODESolver");
53}
54
55template <size_t N>
56void
58{
59 CH_TIME("MeshODESolver::setAmr");
60 if (m_verbosity > 5) {
61 pout() << m_name + "::setAmr" << endl;
62 }
63
64 m_amr = a_amrMesh;
65}
66
67template <size_t N>
68void
70{
71 CH_TIME("MeshODESolver::parseOptions");
72
73 ParmParse pp(m_className.c_str());
74
75 pp.get("verbosity", m_verbosity);
76 pp.get("use_regrid_slopes", m_regridSlopes);
77
78 this->parsePlotVariables();
79
80 if (m_verbosity > 5) {
81 pout() << m_name + "::parseOptions()" << endl;
82 }
83}
84
85template <size_t N>
86void
88{
89 CH_TIME("MeshODESolver::parseRuntimeOptions()");
90 if (m_verbosity > 5) {
91 pout() << m_name + "::parseRuntimeOptions()" << endl;
92 }
93
94 ParmParse pp(m_className.c_str());
95
96 pp.get("verbosity", m_verbosity);
97 pp.get("use_regrid_slopes", m_regridSlopes);
98
99 this->parsePlotVariables();
100}
101
102template <size_t N>
103void
105{
106 CH_TIME("MeshODESolver::parsePlotVariables()");
107 if (m_verbosity > 5) {
108 pout() << m_name + "::parsePlotVariables()" << endl;
109 }
110
111 m_plotPhi = false;
112 m_plotRHS = false;
113
114 ParmParse pp(m_className.c_str());
115 const int num = pp.countval("plt_vars");
116
117 if (num > 0) {
119 pp.getarr("plt_vars", str, 0, num);
120
121 for (int i = 0; i < num; i++) {
122 if (str[i] == "phi") {
123 m_plotPhi = true;
124 }
125 else if (str[i] == "rhs") {
126 m_plotRHS = true;
127 }
128 }
129 }
130}
131
132template <size_t N>
135{
136 CH_TIME("MeshODESolver::getPhi()");
137 if (m_verbosity > 5) {
138 pout() << m_name + "::getPhi()" << endl;
139 }
140
141 return m_phi;
142}
143
144template <size_t N>
145const EBAMRCellData&
147{
148 CH_TIME("MeshODESolver::getPhi()");
149 if (m_verbosity > 5) {
150 pout() << m_name + "::getPhi()" << endl;
151 }
152
153 return m_phi;
154}
155
156template <size_t N>
159{
160 CH_TIME("MeshODESolver::getRHS()");
161 if (m_verbosity > 5) {
162 pout() << m_name + "::getRHS()" << endl;
163 }
164
165 return m_rhs;
166}
167
168template <size_t N>
169const EBAMRCellData&
171{
172 CH_TIME("MeshODESolver::getRHS()");
173 if (m_verbosity > 5) {
174 pout() << m_name + "::getRHS()" << endl;
175 }
176
177 return m_rhs;
178}
179
180template <size_t N>
181void
183{
184 CH_TIME("MeshODESolver::setPhi(std::function, size_t)");
185 if (m_verbosity > 5) {
186 pout() << m_name + "::setPhi(std::function, size_t)" << endl;
187 }
188
189 DataOps::setValue(m_phi, a_phiFunc, m_amr->getProbLo(), m_amr->getDx(), a_comp);
190}
191
192template <size_t N>
193void
195{
196 CH_TIME("MeshODESolver::setPhi(std::function)");
197 if (m_verbosity > 5) {
198 pout() << m_name + "::setPhi(std::function)" << endl;
199 }
200
201 constexpr int comp = 0;
202
203 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
204 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
205 const DataIterator& dit = dbl.dataIterator();
206 const Real& dx = m_amr->getDx()[lvl];
207 const EBISLayout& ebisl = m_amr->getEBISLayout(m_realm, m_phase)[lvl];
208 const RealVect& probLo = m_amr->getProbLo();
209
210 const int nbox = dit.size();
211
212#pragma omp parallel for schedule(runtime)
213 for (int mybox = 0; mybox < nbox; mybox++) {
214 const DataIndex& din = dit[mybox];
215
216 EBCellFAB& phi = (*m_phi[lvl])[din];
217 const EBISBox& ebisbox = ebisl[din];
218 FArrayBox& phiFAB = phi.getFArrayBox();
219 const BaseFab<bool>& validCells = (*m_amr->getValidCells(m_realm)[lvl])[din];
220
221 // Regular kernel. Only do cells that are not covered by a finer grid.
222 auto regularKernel = [&](const IntVect& iv) -> void {
224
225 if (validCells(iv, comp) && ebisbox.isRegular(iv)) {
226 const RealVect pos = probLo + (0.5 * RealVect::Unit + RealVect(iv)) * dx;
227
228 y = a_phiFunc(pos);
229 }
230
231 // Put right-hand side in mesh data. This is set to zero if the cell is covered by a finer grid cell.
232 for (size_t i = 0; i < N; i++) {
233 phiFAB(iv, i) = y[i];
234 }
235 };
236
237 // Irregular kernel. Only do cells that are not covered by a finer grid.
238 auto irregularKernel = [&](const VolIndex& vof) -> void {
240 const IntVect iv = vof.gridIndex();
241
242 if (validCells(iv, comp)) {
243 const RealVect pos = probLo + Location::position(Location::Cell::Centroid, vof, ebisbox, dx);
244
245 y = a_phiFunc(pos);
246 }
247
248 // Put right-hand side in mesh data. This is set to zero if the cell is covered by a finer grid cell.
249 for (size_t i = 0; i < N; i++) {
250 phi(vof, i) = y[i];
251 }
252 };
253
254 // Kernel regions.
255 const Box cellBox = dbl[din];
256 VoFIterator& vofit = (*m_amr->getVofIterator(m_realm, m_phase)[lvl])[din];
257
258 // Run the kernels.
261 }
262 }
263}
264
265template <size_t N>
266void
268{
269 CH_TIME("MeshODESolver::setRHS(std::function, size_t)");
270 if (m_verbosity > 5) {
271 pout() << m_name + "::setRHS(std::function, size_t)" << endl;
272 }
273
274 DataOps::setValue(m_rhs, a_srcFunc, m_amr->getProbLo(), m_amr->getDx(), a_comp);
275}
276
277template <size_t N>
278void
280{
281 CH_TIME("MeshODESolver::computeRHS(std::function<std::array<Real, N>(...)>)");
282 if (m_verbosity > 5) {
283 pout() << m_name + "::computeRHS(std::function<std::array<Real, N>(...)>)" << endl;
284 }
285
286 this->computeRHS(m_rhs, a_rhsFunction);
287}
288
289template <size_t N>
290void
292{
293 CH_TIME("MeshODESolver::computeRHS(EBAMRCellData, std::function<std::array<Real, N>(...)>)");
294 if (m_verbosity > 5) {
295 pout() << m_name + "::computeRHS(EBAMRCellData, std::function<std::array<Real, N>(...)>)" << endl;
296 }
297
298 constexpr int comp = 0;
299
300 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
301 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
302 const EBISLayout& ebisl = m_amr->getEBISLayout(m_realm, m_phase)[lvl];
303 const DataIterator& dit = dbl.dataIterator();
304
305 const int nbox = dit.size();
306
307#pragma omp parallel for schedule(runtime)
308 for (int mybox = 0; mybox < nbox; mybox++) {
309 const DataIndex& din = dit[mybox];
310
311 EBCellFAB& rhs = (*a_rhs[lvl])[din];
312 const EBCellFAB& phi = (*m_phi[lvl])[din];
313 const EBISBox& ebisbox = ebisl[din];
314
315 FArrayBox& rhsFAB = rhs.getFArrayBox();
316 const FArrayBox& phiFAB = phi.getFArrayBox();
317
318 const BaseFab<bool>& validCells = (*m_amr->getValidCells(m_realm)[lvl])[din];
319
320 // Regular kernel. Only do cells that are not covered by a finer grid.
321 auto regularKernel = [&](const IntVect& iv) -> void {
324
325 if (validCells(iv, comp) && ebisbox.isRegular(iv)) {
326
327 // Make y from the mesh data.
328 for (size_t i = 0; i < N; i++) {
329 y[i] = phiFAB(iv, i);
330 }
331
332 // Compute the right-hand side.
333 f = a_rhsFunction(y, m_time);
334 }
335
336 // Put right-hand side in mesh data. This is set to zero if the cell is covered by a finer grid cell.
337 for (size_t i = 0; i < N; i++) {
338 rhsFAB(iv, i) = f[i];
339 }
340 };
341
342 // Irregular kernel. Only do cells that are not covered by a finer grid.
343 auto irregularKernel = [&](const VolIndex& vof) -> void {
346
347 const IntVect iv = vof.gridIndex();
348
349 if (validCells(iv, comp)) {
350
351 // Make y from the mesh data.
352 for (size_t i = 0; i < N; i++) {
353 y[i] = phi(vof, i);
354 }
355
356 // Compute the right-hand side.
357 f = a_rhsFunction(y, m_time);
358 }
359
360 // Put right-hand side in mesh data. This is set to zero if the cell is covered by a finer grid cell.
361 for (size_t i = 0; i < N; i++) {
362 rhs(vof, i) = f[i];
363 }
364 };
365
366 // Kernel regions.
367 const Box cellBox = dbl[din];
368 VoFIterator& vofit = (*m_amr->getVofIterator(m_realm, m_phase)[lvl])[din];
369
370 // Run the kernels.
373 }
374 }
375}
376
377template <size_t N>
378void
380{
381 CH_TIME("MeshODESolver::allocate()");
382 if (m_verbosity > 5) {
383 pout() << m_name + "::allocate()" << endl;
384 }
385
386 m_amr->allocate(m_phi, m_realm, m_phase, N);
387 m_amr->allocate(m_rhs, m_realm, m_phase, N);
388}
389
390template <size_t N>
391void
393{
394 CH_TIME("MeshODESolver::preRegrid(int, int)");
395 if (m_verbosity > 5) {
396 pout() << m_name + "::preRegrid(int, int)" << endl;
397 }
398
399 m_amr->allocate(m_cache, m_realm, m_phase, N);
400 m_amr->copyData(m_cache, m_phi);
401
402 m_phi.clear();
403}
404
405template <size_t N>
406void
407MeshODESolver<N>::regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) noexcept
408{
409 CH_TIME("MeshODESolver::regrid(int, int, int)");
410 if (m_verbosity > 5) {
411 pout() << m_name + "::regrid(int, int, int)" << endl;
412 }
413
414 this->allocate();
415
416 const EBCoarseToFineInterp::Type interpType = m_regridSlopes ? EBCoarseToFineInterp::Type::ConservativeMinMod
417 : EBCoarseToFineInterp::Type::ConservativePWC;
418
419 m_amr->interpToNewGrids(m_phi, m_cache, m_phase, a_lmin, a_oldFinestLevel, a_newFinestLevel, interpType);
420
421 m_amr->conservativeAverage(m_phi, m_realm, m_phase);
422 m_amr->interpGhost(m_phi, m_realm, m_phase);
423
424 m_cache.clear();
425}
426
427template <size_t N>
430{
431 CH_TIME("MeshODESolver::getRealm()");
432 if (m_verbosity > 5) {
433 pout() << m_name + "::getRealm()" << endl;
434 }
435
436 return m_realm;
437}
438
439template <size_t N>
442{
443 CH_TIME("MeshODESolver::getName()");
444 if (m_verbosity > 5) {
445 pout() << m_name + "::getName()" << endl;
446 }
447
448 return m_name;
449}
450
451template <size_t N>
452void
454{
455 CH_TIME("MeshODESolver::setName()");
456 if (m_verbosity > 5) {
457 pout() << m_name + "::setName()" << endl;
458 }
459
460 m_name = a_name;
461}
462
463template <size_t N>
464void
466{
467 CH_TIME("MeshODESolver::registerOperators()");
468 if (m_verbosity > 5) {
469 pout() << m_name + "::registerOperators()" << endl;
470 }
471
472 CH_assert(!m_amr.isNull());
473
474 m_amr->registerOperator(s_eb_coar_ave, m_realm, m_phase);
475 m_amr->registerOperator(s_eb_fill_patch, m_realm, m_phase);
476 m_amr->registerOperator(s_eb_fine_interp, m_realm, m_phase);
477}
478
479template <size_t N>
480void
482{
483 CH_TIME("MeshODESolver::setRealm(std::string)");
484 if (m_verbosity > 5) {
485 pout() << m_name + "::setRealm(std::string)" << endl;
486 }
487
488 m_realm.assign(a_realm);
489}
490
491template <size_t N>
492void
493MeshODESolver<N>::setPhase(phase::which_phase a_phase) noexcept
494{
495 CH_TIME("MeshODESolver::setPhase(phase)");
496 if (m_verbosity > 5) {
497 pout() << m_name + "::setPhase(phase)" << endl;
498 }
499
500 m_phase = a_phase;
501}
502
503template <size_t N>
504void
506{
507 CH_TIME("MeshODESolver::setVerbosity(int)");
508 if (m_verbosity > 5) {
509 pout() << m_name + "::setVerbosity(int)" << endl;
510 }
511
512 m_verbosity = a_verbosity;
513}
514
515template <size_t N>
516void
517MeshODESolver<N>::setTime(const int a_step, const Real a_time, const Real a_dt) noexcept
518{
519 CH_TIME("MeshODESolver::setTime(int, Real, Real)");
520 if (m_verbosity > 5) {
521 pout() << m_name + "::setTime(int, Real, Real)" << endl;
522 }
523
524 m_timeStep = a_step;
525 m_time = a_time;
526 m_dt = a_dt;
527}
528
529template <size_t N>
530void
532{
533 CH_TIME("MeshODESolver::writePlotFile()");
534 if (m_verbosity > 5) {
535 pout() << m_name + "::writePlotFile()" << endl;
536 }
537
538 // Number of output components and their names
539 const int numPlotVars = this->getNumberOfPlotVariables();
541
542 // Allocate storage
546
547 int icomp = 0;
548 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
549 this->writePlotData(*output[lvl], icomp, m_realm, lvl);
550 }
551
552 char filename[100];
553 sprintf(filename, "%s.step%07d.%dd.hdf5", m_name.c_str(), m_timeStep, SpaceDim);
555
556 // Alias, because Chombo's EBAMRIO wants raw pointers (but we stick to smart pointers, like God intended).
558 m_amr->alias(outputPtr, output);
559
560#ifdef CH_USE_HDF5
561 constexpr int numPlotGhost = 0;
562
563 DischargeIO::writeEBHDF5(fname,
565 m_amr->getGrids(m_realm),
566 outputPtr,
567 m_amr->getDomains(),
568 m_amr->getDx(),
569 m_amr->getRefinementRatios(),
570 m_dt,
571 m_time,
572 m_amr->getProbLo(),
573 m_amr->getFinestLevel() + 1,
575#endif
576}
577
578template <size_t N>
579int
581{
582 CH_TIME("MeshODESolver::getNumberOfPlotVariables()");
583 if (m_verbosity > 5) {
584 pout() << m_name + "::getNumberOfPlotVariables()" << endl;
585 }
586
587 int numPlotVars = 0;
588
589 if (m_plotPhi) {
590 numPlotVars += int(N);
591 }
592
593 if (m_plotRHS) {
594 numPlotVars += int(N);
595 }
596
597 return numPlotVars;
598}
599
600template <size_t N>
603{
604 CH_TIME("MeshODESolver::getPlotVariableNames()");
605 if (m_verbosity > 5) {
606 pout() << m_name + "::getPlotVariableNames()" << endl;
607 }
608
610
611 if (m_plotPhi) {
612 for (size_t i = 0; i < N; i++) {
613 plotVarNames.push_back(m_name + " phi-" + std::to_string(i));
614 }
615 }
616
617 if (m_plotRHS) {
618 for (size_t i = 0; i < N; i++) {
619 plotVarNames.push_back(m_name + " source-" + std::to_string(i));
620 }
621 }
622
623 return plotVarNames;
624}
625
626template <size_t N>
627void
629 int& a_icomp,
631 const int a_level) const noexcept
632{
633 CH_TIME("MeshODESolver::writePlotData");
634 if (m_verbosity > 5) {
635 pout() << m_name + "::writePlotData" << endl;
636 }
637
638 if (m_plotPhi) {
639 this->writeData(a_output, a_icomp, m_phi, a_outputRealm, a_level, false, true);
640 }
641
642 if (m_plotRHS) {
643 this->writeData(a_output, a_icomp, m_rhs, a_outputRealm, a_level, false, true);
644 }
645}
646
647template <size_t N>
648void
650 int& a_comp,
651 const EBAMRCellData& a_data,
653 const int a_level,
654 const bool a_interpToCentroids,
655 const bool a_interpGhost) const noexcept
656
657{
658 CH_TIMERS("MeshODESolver::writeData");
659 CH_TIMER("MeshODESolver::writeData::allocate", t1);
660 CH_TIMER("MeshODESolver::writeData::local_copy", t2);
661 CH_TIMER("MeshODESolver::writeData::interp_ghost", t3);
662 CH_TIMER("MeshODESolver::writeData::interp_centroid", t4);
663 CH_TIMER("MeshODESolver::writeData::final_copy", t5);
664 if (m_verbosity > 5) {
665 pout() << m_name + "::writeData" << endl;
666 }
667
668 // Number of components we are working with.
669 const int numComp = a_data[a_level]->nComp();
670
671 // Component ranges that we copy to/from.
672 const Interval srcInterv(0, numComp - 1);
673 const Interval dstInterv(a_comp, a_comp + numComp - 1);
674
675 CH_START(t1);
677 m_amr->allocate(scratch, m_realm, m_phase, a_level, numComp);
678 CH_STOP(t1);
679
680 CH_START(t2);
681 m_amr->copyData(scratch, *a_data[a_level], a_level, m_realm, m_realm);
682 CH_START(t2);
683
684 // Interpolate ghost cells
685 CH_START(t3);
686 if (a_level > 0 && a_interpGhost) {
687 m_amr->interpGhost(scratch, *a_data[a_level - 1], a_level, m_realm, m_phase);
688 }
689 CH_STOP(t3);
690
691 CH_START(t4);
693 m_amr->interpToCentroids(scratch, m_realm, m_phase, a_level);
694 }
695 CH_STOP(t4);
696
698
699 CH_START(t5);
700 m_amr->copyData(a_output, scratch, a_level, a_outputRealm, m_realm, dstInterv, srcInterv);
701 CH_STOP(t5);
702
703 a_comp += numComp;
704}
705
706#ifdef CH_USE_HDF5
707template <size_t N>
708void
710{
711 CH_TIME("MeshODESolver::writeCheckpointLevel(HDF5Handle, int)");
712 if (m_verbosity > 5) {
713 pout() << m_name + "::writeCheckpointLevel(HDF5Handle, int)" << endl;
714 }
715
716 write(a_handle, *m_phi[a_level], m_name);
717 write(a_handle, *m_rhs[a_level], m_name + "_src");
718}
719#endif
720
721#ifdef CH_USE_HDF5
722template <size_t N>
723void
725{
726 CH_TIME("MeshODESolver::writeCheckpointLevel(HDF5Handle, int)");
727 if (m_verbosity > 5) {
728 pout() << m_name + "::writeCheckpointLevel(HDF5Handle, int)" << endl;
729 }
730
731 read<EBCellFAB>(a_handle, *m_phi[a_level], m_name, m_amr->getGrids(m_realm)[a_level], Interval(0, N - 1), false);
733 *m_rhs[a_level],
734 m_name + "_src",
735 m_amr->getGrids(m_realm)[a_level],
736 Interval(0, N - 1),
737 false);
738}
739#endif
740
741#include <CD_NamespaceFooter.H>
742
743#endif
Declaration of a namespace for proto-typing grid and EB loops.
Silly, but useful functions that override standard Chombo HDF5 IO.
Declaration of cell positions.
Encapsulation of an ODE solver on the mesh.
static void setCoveredValue(EBAMRCellData &a_lhs, const int a_comp, const Real a_value)
Set value in covered cells. Does specified component.
Definition CD_DataOps.cpp:2552
static void setValue(LevelData< MFInterfaceFAB< T > > &a_lhs, const T &a_value)
Set value in an MFInterfaceFAB data holder.
Definition CD_DataOpsImplem.H:23
Type
Type of interpolation methods supported. PWC = Piecewise constant, ignoring the embedded boundary....
Definition CD_EBCoarseToFineInterp.H:42
Class for solving dy/dt = f on an AMR hierarchy.
Definition CD_MeshODESolver.H:28
virtual std::string getRealm() const noexcept
Get the realm where this solver is registered.
Definition CD_MeshODESolverImplem.H:429
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string a_outputRealm, const int a_level) const noexcept
Write plot data to output holder.
Definition CD_MeshODESolverImplem.H:628
virtual Vector< std::string > getPlotVariableNames() const noexcept
Get output plot names.
Definition CD_MeshODESolverImplem.H:602
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) noexcept
Regrid this solver.
Definition CD_MeshODESolverImplem.H:407
virtual void writePlotFile() const noexcept
Write plot file.
Definition CD_MeshODESolverImplem.H:531
std::function< std::array< Real, N >(const std::array< Real, N > &, const Real)> RHSFunction
Alias for right-hand side.
Definition CD_MeshODESolver.H:33
virtual void setName(const std::string &a_name) noexcept
Set solver name.
Definition CD_MeshODESolverImplem.H:453
virtual void preRegrid(const int a_lbase, const int a_oldFinestLevel) noexcept
Perform pre-regrid operations.
Definition CD_MeshODESolverImplem.H:392
virtual void setPhi(const std::function< Real(const RealVect &a_pos)> &a_phiFunc, const size_t a_comp) noexcept
Set phi for a specific component.
Definition CD_MeshODESolverImplem.H:182
virtual void parseRuntimeOptions() noexcept
Parse run-time configurable class options.
Definition CD_MeshODESolverImplem.H:87
MeshODESolver()
Default constructor. Must subsequently set everything through public member functions.
Definition CD_MeshODESolverImplem.H:27
virtual void registerOperators() const noexcept
Register operators for AMR operations.
Definition CD_MeshODESolverImplem.H:465
virtual void setVerbosity(const int a_verbosity) noexcept
Set verbosity.
Definition CD_MeshODESolverImplem.H:505
virtual void setRHS(const std::function< Real(const RealVect &a_pos)> &a_srcFunc, const size_t a_comp) noexcept
Set right-hand side for specified component.
Definition CD_MeshODESolverImplem.H:267
virtual void setRealm(const std::string a_realm) noexcept
Set the realm for this solver.
Definition CD_MeshODESolverImplem.H:481
EBAMRCellData & getPhi() noexcept
Get the solution vector (left-hand side of equation).
Definition CD_MeshODESolverImplem.H:134
virtual ~MeshODESolver()
Destructor.
Definition CD_MeshODESolverImplem.H:50
virtual int getNumberOfPlotVariables() const noexcept
Get number of output fields.
Definition CD_MeshODESolverImplem.H:580
virtual void parseOptions() noexcept
Parse class options.
Definition CD_MeshODESolverImplem.H:69
virtual void parsePlotVariables() noexcept
Parse plot variables.
Definition CD_MeshODESolverImplem.H:104
EBAMRCellData & getRHS() noexcept
Get the solution vector (left-hand side of equation).
Definition CD_MeshODESolverImplem.H:158
virtual void setAmr(const RefCountedPtr< AmrMesh > &a_amrMesh) noexcept
Set AmrMesh.
Definition CD_MeshODESolverImplem.H:57
virtual void setPhase(phase::which_phase a_phase) noexcept
Set phase.
Definition CD_MeshODESolverImplem.H:493
virtual void allocate() noexcept
Allocate internal storage.
Definition CD_MeshODESolverImplem.H:379
virtual void setTime(const int a_step, const Real a_time, const Real a_dt) noexcept
Set the time for this solver.
Definition CD_MeshODESolverImplem.H:517
virtual std::string getName() const noexcept
Get solver name.
Definition CD_MeshODESolverImplem.H:441
virtual void computeRHS(const RHSFunction &a_rhsFunction) noexcept
Compute right-hand side from left-hand side. I.e. compute f = f(y,t).
Definition CD_MeshODESolverImplem.H:279
virtual void writeData(LevelData< EBCellFAB > &a_output, int &a_comp, const EBAMRCellData &a_data, const std::string a_outputRealm, const int a_level, const bool a_interpToCentroids, const bool a_interpGhost) const noexcept
Write data to output. Convenience function.
Definition CD_MeshODESolverImplem.H:649
static const std::string Primal
Identifier for perimal realm.
Definition CD_Realm.H:47
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
void parsePlotVariables()
Parse plot variables.
Definition CD_TracerParticleSolverImplem.H:145
phase::which_phase m_phase
Phase where this solver lives.
Definition CD_TracerParticleSolver.H:343
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:25
std::string m_realm
Realm where this solver lives.
Definition CD_TracerParticleSolver.H:328
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_comp, const std::string a_outputRealm, const int a_level) const noexcept
Write plot data.
Definition CD_TracerParticleSolverImplem.H:505
int m_verbosity
Verbosity level.
Definition CD_TracerParticleSolver.H:363
RefCountedPtr< AmrMesh > m_amr
Handle to AMR mesh.
Definition CD_TracerParticleSolver.H:303
virtual Vector< std::string > getPlotVariableNames() const
Get plot variable names.
Definition CD_TracerParticleSolverImplem.H:476
Real m_dt
Time step.
Definition CD_TracerParticleSolver.H:348
virtual void allocate()
Allocate storage for this solver.
Definition CD_TracerParticleSolverImplem.H:195
std::string m_name
Solver name.
Definition CD_TracerParticleSolver.H:333
int m_timeStep
Time step.
Definition CD_TracerParticleSolver.H:358
std::string m_className
Class name.
Definition CD_TracerParticleSolver.H:338
virtual void parseOptions()
Parse solver options.
Definition CD_TracerParticleSolverImplem.H:63
Real m_time
Time.
Definition CD_TracerParticleSolver.H:353
virtual int getNumberOfPlotVariables() const
Get the number of plot variables.
Definition CD_TracerParticleSolverImplem.H:455
ALWAYS_INLINE void loop(const Box &a_computeBox, Functor &&kernel, const IntVect &a_stride=IntVect::Unit)
Launch a C++ kernel over a regular grid.
Definition CD_BoxLoopsImplem.H:20
RealVect position(const Location::Cell a_location, const VolIndex &a_vof, const EBISBox &a_ebisbox, const Real &a_dx)
Compute the position (ignoring the "origin) of a Vof.
Definition CD_LocationImplem.H:20