chombo-discharge
Loading...
Searching...
No Matches
CD_MeshODESolverImplem.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_MESHODESOLVERIMPLEM_H
14#define CD_MESHODESOLVERIMPLEM_H
15
16// Chombo includes
17#include <CH_Timer.H>
18#include <ParmParse.H>
19
20// Our includes
21#include <CD_MeshODESolver.H>
22#include <CD_DischargeIO.H>
23#include <CD_BoxLoops.H>
24#include <CD_Location.H>
25#include <CD_NamespaceHeader.H>
26
27template <size_t N>
29 : m_verbosity(-1), m_name("MeshODESolver"), m_className("MeshODESolver"), m_realm(Realm::Primal), m_phase(phase::gas)
30{
31 CH_TIME("MeshODESolver::MeshODESolver()");
32
33 this->parseOptions();
34}
35
36template <size_t N>
38{
39 CH_TIME("MeshODESolver::MeshODESolver(AMR)");
40
41 m_amr = a_amr;
42}
43
44template <size_t N>
46{
47 CH_TIME("MeshODESolver::~MeshODESolver");
48}
49
50template <size_t N>
51void
53{
54 CH_TIME("MeshODESolver::setAmr");
55 if (m_verbosity > 5) {
56 pout() << m_name + "::setAmr" << endl;
57 }
58
59 m_amr = a_amrMesh;
60}
61
62template <size_t N>
63void
65{
66 CH_TIME("MeshODESolver::parseOptions");
67
68 ParmParse pp(m_className.c_str());
69
70 pp.get("verbosity", m_verbosity);
71 pp.get("use_regrid_slopes", m_regridSlopes);
72
73 this->parsePlotVariables();
74
75 if (m_verbosity > 5) {
76 pout() << m_name + "::parseOptions()" << endl;
77 }
78}
79
80template <size_t N>
81void
83{
84 CH_TIME("MeshODESolver::parseRuntimeOptions()");
85 if (m_verbosity > 5) {
86 pout() << m_name + "::parseRuntimeOptions()" << endl;
87 }
88
89 ParmParse pp(m_className.c_str());
90
91 pp.get("verbosity", m_verbosity);
92 pp.get("use_regrid_slopes", m_regridSlopes);
93
94 this->parsePlotVariables();
95}
96
97template <size_t N>
98void
100{
101 CH_TIME("MeshODESolver::parsePlotVariables()");
102 if (m_verbosity > 5) {
103 pout() << m_name + "::parsePlotVariables()" << endl;
104 }
105
106 m_plotPhi = false;
107 m_plotRHS = false;
108
109 ParmParse pp(m_className.c_str());
110 const int num = pp.countval("plt_vars");
111
112 if (num > 0) {
114 pp.getarr("plt_vars", str, 0, num);
115
116 for (int i = 0; i < num; i++) {
117 if (str[i] == "phi") {
118 m_plotPhi = true;
119 }
120 else if (str[i] == "rhs") {
121 m_plotRHS = true;
122 }
123 }
124 }
125}
126
127template <size_t N>
130{
131 CH_TIME("MeshODESolver::getPhi()");
132 if (m_verbosity > 5) {
133 pout() << m_name + "::getPhi()" << endl;
134 }
135
136 return m_phi;
137}
138
139template <size_t N>
140const EBAMRCellData&
142{
143 CH_TIME("MeshODESolver::getPhi()");
144 if (m_verbosity > 5) {
145 pout() << m_name + "::getPhi()" << endl;
146 }
147
148 return m_phi;
149}
150
151template <size_t N>
154{
155 CH_TIME("MeshODESolver::getRHS()");
156 if (m_verbosity > 5) {
157 pout() << m_name + "::getRHS()" << endl;
158 }
159
160 return m_rhs;
161}
162
163template <size_t N>
164const EBAMRCellData&
166{
167 CH_TIME("MeshODESolver::getRHS()");
168 if (m_verbosity > 5) {
169 pout() << m_name + "::getRHS()" << endl;
170 }
171
172 return m_rhs;
173}
174
175template <size_t N>
176void
178{
179 CH_TIME("MeshODESolver::setPhi(std::function, size_t)");
180 if (m_verbosity > 5) {
181 pout() << m_name + "::setPhi(std::function, size_t)" << endl;
182 }
183
184 DataOps::setValue(m_phi,
185 a_phiFunc,
186 m_amr->getProbLo(),
187 m_amr->getDx(),
188 a_comp,
189 m_amr->getMultiCutVofIterator(m_realm, m_phase));
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, static_cast<int>(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. Not vectorizable: a_phiFunc(pos) is a std::function callback per cell.
259 // Multi-cut N/A: the regular kernel uses the cell-CENTER position while the irregular kernel uses the
260 // CENTROID (a_phiFunc is position-dependent), so singly-cut cells cannot fold into the regular kernel.
261 BoxLoops::loop<D_DECL(1, 1, 1)>(cellBox, regularKernel);
263 }
264 }
265}
266
267template <size_t N>
268void
270{
271 CH_TIME("MeshODESolver::setRHS(std::function, size_t)");
272 if (m_verbosity > 5) {
273 pout() << m_name + "::setRHS(std::function, size_t)" << endl;
274 }
275
276 DataOps::setValue(m_rhs,
277 a_srcFunc,
278 m_amr->getProbLo(),
279 m_amr->getDx(),
280 a_comp,
281 m_amr->getMultiCutVofIterator(m_realm, m_phase));
282}
283
284template <size_t N>
285void
287{
288 CH_TIME("MeshODESolver::computeRHS(std::function<std::array<Real, N>(...)>)");
289 if (m_verbosity > 5) {
290 pout() << m_name + "::computeRHS(std::function<std::array<Real, N>(...)>)" << endl;
291 }
292
293 this->computeRHS(m_rhs, a_rhsFunction);
294}
295
296template <size_t N>
297void
299{
300 CH_TIME("MeshODESolver::computeRHS(EBAMRCellData, std::function<std::array<Real, N>(...)>)");
301 if (m_verbosity > 5) {
302 pout() << m_name + "::computeRHS(EBAMRCellData, std::function<std::array<Real, N>(...)>)" << endl;
303 }
304
305 constexpr int comp = 0;
306
307 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
308 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
309 const EBISLayout& ebisl = m_amr->getEBISLayout(m_realm, m_phase)[lvl];
310 const DataIterator& dit = dbl.dataIterator();
311
312 const int nbox = dit.size();
313
314#pragma omp parallel for schedule(runtime)
315 for (int mybox = 0; mybox < nbox; mybox++) {
316 const DataIndex& din = dit[mybox];
317
318 EBCellFAB& rhs = (*a_rhs[lvl])[din];
319 const EBCellFAB& phi = (*m_phi[lvl])[din];
320 const EBISBox& ebisbox = ebisl[din];
321
322 FArrayBox& rhsFAB = rhs.getFArrayBox();
323 const FArrayBox& phiFAB = phi.getFArrayBox();
324
325 const BaseFab<bool>& validCells = (*m_amr->getValidCells(m_realm)[lvl])[din];
326
327 // Regular kernel. Only do cells that are not covered by a finer grid.
328 auto regularKernel = [&](const IntVect& iv) -> void {
331
332 if (validCells(iv, comp) && ebisbox.isRegular(iv)) {
333
334 // Make y from the mesh data.
335 for (size_t i = 0; i < N; i++) {
336 y[i] = phiFAB(iv, static_cast<int>(i));
337 }
338
339 // Compute the right-hand side.
340 f = a_rhsFunction(y, m_time);
341 }
342
343 // Put right-hand side in mesh data. This is set to zero if the cell is covered by a finer grid cell.
344 for (size_t i = 0; i < N; i++) {
345 rhsFAB(iv, static_cast<int>(i)) = f[i];
346 }
347 };
348
349 // Irregular kernel. Only do cells that are not covered by a finer grid.
350 auto irregularKernel = [&](const VolIndex& vof) -> void {
353
354 const IntVect iv = vof.gridIndex();
355
356 if (validCells(iv, comp)) {
357
358 // Make y from the mesh data.
359 for (size_t i = 0; i < N; i++) {
360 y[i] = phi(vof, i);
361 }
362
363 // Compute the right-hand side.
364 f = a_rhsFunction(y, m_time);
365 }
366
367 // Put right-hand side in mesh data. This is set to zero if the cell is covered by a finer grid cell.
368 for (size_t i = 0; i < N; i++) {
369 rhs(vof, i) = f[i];
370 }
371 };
372
373 // Kernel regions.
374 const Box cellBox = dbl[din];
375 VoFIterator& vofit = (*m_amr->getVofIterator(m_realm, m_phase)[lvl])[din];
376
377 // Run the kernels. Not vectorizable: a_rhsFunction(y, m_time) is a std::function callback per cell.
378 // Multi-cut investigated, NOT applied: a_rhsFunction is position-independent so singly-cut cells could
379 // in principle fold into the regular kernel (not-covered mask + getMultiCutVofIterator). Not done
380 // because the not-covered mask also includes multi-valued cells, and letting the regular kernel write
381 // their single-valued-FAB entry (today left at 0) is not provably observationally-neutral; the gain is
382 // marginal since the per-cell std::function call dominates and stays non-vectorizable regardless.
383 BoxLoops::loop<D_DECL(1, 1, 1)>(cellBox, regularKernel);
385 }
386 }
387}
388
389template <size_t N>
390void
392{
393 CH_TIME("MeshODESolver::allocate()");
394 if (m_verbosity > 5) {
395 pout() << m_name + "::allocate()" << endl;
396 }
397
398 m_amr->allocate(m_phi, m_realm, m_phase, N);
399 m_amr->allocate(m_rhs, m_realm, m_phase, N);
400}
401
402template <size_t N>
403void
404MeshODESolver<N>::preRegrid(const int /*a_lbase*/, const int /*a_oldFinestLevel*/) noexcept
405{
406 CH_TIME("MeshODESolver::preRegrid(int, int)");
407 if (m_verbosity > 5) {
408 pout() << m_name + "::preRegrid(int, int)" << endl;
409 }
410
411 m_amr->allocate(m_cache, m_realm, m_phase, N);
412 m_amr->copyData(m_cache, m_phi);
413
414 m_phi.clear();
415}
416
417template <size_t N>
418void
419MeshODESolver<N>::regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) noexcept
420{
421 CH_TIME("MeshODESolver::regrid(int, int, int)");
422 if (m_verbosity > 5) {
423 pout() << m_name + "::regrid(int, int, int)" << endl;
424 }
425
426 this->allocate();
427
428 const EBCoarseToFineInterp::Type interpType = m_regridSlopes ? EBCoarseToFineInterp::Type::ConservativeMinMod
429 : EBCoarseToFineInterp::Type::ConservativePWC;
430
431 m_amr->interpToNewGrids(m_phi, m_cache, m_phase, a_lmin, a_oldFinestLevel, a_newFinestLevel, interpType);
432
433 m_amr->conservativeAverage(m_phi, m_realm, m_phase);
434 m_amr->interpGhost(m_phi, m_realm, m_phase);
435
436 m_cache.clear();
437}
438
439template <size_t N>
442{
443 CH_TIME("MeshODESolver::getRealm()");
444 if (m_verbosity > 5) {
445 pout() << m_name + "::getRealm()" << endl;
446 }
447
448 return m_realm;
449}
450
451template <size_t N>
454{
455 CH_TIME("MeshODESolver::getName()");
456 if (m_verbosity > 5) {
457 pout() << m_name + "::getName()" << endl;
458 }
459
460 return m_name;
461}
462
463template <size_t N>
464void
466{
467 CH_TIME("MeshODESolver::setName()");
468 if (m_verbosity > 5) {
469 pout() << m_name + "::setName()" << endl;
470 }
471
472 m_name = a_name;
473}
474
475template <size_t N>
476void
478{
479 CH_TIME("MeshODESolver::registerOperators()");
480 if (m_verbosity > 5) {
481 pout() << m_name + "::registerOperators()" << endl;
482 }
483
484 CH_assert(!m_amr.isNull());
485
486 m_amr->registerOperator(s_eb_coar_ave, m_realm, m_phase);
487 m_amr->registerOperator(s_eb_fill_patch, m_realm, m_phase);
488 m_amr->registerOperator(s_eb_fine_interp, m_realm, m_phase);
489}
490
491template <size_t N>
492void
494{
495 CH_TIME("MeshODESolver::setRealm(std::string)");
496 if (m_verbosity > 5) {
497 pout() << m_name + "::setRealm(std::string)" << endl;
498 }
499
500 m_realm.assign(a_realm);
501}
502
503template <size_t N>
504void
506{
507 CH_TIME("MeshODESolver::setPhase(phase)");
508 if (m_verbosity > 5) {
509 pout() << m_name + "::setPhase(phase)" << endl;
510 }
511
512 m_phase = a_phase;
513}
514
515template <size_t N>
516void
518{
519 CH_TIME("MeshODESolver::setVerbosity(int)");
520 if (m_verbosity > 5) {
521 pout() << m_name + "::setVerbosity(int)" << endl;
522 }
523
524 m_verbosity = a_verbosity;
525}
526
527template <size_t N>
528void
529MeshODESolver<N>::setTime(const int a_step, const Real a_time, const Real a_dt) noexcept
530{
531 CH_TIME("MeshODESolver::setTime(int, Real, Real)");
532 if (m_verbosity > 5) {
533 pout() << m_name + "::setTime(int, Real, Real)" << endl;
534 }
535
536 m_timeStep = a_step;
537 m_time = a_time;
538 m_dt = a_dt;
539}
540
541template <size_t N>
542void
544{
545 CH_TIME("MeshODESolver::writePlotFile()");
546 if (m_verbosity > 5) {
547 pout() << m_name + "::writePlotFile()" << endl;
548 }
549
550 // Number of output components and their names
551 const int numPlotVars = this->getNumberOfPlotVariables();
553
554 // Allocate storage
558
559 int icomp = 0;
560 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
561 this->writePlotData(*output[lvl], icomp, m_realm, lvl);
562 }
563
564 char filename[100];
565 sprintf(filename, "%s.step%07d.%dd.hdf5", m_name.c_str(), m_timeStep, SpaceDim);
567
568 // Alias, because Chombo's EBAMRIO wants raw pointers (but we stick to smart pointers, like God intended).
570 m_amr->alias(outputPtr, output);
571
572#ifdef CH_USE_HDF5
573 constexpr int numPlotGhost = 0;
574
575 DischargeIO::writeEBHDF5(fname,
577 m_amr->getGrids(m_realm),
578 outputPtr,
579 m_amr->getDomains(),
580 m_amr->getDx(),
581 m_amr->getRefinementRatios(),
582 m_dt,
583 m_time,
584 m_amr->getProbLo(),
585 m_amr->getFinestLevel() + 1,
587#endif
588}
589
590template <size_t N>
591int
593{
594 CH_TIME("MeshODESolver::getNumberOfPlotVariables()");
595 if (m_verbosity > 5) {
596 pout() << m_name + "::getNumberOfPlotVariables()" << endl;
597 }
598
599 int numPlotVars = 0;
600
601 if (m_plotPhi) {
602 numPlotVars += static_cast<int>(N);
603 }
604
605 if (m_plotRHS) {
606 numPlotVars += static_cast<int>(N);
607 }
608
609 return numPlotVars;
610}
611
612template <size_t N>
615{
616 CH_TIME("MeshODESolver::getPlotVariableNames()");
617 if (m_verbosity > 5) {
618 pout() << m_name + "::getPlotVariableNames()" << endl;
619 }
620
622
623 if (m_plotPhi) {
624 for (size_t i = 0; i < N; i++) {
625 plotVarNames.push_back(m_name + " phi-" + std::to_string(i));
626 }
627 }
628
629 if (m_plotRHS) {
630 for (size_t i = 0; i < N; i++) {
631 plotVarNames.push_back(m_name + " source-" + std::to_string(i));
632 }
633 }
634
635 return plotVarNames;
636}
637
638template <size_t N>
639void
641 int& a_icomp,
643 const int a_level) const noexcept
644{
645 CH_TIME("MeshODESolver::writePlotData");
646 if (m_verbosity > 5) {
647 pout() << m_name + "::writePlotData" << endl;
648 }
649
650 if (m_plotPhi) {
651 this->writeData(a_output, a_icomp, m_phi, a_outputRealm, a_level, false, true);
652 }
653
654 if (m_plotRHS) {
655 this->writeData(a_output, a_icomp, m_rhs, a_outputRealm, a_level, false, true);
656 }
657}
658
659template <size_t N>
660void
662 int& a_comp,
663 const EBAMRCellData& a_data,
665 const int a_level,
666 const bool a_interpToCentroids,
667 const bool a_interpGhost) const noexcept
668
669{
670 CH_TIMERS("MeshODESolver::writeData");
671 CH_TIMER("MeshODESolver::writeData::allocate", t1);
672 CH_TIMER("MeshODESolver::writeData::local_copy", t2);
673 CH_TIMER("MeshODESolver::writeData::interp_ghost", t3);
674 CH_TIMER("MeshODESolver::writeData::interp_centroid", t4);
675 CH_TIMER("MeshODESolver::writeData::final_copy", t5);
676 if (m_verbosity > 5) {
677 pout() << m_name + "::writeData" << endl;
678 }
679
680 // Number of components we are working with.
681 const int numComp = a_data[a_level]->nComp();
682
683 // Component ranges that we copy to/from.
684 const Interval srcInterv(0, numComp - 1);
685 const Interval dstInterv(a_comp, a_comp + numComp - 1);
686
687 CH_START(t1);
689 m_amr->allocate(scratch, m_realm, m_phase, a_level, numComp);
690 CH_STOP(t1);
691
692 CH_START(t2);
693 m_amr->copyData(scratch, *a_data[a_level], a_level, m_realm, m_realm);
694 CH_START(t2);
695
696 // Interpolate ghost cells
697 CH_START(t3);
698 if (a_level > 0 && a_interpGhost) {
699 m_amr->interpGhost(scratch, *a_data[a_level - 1], a_level, m_realm, m_phase);
700 }
701 CH_STOP(t3);
702
703 CH_START(t4);
705 m_amr->interpToCentroids(scratch, m_realm, m_phase, a_level);
706 }
707 CH_STOP(t4);
708
709 DataOps::setCoveredValue(scratch, *m_amr->getCoveredCells(m_realm, m_phase)[a_level], 0.0);
710
711 CH_START(t5);
712 m_amr->copyData(a_output, scratch, a_level, a_outputRealm, m_realm, dstInterv, srcInterv);
713 CH_STOP(t5);
714
715 a_comp += numComp;
716}
717
718#ifdef CH_USE_HDF5
719template <size_t N>
720void
722{
723 CH_TIME("MeshODESolver::writeCheckpointLevel(HDF5Handle, int)");
724 if (m_verbosity > 5) {
725 pout() << m_name + "::writeCheckpointLevel(HDF5Handle, int)" << endl;
726 }
727
728 write(a_handle, *m_phi[a_level], m_name);
729 write(a_handle, *m_rhs[a_level], m_name + "_src");
730}
731#endif
732
733#ifdef CH_USE_HDF5
734template <size_t N>
735void
737{
738 CH_TIME("MeshODESolver::writeCheckpointLevel(HDF5Handle, int)");
739 if (m_verbosity > 5) {
740 pout() << m_name + "::writeCheckpointLevel(HDF5Handle, int)" << endl;
741 }
742
744 *m_phi[a_level],
745 m_name,
746 m_amr->getGrids(m_realm)[a_level],
747 Interval(0, static_cast<int>(N) - 1),
748 false);
750 *m_rhs[a_level],
751 m_name + "_src",
752 m_amr->getGrids(m_realm)[a_level],
753 Interval(0, static_cast<int>(N) - 1),
754 false);
755}
756#endif
757
758#include <CD_NamespaceFooter.H>
759
760#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 setValue(LevelData< MFInterfaceFAB< T > > &a_lhs, const T &a_value)
Set value in an MFInterfaceFAB data holder.
Definition CD_DataOpsImplem.H:24
static void setCoveredValue(EBAMRCellData &a_lhs, const EBAMRCellData &a_coveredMask, const int a_comp, const Real a_value)
Set value in covered cells. Does specified component.
Definition CD_DataOps.cpp:2655
Type
Type of interpolation methods supported. PWC = Piecewise constant, ignoring the embedded boundary....
Definition CD_EBCoarseToFineInterp.H:43
Class for solving dy/dt = f on an AMR hierarchy.
Definition CD_MeshODESolver.H:29
virtual std::string getRealm() const noexcept
Get the realm where this solver is registered.
Definition CD_MeshODESolverImplem.H:441
virtual void setRHS(const std::function< Real(const RealVect &a_pos)> &a_srcFunc, size_t a_comp) noexcept
Set right-hand side for specified component.
Definition CD_MeshODESolverImplem.H:269
virtual Vector< std::string > getPlotVariableNames() const noexcept
Get output plot names.
Definition CD_MeshODESolverImplem.H:614
virtual void writePlotFile() const noexcept
Write plot file.
Definition CD_MeshODESolverImplem.H:543
std::function< std::array< Real, N >(const std::array< Real, N > &, const Real)> RHSFunction
Alias for right-hand side.
Definition CD_MeshODESolver.H:34
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string &a_outputRealm, int a_level) const noexcept
Write plot data to output holder.
Definition CD_MeshODESolverImplem.H:640
virtual void setName(const std::string &a_name) noexcept
Set solver name.
Definition CD_MeshODESolverImplem.H:465
virtual void writeData(LevelData< EBCellFAB > &a_output, int &a_comp, const EBAMRCellData &a_data, std::string a_outputRealm, int a_level, bool a_interpToCentroids, bool a_interpGhost) const noexcept
Write data to output. Convenience function.
Definition CD_MeshODESolverImplem.H:661
virtual void parseRuntimeOptions() noexcept
Parse run-time configurable class options.
Definition CD_MeshODESolverImplem.H:82
MeshODESolver()
Default constructor. Must subsequently set everything through public member functions.
Definition CD_MeshODESolverImplem.H:28
virtual void setPhi(const std::function< Real(const RealVect &a_pos)> &a_phiFunc, size_t a_comp) noexcept
Set phi for a specific component.
Definition CD_MeshODESolverImplem.H:177
virtual void registerOperators() const noexcept
Register operators for AMR operations.
Definition CD_MeshODESolverImplem.H:477
EBAMRCellData & getPhi() noexcept
Get the solution vector (left-hand side of equation).
Definition CD_MeshODESolverImplem.H:129
virtual ~MeshODESolver()
Destructor.
Definition CD_MeshODESolverImplem.H:45
virtual void setRealm(const std::string &a_realm) noexcept
Set the realm for this solver.
Definition CD_MeshODESolverImplem.H:493
virtual int getNumberOfPlotVariables() const noexcept
Get number of output fields.
Definition CD_MeshODESolverImplem.H:592
virtual void preRegrid(int a_lbase, int a_oldFinestLevel) noexcept
Perform pre-regrid operations.
Definition CD_MeshODESolverImplem.H:404
virtual void parseOptions() noexcept
Parse class options.
Definition CD_MeshODESolverImplem.H:64
virtual void parsePlotVariables() noexcept
Parse plot variables.
Definition CD_MeshODESolverImplem.H:99
EBAMRCellData & getRHS() noexcept
Get the right-hand side vector.
Definition CD_MeshODESolverImplem.H:153
virtual void setAmr(const RefCountedPtr< AmrMesh > &a_amrMesh) noexcept
Set AmrMesh.
Definition CD_MeshODESolverImplem.H:52
virtual void setVerbosity(int a_verbosity) noexcept
Set verbosity.
Definition CD_MeshODESolverImplem.H:517
virtual void setPhase(phase::which_phase a_phase) noexcept
Set phase.
Definition CD_MeshODESolverImplem.H:505
virtual void allocate() noexcept
Allocate internal storage.
Definition CD_MeshODESolverImplem.H:391
virtual void regrid(int a_lmin, int a_oldFinestLevel, int a_newFinestLevel) noexcept
Regrid this solver.
Definition CD_MeshODESolverImplem.H:419
virtual std::string getName() const noexcept
Get solver name.
Definition CD_MeshODESolverImplem.H:453
virtual void setTime(int a_step, Real a_time, Real a_dt) noexcept
Set the time for this solver.
Definition CD_MeshODESolverImplem.H:529
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:286
Class for holding multifluid Realms, which are the Realms that we actually use.
Definition CD_Realm.H:34
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
void parsePlotVariables()
Parse plot variables.
Definition CD_TracerParticleSolverImplem.H:148
phase::which_phase m_phase
Phase where this solver lives.
Definition CD_TracerParticleSolver.H:367
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26
std::string m_realm
Realm where this solver lives.
Definition CD_TracerParticleSolver.H:352
int m_verbosity
Verbosity level.
Definition CD_TracerParticleSolver.H:387
RefCountedPtr< AmrMesh > m_amr
Handle to AMR mesh.
Definition CD_TracerParticleSolver.H:327
virtual Vector< std::string > getPlotVariableNames() const
Get plot variable names.
Definition CD_TracerParticleSolverImplem.H:482
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:511
Real m_dt
Time step.
Definition CD_TracerParticleSolver.H:372
virtual void allocate()
Allocate storage for this solver.
Definition CD_TracerParticleSolverImplem.H:195
std::string m_name
Solver name.
Definition CD_TracerParticleSolver.H:357
int m_timeStep
Time step.
Definition CD_TracerParticleSolver.H:382
std::string m_className
Class name.
Definition CD_TracerParticleSolver.H:362
Real m_time
Time.
Definition CD_TracerParticleSolver.H:377
virtual int getNumberOfPlotVariables() const
Get the number of plot variables.
Definition CD_TracerParticleSolverImplem.H:461
ALWAYS_INLINE void loop(const Box &a_computeBox, Functor &&kernel)
Launch a C++ kernel over a regular grid with compile-time per-dimension strides.
Definition CD_BoxLoopsImplem.H:39
RealVect position(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:21
Phase names namespace.
Definition CD_MultiFluidIndexSpace.H:28
which_phase
Enumeration of supported phases.
Definition CD_MultiFluidIndexSpace.H:38