From e6cad424a24a41ff4b5a63caa83153ebdc98e670 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Fri, 8 Sep 2017 16:42:58 +0200 Subject: [PATCH] [PL] SD: Add parsing of density and gravity. Store the results in the process data. --- .../SMALL_DEFORMATION/t_solid_density.md | 1 + .../t_specific_body_force.md | 1 + .../CreateSmallDeformationProcess.cpp | 26 ++++++++++++++++++- .../SmallDeformationProcessData.h | 21 ++++++++++++--- 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 Documentation/ProjectFile/prj/processes/process/SMALL_DEFORMATION/t_solid_density.md create mode 100644 Documentation/ProjectFile/prj/processes/process/SMALL_DEFORMATION/t_specific_body_force.md diff --git a/Documentation/ProjectFile/prj/processes/process/SMALL_DEFORMATION/t_solid_density.md b/Documentation/ProjectFile/prj/processes/process/SMALL_DEFORMATION/t_solid_density.md new file mode 100644 index 00000000000..4cc76c57916 --- /dev/null +++ b/Documentation/ProjectFile/prj/processes/process/SMALL_DEFORMATION/t_solid_density.md @@ -0,0 +1 @@ +\copydoc ProcessLib::SmallDeformation::SmallDeformationProcessData::solid_density diff --git a/Documentation/ProjectFile/prj/processes/process/SMALL_DEFORMATION/t_specific_body_force.md b/Documentation/ProjectFile/prj/processes/process/SMALL_DEFORMATION/t_specific_body_force.md new file mode 100644 index 00000000000..a481e852d81 --- /dev/null +++ b/Documentation/ProjectFile/prj/processes/process/SMALL_DEFORMATION/t_specific_body_force.md @@ -0,0 +1 @@ +\copydoc ProcessLib::SmallDeformation::SmallDeformationProcessData::specific_body_force diff --git a/ProcessLib/SmallDeformation/CreateSmallDeformationProcess.cpp b/ProcessLib/SmallDeformation/CreateSmallDeformationProcess.cpp index ceb84f4daed..8db7dc6dfc2 100644 --- a/ProcessLib/SmallDeformation/CreateSmallDeformationProcess.cpp +++ b/ProcessLib/SmallDeformation/CreateSmallDeformationProcess.cpp @@ -97,8 +97,32 @@ createSmallDeformationProcess( type.c_str()); } + // Solid density + auto& solid_density = findParameter<double>( + config, + //! \ogs_file_param_special{prj__processes__process__SMALL_DEFORMATION__solid_density} + "solid_density", parameters, 1); + DBUG("Use \'%s\' as solid density parameter.", solid_density.name.c_str()); + + // Specific body force + Eigen::Matrix<double, DisplacementDim, 1> specific_body_force; + { + std::vector<double> const b = + //! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION__specific_body_force} + config.getConfigParameter<std::vector<double>>( + "specific_body_force"); + if (b.size() != DisplacementDim) + OGS_FATAL( + "The size of the specific body force vector does not match the " + "displacement dimension. Vector size is %d, displacement " + "dimension is %d", + b.size(), DisplacementDim); + + std::copy_n(b.data(), b.size(), specific_body_force.data()); + } + SmallDeformationProcessData<DisplacementDim> process_data{ - std::move(material)}; + std::move(material), solid_density, specific_body_force}; SecondaryVariableCollection secondary_variables; diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcessData.h b/ProcessLib/SmallDeformation/SmallDeformationProcessData.h index 3aca5d5630d..115b0f286cc 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationProcessData.h +++ b/ProcessLib/SmallDeformation/SmallDeformationProcessData.h @@ -26,13 +26,22 @@ struct SmallDeformationProcessData { SmallDeformationProcessData( std::unique_ptr<MaterialLib::Solids::MechanicsBase<DisplacementDim>>&& - material) - : material{std::move(material)} + material, + Parameter<double> const& solid_density_, + Eigen::Matrix<double, DisplacementDim, 1> + specific_body_force_) + : material{std::move(material)}, + solid_density(solid_density_), + specific_body_force(std::move(specific_body_force_)) { } SmallDeformationProcessData(SmallDeformationProcessData&& other) - : material{std::move(other.material)}, dt{other.dt}, t{other.t} + : material{std::move(other.material)}, + solid_density(other.solid_density), + specific_body_force(other.specific_body_force), + dt{other.dt}, + t{other.t} { } @@ -47,6 +56,12 @@ struct SmallDeformationProcessData std::unique_ptr<MaterialLib::Solids::MechanicsBase<DisplacementDim>> material; + /// Solid's density. A scalar quantity, Parameter<double>. + Parameter<double> const& solid_density; + /// Specific body forces applied to the solid. + /// It is usually used to apply gravitational forces. + /// A vector of displacement dimension's length. + Eigen::Matrix<double, DisplacementDim, 1> const specific_body_force; double dt = 0; double t = 0; }; -- GitLab