1056 {
1058
1059
1060 auto t_normal = getFTensor1Normal();
1061 t_normal(
i) /= sqrt(t_normal(
j) * t_normal(
j));
1062
1063
1065 const auto in_the_loop =
1067
1068 std::array<boost::shared_ptr<MatrixDouble>, 2> d_ptr;
1069 std::array<boost::shared_ptr<MatrixDouble>, 2> d_vis_ptr;
1070
1071 std::array<std::vector<VectorInt>, 2> indices_side_map;
1072 std::array<std::vector<MatrixDouble>, 2> base_side_map;
1073 std::array<std::vector<MatrixDouble>, 2> diff_base_side_map;
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095 auto set_row_col = [&](
auto a,
auto b) {
1106 };
1107
1109
1112 "Other side should be fluid");
1113 }
1114
1115 set_row_col(0, 1);
1116
1119
1121
1124 "Other side should be solid");
1125 }
1126
1127 set_row_col(1, 0);
1128
1131
1132 } else {
1134 "Side is not fluid or solid");
1135 }
1136
1137
1138
1139
1140
1141
1144
1145
1146 const size_t nb_integration_pts = getGaussPts().size2();
1147
1148
1149 const double beta = 1. / (in_the_loop + 1);
1150
1151 auto integrate = [&](auto sense_row, auto &row_ind, auto &row, auto &row_diff,
1152 auto sense_col, auto &col_ind, auto &col, auto &col_diff,
1153 auto &d_row, auto &d_col, auto &d_vis_row,
1154 auto &d_vis_col) {
1156
1157
1158
1159 const auto nb_rows = row_ind.size();
1160 const auto nb_cols = col_ind.size();
1161
1162 const auto nb_row_base_functions = row.size2();
1163
1164 auto t_D_row = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(d_row);
1165 auto t_D_col = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(d_col);
1166
1167 auto t_vis_D_row =
1168 getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(d_vis_row);
1169 auto t_vis_D_col =
1170 getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(d_vis_col);
1171
1172 if (nb_cols) {
1173
1174
1175 locMatK.resize(nb_rows, nb_cols,
false);
1177 locMatC.resize(nb_rows, nb_cols,
false);
1179 locMatM.resize(nb_rows, nb_cols,
false);
1181
1182
1185
1188 t_P(
i,
j) = t_normal(
i) * t_normal(
j);
1189
1190 auto t_w = getFTensor0IntegrationWeight();
1191
1192
1193 for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
1194
1195
1196
1197 const double alpha = getMeasure() * t_w;
1198
1199
1200 size_t rr = 0;
1201 for (; rr != nb_rows /
SPACE_DIM; ++rr) {
1202
1203 auto get_vn_plus = [&](auto &t_D) {
1205 t_vn_plus(
i,
j,
k) =
1207 (
t_kd(
i,
m) * t_D(
m,
j,
k,
l) * t_diff_row_base(
l));
1208 return t_vn_plus;
1209 };
1210
1211 auto get_vn = [&]() {
1213 t_vn(
i,
j,
k) = t_normal(
j) * (
t_kd(
i,
k) * t_row_base * sense_row);
1214 return t_vn;
1215 };
1216
1217 auto t_vn_plus = get_vn_plus(t_D_row);
1218 auto t_vn = get_vn();
1219 auto t_vn_lambda_plus = get_vn_plus(t_vis_D_row);
1220
1221
1224
1225 auto t_mat_K = getFTensor2FromArray<SPACE_DIM, SPACE_DIM, SPACE_DIM>(
1227 auto t_mat_C = getFTensor2FromArray<SPACE_DIM, SPACE_DIM, SPACE_DIM>(
1229 auto t_mat_M = getFTensor2FromArray<SPACE_DIM, SPACE_DIM, SPACE_DIM>(
1231
1232
1233 for (
size_t cc = 0; cc != nb_cols /
SPACE_DIM; ++cc) {
1234
1235 auto get_un_plus = [&](auto &t_D) {
1237 t_un_plus;
1238 t_un_plus(
i,
j,
k) =
1239 beta * ((t_P(
i,
m) * t_D(
m,
j,
k,
l)) * t_diff_col_base(
l));
1240 return t_un_plus;
1241 };
1242
1243 auto get_un = [&]() {
1246 (t_normal(
j) * (t_P(
i,
k) * t_col_base * sense_col));
1247 return t_un;
1248 };
1249
1250 auto t_un_plus = get_un_plus(t_D_col);
1251 auto t_un = get_un();
1252 auto t_un_lambda_plus = get_un_plus(t_vis_D_col);
1253
1254
1257 ((-
p) * (t_un(
m,
n,
j) - (t_un_plus(
m,
n,
j) /
p)));
1258 t_mat_K(
i,
j) -=
alpha * (t_vn_plus(
m,
n,
i) * t_un_plus(
m,
n,
j));
1259
1260
1262 alpha * (-t_vn_lambda_plus(
m,
n,
i)) *
1263 ((-
p) * (t_un(
m,
n,
j) - (t_un_plus(
m,
n,
j) /
p)));
1265 alpha * (t_vn_lambda_plus(
m,
n,
i) * t_un_plus(
m,
n,
j));
1266
1267
1268 t_mat_C(
i,
j) -=
alpha * (t_vn(
m,
n,
i) - t_vn_plus(
m,
n,
i)) *
1269 ((-
p) * (t_un_lambda_plus(
m,
n,
j) / (-
p)));
1271 alpha * (t_vn_plus(
m,
n,
i) * t_un_lambda_plus(
m,
n,
j));
1272
1273
1274 t_mat_M(
i,
j) -=
alpha * (-t_vn_lambda_plus(
m,
n,
i)) *
1275 ((-
p) * (t_un_lambda_plus(
m,
n,
j) / (-
p)));
1277 alpha * (t_vn_lambda_plus(
m,
n,
i) * t_un_lambda_plus(
m,
n,
j));
1278
1279
1280 ++t_col_base;
1281 ++t_diff_col_base;
1282 ++t_mat_K;
1283 ++t_mat_C;
1284 ++t_mat_M;
1285 }
1286
1287
1288 ++t_row_base;
1289 ++t_diff_row_base;
1290 }
1291
1292 for (; rr < nb_row_base_functions; ++rr) {
1293 ++t_row_base;
1294 ++t_diff_row_base;
1295 }
1296
1297 ++t_w;
1298 }
1299
1300
1301
1302 CHKERR ::MatSetValues(
K, nb_rows, &*row_ind.begin(), col_ind.size(),
1303 &*col_ind.begin(), &*
locMatK.data().begin(),
1304 ADD_VALUES);
1305 CHKERR ::MatSetValues(
C, nb_rows, &*row_ind.begin(), col_ind.size(),
1306 &*col_ind.begin(), &*
locMatC.data().begin(),
1307 ADD_VALUES);
1308 CHKERR ::MatSetValues(
M, nb_rows, &*row_ind.begin(), col_ind.size(),
1309 &*col_ind.begin(), &*
locMatM.data().begin(),
1310 ADD_VALUES);
1311 }
1312
1314 };
1315
1316
1318 const auto sense_row =
senseMap[s0];
1319
1320 for (auto x0 = 0; x0 != indices_side_map[s0].size(); ++x0) {
1321
1323 const auto sense_col =
senseMap[s1];
1324
1325 for (auto x1 = 0; x1 != indices_side_map[s1].size(); ++x1) {
1326
1327 CHKERR integrate(sense_row, indices_side_map[s0][x0],
1328 base_side_map[s0][x0], diff_base_side_map[s0][x0],
1329
1330 sense_col, indices_side_map[s1][x1],
1331 base_side_map[s1][x1], diff_base_side_map[s1][x1],
1332
1333 *d_ptr[s0], *d_ptr[s1], *d_vis_ptr[s0],
1334 *d_vis_ptr[s1]
1335
1336 );
1337 }
1338 }
1339 }
1340 }
1341
1343}
#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.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
auto get_diff_ntensor(T &base_mat)
std::array< std::vector< MatrixDouble >, 2 > baseUfSideMap
FTensor::Index< 'j', SPACE_DIM > j
FTensor::Index< 'k', SPACE_DIM > k
std::array< std::vector< MatrixDouble >, 2 > baseUsSideMap
FTensor::Index< 'i', SPACE_DIM > i
auto get_ntensor(T &base_mat)
FTensor::Index< 'l', SPACE_DIM > l
std::array< double, 2 > areaMap
std::array< int, 2 > senseMap
std::array< std::vector< VectorInt >, 2 > indicesUfSideMap
FTensor::Index< 'n', SPACE_DIM > n
std::array< EntityHandle, 2 > sideHandle
std::array< std::vector< MatrixDouble >, 2 > diffUfBaseSideMap
FTensor::Index< 'm', SPACE_DIM > m
std::array< std::vector< MatrixDouble >, 2 > diffUsBaseSideMap
std::array< std::vector< VectorInt >, 2 > indicesUsSideMap