Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LDD-for-two-phase-flow-systems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Seus
LDD-for-two-phase-flow-systems
Commits
17f3c1bb
Commit
17f3c1bb
authored
Mar 21, 2019
by
David Seus
Browse files
Options
Downloads
Patches
Plain Diff
fix domainPatch.write_pressure_to_interfaces()
parent
02032034
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
LDDsimulation.py
+21
-0
21 additions, 0 deletions
LDDsimulation.py
RR-2-patch-test.py
+7
-0
7 additions, 0 deletions
RR-2-patch-test.py
domainPatch.py
+4
-4
4 additions, 4 deletions
domainPatch.py
with
32 additions
and
4 deletions
LDDsimulation.py
+
21
−
0
View file @
17f3c1bb
...
@@ -328,6 +328,27 @@ class LDDsimulation(object):
...
@@ -328,6 +328,27 @@ class LDDsimulation(object):
subdomain
.
pressure_prev_timestep
=
{
'
wetting
'
:
df
.
interpolate
(
pw0
,
V
[
'
wetting
'
]),
#
subdomain
.
pressure_prev_timestep
=
{
'
wetting
'
:
df
.
interpolate
(
pw0
,
V
[
'
wetting
'
]),
#
'
nonwetting
'
:
df
.
interpolate
(
pnw0
,
V
[
'
nonwetting
'
])}
'
nonwetting
'
:
df
.
interpolate
(
pnw0
,
V
[
'
nonwetting
'
])}
def
_init_DirichletBC
(
self
,
interpolation_degree
:
int
=
2
):
"""
set initial values
"""
for
num
,
subdomain
in
self
.
subdomain
.
items
():
mesh
=
subdomain
.
mesh
V
=
subdomain
.
function_space
# p0 contains both pw_0 and pnw_0 for subdomain[num]
p0
=
self
.
initial_conditions
[
num
]
if
subdomain
.
isRichards
:
# note that the default interpolation degree is 2
pw0
=
df
.
Expression
(
p0
[
'
wetting
'
],
domain
=
mesh
,
degree
=
interpolation_degree
)
subdomain
.
pressure_prev_iter
=
{
'
wetting
'
:
df
.
interpolate
(
pw0
,
V
[
'
wetting
'
])}
subdomain
.
pressure_prev_timestep
=
{
'
wetting
'
:
df
.
interpolate
(
pw0
,
V
[
'
wetting
'
])}
else
:
pw0
=
df
.
Expression
(
p0
[
'
wetting
'
],
domain
=
mesh
,
degree
=
interpolation_degree
)
pnw0
=
df
.
Expression
(
p0
[
'
nonwetting
'
],
domain
=
mesh
,
degree
=
interpolation_degree
)
subdomain
.
pressure_prev_iter
=
{
'
wetting
'
:
df
.
interpolate
(
pw0
,
V
[
'
wetting
'
]),
#
'
nonwetting
'
:
df
.
interpolate
(
pnw0
,
V
[
'
nonwetting
'
])}
subdomain
.
pressure_prev_timestep
=
{
'
wetting
'
:
df
.
interpolate
(
pw0
,
V
[
'
wetting
'
]),
#
'
nonwetting
'
:
df
.
interpolate
(
pnw0
,
V
[
'
nonwetting
'
])}
def
_eval_sources
(
self
,
interpolation_degree
:
int
=
2
,
time
:
float
=
0
):
def
_eval_sources
(
self
,
interpolation_degree
:
int
=
2
,
time
:
float
=
0
):
"""
evaluate time dependent source terms or initialise them if time == 0
"""
evaluate time dependent source terms or initialise them if time == 0
"""
"""
...
...
This diff is collapsed.
Click to expand it.
RR-2-patch-test.py
+
7
−
0
View file @
17f3c1bb
...
@@ -125,6 +125,13 @@ initial_condition = {
...
@@ -125,6 +125,13 @@ initial_condition = {
2
:
{
'
wetting
'
:
'
-x[1]*x[1]
'
}
2
:
{
'
wetting
'
:
'
-x[1]*x[1]
'
}
}
}
exact_solution
=
{
1
:
{
'
wetting
'
:
'
1.0 - (1.0 + t*t)*(1.0 + x[0]*x[0] + x[1]*x[1])
'
},
#
2
:
{
'
wetting
'
:
'
1.0 - (1.0 + t*t)*(1.0 + x[1]*x[1])
'
}
}
dirichletBC
=
exact_solution
# def saturation(pressure, subdomain_index):
# def saturation(pressure, subdomain_index):
# # inverse capillary pressure-saturation-relationship
# # inverse capillary pressure-saturation-relationship
# return df.conditional(pressure < 0, 1/((1 - pressure)**(1/(subdomain_index + 1))), 1)
# return df.conditional(pressure < 0, 1/((1 - pressure)**(1/(subdomain_index + 1))), 1)
...
...
This diff is collapsed.
Click to expand it.
domainPatch.py
+
4
−
4
View file @
17f3c1bb
...
@@ -139,7 +139,7 @@ class DomainPatch(df.SubDomain):
...
@@ -139,7 +139,7 @@ class DomainPatch(df.SubDomain):
### Class variables set by methods
### Class variables set by methods
# dictionary holding the dof indices corresponding to an interface of
# dictionary holding the dof indices corresponding to an interface of
# given interface. see self._calc_dof_indices_of_interfaces()
# given interface. see self._calc_dof_indices_of_interfaces()
self
.
dof_indices_of_interface
=
dict
()
self
.
_
dof_indices_of_interface
=
dict
()
# measures are set by self._init_measures()
# measures are set by self._init_measures()
self
.
iteration_number
=
0
self
.
iteration_number
=
0
self
.
dx
=
None
self
.
dx
=
None
...
@@ -165,7 +165,7 @@ class DomainPatch(df.SubDomain):
...
@@ -165,7 +165,7 @@ class DomainPatch(df.SubDomain):
def
write_pressure_to_interfaces
(
self
):
def
write_pressure_to_interfaces
(
self
):
"""
save the interface values of self.pressure to all neighbouring interfaces
"""
"""
save the interface values of self.pressure to all neighbouring interfaces
"""
if
self
.
isRichards
:
if
self
.
isRichards
:
for
ind
in
has_interface
:
for
ind
in
self
.
has_interface
:
interface
[
ind
].
write_dofs
(
from_function
=
self
.
pressure
[
'
wetting
'
],
#
interface
[
ind
].
write_dofs
(
from_function
=
self
.
pressure
[
'
wetting
'
],
#
interface_dofs
=
self
.
_dof_indices_of_interface
[
ind
][
'
wetting
'
],
#
interface_dofs
=
self
.
_dof_indices_of_interface
[
ind
][
'
wetting
'
],
#
dof_to_vert_map
=
self
.
dof2vertex
[
'
wetting
'
],
#
dof_to_vert_map
=
self
.
dof2vertex
[
'
wetting
'
],
#
...
@@ -173,7 +173,7 @@ class DomainPatch(df.SubDomain):
...
@@ -173,7 +173,7 @@ class DomainPatch(df.SubDomain):
phase
=
'
wetting
'
,
#
phase
=
'
wetting
'
,
#
subdomain_ind
=
self
.
subdomain_index
)
subdomain_ind
=
self
.
subdomain_index
)
else
:
else
:
for
ind
in
has_interface
:
for
ind
in
self
.
has_interface
:
for
phase
in
[
'
wetting
'
,
'
nonwetting
'
]:
for
phase
in
[
'
wetting
'
,
'
nonwetting
'
]:
interface
[
ind
].
write_dofs
(
from_function
=
self
.
pressure
[
phase
],
#
interface
[
ind
].
write_dofs
(
from_function
=
self
.
pressure
[
phase
],
#
interface_dofs
=
self
.
_dof_indices_of_interface
[
ind
][
phase
],
#
interface_dofs
=
self
.
_dof_indices_of_interface
[
ind
][
phase
],
#
...
@@ -311,7 +311,7 @@ class DomainPatch(df.SubDomain):
...
@@ -311,7 +311,7 @@ class DomainPatch(df.SubDomain):
"""
calculate dof indices of each interface
"""
"""
calculate dof indices of each interface
"""
V
=
self
.
function_space
V
=
self
.
function_space
marker
=
self
.
boundary_marker
marker
=
self
.
boundary_marker
for
ind
in
has_interface
:
for
ind
in
self
.
has_interface
:
self
.
_dof_indices_of_interface
.
update
(
#
self
.
_dof_indices_of_interface
.
update
(
#
{
ind
:
dict
()}
{
ind
:
dict
()}
)
)
...
...
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