|
chombo-discharge
|
TimeStepper implementation for advancing a single advection-diffusion equation. More...
#include <CD_AdvectionDiffusionStepper.H>


Public Member Functions | |
| AdvectionDiffusionStepper () | |
| Default constructor. Parses all options from ParmParse and sets default velocity, diffusion coefficient, and initial data functors. | |
| AdvectionDiffusionStepper (RefCountedPtr< CdrSolver > &a_solver) | |
| Full constructor. Delegates to the default constructor and then stores the provided solver. | |
| virtual | ~AdvectionDiffusionStepper () |
| Destructor. | |
| void | initialData () override |
| Fill the solver with initial data and set velocity, diffusion coefficient, and source term. | |
| void | allocate () override |
| Allocate internal storage in the solver. | |
| void | postInitialize () override |
| Post-initialization hook. No operations are performed. | |
| void | postCheckpointSetup () override |
| Post-checkpoint setup. Re-applies velocity, diffusion coefficient, source, and EB flux after a restart so the solver fields are consistent with the loaded state. | |
| int | getNumberOfPlotVariables () const override |
| Return the number of output variables contributed by this stepper. | |
| Vector< std::string > | getPlotVariableNames () const override |
| Return the names of the output variables contributed by this stepper. | |
| void | writePlotData (LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string &a_outputRealm, const int a_level) const override |
| Write plot data into the output holder. | |
| Real | computeDt () override |
| Compute the next time step. | |
| void | synchronizeSolverTimes (const int a_step, const Real a_time, const Real a_dt) override |
| Update internal time/step counters and forward them to the solver. | |
| void | printStepReport () override |
| Print a step report. No output is produced. | |
| void | parseRuntimeOptions () override |
| Parse runtime options from ParmParse. Re-reads verbosity, CFL bounds, and integrator. | |
| void | registerRealms () override |
| Register the Primal realm with the AMR mesh. | |
| void | registerOperators () override |
| Register the operators required by the solver. | |
| void | preRegrid (const int a_lbase, const int a_oldFinestLevel) override |
| Pre-regrid hook. Notifies the solver to store data before the mesh changes. | |
| void | setupSolvers () override |
| Instantiate the species and configure the solver with realm, phase, and AMR data. | |
| Real | advance (const Real a_dt) override |
| Advance the solution by one time step using the selected integrator. | |
| void | regrid (const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override |
| Regrid the solver and re-apply the flow fields on the new mesh. | |
| void | postRegrid () override |
| Post-regrid hook. No operations are performed. | |
| void | setCFL (const Real a_cfl) |
| Force a specific CFL number, overriding the value read from input. | |
| void | setInitialData (const std::function< Real(const RealVect &a_position)> &a_initData) noexcept |
| Override the initial data functor. | |
| void | setVelocity (const std::function< RealVect(const RealVect &a_position)> &a_velocity) noexcept |
| Override the velocity field functor. | |
| void | setDiffusionCoefficient (const std::function< Real(const RealVect &a_position)> &a_diffusion) noexcept |
| Override the diffusion coefficient functor. | |
Public Member Functions inherited from TimeStepper | |
| TimeStepper () | |
| Default constructor (does nothing) | |
| virtual | ~TimeStepper () |
| Default destructor (does nothing) | |
| TimeStepper (const TimeStepper &)=delete | |
| Disallow copy construction. | |
| TimeStepper & | operator= (const TimeStepper &)=delete |
| Disallow copy assignment. | |
| TimeStepper (TimeStepper &&)=default | |
| Allow move construction. | |
| TimeStepper & | operator= (TimeStepper &&)=default |
| Allow move assignment. | |
| void | setAmr (const RefCountedPtr< AmrMesh > &a_amr) |
| Set AmrMesh. | |
| void | setComputationalGeometry (const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry) |
| Set the computational geometry. | |
| virtual void | prePlot () |
| An option for calling special functions prior to plotting data. Called by Driver in the IMMEDIATELY before writing the plot file. | |
| virtual void | postPlot () |
| An option for calling special functions prior to plotting data. Called by Driver in the IMMEDIATELY after writing the plot file. | |
| virtual Vector< long int > | getCheckpointLoads (const std::string &a_realm, int a_level) const |
| Get computational loads to be checkpointed. | |
| virtual bool | needToRegrid () |
| Function which can have Driver do regrids at arbitrary points in the simulation. | |
| bool | keepGoing () const |
| Query whether the time stepper wants to continue stepping. | |
| virtual bool | loadBalanceThisRealm (const std::string &a_realm) const |
| Load balancing query for a specified realm. If this returns true for a_realm, load balancing routines will be called during regrids. | |
| virtual void | loadBalanceBoxes (Vector< Vector< int > > &a_procs, Vector< Vector< Box > > &a_boxes, const std::string &a_realm, const Vector< DisjointBoxLayout > &a_grids, int a_lmin, int a_finestLevel) |
| Load balance grid boxes for a specified realm. | |
Protected Types | |
| enum | Integrator { Heun , IMEX } |
| Supported time integration methods. More... | |
Protected Member Functions | |
| void | parseIntegrator () |
| Parse the integration method from ParmParse input. | |
Protected Attributes | |
| RefCountedPtr< CdrSolver > | m_solver |
| The CDR solver used for advancing the scalar field. | |
| RefCountedPtr< AdvectionDiffusionSpecies > | m_species |
| Species definition passed to the CDR solver. | |
| std::string | m_realm |
| Name of the realm on which the solver operates. | |
| phase::which_phase | m_phase |
| Computational phase (gas or solid) on which the solver operates. | |
| std::function< RealVect(const RealVect &a_position)> | m_velocity |
| Functor providing the advection velocity at a given position. | |
| std::function< Real(const RealVect &a_position)> | m_diffCo |
| Functor providing the diffusion coefficient at a given position. | |
| std::function< Real(const RealVect &a_initialData)> | m_initialData |
| Functor providing the initial scalar concentration at a given position. | |
| Real | m_minDt |
| Minimum permissible time step in seconds. | |
| Real | m_maxDt |
| Maximum permissible time step in seconds. | |
| Real | m_cfl |
| CFL number read from input. | |
| Real | m_forceCFL |
| Programmatically forced CFL number. Overrides m_cfl when positive. | |
| bool | m_debug |
| If true, print mass-conservation diagnostics to stdout after each step. | |
| bool | m_mobile |
| If true, the scalar is advected by the velocity field. | |
| bool | m_diffusive |
| If true, the scalar undergoes diffusion. | |
| Integrator | m_integrator |
| Selected time integration method. | |
Protected Attributes inherited from TimeStepper | |
| int | m_verbosity |
| Class verbosity. | |
| int | m_timeStep |
| Time step. | |
| Real | m_time |
| TIme. | |
| Real | m_dt |
| Previous time step size. | |
| bool | m_keepGoing |
| If false, Driver will stop the time loop after the current step. | |
| RefCountedPtr< AmrMesh > | m_amr |
| AmrMesh. | |
| RefCountedPtr< ComputationalGeometry > | m_computationalGeometry |
| Computational geometry. | |
TimeStepper implementation for advancing a single advection-diffusion equation.
This class drives a single CdrSolver through a sequence of time steps. The velocity field, diffusion coefficient, and initial data are specified as functors and can be set either through ParmParse input or programmatically via the setter methods. Two explicit integrators are supported: a second-order Heun (explicit trapezoidal) method and an IMEX method that treats advection explicitly and diffusion implicitly via Crank-Nicholson.
| AdvectionDiffusionStepper::AdvectionDiffusionStepper | ( | RefCountedPtr< CdrSolver > & | a_solver | ) |
Full constructor. Delegates to the default constructor and then stores the provided solver.
| [in] | a_solver | CDR solver to use for the advection-diffusion advance. |
Advance the solution by one time step using the selected integrator.
| [in] | a_dt | Time step size in seconds. |
Implements TimeStepper.
|
overridevirtual |
Allocate internal storage in the solver.
Implements TimeStepper.
|
overridevirtual |
Compute the next time step.
For Heun integration the advection-diffusion CFL limit is used; for IMEX only the advection CFL limit is used since diffusion is treated implicitly. The result is clamped to [m_minDt, m_maxDt].
Implements TimeStepper.
|
overridevirtual |
Return the number of output variables contributed by this stepper.
Implements TimeStepper.
|
overridevirtual |
Return the names of the output variables contributed by this stepper.
Implements TimeStepper.
|
overridevirtual |
Fill the solver with initial data and set velocity, diffusion coefficient, and source term.
Implements TimeStepper.
|
overridevirtual |
Parse runtime options from ParmParse. Re-reads verbosity, CFL bounds, and integrator.
Reimplemented from TimeStepper.
|
overridevirtual |
Post-checkpoint setup. Re-applies velocity, diffusion coefficient, source, and EB flux after a restart so the solver fields are consistent with the loaded state.
Implements TimeStepper.
|
inlineoverridevirtual |
Post-initialization hook. No operations are performed.
Implements TimeStepper.
|
inlineoverridevirtual |
Post-regrid hook. No operations are performed.
Implements TimeStepper.
|
overridevirtual |
Pre-regrid hook. Notifies the solver to store data before the mesh changes.
| [in] | a_lbase | Coarsest level that will change. |
| [in] | a_oldFinestLevel | Finest level before the regrid. |
Implements TimeStepper.
|
inlineoverridevirtual |
Print a step report. No output is produced.
Implements TimeStepper.
|
overridevirtual |
Register the operators required by the solver.
Implements TimeStepper.
|
overridevirtual |
Register the Primal realm with the AMR mesh.
Implements TimeStepper.
|
overridevirtual |
Regrid the solver and re-apply the flow fields on the new mesh.
| [in] | a_lmin | Coarsest level that changed. |
| [in] | a_oldFinestLevel | Finest level before regridding. |
| [in] | a_newFinestLevel | Finest level after regridding. |
Implements TimeStepper.
Force a specific CFL number, overriding the value read from input.
| [in] | a_cfl | CFL number to use. |
|
noexcept |
Override the diffusion coefficient functor.
| [in] | a_diffusion | Functor returning the diffusion coefficient at a given position. |
|
noexcept |
Override the initial data functor.
| [in] | a_initData | Functor returning the initial scalar concentration at a given position. |
|
overridevirtual |
Instantiate the species and configure the solver with realm, phase, and AMR data.
Implements TimeStepper.
|
noexcept |
Override the velocity field functor.
| [in] | a_velocity | Functor returning the advection velocity at a given position. |
|
overridevirtual |
Update internal time/step counters and forward them to the solver.
| [in] | a_step | Current time step number. |
| [in] | a_time | Current simulation time in seconds. |
| [in] | a_dt | Time step that was used. |
Implements TimeStepper.
|
overridevirtual |
Write plot data into the output holder.
| [in,out] | a_output | Output data holder. |
| [in,out] | a_icomp | Starting component index in a_output; incremented on return. |
| [in] | a_outputRealm | Realm that owns a_output. |
| [in] | a_level | AMR level to write. |
Implements TimeStepper.