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 =
280 auto t_invH =
284
286
289
290 t_G(
i,
j) = t_g(
i,
k) * t_invH(
k,
j);
291 t_a_res(
i) = t_a(
i) - t_a0(
i) + t_G(
i,
j) * t_dotW(
j);
292
293
294
296
297 t_F(
i,
j) = t_h(
i,
k) * t_invH(
k,
j);
298 t_a_res(
i) *= rho0 * detH;
300
301 } else {
302
303 t_a_res(
i) *= rho0 * detH;
304 }
305
306
308 res.resize(3);
309 for (int rr = 0; rr < 3; rr++) {
310 a_res[rr] >>= res[rr];
311 }
312
313 trace_off();
314 }
315
316 active.resize(nb_active_vars);
317 int aa = 0;
318 for (int nn1 = 0; nn1 < 3; nn1++) {
319 active[aa++] = dot_spacial_vel[gg][nn1];
320 }
321 for (int nn1 = 0; nn1 < 3; nn1++) {
322 for (int nn2 = 0; nn2 < 3; nn2++) {
324 active[aa++] = spatial_positions_grad[gg](nn1, nn2) + 1;
325 } else {
326 active[aa++] = spatial_positions_grad[gg](nn1, nn2);
327 }
328 }
329 }
331 0) {
332 for (int nn1 = 0; nn1 < 3; nn1++) {
333 for (int nn2 = 0; nn2 < 3; nn2++) {
334 active[aa++] = spatial_velocities_grad[gg](nn1, nn2);
335 }
336 }
337 for (int nn1 = 0; nn1 < 3; nn1++) {
338 active[aa++] = meshpos_vel[gg][nn1];
339 }
340 for (int nn1 = 0; nn1 < 3; nn1++) {
341 for (int nn2 = 0; nn2 < 3; nn2++) {
342 active[aa++] = mesh_positions_gradient[gg](nn1, nn2);
343 }
344 }
345 }
346
349 if (gg > 0) {
350 res.resize(3);
352 r = ::function(
tAg, 3, nb_active_vars, &
active[0], &res[0]);
353 if (r != 3) {
355 "ADOL-C function evaluation with error r = %d", r);
356 }
357 }
358 double val = getVolume() * getGaussPts()(3, gg);
359 res *= val;
360
361 } else {
364 for (int nn1 = 0; nn1 < 3; nn1++) {
367 }
369 r = jacobian(
tAg, 3, nb_active_vars, &
active[0],
371 if (r != 3) {
373 "ADOL-C function evaluation with error");
374 }
375 double val = getVolume() * getGaussPts()(3, gg);
377 }
378 }
379 }
380
382}
#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 ...
ublas::matrix< T, ublas::row_major, ublas::bounded_array< T, N > > MatrixBoundedArray
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.
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.