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
Özgür Ozan Sen
ogs
Commits
931fc44e
Commit
931fc44e
authored
1 month ago
by
wenqing
Browse files
Options
Downloads
Patches
Plain Diff
[MPL] New h/cpp files in MPL/Utils containing
getFluidDensity and getFluidDensityAndViscosity for single phase flow models.
parent
1d6959fb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MaterialLib/MPL/Utils/GetFluidDensityAndViscosity.cpp
+59
-0
59 additions, 0 deletions
MaterialLib/MPL/Utils/GetFluidDensityAndViscosity.cpp
MaterialLib/MPL/Utils/GetFluidDensityAndViscosity.h
+34
-0
34 additions, 0 deletions
MaterialLib/MPL/Utils/GetFluidDensityAndViscosity.h
with
93 additions
and
0 deletions
MaterialLib/MPL/Utils/GetFluidDensityAndViscosity.cpp
0 → 100644
+
59
−
0
View file @
931fc44e
/**
* \file
* \copyright
* Copyright (c) 2012-2025, 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 January 21, 2025, 4:10 PM
*/
#include
"GetFluidDensityAndViscosity.h"
#include
"MaterialLib/MPL/Phase.h"
#include
"MaterialLib/MPL/VariableType.h"
#include
"ParameterLib/SpatialPosition.h"
namespace
MaterialPropertyLib
{
double
getFluidDensity
(
double
const
t
,
double
const
dt
,
ParameterLib
::
SpatialPosition
const
&
pos
,
Phase
const
&
fluid_phase
,
VariableArray
&
vars
)
{
// Compute density:
// Quick workaround: If fluid density is described as ideal gas, then
// the molar mass must be passed to the MPL::IdealGasLaw via the
// variable_array and the fluid must have the property
// MPL::PropertyType::molar_mass. For other density models (e.g.
// Constant), it is not mandatory to specify the molar mass.
if
(
fluid_phase
.
hasProperty
(
MaterialPropertyLib
::
PropertyType
::
molar_mass
))
{
vars
.
molar_mass
=
fluid_phase
.
property
(
MaterialPropertyLib
::
PropertyType
::
molar_mass
)
.
template
value
<
double
>(
vars
,
pos
,
t
,
dt
);
}
return
fluid_phase
[
MaterialPropertyLib
::
PropertyType
::
density
]
.
template
value
<
double
>(
vars
,
pos
,
t
,
dt
);
}
std
::
tuple
<
double
,
double
>
getFluidDensityAndViscosity
(
double
const
t
,
double
const
dt
,
ParameterLib
::
SpatialPosition
const
&
pos
,
MaterialPropertyLib
::
Phase
const
&
fluid_phase
,
MaterialPropertyLib
::
VariableArray
&
vars
)
{
auto
const
fluid_density
=
getFluidDensity
(
t
,
dt
,
pos
,
fluid_phase
,
vars
);
assert
(
fluid_density
>
0.
);
vars
.
density
=
fluid_density
;
auto
const
viscosity
=
fluid_phase
[
MaterialPropertyLib
::
PropertyType
::
viscosity
]
.
template
value
<
double
>(
vars
,
pos
,
t
,
dt
);
return
{
fluid_density
,
viscosity
};
}
}
// namespace MaterialPropertyLib
This diff is collapsed.
Click to expand it.
MaterialLib/MPL/Utils/GetFluidDensityAndViscosity.h
0 → 100644
+
34
−
0
View file @
931fc44e
/**
* \file
* \copyright
* Copyright (c) 2012-2025, 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 January 21, 2025, 4:10 PM
*/
#pragma once
#include
<tuple>
namespace
ParameterLib
{
class
SpatialPosition
;
}
namespace
MaterialPropertyLib
{
class
Phase
;
class
VariableArray
;
/// It computes fluid density and viscosity for single phase flow model.
std
::
tuple
<
double
,
double
>
getFluidDensityAndViscosity
(
double
const
t
,
double
const
dt
,
ParameterLib
::
SpatialPosition
const
&
pos
,
Phase
const
&
fluid_phase
,
VariableArray
&
vars
);
/// It computes fluid density for single phase flow model.
double
getFluidDensity
(
double
const
t
,
double
const
dt
,
ParameterLib
::
SpatialPosition
const
&
pos
,
Phase
const
&
fluid_phase
,
VariableArray
&
vars
);
}
// namespace MaterialPropertyLib
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