Peano
Loading...
Searching...
No Matches
ContextDynamicRupture.h
Go to the documentation of this file.
1#pragma once
2
4
5#include "toolbox/curvi/kdTree/InnerNode.h"
6#include "toolbox/curvi/kdTree/Root.h"
7
8template <class Shortcuts, int basisSize, int numberOfVariables, int numberOfParameters, typename T>
9class ContextDynamicRupture: public ContextCurvilinear<Shortcuts, basisSize, numberOfVariables+numberOfParameters, T> {
10
11public:
13 std::string& topography_string,
14 int coarsestMeshLevel,
15 double coarsestMeshSize,
16 double maxAdaptiveDepth,
17 tarch::la::Vector<DIMENSIONS,double> _domainOffset,
18 tarch::la::Vector<DIMENSIONS,double> _domainSize,
19 T* _nodes,
20 T* _dudx
21 ): ContextCurvilinear<Shortcuts, basisSize, numberOfVariables+numberOfParameters, T>(
22 topography_string,
23 coarsestMeshLevel, coarsestMeshSize, maxAdaptiveDepth,
24 _domainOffset, _domainSize,
25 _nodes,_dudx
26 )
27 {
28
29 domainSize[0] = _domainSize[0];
30 domainSize[1] = _domainSize[1];
31 domainSize[2] = _domainSize[2];
32
33 }
34
36 std::string& filename_rupture_model
37 ){
38
39 easi::YAMLParser parser(3);
40
41 model = parser.parse(filename_rupture_model);
42
43 //double cohesion;
44 easi::ArraysAdapter<T> adapter;
45 adapter.addBindingPoint("mu_s",&mu_s);
46 adapter.addBindingPoint("mu_d",&mu_d);
47 adapter.addBindingPoint("d_c" ,&S_c);
48 adapter.addBindingPoint("t_0" ,&t0_rupture);
49 adapter.addBindingPoint("f_cy",&f_cy);
50 adapter.addBindingPoint("f_wy",&f_wy);
51 adapter.addBindingPoint("f_cz",&f_cz);
52 adapter.addBindingPoint("f_wz",&f_wz);
53
54 easi::Query query(1,3);
55 query.group(0) = 0;
56 query.x(0,0) = 0;
57 query.x(0,1) = 0;
58 query.x(0,2) = 0;
59
60 model->evaluate(query,adapter);
61
62
63 // We want to find the position of the fault so that we can check whether we
64 // are on the fault in the Riemann solver.
65 // Since the curve might be rough or not aligned with our domain axes, the position
66 // of the curve in reference space is not constant.
67 // However since curvi maps the reference space onto the physical space in such a way
68 // that the fault is contiguous, this means that there is one position in the reference
69 // space (i.e. Peano positions) that the fault falls on, and we would like to find this position.
70 // Curvi does not however does not provide this position in a trivial way, so what we do
71 // is we try to find one point which is on the fault, and invert the projection to find
72 // what position in reference space maps to this point.
73 // This will not provide an entirely accurate position, but should provide a rough
74 // estimate, which we assume is accurate to a half-cells distance.
75
76 toolbox::curvi::Root* root = this->interface->getRoot();
77 toolbox::curvi::InnerNode* fault_node = static_cast<toolbox::curvi::InnerNode*>(root->getChild());
78 fault_normal = fault_node->getFaceNormal();
79
80 // We look for a point on the fault and, for lack of better options, pick
81 // the point at the center of the fault
82 double fault_center[3];
83 fault_center[toolbox::curvi::Coordinate::X] = this->domainOffset[0] + domainSize[0];
84 fault_center[toolbox::curvi::Coordinate::Y] = this->domainOffset[1] + domainSize[1];
85 fault_center[toolbox::curvi::Coordinate::Z] = this->domainOffset[2] + domainSize[2];
86
87 // Get the position on the plane, i.e. if you are on a y-z plane you
88 // need y and z to query the perturbation at this point
89 toolbox::curvi::Coordinate fault_coords[2];
90 fault_node->getCoordinates(fault_coords);
91 T xi = fault_center[(2-fault_coords[0])];
92 T mu = fault_center[(2-fault_coords[1])];
93
94 // this gives the base position of the fault in the physical space,
95 // i.e. if the fault has been placed at x = 20.0 this returns 20.,
96 // but does not take into account possible perturbations on said fault
97 // so we need to add these
98 fault_center[fault_normal] = fault_node->getPosition()
99 + fault_node->evalPerturbation(xi, mu);
100
101 // Finally, we query the interface as to the position in reference space which
102 // would get mapped to this position
103 fault_position = this->interface->invertProjection(fault_normal, fault_center);
104
105
106 }
107
108public:
109
110 bool riemannSolver(
111 T* FL, T* FR,
112 const T* const QL, const T* const QR,
113 const double t, const double dt,
114 const tarch::la::Vector<DIMENSIONS, double>& facePos,
115 const tarch::la::Vector<DIMENSIONS, double>& cellSize,
116 const int direction,
117 bool isBoundaryFace,
118 int faceIndex,
119 int surface = 2
120 );
121
123 T& sxx, T& syy, T& szz,
124 T& sxy, T& sxz, T& syz,
125 double* const x);
126 void preStress(
127 T& T0_n, T& T0_m, T& T0_l,
128 double* const x, double t,
129 T* const l, T* const m, T* const n);
130 T boxcar(T& f, double x, T w);
131 void tauStrength(T& tau_str, T sigma_n, T S, double* const x, double t);
132 void slipWeakening(
133 T& v1, T& v2,
134 T& Vel, T& tau1, T& tau2,
135 T phi_1, T phi_2,
136 T eta, T tau_str, T sigma_n);
138 T vn_p, T vn_m,
139 T Tn_p, T Tn_m,
140 T zn_p, T zn_m,
141 T& vn_hat_p, T& vn_hat_m,
142 T& Tn_hat_p, T& Tn_hat_m,
143 T vm_p, T vm_m,
144 T Tm_p, T Tm_m,
145 T zl_p, T zl_m,
146 T& vm_hat_p, T& vm_hat_m,
147 T& Tm_hat_p, T& Tm_hat_m,
148 T vl_p,T vl_m,
149 T Tl_p, T Tl_m,
150 T zm_p, T zm_m,
151 T& vl_hat_p, T& vl_hat_m,
152 T& Tl_hat_p, T& Tl_hat_m,
153 T* const l, T* const m, T* const n,
154 double* const x, T S, double t);
155
156public:
157 double domainSize[DIMENSIONS];
158
159 easi::Component* model;
160
161 //rupture parameters
162 T S_c; //Slip-weakening critical distance (meters)
163 T mu_d; //Dynamic coefficient of friction (dimensionless)
164 T mu_s; //Static coefficient of friction (dimensionless)
165
166 //duration of forced rupture (seconds)
167 // the forces holding the fault together will decrease linearly for this duration starting at the forced rupture time.
169
183
184 // In reference space, i.e. this should correspond to the position
185 // as viewed by ExaHyPE of the fault.
187
188 // Normal on which the fault lies, i.e. if this axis is x, then
189 // the fault is on a y-z plane.
190 toolbox::curvi::Coordinate fault_normal;
191};
const tarch::la::Vector< DIMENSIONS, double > cellSize
void slipWeakening(T &v1, T &v2, T &Vel, T &tau1, T &tau2, T phi_1, T phi_2, T eta, T tau_str, T sigma_n)
toolbox::curvi::Coordinate fault_normal
T f_cy
These define the position of the area with frictional cohesion.
T boxcar(T &f, double x, T w)
void slipWeakeningFriction(T vn_p, T vn_m, T Tn_p, T Tn_m, T zn_p, T zn_m, T &vn_hat_p, T &vn_hat_m, T &Tn_hat_p, T &Tn_hat_m, T vm_p, T vm_m, T Tm_p, T Tm_m, T zl_p, T zl_m, T &vm_hat_p, T &vm_hat_m, T &Tm_hat_p, T &Tm_hat_m, T vl_p, T vl_m, T Tl_p, T Tl_m, T zm_p, T zm_m, T &vl_hat_p, T &vl_hat_m, T &Tl_hat_p, T &Tl_hat_m, T *const l, T *const m, T *const n, double *const x, T S, double t)
void preStress(T &T0_n, T &T0_m, T &T0_l, double *const x, double t, T *const l, T *const m, T *const n)
ContextDynamicRupture(std::string &topography_string, int coarsestMeshLevel, double coarsestMeshSize, double maxAdaptiveDepth, tarch::la::Vector< DIMENSIONS, double > _domainOffset, tarch::la::Vector< DIMENSIONS, double > _domainSize, T *_nodes, T *_dudx)
void initialStressTensor(T &sxx, T &syy, T &szz, T &sxy, T &sxz, T &syz, double *const x)
double domainSize[DIMENSIONS]
void initRuptureModel(std::string &filename_rupture_model)
void tauStrength(T &tau_str, T sigma_n, T S, double *const x, double t)