163 {
165
166 if (
dAta.
tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
169 }
170
171
172 if (row_type != MBVERTEX)
174
176 if (nb_dofs == 0)
178
179 {
180
183 dot_W.resize(3,
false);
184 a_res.resize(3,
false);
185 g.resize(3, 3,
false);
186 G.resize(3, 3,
false);
187 h.resize(3, 3,
false);
188 H.resize(3, 3,
false);
189 invH.resize(3, 3,
false);
190 F.resize(3, 3,
false);
191 }
192
194 std::fill(
H.data().begin(),
H.data().end(), 0);
195 std::fill(
invH.data().begin(),
invH.data().end(), 0);
196 for (int ii = 0; ii != 3; ii++) {
199 }
200
201 int nb_gauss_pts = row_data.
getN().size1();
205
206 const std::vector<VectorDouble> &dot_spacial_vel =
208
209 const std::vector<MatrixDouble> &spatial_positions_grad =
211
212 const std::vector<MatrixDouble> &spatial_velocities_grad =
214
215 const std::vector<VectorDouble> &meshpos_vel =
217
218 const std::vector<MatrixDouble> &mesh_positions_gradient =
220
221 int nb_active_vars = 0;
222 for (int gg = 0; gg < nb_gauss_pts; gg++) {
223
224 if (gg == 0) {
225
227
228 for (int nn1 = 0; nn1 < 3; nn1++) {
229
230 a[nn1] <<= dot_spacial_vel[gg][nn1];
231 nb_active_vars++;
232 }
233 for (int nn1 = 0; nn1 < 3; nn1++) {
234 for (int nn2 = 0; nn2 < 3; nn2++) {
235
236 h(nn1, nn2) <<= spatial_positions_grad[gg](nn1, nn2);
238 if (nn1 == nn2) {
240 }
241 }
242 nb_active_vars++;
243 }
244 }
246 .size() > 0) {
247 for (int nn1 = 0; nn1 < 3; nn1++) {
248 for (int nn2 = 0; nn2 < 3; nn2++) {
249
250 g(nn1, nn2) <<= spatial_velocities_grad[gg](nn1, nn2);
251 nb_active_vars++;
252 }
253 }
254 for (int nn1 = 0; nn1 < 3; nn1++) {
255
256 dot_W(nn1) <<= meshpos_vel[gg][nn1];
257 nb_active_vars++;
258 }
259 for (int nn1 = 0; nn1 < 3; nn1++) {
260 for (int nn2 = 0; nn2 < 3; nn2++) {
261
262 H(nn1, nn2) <<= mesh_positions_gradient[gg](nn1, nn2);
263 nb_active_vars++;
264 }
265 }
266 }
267
270
271 auto t_a_res =
275 auto t_dotW =
282
284
287
288 t_G(
i,
j) = t_g(
i,
k) * t_invH(
k,
j);
289 t_a_res(
i) = t_a(
i) - t_a0(
i) + t_G(
i,
j) * t_dotW(
j);
290
291
292
294
295 t_F(
i,
j) = t_h(
i,
k) * t_invH(
k,
j);
296 t_a_res(
i) *= rho0 * detH;
298
299 } else {
300
301 t_a_res(
i) *= rho0 * detH;
302 }
303
304
306 res.resize(3);
307 for (int rr = 0; rr < 3; rr++) {
308 a_res[rr] >>= res[rr];
309 }
310
311 trace_off();
312 }
313
314 active.resize(nb_active_vars);
315 int aa = 0;
316 for (int nn1 = 0; nn1 < 3; nn1++) {
317 active[aa++] = dot_spacial_vel[gg][nn1];
318 }
319 for (int nn1 = 0; nn1 < 3; nn1++) {
320 for (int nn2 = 0; nn2 < 3; nn2++) {
322 active[aa++] = spatial_positions_grad[gg](nn1, nn2) + 1;
323 } else {
324 active[aa++] = spatial_positions_grad[gg](nn1, nn2);
325 }
326 }
327 }
329 0) {
330 for (int nn1 = 0; nn1 < 3; nn1++) {
331 for (int nn2 = 0; nn2 < 3; nn2++) {
332 active[aa++] = spatial_velocities_grad[gg](nn1, nn2);
333 }
334 }
335 for (int nn1 = 0; nn1 < 3; nn1++) {
336 active[aa++] = meshpos_vel[gg][nn1];
337 }
338 for (int nn1 = 0; nn1 < 3; nn1++) {
339 for (int nn2 = 0; nn2 < 3; nn2++) {
340 active[aa++] = mesh_positions_gradient[gg](nn1, nn2);
341 }
342 }
343 }
344
347 if (gg > 0) {
348 res.resize(3);
350 r = ::function(
tAg, 3, nb_active_vars, &
active[0], &res[0]);
351 if (r != 3) {
353 "ADOL-C function evaluation with error r = %d", r);
354 }
355 }
356 double val = getVolume() * getGaussPts()(3, gg);
357 res *= val;
358
359 } else {
362 for (int nn1 = 0; nn1 < 3; nn1++) {
365 }
367 r = jacobian(
tAg, 3, nb_active_vars, &
active[0],
369 if (r != 3) {
371 "ADOL-C function evaluation with error");
372 }
373 double val = getVolume() * getGaussPts()(3, gg);
375 }
376 }
377 }
378
380}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ MOFEM_OPERATION_UNSUCCESSFUL
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
MoFEMErrorCode invertTensor3by3(ublas::matrix< T, L, A > &jac_data, ublas::vector< T, A > &det_data, ublas::matrix< T, L, A > &inv_jac_data)
Calculate inverse of tensor rank 2 at integration points.
auto getFTensor2FromArray3by3(ublas::matrix< T, L, A > &data, const FTensor::Number< S > &, const size_t rr, const size_t cc=0)
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Range tEts
elements in block set
double rho0
reference density
VectorDouble a0
constant acceleration
std::map< std::string, std::vector< VectorDouble > > dataAtGaussPts
std::vector< MatrixDouble > jacMass
std::vector< VectorDouble > valMass
std::map< std::string, std::vector< MatrixDouble > > gradAtGaussPts
std::vector< std::vector< double * > > jacMassRowPtr
MatrixBoundedArray< adouble, 9 > invH
MatrixBoundedArray< adouble, 9 > G
FTensor::Index< 'k', 3 > k
FTensor::Index< 'i', 3 > i
MatrixBoundedArray< adouble, 9 > H
MatrixBoundedArray< adouble, 9 > g
MatrixBoundedArray< adouble, 9 > h
VectorBoundedArray< adouble, 3 > a_res
MatrixBoundedArray< adouble, 9 > F
VectorBoundedArray< adouble, 3 > dot_W
std::vector< double > active
FTensor::Index< 'j', 3 > j
VectorBoundedArray< adouble, 3 > a
static MoFEMErrorCode applyScale(const FEMethod *fe, boost::ptr_vector< MethodForForceScaling > &methods_op, VectorDouble &nf)
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.