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
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
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
Mojtaba Abdolkhani
ogs
Commits
7d22cc5d
Commit
7d22cc5d
authored
8 years ago
by
wenqing
Browse files
Options
Downloads
Patches
Plain Diff
[FLTest] Modified the test for FluidProperties
parent
6561289e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/MaterialLib/TestFluidProperties.cpp
+26
-33
26 additions, 33 deletions
Tests/MaterialLib/TestFluidProperties.cpp
with
26 additions
and
33 deletions
Tests/MaterialLib/TestFluidProperties.cpp
+
26
−
33
View file @
7d22cc5d
/**
* \brief Test
Composite density viscosity model
s
* \brief Test
the creator of FluidPropertie
s
*
* \copyright
* Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org)
...
...
@@ -13,56 +13,49 @@
#include
<gtest/gtest.h>
#include
<memory>
#include
<cmath>
#include
<memory>
#include
"Tests/TestTools.h"
#include
"MaterialLib/Fluid/Density/createFluidDensityModel.h"
#include
"MaterialLib/Fluid/Viscosity/createViscosityModel.h"
#include
"BaseLib/ConfigTree.h"
#include
"MaterialLib/Fluid/FluidProperties/CreateFluidProperties.h"
#include
"MaterialLib/Fluid/FluidProperties/FluidProperties.h"
#include
"MaterialLib/Fluid/FluidProperties/PrimaryVariableDependentFluidProperties.h"
using
namespace
MaterialLib
;
using
namespace
MaterialLib
::
Fluid
;
using
ArrayType
=
MaterialLib
::
Fluid
::
FluidProperty
::
ArrayType
;
template
<
typename
F
>
std
::
unique_ptr
<
FluidProperty
>
createTestModel
(
const
char
xml
[],
F
func
,
const
std
::
string
&
key
)
std
::
unique_ptr
<
FluidProperties
>
createTestFluidProperties
(
const
char
xml
[])
{
auto
const
ptree
=
readXml
(
xml
);
BaseLib
::
ConfigTree
conf
(
ptree
,
""
,
BaseLib
::
ConfigTree
::
onerror
,
BaseLib
::
ConfigTree
::
onwarning
);
auto
const
&
sub_config
=
conf
.
getConfigSubtree
(
key
);
return
func
(
sub_config
);
auto
const
&
sub_config
=
conf
.
getConfigSubtree
(
"fluid"
);
return
createFluidProperties
(
sub_config
);
}
TEST
(
MaterialFluid
Model
,
checkCompositeDensityViscosityModel
)
TEST
(
MaterialFluid
Properties
,
checkPrimaryVariableDependentFluidProperties
)
{
const
char
xml_d
[]
=
"<density>"
" <type>TemperatureDependent</type>"
" <temperature0> 293.0 </temperature0> "
" <beta> 4.3e-4 </beta> "
" <rho0>1000.</rho0>"
"</density>"
;
auto
rho
=
createTestModel
(
xml_d
,
createFluidDensityModel
,
"density"
);
const
char
xml_v
[]
=
"<viscosity>"
" <type>TemperatureDependent</type>"
" <mu0>1.e-3 </mu0>"
" <tc>293.</tc>"
" <tv>368.</tv>"
"</viscosity>"
;
auto
mu
=
createTestModel
(
xml_v
,
createViscosityModel
,
"viscosity"
);
const
char
xml
[]
=
"<fluid>"
" <density>"
" <type>TemperatureDependent</type>"
" <temperature0> 293.0 </temperature0> "
" <beta> 4.3e-4 </beta> "
" <rho0>1000.</rho0>"
" </density>"
" <viscosity>"
" <type>TemperatureDependent</type>"
" <mu0>1.e-3 </mu0>"
" <tc>293.</tc>"
" <tv>368.</tv>"
" </viscosity>"
"</fluid>"
;
std
::
unique_ptr
<
FluidProperties
>
fluid_model
=
std
::
unique_ptr
<
FluidProperties
>
(
new
PrimaryVariableDependentFluidProperties
(
std
::
move
(
rho
),
std
::
move
(
mu
),
nullptr
,
nullptr
));
auto
const
fluid_model
=
createTestFluidProperties
(
xml
);
ArrayType
vars
;
vars
[
0
]
=
350.0
;
...
...
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