Skip to content

Commit

Permalink
[PL] Use FluidProperties/createFluidProperties.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomFischer committed Apr 24, 2017
1 parent 6cd41b0 commit c0bfb08
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
16 changes: 11 additions & 5 deletions ProcessLib/ComponentTransport/ComponentTransportFEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@


#include "ComponentTransportProcessData.h"
#include "MaterialLib/Fluid/FluidProperties/FluidProperties.h"
#include "MathLib/LinAlg/Eigen/EigenMapTools.h"
#include "NumLib/Extrapolation/ExtrapolatableElement.h"
#include "NumLib/Fem/FiniteElement/TemplateIsoparametric.h"
Expand Down Expand Up @@ -201,15 +202,17 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface
MaterialLib::Fluid::PropertyVariableType::C)] = C_int_pt;
vars[static_cast<int>(
MaterialLib::Fluid::PropertyVariableType::p)] = p_int_pt;
auto const density_water =
_process_data.fluid_density->getValue(vars);
auto const density_water = _process_data.fluid_properties->getValue(
MaterialLib::Fluid::FluidPropertyType::Density, vars);
auto const& decay_rate = _process_data.decay_rate(t, pos)[0];
auto const& molecular_diffusion_coefficient =
_process_data.molecular_diffusion_coefficient(t, pos)[0];

// Use the viscosity model to compute the viscosity
auto const viscosity =
_process_data.viscosity_model->getValue(vars);
_process_data.fluid_properties->getValue(
MaterialLib::Fluid::FluidPropertyType::Viscosity, vars);

GlobalDimMatrixType const perm_over_visc =
intrinsic_permeability / viscosity;

Expand Down Expand Up @@ -268,7 +271,9 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface
pos);
MaterialLib::Fluid::FluidProperty::ArrayType vars;

auto const mu = _process_data.viscosity_model->getValue(vars);
auto const mu = //_process_data.viscosity_model->getValue(vars);
_process_data.fluid_properties->getValue(
MaterialLib::Fluid::FluidPropertyType::Viscosity, vars);
GlobalDimMatrixType const K_over_mu = K / mu;

unsigned const n_integration_points =
Expand All @@ -295,7 +300,8 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface
vars[static_cast<int>(
MaterialLib::Fluid::PropertyVariableType::p)] = p_int_pt;

auto const rho_w = _process_data.fluid_density->getValue(vars);
auto const rho_w = _process_data.fluid_properties->getValue(
MaterialLib::Fluid::FluidPropertyType::Density, vars);
auto const b = _process_data.specific_body_force;
// here it is assumed that the vector b is directed 'downwards'
velocity += K_over_mu * rho_w * b;
Expand Down
15 changes: 6 additions & 9 deletions ProcessLib/ComponentTransport/ComponentTransportProcessData.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <memory>

#include "MaterialLib/Fluid/FluidProperty.h"
#include "MaterialLib/Fluid/FluidProperties/FluidProperties.h"
#include "MaterialLib/PorousMedium/Porosity/Porosity.h"
#include "MaterialLib/PorousMedium/Storage/Storage.h"

Expand All @@ -33,9 +33,9 @@ struct ComponentTransportProcessData
{
ComponentTransportProcessData(
PorousMediaProperties&& porous_media_properties_,
std::unique_ptr<MaterialLib::Fluid::FluidProperty>&& viscosity_model_,
ProcessLib::Parameter<double> const& fluid_reference_density_,
std::unique_ptr<MaterialLib::Fluid::FluidProperty>&& fluid_density_,
std::unique_ptr<MaterialLib::Fluid::FluidProperties>&&
fluid_properties_,
ProcessLib::Parameter<double> const& molecular_diffusion_coefficient_,
ProcessLib::Parameter<double> const& solute_dispersivity_longitudinal_,
ProcessLib::Parameter<double> const& solute_dispersivity_transverse_,
Expand All @@ -44,9 +44,8 @@ struct ComponentTransportProcessData
Eigen::VectorXd const& specific_body_force_,
bool const has_gravity_)
: porous_media_properties(std::move(porous_media_properties_)),
viscosity_model(std::move(viscosity_model_)),
fluid_reference_density(fluid_reference_density_),
fluid_density(std::move(fluid_density_)),
fluid_properties(std::move(fluid_properties_)),
molecular_diffusion_coefficient(molecular_diffusion_coefficient_),
solute_dispersivity_longitudinal(solute_dispersivity_longitudinal_),
solute_dispersivity_transverse(solute_dispersivity_transverse_),
Expand All @@ -59,9 +58,8 @@ struct ComponentTransportProcessData

ComponentTransportProcessData(ComponentTransportProcessData&& other)
: porous_media_properties(std::move(other.porous_media_properties)),
viscosity_model(other.viscosity_model.release()),
fluid_reference_density(other.fluid_reference_density),
fluid_density(other.fluid_density.release()),
fluid_properties(other.fluid_properties.release()),
molecular_diffusion_coefficient(
other.molecular_diffusion_coefficient),
solute_dispersivity_longitudinal(
Expand All @@ -85,9 +83,8 @@ struct ComponentTransportProcessData
void operator=(ComponentTransportProcessData&&) = delete;

PorousMediaProperties porous_media_properties;
std::unique_ptr<MaterialLib::Fluid::FluidProperty> viscosity_model;
Parameter<double> const& fluid_reference_density;
std::unique_ptr<MaterialLib::Fluid::FluidProperty> fluid_density;
std::unique_ptr<MaterialLib::Fluid::FluidProperties> fluid_properties;
Parameter<double> const& molecular_diffusion_coefficient;
Parameter<double> const& solute_dispersivity_longitudinal;
Parameter<double> const& solute_dispersivity_transverse;
Expand Down
27 changes: 9 additions & 18 deletions ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#include "CreateComponentTransportProcess.h"

#include "MaterialLib/Fluid/Density/CreateFluidDensityModel.h"
#include "MaterialLib/Fluid/Viscosity/CreateViscosityModel.h"
#include "MaterialLib/Fluid/FluidProperties/CreateFluidProperties.h"

#include "ProcessLib/Parameter/ConstantParameter.h"
#include "ProcessLib/Utils/ParseSecondaryVariables.h"
Expand Down Expand Up @@ -58,15 +57,9 @@ std::unique_ptr<Process> createComponentTransportProcess(

//! \ogs_file_param{prj__processes__process__ComponentTransport__fluid}
auto const& fluid_config = config.getConfigSubtree("fluid");
//! \ogs_file_param{prj__processes__process__ComponentTransport__fluid__viscosity}
auto const& viscosity_conf = fluid_config.getConfigSubtree("viscosity");
auto viscosity_model =
MaterialLib::Fluid::createViscosityModel(viscosity_conf);

//! \ogs_file_param{prj__processes__process__ComponentTransport__fluid__density}
auto const& fluid_density_conf = fluid_config.getConfigSubtree("density");
auto fluid_density =
MaterialLib::Fluid::createFluidDensityModel(fluid_density_conf);
auto fluid_properties =
MaterialLib::Fluid::createFluidProperties(fluid_config);

// Parameter for the density of the fluid.
auto& fluid_reference_density= findParameter<double>(
Expand All @@ -79,26 +72,23 @@ std::unique_ptr<Process> createComponentTransportProcess(
// Parameter for the longitudinal solute dispersivity.
auto const& molecular_diffusion_coefficient = findParameter<double>(
config,
//!
//\ogs_file_param_special{prj__processes__process__ComponentTransport__molecular_diffusion_coefficient
//! \ogs_file_param_special{prj__processes__process__ComponentTransport__molecular_diffusion_coefficient
"molecular_diffusion_coefficient", parameters, 1);
DBUG("Use \'%s\' as molecular diffusion coefficient parameter.",
molecular_diffusion_coefficient.name.c_str());

// Parameter for the longitudinal solute dispersivity.
auto const& solute_dispersivity_longitudinal = findParameter<double>(
config,
//!
//\ogs_file_param_special{prj__processes__process__ComponentTransport__solute_dispersivity_longitudinal
//! \ogs_file_param_special{prj__processes__process__ComponentTransport__solute_dispersivity_longitudinal
"solute_dispersivity_longitudinal", parameters, 1);
DBUG("Use \'%s\' as longitudinal solute dispersivity parameter.",
solute_dispersivity_longitudinal.name.c_str());

// Parameter for the transverse solute dispersivity.
auto const& solute_dispersivity_transverse = findParameter<double>(
config,
//!
//\ogs_file_param_special{prj__processes__process__ComponentTransport__solute_dispersivity_transverse
//! \ogs_file_param_special{prj__processes__process__ComponentTransport__solute_dispersivity_transverse
"solute_dispersivity_transverse", parameters, 1);
DBUG("Use \'%s\' as transverse solute dispersivity parameter.",
solute_dispersivity_transverse.name.c_str());
Expand Down Expand Up @@ -135,9 +125,10 @@ std::unique_ptr<Process> createComponentTransportProcess(

ComponentTransportProcessData process_data{
std::move(porous_media_properties),
std::move(viscosity_model),
// std::move(viscosity_model),
fluid_reference_density,
std::move(fluid_density),
// std::move(fluid_density),
std::move(fluid_properties),
molecular_diffusion_coefficient,
solute_dispersivity_longitudinal,
solute_dispersivity_transverse,
Expand Down

0 comments on commit c0bfb08

Please sign in to comment.