17 #include <ParmParse.H>
23 #include <CD_NamespaceHeader.H>
30 CH_TIME(
"RadiativeTransferStepper::RadiativeTransferStepper");
33 ParmParse pp(
"RadiativeTransferStepper");
36 pp.get(
"verbosity", m_verbosity);
37 pp.get(
"realm", m_realm);
46 CH_TIME(
"RadiativeTransferStepper::~RadiativeTransferStepper");
47 if (m_verbosity > 5) {
48 pout() <<
"RadiativeTransferStepper::~RadiativeTransferStepper" << endl;
56 CH_TIME(
"RadiativeTransferStepper::setupSolvers");
57 if (m_verbosity > 5) {
58 pout() <<
"RadiativeTransferStepper::setupSolvers" << endl;
64 m_solver = RefCountedPtr<RtSolver>(
new T());
65 m_solver->setVerbosity(m_verbosity);
66 m_solver->setRtSpecies(m_species);
67 m_solver->parseOptions();
68 m_solver->setPhase(phase::gas);
69 m_solver->setAmr(m_amr);
70 m_solver->setComputationalGeometry(m_computationalGeometry);
71 m_solver->setRealm(m_realm);
78 CH_TIME(
"RadiativeTransferStepper::parseRuntimeOptions");
79 if (m_verbosity > 5) {
80 pout() <<
"RadiativeTransferStepper::parseRuntimeOptions" << endl;
83 ParmParse pp(
"RadiativeTransferStepper");
85 pp.get(
"verbosity", m_verbosity);
88 m_solver->parseRuntimeOptions();
95 CH_TIME(
"RadiativeTransferStepper::allocate");
96 if (m_verbosity > 5) {
97 pout() <<
"RadiativeTransferStepper::allocate" << endl;
100 m_solver->allocate();
103 template <
typename T>
107 CH_TIME(
"RadiativeTransferStepper::initialData");
108 if (m_verbosity > 5) {
109 pout() <<
"RadiativeTransferStepper::initialData" << endl;
112 m_solver->initialData();
113 this->setGaussianSource();
115 if (m_solver->isStationary()) {
116 m_solver->advance(0.0,
false);
120 template <
typename T>
124 CH_TIME(
"RadiativeTransferStepper::postInitialize");
125 if (m_verbosity > 5) {
126 pout() <<
"RadiativeTransferStepper::postInitialize" << endl;
130 template <
typename T>
134 CH_TIME(
"RadiativeTransferStepper::forceDt");
135 if (m_verbosity > 5) {
136 pout() <<
"RadiativeTransferStepper::forceDt" << endl;
143 template <
typename T>
147 CH_TIME(
"RadiativeTransferStepper::writeCheckpointData");
148 if (m_verbosity > 5) {
149 pout() <<
"RadiativeTransferStepper::writeCheckpointData" << endl;
152 m_solver->writeCheckpointLevel(a_handle, a_lvl);
157 template <
typename T>
161 CH_TIME(
"RadiativeTransferStepper::readCheckpointData");
162 if (m_verbosity > 5) {
163 pout() <<
"RadiativeTransferStepper::readCheckpointData" << endl;
166 m_solver->readCheckpointLevel(a_handle, a_lvl);
170 template <
typename T>
174 CH_TIME(
"RadiativeTransferStepper::postCheckpointSetup");
175 if (m_verbosity > 5) {
176 pout() <<
"RadiativeTransferStepper::postCheckpointSetup" << endl;
179 this->setGaussianSource();
182 template <
typename T>
186 CH_TIME(
"RadiativeTransferStepper::getNumberOfPlotVariables");
187 if (m_verbosity > 5) {
188 pout() <<
"RadiativeTransferStepper::getNumberOfPlotVariables" << endl;
191 return m_solver->getNumberOfPlotVariables();
194 template <
typename T>
198 CH_TIME(
"RadiativeTransferStepper::getPlotVariableNames");
199 if (m_verbosity > 5) {
200 pout() <<
"RadiativeTransferStepper::getPlotVariableNames" << endl;
203 return m_solver->getPlotVariableNames();
206 template <
typename T>
210 const std::string a_outputRealm,
211 const int a_level)
const
213 CH_TIME(
"RadiativeTransferStepper::writePlotData");
214 if (m_verbosity > 5) {
215 pout() <<
"RadiativeTransferStepper::writePlotData" << endl;
218 m_solver->writePlotData(a_output, a_icomp, a_outputRealm, a_level);
221 template <
typename T>
225 CH_TIME(
"RadiativeTransferStepper::computeDt");
226 if (m_verbosity > 5) {
227 pout() <<
"RadiativeTransferStepper::computeDt" << endl;
232 if (m_forceDt > 0.0) {
239 template <
typename T>
243 CH_TIME(
"RadiativeTransferStepper::advance");
244 if (m_verbosity > 5) {
245 pout() <<
"RadiativeTransferStepper::advance" << endl;
248 m_solver->advance(a_dt);
253 template <
typename T>
257 CH_TIME(
"RadiativeTransferStepper::synchronizeSolverTimes");
258 if (m_verbosity > 5) {
259 pout() <<
"RadiativeTransferStepper::synchronizeSolverTimes" << endl;
266 m_solver->setTime(m_timeStep, m_time, m_dt);
269 template <
typename T>
273 CH_TIME(
"RadiativeTransferStepper::printStepReport");
274 if (m_verbosity > 5) {
275 pout() <<
"RadiativeTransferStepper::printStepReport" << endl;
279 template <
typename T>
283 CH_TIME(
"RadiativeTransferStepper::registerRealms");
284 if (m_verbosity > 5) {
285 pout() <<
"RadiativeTransferStepper::registerRealms" << endl;
288 m_amr->registerRealm(m_realm);
291 template <
typename T>
295 CH_TIME(
"RadiativeTransferStepper::registerOperators");
296 if (m_verbosity > 5) {
297 pout() <<
"RadiativeTransferStepper::registerOperators" << endl;
300 m_solver->registerOperators();
303 template <
typename T>
307 CH_TIME(
"RadiativeTransferStepper::preRegrid");
308 if (m_verbosity > 5) {
309 pout() <<
"RadiativeTransferStepper::preRegrid" << endl;
312 m_solver->preRegrid(a_base, a_oldFinestLevel);
315 template <
typename T>
319 CH_TIME(
"RadiativeTransferStepper::regrid");
320 if (m_verbosity > 5) {
321 pout() <<
"RadiativeTransferStepper::regrid" << endl;
324 m_solver->regrid(a_lmin, a_oldFinestLevel, a_newFinestLevel);
327 template <
typename T>
331 CH_TIME(
"RadiativeTransferStepper::postRegrid");
332 if (m_verbosity > 5) {
333 pout() <<
"RadiativeTransferStepper::postRegrid" << endl;
336 this->setGaussianSource();
339 template <
typename T>
343 CH_TIME(
"RadiativeTransferStepper::getPhi");
344 if (m_verbosity > 5) {
345 pout() <<
"RadiativeTransferStepper::getPhi" << endl;
348 return m_solver->getPhi();
351 template <
typename T>
355 CH_TIME(
"RadiativeTransferStepper::setGaussianSource");
356 if (m_verbosity > 5) {
357 pout() <<
"RadiativeTransferStepper::setGaussianSource" << endl;
360 ParmParse pp(
"RadiativeTransferStepper");
362 Vector<Real> v(SpaceDim);
367 pp.get(
"blob_amplitude", blobAmp);
368 pp.get(
"blob_radius", blobRad);
369 pp.getarr(
"blob_center", v, 0, SpaceDim);
370 blobCenter = RealVect(D_DECL(v[0], v[1], v[2]));
372 auto sourceFunction = [blobAmp, blobRad, blobCenter](
const RealVect a_position) -> Real {
373 const RealVect dist = a_position - blobCenter;
374 const Real dist2 = dist.dotProduct(dist);
375 return blobAmp * exp(-dist2 / (2 * blobRad * blobRad));
378 m_solver->setSource(sourceFunction);
381 #include <CD_NamespaceFooter.H>
Simple species for Physics/RadiativeTransfer.
TimeStepper class for only evolving radiative transfer modules.
Implementation of RtSpecies for usage in RadiativeTransfer module.
Definition: CD_RadiativeTransferSpecies.H:28
Implementation of TimeStepper for solving for a single radiative transfer species....
Definition: CD_RadiativeTransferStepper.H:33
void registerOperators() override
Register operators – calls the solver registration routine.
Definition: CD_RadiativeTransferStepperImplem.H:293
void postCheckpointSetup() override
Perform post-checkpoint setup routines (sets the source in the solver)
Definition: CD_RadiativeTransferStepperImplem.H:172
void registerRealms() override
Register realms.
Definition: CD_RadiativeTransferStepperImplem.H:281
void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override
Regrid function. Calls the solver function.
Definition: CD_RadiativeTransferStepperImplem.H:317
void allocate() override
Allocate necessary memory for solvers.
Definition: CD_RadiativeTransferStepperImplem.H:93
RadiativeTransferStepper()
Constructor. Reads a couple of input options.
Definition: CD_RadiativeTransferStepperImplem.H:28
void writePlotData(LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string a_outputRealm, const int a_level) const override
Write plot data to output holder.
Definition: CD_RadiativeTransferStepperImplem.H:208
void postInitialize() override
Post-initialization functionality – sets the source term.
Definition: CD_RadiativeTransferStepperImplem.H:122
Real advance(const Real a_dt) override
Advancement method. Calls the solver function.
Definition: CD_RadiativeTransferStepperImplem.H:241
Vector< std::string > getPlotVariableNames() const override
Get plot variable names.
Definition: CD_RadiativeTransferStepperImplem.H:196
int getNumberOfPlotVariables() const override
Get number of plot variables for this physics module.
Definition: CD_RadiativeTransferStepperImplem.H:184
void preRegrid(const int a_lmin, const int a_oldFinestLevel) override
Perform pre-regrid operations – calls the solver function. operation takes a lot of memory.
Definition: CD_RadiativeTransferStepperImplem.H:305
void parseRuntimeOptions() override
Parse runtime options.
Definition: CD_RadiativeTransferStepperImplem.H:76
Real computeDt() override
Compute a time step to be used by Driver.
Definition: CD_RadiativeTransferStepperImplem.H:223
void setGaussianSource()
For setting a Gaussian source in the radiative transfer equation solver.
Definition: CD_RadiativeTransferStepperImplem.H:353
void forceDt(const Real a_dt)
Force usage of a time step.
Definition: CD_RadiativeTransferStepperImplem.H:132
void printStepReport() override
Print a step report (does nothing)
Definition: CD_RadiativeTransferStepperImplem.H:271
void setupSolvers() override
Set up the solver.
Definition: CD_RadiativeTransferStepperImplem.H:54
void postRegrid() override
Post-regrid function. Sets a Gaussian source.
Definition: CD_RadiativeTransferStepperImplem.H:329
void initialData() override
Fill simulation with initial data.
Definition: CD_RadiativeTransferStepperImplem.H:105
void synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt) override
Synchronzie solver times and time steps.
Definition: CD_RadiativeTransferStepperImplem.H:255
virtual ~RadiativeTransferStepper()
Destructor (does nothing)
Definition: CD_RadiativeTransferStepperImplem.H:44
const EBAMRCellData & getPhi() const
Get the solver solution.
Definition: CD_RadiativeTransferStepperImplem.H:341
Namespace for encapsulating the radiative transfer physics module.
Definition: CD_RadiativeTransferSpecies.H:21