12 #ifndef CD_ItoKMCStreamerTaggerImplem_H
13 #define CD_ItoKMCStreamerTaggerImplem_H
16 #include <ParmParse.H>
20 #include <CD_NamespaceHeader.H>
22 using namespace Physics::ItoKMC;
27 CH_TIME(
"ItoKMCStreamerTagger::ItoKMCStreamerTagger");
29 this->m_name =
"ItoKMCStreamerTagger";
30 this->m_numTagFields = 2;
39 const RefCountedPtr<S>& a_timeStepper,
40 const RefCountedPtr<AmrMesh>& a_amr) noexcept
43 CH_TIME(
"ItoKMCStreamerTagger::ItoKMCStreamerTagger");
44 if (this->m_verbosity > 5) {
45 pout() <<
"ItoKMCStreamerTagger::ItoKMCStreamerTagger" << endl;
48 this->define(a_physics, a_timeStepper, a_amr);
55 CH_TIME(
"ItoKMCStreamerTagger::parseOptions");
56 if (this->m_verbosity > 5) {
57 pout() <<
"ItoKMCStreamerTagger::parseOptions" << endl;
60 this->parseVerbosity();
61 this->parseTagBoxes();
62 this->parseRefinementBoxes();
65 ParmParse pp(this->m_name.c_str());
66 pp.get(
"coarsen_curvature", this->m_coarsenCurvature);
67 pp.get(
"refine_curvature", this->m_refineCurvature);
68 pp.get(
"refine_alpha", this->m_refineAlpha);
69 pp.get(
"coarsen_alpha", this->m_coarsenAlpha);
70 pp.get(
"max_coarsen_lvl", this->m_maxCoarsenLevel);
77 CH_TIME(
"ItoKMCStreamerTagger::parseOptions");
78 if (this->m_verbosity > 5) {
79 pout() <<
"ItoKMCStreamerTagger::parseOptions" << endl;
82 this->parseVerbosity();
83 this->parseTagBoxes();
84 this->parseRefinementBoxes();
87 ParmParse pp(this->m_name.c_str());
88 pp.get(
"coarsen_curvature", this->m_coarsenCurvature);
89 pp.get(
"refine_curvature", this->m_refineCurvature);
90 pp.get(
"refine_alpha", this->m_refineAlpha);
91 pp.get(
"coarsen_alpha", this->m_coarsenAlpha);
92 pp.get(
"max_coarsen_lvl", this->m_maxCoarsenLevel);
103 const RealVect a_gradE,
104 const Real a_minGradE,
105 const Real a_maxGradE)
const noexcept
107 CH_TIME(
"ItoKMCStreamerTagger::computeTagFields");
108 if (this->m_verbosity > 5) {
109 pout() <<
"ItoKMCStreamerTagger::computeTagFields" << endl;
112 Vector<Real> tagFields(this->m_numTagFields);
114 const Real E = a_E.vectorLength();
115 tagFields[0] = E / a_maxE;
116 tagFields[1] = this->m_physics->computeAlpha(E, a_pos) * a_dx;
117 tagFields[1] -= this->m_physics->computeEta(E, a_pos) * a_dx;
122 template <
typename S>
128 const Vector<Real> a_tagFields,
129 const Vector<RealVect> a_gradTagFields)
const noexcept
131 CH_TIME(
"ItoKMCStreamerTagger::coarsenCell");
132 if (this->m_verbosity > 5) {
133 pout() <<
"ItoKMCStreamerTagger::coarsenCell" << endl;
136 bool coarsen =
false;
138 if (a_lvl >= m_maxCoarsenLevel) {
139 const Real E = a_tagFields[0];
140 const Real alphaDx = a_tagFields[1];
141 const RealVect gradE = a_gradTagFields[0];
143 const bool coarsenCurv = gradE.vectorLength() * a_dx / E < m_coarsenCurvature;
144 const bool coarsenAlpha = alphaDx < m_coarsenAlpha;
146 coarsen = coarsenCurv && coarsenAlpha;
155 template <
typename S>
161 const Vector<Real> a_tagFields,
162 const Vector<RealVect> a_gradTagFields)
const noexcept
164 CH_TIME(
"ItoKMCStreamerTagger::refineCell");
165 if (this->m_verbosity > 5) {
166 pout() <<
"ItoKMCStreamerTagger::refineCell" << endl;
169 const Real E = a_tagFields[0];
170 const Real alphaDx = a_tagFields[1];
171 const RealVect gradE = a_gradTagFields[0];
173 const bool refineCurv = gradE.vectorLength() * a_dx / E > m_refineCurvature;
174 const bool refineAlpha = alphaDx > m_refineAlpha;
175 const bool refineManual = (a_lvl < this->getManualRefinementLevel(a_pos));
177 return refineCurv || refineAlpha || refineManual;
180 #include <CD_NamespaceFooter.H>
Implementation ItoKMCTagger which tags on alpha and curvature of field.
virtual void computeTagFields() const noexcept override
Compute tagging fields.
Definition: CD_ItoKMCFieldTaggerImplem.H:95
Cell tagging class for streamers.
Definition: CD_ItoKMCStreamerTagger.H:27
virtual bool refineCell(const RealVect a_pos, const Real a_time, const Real a_dx, const int a_lvl, const Vector< Real > a_tagFields, const Vector< RealVect > a_gradTagFields) const noexcept override
Determine if a particular cell should be refined or not.
Definition: CD_ItoKMCStreamerTaggerImplem.H:157
ItoKMCStreamerTagger() noexcept
Constructor. Must subsequently call the define function.
Definition: CD_ItoKMCStreamerTaggerImplem.H:25
virtual bool coarsenCell(const RealVect a_pos, const Real a_time, const Real a_dx, const int a_lvl, const Vector< Real > a_tagFields, const Vector< RealVect > a_gradTagFields) const noexcept override
Determine if a particular cell should be coarsened or not.
Definition: CD_ItoKMCStreamerTaggerImplem.H:124
virtual void parseRuntimeOptions() noexcept override
Parse class options.
Definition: CD_ItoKMCStreamerTaggerImplem.H:75
virtual ~ItoKMCStreamerTagger() noexcept
Destructor.
Definition: CD_ItoKMCStreamerTaggerImplem.H:34
virtual void parseOptions() noexcept override
Parse class options.
Definition: CD_ItoKMCStreamerTaggerImplem.H:53