Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wenqing
ogs
Commits
e6f8c1d5
Commit
e6f8c1d5
authored
5 years ago
by
Norbert Grunwald
Browse files
Options
Downloads
Patches
Plain Diff
added a Test for MPL IdealGasLaw property
parent
2b60cae7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/MaterialLib/TestMPLIdealGasLaw.cpp
+118
-0
118 additions, 0 deletions
Tests/MaterialLib/TestMPLIdealGasLaw.cpp
with
118 additions
and
0 deletions
Tests/MaterialLib/TestMPLIdealGasLaw.cpp
0 → 100644
+
118
−
0
View file @
e6f8c1d5
/**
* \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
*
*/
#include
<gtest/gtest.h>
#include
<sstream>
#include
"TestMPL.h"
#include
"Tests/TestTools.h"
#include
"MaterialLib/MPL/Medium.h"
#include
"MaterialLib/MPL/Properties/IdealGasLaw.h"
#include
"MaterialLib/PhysicalConstant.h"
TEST
(
MaterialPropertyLib
,
IdealGasLawOfPurePhase
)
{
const
double
pressure_norm
=
101325.0
;
// Pa
const
double
temperature_norm
=
273.15
;
// K
const
double
molar_mass_air
=
0.02905
;
// kg/mol
const
auto
R
=
MaterialLib
::
PhysicalConstant
::
IdealGasConstant
;
const
double
density_norm_air
=
pressure_norm
*
molar_mass_air
/
R
/
temperature_norm
;
const
double
d_rho_dT_air
=
-
density_norm_air
/
temperature_norm
;
const
double
d_rho_dp_air
=
density_norm_air
/
pressure_norm
;
const
double
d_rho2_dp2_air
=
0.
;
const
double
d_rho2_dT2_air
=
2.
*
density_norm_air
/
temperature_norm
/
temperature_norm
;
const
double
d_rho2_dTdp_air
=
-
density_norm_air
/
temperature_norm
/
pressure_norm
;
std
::
stringstream
m
;
m
<<
"<medium>
\n
"
;
m
<<
"<phases><phase>
\n
"
;
m
<<
" <type>Gas</type>
\n
"
;
m
<<
" <properties>
\n
"
;
m
<<
" <property>
\n
"
;
m
<<
" <name>density</name>
\n
"
;
m
<<
" <type>IdealGaslaw</type>
\n
"
;
m
<<
" </property>
\n
"
;
m
<<
" <property>
\n
"
;
m
<<
" <name>molar_mass</name>
\n
"
;
m
<<
" <type>Constant</type>
\n
"
;
m
<<
" <value>"
<<
molar_mass_air
<<
"</value>
\n
"
;
m
<<
" </property>
\n
"
;
m
<<
" </properties>
\n
"
;
m
<<
"</phase></phases>
\n
"
;
m
<<
"<properties></properties>
\n
"
;
m
<<
"</medium>
\n
"
;
auto
const
&
medium
=
createTestMaterial
(
m
.
str
());
auto
const
&
gas_phase
=
medium
->
phase
(
"Gas"
);
MaterialPropertyLib
::
VariableArray
variable_array
;
variable_array
[
static_cast
<
int
>
(
MaterialPropertyLib
::
Variable
::
phase_pressure
)]
=
pressure_norm
;
variable_array
[
static_cast
<
int
>
(
MaterialPropertyLib
::
Variable
::
temperature
)]
=
temperature_norm
;
ParameterLib
::
SpatialPosition
const
pos
;
double
const
time
=
std
::
numeric_limits
<
double
>::
quiet_NaN
();
auto
const
density
=
gas_phase
.
property
(
MaterialPropertyLib
::
PropertyType
::
density
)
.
template
value
<
double
>(
variable_array
,
pos
,
time
);
auto
const
d_rho_dT
=
gas_phase
.
property
(
MaterialPropertyLib
::
PropertyType
::
density
)
.
template
dValue
<
double
>(
variable_array
,
MaterialPropertyLib
::
Variable
::
temperature
,
pos
,
time
);
auto
const
d_rho_dp
=
gas_phase
.
property
(
MaterialPropertyLib
::
PropertyType
::
density
)
.
template
dValue
<
double
>(
variable_array
,
MaterialPropertyLib
::
Variable
::
phase_pressure
,
pos
,
time
);
auto
const
d_rho2_dp2
=
gas_phase
.
property
(
MaterialPropertyLib
::
PropertyType
::
density
)
.
template
d2Value
<
double
>(
variable_array
,
MaterialPropertyLib
::
Variable
::
phase_pressure
,
MaterialPropertyLib
::
Variable
::
phase_pressure
,
pos
,
time
);
auto
const
d_rho2_dT2
=
gas_phase
.
property
(
MaterialPropertyLib
::
PropertyType
::
density
)
.
template
d2Value
<
double
>(
variable_array
,
MaterialPropertyLib
::
Variable
::
temperature
,
MaterialPropertyLib
::
Variable
::
temperature
,
pos
,
time
);
auto
const
d_rho2_dTdp
=
gas_phase
.
property
(
MaterialPropertyLib
::
PropertyType
::
density
)
.
template
d2Value
<
double
>(
variable_array
,
MaterialPropertyLib
::
Variable
::
temperature
,
MaterialPropertyLib
::
Variable
::
phase_pressure
,
pos
,
time
);
auto
const
d_rho2_dpdT
=
gas_phase
.
property
(
MaterialPropertyLib
::
PropertyType
::
density
)
.
template
d2Value
<
double
>(
variable_array
,
MaterialPropertyLib
::
Variable
::
phase_pressure
,
MaterialPropertyLib
::
Variable
::
temperature
,
pos
,
time
);
ASSERT_NEAR
(
density_norm_air
,
density
,
1.e-10
);
ASSERT_NEAR
(
d_rho_dT_air
,
d_rho_dT
,
1.e-10
);
ASSERT_NEAR
(
d_rho_dp_air
,
d_rho_dp
,
1.e-10
);
ASSERT_NEAR
(
d_rho2_dp2_air
,
d_rho2_dp2
,
1.e-10
);
ASSERT_NEAR
(
d_rho2_dT2_air
,
d_rho2_dT2
,
1.e-10
);
ASSERT_NEAR
(
d_rho2_dTdp_air
,
d_rho2_dTdp
,
1.e-10
);
ASSERT_EQ
(
d_rho2_dTdp
,
d_rho2_dpdT
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment