Debian Codegraph @

src/num/aslFDElasticityBC.h

raw
1 /*
2 * Advanced Simulation Library <http://asl.org.il>
3 *
4 * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5 *
6 *
7 * This file is part of Advanced Simulation Library (ASL).
8 *
9 * ASL is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, version 3 of the License.
12 *
13 * ASL is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24 #ifndef ASLFDELASTICITYBC_H
25 #define ASLFDELASTICITYBC_H
26
27 #include "aslBCond.h"
28 #include "acl/aclMath/aclVectorOfElementsDef.h"
29
30 namespace acl{
31 class Kernel;
32 typedef std::shared_ptr<Kernel> SPKernel;
33 }
34
35 namespace asl
36 {
37 class ElasticityCommonA;
38 typedef std::shared_ptr<ElasticityCommonA> SPElasticityCommonA;
39 class FDElasticityIncompressibleStatic;
40 typedef std::shared_ptr<FDElasticityIncompressibleStatic> SPFDElasticityIncompressibleStatic;
41 class FDElasticityRelaxation;
42 typedef std::shared_ptr<FDElasticityRelaxation> SPFDElasticityRelaxation;
43 class FDElasticity2;
44 typedef std::shared_ptr<FDElasticity2> SPFDElasticity2;
45
46 /// Bondary condition corresponding to a rigid wall (\f$\vec u=0\f$ and \f$\nabla p=0\f$)
47 /**
48 \ingroup ElasticityBC
49 */
50 class BCRigidWall:public BCond
51 {
52 protected:
53 std::unique_ptr<acl::Kernel> kernel;
54 SPFDElasticityIncompressibleStatic num;
55 public:
56 BCRigidWall(SPFDElasticityIncompressibleStatic nm);
57 virtual void execute();
58 virtual void init();
59 };
60
61 /// Bondary condition corresponding to a rigid wall (\f$\vec u=0\f$ and \f$\nabla p=0\f$)
62 /**
63 \ingroup ElasticityBS
64 */
65
66 SPBCond generateBCRigidWall(SPFDElasticityIncompressibleStatic nm,
67 const std::vector<SlicesNames> & sl);
68
69 /// Bondary condition corresponding to a rigid wall (\f$\vec u=0\f$ and \f$\nabla p=0\f$)
70 /**
71 \ingroup ElasticityBC
72 */
73 class BCRigidWallRelaxation:public BCond
74 {
75 protected:
76 std::unique_ptr<acl::Kernel> kernel;
77 SPFDElasticityRelaxation num;
78 acl::VectorOfElements value;
79 public:
80 BCRigidWallRelaxation(SPFDElasticityRelaxation nm);
81 BCRigidWallRelaxation(SPFDElasticityRelaxation nm, acl::VectorOfElements v);
82 virtual void execute();
83 virtual void init();
84 };
85
86 /// Bondary condition corresponding to a rigid wall (\f$\vec u=0\f$ and \f$\nabla p=0\f$)
87 /**
88 \ingroup ElasticityBS
89 */
90
91 SPBCond generateBCRigidWall(SPFDElasticityRelaxation nm,
92 const std::vector<SlicesNames> & sl);
93
94 /// Bondary condition corresponding to a rigid wall (\f$ u=0\f$ and \f$\dot u=0\f$)
95 /**
96 \ingroup ElasticityBC
97 */
98
99 SPBCond generateBCRigidWall(SPFDElasticity2 nm,
100 const std::vector<SlicesNames> & sl);
101
102 /// Bondary condition corresponding to a rigid wall (\f$ u=u_0\f$ and \f$\dot u=0\f$)
103 /**
104 \ingroup ElasticityBC
105 */
106
107 SPBCond generateBCRigidWall(SPFDElasticity2 nm,
108 const AVec<> & u0,
109 const std::vector<SlicesNames> & sl);
110
111 /// Bondary condition corresponding to a rigid wall (\f$ u=u_0\f$ and \f$\dot u=0\f$)
112 /**
113 \ingroup ElasticityBC
114 */
115
116 SPBCond generateBCRigidWall(SPFDElasticityRelaxation nm,
117 const AVec<> & u0,
118 const std::vector<SlicesNames> & sl);
119
120 /// Bondary condition corresponding to a free surface (\f$\partial_{\vec n}u=0\f$ and \f$\partial_{\vec n}\dot u=0\f$)
121 /**
122 \ingroup ElasticityBC
123 */
124 class BCFreeSurface:public BCond
125 {
126 protected:
127 std::unique_ptr<acl::Kernel> kernel;
128 FDElasticityIncompressibleStatic* num;
129 public:
130 BCFreeSurface(FDElasticityIncompressibleStatic* nm);
131 virtual void execute();
132 virtual void init();
133 };
134
135 /// Bondary condition corresponding to a free surface (\f$\partial_{\vec n}u=0\f$)
136 /**
137 \note The free boundary conditions have a different mathematical formulation,
138 see BCFreeSurface2Real
139
140 \ingroup ElasticityBC
141 */
142 class BCFreeSurface2:public BCond
143 {
144 protected:
145 std::unique_ptr<acl::Kernel> kernel;
146 SPFDElasticity2 num;
147 public:
148 BCFreeSurface2(SPFDElasticity2 nm);
149 ~BCFreeSurface2();
150 virtual void execute();
151 virtual void init();
152 };
153
154 /// Bondary condition corresponding to a free surface
155 /**
156 \ingroup ElasticityBC
157
158 The class is a realisation of 1st order explicit free boundary conditions
159 for rectangular grid and arbitrary geometry. The geometry is defined by a levelset
160 The algorithm computes value in a ghost node. This is done by cell subdivision.
161 The unit cell containing the ghost node in the center. It is splited into
162 elementary cells the spliting is described by the corresponding VTObjects.
163
164 The gradient in the elementary cells is computed by the following expression:
165 \f[
166 \nabla_i u_j = (u^k_j - u^0_j E_k) T_{ki},
167 \f]
168 where \f$ u^k_j\f$ is the \f$ k^{th}\f$ point of the elementary cell,
169 \f$ E_k \f$ is the vector filled by 1 and \f$ T_{ki} \f$ is the baricentric
170 coordinates transformation matrix.
171
172 The free boundary condition has the following expression:
173 \f[
174 \lambda n_i\nabla_k u_k+\mu n_j \left( \nabla_i u_j + \nabla_j u_i \right) = F_i,
175 \f]
176 where \f$ \lambda \f$ is a Lame first parameter, \f$ \mu \f$ is shear modulus.
177 This expression can be rewriten in terms of the elementary cell expresion:
178 \f[
179 \lambda n_i(u^k_j - u^0_j E_k) T_{kj} +
180 \mu n_j \left( (u^k_j - u^0_j E_k) T_{ki} + (u^k_i - u^0_i E_k) T_{kj} \right) = F_i,
181 \f]
182 This equation can be rewritten in form of \f$ A_{ij} u^0_j = b_i \f$:
183 \f[
184 A_{ij}=\lambda n_i E_kT_{kj} + \mu n_j E_k T_{ki} + \mu n_l E_k T_{kl} \delta_{ij},
185 \f]
186 \f[
187 b_i = \lambda n_i u^k_j T_{kj} + \mu n_j (u^k_j T_{ki}+ u^k_i T_{kj}) - F_i.
188 \f]
189 The solution of the system of equations is the seeking boundary condition.
190
191 The class should obtain list of the ghost points
192
193 */
194 class BCZeroStressMap: public BCondWithMap
195 {
196 protected:
197 SPAbstractDataWithGhostNodes displacement;
198 acl::VectorOfElements lambda;
199 acl::VectorOfElements mu;
200 acl::SPKernel kernel;
201 public:
202 BCZeroStressMap(SPAbstractDataWithGhostNodes displacement,
203 acl::VectorOfElements lambda,
204 acl::VectorOfElements mu,
205 SPAbstractDataWithGhostNodes map,
206 const VectorTemplate *const t);
207 ~BCZeroStressMap();
208 virtual void execute();
209 virtual void init();
210 };
211
212 /// Bondary condition set given values to displacement/velocity
213 /**
214 \ingroup ElasticityBC
215 */
216 SPNumMethod generateBCZeroStress(SPElasticityCommonA nm,
217 SPAbstractDataWithGhostNodes map);
218
219
220 /// Bondary condition set given values to displacement/velocity
221 /**
222 \ingroup ElasticityBC
223 */
224 // SPNumMethod generateBCZeroStress(SPFDElasticityIncompressibleStatic nm,
225 // SPAbstractDataWithGhostNodes map);
226
227 /// Bondary condition set given values to displacement/velocity
228 /**
229 \ingroup ElasticityBC
230 */
231 // SPNumMethod generateBCZeroStress(SPFDElasticityRelaxation nm,
232 // SPAbstractDataWithGhostNodes map);
233
234 /// Bondary condition set given values to pressure
235 /**
236 \ingroup ElasticityBC
237 */
238 SPNumMethod generateBCZeroStressP(SPFDElasticityIncompressibleStatic nm,
239 SPAbstractDataWithGhostNodes map);
240
241 /// Bondary condition set given values to displacement/velocity
242 /**
243 \ingroup ElasticityBC
244 */
245 SPNumMethod generateBCZeroStressP(SPFDElasticityRelaxation nm,
246 SPAbstractDataWithGhostNodes map);
247
248 /// Bondary condition set given values to displacement/velocity
249 /**
250 \ingroup ElasticityBC
251 */
252 class BCImposedDisplacementVelocityValue:public BCond
253 {
254 protected:
255 std::unique_ptr<acl::Kernel> kernel;
256 SPFDElasticityIncompressibleStatic num;
257 AVec<double> displacement;
258 bool bDisplacement;
259 AVec<double> velocity;
260 bool bVelocity;
261 bool initialized;
262 public:
263 BCImposedDisplacementVelocityValue(SPFDElasticityIncompressibleStatic nm);
264 virtual void execute();
265 virtual void init();
266 void setDisplacement(AVec<double> d);
267 void setVelocity(AVec<double> v);
268 };
269
270 /// Bondary condition local force(acceleration)
271 /**
272 \ingroup ElasticityBC
273 */
274 class BCAccelerationSource2: public BCond
275 {
276 protected:
277 std::unique_ptr<acl::Kernel> kernel;
278 FDElasticity2* num;
279 acl::VectorOfElements acceleration;
280 bool initialized;
281 public:
282 BCAccelerationSource2(FDElasticity2* nm);
283 virtual void execute();
284 virtual void init();
285 void setAcceleration(AVec<double> a);
286 };
287
288 } //asl
289
290 #endif //ASLFDELASTICITYBC_H