Line data Source code
1 : //
2 : // Class of BC operators that work with :ref:`Operator::Elastic`.
3 : //
4 :
5 : #ifndef BC_OPERATOR_ELASTIC_H
6 : #define BC_OPERATOR_ELASTIC_H
7 :
8 : // #include "Operator/Elastic.H"
9 : #include "IO/ParmParse.H"
10 : #include "Numeric/Interpolator/Linear.H"
11 :
12 : namespace BC
13 : {
14 : namespace Operator
15 : {
16 : namespace Elastic
17 : {
18 : class Elastic
19 : {
20 : public:
21 : static const int min = 1, max = 2;
22 :
23 19 : virtual ~Elastic() = default;
24 :
25 : public:
26 : enum Type {Displacement, Traction, Periodic, Neumann, None};
27 :
28 : #if AMREX_SPACEDIM==2
29 : enum Face{
30 : XLO, YLO, XHI, YHI,
31 : XLO_YLO, XLO_YHI, XHI_YLO, XHI_YHI,
32 : INT
33 : };
34 : #elif AMREX_SPACEDIM==3
35 : enum Face{
36 : XLO, YLO, ZLO, XHI, YHI, ZHI, // 6
37 : YLO_ZLO, YLO_ZHI, YHI_ZLO, YHI_ZHI, // 12
38 : ZLO_XLO, ZLO_XHI, ZHI_XLO, ZHI_XHI,
39 : XLO_YLO, XLO_YHI, XHI_YLO, XHI_YHI,
40 : XLO_YLO_ZLO, XLO_YLO_ZHI, XLO_YHI_ZLO, XLO_YHI_ZHI, // 8
41 : XHI_YLO_ZLO, XHI_YLO_ZHI, XHI_YHI_ZLO, XHI_YHI_ZHI,
42 : INT
43 : };
44 : #endif
45 :
46 : enum Direction {AMREX_D_DECL(X=0,Y=1,Z=2)};
47 :
48 : void
49 426 : SetTime(const Set::Scalar a_time) {m_time = a_time;}
50 :
51 : virtual void
52 : Init(amrex::MultiFab * a_rhs,
53 : const amrex::Geometry &a_geom,
54 : bool a_homogeneous = false) const = 0;
55 :
56 : virtual void
57 : Init(amrex::FabArray<amrex::BaseFab<Set::Vector>> * a_rhs,
58 : const amrex::Geometry &a_geom,
59 : bool a_homogeneous = false) const = 0;
60 :
61 : void
62 0 : Init(Set::Field<Set::Scalar> &a_rhs,
63 : const amrex::Vector<amrex::Geometry> &a_geom,
64 : bool a_homogeneous = false) const
65 : {
66 0 : for (int ilev = 0; ilev <= a_rhs.finest_level; ilev++)
67 0 : Init(a_rhs[ilev].get(),a_geom[ilev],a_homogeneous);
68 0 : }
69 :
70 : void
71 426 : Init(Set::Field<Set::Vector> &a_rhs,
72 : const amrex::Vector<amrex::Geometry> &a_geom,
73 : bool a_homogeneous = false) const
74 : {
75 898 : for (int ilev = 0; ilev <= a_rhs.finest_level; ilev++)
76 472 : Init(a_rhs[ilev].get(),a_geom[ilev],a_homogeneous);
77 426 : }
78 :
79 : #define SQRT3INV 0.57735026919
80 : #define SQRT2INV 0.70710678118
81 :
82 : virtual
83 : std::array<Type,AMREX_SPACEDIM> getType (
84 : const int &i, const int &j, const int &k,
85 : const amrex::Box &domain) = 0;
86 :
87 : virtual
88 : Set::Vector operator () (const Set::Vector &u,
89 : const Set::Matrix &gradu,
90 : const Set::Matrix &sigma,
91 : const int &i, const int &j, const int &k,
92 : const amrex::Box &domain) = 0;
93 :
94 : protected:
95 : Set::Scalar m_time = 0.0;
96 : };
97 : }
98 : }
99 : }
100 : #endif
|