diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp index 0d542c996a5674771ebbe8c7e092531fa6aeb930..2c140c5fd40c13ee029a1fa6a125738044125b60 100644 --- a/Applications/ApplicationsLib/ProjectData.cpp +++ b/Applications/ApplicationsLib/ProjectData.cpp @@ -157,11 +157,11 @@ void readGeometry(std::string const& fname, GeoLib::GEOObjects& geo_objects, { DBUG("Reading geometry file '{:s}'.", fname); GeoLib::IO::BoostXmlGmlInterface gml_reader(geo_objects); - std::string geometry_file = BaseLib::copyPathToFileName(fname, dir_first); + std::string geometry_file = BaseLib::joinPaths(dir_first, fname); if (!BaseLib::IsFileExisting(geometry_file)) { // Fallback to reading gml from prj-file directory - geometry_file = BaseLib::copyPathToFileName(fname, dir_second); + geometry_file = BaseLib::joinPaths(dir_second, fname); WARN("File {:s} not found in {:s}! Trying reading from {:s}.", fname, dir_first, dir_second); if (!BaseLib::IsFileExisting(geometry_file)) @@ -177,16 +177,27 @@ std::unique_ptr<MeshLib::Mesh> readSingleMesh( BaseLib::ConfigTree const& mesh_config_parameter, std::string const& directory) { - std::string const mesh_file = BaseLib::copyPathToFileName( - mesh_config_parameter.getValue<std::string>(), directory); + std::string const mesh_file = BaseLib::joinPaths( + directory, mesh_config_parameter.getValue<std::string>()); DBUG("Reading mesh file '{:s}'.", mesh_file); auto mesh = std::unique_ptr<MeshLib::Mesh>(MeshLib::IO::readMeshFromFile( mesh_file, true /* compute_element_neighbors */)); if (!mesh) { + std::filesystem::path abspath{mesh_file}; + try + { + abspath = std::filesystem::absolute(mesh_file); + } + catch (std::filesystem::filesystem_error const& e) + { + ERR("Determining the absolute path of '{}' failed: {}", mesh_file, + e.what()); + } + OGS_FATAL("Could not read mesh from '{:s}' file. No mesh added.", - mesh_file); + abspath.string()); } #ifdef DOXYGEN_DOCU_ONLY @@ -369,7 +380,7 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config, py_path.attr("append")(script_directory); // .prj or -s directory auto const script_path = - BaseLib::copyPathToFileName(*python_script, script_directory); + BaseLib::joinPaths(script_directory, *python_script); // Evaluate in scope of main module py::object scope = py::module::import("__main__").attr("__dict__"); diff --git a/BaseLib/FileTools.cpp b/BaseLib/FileTools.cpp index 4b7a506e9cc0cba526ebe72fd4707618cdfa541c..0afffba21602c1261e76ff73b578bb6ae428789c 100644 --- a/BaseLib/FileTools.cpp +++ b/BaseLib/FileTools.cpp @@ -200,17 +200,6 @@ bool hasFileExtension(std::string const& extension, std::string const& filename) return boost::iequals(extension, getFileExtension(filename)); } -std::string copyPathToFileName(const std::string& file_name, - const std::string& source) -{ - auto filePath = std::filesystem::path(file_name); - if (filePath.has_parent_path()) - { - return filePath.string(); - } - return (std::filesystem::path(source) /= filePath).string(); -} - std::string extractPath(std::string const& pathname) { return std::filesystem::path(pathname).parent_path().string(); diff --git a/BaseLib/FileTools.h b/BaseLib/FileTools.h index 63e5448c5d5334d8a88fd2f58ac984496511ec07..523e87d10cb113f7e0c10b2d50f82ea7a6b55443 100644 --- a/BaseLib/FileTools.h +++ b/BaseLib/FileTools.h @@ -120,13 +120,6 @@ std::string getFileExtension(std::string const& path); bool hasFileExtension(std::string const& extension, std::string const& filename); -/** - * Checks if file_name already contains a qualified path and if not copies the - * path from source. - */ -std::string copyPathToFileName(const std::string& file_name, - const std::string& source); - /** Returns a string with file extension as found by getFileExtension() * dropped. */ diff --git a/Documentation/ProjectFile/material/solid/constitutive_relation/MFront/library/a_path_is_relative_to_prj_file.md b/Documentation/ProjectFile/material/solid/constitutive_relation/MFront/library/a_path_is_relative_to_prj_file.md new file mode 100644 index 0000000000000000000000000000000000000000..b8e64afb9bd91fffaf5b1b165c794e8c41b62f48 --- /dev/null +++ b/Documentation/ProjectFile/material/solid/constitutive_relation/MFront/library/a_path_is_relative_to_prj_file.md @@ -0,0 +1,5 @@ +This setting modifies where the shared library containing the MFront behaviour will be looked for. + +The default setting of `true` should work for almost all use cases. `false` is used for some special tests in OGS's test suite. + +See also the documentation of the \ref ogs_file_param__material__solid__constitutive_relation__MFront__library "<code><library></code>" tag. diff --git a/Documentation/ProjectFile/material/solid/constitutive_relation/MFront/library/i_library.md b/Documentation/ProjectFile/material/solid/constitutive_relation/MFront/library/i_library.md new file mode 100644 index 0000000000000000000000000000000000000000..a4b2d88090f6dc144f884aa95b0ffb55aca5c08e --- /dev/null +++ b/Documentation/ProjectFile/material/solid/constitutive_relation/MFront/library/i_library.md @@ -0,0 +1,3 @@ +Path of the shared library containing the material model. + +Relative paths are interpreted relative to the project directory unless \ref ogs_file_attr__material__solid__constitutive_relation__MFront__library__path_is_relative_to_prj_file "<code>path_is_relative_to_prj_file</code>" is set to `false`, in which case the library path/name is used verbatim and will be searched based on the operating system's library lookup rules. diff --git a/Documentation/ProjectFile/material/solid/constitutive_relation/MFront/t_library.md b/Documentation/ProjectFile/material/solid/constitutive_relation/MFront/t_library.md deleted file mode 100644 index 5e87a14f113cf010dac47e75fb749c81d1d1f855..0000000000000000000000000000000000000000 --- a/Documentation/ProjectFile/material/solid/constitutive_relation/MFront/t_library.md +++ /dev/null @@ -1,3 +0,0 @@ -Path of the shared library containing the material model. - -Relative paths are interpreted relative to the project directory. diff --git a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp index 9a9151cce0eeb8546db50da71a5b5b4234930c40..77c280633b0fa7d6107eeb8861d5c3a9e2d08a40 100644 --- a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp +++ b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp @@ -149,8 +149,8 @@ void XmlStnInterface::readStations(const QDomNode& stationsRoot, s->setStationValue(stationValue); if (!sensor_data_file_name.empty()) { - s->addSensorDataFromCSV(BaseLib::copyPathToFileName( - sensor_data_file_name, station_file_name)); + s->addSensorDataFromCSV(BaseLib::joinPaths( + station_file_name, sensor_data_file_name)); } stations.push_back(s); } diff --git a/MaterialLib/SolidModels/MFront/CreateMFront.cpp b/MaterialLib/SolidModels/MFront/CreateMFront.cpp index db8b12ae1715bcf252e11f0ead082c8dec446cbe..07fbd39e0fcf617db22cb778e87b1817baa6f019 100644 --- a/MaterialLib/SolidModels/MFront/CreateMFront.cpp +++ b/MaterialLib/SolidModels/MFront/CreateMFront.cpp @@ -29,9 +29,7 @@ std::unique_ptr<MechanicsBase<DisplacementDim>> createMFront( local_coordinate_system, BaseLib::ConfigTree const& config) { - bool const library_path_is_relative_to_prj_file = true; - auto conf = createMFrontConfig(DisplacementDim, parameters, config, - library_path_is_relative_to_prj_file); + auto conf = createMFrontConfig(DisplacementDim, parameters, config); return std::make_unique<MFront<DisplacementDim>>( std::move(conf.behaviour), std::move(conf.material_properties), diff --git a/MaterialLib/SolidModels/MFront/CreateMFrontGeneric.cpp b/MaterialLib/SolidModels/MFront/CreateMFrontGeneric.cpp index 8666eb126107c0d95f44b24ffc0410466046c77a..eb79dc49b6c2ff787e7b0a1cfdaaf65630007e29 100644 --- a/MaterialLib/SolidModels/MFront/CreateMFrontGeneric.cpp +++ b/MaterialLib/SolidModels/MFront/CreateMFrontGeneric.cpp @@ -324,23 +324,31 @@ namespace MaterialLib::Solids::MFront MFrontConfig createMFrontConfig( int const displacement_dim, std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters, - BaseLib::ConfigTree const& config, - bool const library_path_is_relative_to_prj_file) + BaseLib::ConfigTree const& config) { INFO("### MFRONT ########################################################"); //! \ogs_file_param{material__solid__constitutive_relation__type} config.checkConfigParameter("type", "MFront"); - auto const library_name = - //! \ogs_file_param{material__solid__constitutive_relation__MFront__library} - config.getConfigParameterOptional<std::string>("library"); + //! \ogs_file_param{material__solid__constitutive_relation__MFront__library} + auto const library = config.getConfigSubtreeOptional("library"); + + bool const library_path_is_relative_to_prj_file = + library /* If no library tag is specified in the prj file, the lib + shipped with OGS is used, whose path is not relative to the + project file. */ + && + //! \ogs_file_attr{material__solid__constitutive_relation__MFront__library__path_is_relative_to_prj_file} + library->getConfigAttribute("path_is_relative_to_prj_file", true); + + std::string const library_name = + library ? library->getValue<std::string>() : "libOgsMFrontBehaviour"; + auto const lib_path = - library_name ? (library_path_is_relative_to_prj_file - ? BaseLib::joinPaths(BaseLib::getProjectDirectory(), - *library_name) - : *library_name) - : "libOgsMFrontBehaviour"; + library_path_is_relative_to_prj_file + ? BaseLib::joinPaths(BaseLib::getProjectDirectory(), library_name) + : library_name; mgis::behaviour::Hypothesis hypothesis; if (displacement_dim == 2) diff --git a/MaterialLib/SolidModels/MFront/CreateMFrontGeneric.h b/MaterialLib/SolidModels/MFront/CreateMFrontGeneric.h index 0b4394b8078cc4b67e452b2f7de4c9e5899c7c6c..09a9ab96e908a9704a4c5eca1c9de16430cdba32 100644 --- a/MaterialLib/SolidModels/MFront/CreateMFrontGeneric.h +++ b/MaterialLib/SolidModels/MFront/CreateMFrontGeneric.h @@ -26,8 +26,7 @@ struct MFrontConfig MFrontConfig createMFrontConfig( int const displacement_dim, std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters, - BaseLib::ConfigTree const& config, - bool const library_path_is_relative_to_prj_file); + BaseLib::ConfigTree const& config); template <int DisplacementDim, typename Gradients, typename TDynForces, typename ExtStateVars> @@ -37,11 +36,9 @@ createMFrontGeneric( std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters, std::optional<ParameterLib::CoordinateSystem> const& local_coordinate_system, - BaseLib::ConfigTree const& config, - bool const library_path_is_relative_to_prj_file) + BaseLib::ConfigTree const& config) { - auto conf = createMFrontConfig(DisplacementDim, parameters, config, - library_path_is_relative_to_prj_file); + auto conf = createMFrontConfig(DisplacementDim, parameters, config); return std::make_unique< MFrontGeneric<DisplacementDim, Gradients, TDynForces, ExtStateVars>>( diff --git a/MeshLib/IO/readMeshFromFile.cpp b/MeshLib/IO/readMeshFromFile.cpp index 07ad8a95348e9d26cc3db0162b71e6171de095f4..3545a04b858e7d8715d3c86fb392d3912a729373 100644 --- a/MeshLib/IO/readMeshFromFile.cpp +++ b/MeshLib/IO/readMeshFromFile.cpp @@ -85,6 +85,12 @@ MeshLib::Mesh* readMeshFromFile(const std::string& file_name, { std::unique_ptr<Mesh> mesh{ readMeshFromFileSerial(file_name, compute_element_neighbors)}; + + if (!mesh) + { + return nullptr; + } + return new MeshLib::NodePartitionedMesh(*mesh); } return nullptr; diff --git a/ProcessLib/HeatConduction/Tests.cmake b/ProcessLib/HeatConduction/Tests.cmake index 5277158dec8d5b74e0c85f8387e2f9a348356e04..a2fa990c28c9542c22c1ee9e54532deaea4d377f 100644 --- a/ProcessLib/HeatConduction/Tests.cmake +++ b/ProcessLib/HeatConduction/Tests.cmake @@ -452,6 +452,15 @@ AddTest( line_1_line_1e2_ts_500_t_39062500.000000_reference.vtu line_1_line_1e2_ts_500_t_39062500.000000.vtu temperature temperature 1e-10 0.0 ) +# failing test - mesh not found +AddTest( + NAME 1D_HeatConduction_dirichlet_SourceTerm_fail_mesh_not_found + PATH Parabolic/T/1D_dirichlet_source-term + EXECUTABLE ogs + EXECUTABLE_ARGS line_1_line_1e2_source_term_fail_mesh_not_found.xml + PROPERTIES PASS_REGULAR_EXPRESSION "Could not read mesh from '.*' file[.] No mesh added[.]" +) + AddTest( NAME HeatConduction_t1_1Dsource PATH Parabolic/T/t1_1Dsource diff --git a/ProcessLib/LargeDeformation/ConstitutiveRelations/CreateConstitutiveSetting.cpp b/ProcessLib/LargeDeformation/ConstitutiveRelations/CreateConstitutiveSetting.cpp index 5e3d8e961ea8708dff6a29b8091ff613c7ab613a..a594500d2aeb1fb0277277b5d4871e8751c55182 100644 --- a/ProcessLib/LargeDeformation/ConstitutiveRelations/CreateConstitutiveSetting.cpp +++ b/ProcessLib/LargeDeformation/ConstitutiveRelations/CreateConstitutiveSetting.cpp @@ -26,13 +26,10 @@ std::unique_ptr<SolidConstitutiveRelation<DisplacementDim>> createMFrontGeneric( namespace MSM = MaterialLib::Solids::MFront; using namespace boost::mp11; - bool const library_path_is_relative_to_prj_file = true; - return MSM::createMFrontGeneric< DisplacementDim, mp_list<MSM::DeformationGradient>, mp_list<MSM::SecondPiolaKirchhoffStress>, mp_list<MSM::Temperature>>( - parameters, local_coordinate_system, config, - library_path_is_relative_to_prj_file); + parameters, local_coordinate_system, config); } template <int DisplacementDim> diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/CreateConstitutiveSetting.cpp b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/CreateConstitutiveSetting.cpp index f60915a8c0aff5ee85ab8c3cd4aa3ab452df9351..208056cb77158e7a30611ce0ecb81ff626238723 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/CreateConstitutiveSetting.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/CreateConstitutiveSetting.cpp @@ -27,13 +27,10 @@ std::unique_ptr<SolidConstitutiveRelation<DisplacementDim>> createMFrontGeneric( namespace MSM = MaterialLib::Solids::MFront; using namespace boost::mp11; - bool const library_path_is_relative_to_prj_file = true; - return MSM::createMFrontGeneric< DisplacementDim, mp_list<MSM::Strain, MSM::LiquidPressure>, mp_list<MSM::Stress, MSM::Saturation>, mp_list<MSM::Temperature>>( - parameters, local_coordinate_system, config, - library_path_is_relative_to_prj_file); + parameters, local_coordinate_system, config); } template <int DisplacementDim> diff --git a/Tests/BaseLib/TestFilePathStringManipulation.cpp b/Tests/BaseLib/TestFilePathStringManipulation.cpp index d790059ad57295ae67e4339b69b2b0d30ee7481b..0b8c9d5b926d8eb8ee2c537f620651343788c1ee 100644 --- a/Tests/BaseLib/TestFilePathStringManipulation.cpp +++ b/Tests/BaseLib/TestFilePathStringManipulation.cpp @@ -13,30 +13,27 @@ #include "BaseLib/FileTools.h" #ifdef WIN32 -TEST(BaseLib, CopyPathToFileNameWin) +TEST(BaseLib, JoinPathsWin) { - ASSERT_EQ("extend\\file", BaseLib::copyPathToFileName("file", "extend")); - ASSERT_EQ("path\\file", - BaseLib::copyPathToFileName("path\\file", "extend")); - ASSERT_EQ("extend\\file", BaseLib::copyPathToFileName("file", "extend\\")); - ASSERT_EQ("path\\file", - BaseLib::copyPathToFileName("path\\file", "extend\\")); - ASSERT_EQ("extend\\smth\\file", - BaseLib::copyPathToFileName("file", "extend\\smth")); - ASSERT_EQ("path\\file", - BaseLib::copyPathToFileName("path\\file", "extend\\smth")); + ASSERT_EQ("extend\\file", BaseLib::joinPaths("extend", "file")); + ASSERT_EQ("extend\\path\\file", BaseLib::joinPaths("extend", "path\\file")); + ASSERT_EQ("extend\\file", BaseLib::joinPaths("extend\\", "file")); + ASSERT_EQ("extend\\path\\file", + BaseLib::joinPaths("extend\\", "path\\file")); + ASSERT_EQ("extend\\smth\\file", BaseLib::joinPaths("extend\\smth", "file")); + ASSERT_EQ("extend\\smth\\path\\file", + BaseLib::joinPaths("extend\\smth", "path\\file")); } #else -TEST(BaseLib, CopyPathToFileNameUnix) +TEST(BaseLib, JoinPathsUnix) { - ASSERT_EQ("extend/file", BaseLib::copyPathToFileName("file", "extend")); - ASSERT_EQ("path/file", BaseLib::copyPathToFileName("path/file", "extend")); - ASSERT_EQ("extend/file", BaseLib::copyPathToFileName("file", "extend/")); - ASSERT_EQ("path/file", BaseLib::copyPathToFileName("path/file", "extend/")); + ASSERT_EQ("extend/file", BaseLib::joinPaths("extend", "file")); + ASSERT_EQ("extend/path/file", BaseLib::joinPaths("extend", "path/file")); + ASSERT_EQ("extend/file", BaseLib::joinPaths("extend/", "file")); + ASSERT_EQ("extend/path/file", BaseLib::joinPaths("extend/", "path/file")); - ASSERT_EQ("extend/smth/file", - BaseLib::copyPathToFileName("file", "extend/smth")); - ASSERT_EQ("path/file", - BaseLib::copyPathToFileName("path/file", "extend/smth")); + ASSERT_EQ("extend/smth/file", BaseLib::joinPaths("extend/smth", "file")); + ASSERT_EQ("extend/smth/path/file", + BaseLib::joinPaths("extend/smth", "path/file")); } #endif diff --git a/Tests/Data/Mechanics/Linear/SimpleMechanics.ipynb b/Tests/Data/Mechanics/Linear/SimpleMechanics.ipynb index 01bf6c3f14b18dc55ff936187e4837ef41db8a16..ec086954419b58b31b564256dcd49d78472e8753 100644 --- a/Tests/Data/Mechanics/Linear/SimpleMechanics.ipynb +++ b/Tests/Data/Mechanics/Linear/SimpleMechanics.ipynb @@ -171,7 +171,9 @@ ")\n", "try:\n", " model.write_input()\n", - " model.run_model(logfile=(out_dir / f\"{prj_name}.txt\"), args=f\"-o {out_dir}\")\n", + " model.run_model(\n", + " logfile=(out_dir / f\"{prj_name}-out.txt\"), args=f\"-o {out_dir} -m .\"\n", + " )\n", "except Exception as inst:\n", " print(f\"{type(inst)}: {inst.args[0]}\")\n", "\n", diff --git a/Tests/Data/Parabolic/T/1D_dirichlet_source-term/line_1_line_1e2_source_term_fail_mesh_not_found.xml b/Tests/Data/Parabolic/T/1D_dirichlet_source-term/line_1_line_1e2_source_term_fail_mesh_not_found.xml new file mode 100644 index 0000000000000000000000000000000000000000..58ca37ba59bc60eb402fa2645519b38cef611630 --- /dev/null +++ b/Tests/Data/Parabolic/T/1D_dirichlet_source-term/line_1_line_1e2_source_term_fail_mesh_not_found.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<OpenGeoSysProjectDiff base_file="line_1_line_1e2_source_term.prj"> + <replace msel="/*/meshes/mesh[1]/text()"> + NON_EXISTENT_MESH.vtu + </replace> +</OpenGeoSysProjectDiff> + diff --git a/Tests/Data/PhaseField/PForthotropy_jupyter_notebook/sen_shear.ipynb b/Tests/Data/PhaseField/PForthotropy_jupyter_notebook/sen_shear.ipynb index e6cec7ccb9aa893b7853d39798e01353af65ad94..eaa777c91e1bdeb4769c83f95375ea9586c5d578 100644 --- a/Tests/Data/PhaseField/PForthotropy_jupyter_notebook/sen_shear.ipynb +++ b/Tests/Data/PhaseField/PForthotropy_jupyter_notebook/sen_shear.ipynb @@ -67,8 +67,6 @@ "metadata": {}, "outputs": [], "source": [ - "data_dir = os.environ.get(\"OGS_DATA_DIR\", \"../../..\")\n", - "\n", "from pathlib import Path\n", "\n", "out_dir = Path(os.environ.get(\"OGS_TESTRUNNER_OUT_DIR\", \"_out\"))\n", @@ -147,7 +145,9 @@ " print(\n", " f\"> Running single edge notched shear test {phasefield_model} - {energy_split_model} ... <\"\n", " )\n", - " logfile = f\"{out_dir}/log_{phasefield_model}_{energy_split_model}.txt\" # noqa: F841\n", + " # fmt: off\n", + " logfile = f\"{out_dir}/log_{phasefield_model}_{energy_split_model}_out.txt\" # noqa: F841\n", + " # fmt: on\n", " model = ogs.OGS(INPUT_FILE=prj_name, PROJECT_FILE=f\"{out_dir}/{prj_name}\", MKL=True)\n", "\n", " # generate prefix from properties\n", @@ -201,16 +201,18 @@ " xpath=\"./linear_solvers/linear_solver/petsc/parameters\",\n", " occurrence=1,\n", " )\n", - " model.replace_text(\"./shear.gml\", xpath=\"./geometry\")\n", + " model.replace_text(Path(\"./shear.gml\").resolve(), xpath=\"./geometry\")\n", " model.write_input()\n", " # run ogs\n", " t0 = time.time()\n", " if MPI:\n", " print(f\" > OGS started execution with MPI - {ncores} cores...\")\n", " ! mpirun --bind-to none -np {ncores} ogs {out_dir}/{prj_name} -o {output_dir} >> {logfile}\n", + " assert _exit_code == 0 # noqa: F821\n", " else:\n", " print(\" > OGS started execution - \")\n", " ! ogs {out_dir}/{prj_name} -o {output_dir} >> {logfile}\n", + " assert _exit_code == 0 # noqa: F821\n", " tf = time.time()\n", " print(\" > OGS terminated execution. Elapsed time: \", round(tf - t0, 2), \" s.\")" ] diff --git a/Tests/Data/PhaseField/kregime_jupyter_notebook/Kregime_Static_jupyter.ipynb b/Tests/Data/PhaseField/kregime_jupyter_notebook/Kregime_Static_jupyter.ipynb index f6374abafe7e2fbe13c5ac177466ae45d33667ec..39301b2f5c2a7479a16b57a9a868096990af6326 100644 --- a/Tests/Data/PhaseField/kregime_jupyter_notebook/Kregime_Static_jupyter.ipynb +++ b/Tests/Data/PhaseField/kregime_jupyter_notebook/Kregime_Static_jupyter.ipynb @@ -317,14 +317,19 @@ " MKL=True,\n", " args=f\"-o {out_dir}\",\n", " )\n", + "\n", + " gml_file = Path(\"./Kregime_Static.gml\").resolve()\n", + "\n", " model.replace_parameter_value(name=\"ls\", value=ls)\n", - " model.replace_text(\"./Kregime_Static.gml\", xpath=\"./geometry\")\n", + " model.replace_text(gml_file, xpath=\"./geometry\")\n", " model.replace_text(filename, xpath=\"./time_loop/output/prefix\")\n", " model.write_input()\n", " # run simulation with ogs\n", " t0 = time.time()\n", " print(\">>> OGS started execution ... <<<\")\n", - " !ogs {out_dir}/{prj_name} -o {out_dir} > {out_dir}/log.txt\n", + "\n", + " !ogs {out_dir}/{prj_name} -o {out_dir} -m {out_dir} > {out_dir}/ogs-out.txt\n", + " assert _exit_code == 0 # noqa: F821\n", " tf = time.time()\n", " print(\">>> OGS terminated execution <<< Elapsed time: \", round(tf - t0, 2), \" s.\")" ] diff --git a/Tests/Data/PhaseField/surfing_jupyter_notebook/surfing_pyvista.ipynb b/Tests/Data/PhaseField/surfing_jupyter_notebook/surfing_pyvista.ipynb index 63066739bb3a57f7974b1573bcfa7eac048db1c8..76fff6c1fe59bef945a1685cd20f020db604cceb 100644 --- a/Tests/Data/PhaseField/surfing_jupyter_notebook/surfing_pyvista.ipynb +++ b/Tests/Data/PhaseField/surfing_jupyter_notebook/surfing_pyvista.ipynb @@ -340,17 +340,21 @@ " MKL=True,\n", " args=f\"-o {out_dir}\",\n", ")\n", + "\n", + "gml_file = Path(\"./surfing.gml\").resolve()\n", + "\n", "model.replace_parameter_value(name=\"ls\", value=2 * h)\n", "model.replace_text(phasefield_model, xpath=\"./processes/process/phasefield_model\")\n", - "model.replace_text(\"./surfing.gml\", xpath=\"./geometry\")\n", - "model.replace_text(\"./Surfing_python.py\", xpath=\"./python_script\")\n", + "model.replace_text(gml_file, xpath=\"./geometry\")\n", + "model.replace_text(Path(\"./Surfing_python.py\").resolve(), xpath=\"./python_script\")\n", "model.write_input()\n", "\n", "import time\n", "\n", "t0 = time.time()\n", "print(\">>> OGS started execution ... <<<\")\n", - "! ogs {out_dir}/{prj_name} -o {out_dir} > {out_dir}/log.txt\n", + "! ogs {out_dir}/{prj_name} -o {out_dir} -m {out_dir} > {out_dir}/ogs-out.txt\n", + "assert _exit_code == 0 # noqa: F821\n", "\n", "tf = time.time()\n", "print(\">>> OGS terminated execution <<< Elapsed time: \", round(tf - t0, 2), \" s.\")" diff --git a/Tests/MaterialLib/CheckParamPassingMFront.cpp b/Tests/MaterialLib/CheckParamPassingMFront.cpp index d9ef2df7220e2eb4a4eae7e8663815202d170f05..83b8e7045d8f5f4e477c35f9809390c378abee9a 100644 --- a/Tests/MaterialLib/CheckParamPassingMFront.cpp +++ b/Tests/MaterialLib/CheckParamPassingMFront.cpp @@ -97,7 +97,7 @@ auto createMFront( const char* xml = R"XML( <type>MFront</type> <behaviour>CheckParamPassing1</behaviour> - <library>libOgsMFrontBehaviourForUnitTests</library> + <library path_is_relative_to_prj_file="false">libOgsMFrontBehaviourForUnitTests</library> <material_properties> <material_property name="YoungModulus" parameter="E"/> <material_property name="PoissonRatio" parameter="nu"/> @@ -113,7 +113,7 @@ auto createMFront( 3, boost::mp11::mp_list<MSM::Strain, MSM::LiquidPressure>, boost::mp11::mp_list<MSM::Stress, MSM::Saturation>, boost::mp11::mp_list<MSM::Temperature>>( - parameters, local_coordinate_system, config_tree, false); + parameters, local_coordinate_system, config_tree); } TEST(MaterialLib_CheckParamPassingMFront, SuccessTest) diff --git a/Tests/MaterialLib/CheckStiffnessMatrixMFront.cpp b/Tests/MaterialLib/CheckStiffnessMatrixMFront.cpp index 2af9d71d8919146e4f955a50ccb9ebfdb38b75f5..6d4708563a5a43151f522b0372eeeeb8751bd31b 100644 --- a/Tests/MaterialLib/CheckStiffnessMatrixMFront.cpp +++ b/Tests/MaterialLib/CheckStiffnessMatrixMFront.cpp @@ -29,7 +29,7 @@ auto createMFront(std::string const& behaviour) auto const xml = fmt::format(R"XML( <type>MFront</type> <behaviour>{}</behaviour> - <library>libOgsMFrontBehaviourForUnitTests</library> + <library path_is_relative_to_prj_file="false">libOgsMFrontBehaviourForUnitTests</library> <material_properties /> )XML", behaviour); @@ -41,7 +41,7 @@ auto createMFront(std::string const& behaviour) return MSM::createMFrontGeneric< 3, boost::mp11::mp_list<MSM::Strain, MSM::LiquidPressure>, boost::mp11::mp_list<MSM::Stress, MSM::Saturation>, ExtStateVars>( - parameters, local_coordinate_system, config_tree, false); + parameters, local_coordinate_system, config_tree); } struct TestDataBase diff --git a/Tests/MaterialLib/ThermoporoelasticityMFront.cpp b/Tests/MaterialLib/ThermoporoelasticityMFront.cpp index 8d841442345e5b71597d98b44147735c2c9c4e6f..10d761e6d155b884807edf8ca504c21968757601 100644 --- a/Tests/MaterialLib/ThermoporoelasticityMFront.cpp +++ b/Tests/MaterialLib/ThermoporoelasticityMFront.cpp @@ -131,7 +131,7 @@ static auto createMFront( 3, boost::mp11::mp_list<MSM::Strain, MSM::LiquidPressure>, boost::mp11::mp_list<MSM::Stress, MSM::Saturation>, boost::mp11::mp_list<MSM::Temperature>>( - parameters, local_coordinate_system, config_tree, false); + parameters, local_coordinate_system, config_tree); } TEST(MaterialLib_ThermoPoroElasticityMFront, IsochoricDrainedHeating)