4 #ifndef INTEGRATOR_PHASEFIELDMICROSTRUCTURE_H
5 #define INTEGRATOR_PHASEFIELDMICROSTRUCTURE_H
12 #include "AMReX_ParmParse.H"
13 #include "AMReX_ParallelDescriptor.H"
14 #include <AMReX_MLMG.H>
31 #include "Model/Interface/GB/GB.H"
56 template<
class model_type>
71 BL_PROFILE(
"PhaseFieldMicrostructure::Parse");
90 value.pf.threshold.on =
91 value.pf.threshold.chempot ||
value.pf.threshold.boundary ||
92 value.pf.threshold.corner ||
value.pf.threshold.lagrange ||
93 value.pf.threshold.mechanics;
95 std::string
type =
"continuous";
97 if (
type ==
"continuous")
value.pf.threshold.type = ThresholdType::Continuous;
98 else if (
type ==
"chop")
value.pf.threshold.type = ThresholdType::Chop;
108 value.mechanics.model.clear();
109 value.mechanics.model.resize(
value.number_of_grains,model_type::Zero());
110 for (
int i=0; i <
value.number_of_grains; i++)
113 if (pp.getEntries(
"mechanics.model").size())
117 std::string name =
"mechanics.model" + std::to_string(i+1);
118 if (pp.getEntries(name).size())
125 value.number_of_ghost_cells = std::max(
value.number_of_ghost_cells,3);
130 if (
value.lagrange.on)
135 value.SetThermoInt(1);
141 std::vector<std::string> vals;
143 int nvals =
static_cast<int>(vals.size());
145 for (
int i = 0; i <
value.number_of_grains; i++)
147 else if (nvals ==
value.number_of_grains)
148 for (
int i = 0; i <
value.number_of_grains; i++)
151 Util::Abort(
INFO,
"sdf.val received ", vals.size(),
" but requires 1 or ",
value.number_of_grains);
159 if (
value.anisotropy.on)
180 if (
value.anisotropy.on)
181 value.number_of_ghost_cells = std::max(
value.number_of_ghost_cells,2);
184 std::map<std::string, RegularizationType> regularization_type;
188 std::string regularization_type_input;
190 pp_query_validate(
"anisotropy.regularization", regularization_type_input,{
"k12",
"wilmore"});
191 value.regularization = regularization_type[regularization_type_input];
193 pp_forbid(
"anisotropy.gb_type",
" --> anisotropy.type");
206 if (
value.anisotropic_kinetics.on)
210 std::string mobility_filename, threshold_filename;
212 pp_query_file(
"anisotropic_kinetics.mobility",mobility_filename);
215 pp_query_file(
"anisotropic_kinetics.threshold",threshold_filename);
217 value.RegisterNewFab(
value.anisotropic_kinetics.L_mf,
value.mybc,
value.number_of_grains, 0,
"mobility",
true);
218 value.RegisterNewFab(
value.anisotropic_kinetics.threshold_mf,
value.mybc,
value.number_of_grains, 0,
"theshold",
true);
225 value.RegisterNewFab(
value.driving_force_mf,
value.mybc,
value.number_of_grains,
value.number_of_ghost_cells,
"DrivingForce",
false);
226 if (
value.pf.threshold.on)
227 value.RegisterNewFab(
value.driving_force_threshold_mf,
value.mybc,
value.number_of_grains,
value.number_of_ghost_cells,
"DrivingForceThreshold",
false);
229 value.RegisterIntegratedVariable(&
value.volume,
"volume");
230 value.RegisterIntegratedVariable(&
value.area,
"area");
231 value.RegisterIntegratedVariable(&
value.gbenergy,
"gbenergy");
232 value.RegisterIntegratedVariable(&
value.realgbenergy,
"realgbenergy");
233 value.RegisterIntegratedVariable(&
value.regenergy,
"regenergy");
242 void Advance (
int lev, Real time, Real
dt)
override;
245 void TagCellsForRefinement (
int lev, amrex::TagBoxArray& tags, amrex::Real time,
int ngrow)
override;
247 virtual void TimeStepBegin(amrex::Real time,
int iter)
override;
250 const amrex::MFIter &mfi,
const amrex::Box &
box)
override;
326 std::vector<Numeric::Interpolator::Linear<Set::Scalar>>
val;