/** * \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 "CreateSteadyStateDiffusion.h" #include "BaseLib/FileTools.h" #include "MaterialLib/MPL/CheckMaterialSpatialDistributionMap.h" #include "MaterialLib/MPL/CreateMaterialSpatialDistributionMap.h" #include "MaterialLib/MPL/MaterialSpatialDistributionMap.h" #include "MeshLib/IO/readMeshFromFile.h" #include "ParameterLib/Utils.h" #include "ProcessLib/Output/CreateSecondaryVariables.h" #include "ProcessLib/Utils/ProcessUtils.h" #include "SteadyStateDiffusion.h" #include "SteadyStateDiffusionData.h" namespace ProcessLib { namespace SteadyStateDiffusion { void checkMPLProperties( MeshLib::Mesh const& mesh, MaterialPropertyLib::MaterialSpatialDistributionMap const& media_map) { std::array const required_medium_properties = { MaterialPropertyLib::PropertyType::reference_temperature, MaterialPropertyLib::PropertyType::diffusion}; std::array const empty{}; MaterialPropertyLib::checkMaterialSpatialDistributionMap( mesh, media_map, required_medium_properties, empty, empty); } std::unique_ptr createSteadyStateDiffusion( std::string name, MeshLib::Mesh& mesh, std::unique_ptr&& jacobian_assembler, std::vector const& variables, std::vector> const& parameters, unsigned const integration_order, BaseLib::ConfigTree const& config, std::vector> const& meshes, std::map> const& media) { //! \ogs_file_param{prj__processes__process__type} config.checkConfigParameter("type", "STEADY_STATE_DIFFUSION"); DBUG("Create SteadyStateDiffusion."); /// \section processvariablesssd Process Variables //! \ogs_file_param{prj__processes__process__STEADY_STATE_DIFFUSION__process_variables} auto const pv_config = config.getConfigSubtree("process_variables"); std::vector>> process_variables; /// Primary process variables as they appear in the global component vector: auto per_process_variables = findProcessVariables( variables, pv_config, {//! \ogs_file_param_special{prj__processes__process__STEADY_STATE_DIFFUSION__process_variables__process_variable} "process_variable"}); process_variables.push_back(std::move(per_process_variables)); auto media_map = MaterialPropertyLib::createMaterialSpatialDistributionMap(media, mesh); DBUG("Check the media properties of steady state diffusion process ..."); checkMPLProperties(mesh, *media_map); DBUG("Media properties verified."); SteadyStateDiffusionData process_data{std::move(media_map)}; SecondaryVariableCollection secondary_variables; ProcessLib::createSecondaryVariables(config, secondary_variables); /// \section parametersssd Process Parameters std::unique_ptr surfaceflux; auto calculatesurfaceflux_config = //! \ogs_file_param{prj__processes__process__calculatesurfaceflux} config.getConfigSubtreeOptional("calculatesurfaceflux"); if (calculatesurfaceflux_config) { surfaceflux = ProcessLib::SurfaceFluxData::createSurfaceFluxData( *calculatesurfaceflux_config, meshes); } 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), std::move(surfaceflux)); } } // namespace SteadyStateDiffusion } // namespace ProcessLib