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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Seus
LDD-for-two-phase-flow-systems
Commits
c53bdb57
Commit
c53bdb57
authored
6 years ago
by
David Seus
Browse files
Options
Downloads
Patches
Plain Diff
check _init_initial_values for call by ref/value errors
parent
9a6da2de
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
LDDsimulation/LDDsimulation.py
+15
-13
15 additions, 13 deletions
LDDsimulation/LDDsimulation.py
with
15 additions
and
13 deletions
LDDsimulation/LDDsimulation.py
+
15
−
13
View file @
c53bdb57
...
...
@@ -116,9 +116,9 @@ class LDDsimulation(object):
# dictionary to hold the input Expressions for the external boundary. These are
# turned into df.Expressions objects by the method update_DirichletBC_dictionary()
# this is mostly in place when examples with exact solutions are calculated.
self
.
dirichletBC_
E
xpressions
=
None
self
.
dirichletBC_
e
xpression
_string
s
=
None
# dictionary to hold the df.Expressions for the external boundary created
# from the above self.dirichletBC_
E
xpressions. These are
# from the above self.dirichletBC_
e
xpression
_string
s. These are
# turned into df.dirichletBC objects by the method update_DirichletBC_dictionary()
self
.
dirichletBC_dfExpression
=
dict
()
# dictionary to store the df.dirichletBC objects in. These are used by the
...
...
@@ -223,7 +223,7 @@ class LDDsimulation(object):
self
.
timestep_size
=
timestep_size
self
.
sources
=
sources
self
.
initial_conditions
=
initial_conditions
self
.
dirichletBC_
E
xpressions
=
dirichletBC_Expressions
self
.
dirichletBC_
e
xpression
_string
s
=
dirichletBC_Expressions
self
.
exact_solution
=
exact_solution
self
.
write2file
=
write2file
self
.
_parameters_set
=
True
...
...
@@ -946,13 +946,14 @@ class LDDsimulation(object):
interpolation_degree
=
self
.
interpolation_degree
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
]
for
phase
in
subdomain
.
has_phases
:
# note that the default interpolation degree is 2
pa0
=
df
.
Expression
(
p0
[
phase
],
domain
=
mesh
,
degree
=
interpolation_degree
,
t
=
self
.
t
)
pa0
=
df
.
Expression
(
p0
[
phase
],
domain
=
subdomain
.
mesh
,
#
degree
=
interpolation_degree
,
#
t
=
self
.
starttime
)
pa0_interpolated
=
df
.
interpolate
(
pa0
,
V
[
phase
])
# alocate memory
subdomain
.
pressure
.
update
(
...
...
@@ -984,7 +985,7 @@ class LDDsimulation(object):
index subdomain_index.
In case we don
'
t have a case with an exact solution, we should have 0
expressions in self.dirichletBC_
E
xpressions, so nothing should happen.
expressions in self.dirichletBC_
e
xpression
_string
s, so nothing should happen.
"""
if
interpolation_degree
is
None
:
interpolation_degree
=
self
.
interpolation_degree
...
...
@@ -994,7 +995,6 @@ class LDDsimulation(object):
# we only need to set Dirichlet boundary conditions if we have an outer
# boundary.
if
subdomain
.
outer_boundary
is
not
None
:
mesh
=
subdomain
.
mesh
V
=
subdomain
.
function_space
# loop over all outer boundary parts. This is a bit of a brainfuck:
# subdomain.outer_boundary gives a dictionary of the outer boundaries of the subdomain.
...
...
@@ -1004,6 +1004,7 @@ class LDDsimulation(object):
# the wetting and the nonwetting phase, so subdomain.outer_boundary[j]['wetting'] and
# subdomain.outer_boundary[j]['nonwetting'] return
# the actual expression needed for the dirichlet condition for both phases if present.
boundary_marker
=
subdomain
.
outer_boundary_marker
for
index
,
boundary
in
enumerate
(
subdomain
.
outer_boundary
):
if
np
.
abs
(
time
-
self
.
starttime
)
<
self
.
tol
:
# Here the dictionary has to be created first because t = 0.
...
...
@@ -1014,9 +1015,8 @@ class LDDsimulation(object):
# part of the subdomain.
self
.
outerBC
[
num
].
update
({
index
:
dict
()})
self
.
dirichletBC_dfExpression
[
num
].
update
({
index
:
dict
()})
pDC
=
self
.
dirichletBC_Expressions
[
num
][
index
]
boundary_marker
=
subdomain
.
outer_boundary_marker
# this contains the Expression strings input by the user.
pDC
=
self
.
dirichletBC_expression_strings
[
num
][
index
]
# as with the interfaces, since numbering of the outer boundary
# parts of each subdomain starts at 0 and subdomain.outer_boundary_marker
# gets set to 0 on all facets of the mesh, we need to up the value for
...
...
@@ -1026,11 +1026,13 @@ class LDDsimulation(object):
# note that the default interpolation degree is 2
if
np
.
abs
(
time
-
self
.
starttime
)
<
self
.
tol
:
# time = 0 so the Dolfin Expression has to be created first.
pDCa
=
df
.
Expression
(
pDC
[
phase
],
domain
=
mesh
,
degree
=
interpolation_degree
,
t
=
time
)
pDCa
=
df
.
Expression
(
pDC
[
phase
],
domain
=
subdomain
.
mesh
,
#
degree
=
interpolation_degree
,
#
t
=
self
.
starttime
)
self
.
dirichletBC_dfExpression
[
num
][
index
].
update
({
phase
:
pDCa
})
else
:
pDCa
=
self
.
dirichletBC_dfExpression
[
num
][
index
][
phase
]
.
t
=
time
pDCa
=
self
.
dirichletBC_dfExpression
[
num
][
index
][
phase
]
pDCa
.
t
=
time
self
.
outerBC
[
num
][
index
].
update
(
{
phase
:
df
.
DirichletBC
(
V
[
phase
],
pDCa
,
boundary_marker
,
boundary_marker_value
)}
)
...
...
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