v0.15.0
Loading...
Searching...
No Matches
FreeSurfaceOps.hpp
Go to the documentation of this file.
1namespace FreeSurfaceOps {
2
4 OpCalculateLift(const std::string field_name,
5 boost::shared_ptr<VectorDouble> p_ptr,
6 boost::shared_ptr<VectorDouble> lift_ptr,
7 boost::shared_ptr<Range> ents_ptr)
9 pPtr(p_ptr), liftPtr(lift_ptr), entsPtr(ents_ptr) {
10 std::fill(&doEntities[MBVERTEX], &doEntities[MBMAXTYPE], false);
11 doEntities[MBEDGE] = true;
12 }
13
14 MoFEMErrorCode doWork(int row_side, EntityType row_type,
15 EntitiesFieldData::EntData &data) {
17
18 const auto fe_ent = getFEEntityHandle();
19 if (entsPtr->find(fe_ent) != entsPtr->end()) {
20
21 auto t_w = getFTensor0IntegrationWeight();
22 auto t_p = getFTensor0FromVec(*pPtr);
23 auto t_normal = getFTensor1Normal();
24 auto t_coords = getFTensor1CoordsAtGaussPts();
25 auto t_lift = getFTensor1FromArray<SPACE_DIM, SPACE_DIM>(*liftPtr);
26
27 const auto nb_int_points = getGaussPts().size2();
28
29 for (int gg = 0; gg != nb_int_points; gg++) {
30
31 const double r = t_coords(0);
32 const double alpha = cylindrical(r) * t_w;
33 t_lift(i) -= t_normal(i) * (t_p * alpha);
34
35 ++t_w;
36 ++t_p;
37 ++t_coords;
38 }
39 }
40
42 }
43
44private:
45 boost::shared_ptr<VectorDouble> pPtr;
46 boost::shared_ptr<VectorDouble> liftPtr;
47 boost::shared_ptr<Range> entsPtr;
48};
49
52 boost::shared_ptr<MatrixDouble> u_ptr)
55 uPtr(u_ptr) {}
56
57 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data) {
59
60 auto t_w = getFTensor0IntegrationWeight();
61 auto t_normal = getFTensor1Normal();
62 auto t_u = getFTensor1FromMat<SPACE_DIM>(*uPtr);
63 auto t_row_base = row_data.getFTensor0N();
64 auto t_coords = getFTensor1CoordsAtGaussPts();
65
66 for (int gg = 0; gg != nbIntegrationPts; gg++) {
67
68 const double r = t_coords(0);
69 const double alpha = t_w * cylindrical(r);
70
71 int bb = 0;
72 for (; bb != nbRows; ++bb) {
73 locF[bb] += alpha * t_row_base * (t_normal(i) * t_u(i));
74 ++t_row_base;
75 }
76
77 for (; bb < nbRowBaseFunctions; ++bb)
78 ++t_row_base;
79
80 ++t_w;
81 ++t_u;
82 ++t_coords;
83 }
84
86 }
87
88private:
89 boost::shared_ptr<MatrixDouble> uPtr;
90};
91
93 OpNormalForceRhs(const std::string field_name,
94 boost::shared_ptr<VectorDouble> lambda_ptr)
96 AssemblyDomainEleOp::OPROW),
97 lambdaPtr(lambda_ptr) {}
98
99 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data) {
101
102 auto t_w = getFTensor0IntegrationWeight();
103 auto t_normal = getFTensor1Normal();
104 auto t_lambda = getFTensor0FromVec(*lambdaPtr);
105 auto t_row_base = row_data.getFTensor0N();
106 auto t_coords = getFTensor1CoordsAtGaussPts();
107
108 for (int gg = 0; gg != nbIntegrationPts; gg++) {
109
110 auto t_nf = getFTensor1FromArray<U_FIELD_DIM, U_FIELD_DIM>(locF);
111
112 const double r = t_coords(0);
113 const double alpha = t_w * cylindrical(r);
114
115 int bb = 0;
116 for (; bb != nbRows / U_FIELD_DIM; ++bb) {
117
118 t_nf(i) += alpha * t_row_base * t_normal(i) * t_lambda;
119 ++t_row_base;
120 ++t_nf;
121 }
122
123 for (; bb < nbRowBaseFunctions; ++bb)
124 ++t_row_base;
125
126 ++t_w;
127 ++t_lambda;
128 ++t_coords;
129 }
130
132 }
133
134private:
135 boost::shared_ptr<VectorDouble> lambdaPtr;
136};
137
139 OpWettingAngleRhs(const std::string field_name,
140 boost::shared_ptr<MatrixDouble> grad_h_ptr,
141 boost::shared_ptr<Range> ents_ptr = nullptr,
142 double wetting_angle = 0)
144 AssemblyBoundaryEleOp::OPROW),
145 gradHPtr(grad_h_ptr), entsPtr(ents_ptr), wettingAngle(wetting_angle) {}
146
147 MoFEMErrorCode iNtegrate(DataForcesAndSourcesCore::EntData &row_data) {
149 if (entsPtr) {
150 if (entsPtr->find(AssemblyBoundaryEleOp::getFEEntityHandle()) ==
151 entsPtr->end())
153 }
154 const double area = getMeasure();
155 auto t_w = getFTensor0IntegrationWeight();
156 auto t_row_base = row_data.getFTensor0N();
157 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*gradHPtr);
158 auto t_coords = getFTensor1CoordsAtGaussPts();
159
160 auto s = wetting_angle_sub_stepping(getFEMethod()->ts_step);
161
162 for (int gg = 0; gg != nbIntegrationPts; gg++) {
163
164 const double r = t_coords(0);
165 const double alpha = t_w * cylindrical(r) * area;
166 const double h_grad_norm = sqrt(t_grad_h(i) * t_grad_h(i) + eps);
167 const double cos_angle = std::cos(M_PI * wettingAngle / 180);
168 const double rhs_wetting = s * eta2 * h_grad_norm * cos_angle;
169
170 // cerr << "pass "
171 // << h_grad_norm <<"\n";
172 int bb = 0;
173 for (; bb != nbRows; ++bb) {
174 locF[bb] += alpha * t_row_base * rhs_wetting;
175 ++t_row_base;
176 }
177
178 for (; bb < nbRowBaseFunctions; ++bb)
179 ++t_row_base;
180
181 ++t_w;
182 ++t_grad_h;
183 ++t_coords;
184 }
185
187 }
188
189private:
190 boost::shared_ptr<MatrixDouble> gradHPtr;
191 boost::shared_ptr<Range> entsPtr;
193};
194
196
197 OpNormalConstrainLhs(const std::string field_name_row,
198 const std::string field_name_col)
199 : AssemblyBoundaryEleOp(field_name_row, field_name_col,
200 AssemblyBoundaryEleOp::OPROWCOL) {
201 assembleTranspose = true;
202 sYmm = false;
203 }
204
205 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
206 EntitiesFieldData::EntData &col_data) {
208
209 auto t_w = getFTensor0IntegrationWeight();
210 auto t_normal = getFTensor1Normal();
211 auto t_row_base = row_data.getFTensor0N();
212 auto t_coords = getFTensor1CoordsAtGaussPts();
213
214 for (int gg = 0; gg != nbIntegrationPts; ++gg) {
215
216 auto t_mat = getFTensor1FromPtr<U_FIELD_DIM>(&locMat(0, 0));
217
218 const double r = t_coords(0);
219 const double alpha = t_w * cylindrical(r);
220
221 int rr = 0;
222 for (; rr != nbRows; ++rr) {
223
224 auto t_col_base = col_data.getFTensor0N(gg, 0);
225 const double a = alpha * t_row_base;
226
227 for (int cc = 0; cc != nbCols / U_FIELD_DIM; ++cc) {
228 t_mat(i) += (a * t_col_base) * t_normal(i);
229 ++t_col_base;
230 ++t_mat;
231 }
232 ++t_row_base;
233 }
234
235 for (; rr < nbRowBaseFunctions; ++rr)
236 ++t_row_base;
237
238 ++t_w;
239 ++t_coords;
240 }
241
243 };
244};
245
247
249 const std::string row_field_name,
250 boost::shared_ptr<MatrixDouble> grad_h_ptr,
251 boost::shared_ptr<std::vector<VectorInt>> col_ind_ptr,
252 boost::shared_ptr<std::vector<MatrixDouble>> col_diff_base_ptr,
253 boost::shared_ptr<Range> ents_ptr = nullptr, double wetting_angle = 0)
254 : BoundaryEleOp(row_field_name, BoundaryEleOp::OPROW),
255 gradHPtr(grad_h_ptr), colIndicesPtr(col_ind_ptr),
256 colDiffBaseFunctionsPtr(col_diff_base_ptr), entsPtr(ents_ptr),
258
259 MoFEMErrorCode doWork(int side, EntityType type,
260 DataForcesAndSourcesCore::EntData &data) {
262 if (entsPtr) {
263 if (entsPtr->find(BoundaryEleOp::getFEEntityHandle()) == entsPtr->end())
265 }
266 const double area = getMeasure();
267
268 const auto row_size = data.getIndices().size();
269 if (row_size == 0)
271
272 auto integrate = [&](auto col_indicies, auto &col_diff_base_functions) {
274
275 const auto col_size = col_indicies.size();
276
277 locMat.resize(row_size, col_size, false);
278 locMat.clear();
279 int nb_gp = getGaussPts().size2();
280 int nb_rows = data.getIndices().size();
281
282 auto t_w = getFTensor0IntegrationWeight();
283 auto t_coords = getFTensor1CoordsAtGaussPts();
284 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*gradHPtr);
285 auto t_row_base = data.getFTensor0N();
286 int nb_row_base_functions = data.getN().size2();
287
288 auto s = wetting_angle_sub_stepping(getFEMethod()->ts_step);
289
290 for (int gg = 0; gg != nb_gp; ++gg) {
291
292 const double r = t_coords(0);
293 const double alpha = t_w * area * cylindrical(r);
294 const double h_grad_norm = sqrt(t_grad_h(i) * t_grad_h(i) + eps);
295 const double one_over_h_grad_norm = 1. / h_grad_norm;
296 const double beta = s * alpha * eta2 * one_over_h_grad_norm *
297 std::cos(M_PI * wettingAngle / 180);
298
299 int rr = 0;
300 for (; rr != nb_rows; ++rr) {
301 const double delta = beta * t_row_base;
302
303 auto ptr = &col_diff_base_functions(gg, 0);
304 auto t_col_diff_base = getFTensor1FromPtr<SPACE_DIM>(ptr);
305
306 for (int cc = 0; cc != col_size; ++cc) {
307 locMat(rr, cc) += t_col_diff_base(i) * (delta * t_grad_h(i));
308 ++t_col_diff_base;
309 }
310 ++t_row_base;
311 }
312
313 for (; rr < nb_row_base_functions; ++rr) {
314 ++t_row_base;
315 }
316
317 ++t_grad_h;
318 ++t_w;
319 ++t_coords;
320 }
321
323 };
324
325 for (auto c = 0; c != colIndicesPtr->size(); ++c) {
326
327 auto &col_ind = (*colIndicesPtr)[c];
328 if (col_ind.size()) {
329 auto &diff_base = (*colDiffBaseFunctionsPtr)[c];
330
331 CHKERR integrate(col_ind, diff_base);
332
333 CHKERR MatSetValues(getKSPB(), data.getIndices().size(),
334 &*data.getIndices().begin(), col_ind.size(),
335 &*col_ind.begin(), &locMat(0, 0), ADD_VALUES);
336 }
337 }
338
340 }
341
342private:
343 MatrixDouble locMat;
344
345 boost::shared_ptr<MatrixDouble> gradHPtr;
346 boost::shared_ptr<Range> entsPtr;
348 boost::shared_ptr<std::vector<VectorInt>> colIndicesPtr;
349 boost::shared_ptr<std::vector<MatrixDouble>> colDiffBaseFunctionsPtr;
350};
351
352/**
353 * @brief Rhs for U
354 *
355 */
357
358 OpRhsU(const std::string field_name,
359 boost::shared_ptr<MatrixDouble> dot_u_ptr,
360 boost::shared_ptr<MatrixDouble> u_ptr,
361 boost::shared_ptr<MatrixDouble> grad_u_ptr,
362 boost::shared_ptr<VectorDouble> h_ptr,
363 boost::shared_ptr<MatrixDouble> grad_h_ptr,
364 boost::shared_ptr<VectorDouble> g_ptr,
365 boost::shared_ptr<VectorDouble> p_ptr)
367 dotUPtr(dot_u_ptr), uPtr(u_ptr), gradUPtr(grad_u_ptr), hPtr(h_ptr),
368 gradHPtr(grad_h_ptr), gPtr(g_ptr), pPtr(p_ptr) {}
369
370 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data) {
372
373 const double vol = getMeasure();
374 auto t_dot_u = getFTensor1FromMat<U_FIELD_DIM>(*dotUPtr);
375 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*uPtr);
376 auto t_p = getFTensor0FromVec(*pPtr);
377 auto t_grad_u = getFTensor2FromMat<U_FIELD_DIM, SPACE_DIM>(*gradUPtr);
378 auto t_h = getFTensor0FromVec(*hPtr);
379 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*gradHPtr);
380 auto t_g = getFTensor0FromVec(*gPtr);
381 auto t_coords = getFTensor1CoordsAtGaussPts();
382
383 auto t_base = data.getFTensor0N();
384 auto t_diff_base = data.getFTensor1DiffN<SPACE_DIM>();
385
386 auto t_w = getFTensor0IntegrationWeight();
387
396
397 t_buoyancy(i) = 0;
398 t_gravity(i) = 0;
399
400 for (int gg = 0; gg != nbIntegrationPts; gg++) {
401
402 const double r = t_coords(0);
403 const double alpha = t_w * vol * cylindrical(r);
404
405 const double rho = phase_function(t_h, rho_diff, rho_ave);
406 const double mu = phase_function(t_h, mu_diff, mu_ave);
407
408 auto t_D = get_D(2 * mu);
409
410 t_inertia_force(i) = (rho * alpha) * (t_dot_u(i));
411 // t_buoyancy(SPACE_DIM - 1) = -(alpha * rho * a0) * t_h;
412 t_gravity(SPACE_DIM - 1) = (alpha * rho * a0);
413 t_phase_force(i) = -alpha * kappa * t_g * t_grad_h(i);
414 t_convection(i) = (rho * alpha) * (t_u(j) * t_grad_u(i, j));
415
416 t_stress(i, j) =
417 alpha * (t_D(i, j, k, l) * t_grad_u(k, l) + t_kd(i, j) * t_p);
418
419 auto t_nf = getFTensor1FromArray<U_FIELD_DIM, U_FIELD_DIM>(locF);
420
421 t_forces(i) = t_inertia_force(i) + t_buoyancy(i) + t_gravity(i) +
422 t_convection(i) + t_phase_force(i);
423
424 int bb = 0;
425 for (; bb != nbRows / U_FIELD_DIM; ++bb) {
426
427 t_nf(i) += t_base * t_forces(i);
428 t_nf(i) += t_diff_base(j) * t_stress(i, j);
429
430 if (coord_type == CYLINDRICAL) {
431 t_nf(0) += (t_base * (alpha / t_coords(0))) * (2 * mu * t_u(0) + t_p);
432 }
433
434 ++t_base;
435 ++t_diff_base;
436 ++t_nf;
437 }
438
439 for (; bb < nbRowBaseFunctions; ++bb) {
440 ++t_diff_base;
441 ++t_base;
442 }
443
444 ++t_dot_u;
445 ++t_u;
446 ++t_grad_u;
447 ++t_h;
448 ++t_grad_h;
449 ++t_g;
450 ++t_p;
451
452 ++t_w;
453 ++t_coords;
454 }
455
457 }
458
459private:
460 boost::shared_ptr<MatrixDouble> dotUPtr;
461 boost::shared_ptr<MatrixDouble> uPtr;
462 boost::shared_ptr<MatrixDouble> gradUPtr;
463 boost::shared_ptr<VectorDouble> hPtr;
464 boost::shared_ptr<MatrixDouble> gradHPtr;
465 boost::shared_ptr<VectorDouble> gPtr;
466 boost::shared_ptr<VectorDouble> pPtr;
467};
468
469/**
470 * @brief Lhs for U dU
471 *
472 */
474
475 OpLhsU_dU(const std::string field_name, boost::shared_ptr<MatrixDouble> u_ptr,
476 boost::shared_ptr<MatrixDouble> grad_u_ptr,
477 boost::shared_ptr<VectorDouble> h_ptr)
479 AssemblyDomainEleOp::OPROWCOL),
480 uPtr(u_ptr), gradUPtr(grad_u_ptr), hPtr(h_ptr) {
481 sYmm = false;
482 assembleTranspose = false;
483 }
484
485 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
486 EntitiesFieldData::EntData &col_data) {
488
489 const double vol = getMeasure();
490 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*uPtr);
491 auto t_grad_u = getFTensor2FromMat<U_FIELD_DIM, SPACE_DIM>(*gradUPtr);
492 auto t_h = getFTensor0FromVec(*hPtr);
493 auto t_coords = getFTensor1CoordsAtGaussPts();
494
495 auto t_row_base = row_data.getFTensor0N();
496 auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
497
498 auto t_w = getFTensor0IntegrationWeight();
499
500 auto get_mat = [&](const int rr) {
501 return getFTensor2FromArray<SPACE_DIM, SPACE_DIM, SPACE_DIM>(locMat, rr);
502 };
503
504 auto ts_a = getTSa();
506
507 for (int gg = 0; gg != nbIntegrationPts; gg++) {
508
509 const double r = t_coords(0);
510 const double alpha = t_w * vol * cylindrical(r);
511 const double rho = phase_function(t_h, rho_diff, rho_ave);
512 const double mu = phase_function(t_h, mu_diff, mu_ave);
513
514 const double beta0 = alpha * rho;
515 const double beta1 = beta0 * ts_a;
516 auto t_D = get_D(2 * mu);
517
518 int rr = 0;
519 for (; rr != nbRows / U_FIELD_DIM; ++rr) {
520
521 auto t_mat = get_mat(rr * U_FIELD_DIM);
522 auto t_col_base = col_data.getFTensor0N(gg, 0);
523 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
524
526 // I mix up the indices here so that it behaves like a
527 // Dg. That way I don't have to have a separate wrapper
528 // class Christof_Expr, which simplifies things.
529 t_d_stress(l, j, k) = t_D(i, j, k, l) * (alpha * t_row_diff_base(i));
530
531 for (int cc = 0; cc != nbCols / U_FIELD_DIM; ++cc) {
532
533 const double bb = t_row_base * t_col_base;
534
535 t_mat(i, j) += (beta1 * bb) * t_kd(i, j);
536 t_mat(i, j) += (beta0 * bb) * t_grad_u(i, j);
537 t_mat(i, j) +=
538 (beta0 * t_row_base) * t_kd(i, j) * (t_col_diff_base(k) * t_u(k));
539 t_mat(i, j) += t_d_stress(i, j, k) * t_col_diff_base(k);
540
541 if (coord_type == CYLINDRICAL) {
542 t_mat(0, 0) += (bb * (alpha / t_coords(0))) * (2 * mu);
543 }
544
545 ++t_mat;
546 ++t_col_base;
547 ++t_col_diff_base;
548 }
549
550 ++t_row_base;
551 ++t_row_diff_base;
552 }
553
554 for (; rr < nbRowBaseFunctions; ++rr) {
555 ++t_row_diff_base;
556 ++t_row_base;
557 }
558
559 ++t_u;
560 ++t_grad_u;
561 ++t_h;
562
563 ++t_coords;
564 ++t_w;
565 }
566
568 }
569
570private:
571 boost::shared_ptr<MatrixDouble> uPtr;
572 boost::shared_ptr<MatrixDouble> gradUPtr;
573 boost::shared_ptr<VectorDouble> hPtr;
574};
575
576struct OpLoopSideGetDataForSideEle : ForcesAndSourcesCore::UserDataOperator {
577
578 using UDO = ForcesAndSourcesCore::UserDataOperator;
579
581 const std::string field_name,
582 boost::shared_ptr<std::vector<VectorInt>> col_indices_ptr,
583 boost::shared_ptr<std::vector<MatrixDouble>> col_diff_basefunctions_ptr)
584 : UDO(field_name, UDO::OPCOL), colIndicesPtr(col_indices_ptr),
585 colDiffBaseFunctionsPtr(col_diff_basefunctions_ptr) {}
586
587 MoFEMErrorCode doWork(int side, EntityType type,
588 DataForcesAndSourcesCore::EntData &data) {
590
591 if (type == MBVERTEX) {
592 colIndicesPtr->clear();
594 }
595
596 colIndicesPtr->push_back(data.getIndices());
597 colDiffBaseFunctionsPtr->push_back(data.getDiffN());
598
600 }
601
602protected:
603 boost::shared_ptr<std::vector<VectorInt>> colIndicesPtr;
604 boost::shared_ptr<std::vector<MatrixDouble>> colDiffBaseFunctionsPtr;
605};
606
607/**
608 * @brief Lhs for U dH
609 *
610 */
612
613 OpLhsU_dH(const std::string field_name_u, const std::string field_name_h,
614 boost::shared_ptr<MatrixDouble> dot_u_ptr,
615 boost::shared_ptr<MatrixDouble> u_ptr,
616 boost::shared_ptr<MatrixDouble> grad_u_ptr,
617 boost::shared_ptr<VectorDouble> h_ptr,
618 boost::shared_ptr<VectorDouble> g_ptr)
619 : AssemblyDomainEleOp(field_name_u, field_name_h,
620 AssemblyDomainEleOp::OPROWCOL),
621 dotUPtr(dot_u_ptr), uPtr(u_ptr), gradUPtr(grad_u_ptr), hPtr(h_ptr),
622 gPtr(g_ptr) {
623 sYmm = false;
624 assembleTranspose = false;
625 }
626
627 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
628 EntitiesFieldData::EntData &col_data) {
630
631 const double vol = getMeasure();
632 auto t_dot_u = getFTensor1FromMat<U_FIELD_DIM>(*dotUPtr);
633 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*uPtr);
634 auto t_grad_u = getFTensor2FromMat<U_FIELD_DIM, SPACE_DIM>(*gradUPtr);
635 auto t_h = getFTensor0FromVec(*hPtr);
636 auto t_g = getFTensor0FromVec(*gPtr);
637 auto t_coords = getFTensor1CoordsAtGaussPts();
638
639 auto t_row_base = row_data.getFTensor0N();
640 auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
641
642 auto t_w = getFTensor0IntegrationWeight();
643
646 FTensor::Tensor1<double, U_FIELD_DIM> t_inertia_force_dh;
651
652 t_buoyancy_dh(i) = 0;
653 t_gravity_dh(i) = 0;
654
655 for (int gg = 0; gg != nbIntegrationPts; gg++) {
656
657 const double r = t_coords(0);
658 const double alpha = t_w * vol * cylindrical(r);
659
660 const double rho_dh = d_phase_function_h(t_h, rho_diff);
661 const double mu_dh = d_phase_function_h(t_h, mu_diff);
662
663 auto t_D_dh = get_D(2 * mu_dh);
664
665 t_inertia_force_dh(i) = (alpha * rho_dh) * t_dot_u(i);
666 // t_buoyancy_dh(SPACE_DIM - 1) = -(alpha * a0) * (rho + rho_dh * t_h);
667 t_gravity_dh(SPACE_DIM - 1) = (alpha * rho_dh * a0);
668 t_convection_dh(i) = (rho_dh * alpha) * (t_u(j) * t_grad_u(i, j));
669 const double t_phase_force_g_dh = -alpha * kappa * t_g;
670 t_forces_dh(i) = t_inertia_force_dh(i) + t_buoyancy_dh(i) +
671 t_gravity_dh(i) + t_convection_dh(i);
672
673 t_stress_dh(i, j) = alpha * (t_D_dh(i, j, k, l) * t_grad_u(k, l));
674
675 int rr = 0;
676 for (; rr != nbRows / U_FIELD_DIM; ++rr) {
677
678 auto t_mat =
679 getFTensor1FromMat<U_FIELD_DIM, 1>(locMat, rr * U_FIELD_DIM);
680 auto t_col_base = col_data.getFTensor0N(gg, 0);
681 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
682
683 for (int cc = 0; cc != nbCols; ++cc) {
684
685 const double bb = t_row_base * t_col_base;
686 t_mat(i) += t_forces_dh(i) * bb;
687 t_mat(i) += (t_phase_force_g_dh * t_row_base) * t_col_diff_base(i);
688 t_mat(i) += (t_row_diff_base(j) * t_col_base) * t_stress_dh(i, j);
689
690 if (coord_type == CYLINDRICAL) {
691 t_mat(0) += (bb * (alpha / t_coords(0))) * (2 * mu_dh * t_u(0));
692 }
693
694 ++t_mat;
695 ++t_col_base;
696 ++t_col_diff_base;
697 }
698
699 ++t_row_base;
700 ++t_row_diff_base;
701 }
702
703 for (; rr < nbRowBaseFunctions; ++rr) {
704 ++t_row_diff_base;
705 ++t_row_base;
706 }
707
708 ++t_dot_u;
709 ++t_u;
710 ++t_grad_u;
711 ++t_h;
712 ++t_g;
713 ++t_coords;
714 ++t_w;
715 }
716
718 }
719
720private:
721 boost::shared_ptr<MatrixDouble> dotUPtr;
722 boost::shared_ptr<MatrixDouble> uPtr;
723 boost::shared_ptr<MatrixDouble> gradUPtr;
724 boost::shared_ptr<VectorDouble> hPtr;
725 boost::shared_ptr<VectorDouble> gPtr;
726};
727
728/**
729 * @brief Lhs for G dH
730 *
731 */
733
734 OpLhsU_dG(const std::string field_name_u, const std::string field_name_h,
735 boost::shared_ptr<MatrixDouble> grad_h_ptr)
736 : AssemblyDomainEleOp(field_name_u, field_name_h,
737 AssemblyDomainEleOp::OPROWCOL),
738 gradHPtr(grad_h_ptr) {
739 sYmm = false;
740 assembleTranspose = false;
741 }
742
743 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
744 EntitiesFieldData::EntData &col_data) {
746
747 const double vol = getMeasure();
748 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*gradHPtr);
749 auto t_coords = getFTensor1CoordsAtGaussPts();
750
751 auto t_row_base = row_data.getFTensor0N();
752 auto t_w = getFTensor0IntegrationWeight();
753
754 for (int gg = 0; gg != nbIntegrationPts; gg++) {
755
756 const double r = t_coords(0);
757 const double alpha = t_w * vol * cylindrical(r);
758
760 t_phase_force_dg(i) = -alpha * kappa * t_grad_h(i);
761
762 int rr = 0;
763 for (; rr != nbRows / U_FIELD_DIM; ++rr) {
764 auto t_mat =
765 getFTensor1FromMat<U_FIELD_DIM, 1>(locMat, rr * U_FIELD_DIM);
766 auto t_col_base = col_data.getFTensor0N(gg, 0);
767
768 for (int cc = 0; cc != nbCols; ++cc) {
769 const double bb = t_row_base * t_col_base;
770 t_mat(i) += t_phase_force_dg(i) * bb;
771
772 ++t_mat;
773 ++t_col_base;
774 }
775
776 ++t_row_base;
777 }
778
779 for (; rr < nbRowBaseFunctions; ++rr) {
780 ++t_row_base;
781 }
782
783 ++t_grad_h;
784 ++t_coords;
785 ++t_w;
786 }
787
789 }
790
791private:
792 boost::shared_ptr<MatrixDouble> gradHPtr;
793};
794
795template <bool I> struct OpRhsH : public AssemblyDomainEleOp {
796
797 OpRhsH(const std::string field_name, boost::shared_ptr<MatrixDouble> u_ptr,
798 boost::shared_ptr<VectorDouble> dot_h_ptr,
799 boost::shared_ptr<VectorDouble> h_ptr,
800 boost::shared_ptr<MatrixDouble> grad_h_ptr,
801 boost::shared_ptr<MatrixDouble> grad_g_ptr)
803 uPtr(u_ptr), dotHPtr(dot_h_ptr), hPtr(h_ptr), gradHPtr(grad_h_ptr),
804 gradGPtr(grad_g_ptr) {}
805
806 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data) {
808
809 const double vol = getMeasure();
810 auto t_w = getFTensor0IntegrationWeight();
811 auto t_coords = getFTensor1CoordsAtGaussPts();
812 auto t_base = data.getFTensor0N();
813 auto t_diff_base = data.getFTensor1DiffN<SPACE_DIM>();
814
815#ifndef NDEBUG
816 if (data.getDiffN().size1() != data.getN().size1())
817 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 1");
818 if (data.getDiffN().size2() != data.getN().size2() * SPACE_DIM) {
819 MOFEM_LOG("SELF", Sev::error)
820 << "Side " << rowSide << " " << CN::EntityTypeName(rowType);
821 MOFEM_LOG("SELF", Sev::error) << data.getN();
822 MOFEM_LOG("SELF", Sev::error) << data.getDiffN();
823 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 2");
824 }
825#endif
826
827 if constexpr (I) {
828
829 auto t_h = getFTensor0FromVec(*hPtr);
830 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*gradGPtr);
831
832 for (int gg = 0; gg != nbIntegrationPts; ++gg) {
833
834 const double r = t_coords(0);
835 const double alpha = t_w * vol * cylindrical(r);
836
837 const double set_h = init_h(t_coords(0), t_coords(1), t_coords(2));
838 const double m = get_M(set_h) * alpha;
839
840 int bb = 0;
841 for (; bb != nbRows; ++bb) {
842 locF[bb] += (t_base * alpha) * (t_h - set_h);
843 locF[bb] += (t_diff_base(i) * m) * t_grad_g(i);
844 ++t_base;
845 ++t_diff_base;
846 }
847
848 for (; bb < nbRowBaseFunctions; ++bb) {
849 ++t_base;
850 ++t_diff_base;
851 }
852
853 ++t_h;
854 ++t_grad_g;
855
856 ++t_coords;
857 ++t_w;
858 }
859
860 } else {
861
862 auto t_dot_h = getFTensor0FromVec(*dotHPtr);
863 auto t_h = getFTensor0FromVec(*hPtr);
864 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*uPtr);
865 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*gradHPtr);
866 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*gradGPtr);
867
868 for (int gg = 0; gg != nbIntegrationPts; ++gg) {
869
870 const double r = t_coords(0);
871 const double alpha = t_w * vol * cylindrical(r);
872
873 const double m = get_M(t_h) * alpha;
874
875 int bb = 0;
876 for (; bb != nbRows; ++bb) {
877 locF[bb] += (t_base * alpha) * (t_dot_h);
878 locF[bb] += (t_base * alpha) * (t_grad_h(i) * t_u(i));
879 locF[bb] += (t_diff_base(i) * t_grad_g(i)) * m;
880 ++t_base;
881 ++t_diff_base;
882 }
883
884 for (; bb < nbRowBaseFunctions; ++bb) {
885 ++t_base;
886 ++t_diff_base;
887 }
888
889 ++t_dot_h;
890 ++t_h;
891 ++t_grad_g;
892 ++t_u;
893 ++t_grad_h;
894
895 ++t_coords;
896 ++t_w;
897 }
898 }
899
901 }
902
903private:
904 boost::shared_ptr<MatrixDouble> uPtr;
905 boost::shared_ptr<VectorDouble> dotHPtr;
906 boost::shared_ptr<VectorDouble> hPtr;
907 boost::shared_ptr<MatrixDouble> gradHPtr;
908 boost::shared_ptr<MatrixDouble> gradGPtr;
909};
910
911/**
912 * @brief Lhs for H dU
913 *
914 */
916 OpLhsH_dU(const std::string h_field_name, const std::string u_field_name,
917 boost::shared_ptr<MatrixDouble> grad_h_ptr)
918 : AssemblyDomainEleOp(h_field_name, u_field_name,
919 AssemblyDomainEleOp::OPROWCOL),
920 gradHPtr(grad_h_ptr) {
921 sYmm = false;
922 assembleTranspose = false;
923 }
924 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
925 EntitiesFieldData::EntData &col_data) {
927
928 const double vol = getMeasure();
929 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*gradHPtr);
930 auto t_coords = getFTensor1CoordsAtGaussPts();
931
932 auto t_row_base = row_data.getFTensor0N();
933 auto t_w = getFTensor0IntegrationWeight();
934
935 for (int gg = 0; gg != nbIntegrationPts; gg++) {
936
937 const auto r = t_coords(0);
938 const auto alpha = t_w * vol * cylindrical(r);
939 auto t_mat = getFTensor1FromPtr<U_FIELD_DIM>(&locMat(0, 0));
941
942 int rr = 0;
943 for (; rr != nbRows; ++rr) {
944 t_row(i) = (alpha * t_row_base) * t_grad_h(i);
945 auto t_col_base = col_data.getFTensor0N(gg, 0);
946 for (int cc = 0; cc != nbCols / U_FIELD_DIM; ++cc) {
947 t_mat(i) += t_row(i) * t_col_base;
948 ++t_mat;
949 ++t_col_base;
950 }
951 ++t_row_base;
952 }
953
954 for (; rr < nbRowBaseFunctions; ++rr)
955 ++t_row_base;
956
957 ++t_grad_h;
958 ++t_w;
959 ++t_coords;
960 }
961
963 }
964
965private:
966 boost::shared_ptr<MatrixDouble> gradHPtr;
967};
968
969/**
970 * @brief Lhs for H dH
971 *
972 */
973template <bool I> struct OpLhsH_dH : public AssemblyDomainEleOp {
974
975 OpLhsH_dH(const std::string field_name, boost::shared_ptr<MatrixDouble> u_ptr,
976 boost::shared_ptr<VectorDouble> h_ptr,
977 boost::shared_ptr<MatrixDouble> grad_g_ptr)
979 AssemblyDomainEleOp::OPROWCOL),
980 uPtr(u_ptr), hPtr(h_ptr), gradGPtr(grad_g_ptr) {
981 sYmm = false;
982 }
983
984 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
985 EntitiesFieldData::EntData &col_data) {
987
988 const double vol = getMeasure();
989 auto t_w = getFTensor0IntegrationWeight();
990 auto t_coords = getFTensor1CoordsAtGaussPts();
991 auto t_row_base = row_data.getFTensor0N();
992 auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
993
994#ifndef NDEBUG
995 if (row_data.getDiffN().size1() != row_data.getN().size1())
996 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 1");
997 if (row_data.getDiffN().size2() != row_data.getN().size2() * SPACE_DIM) {
998 MOFEM_LOG("SELF", Sev::error)
999 << "Side " << rowSide << " " << CN::EntityTypeName(rowType);
1000 MOFEM_LOG("SELF", Sev::error) << row_data.getN();
1001 MOFEM_LOG("SELF", Sev::error) << row_data.getDiffN();
1002 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 2");
1003 }
1004
1005 if (col_data.getDiffN().size1() != col_data.getN().size1())
1006 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 1");
1007 if (col_data.getDiffN().size2() != col_data.getN().size2() * SPACE_DIM) {
1008 MOFEM_LOG("SELF", Sev::error)
1009 << "Side " << rowSide << " " << CN::EntityTypeName(rowType);
1010 MOFEM_LOG("SELF", Sev::error) << col_data.getN();
1011 MOFEM_LOG("SELF", Sev::error) << col_data.getDiffN();
1012 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "wrong size 2");
1013 }
1014#endif
1015
1016 if constexpr (I) {
1017
1018 auto t_h = getFTensor0FromVec(*hPtr);
1019 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*gradGPtr);
1020
1021 for (int gg = 0; gg != nbIntegrationPts; gg++) {
1022
1023 const double r = t_coords(0);
1024 const double alpha = t_w * vol * cylindrical(r);
1025
1026 int rr = 0;
1027 for (; rr != nbRows; ++rr) {
1028
1029 auto t_col_base = col_data.getFTensor0N(gg, 0);
1030 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
1031
1032 for (int cc = 0; cc != nbCols; ++cc) {
1033
1034 locMat(rr, cc) += (t_row_base * t_col_base * alpha);
1035
1036 ++t_col_base;
1037 ++t_col_diff_base;
1038 }
1039
1040 ++t_row_base;
1041 ++t_row_diff_base;
1042 }
1043
1044 for (; rr < nbRowBaseFunctions; ++rr) {
1045 ++t_row_base;
1046 ++t_row_diff_base;
1047 }
1048
1049 ++t_h;
1050 ++t_grad_g;
1051 ++t_w;
1052 ++t_coords;
1053 }
1054
1055 } else {
1056
1057 auto t_h = getFTensor0FromVec(*hPtr);
1058 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*gradGPtr);
1059 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*uPtr);
1060
1061 auto ts_a = getTSa();
1062
1063 for (int gg = 0; gg != nbIntegrationPts; gg++) {
1064
1065 const double r = t_coords(0);
1066 const double alpha = t_w * vol * cylindrical(r);
1067
1068 auto m_dh = get_M_dh(t_h) * alpha;
1069 int rr = 0;
1070 for (; rr != nbRows; ++rr) {
1071
1072 auto t_col_base = col_data.getFTensor0N(gg, 0);
1073 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
1074
1075 for (int cc = 0; cc != nbCols; ++cc) {
1076
1077 locMat(rr, cc) += (t_row_base * t_col_base * alpha) * ts_a;
1078 locMat(rr, cc) +=
1079 (t_row_base * alpha) * (t_col_diff_base(i) * t_u(i));
1080 locMat(rr, cc) +=
1081 (t_row_diff_base(i) * t_grad_g(i)) * (t_col_base * m_dh);
1082
1083 ++t_col_base;
1084 ++t_col_diff_base;
1085 }
1086
1087 ++t_row_base;
1088 ++t_row_diff_base;
1089 }
1090
1091 for (; rr < nbRowBaseFunctions; ++rr) {
1092 ++t_row_base;
1093 ++t_row_diff_base;
1094 }
1095
1096 ++t_u;
1097 ++t_h;
1098 ++t_grad_g;
1099 ++t_w;
1100 ++t_coords;
1101 }
1102 }
1103
1105 }
1106
1107private:
1108 boost::shared_ptr<MatrixDouble> uPtr;
1109 boost::shared_ptr<VectorDouble> hPtr;
1110 boost::shared_ptr<MatrixDouble> gradGPtr;
1111};
1112
1113/**
1114 * @brief Lhs for H dH
1115 *
1116 */
1117template <bool I> struct OpLhsH_dG : public AssemblyDomainEleOp {
1118
1119 OpLhsH_dG(const std::string field_name_h, const std::string field_name_g,
1120 boost::shared_ptr<VectorDouble> h_ptr)
1121 : AssemblyDomainEleOp(field_name_h, field_name_g,
1122 AssemblyDomainEleOp::OPROWCOL),
1123 hPtr(h_ptr) {
1124 sYmm = false;
1125 assembleTranspose = false;
1126 }
1127
1128 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
1129 EntitiesFieldData::EntData &col_data) {
1131
1132 const double vol = getMeasure();
1133 auto t_h = getFTensor0FromVec(*hPtr);
1134
1135 auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
1136 auto t_w = getFTensor0IntegrationWeight();
1137 auto t_coords = getFTensor1CoordsAtGaussPts();
1138
1139 for (int gg = 0; gg != nbIntegrationPts; gg++) {
1140
1141 const double r = t_coords(0);
1142 const double alpha = t_w * vol * cylindrical(r);
1143
1144 double set_h;
1145 if constexpr (I)
1146 set_h = init_h(t_coords(0), t_coords(1), t_coords(2));
1147 else
1148 set_h = t_h;
1149
1150 auto m = get_M(set_h) * alpha;
1151
1152 int rr = 0;
1153 for (; rr != nbRows; ++rr) {
1154 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
1155
1156 for (int cc = 0; cc != nbCols; ++cc) {
1157 locMat(rr, cc) += (t_row_diff_base(i) * t_col_diff_base(i)) * m;
1158
1159 ++t_col_diff_base;
1160 }
1161
1162 ++t_row_diff_base;
1163 }
1164
1165 for (; rr < nbRowBaseFunctions; ++rr) {
1166 ++t_row_diff_base;
1167 }
1168
1169 ++t_h;
1170 ++t_w;
1171 ++t_coords;
1172 }
1173
1175 }
1176
1177private:
1178 boost::shared_ptr<VectorDouble> hPtr;
1179};
1180
1181template <bool I> struct OpRhsG : public AssemblyDomainEleOp {
1182
1183 OpRhsG(const std::string field_name, boost::shared_ptr<VectorDouble> h_ptr,
1184 boost::shared_ptr<MatrixDouble> grad_h_ptr,
1185 boost::shared_ptr<VectorDouble> g_ptr)
1187 hPtr(h_ptr), gradHPtr(grad_h_ptr), gPtr(g_ptr) {}
1188
1189 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data) {
1191
1192 const double vol = getMeasure();
1193 auto t_h = getFTensor0FromVec(*hPtr);
1194 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*gradHPtr);
1195 auto t_g = getFTensor0FromVec(*gPtr);
1196 auto t_coords = getFTensor1CoordsAtGaussPts();
1197
1198 auto t_base = data.getFTensor0N();
1199 auto t_diff_base = data.getFTensor1DiffN<SPACE_DIM>();
1200 auto t_w = getFTensor0IntegrationWeight();
1201
1202 for (int gg = 0; gg != nbIntegrationPts; ++gg) {
1203
1204 const double r = t_coords(0);
1205 const double alpha = t_w * vol * cylindrical(r);
1206
1207 double set_h;
1208 if constexpr (I)
1209 set_h = init_h(t_coords(0), t_coords(1), t_coords(2));
1210 else
1211 set_h = t_h;
1212
1213 const double f = get_f(set_h);
1214
1215 int bb = 0;
1216 for (; bb != nbRows; ++bb) {
1217 locF[bb] += (t_base * alpha) * (t_g - f);
1218 locF[bb] -= (t_diff_base(i) * (eta2 * alpha)) * t_grad_h(i);
1219 ++t_base;
1220 ++t_diff_base;
1221 }
1222
1223 for (; bb < nbRowBaseFunctions; ++bb) {
1224 ++t_base;
1225 ++t_diff_base;
1226 }
1227
1228 ++t_h;
1229 ++t_grad_h;
1230 ++t_g;
1231
1232 ++t_coords;
1233 ++t_w;
1234 }
1235
1237 }
1238
1239private:
1240 boost::shared_ptr<VectorDouble> hPtr;
1241 boost::shared_ptr<MatrixDouble> gradHPtr;
1242 boost::shared_ptr<VectorDouble> gPtr;
1243};
1244
1245/**
1246 * @brief Lhs for H dH
1247 *
1248 */
1249template <bool I> struct OpLhsG_dH : public AssemblyDomainEleOp {
1250
1251 OpLhsG_dH(const std::string field_name_g, const std::string field_name_h,
1252 boost::shared_ptr<VectorDouble> h_ptr)
1253 : AssemblyDomainEleOp(field_name_g, field_name_h,
1254 AssemblyDomainEleOp::OPROWCOL),
1255 hPtr(h_ptr) {
1256 sYmm = false;
1257 assembleTranspose = false;
1258 }
1259
1260 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
1261 EntitiesFieldData::EntData &col_data) {
1263
1264 const double vol = getMeasure();
1265 auto t_h = getFTensor0FromVec(*hPtr);
1266
1267 auto t_row_base = row_data.getFTensor0N();
1268 auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
1269 auto t_w = getFTensor0IntegrationWeight();
1270 auto t_coords = getFTensor1CoordsAtGaussPts();
1271
1272 for (int gg = 0; gg != nbIntegrationPts; ++gg) {
1273
1274 const double r = t_coords(0);
1275 const double alpha = t_w * vol * cylindrical(r);
1276
1277 const double f_dh = get_f_dh(t_h) * alpha;
1278 const double beta = eta2 * alpha;
1279
1280 int rr = 0;
1281 for (; rr != nbRows; ++rr) {
1282
1283 auto t_col_base = col_data.getFTensor0N(gg, 0);
1284 auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
1285
1286 for (int cc = 0; cc != nbCols; ++cc) {
1287
1288 if constexpr (I == false)
1289 locMat(rr, cc) -= (t_row_base * t_col_base) * f_dh;
1290 locMat(rr, cc) -= (t_row_diff_base(i) * beta) * t_col_diff_base(i);
1291
1292 ++t_col_base;
1293 ++t_col_diff_base;
1294 }
1295
1296 ++t_row_base;
1297 ++t_row_diff_base;
1298 }
1299
1300 for (; rr < nbRowBaseFunctions; ++rr) {
1301 ++t_row_base;
1302 ++t_row_diff_base;
1303 }
1304
1305 ++t_h;
1306 ++t_w;
1307 ++t_coords;
1308 }
1309
1311 }
1312
1313private:
1314 boost::shared_ptr<VectorDouble> hPtr;
1315};
1316
1317/**
1318 * @brief Lhs for H dH
1319 *
1320 */
1322
1323 OpLhsG_dG(const std::string field_name)
1325 AssemblyDomainEleOp::OPROWCOL) {
1326 sYmm = true;
1327 }
1328
1329 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
1330 EntitiesFieldData::EntData &col_data) {
1332
1333 const double vol = getMeasure();
1334
1335 auto t_row_base = row_data.getFTensor0N();
1336 auto t_w = getFTensor0IntegrationWeight();
1337 auto t_coords = getFTensor1CoordsAtGaussPts();
1338
1339 for (int gg = 0; gg != nbIntegrationPts; ++gg) {
1340
1341 const double r = t_coords(0);
1342 const double alpha = t_w * vol * cylindrical(r);
1343
1344 int rr = 0;
1345 for (; rr != nbRows; ++rr) {
1346 auto t_col_base = col_data.getFTensor0N(gg, 0);
1347 const double beta = alpha * t_row_base;
1348 for (int cc = 0; cc != nbCols; ++cc) {
1349 locMat(rr, cc) += (t_col_base * beta);
1350 ++t_col_base;
1351 }
1352
1353 ++t_row_base;
1354 }
1355
1356 for (; rr < nbRowBaseFunctions; ++rr) {
1357 ++t_row_base;
1358 }
1359
1360 ++t_w;
1361 ++t_coords;
1362 }
1363
1365 }
1366
1367private:
1368};
1369
1370} // namespace FreeSurfaceOps
constexpr double a
static const double eps
constexpr int SPACE_DIM
Kronecker Delta class symmetric.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
@ CYLINDRICAL
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
auto cylindrical
double kappa
double mu_diff
constexpr int U_FIELD_DIM
auto get_M_dh
double rho_diff
auto init_h
Initialisation function.
constexpr auto t_kd
auto d_phase_function_h
double rho_ave
double eta2
auto get_f_dh
auto wetting_angle
auto get_M
double mu_ave
auto phase_function
auto get_D
auto wetting_angle_sub_stepping
auto get_f
#define MOFEM_LOG(channel, severity)
Log.
constexpr double a0
FTensor::Index< 'i', SPACE_DIM > i
constexpr CoordinateTypes coord_type
const double c
speed of light (cm/ns)
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
constexpr IntegrationType I
double rho
Definition plastic.cpp:144
constexpr auto field_name
static constexpr double delta
FTensor::Index< 'm', 3 > m
MoFEMErrorCode doWork(int row_side, EntityType row_type, EntitiesFieldData::EntData &data)
boost::shared_ptr< VectorDouble > liftPtr
OpCalculateLift(const std::string field_name, boost::shared_ptr< VectorDouble > p_ptr, boost::shared_ptr< VectorDouble > lift_ptr, boost::shared_ptr< Range > ents_ptr)
boost::shared_ptr< VectorDouble > pPtr
boost::shared_ptr< Range > entsPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
OpLhsG_dG(const std::string field_name)
boost::shared_ptr< VectorDouble > hPtr
OpLhsG_dH(const std::string field_name_g, const std::string field_name_h, boost::shared_ptr< VectorDouble > h_ptr)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
OpLhsH_dG(const std::string field_name_h, const std::string field_name_g, boost::shared_ptr< VectorDouble > h_ptr)
boost::shared_ptr< VectorDouble > hPtr
boost::shared_ptr< MatrixDouble > uPtr
OpLhsH_dH(const std::string field_name, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< VectorDouble > h_ptr, boost::shared_ptr< MatrixDouble > grad_g_ptr)
boost::shared_ptr< MatrixDouble > gradGPtr
boost::shared_ptr< VectorDouble > hPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
boost::shared_ptr< MatrixDouble > gradHPtr
OpLhsH_dU(const std::string h_field_name, const std::string u_field_name, boost::shared_ptr< MatrixDouble > grad_h_ptr)
OpLhsU_dG(const std::string field_name_u, const std::string field_name_h, boost::shared_ptr< MatrixDouble > grad_h_ptr)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
boost::shared_ptr< MatrixDouble > gradHPtr
boost::shared_ptr< VectorDouble > gPtr
OpLhsU_dH(const std::string field_name_u, const std::string field_name_h, boost::shared_ptr< MatrixDouble > dot_u_ptr, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< MatrixDouble > grad_u_ptr, boost::shared_ptr< VectorDouble > h_ptr, boost::shared_ptr< VectorDouble > g_ptr)
boost::shared_ptr< VectorDouble > hPtr
boost::shared_ptr< MatrixDouble > uPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
boost::shared_ptr< MatrixDouble > gradUPtr
boost::shared_ptr< MatrixDouble > dotUPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
boost::shared_ptr< MatrixDouble > gradUPtr
OpLhsU_dU(const std::string field_name, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< MatrixDouble > grad_u_ptr, boost::shared_ptr< VectorDouble > h_ptr)
boost::shared_ptr< MatrixDouble > uPtr
boost::shared_ptr< VectorDouble > hPtr
boost::shared_ptr< std::vector< VectorInt > > colIndicesPtr
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
OpLoopSideGetDataForSideEle(const std::string field_name, boost::shared_ptr< std::vector< VectorInt > > col_indices_ptr, boost::shared_ptr< std::vector< MatrixDouble > > col_diff_basefunctions_ptr)
ForcesAndSourcesCore::UserDataOperator UDO
boost::shared_ptr< std::vector< MatrixDouble > > colDiffBaseFunctionsPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
OpNormalConstrainLhs(const std::string field_name_row, const std::string field_name_col)
OpNormalConstrainRhs(const std::string field_name, boost::shared_ptr< MatrixDouble > u_ptr)
boost::shared_ptr< MatrixDouble > uPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data)
boost::shared_ptr< VectorDouble > lambdaPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data)
OpNormalForceRhs(const std::string field_name, boost::shared_ptr< VectorDouble > lambda_ptr)
OpRhsG(const std::string field_name, boost::shared_ptr< VectorDouble > h_ptr, boost::shared_ptr< MatrixDouble > grad_h_ptr, boost::shared_ptr< VectorDouble > g_ptr)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
boost::shared_ptr< MatrixDouble > gradHPtr
boost::shared_ptr< VectorDouble > hPtr
boost::shared_ptr< VectorDouble > gPtr
boost::shared_ptr< VectorDouble > hPtr
boost::shared_ptr< MatrixDouble > gradGPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
boost::shared_ptr< MatrixDouble > uPtr
boost::shared_ptr< VectorDouble > dotHPtr
boost::shared_ptr< MatrixDouble > gradHPtr
OpRhsH(const std::string field_name, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< VectorDouble > dot_h_ptr, boost::shared_ptr< VectorDouble > h_ptr, boost::shared_ptr< MatrixDouble > grad_h_ptr, boost::shared_ptr< MatrixDouble > grad_g_ptr)
boost::shared_ptr< MatrixDouble > gradUPtr
boost::shared_ptr< VectorDouble > pPtr
OpRhsU(const std::string field_name, boost::shared_ptr< MatrixDouble > dot_u_ptr, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< MatrixDouble > grad_u_ptr, boost::shared_ptr< VectorDouble > h_ptr, boost::shared_ptr< MatrixDouble > grad_h_ptr, boost::shared_ptr< VectorDouble > g_ptr, boost::shared_ptr< VectorDouble > p_ptr)
boost::shared_ptr< VectorDouble > gPtr
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
boost::shared_ptr< VectorDouble > hPtr
boost::shared_ptr< MatrixDouble > dotUPtr
boost::shared_ptr< MatrixDouble > uPtr
boost::shared_ptr< MatrixDouble > gradHPtr
boost::shared_ptr< MatrixDouble > gradHPtr
boost::shared_ptr< std::vector< VectorInt > > colIndicesPtr
boost::shared_ptr< std::vector< MatrixDouble > > colDiffBaseFunctionsPtr
boost::shared_ptr< Range > entsPtr
OpWettingAngleLhs(const std::string row_field_name, boost::shared_ptr< MatrixDouble > grad_h_ptr, boost::shared_ptr< std::vector< VectorInt > > col_ind_ptr, boost::shared_ptr< std::vector< MatrixDouble > > col_diff_base_ptr, boost::shared_ptr< Range > ents_ptr=nullptr, double wetting_angle=0)
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
boost::shared_ptr< MatrixDouble > gradHPtr
OpWettingAngleRhs(const std::string field_name, boost::shared_ptr< MatrixDouble > grad_h_ptr, boost::shared_ptr< Range > ents_ptr=nullptr, double wetting_angle=0)
MoFEMErrorCode iNtegrate(DataForcesAndSourcesCore::EntData &row_data)
boost::shared_ptr< Range > entsPtr