|
| v0.14.0
|
- Examples
- thermo_elastic.cpp.
Definition at line 162 of file thermo_elastic.cpp.
◆ ThermoElasticProblem()
◆ addMatBlockOps()
[Calculate elasticity tensor]
[Calculate elasticity tensor]
- Examples
- thermo_elastic.cpp.
Definition at line 220 of file thermo_elastic.cpp.
227 OpMatElasticBlocks(boost::shared_ptr<MatrixDouble>
m,
double bulk_modulus_K,
230 std::vector<const CubitMeshSets *> meshset_vec_ptr)
235 "Can not get data from block");
242 for (
auto &b : blockData) {
244 if (b.blockEnts.find(getFEEntityHandle()) != b.blockEnts.end()) {
245 CHKERR getMatDPtr(matDPtr, b.bulkModulusK, b.shearModulusG);
250 CHKERR getMatDPtr(matDPtr, bulkModulusKDefault, shearModulusGDefault);
255 boost::shared_ptr<MatrixDouble> matDPtr;
259 double shearModulusG;
263 double bulkModulusKDefault;
264 double shearModulusGDefault;
265 std::vector<BlockData> blockData;
269 std::vector<const CubitMeshSets *> meshset_vec_ptr,
273 for (
auto m : meshset_vec_ptr) {
275 std::vector<double> block_data;
276 CHKERR m->getAttributes(block_data);
277 if (block_data.size() < 2) {
279 "Expected that block has two attributes");
281 auto get_block_ents = [&]() {
284 m_field.
get_moab().get_entities_by_handle(
m->meshset, ents,
true);
304 MoFEMErrorCode getMatDPtr(boost::shared_ptr<MatrixDouble> mat_D_ptr,
308 auto set_material_stiffness = [&]() {
319 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*mat_D_ptr);
328 set_material_stiffness();
333 double default_bulk_modulus_K =
335 double default_shear_modulus_G =
338 pipeline.push_back(
new OpMatElasticBlocks(
339 blockedParamsPtr->getDPtr(), default_bulk_modulus_K,
340 default_shear_modulus_G,
mField, sev,
345 (boost::format(
"%s(.*)") % block_elastic_name).str()
352 OpMatThermalBlocks(boost::shared_ptr<VectorDouble> expansion_ptr,
353 boost::shared_ptr<double> conductivity_ptr,
354 boost::shared_ptr<double> capacity_ptr,
356 std::vector<const CubitMeshSets *> meshset_vec_ptr)
358 expansionPtr(expansion_ptr), conductivityPtr(conductivity_ptr),
359 capacityPtr(capacity_ptr) {
361 "Can not get data from block");
368 for (
auto &b : blockData) {
370 if (b.blockEnts.find(getFEEntityHandle()) != b.blockEnts.end()) {
371 *expansionPtr = b.expansion;
372 *conductivityPtr = b.conductivity;
373 *capacityPtr = b.capacity;
393 std::vector<BlockData> blockData;
397 std::vector<const CubitMeshSets *> meshset_vec_ptr,
401 for (
auto m : meshset_vec_ptr) {
403 std::vector<double> block_data;
404 CHKERR m->getAttributes(block_data);
405 if (block_data.size() < 3) {
407 "Expected that block has at least three attributes");
409 auto get_block_ents = [&]() {
412 m_field.
get_moab().get_entities_by_handle(
m->meshset, ents,
true);
416 auto get_expansion = [&]() {
418 if (block_data.size() > 3) {
419 expansion[1] = block_data[3];
421 if (
SPACE_DIM == 3 && block_data.size() > 4) {
422 expansion[2] = block_data[4];
427 auto coeff_exp_vec = get_expansion();
430 <<
m->getName() <<
": conductivity = " << block_data[0]
431 <<
" capacity = " << block_data[1]
432 <<
" expansion = " << coeff_exp_vec;
435 {block_data[0], block_data[1], coeff_exp_vec, get_block_ents()});
441 boost::shared_ptr<VectorDouble> expansionPtr;
442 boost::shared_ptr<double> conductivityPtr;
443 boost::shared_ptr<double> capacityPtr;
446 pipeline.push_back(
new OpMatThermalBlocks(
447 blockedParamsPtr->getCoeffExpansionPtr(),
448 blockedParamsPtr->getHeatConductivityPtr(),
449 blockedParamsPtr->getHeatCapacityPtr(),
mField, sev,
454 (boost::format(
"%s(.*)") % block_thermal_name).str()
◆ bC()
[Set up problem]
[Boundary condition]
- Examples
- thermo_elastic.cpp.
Definition at line 624 of file thermo_elastic.cpp.
633 auto get_skin = [&]() {
638 CHKERR skin.find_skin(0, body_ents,
false, skin_ents);
642 auto filter_flux_blocks = [&](
auto skin,
bool temp_bc =
false) {
643 auto remove_cubit_blocks = [&](
auto c) {
653 skin = subtract(skin, ents);
658 auto remove_named_blocks = [&](
auto n) {
663 (boost::format(
"%s(.*)") %
n).str()
671 skin = subtract(skin, ents);
677 "remove_cubit_blocks");
679 "remove_named_blocks");
682 "remove_cubit_blocks");
689 auto filter_true_skin = [&](
auto skin) {
691 ParallelComm *pcomm =
693 CHKERR pcomm->filter_pstatus(skin, PSTATUS_SHARED | PSTATUS_MULTISHARED,
694 PSTATUS_NOT, -1, &boundary_ents);
695 return boundary_ents;
698 auto remove_flux_ents = filter_true_skin(filter_flux_blocks(get_skin()));
699 auto remove_temp_bc_ents =
700 filter_true_skin(filter_flux_blocks(get_skin(),
true));
705 remove_temp_bc_ents);
707 MOFEM_LOG(
"SYNC", Sev::noisy) << remove_flux_ents << endl;
710 MOFEM_LOG(
"SYNC", Sev::noisy) << remove_temp_bc_ents << endl;
723 remove_temp_bc_ents);
728 simple->getProblemName(),
"FLUX", remove_flux_ents);
730 simple->getProblemName(),
"TBC", remove_temp_bc_ents);
732 auto set_init_temp = [](boost::shared_ptr<FieldEntity> field_entity_ptr) {
733 field_entity_ptr->getEntFieldData()[0] =
init_temp;
740 simple->getProblemName(),
"U");
742 simple->getProblemName(),
"FLUX",
false);
◆ getCommandLineParameters()
◆ OPs()
[Boundary condition]
[Push operators to pipeline]
- Examples
- thermo_elastic.cpp.
Definition at line 749 of file thermo_elastic.cpp.
759 auto boundary_marker =
760 bc_mng->getMergedBlocksMarker(vector<string>{
"HEATFLUX"});
770 auto block_params = boost::make_shared<BlockedParameters>();
771 auto mDPtr = block_params->getDPtr();
772 auto coeff_expansion_ptr = block_params->getCoeffExpansionPtr();
773 auto heat_conductivity_ptr = block_params->getHeatConductivityPtr();
774 auto heat_capacity_ptr = block_params->getHeatCapacityPtr();
777 auto time_scale = boost::make_shared<TimeScale>();
780 auto time_bodyforce_scaling =
781 boost::make_shared<TimeScale>(
"bodyforce_scale.txt");
782 auto time_heatsource_scaling =
783 boost::make_shared<TimeScale>(
"heatsource_scale.txt");
784 auto time_temperature_scaling =
785 boost::make_shared<TimeScale>(
"temperature_bc_scale.txt");
786 auto time_displacement_scaling =
787 boost::make_shared<TimeScale>(
"displacement_bc_scale.txt");
788 auto time_flux_scaling = boost::make_shared<TimeScale>(
"flux_bc_scale.txt");
789 auto time_force_scaling = boost::make_shared<TimeScale>(
"force_bc_scale.txt");
791 auto add_domain_rhs_ops = [&](
auto &pipeline) {
797 auto mat_grad_ptr = boost::make_shared<MatrixDouble>();
798 auto mat_strain_ptr = boost::make_shared<MatrixDouble>();
799 auto mat_stress_ptr = boost::make_shared<MatrixDouble>();
801 auto vec_temp_ptr = boost::make_shared<VectorDouble>();
802 auto vec_temp_dot_ptr = boost::make_shared<VectorDouble>();
803 auto mat_flux_ptr = boost::make_shared<MatrixDouble>();
804 auto vec_temp_div_ptr = boost::make_shared<VectorDouble>();
810 "FLUX", vec_temp_div_ptr));
818 pipeline.push_back(
new OpStressThermal(mat_strain_ptr, vec_temp_ptr, mDPtr,
824 [](
double,
double,
double) constexpr {
return 1; }));
826 auto resistance = [heat_conductivity_ptr](
const double,
const double,
828 return (1. / (*heat_conductivity_ptr));
831 auto capacity = [heat_capacity_ptr](
const double,
const double,
833 return -(*heat_capacity_ptr);
838 pipeline.push_back(
new OpHdivFlux(
"FLUX", mat_flux_ptr, resistance));
839 pipeline.push_back(
new OpHDivTemp(
"FLUX", vec_temp_ptr, unity));
840 pipeline.push_back(
new OpBaseDivFlux(
"T", vec_temp_div_ptr, unity));
841 pipeline.push_back(
new OpBaseDotT(
"T", vec_temp_dot_ptr, capacity));
845 pipeline,
mField,
"T", {time_scale, time_heatsource_scaling},
846 "HEAT_SOURCE", Sev::inform);
848 pipeline,
mField,
"U", {time_scale, time_bodyforce_scaling},
849 "BODY_FORCE", Sev::inform);
851 pipeline,
mField,
"T", vec_temp_ptr,
"SETTEMP", Sev::inform);
856 auto add_domain_lhs_ops = [&](
auto &pipeline) {
862 pipeline.push_back(
new OpKCauchy(
"U",
"U", mDPtr));
864 "U",
"T", mDPtr, coeff_expansion_ptr));
866 auto resistance = [heat_conductivity_ptr](
const double,
const double,
868 return (1. / (*heat_conductivity_ptr));
870 auto capacity = [heat_capacity_ptr](
const double,
const double,
872 return -(*heat_capacity_ptr);
874 pipeline.push_back(
new OpHdivHdiv(
"FLUX",
"FLUX", resistance));
876 new OpHdivT(
"FLUX",
"T", []() constexpr {
return -1; },
true));
878 auto op_capacity =
new OpCapacity(
"T",
"T", capacity);
879 op_capacity->feScalingFun = [](
const FEMethod *fe_ptr) {
882 pipeline.push_back(op_capacity);
884 auto vec_temp_ptr = boost::make_shared<VectorDouble>();
887 pipeline,
mField,
"T", vec_temp_ptr,
"SETTEMP", Sev::verbose);
892 auto add_boundary_rhs_ops = [&](
auto &pipeline) {
898 pipeline,
mField,
"U", {time_scale, time_force_scaling},
"FORCE",
906 pipeline,
mField,
"FLUX", {time_scale, time_temperature_scaling},
907 "TEMPERATURE", Sev::inform);
917 pipeline,
mField,
"TBC", {time_scale, time_flux_scaling},
"FLUX",
921 using OpConvectionRhsBC =
922 T::OpFlux<ThermoElasticOps::ConvectionBcType<BLOCKSET>, 1, 1>;
923 using OpRadiationRhsBC =
924 T::OpFlux<ThermoElasticOps::RadiationBcType<BLOCKSET>, 1, 1>;
925 auto temp_bc_ptr = boost::make_shared<VectorDouble>();
927 T::AddFluxToPipeline<OpConvectionRhsBC>::add(
928 pipeline,
mField,
"TBC", temp_bc_ptr,
"CONVECTION", Sev::inform);
929 T::AddFluxToPipeline<OpRadiationRhsBC>::add(
930 pipeline,
mField,
"TBC", temp_bc_ptr,
"RADIATION", Sev::inform);
932 auto mat_flux_ptr = boost::make_shared<MatrixDouble>();
941 struct OpTBCTimesNormalFlux
946 OpTBCTimesNormalFlux(
const std::string
field_name,
947 boost::shared_ptr<MatrixDouble> vec,
948 boost::shared_ptr<Range> ents_ptr =
nullptr)
955 auto t_w = OP::getFTensor0IntegrationWeight();
959 auto t_normal = OP::getFTensor1NormalsAtGaussPts();
961 auto t_vec = getFTensor1FromMat<SPACE_DIM, 1>(*sourceVec);
963 for (
int gg = 0; gg != OP::nbIntegrationPts; gg++) {
965 const double alpha = t_w * (t_vec(
i) * t_normal(
i));
968 for (; rr != OP::nbRows; ++rr) {
969 OP::locF[rr] += alpha * t_row_base;
972 for (; rr < OP::nbRowBaseFunctions; ++rr)
978 EntityType fe_type = OP::getNumeredEntFiniteElementPtr()->getEntType();
979 if (fe_type == MBTRI) {
986 boost::shared_ptr<MatrixDouble> sourceVec;
988 pipeline.push_back(
new OpTBCTimesNormalFlux(
"TBC", mat_flux_ptr));
990 struct OpBaseNormalTimesTBC
995 OpBaseNormalTimesTBC(
const std::string
field_name,
996 boost::shared_ptr<VectorDouble> vec,
997 boost::shared_ptr<Range> ents_ptr =
nullptr)
1004 auto t_w = OP::getFTensor0IntegrationWeight();
1008 auto t_normal = OP::getFTensor1NormalsAtGaussPts();
1012 for (
int gg = 0; gg != OP::nbIntegrationPts; gg++) {
1014 const double alpha = t_w * t_vec;
1017 for (; rr != OP::nbRows; ++rr) {
1018 OP::locF[rr] += alpha * (t_row_base(
i) * t_normal(
i));
1021 for (; rr < OP::nbRowBaseFunctions; ++rr)
1027 EntityType fe_type = OP::getNumeredEntFiniteElementPtr()->getEntType();
1028 if (fe_type == MBTRI) {
1035 boost::shared_ptr<VectorDouble> sourceVec;
1038 pipeline.push_back(
new OpBaseNormalTimesTBC(
"FLUX", temp_bc_ptr));
1043 auto add_boundary_lhs_ops = [&](
auto &pipeline) {
1050 using OpConvectionLhsBC =
1051 T::OpFlux<ThermoElasticOps::ConvectionBcType<BLOCKSET>, 1, 1>;
1052 using OpRadiationLhsBC =
1053 T::OpFlux<ThermoElasticOps::RadiationBcType<BLOCKSET>, 1, 1>;
1054 auto temp_bc_ptr = boost::make_shared<VectorDouble>();
1056 T::AddFluxToPipeline<OpConvectionLhsBC>::add(pipeline,
mField,
"TBC",
"TBC",
1057 "CONVECTION", Sev::verbose);
1058 T::AddFluxToPipeline<OpRadiationLhsBC>::add(
1059 pipeline,
mField,
"TBC",
"TBC", temp_bc_ptr,
"RADIATION", Sev::verbose);
1066 struct OpTBCTimesNormalFlux
1071 OpTBCTimesNormalFlux(
const std::string row_field_name,
1072 const std::string col_field_name,
1073 boost::shared_ptr<Range> ents_ptr =
nullptr)
1074 :
OP(row_field_name, col_field_name,
OP::OPROWCOL, ents_ptr) {
1076 this->assembleTranspose =
true;
1077 this->onlyTranspose =
false;
1087 auto t_w = OP::getFTensor0IntegrationWeight();
1091 auto t_normal = OP::getFTensor1NormalsAtGaussPts();
1093 for (
int gg = 0; gg != OP::nbIntegrationPts; gg++) {
1095 auto a_mat_ptr = &*OP::locMat.data().begin();
1097 for (; rr != OP::nbRows; rr++) {
1099 const double alpha = t_w * t_row_base;
1103 for (
int cc = 0; cc != OP::nbCols; cc++) {
1107 *a_mat_ptr += alpha * (t_col_base(
i) * t_normal(
i));
1113 for (; rr < OP::nbRowBaseFunctions; ++rr)
1118 EntityType fe_type = OP::getNumeredEntFiniteElementPtr()->getEntType();
1119 if (fe_type == MBTRI) {
1126 pipeline.push_back(
new OpTBCTimesNormalFlux(
"TBC",
"FLUX"));
1132 auto get_bc_hook_rhs = [&]() {
1134 mField, pipeline_mng->getDomainRhsFE(),
1135 {time_scale, time_displacement_scaling});
1138 auto get_bc_hook_lhs = [&]() {
1140 mField, pipeline_mng->getDomainLhsFE(),
1141 {time_scale, time_displacement_scaling});
1145 pipeline_mng->getDomainRhsFE()->preProcessHook = get_bc_hook_rhs();
1146 pipeline_mng->getDomainLhsFE()->preProcessHook = get_bc_hook_lhs();
1148 CHKERR add_domain_rhs_ops(pipeline_mng->getOpDomainRhsPipeline());
1149 CHKERR add_domain_lhs_ops(pipeline_mng->getOpDomainLhsPipeline());
1150 CHKERR add_boundary_rhs_ops(pipeline_mng->getOpBoundaryRhsPipeline());
1151 CHKERR add_boundary_lhs_ops(pipeline_mng->getOpBoundaryLhsPipeline());
◆ runProblem()
◆ setupProblem()
add fields
[Get command line parameters]
[Set up problem]
- Examples
- thermo_elastic.cpp.
Definition at line 541 of file thermo_elastic.cpp.
552 CHKERR simple->addDomainField(
"FLUX", flux_space, base, 1);
553 CHKERR simple->addBoundaryField(
"FLUX", flux_space, base, 1);
588 auto no_rule = [](
int,
int,
int) {
return -1; };
591 field_eval_fe_ptr->getRuleHook = no_rule;
593 auto block_params = boost::make_shared<BlockedParameters>();
594 auto mDPtr = block_params->getDPtr();
595 auto coeff_expansion_ptr = block_params->getCoeffExpansionPtr();
598 "MAT_THERMAL", block_params, Sev::verbose);
601 field_eval_fe_ptr->getOpPtrVector(), {H1, HDIV});
603 field_eval_fe_ptr->getOpPtrVector().push_back(
605 field_eval_fe_ptr->getOpPtrVector().push_back(
607 field_eval_fe_ptr->getOpPtrVector().push_back(
609 field_eval_fe_ptr->getOpPtrVector().push_back(
612 field_eval_fe_ptr->getOpPtrVector().push_back(
614 field_eval_fe_ptr->getOpPtrVector().push_back(
◆ tsSolve()
[Push operators to pipeline]
[Solve]
- Examples
- thermo_elastic.cpp.
Definition at line 1158 of file thermo_elastic.cpp.
1165 auto dm =
simple->getDM();
1166 auto solver = pipeline_mng->createTSIM();
1169 auto set_section_monitor = [&](
auto solver) {
1172 CHKERR TSGetSNES(solver, &snes);
1173 CHKERR SNESMonitorSet(snes,
1176 (
void *)(snes_ctx_ptr.get()),
nullptr);
1180 auto create_post_process_element = [&]() {
1181 auto post_proc_fe = boost::make_shared<PostProcEle>(
mField);
1183 auto block_params = boost::make_shared<BlockedParameters>();
1184 auto mDPtr = block_params->getDPtr();
1185 auto coeff_expansion_ptr = block_params->getCoeffExpansionPtr();
1188 "MAT_THERMAL", block_params, Sev::verbose);
1191 post_proc_fe->getOpPtrVector(), {H1, HDIV});
1193 auto mat_grad_ptr = boost::make_shared<MatrixDouble>();
1194 auto mat_strain_ptr = boost::make_shared<MatrixDouble>();
1195 auto mat_stress_ptr = boost::make_shared<MatrixDouble>();
1197 auto vec_temp_ptr = boost::make_shared<VectorDouble>();
1198 auto mat_flux_ptr = boost::make_shared<MatrixDouble>();
1200 post_proc_fe->getOpPtrVector().push_back(
1202 post_proc_fe->getOpPtrVector().push_back(
1205 auto u_ptr = boost::make_shared<MatrixDouble>();
1206 post_proc_fe->getOpPtrVector().push_back(
1208 post_proc_fe->getOpPtrVector().push_back(
1211 post_proc_fe->getOpPtrVector().push_back(
1213 post_proc_fe->getOpPtrVector().push_back(
1215 coeff_expansion_ptr, mat_stress_ptr));
1219 post_proc_fe->getOpPtrVector().push_back(
1223 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
1225 {{
"T", vec_temp_ptr}},
1227 {{
"U", u_ptr}, {
"FLUX", mat_flux_ptr}},
1231 {{
"STRAIN", mat_strain_ptr}, {
"STRESS", mat_stress_ptr}}
1237 return post_proc_fe;
1240 auto monitor_ptr = boost::make_shared<FEMethod>();
1241 auto post_proc_fe = create_post_process_element();
1243 auto set_time_monitor = [&](
auto dm,
auto solver) {
1245 monitor_ptr->preProcessHook = [&]() {
1252 monitor_ptr->getCacheWeakPtr());
1253 CHKERR post_proc_fe->writeFile(
1254 "out_" + boost::lexical_cast<std::string>(monitor_ptr->ts_step) +
1262 ->evalFEAtThePoint3D(
1269 ->evalFEAtThePoint2D(
1279 CHKERR VecZeroEntries(eval_num_vec);
1281 CHKERR VecSetValue(eval_num_vec, 0, 1, ADD_VALUES);
1283 CHKERR VecAssemblyBegin(eval_num_vec);
1284 CHKERR VecAssemblyEnd(eval_num_vec);
1287 CHKERR VecSum(eval_num_vec, &eval_num);
1288 if (!(
int)eval_num) {
1290 "atom test %d failed: did not find elements to evaluate "
1291 "the field, check the coordinates",
1298 MOFEM_LOG(
"ThermoElasticSync", Sev::inform)
1299 <<
"Eval point T: " << t_temp;
1300 if (
atom_test && fabs(monitor_ptr->ts_t - 10) < 1e-12) {
1301 if (
atom_test <= 3 && fabs(t_temp - 554.48) > 1e-2) {
1303 "atom test %d failed: wrong temperature value",
1306 if (
atom_test == 4 && fabs(t_temp - 250) > 1e-2) {
1308 "atom test %d failed: wrong temperature value",
1315 auto t_flux = getFTensor1FromMat<SPACE_DIM>(*
fluxFieldPtr);
1316 auto flux_mag = sqrt(t_flux(
i) * t_flux(
i));
1317 MOFEM_LOG(
"ThermoElasticSync", Sev::inform)
1318 <<
"Eval point FLUX magnitude: " << flux_mag;
1319 if (
atom_test && fabs(monitor_ptr->ts_t - 10) < 1e-12) {
1320 if (
atom_test <= 3 && fabs(flux_mag - 27008.0) > 2e1) {
1322 "atom test %d failed: wrong flux value",
atom_test);
1324 if (
atom_test == 4 && fabs(flux_mag - 150e3) > 1e-1) {
1326 "atom test %d failed: wrong flux value",
atom_test);
1332 auto t_disp = getFTensor1FromMat<SPACE_DIM>(*
dispFieldPtr);
1333 auto disp_mag = sqrt(t_disp(
i) * t_disp(
i));
1334 MOFEM_LOG(
"ThermoElasticSync", Sev::inform)
1335 <<
"Eval point U magnitude: " << disp_mag;
1336 if (
atom_test && fabs(monitor_ptr->ts_t - 10) < 1e-12) {
1337 if (
atom_test == 1 && fabs(disp_mag - 0.00345) > 1e-5) {
1339 "atom test %d failed: wrong displacement value",
1343 fabs(disp_mag - 0.00265) > 1e-5) {
1345 "atom test %d failed: wrong displacement value",
1354 auto t_strain_trace = t_strain(
i,
i);
1355 if (
atom_test && fabs(monitor_ptr->ts_t - 10) < 1e-12) {
1356 if (
atom_test == 1 && fabs(t_strain_trace - 0.00679) > 1e-5) {
1358 "atom test %d failed: wrong strain value",
atom_test);
1361 fabs(t_strain_trace - 0.00522) > 1e-5) {
1363 "atom test %d failed: wrong strain value",
atom_test);
1370 auto von_mises_stress = std::sqrt(
1372 ((t_stress(0, 0) - t_stress(1, 1)) *
1373 (t_stress(0, 0) - t_stress(1, 1)) +
1374 (
SPACE_DIM == 3 ? (t_stress(1, 1) - t_stress(2, 2)) *
1375 (t_stress(1, 1) - t_stress(2, 2))
1377 (
SPACE_DIM == 3 ? (t_stress(2, 2) - t_stress(0, 0)) *
1378 (t_stress(2, 2) - t_stress(0, 0))
1380 6 * (t_stress(0, 1) * t_stress(0, 1) +
1381 (
SPACE_DIM == 3 ? t_stress(1, 2) * t_stress(1, 2) : 0) +
1382 (
SPACE_DIM == 3 ? t_stress(2, 0) * t_stress(2, 0) : 0))));
1383 MOFEM_LOG(
"ThermoElasticSync", Sev::inform)
1384 <<
"Eval point von Mises Stress: " << von_mises_stress;
1385 if (
atom_test && fabs(monitor_ptr->ts_t - 10) < 1e-12) {
1386 if (
atom_test == 1 && fabs(von_mises_stress - 523.0) > 5e-1) {
1388 "atom test %d failed: wrong von Mises stress value",
1391 if (
atom_test == 2 && fabs(von_mises_stress - 16.3) > 5e-2) {
1393 "atom test %d failed: wrong von Mises stress value",
1396 if (
atom_test == 3 && fabs(von_mises_stress - 14.9) > 5e-2) {
1398 "atom test %d failed: wrong von Mises stress value",
1409 auto null = boost::shared_ptr<FEMethod>();
1415 auto set_fieldsplit_preconditioner = [&](
auto solver) {
1419 CHKERR TSGetSNES(solver, &snes);
1421 CHKERR SNESGetKSP(snes, &ksp);
1423 CHKERR KSPGetPC(ksp, &pc);
1424 PetscBool is_pcfs = PETSC_FALSE;
1425 PetscObjectTypeCompare((PetscObject)pc, PCFIELDSPLIT, &is_pcfs);
1428 if (is_pcfs == PETSC_TRUE) {
1431 auto name_prb =
simple->getProblemName();
1434 CHKERR is_mng->isCreateProblemFieldAndRank(name_prb,
ROW,
"U", 0,
1437 CHKERR is_mng->isCreateProblemFieldAndRank(name_prb,
ROW,
"FLUX", 0, 0,
1440 CHKERR is_mng->isCreateProblemFieldAndRank(name_prb,
ROW,
"T", 0, 0,
1443 CHKERR is_mng->isCreateProblemFieldAndRank(name_prb,
ROW,
"TBC", 0, 0,
1446 CHKERR ISExpand(is_T, is_flux, &is_tmp);
1447 CHKERR ISExpand(is_TBC, is_tmp, &is_tmp2);
1448 CHKERR ISDestroy(&is_tmp);
1453 CHKERR PCFieldSplitSetIS(pc, PETSC_NULL, is_TFlux);
1454 CHKERR PCFieldSplitSetIS(pc, PETSC_NULL, is_u);
1462 CHKERR TSSetSolution(solver,
D);
1463 CHKERR TSSetFromOptions(solver);
1465 CHKERR set_section_monitor(solver);
1466 CHKERR set_fieldsplit_preconditioner(solver);
1467 CHKERR set_time_monitor(dm, solver);
1470 CHKERR TSSolve(solver, NULL);
◆ dispFieldPtr
boost::shared_ptr<MatrixDouble> ThermoElasticProblem::dispFieldPtr |
|
private |
◆ dispGradPtr
boost::shared_ptr<MatrixDouble> ThermoElasticProblem::dispGradPtr |
|
private |
◆ doEvalField
PetscBool ThermoElasticProblem::doEvalField |
|
private |
◆ fieldEvalCoords
◆ fieldEvalData
◆ fluxFieldPtr
boost::shared_ptr<MatrixDouble> ThermoElasticProblem::fluxFieldPtr |
|
private |
◆ mField
◆ strainFieldPtr
boost::shared_ptr<MatrixDouble> ThermoElasticProblem::strainFieldPtr |
|
private |
◆ stressFieldPtr
boost::shared_ptr<MatrixDouble> ThermoElasticProblem::stressFieldPtr |
|
private |
◆ tempFieldPtr
boost::shared_ptr<VectorDouble> ThermoElasticProblem::tempFieldPtr |
|
private |
The documentation for this struct was generated from the following file:
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
boost::shared_ptr< MatrixDouble > fluxFieldPtr
double default_coeff_expansion
Data on single entity (This is passed as argument to DataOperator::doWork)
PetscBool is_plane_strain
#define MYPCOMM_INDEX
default communicator number PCOMM
MoFEMErrorCode tsSolve()
[Push operators to pipeline]
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 3, SPACE_DIM > OpHdivHdiv
[Linear elastic problem]
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
double young_modulus
Young modulus.
Problem manager is used to build and partition problems.
structure for User Loop Methods on finite elements
virtual MPI_Comm & get_comm() const =0
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
@ L2
field with C-1 continuity
Natural boundary conditions.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpMixDivTimesU< 3, 1, SPACE_DIM > OpHDivTemp
Integrate Rhs div flux base times temperature (T)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Get values at integration pts for tensor filed rank 1, i.e. vector field.
std::array< double, SPACE_DIM > fieldEvalCoords
MoFEMErrorCode bC()
[Set up problem]
virtual int get_comm_rank() const =0
OpCalculateScalarFieldValuesFromPetscVecImpl< PetscData::CTX_SET_X_T > OpCalculateScalarFieldValuesDot
PipelineManager interface.
MoFEMErrorCode setupProblem()
add fields
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition of the displacement bc data structure.
double default_poisson_ratio
OpBaseImpl< PETSC, EdgeEleOp > OpBase
#define FTENSOR_INDEX(DIM, I)
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesScalar< 1 > OpBaseDotT
Integrate Rhs base of temperature time heat capacity times heat rate (T)
Simple interface for fast problem set-up.
MoFEMErrorCode getCommandLineParameters()
[Run problem]
Deprecated interface functions.
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
boost::shared_ptr< VectorDouble > tempFieldPtr
const double c
speed of light (cm/ns)
boost::shared_ptr< MatrixDouble > dispGradPtr
#define CHKERR
Inline error check.
auto createDMVector(DM dm)
Get smart vector from DM.
Specialization for DisplacementCubitBcData.
virtual moab::Interface & get_moab()=0
double default_heat_conductivity
Section manager is used to create indexes and sections.
Simple interface for fast problem set-up.
Get vector field for H-div approximation.
Field evaluator interface.
void simple(double P1[], double P2[], double P3[], double c[], const int N)
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
OpBaseDotT OpBaseDivFlux
Integrate Rhs base of temperature times divergence of flux (T)
Get value at integration points for scalar field.
double poisson_ratio
Poisson ratio.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradSymTensorGrad< 1, SPACE_DIM, SPACE_DIM, 0 > OpKCauchy
[Linear elastic problem]
SeverityLevel
Severity levels.
FTensor::Index< 'i', SPACE_DIM > i
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpGradTimesSymTensor< 1, SPACE_DIM, SPACE_DIM > OpInternalForceCauchy
MoFEMErrorCode OPs()
[Boundary condition]
constexpr auto field_name
Add operators pushing bases from local to physical configuration.
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
boost::shared_ptr< MatrixDouble > strainFieldPtr
MoFEMErrorCode addMatBlockOps(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pipeline, std::string block_elastic_name, std::string block_thermal_name, boost::shared_ptr< BlockedParameters > blockedParamsPtr, Sev sev)
boost::shared_ptr< MatrixDouble > dispFieldPtr
PetscErrorCode PetscOptionsGetRealArray(PetscOptions *, const char pre[], const char name[], PetscReal dval[], PetscInt *nmax, PetscBool *set)
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define MOFEM_LOG(channel, severity)
Log.
double default_young_modulus
[Essential boundary conditions (Least square approach)]
FTensor::Index< 'j', 3 > j
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
PetscErrorCode DMMoFEMTSSetMonitor(DM dm, TS ts, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
Set Monitor To TS solver.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ HCURL
field with continuous tangents
@ MOFEM_DATA_INCONSISTENCY
Interface for managing meshsets containing materials and boundary conditions.
auto createVectorMPI(MPI_Comm comm, PetscInt n, PetscInt N)
Create MPI Vector.
Calculate divergence of vector field.
MoFEMErrorCode MoFEMSNESMonitorFields(SNES snes, PetscInt its, PetscReal fgnorm, SnesCtx *snes_ctx)
Sens monitor printing residual field by field.
FieldApproximationBase
approximation base
UBlasVector< double > VectorDouble
const double D
diffusivity
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, 1 > OpCapacity
Integrate Lhs base of temperature times (heat capacity) times base of temperature (T x T)
Definition of the heat flux bc data structure.
FTensor::Index< 'm', 3 > m
double default_heat_capacity
Kronecker Delta class symmetric.
@ MOFEM_ATOM_TEST_INVALID
auto getDMSnesCtx(DM dm)
Get SNES context data structure used by DM.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
MoFEM::Interface & mField
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
boost::shared_ptr< FieldEvaluatorInterface::SetPtsData > fieldEvalData
FTensor::Index< 'k', 3 > k
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMixDivTimesScalar< SPACE_DIM > OpHdivT
Integrate Lhs div of base of flux time base of temperature (FLUX x T) and transpose of it,...
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ HDIV
field with continuous normal traction
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
FTensor::Index< 'l', 3 > l
boost::shared_ptr< MatrixDouble > stressFieldPtr
Post post-proc data at points from hash maps.
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesVector< 3, SPACE_DIM, 1 > OpHdivFlux
Integrating Rhs flux base (1/k) flux (FLUX)