-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MPL] Added a new function to get fluid thermal expansity
- Loading branch information
Showing
3 changed files
with
92 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* \file | ||
* | ||
* \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 | ||
* | ||
* | ||
* Created on August 16, 2019, 3:40 PM | ||
*/ | ||
|
||
#include "GetThermalExpansivity.h" | ||
|
||
#include "MaterialLib/MPL/Phase.h" | ||
|
||
namespace MaterialPropertyLib | ||
{ | ||
class Phase; | ||
|
||
double getThermalExpansivity(Phase const& phase, | ||
VariableArray const& vars, | ||
const double density) | ||
{ | ||
auto const thermal_expansivity_ptr = | ||
&phase.property(MaterialPropertyLib::PropertyType::thermal_expansivity); | ||
|
||
// The thermal expansivity is explicitly given in the project file. | ||
if (thermal_expansivity_ptr) | ||
{ | ||
return (*thermal_expansivity_ptr).template value<double>(vars); | ||
} | ||
|
||
// The thermal expansivity calculated by the density model directly. | ||
return (density == 0.0) | ||
? 0.0 | ||
: -phase.property(MaterialPropertyLib::PropertyType::density) | ||
.template dValue<double>( | ||
vars, MaterialPropertyLib::Variable::temperature) / | ||
density; | ||
} | ||
} // namespace MaterialPropertyLib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* \file | ||
* | ||
* \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 | ||
* | ||
* | ||
* Created on August 16, 2019, 3:40 PM | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "MaterialLib/MPL/VariableType.h" // for VariableArray | ||
|
||
namespace MaterialPropertyLib | ||
{ | ||
class Phase; | ||
|
||
/** | ||
* It gets the thermal expansion coefficient. | ||
* | ||
* If the the thermal expansion coefficient is given in the project file via | ||
* the media property of thermal_expansivity, e.g | ||
* \verbatim | ||
* <property> | ||
* <name>thermal_expansivity</name> | ||
* <type>Constant</type> | ||
* <value>2.07e-4</value> | ||
* </property> | ||
* \endverbatim | ||
* it returns the value of the given property. Otherwise it returns the value | ||
* computed from the density model by the following formula | ||
* \f[ | ||
* (\frac{\partial \rho}{\partial T})/\rho | ||
* \f] | ||
* where \f$\rho\f$ is the density, \f$T\f$ is the temperature. | ||
*/ | ||
double getThermalExpansivity(Phase const& phase, | ||
VariableArray const& vars, | ||
const double density); | ||
} // namespace MaterialPropertyLib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters