Alamo
DoubleNotch.H
Go to the documentation of this file.
1 //
2 // Implement a double-notch. Primarily used in fracture.
3 //
4 // .. WARNING::
5 //
6 // This function is depricated. Use :ref:`IC::Expression` instead.
7 //
8 #ifndef IC_DOUBLENOTCH_H_
9 #define IC_DOUBLENOTCH_H_
10 
11 #include "Set/Set.H"
12 #include "IC/IC.H"
13 #include "IO/ParmParse.H"
14 
15 namespace IC
16 {
17 class DoubleNotch : public IC
18 {
19 public:
21 
22  DoubleNotch (amrex::Vector<amrex::Geometry> &_geom) : IC(_geom)
23  {
24  }
25 
26 
27  void Add(const int lev, amrex::Vector<amrex::MultiFab * > &a_field)
28  {
29  Set::Vector DX(geom[lev].CellSize());
30  amrex::IndexType type = a_field[lev]->ixType();
31  for (amrex::MFIter mfi(*a_field[lev],amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi)
32  {
33  amrex::Box bx = mfi.tilebox();
34  bx.grow(a_field[lev]->nGrow());
35  amrex::Array4<Set::Scalar> const& field = a_field[lev]->array(mfi);
36  amrex::ParallelFor (bx,[=] AMREX_GPU_DEVICE(int i, int j, int k) {
37 
38  Set::Vector x;
39  // NODE
40  if (type == amrex::IndexType::TheNodeType())
41  {
42  AMREX_D_TERM(x(0) = geom[lev].ProbLo()[0] + ((amrex::Real)(i)) * geom[lev].CellSize()[0];,
43  x(1) = geom[lev].ProbLo()[1] + ((amrex::Real)(j)) * geom[lev].CellSize()[1];,
44  x(2) = geom[lev].ProbLo()[2] + ((amrex::Real)(k)) * geom[lev].CellSize()[2];);
45  }
46  else if (type == amrex::IndexType::TheCellType())
47  {
48  AMREX_D_TERM(x(0) = geom[lev].ProbLo()[0] + ((amrex::Real)(i) + 0.5) * geom[lev].CellSize()[0];,
49  x(1) = geom[lev].ProbLo()[1] + ((amrex::Real)(j) + 0.5) * geom[lev].CellSize()[1];,
50  x(2) = geom[lev].ProbLo()[2] + ((amrex::Real)(k) + 0.5) * geom[lev].CellSize()[2];);
51  }
52 
53  field(i,j,k) = L;
54  if ( (x - x0)(0) > 0.5*width || (x - x0)(0) < -0.5*width)
55  if ( (x - x0)(1) < 0.5*thickness && (x-x0)(1) > -0.5*thickness)
56  field(i,j,k) = 0.0;
57  });
58  }
59  a_field[lev]->FillBoundary();
60  }
61 
62 private:
66  Set::Scalar L = 1.0;
67 public:
68  static void Parse(DoubleNotch & value, IO::ParmParse & pp)
69  {
70  pp_query("thickness",value.thickness); // Thickness of the notches
71  pp_query("width",value.width); // Width of the notches
72  pp_queryarr("x0",value.x0); // Center of the notches
73  pp_query("L",value.L); // Length of the notches
74  }
75 };
76 }
77 #endif
IC::IC::geom
amrex::Vector< amrex::Geometry > & geom
Definition: IC.H:45
BC::AMREX_D_DECL
@ AMREX_D_DECL
Definition: BC.H:34
IC::DoubleNotch::DoubleNotch
DoubleNotch(amrex::Vector< amrex::Geometry > &_geom)
Definition: DoubleNotch.H:22
Set::Vector
Eigen::Matrix< amrex::Real, AMREX_SPACEDIM, 1 > Vector
Definition: Base.H:20
ParmParse.H
pp_query
#define pp_query(...)
Definition: ParmParse.H:104
IC::DoubleNotch::x0
Set::Vector x0
Definition: DoubleNotch.H:65
IC::DoubleNotch::L
Set::Scalar L
Definition: DoubleNotch.H:66
Set::Scalar
amrex::Real Scalar
Definition: Base.H:19
IC::DoubleNotch::Add
void Add(const int lev, amrex::Vector< amrex::MultiFab * > &a_field)
Definition: DoubleNotch.H:27
IC::DoubleNotch::Dirac
@ Dirac
Definition: DoubleNotch.H:20
IC::DoubleNotch::width
Set::Scalar width
Definition: DoubleNotch.H:64
IC::DoubleNotch::Parse
static void Parse(DoubleNotch &value, IO::ParmParse &pp)
Definition: DoubleNotch.H:68
Set.H
IC
Definition: Affine.H:18
IO::ParmParse
Definition: ParmParse.H:110
IC::DoubleNotch::Mollifier
Mollifier
Definition: DoubleNotch.H:20
IC::DoubleNotch
Definition: DoubleNotch.H:17
IC::DoubleNotch::Gaussian
@ Gaussian
Definition: DoubleNotch.H:20
IC.H
IC::DoubleNotch::thickness
Set::Scalar thickness
Definition: DoubleNotch.H:63
pp_queryarr
#define pp_queryarr(...)
Definition: ParmParse.H:103