Skip to content
Snippets Groups Projects
Commit 6561289e authored by wenqing's avatar wenqing
Browse files

[FL] Added a function to create FluidProperties

parent 9190d70d
No related branches found
No related tags found
No related merge requests found
/**
* \copyright
* Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
* \file CreateFluidProperties.cpp
*
* Created on December 13, 2016, 3:32 PM
*/
#include "CreateFluidProperties.h"
#include <string>
#include "BaseLib/ConfigTree.h"
#include "FluidProperties.h"
#include "PrimaryVariableDependentFluidProperties.h"
#include "FluidPropertiesWithDensityDependentModels.h"
#include "MaterialLib/Fluid/FluidPropertyHeaders.h"
#include "MaterialLib/Fluid/SpecificHeatCapacity/CreateSpecificFluidHeatCapacityModel.h"
#include "MaterialLib/Fluid/ThermalConductivity/CreateFluidThermalConductivityModel.h"
namespace MaterialLib
{
namespace Fluid
{
std::unique_ptr<FluidProperties> createFluidProperties(
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{material__fluid__density}
auto const& rho_conf = config.getConfigSubtree("density");
auto liquid_density = MaterialLib::Fluid::createFluidDensityModel(rho_conf);
//! \ogs_file_param{material__fluid__viscosity}
auto const& mu_conf = config.getConfigSubtree("viscosity");
auto viscosity = MaterialLib::Fluid::createViscosityModel(mu_conf);
const bool is_mu_density_dependent =
(viscosity->getName().find("density dependent") != std::string::npos)
? true
: false;
bool is_cp_density_dependent = false;
std::unique_ptr<MaterialLib::Fluid::FluidProperty> specific_heat_capacity =
nullptr;
auto heat_capacity__opt_conf =
//! \ogs_file_param{material__fluid__specific_heat_capacity}
config.getConfigSubtreeOptional("specific_heat_capacity");
if (heat_capacity__opt_conf)
{
const auto& heat_capacity_conf = *heat_capacity__opt_conf;
specific_heat_capacity =
createSpecificFluidHeatCapacityModel(heat_capacity_conf);
is_cp_density_dependent =
(specific_heat_capacity->getName().find("density dependent") !=
std::string::npos)
? true
: false;
}
bool is_KT_density_dependent = false;
std::unique_ptr<MaterialLib::Fluid::FluidProperty> thermal_conductivity =
nullptr;
auto const& thermal_conductivity_opt_conf =
//! \ogs_file_param{material__fluid__thermal_conductivity}
config.getConfigSubtreeOptional("thermal_conductivity");
if (thermal_conductivity_opt_conf)
{
auto& thermal_conductivity_conf = *thermal_conductivity_opt_conf;
thermal_conductivity =
MaterialLib::Fluid::createFluidThermalConductivityModel(
thermal_conductivity_conf);
is_KT_density_dependent =
(specific_heat_capacity->getName().find("density dependent") !=
std::string::npos)
? true
: false;
}
if (is_mu_density_dependent || is_cp_density_dependent ||
is_KT_density_dependent)
return std::unique_ptr<MaterialLib::Fluid::FluidProperties>(
new MaterialLib::Fluid::FluidPropertiesWithDensityDependentModels(
std::move(liquid_density), std::move(viscosity),
std::move(specific_heat_capacity),
std::move(thermal_conductivity), is_mu_density_dependent,
is_cp_density_dependent, is_KT_density_dependent));
else
return std::unique_ptr<MaterialLib::Fluid::FluidProperties>(
new MaterialLib::Fluid::PrimaryVariableDependentFluidProperties(
std::move(liquid_density), std::move(viscosity),
std::move(specific_heat_capacity),
std::move(thermal_conductivity)));
}
} // end namespace
} // end namespace
/**
* \copyright
* Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
* \file CreateFluidProperties.h
*
* Created on December 13, 2016, 3:32 PM
*/
#ifndef OGS_CREATE_FLUID_PROPERTIES_H
#define OGS_CREATE_FLUID_PROPERTIES_H
#include <memory>
namespace BaseLib
{
class ConfigTree;
}
namespace MaterialLib
{
namespace Fluid
{
class FluidProperties;
/// Create an instance of class FluidProperties
/// \param config ConfigTree object has tags of `<fluid>`
std::unique_ptr<FluidProperties> createFluidProperties(
BaseLib::ConfigTree const& config);
} // end namespace
} // end namespace
#endif /* OGS_CREATE_FLUID_PROPERTIES_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment