33 boost::shared_ptr<VectorDouble> p_ptr,
34 boost::shared_ptr<VectorDouble> lift_ptr,
35 boost::shared_ptr<Range> ents_ptr)
38 std::fill(&doEntities[MBVERTEX], &doEntities[MBMAXTYPE],
false);
39 doEntities[MBEDGE] =
true;
42 MoFEMErrorCode
doWork(
int row_side, EntityType row_type,
43 EntitiesFieldData::EntData &data) {
46 const auto fe_ent = getFEEntityHandle();
49 auto t_w = getFTensor0IntegrationWeight();
50 auto t_p = getFTensor0FromVec(*
pPtr);
51 auto t_normal = getFTensor1Normal();
52 auto t_coords = getFTensor1CoordsAtGaussPts();
53 auto t_lift = getFTensor1FromArray<SPACE_DIM, SPACE_DIM>(*
liftPtr);
55 const auto nb_int_points = getGaussPts().size2();
57 for (
int gg = 0; gg != nb_int_points; gg++) {
59 const double r = t_coords(0);
61 t_lift(
i) -= t_normal(
i) * (t_p * alpha);
73 boost::shared_ptr<VectorDouble>
pPtr;
91 boost::shared_ptr<MatrixDouble> u_ptr)
96 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data) {
99 auto t_w = getFTensor0IntegrationWeight();
100 auto t_normal = getFTensor1Normal();
101 auto t_u = getFTensor1FromMat<SPACE_DIM>(*
uPtr);
102 auto t_row_base = row_data.getFTensor0N();
103 auto t_coords = getFTensor1CoordsAtGaussPts();
105 for (
int gg = 0; gg != nbIntegrationPts; gg++) {
107 const double r = t_coords(0);
111 for (; bb != nbRows; ++bb) {
112 locF[bb] += alpha * t_row_base * (t_normal(
i) * t_u(
i));
116 for (; bb < nbRowBaseFunctions; ++bb)
128 boost::shared_ptr<MatrixDouble>
uPtr;
143 boost::shared_ptr<VectorDouble> lambda_ptr)
148 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data) {
151 auto t_w = getFTensor0IntegrationWeight();
152 auto t_normal = getFTensor1Normal();
153 auto t_lambda = getFTensor0FromVec(*
lambdaPtr);
154 auto t_row_base = row_data.getFTensor0N();
155 auto t_coords = getFTensor1CoordsAtGaussPts();
157 for (
int gg = 0; gg != nbIntegrationPts; gg++) {
159 auto t_nf = getFTensor1FromArray<U_FIELD_DIM, U_FIELD_DIM>(locF);
161 const double r = t_coords(0);
167 t_nf(
i) += alpha * t_row_base * t_normal(
i) * t_lambda;
172 for (; bb < nbRowBaseFunctions; ++bb)
203 boost::shared_ptr<MatrixDouble> grad_h_ptr,
204 boost::shared_ptr<Range> ents_ptr =
nullptr,
210 MoFEMErrorCode
iNtegrate(DataForcesAndSourcesCore::EntData &row_data) {
213 if (
entsPtr->find(AssemblyBoundaryEleOp::getFEEntityHandle()) ==
217 const double area = getMeasure();
218 auto t_w = getFTensor0IntegrationWeight();
219 auto t_row_base = row_data.getFTensor0N();
220 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*
gradHPtr);
221 auto t_coords = getFTensor1CoordsAtGaussPts();
225 for (
int gg = 0; gg != nbIntegrationPts; gg++) {
227 const double r = t_coords(0);
229 const double h_grad_norm = sqrt(t_grad_h(
i) * t_grad_h(
i) +
eps);
230 const double cos_angle = std::cos(M_PI *
wettingAngle / 180);
231 const double rhs_wetting = s *
eta2 * h_grad_norm * cos_angle;
236 for (; bb != nbRows; ++bb) {
237 locF[bb] += alpha * t_row_base * rhs_wetting;
241 for (; bb < nbRowBaseFunctions; ++bb)
275 const std::string field_name_col)
278 assembleTranspose =
true;
282 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data,
283 EntitiesFieldData::EntData &col_data) {
286 auto t_w = getFTensor0IntegrationWeight();
287 auto t_normal = getFTensor1Normal();
288 auto t_row_base = row_data.getFTensor0N();
289 auto t_coords = getFTensor1CoordsAtGaussPts();
291 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
293 auto t_mat = getFTensor1FromPtr<U_FIELD_DIM>(&locMat(0, 0));
295 const double r = t_coords(0);
299 for (; rr != nbRows; ++rr) {
301 auto t_col_base = col_data.getFTensor0N(gg, 0);
302 const double a = alpha * t_row_base;
304 for (
int cc = 0; cc != nbCols /
U_FIELD_DIM; ++cc) {
305 t_mat(
i) += (
a * t_col_base) * t_normal(
i);
312 for (; rr < nbRowBaseFunctions; ++rr)
343 const std::string row_field_name,
344 boost::shared_ptr<MatrixDouble> grad_h_ptr,
345 boost::shared_ptr<std::vector<VectorInt>> col_ind_ptr,
346 boost::shared_ptr<std::vector<MatrixDouble>> col_diff_base_ptr,
347 boost::shared_ptr<Range> ents_ptr =
nullptr,
double wetting_angle = 0)
353 MoFEMErrorCode
doWork(
int side, EntityType type,
354 DataForcesAndSourcesCore::EntData &data) {
357 if (
entsPtr->find(BoundaryEleOp::getFEEntityHandle()) ==
entsPtr->end())
360 const double area = getMeasure();
362 const auto row_size = data.getIndices().size();
366 auto integrate = [&](
auto col_indicies,
auto &col_diff_base_functions) {
369 const auto col_size = col_indicies.size();
371 locMat.resize(row_size, col_size,
false);
373 int nb_gp = getGaussPts().size2();
374 int nb_rows = data.getIndices().size();
376 auto t_w = getFTensor0IntegrationWeight();
377 auto t_coords = getFTensor1CoordsAtGaussPts();
378 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*
gradHPtr);
379 auto t_row_base = data.getFTensor0N();
380 int nb_row_base_functions = data.getN().size2();
384 for (
int gg = 0; gg != nb_gp; ++gg) {
386 const double r = t_coords(0);
388 const double h_grad_norm = sqrt(t_grad_h(
i) * t_grad_h(
i) +
eps);
389 const double one_over_h_grad_norm = 1. / h_grad_norm;
390 const double beta = s * alpha *
eta2 * one_over_h_grad_norm *
394 for (; rr != nb_rows; ++rr) {
395 const double delta = beta * t_row_base;
397 auto ptr = &col_diff_base_functions(gg, 0);
398 auto t_col_diff_base = getFTensor1FromPtr<SPACE_DIM>(ptr);
400 for (
int cc = 0; cc != col_size; ++cc) {
401 locMat(rr, cc) += t_col_diff_base(
i) * (
delta * t_grad_h(
i));
407 for (; rr < nb_row_base_functions; ++rr) {
421 auto &col_ind = (*colIndicesPtr)[
c];
422 if (col_ind.size()) {
423 auto &diff_base = (*colDiffBaseFunctionsPtr)[
c];
425 CHKERR integrate(col_ind, diff_base);
427 CHKERR MatSetValues(getKSPB(), data.getIndices().size(),
428 &*data.getIndices().begin(), col_ind.size(),
429 &*col_ind.begin(), &
locMat(0, 0), ADD_VALUES);
478 boost::shared_ptr<MatrixDouble> dot_u_ptr,
479 boost::shared_ptr<MatrixDouble> u_ptr,
480 boost::shared_ptr<MatrixDouble> grad_u_ptr,
481 boost::shared_ptr<VectorDouble> h_ptr,
482 boost::shared_ptr<MatrixDouble> grad_h_ptr,
483 boost::shared_ptr<VectorDouble> g_ptr,
484 boost::shared_ptr<VectorDouble> p_ptr)
489 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
492 const double vol = getMeasure();
493 auto t_dot_u = getFTensor1FromMat<U_FIELD_DIM>(*
dotUPtr);
494 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*
uPtr);
495 auto t_p = getFTensor0FromVec(*
pPtr);
496 auto t_grad_u = getFTensor2FromMat<U_FIELD_DIM, SPACE_DIM>(*
gradUPtr);
497 auto t_h = getFTensor0FromVec(*
hPtr);
498 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*
gradHPtr);
499 auto t_g = getFTensor0FromVec(*
gPtr);
500 auto t_coords = getFTensor1CoordsAtGaussPts();
502 auto t_base = data.getFTensor0N();
503 auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
505 auto t_w = getFTensor0IntegrationWeight();
519 for (
int gg = 0; gg != nbIntegrationPts; gg++) {
521 const double r = t_coords(0);
529 t_inertia_force(
i) = (
rho * alpha) * (t_dot_u(
i));
532 t_phase_force(
i) = -alpha *
kappa * t_g * t_grad_h(
i);
533 t_convection(
i) = (
rho * alpha) * (t_u(
j) * t_grad_u(
i,
j));
536 alpha * (t_D(
i,
j,
k,
l) * t_grad_u(
k,
l) +
t_kd(
i,
j) * t_p);
538 auto t_nf = getFTensor1FromArray<U_FIELD_DIM, U_FIELD_DIM>(locF);
540 t_forces(
i) = t_inertia_force(
i) + t_buoyancy(
i) + t_gravity(
i) +
541 t_convection(
i) + t_phase_force(
i);
547 t_nf(
i) += t_base * t_forces(
i);
548 t_nf(
i) += t_diff_base(
j) * t_stress(
i,
j);
551 t_nf(0) += (t_base * (alpha / t_coords(0))) * (2 *
mu * t_u(0) + t_p);
559 for (; bb < nbRowBaseFunctions; ++bb) {
581 boost::shared_ptr<MatrixDouble>
uPtr;
583 boost::shared_ptr<VectorDouble>
hPtr;
585 boost::shared_ptr<VectorDouble>
gPtr;
586 boost::shared_ptr<VectorDouble>
pPtr;
607 boost::shared_ptr<MatrixDouble> grad_u_ptr,
608 boost::shared_ptr<VectorDouble> h_ptr)
613 assembleTranspose =
false;
616 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data,
617 EntitiesFieldData::EntData &col_data) {
620 const double vol = getMeasure();
621 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*
uPtr);
622 auto t_grad_u = getFTensor2FromMat<U_FIELD_DIM, SPACE_DIM>(*
gradUPtr);
623 auto t_h = getFTensor0FromVec(*
hPtr);
624 auto t_coords = getFTensor1CoordsAtGaussPts();
626 auto t_row_base = row_data.getFTensor0N();
627 auto t_row_diff_base = row_data.getFTensor1DiffN<
SPACE_DIM>();
629 auto t_w = getFTensor0IntegrationWeight();
631 auto get_mat = [&](
const int rr) {
632 return getFTensor2FromArray<SPACE_DIM, SPACE_DIM, SPACE_DIM>(locMat, rr);
635 auto ts_a = getTSa();
638 for (
int gg = 0; gg != nbIntegrationPts; gg++) {
640 const double r = t_coords(0);
645 const double beta0 = alpha *
rho;
646 const double beta1 = beta0 * ts_a;
653 auto t_col_base = col_data.getFTensor0N(gg, 0);
654 auto t_col_diff_base = col_data.getFTensor1DiffN<
SPACE_DIM>(gg, 0);
659 t_d_stress(
l,
j,
k) = t_D(
i,
j,
k,
l) * (alpha * t_row_diff_base(
i));
661 for (
int cc = 0; cc != nbCols /
U_FIELD_DIM; ++cc) {
663 const double bb = t_row_base * t_col_base;
665 t_mat(
i,
j) += (beta1 * bb) *
t_kd(
i,
j);
666 t_mat(
i,
j) += (beta0 * bb) * t_grad_u(
i,
j);
668 (beta0 * t_row_base) *
t_kd(
i,
j) * (t_col_diff_base(
k) * t_u(
k));
669 t_mat(
i,
j) += t_d_stress(
i,
j,
k) * t_col_diff_base(
k);
672 t_mat(0, 0) += (bb * (alpha / t_coords(0))) * (2 *
mu);
684 for (; rr < nbRowBaseFunctions; ++rr) {
701 boost::shared_ptr<MatrixDouble>
uPtr;
703 boost::shared_ptr<VectorDouble>
hPtr;
709 using UDO = ForcesAndSourcesCore::UserDataOperator;
713 boost::shared_ptr<std::vector<VectorInt>> col_indices_ptr,
714 boost::shared_ptr<std::vector<MatrixDouble>> col_diff_basefunctions_ptr)
718 MoFEMErrorCode
doWork(
int side, EntityType type,
719 DataForcesAndSourcesCore::EntData &data) {
722 if (type == MBVERTEX) {
756 OpLhsU_dH(
const std::string field_name_u,
const std::string field_name_h,
757 boost::shared_ptr<MatrixDouble> dot_u_ptr,
758 boost::shared_ptr<MatrixDouble> u_ptr,
759 boost::shared_ptr<MatrixDouble> grad_u_ptr,
760 boost::shared_ptr<VectorDouble> h_ptr,
761 boost::shared_ptr<VectorDouble> g_ptr)
767 assembleTranspose =
false;
770 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data,
771 EntitiesFieldData::EntData &col_data) {
774 const double vol = getMeasure();
775 auto t_dot_u = getFTensor1FromMat<U_FIELD_DIM>(*
dotUPtr);
776 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*
uPtr);
777 auto t_grad_u = getFTensor2FromMat<U_FIELD_DIM, SPACE_DIM>(*
gradUPtr);
778 auto t_h = getFTensor0FromVec(*
hPtr);
779 auto t_g = getFTensor0FromVec(*
gPtr);
780 auto t_coords = getFTensor1CoordsAtGaussPts();
782 auto t_row_base = row_data.getFTensor0N();
783 auto t_row_diff_base = row_data.getFTensor1DiffN<
SPACE_DIM>();
785 auto t_w = getFTensor0IntegrationWeight();
795 t_buoyancy_dh(
i) = 0;
798 for (
int gg = 0; gg != nbIntegrationPts; gg++) {
800 const double r = t_coords(0);
806 auto t_D_dh =
get_D(2 * mu_dh);
808 t_inertia_force_dh(
i) = (alpha * rho_dh) * t_dot_u(
i);
810 t_gravity_dh(
SPACE_DIM - 1) = (alpha * rho_dh *
a0);
811 t_convection_dh(
i) = (rho_dh * alpha) * (t_u(
j) * t_grad_u(
i,
j));
812 const double t_phase_force_g_dh = -alpha *
kappa * t_g;
813 t_forces_dh(
i) = t_inertia_force_dh(
i) + t_buoyancy_dh(
i) +
814 t_gravity_dh(
i) + t_convection_dh(
i);
816 t_stress_dh(
i,
j) = alpha * (t_D_dh(
i,
j,
k,
l) * t_grad_u(
k,
l));
822 getFTensor1FromMat<U_FIELD_DIM, 1>(locMat, rr *
U_FIELD_DIM);
823 auto t_col_base = col_data.getFTensor0N(gg, 0);
824 auto t_col_diff_base = col_data.getFTensor1DiffN<
SPACE_DIM>(gg, 0);
826 for (
int cc = 0; cc != nbCols; ++cc) {
828 const double bb = t_row_base * t_col_base;
829 t_mat(
i) += t_forces_dh(
i) * bb;
830 t_mat(
i) += (t_phase_force_g_dh * t_row_base) * t_col_diff_base(
i);
831 t_mat(
i) += (t_row_diff_base(
j) * t_col_base) * t_stress_dh(
i,
j);
834 t_mat(0) += (bb * (alpha / t_coords(0))) * (2 * mu_dh * t_u(0));
846 for (; rr < nbRowBaseFunctions; ++rr) {
865 boost::shared_ptr<MatrixDouble>
uPtr;
867 boost::shared_ptr<VectorDouble>
hPtr;
868 boost::shared_ptr<VectorDouble>
gPtr;
884 OpLhsU_dG(
const std::string field_name_u,
const std::string field_name_h,
885 boost::shared_ptr<MatrixDouble> grad_h_ptr)
890 assembleTranspose =
false;
893 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data,
894 EntitiesFieldData::EntData &col_data) {
897 const double vol = getMeasure();
898 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*
gradHPtr);
899 auto t_coords = getFTensor1CoordsAtGaussPts();
901 auto t_row_base = row_data.getFTensor0N();
902 auto t_w = getFTensor0IntegrationWeight();
904 for (
int gg = 0; gg != nbIntegrationPts; gg++) {
906 const double r = t_coords(0);
910 t_phase_force_dg(
i) = -alpha *
kappa * t_grad_h(
i);
915 getFTensor1FromMat<U_FIELD_DIM, 1>(locMat, rr *
U_FIELD_DIM);
916 auto t_col_base = col_data.getFTensor0N(gg, 0);
918 for (
int cc = 0; cc != nbCols; ++cc) {
919 const double bb = t_row_base * t_col_base;
920 t_mat(
i) += t_phase_force_dg(
i) * bb;
929 for (; rr < nbRowBaseFunctions; ++rr) {
963 boost::shared_ptr<VectorDouble> dot_h_ptr,
964 boost::shared_ptr<VectorDouble> h_ptr,
965 boost::shared_ptr<MatrixDouble> grad_h_ptr,
966 boost::shared_ptr<MatrixDouble> grad_g_ptr)
971 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
974 const double vol = getMeasure();
975 auto t_w = getFTensor0IntegrationWeight();
976 auto t_coords = getFTensor1CoordsAtGaussPts();
977 auto t_base = data.getFTensor0N();
978 auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
981 if (data.getDiffN().size1() != data.getN().size1())
983 if (data.getDiffN().size2() != data.getN().size2() *
SPACE_DIM) {
985 <<
"Side " << rowSide <<
" " << CN::EntityTypeName(rowType);
986 MOFEM_LOG(
"SELF", Sev::error) << data.getN();
987 MOFEM_LOG(
"SELF", Sev::error) << data.getDiffN();
995 auto t_h = getFTensor0FromVec(*
hPtr);
996 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*
gradGPtr);
998 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
1000 const double r = t_coords(0);
1003 const double set_h =
init_h(t_coords(0), t_coords(1), t_coords(2));
1004 const double m =
get_M(set_h) * alpha;
1007 for (; bb != nbRows; ++bb) {
1008 locF[bb] += (t_base * alpha) * (t_h - set_h);
1009 locF[bb] += (t_diff_base(
i) *
m) * t_grad_g(
i);
1014 for (; bb < nbRowBaseFunctions; ++bb) {
1028 auto t_dot_h = getFTensor0FromVec(*
dotHPtr);
1029 auto t_h = getFTensor0FromVec(*
hPtr);
1030 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*
uPtr);
1031 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*
gradHPtr);
1032 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*
gradGPtr);
1034 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
1036 const double r = t_coords(0);
1039 const double m =
get_M(t_h) * alpha;
1042 for (; bb != nbRows; ++bb) {
1043 locF[bb] += (t_base * alpha) * (t_dot_h);
1044 locF[bb] += (t_base * alpha) * (t_grad_h(
i) * t_u(
i));
1045 locF[bb] += (t_diff_base(
i) * t_grad_g(
i)) *
m;
1050 for (; bb < nbRowBaseFunctions; ++bb) {
1070 boost::shared_ptr<MatrixDouble>
uPtr;
1072 boost::shared_ptr<VectorDouble>
hPtr;
1088 OpLhsH_dU(
const std::string h_field_name,
const std::string u_field_name,
1089 boost::shared_ptr<MatrixDouble> grad_h_ptr)
1094 assembleTranspose =
false;
1096 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data,
1097 EntitiesFieldData::EntData &col_data) {
1100 const double vol = getMeasure();
1101 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*
gradHPtr);
1102 auto t_coords = getFTensor1CoordsAtGaussPts();
1104 auto t_row_base = row_data.getFTensor0N();
1105 auto t_w = getFTensor0IntegrationWeight();
1107 for (
int gg = 0; gg != nbIntegrationPts; gg++) {
1109 const auto r = t_coords(0);
1111 auto t_mat = getFTensor1FromPtr<U_FIELD_DIM>(&locMat(0, 0));
1115 for (; rr != nbRows; ++rr) {
1116 t_row(
i) = (alpha * t_row_base) * t_grad_h(
i);
1117 auto t_col_base = col_data.getFTensor0N(gg, 0);
1118 for (
int cc = 0; cc != nbCols /
U_FIELD_DIM; ++cc) {
1119 t_mat(
i) += t_row(
i) * t_col_base;
1126 for (; rr < nbRowBaseFunctions; ++rr)
1159 boost::shared_ptr<VectorDouble> h_ptr,
1160 boost::shared_ptr<MatrixDouble> grad_g_ptr)
1167 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data,
1168 EntitiesFieldData::EntData &col_data) {
1171 const double vol = getMeasure();
1172 auto t_w = getFTensor0IntegrationWeight();
1173 auto t_coords = getFTensor1CoordsAtGaussPts();
1174 auto t_row_base = row_data.getFTensor0N();
1175 auto t_row_diff_base = row_data.getFTensor1DiffN<
SPACE_DIM>();
1178 if (row_data.getDiffN().size1() != row_data.getN().size1())
1180 if (row_data.getDiffN().size2() != row_data.getN().size2() *
SPACE_DIM) {
1182 <<
"Side " << rowSide <<
" " << CN::EntityTypeName(rowType);
1183 MOFEM_LOG(
"SELF", Sev::error) << row_data.getN();
1184 MOFEM_LOG(
"SELF", Sev::error) << row_data.getDiffN();
1188 if (col_data.getDiffN().size1() != col_data.getN().size1())
1190 if (col_data.getDiffN().size2() != col_data.getN().size2() *
SPACE_DIM) {
1192 <<
"Side " << rowSide <<
" " << CN::EntityTypeName(rowType);
1193 MOFEM_LOG(
"SELF", Sev::error) << col_data.getN();
1194 MOFEM_LOG(
"SELF", Sev::error) << col_data.getDiffN();
1201 auto t_h = getFTensor0FromVec(*
hPtr);
1202 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*
gradGPtr);
1204 for (
int gg = 0; gg != nbIntegrationPts; gg++) {
1206 const double r = t_coords(0);
1210 for (; rr != nbRows; ++rr) {
1212 auto t_col_base = col_data.getFTensor0N(gg, 0);
1213 auto t_col_diff_base = col_data.getFTensor1DiffN<
SPACE_DIM>(gg, 0);
1215 for (
int cc = 0; cc != nbCols; ++cc) {
1217 locMat(rr, cc) += (t_row_base * t_col_base * alpha);
1227 for (; rr < nbRowBaseFunctions; ++rr) {
1240 auto t_h = getFTensor0FromVec(*
hPtr);
1241 auto t_grad_g = getFTensor1FromMat<SPACE_DIM>(*
gradGPtr);
1242 auto t_u = getFTensor1FromMat<U_FIELD_DIM>(*
uPtr);
1244 auto ts_a = getTSa();
1246 for (
int gg = 0; gg != nbIntegrationPts; gg++) {
1248 const double r = t_coords(0);
1253 for (; rr != nbRows; ++rr) {
1255 auto t_col_base = col_data.getFTensor0N(gg, 0);
1256 auto t_col_diff_base = col_data.getFTensor1DiffN<
SPACE_DIM>(gg, 0);
1258 for (
int cc = 0; cc != nbCols; ++cc) {
1260 locMat(rr, cc) += (t_row_base * t_col_base * alpha) * ts_a;
1262 (t_row_base * alpha) * (t_col_diff_base(
i) * t_u(
i));
1264 (t_row_diff_base(
i) * t_grad_g(
i)) * (t_col_base * m_dh);
1274 for (; rr < nbRowBaseFunctions; ++rr) {
1291 boost::shared_ptr<MatrixDouble>
uPtr;
1292 boost::shared_ptr<VectorDouble>
hPtr;
1308 OpLhsH_dG(
const std::string field_name_h,
const std::string field_name_g,
1309 boost::shared_ptr<VectorDouble> h_ptr)
1314 assembleTranspose =
false;
1317 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data,
1318 EntitiesFieldData::EntData &col_data) {
1321 const double vol = getMeasure();
1322 auto t_h = getFTensor0FromVec(*
hPtr);
1324 auto t_row_diff_base = row_data.getFTensor1DiffN<
SPACE_DIM>();
1325 auto t_w = getFTensor0IntegrationWeight();
1326 auto t_coords = getFTensor1CoordsAtGaussPts();
1328 for (
int gg = 0; gg != nbIntegrationPts; gg++) {
1330 const double r = t_coords(0);
1335 set_h =
init_h(t_coords(0), t_coords(1), t_coords(2));
1339 auto m =
get_M(set_h) * alpha;
1342 for (; rr != nbRows; ++rr) {
1343 auto t_col_diff_base = col_data.getFTensor1DiffN<
SPACE_DIM>(gg, 0);
1345 for (
int cc = 0; cc != nbCols; ++cc) {
1346 locMat(rr, cc) += (t_row_diff_base(
i) * t_col_diff_base(
i)) *
m;
1354 for (; rr < nbRowBaseFunctions; ++rr) {
1367 boost::shared_ptr<VectorDouble>
hPtr;
1386 boost::shared_ptr<MatrixDouble> grad_h_ptr,
1387 boost::shared_ptr<VectorDouble> g_ptr)
1391 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &data) {
1394 const double vol = getMeasure();
1395 auto t_h = getFTensor0FromVec(*
hPtr);
1396 auto t_grad_h = getFTensor1FromMat<SPACE_DIM>(*
gradHPtr);
1397 auto t_g = getFTensor0FromVec(*
gPtr);
1398 auto t_coords = getFTensor1CoordsAtGaussPts();
1400 auto t_base = data.getFTensor0N();
1401 auto t_diff_base = data.getFTensor1DiffN<
SPACE_DIM>();
1402 auto t_w = getFTensor0IntegrationWeight();
1404 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
1406 const double r = t_coords(0);
1411 set_h =
init_h(t_coords(0), t_coords(1), t_coords(2));
1415 const double f =
get_f(set_h);
1418 for (; bb != nbRows; ++bb) {
1419 locF[bb] += (t_base * alpha) * (t_g - f);
1420 locF[bb] -= (t_diff_base(
i) * (
eta2 * alpha)) * t_grad_h(
i);
1425 for (; bb < nbRowBaseFunctions; ++bb) {
1442 boost::shared_ptr<VectorDouble>
hPtr;
1444 boost::shared_ptr<VectorDouble>
gPtr;
1459 OpLhsG_dH(
const std::string field_name_g,
const std::string field_name_h,
1460 boost::shared_ptr<VectorDouble> h_ptr)
1465 assembleTranspose =
false;
1468 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data,
1469 EntitiesFieldData::EntData &col_data) {
1472 const double vol = getMeasure();
1473 auto t_h = getFTensor0FromVec(*
hPtr);
1475 auto t_row_base = row_data.getFTensor0N();
1476 auto t_row_diff_base = row_data.getFTensor1DiffN<
SPACE_DIM>();
1477 auto t_w = getFTensor0IntegrationWeight();
1478 auto t_coords = getFTensor1CoordsAtGaussPts();
1480 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
1482 const double r = t_coords(0);
1485 const double f_dh =
get_f_dh(t_h) * alpha;
1486 const double beta =
eta2 * alpha;
1489 for (; rr != nbRows; ++rr) {
1491 auto t_col_base = col_data.getFTensor0N(gg, 0);
1492 auto t_col_diff_base = col_data.getFTensor1DiffN<
SPACE_DIM>(gg, 0);
1494 for (
int cc = 0; cc != nbCols; ++cc) {
1496 if constexpr (
I ==
false)
1497 locMat(rr, cc) -= (t_row_base * t_col_base) * f_dh;
1498 locMat(rr, cc) -= (t_row_diff_base(
i) * beta) * t_col_diff_base(
i);
1508 for (; rr < nbRowBaseFunctions; ++rr) {
1522 boost::shared_ptr<VectorDouble>
hPtr;
1541 MoFEMErrorCode
iNtegrate(EntitiesFieldData::EntData &row_data,
1542 EntitiesFieldData::EntData &col_data) {
1545 const double vol = getMeasure();
1547 auto t_row_base = row_data.getFTensor0N();
1548 auto t_w = getFTensor0IntegrationWeight();
1549 auto t_coords = getFTensor1CoordsAtGaussPts();
1551 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
1553 const double r = t_coords(0);
1557 for (; rr != nbRows; ++rr) {
1558 auto t_col_base = col_data.getFTensor0N(gg, 0);
1559 const double beta = alpha * t_row_base;
1560 for (
int cc = 0; cc != nbCols; ++cc) {
1561 locMat(rr, cc) += (t_col_base * beta);
1568 for (; rr < nbRowBaseFunctions; ++rr) {
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
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
auto cylindrical
[cylindrical]
constexpr int U_FIELD_DIM
auto init_h
Initialisation function.
auto d_phase_function_h
Derivative of phase function with respect to h.
auto get_f_dh
Derivative of double-well potential.
auto wetting_angle
Wetting angle function (placeholder)
auto phase_function
Phase-dependent material property interpolation.
auto get_D
Create deviatoric stress tensor.
auto wetting_angle_sub_stepping
[cylindrical]
auto get_f
Double-well potential function.
#define MOFEM_LOG(channel, severity)
Log.
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
constexpr auto field_name
static constexpr double delta
FTensor::Index< 'm', 3 > m
Calculate lift force on free surface boundary.
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
Lhs for H dH (Jacobian block ∂R_H/∂H)
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)
Lhs for U dG (Jacobian block ∂R_U/∂G)
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
Lhs for U dH (Jacobian block ∂R_U/∂H)
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)
Rhs for G (chemical potential residual)
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
Rhs for H (phase-field residual)
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