chombo-discharge
CD_ItoSolver.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_ItoSolver_H
13 #define CD_ItoSolver_H
14 
15 // Our includes
16 #include <CD_AmrMesh.H>
18 #include <CD_ItoSpecies.H>
19 #include <CD_ItoParticle.H>
20 #include <CD_EBParticleMesh.H>
21 #include <CD_ParticleContainer.H>
22 #include <CD_EBRepresentation.H>
23 #include <CD_EBIntersection.H>
24 #include <CD_CellInfo.H>
25 #include <CD_ParticleManagement.H>
26 #include <CD_NamespaceHeader.H>
27 
34 class ItoSolver
35 {
36 public:
48  enum class WhichContainer
49  {
50  Bulk,
51  EB,
52  Domain,
53  Source,
54  Covered,
55  Scratch
56  };
57 
61  ItoSolver();
62 
66  virtual ~ItoSolver();
67 
72  virtual void
74 
79  virtual std::string
80  getName() const;
81 
86  virtual const std::string
87  getRealm() const;
88 
93  virtual void
94  setRealm(const std::string a_realm);
95 
99  virtual void
100  parseOptions();
101 
105  virtual void
107 
111  virtual EBIntersection
112  getIntersectionAlgorithm() const noexcept;
113 
118  virtual void
119  initialData();
120 
127  virtual void
128  regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel);
129 
135  virtual void
136  allocate();
137 
142  virtual void
143  clear(const WhichContainer a_container);
144 
149  virtual void
150  clear(ParticleContainer<ItoParticle>& a_particles) const;
151 
156  virtual void
157  clear(AMRParticles<ItoParticle>& a_particles) const;
158 
165  virtual void
166  depositConductivity(EBAMRCellData& a_phi, ParticleContainer<ItoParticle>& a_particles) const;
167 
176  virtual void
178  ParticleContainer<ItoParticle>& a_particles,
179  const DepositionType a_deposition,
180  const CoarseFineDeposition a_coarseFineDeposition) const;
181 
189  virtual void
190  depositDiffusivity(EBAMRCellData& a_phi, ParticleContainer<ItoParticle>& a_particles) const;
191 
200  virtual void
202  ParticleContainer<ItoParticle>& a_particles,
203  const DepositionType a_deposition,
204  const CoarseFineDeposition a_coarseFineDeposition) const;
205 
213  virtual void
215 
224  virtual void
226  ParticleContainer<ItoParticle>& a_particles,
227  const DepositionType a_deposition,
228  const CoarseFineDeposition a_coarseFineDeposition) const;
229 
236  virtual void
238 
245  virtual void
247 
254  virtual void
256 
262  virtual void
264 
271  virtual void
272  depositParticles(const WhichContainer a_container);
273 
280  template <class P, const Real& (P ::*particleScalarField)() const>
281  void
282  depositParticlesNGP(LevelData<EBCellFAB>& a_output,
283  const ParticleContainer<P>& a_particles,
284  const int a_level) const noexcept;
285 
292  template <class P, Real (P ::*particleScalarField)() const>
293  void
294  depositParticlesNGP(LevelData<EBCellFAB>& a_output,
295  const ParticleContainer<P>& a_particles,
296  const int a_level) const noexcept;
297 
305  template <class P, const Real& (P::*particleScalarField)() const>
306  void
307  depositParticles(EBAMRCellData& a_phi, ParticleContainer<P>& a_particles) const;
308 
318  template <class P, const Real& (P::*particleScalarField)() const>
319  void
321  ParticleContainer<P>& a_particles,
322  const DepositionType a_deposition,
323  const CoarseFineDeposition a_coarseFineDeposition) const;
324 
333  template <class P, Real (P::*particleScalarField)() const>
334  void
336  ParticleContainer<P>& a_particles,
337  const DepositionType a_deposition,
338  const CoarseFineDeposition a_coarseFineDeposition) const;
339 
346  virtual void
347  removeCoveredParticles(const EBRepresentation a_representation, const Real a_tol);
348 
356  virtual void
357  removeCoveredParticles(const WhichContainer a_container, const EBRepresentation a_representation, const Real a_tol);
358 
365  virtual void
367  const EBRepresentation a_representation,
368  const Real a_tol) const;
369 
376  virtual void
377  transferCoveredParticles(const EBRepresentation a_representation, const Real a_tol);
378 
386  virtual void
387  transferCoveredParticles(const WhichContainer a_containerFrom,
388  const WhichContainer a_containerTo,
389  const EBRepresentation a_representation,
390  const Real a_tol);
391 
399  virtual void
401  ParticleContainer<ItoParticle>& a_particlesTo,
402  const EBRepresentation a_representation,
403  const Real a_tol) const;
404 
414  virtual void
416  const EBIntersection a_ebIntersection,
417  const bool a_deleteParticles,
418  const std::function<void(ItoParticle&)> a_nonDeletionModifier = [](ItoParticle&) -> void {
419  return;
420  });
421 
434  virtual void
436  const WhichContainer a_particles,
437  const WhichContainer a_ebParticles,
438  const WhichContainer a_domainParticles,
439  const EBIntersection a_ebIntersection,
440  const bool a_deleteParticles,
441  const std::function<void(ItoParticle&)> a_nonDeletionModifier = [](ItoParticle&) -> void {
442  return;
443  });
444 
456  virtual void
458  ParticleContainer<ItoParticle>& a_particles,
459  ParticleContainer<ItoParticle>& a_ebParticles,
460  ParticleContainer<ItoParticle>& a_domainParticles,
461  const EBIntersection a_ebIntersection,
462  const bool a_deleteParticles,
463  const std::function<void(ItoParticle&)> a_nonDeletionModifier = [](ItoParticle&) -> void {
464  return;
465  });
466 
473  virtual void
474  computeLoads(Vector<long int>& a_loads, const DisjointBoxLayout& a_dbl, const int a_level);
475 
480  virtual int
481  getNumberOfPlotVariables() const;
482 
487  virtual Vector<std::string>
488  getPlotVariableNames() const;
489 
498  virtual void
499  writePlotData(LevelData<EBCellFAB>& a_output,
500  int& a_comp,
501  const std::string a_outputRealm,
502  const int a_level) const noexcept;
503 
509  virtual unsigned long long
510  getNumParticles(const WhichContainer a_container, const bool a_localOnly) const;
511 
516  virtual void
517  registerOperators() const;
518 
523  virtual void
524  setComputationalGeometry(const RefCountedPtr<ComputationalGeometry>& a_computationalGeometry);
525 
530  virtual void
531  setAmr(const RefCountedPtr<AmrMesh>& a_amr);
532 
537  virtual void
538  setPhase(const phase::which_phase a_phase);
539 
544  virtual void
545  setVerbosity(const int a_verbosity);
546 
554  virtual void
555  setTime(const int a_step, const Real a_time, const Real a_dt);
556 
557 #ifdef CH_USE_HDF5
565  virtual void
566  writeCheckpointLevel(HDF5Handle& a_handle, const int a_level) const;
567 #endif
568 
569 #ifdef CH_USE_HDF5
576  virtual void
577  readCheckpointLevel(HDF5Handle& a_handle, const int a_level);
578 #endif
579 
584  virtual void
585  setSpecies(const RefCountedPtr<ItoSpecies>& a_species);
586 
593  virtual void
594  preRegrid(const int a_lbase, const int a_oldFinestLevel);
595 
603  template <ItoSolver::WhichContainer C = WhichContainer::Bulk>
604  void
605  addParticles(ListBox<ItoParticle>& a_inputParticles,
606  const int a_lvl,
607  const DataIndex a_dit,
608  const bool a_destructive);
609 
614  virtual bool
615  isMobile() const;
616 
621  virtual bool
622  isDiffusive() const;
623 
629  getParticles(const WhichContainer a_container);
630 
635  virtual const ParticleContainer<ItoParticle>&
636  getParticles(const WhichContainer a_container) const;
637 
642  virtual const RefCountedPtr<ItoSpecies>&
643  getSpecies() const;
644 
649  virtual EBAMRCellData&
650  getPhi();
651 
656  virtual EBAMRCellData&
658 
663  virtual const EBAMRCellData&
664  getVelocityFunction() const;
665 
670  virtual EBAMRCellData&
672 
677  virtual const EBAMRCellData&
678  getDiffusionFunction() const;
679 
684  virtual EBAMRCellData&
686 
691  virtual const EBAMRCellData&
692  getMobilityFunction() const;
693 
698  virtual void
699  setDiffusionFunction(const Real a_diffusionCoefficient);
700 
705  virtual void
706  setVelocityFunction(const RealVect a_velocity);
707 
712  virtual void
713  setParticleMobility(const Real a_mobility);
714 
719  virtual void
720  setParticleDiffusion(const Real a_diffusion);
721 
727  virtual void
729 
737  virtual void
738  interpolateVelocities(const int a_level, const DataIndex& a_dit);
739 
744  virtual void
746 
751  virtual void
753 
758  virtual void
760 
765  virtual void
766  updateDiffusion();
767 
772  virtual void
773  organizeParticlesByCell(const WhichContainer a_container);
774 
779  virtual void
780  organizeParticlesByPatch(const WhichContainer a_container);
781 
787  virtual void
788  makeSuperparticles(const WhichContainer a_container, const int a_particlesPerCell);
789 
795  virtual void
796  makeSuperparticles(const WhichContainer a_container, const Vector<int> a_particlesPerCell);
797 
804  virtual void
805  makeSuperparticles(const WhichContainer a_container, const int a_particlesPerCell, const int a_level);
806 
814  virtual void
815  makeSuperparticles(const WhichContainer a_container,
816  const int a_particlesPerCell,
817  const int a_level,
818  const DataIndex a_dit);
819 
826  virtual void
827  mergeParticles(List<ItoParticle>& a_particles,
828  const CellInfo& a_cellInfo,
829  const int a_particlesPerCell) const noexcept;
830 
837  virtual void
838  makeSuperparticlesEqualWeightKD(List<ItoParticle>& a_particles,
839  const CellInfo& a_cellInfo,
840  const int a_particlesPerCell) const noexcept;
841 
848  virtual void
849  reinitializeParticles(List<ItoParticle>& a_particles,
850  const CellInfo& a_cellInfo,
851  const int a_particlesPerCell) const noexcept;
852 
856  virtual void
857  remap();
858 
863  virtual void
864  remap(const WhichContainer a_container);
865 
869  virtual void
870  remapAll();
871 
876  inline RealVect
877  randomGaussian() const;
878 
883  inline RealVect
885 
894  virtual Real
895  computeDt() const;
896 
906  virtual Real
907  computeDt(const int a_lvl) const;
908 
919  virtual Real
920  computeDt(const int a_lvl, const DataIndex& a_dit) const;
921 
933  virtual Real
934  computeHopDt(const Real a_maxCellsToMove) const;
935 
948  virtual Real
949  computeHopDt(const Real a_maxCellsToMove, const int a_lvl) const;
950 
964  virtual Real
965  computeHopDt(const Real a_maxCellsToMove, const int a_lvl, const DataIndex& a_dit) const;
966 
970  virtual Real
971  computeAdvectiveDt() const;
972 
977  virtual Real
978  computeAdvectiveDt(const int a_lvl) const;
979 
985  virtual Real
986  computeAdvectiveDt(const int a_lvl, const DataIndex& a_dit) const;
987 
991  virtual Real
992  computeDiffusiveDt() const;
993 
998  virtual Real
999  computeDiffusiveDt(const int a_lvl) const;
1000 
1006  virtual Real
1007  computeDiffusiveDt(const int a_lvl, const DataIndex& a_dit) const;
1008 
1014  getDeposition() const;
1015 
1020  getCoarseFineDeposition() const;
1021 
1026  phase::which_phase
1027  getPhase() const;
1028 
1029 protected:
1033  static constexpr int m_comp = 0;
1034 
1038  static constexpr int m_nComp = 1;
1039 
1044  enum class WhichCheckpoint
1045  {
1046  Particles,
1047  Numbers
1048  };
1049 
1056  {
1057  Direct,
1058  Velocity
1059  };
1060 
1065 
1070 
1075 
1080 
1084  std::string m_realm;
1085 
1089  RefCountedPtr<ComputationalGeometry> m_computationalGeometry;
1090 
1094  RefCountedPtr<AmrMesh> m_amr;
1095 
1099  RefCountedPtr<ItoSpecies> m_species;
1100 
1104  phase::which_phase m_phase;
1105 
1109  std::string m_name;
1110 
1115  std::string m_className;
1116 
1122 
1127 
1132 
1137 
1142 
1146  Real m_time;
1147 
1151  Real m_dt;
1152 
1157 
1162 
1167 
1172 
1177 
1182 
1187 
1192 
1197 
1202 
1207 
1212 
1217 
1222 
1227 
1232 
1237 
1242 
1247 
1252 
1257 
1262 
1267 
1272 
1277 
1282 
1286  std::map<WhichContainer, ParticleContainer<ItoParticle>> m_particleContainers;
1287 
1292 
1296  void
1297  parseRNG();
1298 
1302  void
1303  parseTruncation();
1304 
1308  void
1309  parseDeposition();
1310 
1314  void
1316 
1320  void
1322 
1326  void
1327  parseVerbosity();
1328 
1332  void
1334 
1338  void
1340 
1344  void
1346 
1350  void
1352 
1356  void
1358 
1359 #ifdef CH_USE_HDF5
1368  virtual void
1369  writeCheckPointLevelParticles(HDF5Handle& a_handle, const int a_level) const;
1370 #endif
1371 
1372 #ifdef CH_USE_HDF5
1380  virtual void
1381  writeCheckPointLevelFluid(HDF5Handle& a_handle, const int a_level) const;
1382 #endif
1383 
1384 #ifdef CH_USE_HDF5
1391  virtual void
1392  readCheckpointLevelParticles(HDF5Handle& a_handle, const int a_level);
1393 #endif
1394 
1395 #ifdef CH_USE_HDF5
1402  virtual void
1403  readCheckpointLevelFluid(HDF5Handle& a_handle, const int a_level);
1404 #endif
1405 
1413  void
1414  drawNewParticles(const LevelData<EBCellFAB>& a_particlesPerCell, const int a_level, const int a_newPPC);
1415 
1425  template <class P, const Real& (P::*particleScalarField)() const>
1426  void
1428  ParticleContainer<P>& a_particles,
1429  const DepositionType a_deposition,
1430  const CoarseFineDeposition a_coarseFineDeposition) const;
1431 
1440  template <class P, Real (P::*particleScalarField)() const>
1441  void
1443  ParticleContainer<P>& a_particles,
1444  const DepositionType a_deposition,
1445  const CoarseFineDeposition a_coarseFineDeposition) const;
1446 
1456  virtual void
1457  redistributeAMR(EBAMRCellData& a_phi) const;
1458 
1464  virtual void
1465  depositNonConservative(EBAMRIVData& a_depositionNC, const EBAMRCellData& a_depositionKappaC) const;
1466 
1473  virtual void
1474  depositHybrid(EBAMRCellData& a_depositionH, EBAMRIVData& a_massDifference, const EBAMRIVData& a_depositionNC) const;
1475 
1482  virtual void
1483  interpolateMobilities(const int a_level, const DataIndex& a_dit, const EBCellFAB& a_velocityMagnitude) noexcept;
1484 
1490  virtual void
1491  interpolateMobilitiesDirect(const int a_level, const DataIndex& a_dit) noexcept;
1492 
1499  virtual void
1500  interpolateMobilitiesVelocity(const int a_level,
1501  const DataIndex& a_dit,
1502  const EBCellFAB& a_velocityMagnitude) noexcept;
1503 
1510  virtual void
1511  updateMobilities(const int a_level, const DataIndex a_dit);
1512 
1519  virtual void
1520  interpolateDiffusion(const int a_level, const DataIndex& a_dit);
1521 
1528  virtual void
1529  updateDiffusion(const int a_level, const DataIndex a_dit);
1530 
1541  virtual void
1542  writeData(LevelData<EBCellFAB>& a_output,
1543  int& a_comp,
1544  const EBAMRCellData& a_data,
1545  const std::string a_outputRealm,
1546  const int a_level,
1547  const bool a_interpToCentroids,
1548  const bool a_interpGhost) const noexcept;
1549 };
1550 
1551 #include <CD_NamespaceFooter.H>
1552 
1553 #include <CD_ItoSolverImplem.H>
1554 
1555 #endif
Declaration of core class for handling AMR-related operations (with embedded boundaries)
Simple class for holding some quantities relevant in a grid cell.
CoarseFineDeposition
Coarse-fine deposition types (see CD_EBAMRParticleMesh for how these are handled).
Definition: CD_CoarseFineDeposition.H:26
Declaration of base class for defining geometries.
DepositionType
Deposition types.
Definition: CD_DepositionType.H:23
Enum for putting some logic into EB intersection tests.
EBIntersection
Enum for putting some logic into how we think about intersection between particles and EBs.
Definition: CD_EBIntersection.H:21
Declaration of a class for handling particle-mesh interpolation and deposition.
Enum for putting some logic into EB intersection tests.
EBRepresentation
Enum for putting some logic into how we think about EBs. This is just a simply supporting class for v...
Definition: CD_EBRepresentation.H:22
Declaration of a particle class for Ito diffusion.
Implementation of CD_ItoSolver.H.
Declaration of an ItoSpecies class that passes in names and initial data to ItoSolvers.
Declaration of a class for holding particles on an AMR hierarchy.
Vector< RefCountedPtr< ParticleData< P > >> AMRParticles
Alias for ParticleData on each AMR level.
Definition: CD_ParticleContainer.H:34
Namespace containing various particle management utilities.
Class for the cell-information that is often queried when merging particles inside a cell.
Definition: CD_CellInfo.H:25
A particle class for use with ItoSolvers, i.e. drifting Brownian walkers.
Definition: CD_ItoParticle.H:40
Base class for Ito diffusion particle models.
Definition: CD_ItoSolver.H:35
virtual void computeAverageEnergy(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Compute average particle energy..
Definition: CD_ItoSolver.cpp:1724
RealVect randomDirection() const
Draw a random direction in N-dimensional space.
virtual void makeSuperparticlesEqualWeightKD(List< ItoParticle > &a_particles, const CellInfo &a_cellInfo, const int a_particlesPerCell) const noexcept
Superparticle merging with KD/BVH trees.
Definition: CD_ItoSolver.cpp:3107
virtual void interpolateMobilities()
Interpolate mobilities.
Definition: CD_ItoSolver.cpp:2137
WhichContainer
Enum class for distinguishing various types of particle containers.
Definition: CD_ItoSolver.H:49
phase::which_phase getPhase() const
Return phase.
Definition: CD_ItoSolver.cpp:2952
void parseDiffusionHop()
Parse diffusion hop.
CoarseFineDeposition m_coarseFineDeposition
Coarse-fine deposition strategy.
Definition: CD_ItoSolver.H:1246
bool m_plotPhi
Flag for outputting m_phi to plot files.
Definition: CD_ItoSolver.H:1191
virtual void organizeParticlesByCell(const WhichContainer a_container)
Sort the input particle container by cell.
Definition: CD_ItoSolver.cpp:2958
virtual Vector< std::string > getPlotVariableNames() const
Get output plot names.
Definition: CD_ItoSolver.cpp:1345
virtual void transferCoveredParticles(const EBRepresentation a_representation, const Real a_tol)
Transfer particles that are covered (within a_tol distance from EB) to another container.
Definition: CD_ItoSolver.cpp:661
virtual void setSpecies(const RefCountedPtr< ItoSpecies > &a_species)
Set the species.
Definition: CD_ItoSolver.cpp:865
EBAMRCellData m_diffusionFunction
Diffusion-centerer field used for interpolating diffusion coefficients.
Definition: CD_ItoSolver.H:1271
virtual void registerOperators() const
Register operators.
Definition: CD_ItoSolver.cpp:484
virtual void depositParticles()
Deposit particles onto mesh.
Definition: CD_ItoSolver.cpp:1752
CoarseFineDeposition getCoarseFineDeposition() const
Get the coarse-fine deposition strategy.
Definition: CD_ItoSolver.cpp:2946
bool m_plotEnergyDensity
Flag for plotting the energy density on the mesh.
Definition: CD_ItoSolver.H:1231
void depositKappaConservative(EBAMRCellData &a_phi, ParticleContainer< P > &a_particles, const DepositionType a_deposition, const CoarseFineDeposition a_coarseFineDeposition) const
Compute the cell-centered deposition – this is the main deposition function.
Definition: CD_ItoSolverImplem.H:221
virtual void depositNonConservative(EBAMRIVData &a_depositionNC, const EBAMRCellData &a_depositionKappaC) const
Make the "non-conservative" kappa deposition – computing depositionNC = sum(kappa*depositionC)/sum(ka...
Definition: CD_ItoSolver.cpp:1819
virtual void setTime(const int a_step, const Real a_time, const Real a_dt)
Set the time for this solver.
Definition: CD_ItoSolver.cpp:533
virtual void intersectParticles(const EBIntersection a_ebIntersection, const bool a_deleteParticles, const std::function< void(ItoParticle &)> a_nonDeletionModifier=[](ItoParticle &) -> void { return;})
Do boundary intersection tests.
Definition: CD_ItoSolver.cpp:725
Real m_bisectionStep
Bisection step size to use for particle intersection tests with EBs.
Definition: CD_ItoSolver.H:1126
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel)
Regrid this solver.
Definition: CD_ItoSolver.cpp:818
int m_restartPPC
Number of particles used when restarting a simulation – this is relevant only when restarting from a ...
Definition: CD_ItoSolver.H:1079
virtual void preRegrid(const int a_lbase, const int a_oldFinestLevel)
Perform pre-regrid operations.
Definition: CD_ItoSolver.cpp:1903
virtual void setComputationalGeometry(const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry)
Set computational geometry.
Definition: CD_ItoSolver.cpp:458
void parseIntersectionEB()
Parse EB intersection algorithms.
Definition: CD_ItoSolver.cpp:315
virtual void setAmr(const RefCountedPtr< AmrMesh > &a_amr)
Set the AmrMesh object.
Definition: CD_ItoSolver.cpp:471
bool m_forceHaloNGP
Force usage of NGP when depositing "halo" particles.
Definition: CD_ItoSolver.H:1166
static constexpr int m_nComp
Default number of component in data holders (do not touch).
Definition: CD_ItoSolver.H:1038
virtual void organizeParticlesByPatch(const WhichContainer a_container)
Sort the input particle container by patch.
Definition: CD_ItoSolver.cpp:2971
void parseRedistribution()
Parse whether or not to use redistribution.
Definition: CD_ItoSolver.cpp:341
virtual Real computeHopDt(const Real a_maxCellsToMove) const
Compute the largest possible time step such that the particles does not move more than a specified nu...
Definition: CD_ItoSolver.cpp:2569
virtual void setParticleMobility(const Real a_mobility)
Sets mobility coefficient for all particles.
Definition: CD_ItoSolver.cpp:2050
bool m_forceIrregInterpolationNGP
NGP interpolation in cut cells or not.
Definition: CD_ItoSolver.H:1161
EBAMRIVData m_depositionNC
Scratch storage for holding the non-conservative deposition.
Definition: CD_ItoSolver.H:1276
virtual Real computeDiffusiveDt() const
Compute the diffusive dt. This computes dt = dx*dx/(2*D) for all particles.
Definition: CD_ItoSolver.cpp:2816
void parseParticleMerger()
Parse the super-particle merger.
Definition: CD_ItoSolver.cpp:391
std::string m_className
Class name.
Definition: CD_ItoSolver.H:1115
virtual void updateDiffusion()
Update mobilities parametrically from the particle energy.
Definition: CD_ItoSolver.cpp:2396
bool m_plotParticles
Flag for depositing and plotting the bulk particles on the mesh.
Definition: CD_ItoSolver.H:1206
int m_timeStep
Time step.
Definition: CD_ItoSolver.H:1136
virtual EBAMRCellData & getVelocityFunction()
Get cell-centered velocity mesh data.
Definition: CD_ItoSolver.cpp:1960
virtual void mergeParticles(List< ItoParticle > &a_particles, const CellInfo &a_cellInfo, const int a_particlesPerCell) const noexcept
General superparticle merging with underlying algorithm through m_particleMerger.
Definition: CD_ItoSolver.cpp:3099
bool m_forceIrregDepositionNGP
NGP deposition in cut cells or not.
Definition: CD_ItoSolver.H:1156
void depositParticlesNGP(LevelData< EBCellFAB > &a_output, const ParticleContainer< P > &a_particles, const int a_level) const noexcept
Do an NGP deposit on a specific grid level. Used for IO.
Definition: CD_ItoSolverImplem.H:85
std::string m_realm
Realm where this solve lives.
Definition: CD_ItoSolver.H:1084
virtual void depositConductivity(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Deposit conductivities (i.e. mass*mobility / volume)
Definition: CD_ItoSolver.cpp:1572
virtual void interpolateVelocities()
Interpolate the particle velocities.
Definition: CD_ItoSolver.cpp:2076
virtual void interpolateMobilitiesDirect(const int a_level, const DataIndex &a_dit) noexcept
Directly interpolate mobilities. Interpolates for all particles in the specified grid patch.
Definition: CD_ItoSolver.cpp:2210
virtual void parseOptions()
Parse class options.
Definition: CD_ItoSolver.cpp:110
bool m_plotParticlesSource
Flag for depositing and plotting the source particles on the mesh.
Definition: CD_ItoSolver.H:1221
virtual Real computeDt() const
Compute a time step for the advance – this calls the level function.
Definition: CD_ItoSolver.cpp:2445
RefCountedPtr< ItoSpecies > m_species
Species that this solver solves for.
Definition: CD_ItoSolver.H:1099
DepositionType m_deposition
Deposition method when depositing particles to the mesh.
Definition: CD_ItoSolver.H:1241
virtual void interpolateDiffusion()
Interpolate the diffusion field to the particle positions.
Definition: CD_ItoSolver.cpp:2341
virtual void computeAverageMobility(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Compute average mobility.
Definition: CD_ItoSolver.cpp:1670
Real m_dt
Time step.
Definition: CD_ItoSolver.H:1151
ItoSolver()
Constructor – user must subsequently set the realm and, parse class options, set the species etc.
Definition: CD_ItoSolver.cpp:36
std::string m_name
Solver name.
Definition: CD_ItoSolver.H:1109
virtual std::string getName() const
Get this solver's name.
Definition: CD_ItoSolver.cpp:65
EBAMRCellData m_velocityFunction
Cell-centered field used for interpolating velocities.
Definition: CD_ItoSolver.H:1266
WhichCheckpoint m_checkpointing
How to checkpoint files. particles => write particles to HDF5. numbers => write numbers to HDF5.
Definition: CD_ItoSolver.H:1064
virtual ~ItoSolver()
Destructor (does nothing).
Definition: CD_ItoSolver.cpp:59
void parseCheckpointing()
Parse checkpointing method.
Definition: CD_ItoSolver.cpp:367
bool m_isDiffusive
If true, solver is diffusive.
Definition: CD_ItoSolver.H:1181
virtual ParticleContainer< ItoParticle > & getParticles(const WhichContainer a_container)
Get a general particle container.
Definition: CD_ItoSolver.cpp:1927
bool m_plotAverageEnergy
Flag for plotting the average particle energy on the mesh.
Definition: CD_ItoSolver.H:1236
DepositionType m_plotDeposition
Deposition method when depositing particles to mesh during plotting.
Definition: CD_ItoSolver.H:1251
RealVect randomGaussian() const
Draw a random N-dimensional Gaussian number from a normal distribution with zero with and unit standa...
Definition: CD_ItoSolverImplem.H:30
virtual void setParticleDiffusion(const Real a_diffusion)
Sets diffusion coefficient for all particles.
Definition: CD_ItoSolver.cpp:2063
virtual void remap()
Remap the bulk particle container.
Definition: CD_ItoSolver.cpp:2916
void drawNewParticles(const LevelData< EBCellFAB > &a_particlesPerCell, const int a_level, const int a_newPPC)
Restart particles from a specified number of particles in the grid cell.
Definition: CD_ItoSolver.cpp:1197
bool m_useRedistribution
Use mass redistribution or not.
Definition: CD_ItoSolver.H:1171
EBAMRCellData m_mobilityFunction
Mobility function – used when interpolating particle mobilities.
Definition: CD_ItoSolver.H:1261
virtual void updateMobilities()
Update mobilities parametrically from the particle energy.
Definition: CD_ItoSolver.cpp:2294
std::map< WhichContainer, ParticleContainer< ItoParticle > > m_particleContainers
Various particle containers with identifiers.
Definition: CD_ItoSolver.H:1286
int m_haloBuffer
Size of refinement boundary halo.
Definition: CD_ItoSolver.H:1141
virtual bool isMobile() const
Check if solver is mobile.
Definition: CD_ItoSolver.cpp:1887
virtual EBAMRCellData & getDiffusionFunction()
Get the diffusion function.
Definition: CD_ItoSolver.cpp:1982
virtual void setPhase(const phase::which_phase a_phase)
Set phase where the particles will live.
Definition: CD_ItoSolver.cpp:510
int m_verbosity
Verbosity level for this solver.
Definition: CD_ItoSolver.H:1131
virtual void makeSuperparticles(const WhichContainer a_container, const int a_particlesPerCell)
Make superparticles for a full container – this is the AMR version that users will usually call.
Definition: CD_ItoSolver.cpp:2984
virtual void depositDiffusivity(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Deposit diffusivity (i.e. mass*D/volume)
Definition: CD_ItoSolver.cpp:1608
WhichCheckpoint
How to checkpoint files.
Definition: CD_ItoSolver.H:1045
virtual void setRealm(const std::string a_realm)
Set the realm where this solver will live.
Definition: CD_ItoSolver.cpp:81
void addParticles(ListBox< ItoParticle > &a_inputParticles, const int a_lvl, const DataIndex a_dit, const bool a_destructive)
Add particles to a contain. This adds into a specific grid level and patch. The user can delete the i...
Definition: CD_ItoSolverImplem.H:50
Real m_normalDistributionTruncation
Truncation value for normal distribution.
Definition: CD_ItoSolver.H:1121
bool m_plotParticlesEB
Flag for depositing and plotting the EB particles on the mesh.
Definition: CD_ItoSolver.H:1211
bool m_blendConservation
Flag for blending the deposition clouds with the "non-conservative" divergence.
Definition: CD_ItoSolver.H:1176
virtual const std::string getRealm() const
Get the realm where this solver is registered.
Definition: CD_ItoSolver.cpp:73
virtual EBAMRCellData & getPhi()
Get the mesh data.
Definition: CD_ItoSolver.cpp:1949
virtual void allocate()
Allocate internal storage.
Definition: CD_ItoSolver.cpp:879
WhichMobilityInterpolation m_mobilityInterp
Switch for deciding how to interpolate mobilities, i.e. interpolating either mu*E or just mu (to the ...
Definition: CD_ItoSolver.H:1069
void parseVerbosity()
Parse class verbosity.
Definition: CD_ItoSolver.cpp:149
static constexpr int m_comp
Default component in data holders (do not touch).
Definition: CD_ItoSolver.H:1033
virtual void setVerbosity(const int a_verbosity)
Set verbosity level for this solver.
Definition: CD_ItoSolver.cpp:521
virtual void depositHybrid(EBAMRCellData &a_depositionH, EBAMRIVData &a_massDifference, const EBAMRIVData &a_depositionNC) const
Make the "hybrid" deposition phiH = kappa*phiC + (1-kappa)*phiNC. On input, a_depositionH should cont...
Definition: CD_ItoSolver.cpp:1838
void parseDivergenceComputation()
Parse whether or not to compute a "non-conservative" divergence when redistributing mass.
Definition: CD_ItoSolver.cpp:354
RefCountedPtr< AmrMesh > m_amr
AMR; needed for grid stuff.
Definition: CD_ItoSolver.H:1094
virtual void depositEnergyDensity(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Deposit energy densities (i.e. mass*energy/volume => total energy per unit volume)
Definition: CD_ItoSolver.cpp:1639
void parseRNG()
Parse RNG options – this parses the RNG seed and instantiates the distributions.
Definition: CD_ItoSolver.cpp:162
virtual void setDiffusionFunction(const Real a_diffusionCoefficient)
Utility function – set a constant diffusion coefficient.
Definition: CD_ItoSolver.cpp:2026
DepositionType getDeposition() const
Get deposition method.
Definition: CD_ItoSolver.cpp:2940
void parseTruncation()
Parse the normal distribution truncation level.
Definition: CD_ItoSolver.cpp:176
EBAMRIVData m_massDiff
Scratch storage for holding the mass difference when using hybrid deposition.
Definition: CD_ItoSolver.H:1281
EBAMRCellData m_phi
Storage for particle mesh data.
Definition: CD_ItoSolver.H:1256
virtual void initialData()
Set the initial data.
Definition: CD_ItoSolver.cpp:546
virtual void computeAverageDiffusion(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Compute average diffusion coefficient.
Definition: CD_ItoSolver.cpp:1697
virtual void parseRuntimeOptions()
Parse class runtime configurable options.
Definition: CD_ItoSolver.cpp:130
bool m_plotDiffCo
Flag for outputting m_diffusionFunction to plot files.
Definition: CD_ItoSolver.H:1201
virtual void computeLoads(Vector< long int > &a_loads, const DisjointBoxLayout &a_dbl, const int a_level)
Compute particle load on a specific grid level – this will compute the number of particles in each bo...
Definition: CD_ItoSolver.cpp:572
virtual void remapAll()
Remap all particle containers.
Definition: CD_ItoSolver.cpp:2903
WhichMobilityInterpolation
Enum for deciding how to interpolate particle mobilities.
Definition: CD_ItoSolver.H:1056
virtual void reinitializeParticles(List< ItoParticle > &a_particles, const CellInfo &a_cellInfo, const int a_particlesPerCell) const noexcept
Particle re-initialization algorithm.
Definition: CD_ItoSolver.cpp:3174
virtual const RefCountedPtr< ItoSpecies > & getSpecies() const
Get the species.
Definition: CD_ItoSolver.cpp:97
bool m_isMobile
If true, solver is mobile, i.e. advection is turned on.
Definition: CD_ItoSolver.H:1186
virtual unsigned long long getNumParticles(const WhichContainer a_container, const bool a_localOnly) const
Get number of particles in a specified particle container.
Definition: CD_ItoSolver.cpp:437
virtual int getNumberOfPlotVariables() const
Get number of plot variables.
Definition: CD_ItoSolver.cpp:1301
virtual void clear(const WhichContainer a_container)
Clear a particle container – this will delete all the particles in the input container.
Definition: CD_ItoSolver.cpp:3221
virtual void redistributeAMR(EBAMRCellData &a_phi) const
Redistribute mass in an AMR context.
Definition: CD_ItoSolver.cpp:1777
bool m_plotParticlesCovered
Flag for depositing and plotting the covered particles on the mesh.
Definition: CD_ItoSolver.H:1226
EBIntersection m_intersectionAlg
Algorithm for EB intersection.
Definition: CD_ItoSolver.H:1291
Real m_time
Current time.
Definition: CD_ItoSolver.H:1146
ParticleManagement::ParticleMerger< ItoParticle > m_particleMerger
Particle merger.
Definition: CD_ItoSolver.H:1074
virtual void setParticleMerger(const ParticleManagement::ParticleMerger< ItoParticle > &a_particleMerger) noexcept
Set the particle merger. This will get called when merging particles using makeSuperparticles.
Definition: CD_ItoSolver.cpp:89
virtual void removeCoveredParticles(const EBRepresentation a_representation, const Real a_tol)
Remove particles that are inside the EB.
Definition: CD_ItoSolver.cpp:601
phase::which_phase m_phase
Phase where this solver lives.
Definition: CD_ItoSolver.H:1104
virtual bool isDiffusive() const
Check if solver is diffusive.
Definition: CD_ItoSolver.cpp:1895
virtual EBIntersection getIntersectionAlgorithm() const noexcept
Get the EB-particle intersection algorithm.
Definition: CD_ItoSolver.cpp:426
virtual EBAMRCellData & getMobilityFunction()
Get mobility function.
Definition: CD_ItoSolver.cpp:2004
virtual void setVelocityFunction(const RealVect a_velocity)
Utility function – set a constant velocity.
Definition: CD_ItoSolver.cpp:2037
void parseDeposition()
Parse particle deposition methods.
Definition: CD_ItoSolver.cpp:248
RefCountedPtr< ComputationalGeometry > m_computationalGeometry
Computational geometry.
Definition: CD_ItoSolver.H:1089
virtual void writeData(LevelData< EBCellFAB > &a_output, int &a_comp, const EBAMRCellData &a_data, const std::string a_outputRealm, const int a_level, const bool a_interpToCentroids, const bool a_interpGhost) const noexcept
Write data to output. Convenience function.
Definition: CD_ItoSolver.cpp:1506
virtual void interpolateMobilitiesVelocity(const int a_level, const DataIndex &a_dit, const EBCellFAB &a_velocityMagnitude) noexcept
Interpolate mobilities through the velocity. Interpolates for all particles in the specified grid pat...
Definition: CD_ItoSolver.cpp:2243
virtual Real computeAdvectiveDt() const
Compute advection time step dt = dx/vMax where vMax is the largest velocity component of the particle...
Definition: CD_ItoSolver.cpp:2728
void parsePlotVariables()
Parse plot variables.
Definition: CD_ItoSolver.cpp:189
bool m_plotParticlesDomain
Flag for depositing and plotting the domain particles on the mesh.
Definition: CD_ItoSolver.H:1216
bool m_plotVelocity
Flag for outputting m_velocityFunction to plot files.
Definition: CD_ItoSolver.H:1196
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_ItoSolver.cpp:1393
Templated class for holding particles on an AMR hierarchy with particle remapping.
Definition: CD_ParticleContainer.H:50
std::function< void(List< P > &a_particles, const CellInfo &a_cellInfo, const int a_numTargetParticles)> ParticleMerger
Concept for splitting/merging particles.
Definition: CD_ParticleManagement.H:40