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
Chaofan Chen
ogs
Commits
f66cc0c3
Commit
f66cc0c3
authored
1 year ago
by
joergbuchwald
Browse files
Options
Downloads
Patches
Plain Diff
add test for DeVries vapour diffusion
parent
518dea61
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/TestMPLVapourDiffusionDeVries.cpp
+139
-0
139 additions, 0 deletions
Tests/MaterialLib/TestMPLVapourDiffusionDeVries.cpp
with
139 additions
and
0 deletions
Tests/MaterialLib/TestMPLVapourDiffusionDeVries.cpp
0 → 100644
+
139
−
0
View file @
f66cc0c3
/**
* \file
* \copyright
* Copyright (c) 2012-2024, 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 March 4, 2021, 5:23 PM
*/
#include
<gtest/gtest.h>
#include
<array>
#include
<cmath>
#include
<limits>
#include
"MaterialLib/MPL/Properties/VapourDiffusion/CreateVapourDiffusionDeVries.h"
#include
"TestMPL.h"
TEST
(
MaterialPropertyLib
,
VapourDiffusionDeVries
)
{
char
const
xml
[]
=
"<property>"
" <name>vapour_diffusion</name>"
" <type>VapourDiffusionDeVries</type>"
" <base_diffusion_coefficient>2.16e-5</base_diffusion_coefficient>"
" <exponent>1.8</exponent>"
"</property>"
;
std
::
unique_ptr
<
MaterialPropertyLib
::
Property
>
const
property_ptr
=
Tests
::
createTestProperty
(
xml
,
MaterialPropertyLib
::
createVapourDiffusionDeVries
);
MaterialPropertyLib
::
Property
const
&
property
=
*
property_ptr
;
double
const
T
=
290.0
;
double
const
pG
=
1.0e5
;
double
const
S
=
0.3
;
MaterialPropertyLib
::
VariableArray
variable_array
;
ParameterLib
::
SpatialPosition
const
pos
;
double
const
t
=
std
::
numeric_limits
<
double
>::
quiet_NaN
();
double
const
dt
=
std
::
numeric_limits
<
double
>::
quiet_NaN
();
variable_array
.
temperature
=
T
;
variable_array
.
gas_phase_pressure
=
pG
;
variable_array
.
liquid_saturation
=
S
;
// The derivative of the water vapour with respect of saturation, which is
// zero.
double
const
S_0
=
-
0.1
;
double
const
S_max
=
1.1
;
int
n_steps
=
10
;
for
(
int
i
=
0
;
i
<=
n_steps
;
++
i
)
{
double
const
S_i
=
S_0
+
i
*
(
S_max
-
S_0
)
/
n_steps
;
variable_array
.
liquid_saturation
=
S_i
;
double
const
dD_v
=
property
.
template
dValue
<
double
>(
variable_array
,
MPL
::
Variable
::
liquid_saturation
,
pos
,
t
,
dt
);
double
const
eps
=
1e-8
;
variable_array
.
liquid_saturation
=
S_i
-
eps
;
double
const
D_v_minus
=
property
.
template
value
<
double
>(
variable_array
,
pos
,
t
,
dt
);
variable_array
.
liquid_saturation
=
S_i
+
eps
;
double
const
D_v_plus
=
property
.
template
value
<
double
>(
variable_array
,
pos
,
t
,
dt
);
double
const
DD_v
=
(
D_v_plus
-
D_v_minus
)
/
2
/
eps
;
ASSERT_LE
(
std
::
fabs
(
dD_v
-
DD_v
),
0.0
)
<<
"for expected derivative of water vapour diffusion with "
"respect to saturation "
<<
DD_v
<<
" and for computed derivative of water vapour diffusion "
"with respect to saturation."
<<
dD_v
;
}
// The derivative of the water vapour with respect of temperature
double
const
T_0
=
273.15
;
double
const
T_max
=
500
;
n_steps
=
1000
;
for
(
int
i
=
0
;
i
<=
n_steps
;
++
i
)
{
double
const
T_i
=
T_0
+
i
*
(
T_max
-
S_0
)
/
n_steps
;
variable_array
.
temperature
=
T_i
;
double
const
dD_v
=
property
.
template
dValue
<
double
>(
variable_array
,
MPL
::
Variable
::
temperature
,
pos
,
t
,
dt
);
double
const
eps
=
1e-8
;
variable_array
.
temperature
=
T_i
-
eps
;
double
const
D_v_minus
=
property
.
template
value
<
double
>(
variable_array
,
pos
,
t
,
dt
);
variable_array
.
temperature
=
T_i
+
eps
;
double
const
D_v_plus
=
property
.
template
value
<
double
>(
variable_array
,
pos
,
t
,
dt
);
double
const
DD_v
=
(
D_v_plus
-
D_v_minus
)
/
2
/
eps
;
ASSERT_LE
(
std
::
fabs
(
dD_v
-
DD_v
),
1e-9
)
<<
"for expected derivative of water vapour diffusion with "
"respect to temperature "
<<
DD_v
<<
" and for computed derivative of water vapour diffusion "
"with respect to temperature."
<<
dD_v
;
}
// The derivative of the water vapour with respect of gas pressure
double
const
pG_0
=
1.0
;
double
const
pG_max
=
1.0e7
;
n_steps
=
10000
;
for
(
int
i
=
0
;
i
<=
n_steps
;
++
i
)
{
double
const
pG_i
=
pG_0
+
i
*
(
pG_max
-
pG_0
)
/
n_steps
;
variable_array
.
gas_phase_pressure
=
pG_i
;
double
const
dD_v
=
property
.
template
dValue
<
double
>(
variable_array
,
MPL
::
Variable
::
gas_phase_pressure
,
pos
,
t
,
dt
);
double
const
eps
=
1e-8
;
variable_array
.
gas_phase_pressure
=
pG_i
-
eps
;
double
const
D_v_minus
=
property
.
template
value
<
double
>(
variable_array
,
pos
,
t
,
dt
);
variable_array
.
gas_phase_pressure
=
pG_i
+
eps
;
double
const
D_v_plus
=
property
.
template
value
<
double
>(
variable_array
,
pos
,
t
,
dt
);
double
const
DD_v
=
(
D_v_plus
-
D_v_minus
)
/
2
/
eps
;
ASSERT_LE
(
std
::
fabs
(
dD_v
-
DD_v
),
5e-9
)
<<
"for expected derivative of water vapour diffusion with "
"respect to gas pressure "
<<
DD_v
<<
" and for computed derivative of water vapour diffusion "
"with respect to gas pressure."
<<
dD_v
;
}
}
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