chombo-discharge
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Driver Class Reference

Main class for time/space advancement of streamer equations. More...

#include <CD_Driver.H>

Collaboration diagram for Driver:
Collaboration graph
[legend]

Public Member Functions

 Driver ()=delete
 Weak constructor. Not allowed.
 
 Driver (const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry, const RefCountedPtr< TimeStepper > &a_timeStepper, const RefCountedPtr< AmrMesh > &a_amr, const RefCountedPtr< CellTagger > &a_cellTagger=RefCountedPtr< CellTagger >(nullptr), const RefCountedPtr< GeoCoarsener > &a_geoCoarsen=RefCountedPtr< GeoCoarsener >(nullptr))
 Full constructor. More...
 
virtual ~Driver ()
 Destructor (does nothing)
 
void setupAndRun (const std::string a_inputFile)
 Setup and run simulations. More...
 
void run (const Real a_startTime, const Real a_endTime, const int a_maxSteps)
 Run a simulation for a specific time, or until a maximum number of steps have been performed. More...
 
void setup (const std::string a_inputFile, const int a_initialRegrids, const bool a_restart, const std::string a_restartFile)
 Setup function. More...
 

Protected Member Functions

void setAmr (const RefCountedPtr< AmrMesh > &a_amrMesh)
 Set amr. More...
 
void sanityCheck ()
 Sanity check.
 
void parseOptions ()
 Parse options. More...
 
void parseRuntimeOptions ()
 Parse runtime options. More...
 
void parseGeometryRefinement ()
 Parse geometrical refinement. More...
 
void parsePlotVariables ()
 Parse plot variables.
 
void parseGeometryGeneration ()
 Parse option for geometry generation. More...
 
void parseIrregTagGrowth ()
 Parse irregular tag growth. More...
 
void createOutputDirectories ()
 Create output directories.
 
void allocateInternals ()
 Allocate internal storage for Driver.
 
void cacheTags (const EBAMRTags &a_tags)
 Cache tags. This is used.
 
void writeEBIS ()
 Write the geometry to file.
 
void getGeometryTags ()
 Get geometric tags. More...
 
void getCellsAndBoxes (long long &a_numLocalCells, long long &a_numLocalCellsGhosts, long long &a_numLocalBoxes, long long &a_numTotalCells, long long &a_numTotalCellsGhosts, long long &a_numTotalBoxes, Vector< long long > &a_numLocalLevelBoxes, Vector< long long > &a_numTotalLevelBoxes, Vector< long long > &a_numLocalLevelCells, Vector< long long > &a_numTotalLevelCells, const int &a_finestLevel, const Vector< DisjointBoxLayout > &a_grids)
 Get statics about a DisjointBoxLaout. This will compute the number of grid cells and patches both locally and globally. More...
 
void gridReport ()
 Print regrid report.
 
void regrid (const int a_lmin, const int a_lmax, const bool a_useInitialData)
 Do a regrid step. More...
 
void regridInternals (const int a_oldFinestLevel, const int a_newFinestLevel)
 Regrid internal storage for this class. More...
 
void setComputationalGeometry (const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry)
 Set the computational geometry. More...
 
void setTimeStepper (const RefCountedPtr< TimeStepper > &a_timeStepper)
 Set the time stepper. More...
 
void setCellTagger (const RefCountedPtr< CellTagger > &a_cellTagger)
 Set the cell tagger. More...
 
void setGeoCoarsen (const RefCountedPtr< GeoCoarsener > &a_geoCoarsen)
 Set the geo coarsener. More...
 
void setupFresh (const int a_initialRegrids)
 Setup function.
 
void setupGeometryOnly ()
 Set for restart. More...
 
void checkRestartFile (const std::string a_restartFile) const
 Check if restart file exists.
 
void stepReport (const Real a_startTime, const Real a_endTime, const int a_maxSteps)
 Write a time step report.
 
void writePlotFile (const std::string a_filename)
 Write a plot file. More...
 
void writePlotFile ()
 Write a plot file. This writes to plt/.
 
void writePreRegridFile ()
 Write a regrid file. More...
 
void writePostRegridFile ()
 Write a regrid file. More...
 
void writeRestartFile ()
 Write a restart file. More...
 
void writeCrashFile ()
 Write a crash file. More...
 
void writeMemoryUsage ()
 Write the memory usage to file.
 
void writeComputationalLoads ()
 Write computational loads.
 
void writeCheckpointFile ()
 Write a checkpoint file.
 
void writeGeometry ()
 Write checkpoint data. More...
 
bool tagCells (Vector< IntVectSet > &a_allTags, EBAMRTags &a_cellTags)
 Tag cells for refinement. This computes cell tags and global tags (union of cell tags with geometric tags);.
 
int getNumberOfPlotVariables () const
 Get number of plot variables. More...
 
Vector< std::string > getPlotVariableNames () const
 Get the string identifiers for the internal plot variables from Driver.
 
virtual void writePlotData (LevelData< EBCellFAB > &a_output, int &a_comp, const int a_level) const noexcept
 Write internal plot data. More...
 
virtual void writeTags (LevelData< EBCellFAB > &a_output, int &a_comp, const int a_level) const noexcept
 Write cell tags to file. More...
 
virtual void writeRanks (LevelData< EBCellFAB > &a_output, int &a_comp, const int a_level) const noexcept
 Write MPI ranks to output. More...
 
virtual void writeLevelset (LevelData< EBCellFAB > &a_output, int &a_comp, const int a_level) const noexcept
 Write level sets. More...
 
virtual void writeLoads (LevelData< EBCellFAB > &a_output, int &a_comp, const int a_level) const noexcept
 Write computational loads to output. More...
 
int getFinestTagLevel (const EBAMRTags &a_cellTags) const
 Return the finest tag level.
 
void rebuildParmParse () const
 Rebuild Parmparse.
 

Protected Attributes

RefCountedPtr< MultiFluidIndexSpacem_multifluidIndexSpace
 Index space.
 
RefCountedPtr< AmrMeshm_amr
 AMR.
 
RefCountedPtr< ComputationalGeometrym_computationalGeometry
 Geometry.
 
RefCountedPtr< TimeStepperm_timeStepper
 Time stepper.
 
RefCountedPtr< CellTaggerm_cellTagger
 Cell tagger.
 
RefCountedPtr< GeoCoarsenerm_geoCoarsen
 Geometric coarsener.
 
std::string m_inputFile
 Input file.
 
std::string m_realm
 Name of realm where Driver allocates his data. This is always Realm::Primal.
 
std::string m_geometryGeneration
 Geometry generation method – can choose between native Chombo or chombo-discharge.
 
std::string m_outputDirectory
 Output directory for output files.
 
std::string m_outputFileNames
 Prefix for all output files.
 
int m_verbosity
 Verbosity.
 
int m_irregTagGrowth
 Irregular tag growth.
 
int m_geoScanLevel
 Geometry scan level. More...
 
int m_timeStep
 Time step.
 
int m_regridInterval
 Regrid interval.
 
int m_checkpointInterval
 Checkpoint interval.
 
int m_plotInterval
 Plot interval.
 
int m_geometricTagsDepth
 Geometric tag depth.
 
int m_conductorTagsDepth
 Geometric tag depth for conductors.
 
int m_dielectricTagsDepth
 Geometric tag depth for dielectrics.
 
int m_maxSteps
 Maximum number of steps.
 
int m_maxPlotLevel
 Maximum plot depth.
 
int m_maxCheckpointDepth
 Maximum plot depth.
 
int m_initialRegrids
 Number of initial regrids.
 
int m_numPlotGhost
 Number of ghost cells to plot.
 
int m_restartStep
 Restart step.
 
int m_growTags
 Grow tagged cells.
 
Vector< IntVectSet > m_geomTags
 Tags.
 
EBAMRTags m_tags
 Tags.
 
EBAMRBool m_cachedTags
 Cached tags. This is done so that when we regrid and change box ownership we can copy the tags around.
 
Real m_outputDt
 Time between outputs.
 
Real m_startTime
 Simulation start time.
 
Real m_stopTime
 Simulation stop time.
 
Real m_dt
 Time increment.
 
Real m_time
 Time.
 
Real m_capacitance
 
Real m_wallClockStart
 MPI timer.
 
Real m_wallClockOne
 MPI timer.
 
Real m_wallClockTwo
 MPI timer.
 
Real m_refineAngle
 Angle refinement threshold.
 
bool m_profile
 Profile or not.
 
bool m_doCoarsening
 Turn on/off geometry coarsening below the base level.
 
bool m_needsNewGeometricTags
 Special option for when geometric tags are changed during a simulation. More...
 
bool m_writeRegridFiles
 Write regrid files or not.
 
bool m_writeRestartFiles
 Write restart files or not.
 
bool m_allowCoarsening
 Allow grid coarsening.
 
bool m_doInitLoadBalancing
 Do init load balancing.
 
bool m_writeMemory
 Write memory report.
 
bool m_writeLoads
 Write loads to file or not.
 
bool m_restart
 Restart or not.
 
bool m_geometryOnly
 Geometry only.
 
bool m_ebisMemoryLoadBalance
 Use memory as load balance for EBIS.
 
bool m_plotTags
 Plot tagged cells.
 
bool m_plotRanks
 Plot MPI ranks.
 
bool m_plotLoads
 Plot patch loads.
 
bool m_plotLevelset
 Plot level sets.
 

Detailed Description

Main class for time/space advancement of streamer equations.

This class runs a simulation and controls input/output, regrid intervals etc.

Constructor & Destructor Documentation

◆ Driver()

Driver::Driver ( const RefCountedPtr< ComputationalGeometry > &  a_computationalGeometry,
const RefCountedPtr< TimeStepper > &  a_timeStepper,
const RefCountedPtr< AmrMesh > &  a_amr,
const RefCountedPtr< CellTagger > &  a_cellTagger = RefCountedPtr<CellTagger>(nullptr),
const RefCountedPtr< GeoCoarsener > &  a_geoCoarsen = RefCountedPtr<GeoCoarsener>(nullptr) 
)

Full constructor.

Parameters
[in]a_computationalGeometryComputational geometry.
[in]a_TimeStepperThe time stepper
[in]a_amrAmrMesh core class.
[in]a_cellTaggerCell tagger which flags cell for refinement.
[in]a_geoCoarsengeo_coarsen class which can remove tags along the geometry.

Member Function Documentation

◆ getCellsAndBoxes()

void Driver::getCellsAndBoxes ( long long &  a_numLocalCells,
long long &  a_numLocalCellsGhosts,
long long &  a_numLocalBoxes,
long long &  a_numTotalCells,
long long &  a_numTotalCellsGhosts,
long long &  a_numTotalBoxes,
Vector< long long > &  a_numLocalLevelBoxes,
Vector< long long > &  a_numTotalLevelBoxes,
Vector< long long > &  a_numLocalLevelCells,
Vector< long long > &  a_numTotalLevelCells,
const int &  a_finestLevel,
const Vector< DisjointBoxLayout > &  a_grids 
)
protected

Get statics about a DisjointBoxLaout. This will compute the number of grid cells and patches both locally and globally.

Parameters
[out]a_numLocalCellsLocal number of grid cells, excluding ghost cells.
[out]a_numLocalCellsGhostsLocal number of grid cells, including ghost cells.
[out]a_numLocalBoxLocal number of grid patches (over all levels)
[out]a_numTotalCellsTotal number of grid cells, excluding ghost cells.
[out]a_numTotalCellsGhostsTotal number of grid cells, including ghost cells.
[out]a_numTotalBoxTotal number of grid patches
[out]a_numLocalLevelBoxesLocal number of grid boxes (per level)
[out]a_numTotalLevelBoxesTotal number of grid boxes (per level)
[out]a_numLocalLevelCellsLocal number of grid cells (per level)
[out]a_numTotalLevelCellsTotal number of grid cells (per level)
[in]a_finestLevelFinest AMR level
[in]a_gridsInput grids

◆ getGeometryTags()

void Driver::getGeometryTags ( )
protected

Get geometric tags.

This fills m_geomTags with irregular cell tags, using information that was passed into Driver from the input script. This includes adding tags that refine surfaces to a certain depth, or tags where the curvature of the surface exceeds a specified value.

◆ getNumberOfPlotVariables()

int Driver::getNumberOfPlotVariables ( ) const
protected

Get number of plot variables.

Returns
Returns the number of internal plot variables that Driver will write to file.

◆ parseGeometryGeneration()

void Driver::parseGeometryGeneration ( )
protected

Parse option for geometry generation.

This sets the geometry-generation load balancing method to either use Chombo or chombo-discharge.

◆ parseGeometryRefinement()

void Driver::parseGeometryRefinement ( )
protected

Parse geometrical refinement.

This parses settings for how deep to refine geometries, either based on curvature or a hard limit for electrodes/dielectrics.

◆ parseIrregTagGrowth()

void Driver::parseIrregTagGrowth ( )
protected

Parse irregular tag growth.

This parses m_irregTagGrowth, which is used to grow cut-cell tags.

◆ parseOptions()

void Driver::parseOptions ( )
protected

Parse options.

Called at the beginning of the simulation.

◆ parseRuntimeOptions()

void Driver::parseRuntimeOptions ( )
protected

Parse runtime options.

Called every time step.

◆ regrid()

void Driver::regrid ( const int  a_lmin,
const int  a_lmax,
const bool  a_useInitialData 
)
protected

Do a regrid step.

Parameters
[in]a_lminCoarsest level that is allowed to change during regrid
[in]a_lmaxFinest level that can be generated during the regrid step.
[in]a_useInitialDataIf true, fill solvers with initial data after making the new grids.

◆ regridInternals()

void Driver::regridInternals ( const int  a_oldFinestLevel,
const int  a_newFinestLevel 
)
protected

Regrid internal storage for this class.

Parameters
[in]a_oldFinestLevelFinest level before the regrid
[in]a_newFinestLevelFinest level before the regrid

◆ run()

void Driver::run ( const Real  a_startTime,
const Real  a_endTime,
const int  a_maxSteps 
)

Run a simulation for a specific time, or until a maximum number of steps have been performed.

Parameters
[in]a_startTimeStarting time of simulation
[in]a_endTimeSimulation end time
[in]a_maxStepsMaximum number of steps.

◆ setAmr()

void Driver::setAmr ( const RefCountedPtr< AmrMesh > &  a_amrMesh)
protected

Set amr.

Parameters
[in]a_amrMeshAmrMesh

◆ setCellTagger()

void Driver::setCellTagger ( const RefCountedPtr< CellTagger > &  a_cellTagger)
protected

Set the cell tagger.

Parameters
[in]a_cellTaggerCell tagger

◆ setComputationalGeometry()

void Driver::setComputationalGeometry ( const RefCountedPtr< ComputationalGeometry > &  a_computationalGeometry)
protected

Set the computational geometry.

Parameters
[in]a_computationalGeometryComputational geometry

◆ setGeoCoarsen()

void Driver::setGeoCoarsen ( const RefCountedPtr< GeoCoarsener > &  a_geoCoarsen)
protected

Set the geo coarsener.

Parameters
[in]a_geoCoarsenCoarsener for cut-cell tags.

◆ setTimeStepper()

void Driver::setTimeStepper ( const RefCountedPtr< TimeStepper > &  a_timeStepper)
protected

Set the time stepper.

Parameters
[in]a_timeStepperTime stepper

◆ setup()

void Driver::setup ( const std::string  a_inputFile,
const int  a_initialRegrids,
const bool  a_restart,
const std::string  a_restartFile 
)

Setup function.

Parameters
[in]a_inputFileInput file containing all tunable simulation parameters.
[in]a_initialRegridsNumber of initial regrids to perform
[in]a_restartDo a restart or not
[in]a_restartFileName of restart file (if restarting from a previous time step)

◆ setupAndRun()

void Driver::setupAndRun ( const std::string  a_inputFile)

Setup and run simulations.

Parameters
[in]a_inputFileInput file containing parameters for the simulation.

◆ setupGeometryOnly()

void Driver::setupGeometryOnly ( )
protected

Set for restart.

Set up for geometry only

◆ writeCrashFile()

void Driver::writeCrashFile ( )
protected

Write a crash file.

This writes a regular plot file to /crash

◆ writeGeometry()

void Driver::writeGeometry ( )
protected

Write checkpoint data.

Read Realm loads.

Write the geometry to file.

◆ writeLevelset()

void Driver::writeLevelset ( LevelData< EBCellFAB > &  a_output,
int &  a_comp,
const int  a_level 
) const
protectedvirtualnoexcept

Write level sets.

Parameters
[in,out]a_outputOutput data holder
[in,out]a_compStarting component

This adds data to a_output where the cell-centered data is the level-set value.

Note
This writes directly to a_output.

◆ writeLoads()

void Driver::writeLoads ( LevelData< EBCellFAB > &  a_output,
int &  a_comp,
const int  a_level 
) const
protectedvirtualnoexcept

Write computational loads to output.

Parameters
[in,out]a_outputOutput data holder
[in,out]a_compStarting component
[in]a_levelAMR level

This adds data to a_output where the data in each grid patch is the MPI rank.

◆ writePlotData()

void Driver::writePlotData ( LevelData< EBCellFAB > &  a_output,
int &  a_comp,
const int  a_level 
) const
protectedvirtualnoexcept

Write internal plot data.

Parameters
[in,out]a_outputOutput data holder
[in,out]a_compStarting component
[in]a_levelAMR level

This will copy Driver's plot data into a_output, starting on component a_comp.

◆ writePlotFile()

void Driver::writePlotFile ( const std::string  a_filename)
protected

Write a plot file.

Parameters
[in]a_fileFile name

This can write an arbitrary folder. E.g. filename = /crash/abc.hdf5

◆ writePostRegridFile()

void Driver::writePostRegridFile ( )
protected

Write a regrid file.

This writes a regular plot file to /regrid

◆ writePreRegridFile()

void Driver::writePreRegridFile ( )
protected

Write a regrid file.

This writes a regular plot file to /regrid

◆ writeRanks()

void Driver::writeRanks ( LevelData< EBCellFAB > &  a_output,
int &  a_comp,
const int  a_level 
) const
protectedvirtualnoexcept

Write MPI ranks to output.

Parameters
[in,out]a_outputOutput data holder
[in,out]a_compStarting component
[in]a_levelAMR level

This adds data to a_output where the data in each grid patch is the MPI rank.

◆ writeRestartFile()

void Driver::writeRestartFile ( )
protected

Write a restart file.

This writes a regular plot file to /restart

◆ writeTags()

void Driver::writeTags ( LevelData< EBCellFAB > &  a_output,
int &  a_comp,
const int  a_level 
) const
protectedvirtualnoexcept

Write cell tags to file.

Parameters
[in,out]a_outputOutput data holder
[in,out]a_compStarting component
[in]a_levelAMR level

This will write cell tags data into a_output, starting on component a_comp.

Member Data Documentation

◆ m_geoScanLevel

int Driver::m_geoScanLevel
protected

Geometry scan level.

This is a special option for when we use chombo-discharge's geometry generation method.

◆ m_needsNewGeometricTags

bool Driver::m_needsNewGeometricTags
protected

Special option for when geometric tags are changed during a simulation.

This becomes = true in parseGeometryRefinement every time the geometric refinement criteria changed, and it always becomes false after a regrid.


The documentation for this class was generated from the following files: