![Logo](alamo3.svg) |
Alamo
|
Go to the documentation of this file.
13 #ifndef INTEGRATOR_ALLENCAHN_H // Include guards
14 #define INTEGRATOR_ALLENCAHN_H //
23 #include "AMReX_ParallelDescriptor.H"
24 #include "AMReX_ParmParse.H"
37 #include "Numeric/Stencil.H"
105 const Set::Scalar *DX = this->geom[lev].CellSize();
107 for (amrex::MFIter mfi(*
alpha_mf[lev],
true); mfi.isValid(); ++mfi)
109 const amrex::Box& bx = mfi.tilebox();
110 amrex::Array4<Set::Scalar>
const& alpha_new = (*
alpha_mf[lev]).array(mfi);
111 amrex::Array4<const Set::Scalar>
const& alpha = (*
alpha_old_mf[lev]).array(mfi);
113 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
117 Set::Scalar alpha_2 = alpha(i, j, k) * alpha(i, j, k);
119 driving_force += (
ch.chempot /
ch.eps) * (2.0 * alpha(i, j, k) - 6.0 * alpha_2 + 4.0 * alpha_3);
122 driving_force -=
ch.eps *
ch.grad * alpha_lap;
124 if (
ch.direction == 1)
125 driving_force = std::min(0.0, driving_force);
126 else if (
ch.direction == -1)
127 driving_force = std::max(0.0, driving_force);
131 alpha(i, j, k) -
ch.L *
dt * driving_force;
142 Set::Scalar dr = sqrt(AMREX_D_TERM(DX[0] * DX[0], +DX[1] * DX[1], +DX[2] * DX[2]));
145 for (amrex::MFIter mfi(*
alpha_mf[lev], amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi)
148 const amrex::Box& bx = mfi.tilebox();
149 amrex::Array4<char>
const& tags = a_tags.array(mfi);
150 amrex::Array4<Set::Scalar>
const& alpha = (*
alpha_mf[lev]).array(mfi);
153 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
161 tags(i, j, k) = amrex::TagBox::SET;
void Initialize(const int &a_lev, Set::Field< Set::Scalar > &a_field, Set::Scalar a_time=0.0)
Pure abstract IC object from which all other IC objects inherit.
void RegisterNewFab(Set::Field< Set::Scalar > &new_fab, BC::BC< Set::Scalar > *new_bc, int ncomp, int nghost, std::string name, bool writeout, std::vector< std::string > suffix={})
int number_of_ghost_cells
BC::BC< Set::Scalar > * bc
static void Parse(AllenCahn &value, IO::ParmParse &pp)
void TagCellsForRefinement(int lev, amrex::TagBoxArray &a_tags, Set::Scalar, int)
Eigen::Matrix< amrex::Real, AMREX_SPACEDIM, 1 > Vector
AMREX_FORCE_INLINE Set::Vector Gradient(const amrex::Array4< const Set::Scalar > &f, const int &i, const int &j, const int &k, const int &m, const Set::Scalar dx[AMREX_SPACEDIM], std::array< StencilType, AMREX_SPACEDIM > stencil=DefaultType)
AMREX_FORCE_INLINE Set::Scalar Laplacian(const amrex::Array4< const Set::Scalar > &f, const int &i, const int &j, const int &k, const int &m, const Set::Scalar dx[AMREX_SPACEDIM], std::array< StencilType, AMREX_SPACEDIM > &stencil=DefaultType)
#define pp_queryclass(...)
AllenCahn(IO::ParmParse &pp)
Set::Scalar refinement_threshold
#define pp_query_default(...)
Set::Field< Set::Scalar > alpha_mf
Collection of numerical integrator objects.
struct Integrator::AllenCahn::@0 ch
void Advance(int lev, Set::Scalar, Set::Scalar dt)
#define pp_query_validate(...)
void select_default(std::string name, PTRTYPE *&ic_eta, Args &&... args)
Set::Field< Set::Scalar > alpha_old_mf
amrex::Vector< amrex::Real > dt
Timesteps for each level of refinement.