9 #ifndef EXECUTABLE_DIMENSION
10 #define EXECUTABLE_DIMENSION 3
14 using namespace MoFEM;
57 GAUSS>::OpMixDivTimesScalar<SPACE_DIM>;
71 GAUSS>::OpBaseTimesVector<3, SPACE_DIM, 1>;
78 GAUSS>::OpMixDivTimesU<3, 1, SPACE_DIM>;
117 GAUSS>::OpEssentialRhs<HeatFluxCubitBcData, 3, SPACE_DIM>;
120 GAUSS>::OpEssentialLhs<HeatFluxCubitBcData, 3, SPACE_DIM>;
157 CHKERR moab.add_entities(*out_meshset,
r);
158 CHKERR moab.write_file(name.c_str(),
"VTK",
"", out_meshset->get_ptr(), 1);
184 getCommandLineParameters();
190 :
public boost::enable_shared_from_this<BlockedParameters> {
197 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &mD);
201 return boost::shared_ptr<VectorDouble>(shared_from_this(),
206 return boost::shared_ptr<double>(shared_from_this(), &heatConductivity);
210 return boost::shared_ptr<double>(shared_from_this(), &heatCapacity);
215 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
216 std::string block_elastic_name, std::string block_thermal_name,
217 boost::shared_ptr<BlockedParameters> blockedParamsPtr,
Sev sev);
221 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
222 std::string block_elastic_name, std::string block_thermal_name,
223 boost::shared_ptr<BlockedParameters> blockedParamsPtr,
Sev sev) {
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()
466 CHKERR getCommandLineParameters();
479 auto get_command_line_parameters = [&]() {
527 <<
"Reference temperature " <<
ref_temp;
534 CHKERR get_command_line_parameters();
552 CHKERR simple->addDomainField(
"FLUX", flux_space, base, 1);
553 CHKERR simple->addBoundaryField(
"FLUX", flux_space, base, 1);
565 fieldEvalCoords.data(), &coords_dim,
568 tempFieldPtr = boost::make_shared<VectorDouble>();
569 fluxFieldPtr = boost::make_shared<MatrixDouble>();
570 dispFieldPtr = boost::make_shared<MatrixDouble>();
571 dispGradPtr = boost::make_shared<MatrixDouble>();
572 strainFieldPtr = boost::make_shared<MatrixDouble>();
573 stressFieldPtr = boost::make_shared<MatrixDouble>();
581 fieldEvalData,
simple->getDomainFEName());
584 fieldEvalData,
simple->getDomainFEName());
587 fieldEvalData->setEvalPoints(fieldEvalCoords.data(), 1);
588 auto no_rule = [](
int,
int,
int) {
return -1; };
590 auto field_eval_fe_ptr = fieldEvalData->feMethodPtr.lock();
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(
616 coeff_expansion_ptr, stressFieldPtr));
633 auto get_skin = [&]() {
635 CHKERR mField.get_moab().get_entities_by_dimension(0,
SPACE_DIM, body_ents);
636 Skinner skin(&mField.get_moab());
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) {
651 CHKERR mField.get_moab().get_entities_by_dimension(
653 skin = subtract(skin, ents);
658 auto remove_named_blocks = [&](
auto n) {
663 (boost::format(
"%s(.*)") %
n).str()
669 CHKERR mField.get_moab().get_entities_by_dimension(
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;
717 (boost::format(
"flux_remove_%d.vtk") % mField.get_comm_rank()).str(),
722 (boost::format(
"temp_bc_remove_%d.vtk") % mField.get_comm_rank()).str(),
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;
736 CHKERR mField.getInterface<
FieldBlas>()->fieldLambdaOnEntities(set_init_temp,
740 simple->getProblemName(),
"U");
742 simple->getProblemName(),
"FLUX",
false);
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());
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(
1263 fieldEvalCoords.data(), 1e-12,
simple->getProblemName(),
1264 simple->getDomainFEName(), fieldEvalData,
1265 mField.get_comm_rank(), mField.get_comm_rank(),
nullptr,
1269 ->evalFEAtThePoint2D(
1270 fieldEvalCoords.data(), 1e-12,
simple->getProblemName(),
1271 simple->getDomainFEName(), fieldEvalData,
1272 mField.get_comm_rank(), mField.get_comm_rank(),
nullptr,
1279 CHKERR VecZeroEntries(eval_num_vec);
1280 if (tempFieldPtr->size()) {
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",
1296 if (tempFieldPtr->size()) {
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",
1313 if (fluxFieldPtr->size1()) {
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);
1330 if (dispFieldPtr->size1()) {
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",
1350 if (strainFieldPtr->size1()) {
1353 getFTensor2SymmetricFromMat<SPACE_DIM>(*strainFieldPtr);
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);
1367 if (stressFieldPtr->size1()) {
1369 getFTensor2SymmetricFromMat<SPACE_DIM>(*stressFieldPtr);
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) {
1429 auto bc_mng = mField.getInterface<
BcManager>();
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);
1481 const char param_file[] =
"param_file.petsc";
1485 auto core_log = logging::core::get();
1499 DMType dm_name =
"DMMOFEM";