1 #ifndef OPERATOR_ELASTIC_H_
2 #define OPERATOR_ELASTIC_H_
4 #include <AMReX_MLCellLinOp.H>
5 #include <AMReX_Array.H>
8 #include "Operator/Operator.H"
11 #include "Numeric/Stencil.H"
14 using namespace amrex;
28 enum class BC {Displacement, Traction, Periodic, Neumann};
32 Elastic (
const Vector<Geometry>& a_geom,
33 const Vector<BoxArray>& a_grids,
34 const Vector<DistributionMapping>& a_dmap,
35 const LPInfo& a_info);
42 void define (
const Vector<Geometry>& a_geom,
43 const Vector<BoxArray>& a_grids,
44 const Vector<DistributionMapping>& a_dmap,
45 const LPInfo& a_info = LPInfo(),
46 const Vector<FabFactory<FArrayBox>
const*>& a_factory = {});
48 virtual void SetHomogeneous (
bool a_homogeneous)
override {m_homogeneous = a_homogeneous;}
50 void SetModel (
int amrlev,
const MultiTab& a_model);
51 void SetModel (
const amrex::Vector<MultiTab> & a_model)
52 {
for (
int ilev = 0; ilev < a_model.size(); ilev++) SetModel(ilev,a_model[ilev]);}
54 {
for (
int ilev = 0; ilev < a_model.size(); ilev++) SetModel(ilev,*a_model[ilev]);}
55 void SetPsi (
int amrlev,
const amrex::MultiFab& a_psi);
57 {m_psi_small = a_psi_small; SetPsi(amrlev,a_psi);}
63 if (this->Geom(0).isAnyPeriodic())
65 Util::Warning(
INFO,
"Looks like you're using a periodic domain. \nThat is currently VERY DANGEROUS when using linear elastic solver!!!");
79 void Strain (
int amrlev, amrex::MultiFab& epsfab,
const amrex::MultiFab& ufab,
bool voigt =
false)
const;
86 void Stress (
int amrlev, amrex::MultiFab& sigmafab,
const amrex::MultiFab& ufab,
bool voigt =
false,
bool a_homogeneous=
false);
93 void Energy (
int amrlev, amrex::MultiFab& energy,
const amrex::MultiFab& u,
bool a_homogeneous=
false);
99 void SetBC(
const std::array<std::array<BC,AMREX_SPACEDIM>,AMREX_SPACEDIM> &a_bc_lo,
100 const std::array<std::array<BC,AMREX_SPACEDIM>,AMREX_SPACEDIM> &a_bc_hi)
102 Util::Abort(
INFO,
"This is now depricated. Use the other SetBC function.");
103 m_bc_lo = a_bc_lo;m_bc_hi = a_bc_hi;
106 void Error0x (
int amrlev,
int mglev, MultiFab& R0x,
const MultiFab& x)
const;
111 {m_average_down_coeffs = a_average_down_coeffs;}
113 using Operator::Reflux;
117 virtual void Diagonal (
int amrlev,
int mglev, amrex::MultiFab& diag)
override;
119 virtual void Fapply (
int amrlev,
int mglev, MultiFab& out,
const MultiFab& in)
const override final;
120 virtual void FFlux (
int amrlev,
const MFIter& mfi,
121 const std::array<FArrayBox*,AMREX_SPACEDIM>& flux,
122 const FArrayBox& sol,
const int face_only=0) const final;
127 virtual
int getNComp()
const override {
return AMREX_SPACEDIM;};
131 if (!m_model_set)
Util::Abort(
INFO,
"Attempting to use operator before calling SetModel!");
132 if (!m_bc_set)
Util::Warning(
INFO,
"Attempting to use operator before calling SetBC!");
138 std::array<std::array<BC,AMREX_SPACEDIM>, AMREX_SPACEDIM> m_bc_lo;
139 std::array<std::array<BC,AMREX_SPACEDIM>, AMREX_SPACEDIM>
m_bc_hi;
145 amrex::Vector<Set::Field<Set::Matrix4<AMREX_SPACEDIM,SYM>>>
m_ddw_mf;
150 bool m_psi_set =
false;
152 virtual void averageDownCoeffs ()
override;
153 void averageDownCoeffsDifferentAmrLevels (
int fine_amrlev);
169 void averageDownCoeffsSameAmrLevel (
int amrlev);
171 void FillBoundaryCoeff (
MultiTab& sigma,
const Geometry& geom);
172 void FillBoundaryCoeff (MultiFab& psi,
const Geometry& geom);
174 bool m_testing =
false;
175 bool m_uniform =
false;
176 bool m_homogeneous =
false;
178 bool m_average_down_coeffs =
false;
182 bool m_model_set =
false;
183 bool m_bc_set =
false;