Skip to content
Snippets Groups Projects
Commit cb308002 authored by Florian Zill's avatar Florian Zill Committed by Dmitri Naumov
Browse files

[ML/F] add FluidType

used by HM, will be removed when usage of MPL is
implemented
parent e0747447
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ append_source_files(SOURCES Fluid/Density) ...@@ -10,6 +10,7 @@ append_source_files(SOURCES Fluid/Density)
append_source_files(SOURCES Fluid/Viscosity) append_source_files(SOURCES Fluid/Viscosity)
append_source_files(SOURCES Fluid/GibbsFreeEnergy) append_source_files(SOURCES Fluid/GibbsFreeEnergy)
append_source_files(SOURCES Fluid/FluidProperties) append_source_files(SOURCES Fluid/FluidProperties)
append_source_files(SOURCES Fluid/FluidType)
append_source_files(SOURCES Fluid/SpecificHeatCapacity) append_source_files(SOURCES Fluid/SpecificHeatCapacity)
append_source_files(SOURCES Fluid/ThermalConductivity) append_source_files(SOURCES Fluid/ThermalConductivity)
append_source_files(SOURCES Fluid/WaterVaporProperties) append_source_files(SOURCES Fluid/WaterVaporProperties)
......
/**
* \copyright
* Copyright (c) 2012-2019, 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 "FluidType.h"
#include "BaseLib/Error.h"
#include <math.h>
namespace FluidType
{
Fluid_Type strToFluidType(std::string const& s)
{
if (s == "incompressible_fluid")
return Fluid_Type::INCOMPRESSIBLE_FLUID;
if (s == "compressible_fluid")
return Fluid_Type::COMPRESSIBLE_FLUID;
if (s == "ideal_gas")
return Fluid_Type::IDEAL_GAS;
OGS_FATAL("This fluid type is unavailable. The available types are \n"
"incompressible_fluid, compressible_fluid and ideal_gas.\n");
}
bool checkRequiredParams(Fluid_Type const& f_type,
double const& /*fluid_compressibility*/ beta_p,
double const& /*reference_temperature*/ T_ref,
double const& /*specific_gas_constant*/ R_s)
{
return !((f_type == Fluid_Type::COMPRESSIBLE_FLUID && isnan(beta_p)) ||
(f_type == Fluid_Type::IDEAL_GAS &&
(isnan(T_ref) || isnan(R_s))));
}
const char* getErrorMsg(Fluid_Type const& f_type)
{
if (f_type == Fluid_Type::COMPRESSIBLE_FLUID)
{
return "The fluid type compressible_fluid requires the parameter\n"
"fluid_compressibility";
}
if (f_type == Fluid_Type::IDEAL_GAS)
{
return "The fluid type ideal_gas requires the parameters\n"
"reference_temperature and specific_gas_constant.";
}
return "The required parameters for this fluid type are missing.";
}
} // namespace FluidType
/**
* \copyright
* Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#pragma once
#include <string>
namespace FluidType
{
enum class Fluid_Type
{
INCOMPRESSIBLE_FLUID,
COMPRESSIBLE_FLUID,
IDEAL_GAS
};
Fluid_Type strToFluidType(std::string const& s);
bool checkRequiredParams(Fluid_Type const& f_type,
double const& /*fluid_compressibility*/ beta_p,
double const& /*reference_temperature*/ T_ref,
double const& /*specific_gas_constant*/ R_s);
const char* getErrorMsg(Fluid_Type const& f_type);
} // namespace FluidTypeLib
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