chombo-discharge
Loading...
Searching...
No Matches
CD_SurfaceODESolverImplem.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_SURFACEODESOLVERIMPLEM_H
14#define CD_SURFACEODESOLVERIMPLEM_H
15
16// Chombo includes
17#include <CH_Timer.H>
18#include <ParmParse.H>
19
20// Our includes
21#include <CD_SurfaceODESolver.H>
22#include <CD_DischargeIO.H>
23#include <CD_NamespaceHeader.H>
24
25template <int N>
27{
28 CH_TIME("SurfaceODESolver::SurfaceODESolver");
29
30 m_className = "SurfaceODESolver";
31
32 m_verbosity = -1;
33
34 this->setVerbosity(-1);
36 this->setPhase(phase::gas);
37 this->setName(m_className);
38 this->setTime(0, 0.0, 0.0);
39}
40
41template <int N>
43{
44 CH_TIME("SurfaceODESolver::SurfaceODESolver");
45 if (m_verbosity > 5) {
46 pout() << m_name + "::SurfaceODESolver()" << endl;
47 }
48
49 m_amr = a_amr;
50}
51
52template <int N>
54{
55 CH_TIME("SurfaceODESolver::~SurfaceODESolver");
56 if (m_verbosity > 5) {
57 pout() << m_name + "::~SurfaceODESolver()" << endl;
58 }
59}
60
61template <int N>
62void
64{
65 CH_TIME("SurfaceODESolver::parseOptions");
66 if (m_verbosity > 5) {
67 pout() << m_name + "::parseOptions" << endl;
68 }
69
70 this->parseVerbosity();
71 this->parseRegrid();
72 this->parsePlotVariables();
73}
74
75template <int N>
76void
78{
79 CH_TIME("SurfaceODESolver::parseRuntimeOptions");
80 if (m_verbosity > 5) {
81 pout() << m_name + "::parseRuntimeOptions" << endl;
82 }
83
84 this->parseVerbosity();
85 this->parseRegrid();
86 this->parsePlotVariables();
87}
88
89template <int N>
90void
92{
93 CH_TIME("SurfaceODESolver::parseVerbosity");
94 if (m_verbosity > 5) {
95 pout() << m_name + "::parseVerbosity" << endl;
96 }
97
98 ParmParse pp(m_className.c_str());
99
100 pp.get("verbosity", m_verbosity);
101}
102
103template <int N>
104void
106{
107 CH_TIME("SurfaceODESolver::parseRegrid");
108 if (m_verbosity > 5) {
109 pout() << m_name + "::parseRegrid" << endl;
110 }
111
112 ParmParse pp(m_className.c_str());
113
115 pp.get("regrid", str);
116
117 if (str == "conservative") {
118 m_conservativeRegrid = true;
119 }
120 else if (str == "arithmetic") {
121 m_conservativeRegrid = false;
122 }
123 else {
124 const std::string err = "SurfaceODESolver<N>::parseRegrid() - argument '" + str + "' not recognized";
125 MayDay::Error(err.c_str());
126 }
127}
128
129template <int N>
130void
132{
133 CH_TIME("SurfaceODESolver::parsePlotVariables");
134 if (m_verbosity > 5) {
135 pout() << m_name + "::parsePlotVariables" << endl;
136 }
137
138 m_plotPhi = false;
139 m_plotRHS = false;
140
141 ParmParse pp(m_className.c_str());
142
143 const int num = pp.countval("plt_vars");
144
145 if (num > 0) {
147 pp.getarr("plt_vars", str, 0, num);
148
149 for (int i = 0; i < num; i++) {
150 if (str[i] == "phi") {
151 m_plotPhi = true;
152 }
153 else if (str[i] == "rhs") {
154 m_plotRHS = true;
155 }
156 }
157 }
158}
159
160template <int N>
161void
163{
164 CH_TIME("SurfaceODESolver::setAmr");
165 if (m_verbosity > 5) {
166 pout() << m_name + "::setAmr" << endl;
167 }
168
169 CH_assert(!(a_amr.isNull()));
170
171 m_amr = a_amr;
172}
173
174template <int N>
175void
177{
178 CH_TIME("SurfaceODESolver::setRealm");
179 if (m_verbosity > 5) {
180 pout() << m_name + "::setRealm" << endl;
181 }
182
183 m_realm = a_realm;
184}
185
186template <int N>
187void
189{
190 CH_TIME("SurfaceODESolver::setName");
191 if (m_verbosity > 5) {
192 pout() << "SurfaceODESolver::setName" << endl;
193 }
194
195 m_name = a_name;
196}
197
198template <int N>
201{
202 CH_TIME("SurfaceODESolver::getRealm");
203 if (m_verbosity > 5) {
204 pout() << "SurfaceODESolver::getRealm" << endl;
205 }
206
207 return m_realm;
208}
209
210template <int N>
211void
213{
214 CH_TIME("SurfaceODESolver::setPhase");
215 if (m_verbosity > 5) {
216 pout() << m_name + "::setPhase" << endl;
217 }
218
219 m_phase = a_phase;
220}
221
222template <int N>
225{
226 CH_TIME("SurfaceODESolver::getPhase");
227 if (m_verbosity > 5) {
228 pout() << m_name + "::getPhase" << endl;
229 }
230
231 return m_phase;
232}
233
234template <int N>
235void
237{
238 CH_TIME("SurfaceODESolver::setVerbosity");
239 if (m_verbosity > 5) {
240 pout() << m_name + "::setVerbosity" << endl;
241 }
242
243 m_verbosity = a_verbosity;
244}
245
246template <int N>
247int
249{
250 CH_TIME("SurfaceODESolver::getVerbosity");
251 if (m_verbosity > 5) {
252 pout() << m_name + "::getVerbosity" << endl;
253 }
254
255 return m_verbosity;
256}
257
258template <int N>
259void
260SurfaceODESolver<N>::setTime(const int a_step, const Real a_time, const Real a_dt) noexcept
261{
262 CH_TIME("SurfaceODESolver::setTime");
263 if (m_verbosity > 5) {
264 pout() << m_name + "::setTime" << endl;
265 }
266
267 m_step = a_step;
268 m_time = a_time;
269 m_dt = a_dt;
270}
271
272template <int N>
273Real
275{
276 CH_TIME("SurfaceODESolver::computeMass(int)");
277 if (m_verbosity > 5) {
278 pout() << m_name + "::computeMass(int)" << endl;
279 }
280
281 return this->computeMass(m_phi, a_comp);
282}
283
284template <int N>
285Real
287{
288 CH_TIME("SurfaceODESolver::computeMass(EBAMRIVData, int)");
289 if (m_verbosity > 5) {
290 pout() << m_name + "::computeMass(EBAMRIVData, int)" << endl;
291 }
292
293 Real dataSum = 0.0;
294
295 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
296 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
297 const DataIterator& dit = dbl.dataIterator();
298 const EBISLayout& ebisl = m_amr->getEBISLayout(m_realm, m_phase)[lvl];
299 const Real dx = m_amr->getDx()[lvl];
300 const Real dxArea = std::pow(dx, SpaceDim - 1);
301
302 CH_assert(a_data[lvl]->nComp() > a_comp);
303
304 const int nbox = dit.size();
305
306#pragma omp parallel for schedule(runtime) reduction(+ : dataSum)
307 for (int mybox = 0; mybox < nbox; mybox++) {
308 const DataIndex& din = dit[mybox];
309
310 const EBISBox& ebisbox = ebisl[din];
311 const BaseFab<bool>& validCells = (*m_amr->getValidCells(m_realm)[lvl])[din];
312 const BaseIVFAB<Real>& data = (*a_data[lvl])[din];
313
314 auto irregularKernel = [&](const VolIndex& vof) -> void {
315 const IntVect iv = vof.gridIndex();
316
317 if (validCells(iv)) {
318 dataSum += data(vof, a_comp) * ebisbox.bndryArea(vof) * dxArea;
319 }
320 };
321
322 VoFIterator& vofit = (*m_amr->getVofIterator(m_realm, m_phase)[lvl])[din];
323
325 }
326 }
327
329}
330
331template <int N>
332int
334{
335 CH_TIME("SurfaceODESolver::getStep");
336 if (m_verbosity > 5) {
337 pout() << m_name + "::getStep" << endl;
338 }
339
340 return m_step;
341}
342
343template <int N>
344Real
346{
347 CH_TIME("SurfaceODESolver::getTime");
348 if (m_verbosity > 5) {
349 pout() << m_name + "::getTime" << endl;
350 }
351
352 return m_time;
353}
354
355template <int N>
356Real
358{
359 CH_TIME("SurfaceODESolver::getDt");
360 if (m_verbosity > 5) {
361 pout() << m_name + "::getDt" << endl;
362 }
363
364 return m_dt;
365}
366
367template <int N>
368void
370{
371 CH_TIME("SurfaceODESolver::setPhi(Real)");
372 if (m_verbosity > 5) {
373 pout() << m_name + "::setPhi(Real)" << endl;
374 }
375
376 DataOps::setValue(m_phi, a_phi);
377}
378
379template <int N>
380void
382{
383 CH_TIME("SurfaceODESolver::setPhi(std::array<Real, N>)");
384 if (m_verbosity > 5) {
385 pout() << m_name + "::setPhi(std::array<Real, N>)" << endl;
386 }
387
388 for (int i = 0; i < N; i++) {
389 DataOps::setValue(m_phi, a_phi[i]);
390 }
391}
392
393template <int N>
394void
396{
397 CH_TIME("SurfaceODESolver::setPhi(EBAMRIVData)");
398 if (m_verbosity > 5) {
399 pout() << m_name + "::setPhi(EBAMRIVData)" << endl;
400 }
401
402 DataOps::copy(m_phi, a_phi);
403}
404
405template <int N>
408{
409 CH_TIME("SurfaceODESolver::getPhi");
410 if (m_verbosity > 5) {
411 pout() << m_name + "::getPhi" << endl;
412 }
413
414 return m_phi;
415}
416
417template <int N>
418const EBAMRIVData&
420{
421 CH_TIME("SurfaceODESolver::getPhi");
422 if (m_verbosity > 5) {
423 pout() << m_name + "::getPhi" << endl;
424 }
425
426 return m_phi;
427}
428
429template <int N>
430void
432{
433 CH_TIME("SurfaceODESolver::setRHS(Real)");
434 if (m_verbosity > 5) {
435 pout() << m_name + "::setRHS(Real)" << endl;
436 }
437
438 DataOps::setValue(m_rhs, a_rhs);
439}
440
441template <int N>
442void
444{
445 CH_TIME("SurfaceODESolver::setRHS(std::array<Real, N>)");
446 if (m_verbosity > 5) {
447 pout() << m_name + "::setRHS(std::array<Real, N>)" << endl;
448 }
449
450 for (int i = 0; i < N; i++) {
451 DataOps::setValue(m_rhs, a_rhs[i]);
452 }
453}
454
455template <int N>
456void
458{
459 CH_TIME("SurfaceODESolver::setRHS(EBAMRIVData)");
460 if (m_verbosity > 5) {
461 pout() << m_name + "::setRHS(EBAMRIVData)" << endl;
462 }
463
464 DataOps::copy(m_rhs, a_rhs);
465}
466
467template <int N>
470{
471 CH_TIME("SurfaceODESolver::getRHS");
472 if (m_verbosity > 5) {
473 pout() << m_name + "::getRHS" << endl;
474 }
475
476 return m_rhs;
477}
478
479template <int N>
480const EBAMRIVData&
482{
483 CH_TIME("SurfaceODESolver::getRHS");
484 if (m_verbosity > 5) {
485 pout() << m_name + "::getRHS" << endl;
486 }
487
488 return m_rhs;
489}
490
491template <int N>
492void
494{
495 CH_TIME("SurfaceODESolver::allocate");
496 if (m_verbosity > 5) {
497 pout() << m_name + "::allocate" << endl;
498 }
499
500 CH_assert(!(m_amr.isNull()));
501
502 m_amr->allocate(m_phi, m_realm, m_phase, N);
503 m_amr->allocate(m_rhs, m_realm, m_phase, N);
504
505 this->defineVoFIterators();
506}
507
508template <int N>
509void
511{
512 CH_TIME("SurfaceODESolver::deallocate");
513 if (m_verbosity > 5) {
514 pout() << m_name + "::deallocate" << endl;
515 }
516
517 m_phi.clear();
518 m_rhs.clear();
519}
520
521template <int N>
522void
524{
525 CH_TIME("SurfaceODESolver::defineVoFIterators");
526 if (m_verbosity > 5) {
527 pout() << m_name + "::defineVoFIterators" << endl;
528 }
529
531
532 CH_assert(!(m_amr.isNull()));
533
534 const int finestLevel = m_amr->getFinestLevel();
535
536 m_dielectricVoFs.resize(1 + finestLevel);
537 m_electrodeVoFs.resize(1 + finestLevel);
538
539 for (int lvl = 0; lvl <= finestLevel; lvl++) {
540 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
541 const DataIterator& dit = dbl.dataIterator();
542 const EBISLayout& ebisl = m_amr->getEBISLayout(m_realm, m_phase)[lvl];
543 const MFLevelGrid& mflg = *m_amr->getMFLevelGrid(m_realm)[lvl];
544
545 m_dielectricVoFs[lvl] = RefCountedPtr<LDVoFs>(new LDVoFs(dbl));
546 m_electrodeVoFs[lvl] = RefCountedPtr<LDVoFs>(new LDVoFs(dbl));
547
548 const int nbox = dit.size();
549
550#pragma omp parallel for schedule(runtime)
551 for (int mybox = 0; mybox < nbox; mybox++) {
552 const DataIndex& din = dit[mybox];
553
554 const Box& cellBox = dbl[din];
555 const EBISBox& ebisBox = ebisl[din];
556 const EBGraph& ebGraph = ebisBox.getEBGraph();
557
558 VoFIterator& dielectricVoFIt = (*m_dielectricVoFs[lvl])[din];
559 VoFIterator& electrodeVoFIt = (*m_electrodeVoFs[lvl])[din];
560
561 IntVectSet dielectricIVS = mflg.interfaceRegion(cellBox, din);
563
566 }
567 }
568}
569
570template <int N>
571void
573{
574 CH_TIME("SurfaceODESolver::registerOperators");
575 if (m_verbosity > 5) {
576 pout() << m_name + "::registerOperators" << endl;
577 }
578
579 CH_assert(!(m_amr.isNull()));
580
581 m_amr->registerOperator(s_eb_coar_ave, m_realm, m_phase);
582}
583
584template <int N>
585void
587{
588 CH_TIME("SurfaceODESolver::registerOperators");
589 if (m_verbosity > 5) {
590 pout() << m_name + "::registerOperators" << endl;
591 }
592
593 CH_assert(!(m_amr.isNull()));
594
595 m_amr->allocate(m_cache, m_realm, m_phase, N);
596
597 DataOps::copy(m_cache, m_phi);
598
599 m_phi.clear();
600}
601
602template <int N>
603void
605{
606 CH_TIME("SurfaceODESolver::regrid");
607 if (m_verbosity > 5) {
608 pout() << m_name + "::registerOperators" << endl;
609 }
610
611 this->allocate();
612
613 const EBCoarseToFineInterp::Type interpType = m_conservativeRegrid ? EBCoarseToFineInterp::Type::ConservativePWC
614 : EBCoarseToFineInterp::Type::PWC;
615
616 m_amr->interpToNewGrids(m_phi, m_cache, m_phase, a_lmin, a_oldFinestLevel, a_newFinestLevel, interpType);
617
618 m_cache.clear();
619}
620
621template <int N>
622void
624{
625 CH_TIME("SurfaceODESolver::resetElectrodes");
626 if (m_verbosity > 5) {
627 pout() << m_name + "::resetElectrodes" << endl;
628 }
629
630 this->resetElectrodes(m_phi, a_value);
631}
632
633template <int N>
634void
636{
637 CH_TIME("SurfaceODESolver::resetElectrodes(EBAMRIVData)");
638 if (m_verbosity > 5) {
639 pout() << m_name + "::resetElectrodes(EBAMRIVData)" << endl;
640 }
641
642 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
643 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
644 const DataIterator& dit = dbl.dataIterator();
645
646 const int nbox = dit.size();
647
648#pragma omp parallel for schedule(runtime)
649 for (int mybox = 0; mybox < nbox; mybox++) {
650 const DataIndex& din = dit[mybox];
651
653 VoFIterator& vofit = (*m_electrodeVoFs[lvl])[din];
654
655 auto kernel = [&](const VolIndex& vof) -> void {
656 for (int comp = 0; comp < N; comp++) {
657 phi(vof, comp) = a_value;
658 }
659 };
660
662 }
663 }
664}
665
666template <int N>
667void
669{
670 CH_TIME("SurfaceODESolver::resetDielectrics");
671 if (m_verbosity > 5) {
672 pout() << m_name + "::resetDielectrics" << endl;
673 }
674
675 this->resetDielectrics(m_phi, a_value);
676}
677
678template <int N>
679void
681{
682 CH_TIME("SurfaceODESolver::resetDielectrics(EBAMRIVData)");
683 if (m_verbosity > 5) {
684 pout() << m_name + "::resetDielectrics(EBAMRIVData)" << endl;
685 }
686
687 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
688 const DisjointBoxLayout& dbl = m_amr->getGrids(m_realm)[lvl];
689 const DataIterator& dit = dbl.dataIterator();
690
691 const int nbox = dit.size();
692
693#pragma omp parallel for schedule(runtime)
694 for (int mybox = 0; mybox < nbox; mybox++) {
695 const DataIndex& din = dit[mybox];
696
698 VoFIterator& vofit = (*m_dielectricVoFs[lvl])[din];
699
700 auto kernel = [&](const VolIndex& vof) -> void {
701 for (int comp = 0; comp < N; comp++) {
702 phi(vof, comp) = a_value;
703 }
704 };
705
707 }
708 }
709}
710
711#ifdef CH_USE_HDF5
712template <int N>
713void
715{
716 CH_TIME("SurfaceODESolver::writeCheckpointLevel");
717 if (m_verbosity > 5) {
718 pout() << m_name + "::writeCheckpointLevel" << endl;
719 }
720
721 const std::string id = "SurfaceODESolver::" + m_name + "::phi";
722
723 CH_assert(!(m_amr.isNull()));
724
725 // HDF5 doesn't like irregular data so we copy the data onto an EBCellFAB, which also has storage for multi-cells
727
728 m_amr->allocate(scratch, m_realm, m_phase, N);
729
731 DataOps::incr(*scratch[a_level], *m_phi[a_level], 1.0, *m_amr->getVofIterator(m_realm, m_phase)[a_level]);
732
734}
735#endif
736
737#ifdef CH_USE_HDF5
738
739template <int N>
740void
742{
743 CH_TIME("SurfaceODESolver::readCheckpointLevel");
744 if (m_verbosity > 5) {
745 pout() << m_name + "::readCheckpointLevel" << endl;
746 }
747
748 const std::string id = "SurfaceODESolver::" + m_name + "::phi";
749
750 CH_assert(!(m_amr.isNull()));
751
752 // HDF5 doesn't like irregular data so we wrote the data onto an EBCellFAB, which also has storage for multi-cells. We
753 // also need to read from that...
755
756 m_amr->allocate(scratch, m_realm, m_phase, N);
757
758 read<EBCellFAB>(a_handle, *scratch[a_level], id, m_amr->getGrids(m_realm)[a_level], Interval(0, N - 1), false);
759
760 DataOps::setValue(*m_phi[a_level], 0.0);
761 DataOps::incr(*m_phi[a_level], *scratch[a_level], 1.0, *m_amr->getVofIterator(m_realm, m_phase)[a_level]);
762}
763#endif
764
765template <int N>
766void
768{
769 CH_TIME("SurfaceODESolver::writePlotFile");
770 if (m_verbosity > 5) {
771 pout() << m_name + "::writePlotFile" << endl;
772 }
773
774 const int numPlotVars = this->getNumberOfPlotVariables();
775
776 if (numPlotVars > 0) {
778
779 CH_assert(plotVarNames.size() == numPlotVars);
780 CH_assert(!(m_amr.isNull()));
781
784
785 for (int lvl = 0; lvl <= m_amr->getFinestLevel(); lvl++) {
786 int icomp = 0;
787 this->writePlotData(*output[lvl], icomp, m_realm, lvl);
788 }
789
790 // Filename
791 char filename[100];
792 sprintf(filename, "%s.step%07d.%dd.hdf5", m_name.c_str(), m_step, SpaceDim);
794
795 // Alias, because Chombo is a bit anal about smart pointers.
797 m_amr->alias(outputPtr, output);
798
799#ifdef CH_USE_HDF5
800 constexpr int numPlotGhost = 0;
801
802 DischargeIO::writeEBHDF5(fname,
804 m_amr->getGrids(m_realm),
805 outputPtr,
806 m_amr->getDomains(),
807 m_amr->getDx(),
808 m_amr->getRefinementRatios(),
809 m_dt,
810 m_time,
811 m_amr->getProbLo(),
812 m_amr->getFinestLevel() + 1,
814#endif
815 }
816}
817
818template <int N>
819void
821 int& a_comp,
823 const int a_level) const noexcept
824{
825 CH_TIME("SurfaceODESolver::writePlotData");
826 if (m_verbosity > 5) {
827 pout() << m_name + "::writePlotData" << endl;
828 }
829
830 CH_assert(a_level >= 0);
831 CH_assert(a_level <= m_amr->getFinestLevel());
832
833 // HDF5 doesn't do irregular data the way we want so we copy into EBCellFABs and
834 // use that as output.
836 m_amr->allocate(scratch, m_realm, m_phase, a_level, N);
837
838 // Copy m_phi to a_output
839 if (m_plotPhi) {
841 DataOps::incr(scratch, *m_phi[a_level], 1.0, *m_amr->getVofIterator(m_realm, m_phase)[a_level]);
842
843 const Interval srcInterv(0, N - 1);
844 const Interval dstInterv(a_comp, a_comp + N - 1);
845
846 m_amr->copyData(a_output, scratch, a_level, a_outputRealm, m_realm, dstInterv, srcInterv);
847
848 a_output.exchange(dstInterv);
849
850 a_comp += N;
851 }
852
853 // Copy m_rhs to a_output
854 if (m_plotRHS) {
856 DataOps::incr(scratch, *m_rhs[a_level], 1.0, *m_amr->getVofIterator(m_realm, m_phase)[a_level]);
857
858 const Interval srcInterv(0, N - 1);
859 const Interval dstInterv(a_comp, a_comp + N - 1);
860
861 m_amr->copyData(a_output, scratch, a_level, a_outputRealm, m_realm, dstInterv, srcInterv);
862
863 a_output.exchange(dstInterv);
864
865 a_comp += N;
866 }
867}
868
869template <int N>
870int
872{
873 CH_TIME("SurfaceODESolver::getNumberOfPlotVariables");
874 if (m_verbosity > 5) {
875 pout() << m_name + "::getNumberOfPlotVariables" << endl;
876 }
877
878 int num = 0;
879
880 if (m_plotPhi) {
881 num += N;
882 }
883
884 if (m_plotRHS) {
885 num += N;
886 }
887
888 return num;
889}
890
891template <int N>
894{
895 CH_TIME("SurfaceODESolver::getPlotVariableNames");
896 if (m_verbosity > 5) {
897 pout() << m_name + "::getPlotVariablesNames" << endl;
898 }
899
901
902 if (m_plotPhi) {
903 for (int i = 0; i < N; i++) {
904 if (N > 1) {
905 plotVarNames.push_back(m_name + " phi-" + std::to_string(i));
906 }
907 else {
908 plotVarNames.push_back(m_name + " phi");
909 }
910 }
911 }
912
913 if (m_plotRHS) {
914 for (int i = 0; i < N; i++) {
915 if (N > 1) {
916 plotVarNames.push_back(m_name + " rhs-" + std::to_string(i));
917 }
918 else {
919 plotVarNames.push_back(m_name + " rhs");
920 }
921 }
922 }
923
924 return plotVarNames;
925}
926
927#include <CD_NamespaceFooter.H>
928
929#endif
Silly, but useful functions that override standard Chombo HDF5 IO.
Declaration of a cut-cell ODE solver.
static void incr(MFAMRCellData &a_lhs, const MFAMRCellData &a_rhs, const Real a_scale) noexcept
Function which increments data in the form a_lhs = a_lhs + a_rhs*a_scale for all components.
Definition CD_DataOps.cpp:820
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 copy(MFAMRCellData &a_dst, const MFAMRCellData &a_src)
Copy data from one data holder to another.
Definition CD_DataOps.cpp:1201
Type
Type of interpolation methods supported. PWC = Piecewise constant, ignoring the embedded boundary....
Definition CD_EBCoarseToFineInterp.H:43
Wrapper class for holding multifluid EBLevelGrids.
Definition CD_MFLevelGrid.H:30
static const std::string Primal
Identifier for perimal realm.
Definition CD_Realm.H:39
Surface ODE solver.
Definition CD_SurfaceODESolver.H:29
virtual int getVerbosity() const noexcept
Get verbosity.
Definition CD_SurfaceODESolverImplem.H:248
virtual EBAMRIVData & getRHS()
Get internal state.
Definition CD_SurfaceODESolverImplem.H:469
void parseVerbosity() noexcept
Parse verbosity.
Definition CD_SurfaceODESolverImplem.H:91
virtual EBAMRIVData & getPhi() noexcept
Get internal state.
Definition CD_SurfaceODESolverImplem.H:407
virtual void setRHS(const Real a_rhs)
Convenience function for setting m_rhs.
Definition CD_SurfaceODESolverImplem.H:431
virtual phase::which_phase getPhase() const noexcept
Get phase.
Definition CD_SurfaceODESolverImplem.H:224
std::string m_name
Solver name.
Definition CD_SurfaceODESolver.H:409
virtual void resetElectrodes(const Real a_value) noexcept
Reset m_phi on electrode cells.
Definition CD_SurfaceODESolverImplem.H:623
virtual int getStep() const noexcept
Get current time step.
Definition CD_SurfaceODESolverImplem.H:333
virtual void parseOptions() noexcept
Parse solver options.
Definition CD_SurfaceODESolverImplem.H:63
void parsePlotVariables() noexcept
Parse plot variables.
Definition CD_SurfaceODESolverImplem.H:131
virtual void setPhase(const phase::which_phase a_phase) noexcept
Set phase.
Definition CD_SurfaceODESolverImplem.H:212
virtual void setAmr(const RefCountedPtr< AmrMesh > &a_amrMesh) noexcept
Set the amr object.
Definition CD_SurfaceODESolverImplem.H:162
SurfaceODESolver()
Default constructor. Must subsequently set AmrMesh.
Definition CD_SurfaceODESolverImplem.H:26
void parseRegrid() noexcept
Parse regrid method.
Definition CD_SurfaceODESolverImplem.H:105
virtual void allocate() noexcept
Allocate internal storage for this class.
Definition CD_SurfaceODESolverImplem.H:493
virtual Real getDt() const noexcept
Get last time step.
Definition CD_SurfaceODESolverImplem.H:357
std::string getRealm() const noexcept
Get the realm where the solver is registered.
Definition CD_SurfaceODESolverImplem.H:200
RefCountedPtr< AmrMesh > m_amr
AMR; needed for grid stuff.
Definition CD_SurfaceODESolver.H:439
virtual void preRegrid(const int a_lbase, const int a_oldFinestLevel) noexcept
Pre-regrid function.
Definition CD_SurfaceODESolverImplem.H:586
virtual ~SurfaceODESolver()
Destructor (does nothing).
Definition CD_SurfaceODESolverImplem.H:53
virtual void setRealm(const std::string &a_realm) noexcept
Set the realm.
Definition CD_SurfaceODESolverImplem.H:176
virtual Real getTime() const noexcept
Get current time.
Definition CD_SurfaceODESolverImplem.H:345
virtual void setVerbosity(const int a_verbosity) noexcept
Set verbosity.
Definition CD_SurfaceODESolverImplem.H:236
virtual void setPhi(const Real a_phi)
Convenience function for setting m_phi.
Definition CD_SurfaceODESolverImplem.H:369
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_comp, const std::string &a_outputRealm, const int a_level) const noexcept
Write output data to a_output.
Definition CD_SurfaceODESolverImplem.H:820
virtual void setName(const std::string &a_name) noexcept
Set the solver name.
Definition CD_SurfaceODESolverImplem.H:188
virtual Real computeMass(const int a_comp=0) const noexcept
Compute the total mass for component a_comp in m_phi.
Definition CD_SurfaceODESolverImplem.H:274
virtual Vector< std::string > getPlotVariableNames() const noexcept
Get output plot names.
Definition CD_SurfaceODESolverImplem.H:893
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) noexcept
Regrid function.
Definition CD_SurfaceODESolverImplem.H:604
virtual void registerOperators() noexcept
Register operators.
Definition CD_SurfaceODESolverImplem.H:572
int m_verbosity
Solver verbosity.
Definition CD_SurfaceODESolver.H:470
virtual void deallocate() noexcept
Deallocate internal storage.
Definition CD_SurfaceODESolverImplem.H:510
virtual void parseRuntimeOptions() noexcept
Parse runtime solver options.
Definition CD_SurfaceODESolverImplem.H:77
virtual void writePlotFile() const noexcept
Write a plot file.
Definition CD_SurfaceODESolverImplem.H:767
virtual void setTime(const int a_step, const Real a_time, const Real a_dt) noexcept
Set the time.
Definition CD_SurfaceODESolverImplem.H:260
void defineVoFIterators() noexcept
Define iterators for iterating over cell subsets.
Definition CD_SurfaceODESolverImplem.H:523
virtual int getNumberOfPlotVariables() const noexcept
Get number of variables to be plotted.
Definition CD_SurfaceODESolverImplem.H:871
virtual void resetDielectrics(const Real a_value) noexcept
Reset m_phi on dielectric cells.
Definition CD_SurfaceODESolverImplem.H:668
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
virtual void setRealm(const std::string &a_realm)
Set the solver realm.
Definition CD_TracerParticleSolverImplem.H:233
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
virtual void setName(const std::string &a_name) noexcept
Set the solver name.
Definition CD_TracerParticleSolverImplem.H:209
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
void parseVerbosity()
Parse solver verbosity.
Definition CD_TracerParticleSolverImplem.H:163
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
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
std::string m_name
Solver name.
Definition CD_TracerParticleSolver.H:357
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
Real sum(const Real &a_value) noexcept
Compute the sum across all MPI ranks.
Definition CD_ParallelOpsImplem.H:354
which_phase
Enumeration of supported phases.
Definition CD_MultiFluidIndexSpace.H:38
@ gas
Gas phase.
Definition CD_MultiFluidIndexSpace.H:39