chombo-discharge
Loading...
Searching...
No Matches
CD_Driver.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_DRIVER_H
14#define CD_DRIVER_H
15
16// Chombo includes
17#include <RefCountedPtr.H>
18
19// Our includes
21#include <CD_TimeStepper.H>
22#include <CD_AmrMesh.H>
23#include <CD_CellTagger.H>
25#include <CD_Initialize.H>
26#include <CD_NamespaceHeader.H>
27
32class Driver
33{
34public:
38 Driver() = delete;
39
51
55 virtual ~Driver();
56
60 void
62
63protected:
68
73
78
83
88
93
98
103
108
113
118
123
129
134
139
144
149
154
159
164
169
174
179
184
189
194
199
204
209
214
219
224
229
234
239
244
249
254
259
264
269
274
280
285
290
295
300
305
310
315
320
325
330
335
340
345
352 void
353 run(const Real a_startTime, const Real a_endTime, const int a_maxSteps);
354
362 void
364 const int a_initialRegrids,
365 const bool a_restart,
367
372 void
374
378 void
379 sanityCheck();
380
385 void
386 parseOptions();
387
392 void
394
399 void
401
405 void
407
412 void
414
419 void
421
425 void
427
431 void
433
438 void
439 cacheTags(const EBAMRTags& a_tags);
440
444 void
446
452 void
454
470 void
472 long long& a_numLocalCellsGhosts,
473 long long& a_numLocalBoxes,
474 long long& a_numTotalCells,
475 long long& a_numTotalCellsGhosts,
476 long long& a_numTotalBoxes,
481 const int& a_finestLevel,
483
487 void
488 gridReport();
489
490#ifdef CH_USE_HDF5
496 void
498#endif
499
506 void
507 regrid(const int a_lmin, const int a_lmax, const bool a_useInitialData);
508
514 void
516
521 void
523
528 void
530
535 void
537
542 void
543 setupFresh(const int a_initialRegrids);
544
548#ifdef CH_USE_HDF5
549 void
551#endif
552
556 void
558
563 void
565
572 void
573 stepReport(const Real a_startTime, const Real a_endTime, const int a_maxSteps);
574
579 void
581
585 void
587
592 void
594
599 void
601
606 void
608
613 void
615
619 void
621
625 void
627
631 void
633
634#ifdef CH_USE_HDF5
641 void
643#endif
644
645#ifdef CH_USE_HDF5
651 void
653#endif
654
655#ifdef CH_USE_HDF5
661 void
663#endif
664
665#ifdef CH_USE_HDF5
671 void
673#endif
674
675#ifdef CH_USE_HDF5
683 void
686 const std::string& a_realm,
687 const int a_level);
688#endif
689
693 void
695
702 bool
704
709 int
711
717 getPlotVariableNames() const;
718
726 virtual void
727 writePlotData(LevelData<EBCellFAB>& a_output, int& a_comp, const int a_level) const noexcept;
728
736 virtual void
737 writeTags(LevelData<EBCellFAB>& a_output, int& a_comp, const int a_level) const noexcept;
738
746 virtual void
747 writeRanks(LevelData<EBCellFAB>& a_output, int& a_comp, const int a_level) const noexcept;
748
757 virtual void
758 writeLevelset(LevelData<EBCellFAB>& a_output, int& a_comp, const int a_level) const noexcept;
759
767 virtual void
768 writeLoads(LevelData<EBCellFAB>& a_output, int& a_comp, const int a_level) const noexcept;
769
775 int
777
781 void
782 rebuildParmParse() const;
783};
784
785#include <CD_NamespaceFooter.H>
786
787#endif
Declaration of core class for handling AMR-related operations (with embedded boundaries)
Declaration of a base class for tagging cells across an AMR hierarchy.
Declaration of base class for defining geometries.
Vector< RefCountedPtr< LayoutData< DenseIntVectSet > > > EBAMRTags
Declaration of cell tags.
Definition CD_EBAMRTags.H:24
Declaration of the initialization functions for chombo-discharge.
Multi-fluid index space.
Declaration of main (abstract) time stepper class.
Main class for time/space advancement of streamer equations.
Definition CD_Driver.H:33
int m_restartStep
Restart step.
Definition CD_Driver.H:193
std::string m_geometryGeneration
Geometry generation method – can choose between native Chombo or chombo-discharge.
Definition CD_Driver.H:102
void checkRestartFile(const std::string &a_restartFile) const
Check if restart file exists and abort if not found.
Definition CD_Driver.cpp:1732
bool m_allowCoarsening
Allow grid coarsening.
Definition CD_Driver.H:294
int getFinestTagLevel(const EBAMRTags &a_cellTags) const
Return the finest AMR level that contains any cell tags.
Definition CD_Driver.cpp:1890
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 statistics about a DisjointBoxLaout. This will compute the number of grid cells and patches both ...
Definition CD_Driver.cpp:366
void cacheTags(const EBAMRTags &a_tags)
Cache tags for use after regrid.
Definition CD_Driver.cpp:188
void parseGeometryGeneration()
Parse option for geometry generation.
Definition CD_Driver.cpp:1207
int m_irregTagGrowth
Irregular tag growth.
Definition CD_Driver.H:122
void setupGeometryOnly()
Set for restart.
Definition CD_Driver.cpp:1404
int m_regridInterval
Regrid interval.
Definition CD_Driver.H:138
bool m_plotLevelset
Plot level sets.
Definition CD_Driver.H:344
int m_numPlotGhost
Number of ghost cells to plot.
Definition CD_Driver.H:188
std::string m_outputDirectory
Output directory for output files.
Definition CD_Driver.H:107
void writePreRegridFile()
Write a regrid file.
Definition CD_Driver.cpp:2185
virtual void writeLoads(LevelData< EBCellFAB > &a_output, int &a_comp, const int a_level) const noexcept
Write computational loads to output.
Definition CD_Driver.cpp:2515
std::string m_inputFile
Input file.
Definition CD_Driver.H:92
int m_plotInterval
Plot interval.
Definition CD_Driver.H:148
bool tagCells(Vector< IntVectSet > &a_allTags, EBAMRTags &a_cellTags)
Tag cells for refinement. Computes cell tags and global tags (union of cell tags with geometric tags)...
Definition CD_Driver.cpp:1919
EBAMRBool m_cachedTags
Cached tags. This is done so that when we regrid and change box ownership we can copy the tags around...
Definition CD_Driver.H:213
void setupFresh(const int a_initialRegrids)
Setup function for fresh (non-restart) simulations.
Definition CD_Driver.cpp:1492
void allocateInternals()
Allocate internal storage for Driver.
Definition CD_Driver.cpp:155
void stepReport(const Real a_startTime, const Real a_endTime, const int a_maxSteps)
Write a time step report to stdout.
Definition CD_Driver.cpp:1758
std::string m_outputFileNames
Prefix for all output files.
Definition CD_Driver.H:112
void parseIrregTagGrowth()
Parse irregular tag growth.
Definition CD_Driver.cpp:1192
RefCountedPtr< MultiFluidIndexSpace > m_multifluidIndexSpace
Index space.
Definition CD_Driver.H:67
Real m_wallClockTwo
MPI timer.
Definition CD_Driver.H:258
void rebuildParmParse() const
Rebuild Parmparse.
Definition CD_Driver.cpp:1022
void writeCrashFile()
Write a crash file.
Definition CD_Driver.cpp:2236
int m_verbosity
Verbosity.
Definition CD_Driver.H:117
void gridReport()
Print regrid report.
Definition CD_Driver.cpp:442
Driver()=delete
Weak constructor. Not allowed.
Real m_startTime
Simulation start time.
Definition CD_Driver.H:223
std::string m_realm
Name of realm where Driver allocates his data. This is always Realm::Primal.
Definition CD_Driver.H:97
void writeComputationalLoads()
Write computational loads.
Definition CD_Driver.cpp:2024
RefCountedPtr< AmrMesh > m_amr
AMR.
Definition CD_Driver.H:72
Real m_capacitance
Capacitance of the geometry (used for electrical energy calculations).
Definition CD_Driver.H:243
void writePlotFile()
Write a plot file. This writes to plt/.
Definition CD_Driver.cpp:2165
int getNumberOfPlotVariables() const
Get number of plot variables.
Definition CD_Driver.cpp:86
EBAMRTags m_tags
Tags.
Definition CD_Driver.H:208
void parseGeometryRefinement()
Parse geometrical refinement.
Definition CD_Driver.cpp:1225
void writeCheckpointFile()
Write a checkpoint file.
Definition CD_Driver.cpp:2555
void createOutputDirectories()
Create output directories.
Definition CD_Driver.cpp:1266
bool m_plotRanks
Plot MPI ranks.
Definition CD_Driver.H:334
int m_maxPlotLevel
Maximum plot depth.
Definition CD_Driver.H:173
Real m_refineAngle
Angle refinement threshold.
Definition CD_Driver.H:263
Real m_stopTime
Simulation stop time.
Definition CD_Driver.H:228
RefCountedPtr< TimeStepper > m_timeStepper
Time stepper.
Definition CD_Driver.H:82
RefCountedPtr< ComputationalGeometry > m_computationalGeometry
Geometry.
Definition CD_Driver.H:77
virtual void writeLevelset(LevelData< EBCellFAB > &a_output, int &a_comp, const int a_level) const noexcept
Write level sets.
Definition CD_Driver.cpp:2467
void getGeometryTags()
Get geometric tags.
Definition CD_Driver.cpp:230
bool m_writeRestartFiles
Write restart files or not.
Definition CD_Driver.H:289
Real m_time
Time.
Definition CD_Driver.H:238
Real m_wallClockOne
MPI timer.
Definition CD_Driver.H:253
void writeGeometry()
Write the geometry to file.
Definition CD_Driver.cpp:2111
int m_geoScanLevel
Geometry scan level.
Definition CD_Driver.H:128
void regridInternals(const int a_oldFinestLevel, const int a_newFinestLevel)
Regrid internal storage for this class.
Definition CD_Driver.cpp:721
bool m_geometryOnly
Geometry only.
Definition CD_Driver.H:319
void sanityCheck()
Sanity check.
Definition CD_Driver.cpp:1747
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_comp, const int a_level) const noexcept
Write internal plot data.
Definition CD_Driver.cpp:2365
Real m_wallClockStart
MPI timer.
Definition CD_Driver.H:248
void writePostRegridFile()
Write a regrid file.
Definition CD_Driver.cpp:2202
int m_geometricTagsDepth
Geometric tag depth.
Definition CD_Driver.H:153
void setCellTagger(const RefCountedPtr< CellTagger > &a_cellTagger)
Set the cell tagger.
Definition CD_Driver.cpp:1062
bool m_writeMemory
Write memory report.
Definition CD_Driver.H:304
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.
Definition CD_Driver.cpp:777
void parseRuntimeOptions()
Parse runtime options.
Definition CD_Driver.cpp:1125
bool m_profile
Profile or not.
Definition CD_Driver.H:268
int m_dielectricTagsDepth
Geometric tag depth for dielectrics.
Definition CD_Driver.H:163
bool m_needsNewGeometricTags
Special option for when geometric tags are changed during a simulation.
Definition CD_Driver.H:279
bool m_writeRegridFiles
Write regrid files or not.
Definition CD_Driver.H:284
int m_timeStep
Time step.
Definition CD_Driver.H:133
void setComputationalGeometry(const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry)
Set the computational geometry.
Definition CD_Driver.cpp:1035
void regrid(const int a_lmin, const int a_lmax, const bool a_useInitialData)
Do a regrid step.
Definition CD_Driver.cpp:610
int m_conductorTagsDepth
Geometric tag depth for conductors.
Definition CD_Driver.H:158
int m_maxSteps
Maximum number of steps.
Definition CD_Driver.H:168
bool m_plotLoads
Plot patch loads.
Definition CD_Driver.H:339
bool m_restart
Restart or not.
Definition CD_Driver.H:314
int m_growTags
Grow tagged cells.
Definition CD_Driver.H:198
void writeRestartFile()
Write a restart file.
Definition CD_Driver.cpp:2219
RefCountedPtr< CellTagger > m_cellTagger
Cell tagger.
Definition CD_Driver.H:87
void writeMemoryUsage()
Write the memory usage to file.
Definition CD_Driver.cpp:1986
virtual void writeTags(LevelData< EBCellFAB > &a_output, int &a_comp, const int a_level) const noexcept
Write cell tags to file.
Definition CD_Driver.cpp:2390
void parsePlotVariables()
Parse plot variables.
Definition CD_Driver.cpp:1155
Real m_outputDt
Time between outputs.
Definition CD_Driver.H:218
virtual ~Driver()
Destructor (does nothing)
Definition CD_Driver.cpp:80
Real m_dt
Time increment.
Definition CD_Driver.H:233
int m_initialRegrids
Number of initial regrids.
Definition CD_Driver.H:183
int m_checkpointInterval
Checkpoint interval.
Definition CD_Driver.H:143
bool m_ebisMemoryLoadBalance
Use memory as load balance for EBIS.
Definition CD_Driver.H:324
bool m_writeLoads
Write loads to file or not.
Definition CD_Driver.H:309
void parseOptions()
Parse options.
Definition CD_Driver.cpp:1077
bool m_doInitLoadBalancing
Do init load balancing.
Definition CD_Driver.H:299
virtual void writeRanks(LevelData< EBCellFAB > &a_output, int &a_comp, const int a_level) const noexcept
Write MPI ranks to output.
Definition CD_Driver.cpp:2439
bool m_doCoarsening
Turn on/off geometry coarsening below the base level.
Definition CD_Driver.H:273
void setupAndRun()
Setup and run simulations.
Definition CD_Driver.cpp:1000
int m_maxCheckpointDepth
Maximum plot depth.
Definition CD_Driver.H:178
Vector< std::string > getPlotVariableNames() const
Get the string identifiers for the internal plot variables from Driver.
Definition CD_Driver.cpp:112
Vector< IntVectSet > m_geomTags
Tags.
Definition CD_Driver.H:203
void setTimeStepper(const RefCountedPtr< TimeStepper > &a_timeStepper)
Set the time stepper.
Definition CD_Driver.cpp:1049
void setup(const std::string &a_inputFile, const int a_initialRegrids, const bool a_restart, const std::string &a_restartFile)
Setup function.
Definition CD_Driver.cpp:1358
void setAmr(const RefCountedPtr< AmrMesh > &a_amrMesh)
Set amr.
Definition CD_Driver.cpp:1344
bool m_plotTags
Plot tagged cells.
Definition CD_Driver.H:329
void writeEBIS()
Write the geometry to file.
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26