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
7d7db2ff
Commit
7d7db2ff
authored
5 months ago
by
Dmitri Naumov
Committed by
wenqing
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
[PL/LF] Separate media checks; use algorithms
parent
799d5e38
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
ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp
+29
-25
29 additions, 25 deletions
ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp
with
29 additions
and
25 deletions
ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp
+
29
−
25
View file @
7d7db2ff
...
@@ -12,6 +12,10 @@
...
@@ -12,6 +12,10 @@
#include
"CreateLiquidFlowProcess.h"
#include
"CreateLiquidFlowProcess.h"
#include
<algorithm>
#include
<algorithm>
#include
<range/v3/algorithm/any_of.hpp>
#include
<range/v3/algorithm/for_each.hpp>
#include
<range/v3/range/conversion.hpp>
#include
<range/v3/view/transform.hpp>
#include
<typeinfo>
#include
<typeinfo>
#include
"LiquidFlowProcess.h"
#include
"LiquidFlowProcess.h"
...
@@ -34,6 +38,31 @@ void checkMPLProperties(
...
@@ -34,6 +38,31 @@ void checkMPLProperties(
MaterialPropertyLib
::
MaterialSpatialDistributionMap
const
&
media_map
,
MaterialPropertyLib
::
MaterialSpatialDistributionMap
const
&
media_map
,
bool
const
is_equation_type_volume
)
bool
const
is_equation_type_volume
)
{
{
// Check all of the elements have a medium defined.
ranges
::
for_each
(
mesh
.
getElements
()
|
MeshLib
::
views
::
ids
,
[
&
](
auto
const
&
element_id
)
{
media_map
.
checkElementHasMedium
(
element_id
);
});
// Collect phases of all elements...
auto
all_phases
=
mesh
.
getElements
()
|
MeshLib
::
views
::
ids
|
ranges
::
views
::
transform
(
[
&
](
auto
const
&
element_id
)
{
return
&
fluidPhase
(
*
media_map
.
getMedium
(
element_id
));
})
|
ranges
::
to_vector
;
assert
(
!
all_phases
.
empty
());
// ... and check if any of the phases are different by name.
if
(
ranges
::
any_of
(
all_phases
,
[
p0
=
all_phases
.
front
()](
auto
const
*
const
p
)
{
return
p
->
name
!=
p0
->
name
;
}))
{
OGS_FATAL
(
"You are mixing liquid and gas phases in your model domain. OGS "
"does not yet know how to handle this."
);
}
std
::
array
const
required_medium_properties
=
{
std
::
array
const
required_medium_properties
=
{
MaterialPropertyLib
::
reference_temperature
,
MaterialPropertyLib
::
reference_temperature
,
MaterialPropertyLib
::
PropertyType
::
permeability
,
MaterialPropertyLib
::
PropertyType
::
permeability
,
...
@@ -44,34 +73,9 @@ void checkMPLProperties(
...
@@ -44,34 +73,9 @@ void checkMPLProperties(
MaterialPropertyLib
::
PropertyType
::
viscosity
,
MaterialPropertyLib
::
PropertyType
::
viscosity
,
MaterialPropertyLib
::
PropertyType
::
density
};
MaterialPropertyLib
::
PropertyType
::
density
};
// setting default to suppress -maybe-uninitialized warning
MaterialPropertyLib
::
Variable
phase_pressure
=
MaterialPropertyLib
::
Variable
::
liquid_phase_pressure
;
for
(
auto
const
&
element_id
:
mesh
.
getElements
()
|
MeshLib
::
views
::
ids
)
for
(
auto
const
&
element_id
:
mesh
.
getElements
()
|
MeshLib
::
views
::
ids
)
{
{
media_map
.
checkElementHasMedium
(
element_id
);
auto
const
&
medium
=
*
media_map
.
getMedium
(
element_id
);
auto
const
&
medium
=
*
media_map
.
getMedium
(
element_id
);
if
(
element_id
==
0
)
{
phase_pressure
=
medium
.
hasPhase
(
"Gas"
)
?
MaterialPropertyLib
::
Variable
::
gas_phase_pressure
:
MaterialPropertyLib
::
Variable
::
liquid_phase_pressure
;
}
else
{
auto
const
phase_pressure_tmp
=
medium
.
hasPhase
(
"Gas"
)
?
MaterialPropertyLib
::
Variable
::
gas_phase_pressure
:
MaterialPropertyLib
::
Variable
::
liquid_phase_pressure
;
if
(
phase_pressure
!=
phase_pressure_tmp
)
{
OGS_FATAL
(
"You are mixing liquid and gas phases in your model domain."
"OGS does not yet know how to handle this."
);
}
}
checkRequiredProperties
(
medium
,
required_medium_properties
);
checkRequiredProperties
(
medium
,
required_medium_properties
);
checkRequiredProperties
(
fluidPhase
(
medium
),
required_liquid_properties
);
checkRequiredProperties
(
fluidPhase
(
medium
),
required_liquid_properties
);
...
...
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