/** * \file * \copyright * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org) * Distributed under a Modified BSD License. * See accompanying file LICENSE.txt or * http://www.opengeosys.org/project/license * */ #include "CreateSmallDeformationProcess.h" #include #include "MaterialLib/SolidModels/CreateConstitutiveRelation.h" #include "ParameterLib/Utils.h" #include "ProcessLib/Output/CreateSecondaryVariables.h" #include "ProcessLib/Utils/ProcessUtils.h" #include "SmallDeformationProcess.h" #include "SmallDeformationProcessData.h" namespace ProcessLib { namespace SmallDeformation { template std::unique_ptr createSmallDeformationProcess( std::string name, MeshLib::Mesh& mesh, std::unique_ptr&& jacobian_assembler, std::vector const& variables, std::vector> const& parameters, std::optional const& local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const& config) { //! \ogs_file_param{prj__processes__process__type} config.checkConfigParameter("type", "SMALL_DEFORMATION"); DBUG("Create SmallDeformationProcess."); // Process variable. //! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION__process_variables} auto const pv_config = config.getConfigSubtree("process_variables"); auto per_process_variables = findProcessVariables( variables, pv_config, {//! \ogs_file_param_special{prj__processes__process__SMALL_DEFORMATION__process_variables__process_variable} "process_variable"}); DBUG("Associate displacement with process variable '{:s}'.", per_process_variables.back().get().getName()); if (per_process_variables.back().get().getNumberOfGlobalComponents() != DisplacementDim) { OGS_FATAL( "Number of components of the process variable '{:s}' is different " "from the displacement dimension: got {:d}, expected {:d}", per_process_variables.back().get().getName(), per_process_variables.back().get().getNumberOfGlobalComponents(), DisplacementDim); } std::vector>> process_variables; process_variables.push_back(std::move(per_process_variables)); auto solid_constitutive_relations = MaterialLib::Solids::createConstitutiveRelations( parameters, local_coordinate_system, config); // Solid density auto const& solid_density = ParameterLib::findParameter( config, //! \ogs_file_param_special{prj__processes__process__SMALL_DEFORMATION__solid_density} "solid_density", parameters, 1, &mesh); DBUG("Use '{:s}' as solid density parameter.", solid_density.name); // Specific body force Eigen::Matrix specific_body_force; { std::vector const b = //! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION__specific_body_force} config.getConfigParameter>( "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()); } // Reference temperature const auto& reference_temperature = //! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION__reference_temperature} config.getConfigParameter( "reference_temperature", std::numeric_limits::quiet_NaN()); // Initial stress conditions auto const initial_stress = ParameterLib::findOptionalTagParameter( //! \ogs_file_param_special{prj__processes__process__SMALL_DEFORMATION__initial_stress} config, "initial_stress", parameters, // Symmetric tensor size, 4 or 6, not a Kelvin vector. MathLib::KelvinVector::kelvin_vector_dimensions(DisplacementDim), &mesh); SmallDeformationProcessData process_data{ materialIDs(mesh), std::move(solid_constitutive_relations), initial_stress, solid_density, specific_body_force, reference_temperature}; SecondaryVariableCollection secondary_variables; ProcessLib::createSecondaryVariables(config, secondary_variables); return std::make_unique>( std::move(name), mesh, std::move(jacobian_assembler), parameters, integration_order, std::move(process_variables), std::move(process_data), std::move(secondary_variables)); } template std::unique_ptr createSmallDeformationProcess<2>( std::string name, MeshLib::Mesh& mesh, std::unique_ptr&& jacobian_assembler, std::vector const& variables, std::vector> const& parameters, std::optional const& local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const& config); template std::unique_ptr createSmallDeformationProcess<3>( std::string name, MeshLib::Mesh& mesh, std::unique_ptr&& jacobian_assembler, std::vector const& variables, std::vector> const& parameters, std::optional const& local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const& config); } // namespace SmallDeformation } // namespace ProcessLib