36int main(
int argc,
char* argv[])
39 "Tool merges one mesh to a bulk mesh.\n\n"
40 "OpenGeoSys-6 software, version " +
43 "Copyright (c) 2012-2025, OpenGeoSys Community "
44 "(http://www.opengeosys.org)",
46 TCLAP::ValueArg<std::string> bulk_mesh_in(
47 "b",
"bulk-mesh-input-file",
48 "Input (.vtk | .msh). The name of the file containing the input bulk "
50 true,
"",
"INPUT_FILE");
51 cmd.add(bulk_mesh_in);
52 TCLAP::ValueArg<std::string> mesh_in(
53 "i",
"mesh-input-file",
54 "Input (.vtk | .msh). The name of the file containing the input mesh "
56 true,
"",
"INPUT_FILE");
58 TCLAP::ValueArg<std::string> mesh_out(
59 "o",
"mesh-output-file",
60 "Output (.vtk | .msh). The name of the file the merged mesh should be "
62 true,
"",
"OUTPUT_FILE");
65 TCLAP::ValueArg<double> p(
"",
"pressure",
66 "initial pressure value in the mesh to be merged",
67 false, 0.0,
"PRESSURE");
70 TCLAP::ValueArg<double> pg(
72 "initial gas pressure value in the mesh to be merged",
false, 0.0,
76 TCLAP::ValueArg<double> pc(
77 "",
"capillary_pressure",
78 "initial capillary pressure value in the mesh to be merged",
false, 0.0,
79 "CAPILLARY_PRESSURE");
82 TCLAP::ValueArg<double> T(
83 "",
"temperature",
"initial temperature value in the mesh to be merged",
84 false, 290.0,
"TEMPERATURE");
87 TCLAP::ValueArg<double> sxx(
88 "",
"sigma_xx",
"initial stress xx value in the mesh to be merged",
89 false, 0.0,
"SIGMA_XX");
91 TCLAP::ValueArg<double> syy(
92 "",
"sigma_yy",
"initial stress yy value in the mesh to be merged",
93 false, 0.0,
"SIGMA_YY");
95 TCLAP::ValueArg<double> szz(
96 "",
"sigma_zz",
"initial stress zz value in the mesh to be merged",
97 false, 0.0,
"SIGMA_ZZ");
100 TCLAP::ValueArg<int> mat_id(
101 "",
"material_id",
"Material ID of the mesh to be merged, (min = 0)",
102 false, 0.0,
"MATERIAL_ID");
105 cmd.add(log_level_arg);
107 cmd.parse(argc, argv);
115 std::unordered_map<std::string, double> initial_value_dict;
116 initial_value_dict.insert({
"p", p.getValue()});
117 initial_value_dict.insert({
"pg", pg.getValue()});
118 initial_value_dict.insert({
"pc", pc.getValue()});
119 initial_value_dict.insert({
"T", T.getValue()});
120 initial_value_dict.insert({
"sxx", sxx.getValue()});
121 initial_value_dict.insert({
"syy", syy.getValue()});
122 initial_value_dict.insert({
"szz", szz.getValue()});
123 initial_value_dict.insert({
"mat_id", mat_id.getValue()});
125 auto read_mesh = [](std::string
const& mesh_file_name)
128 mesh_file_name,
true ));
132 OGS_FATAL(
"Could not read the mesh {:s}", mesh_file_name);
135 INFO(
"Read {:s}: {:d} nodes, {:d} elements.", mesh_file_name,
136 mesh->getNumberOfNodes(), mesh->getNumberOfElements());
140 auto bulk_mesh = read_mesh(bulk_mesh_in.getValue());
141 auto const mesh_to_be_merged = read_mesh(mesh_in.getValue());
144 *bulk_mesh, *mesh_to_be_merged, initial_value_dict);
148 auto const result = writer.
writeToFile(mesh_out.getValue());
151 ERR(
"Could not write mesh to '{:s}'.", mesh_out.getValue());
161 mesh_to_be_merged->shallowClean();
162 bulk_mesh->shallowClean();