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>
32 #include "Model/Interface/GB/GB.H"
57 template<
class model_type>
72 BL_PROFILE(
"PhaseFieldMicrostructure::Parse");
91 value.pf.threshold.on =
92 value.pf.threshold.chempot ||
value.pf.threshold.boundary ||
93 value.pf.threshold.corner ||
value.pf.threshold.lagrange ||
94 value.pf.threshold.mechanics;
96 std::string
type =
"continuous";
98 if (
type ==
"continuous")
value.pf.threshold.type = ThresholdType::Continuous;
99 else if (
type ==
"chop")
value.pf.threshold.type = ThresholdType::Chop;
109 value.mechanics.model.clear();
110 value.mechanics.model.resize(
value.number_of_grains,model_type::Zero());
111 for (
int i=0; i <
value.number_of_grains; i++)
114 if (pp.getEntries(
"mechanics.model").size())
118 std::string name =
"mechanics.model" + std::to_string(i+1);
119 if (pp.getEntries(name).size())
126 value.number_of_ghost_cells = std::max(
value.number_of_ghost_cells,3);
131 if (
value.lagrange.on)
136 value.SetThermoInt(1);
142 std::vector<std::string> vals;
144 int nvals =
static_cast<int>(vals.size());
146 for (
int i = 0; i <
value.number_of_grains; i++)
148 else if (nvals ==
value.number_of_grains)
149 for (
int i = 0; i <
value.number_of_grains; i++)
152 Util::Abort(
INFO,
"sdf.val received ", vals.size(),
" but requires 1 or ",
value.number_of_grains);
160 if (
value.anisotropy.on)
173 if (
value.anisotropy.on)
174 value.number_of_ghost_cells = std::max(
value.number_of_ghost_cells,2);
177 std::map<std::string, RegularizationType> regularization_type;
181 std::string regularization_type_input;
183 pp_query_validate(
"anisotropy.regularization", regularization_type_input,{
"k12",
"wilmore"});
184 value.regularization = regularization_type[regularization_type_input];
199 else if (bc_type ==
"step")
value.mybc =
new BC::Step(pp,
"bc.eta");
203 pp_query_validate(
"ic.type", ic_type,{
"constant",
"perturbed_interface",
"tabulated_interface",
"voronoi",
"expression",
"sphere",
"ellipse"});
218 if (
value.anisotropic_kinetics.on)
222 std::string mobility_filename, threshold_filename;
224 pp_query_file(
"anisotropic_kinetics.mobility",mobility_filename);
227 pp_query_file(
"anisotropic_kinetics.threshold",threshold_filename);
229 value.RegisterNewFab(
value.anisotropic_kinetics.L_mf,
value.mybc,
value.number_of_grains, 0,
"mobility",
true);
230 value.RegisterNewFab(
value.anisotropic_kinetics.threshold_mf,
value.mybc,
value.number_of_grains, 0,
"theshold",
true);
237 value.RegisterNewFab(
value.driving_force_mf,
value.mybc,
value.number_of_grains,
value.number_of_ghost_cells,
"DrivingForce",
false);
238 if (
value.pf.threshold.on)
239 value.RegisterNewFab(
value.driving_force_threshold_mf,
value.mybc,
value.number_of_grains,
value.number_of_ghost_cells,
"DrivingForceThreshold",
false);
241 value.RegisterIntegratedVariable(&
value.volume,
"volume");
242 value.RegisterIntegratedVariable(&
value.area,
"area");
243 value.RegisterIntegratedVariable(&
value.gbenergy,
"gbenergy");
244 value.RegisterIntegratedVariable(&
value.realgbenergy,
"realgbenergy");
245 value.RegisterIntegratedVariable(&
value.regenergy,
"regenergy");
255 void Advance (
int lev, Real time, Real
dt)
override;
258 void TagCellsForRefinement (
int lev, amrex::TagBoxArray& tags, amrex::Real time,
int ngrow)
override;
260 virtual void TimeStepBegin(amrex::Real time,
int iter)
override;
263 const amrex::MFIter &mfi,
const amrex::Box &
box)
override;
339 std::vector<Numeric::Interpolator::Linear<Set::Scalar>>
val;