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
17479cf6
Commit
17479cf6
authored
Mar 29, 2019
by
David Seus
Browse files
Options
Downloads
Patches
Plain Diff
Class Interface: rename write_dofs to write_gli_dofs and write_pressure_dofs
parent
09aaad08
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
domainPatch.py
+64
-37
64 additions, 37 deletions
domainPatch.py
with
64 additions
and
37 deletions
domainPatch.py
+
64
−
37
View file @
17479cf6
...
@@ -176,7 +176,7 @@ class DomainPatch(df.SubDomain):
...
@@ -176,7 +176,7 @@ class DomainPatch(df.SubDomain):
"""
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
self
.
has_interface
:
for
ind
in
self
.
has_interface
:
interface
[
ind
].
write_dofs
(
from_function
=
self
.
pressure
[
'
wetting
'
],
#
interface
[
ind
].
write_
pressure_
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
'
],
#
local_to_parent_vertex_map
=
self
.
parent_mesh_index
,
#
local_to_parent_vertex_map
=
self
.
parent_mesh_index
,
#
...
@@ -185,7 +185,7 @@ class DomainPatch(df.SubDomain):
...
@@ -185,7 +185,7 @@ class DomainPatch(df.SubDomain):
else
:
else
:
for
ind
in
self
.
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_
pressure_
dofs
(
from_function
=
self
.
pressure
[
phase
],
#
interface_dofs
=
self
.
_dof_indices_of_interface
[
ind
][
phase
],
#
interface_dofs
=
self
.
_dof_indices_of_interface
[
ind
][
phase
],
#
dof_to_vert_map
=
self
.
dof2vertex
[
phase
],
#
dof_to_vert_map
=
self
.
dof2vertex
[
phase
],
#
local_to_parent_vertex_map
=
self
.
parent_mesh_index
,
#
local_to_parent_vertex_map
=
self
.
parent_mesh_index
,
#
...
@@ -891,14 +891,12 @@ class Interface(BoundaryPart):
...
@@ -891,14 +891,12 @@ class Interface(BoundaryPart):
self
.
gli_term_prev
[
subdom_ind
][
phase
].
update
({
vert_ind
:
0.0
})
self
.
gli_term_prev
[
subdom_ind
][
phase
].
update
({
vert_ind
:
0.0
})
# end init_interface_values
# end init_interface_values
def
write_dofs
(
self
,
from_function
:
df
.
Function
,
#
def
write_
pressure_
dofs
(
self
,
from_function
:
df
.
Function
,
#
interface_dofs
:
np
.
array
,
#
interface_dofs
:
np
.
array
,
#
dof_to_vert_map
:
np
.
array
,
#
dof_to_vert_map
:
np
.
array
,
#
local_to_parent_vertex_map
:
np
.
array
,
#
local_to_parent_vertex_map
:
np
.
array
,
#
phase
:
str
,
#
phase
:
str
,
#
subdomain_ind
:
int
,
#
subdomain_ind
:
int
,
#
pressure
:
bool
=
False
,
#
gl
:
bool
=
False
,
#
previous_iter
:
bool
=
False
,
#
previous_iter
:
bool
=
False
,
#
)
->
None
:
)
->
None
:
"""
write dofs of from_function with indices interface_dofs to self.pressure_values
"""
write dofs of from_function with indices interface_dofs to self.pressure_values
...
@@ -908,11 +906,9 @@ class Interface(BoundaryPart):
...
@@ -908,11 +906,9 @@ class Interface(BoundaryPart):
of the interface
of the interface
self.pressure_values[subdomain_ind][phase], (if pressure == True)
self.pressure_values[subdomain_ind][phase], (if pressure == True)
self.pressure_values_prev[subdomain_ind][phase], (if previous_iter == True)
self.pressure_values_prev[subdomain_ind][phase], (if previous_iter == True)
self.gli_term[subdomain_ind][phase], (if gl == True)
self.gli_term_prev[subdomain_ind][phase] (if previous_iter == True)
# Parameters
# Parameters
from_function: #type: df.Function, function to save the dofs
t
o
from_function: #type: df.Function, function to save the dofs o
f
interface_dofs: #type: np.array, index array of dofs to be saved
interface_dofs: #type: np.array, index array of dofs to be saved
dof_to_vert_map: #type: np.array, dof to vert map of the function
dof_to_vert_map: #type: np.array, dof to vert map of the function
space on the submesh.
space on the submesh.
...
@@ -921,10 +917,6 @@ class Interface(BoundaryPart):
...
@@ -921,10 +917,6 @@ class Interface(BoundaryPart):
'
nonwetting
'
and determins
'
nonwetting
'
and determins
the dict to be written to.
the dict to be written to.
subdomain_ind #type: int subdomain index
subdomain_ind #type: int subdomain index
pressure #type: bool determins wether pressure
values are being written or not
gl #type: bool determins wether gl
values are being written or not
previous_iter #type: bool determins wether a previous
previous_iter #type: bool determins wether a previous
iterate is being written or not
iterate is being written or not
"""
"""
...
@@ -934,8 +926,6 @@ class Interface(BoundaryPart):
...
@@ -934,8 +926,6 @@ class Interface(BoundaryPart):
parent
=
local_to_parent_vertex_map
parent
=
local_to_parent_vertex_map
d2v
=
dof_to_vert_map
d2v
=
dof_to_vert_map
# chose where to write the dofs to
if
pressure
:
if
not
previous_iter
:
if
not
previous_iter
:
for
dof_index
in
interface_dofs
:
for
dof_index
in
interface_dofs
:
# from_function.vector() is orderd by dof and not by vertex numbering of the mesh.
# from_function.vector() is orderd by dof and not by vertex numbering of the mesh.
...
@@ -948,20 +938,57 @@ class Interface(BoundaryPart):
...
@@ -948,20 +938,57 @@ class Interface(BoundaryPart):
# parent needs a mesh vertex index of the submesh, therefore d2v is needed.
# parent needs a mesh vertex index of the submesh, therefore d2v is needed.
self
.
pressure_values_prev
[
subdomain_ind
][
phase
].
update
({
parent
[
d2v
[
dof_index
]]:
from_function
.
vector
()[
dof_index
]})
self
.
pressure_values_prev
[
subdomain_ind
][
phase
].
update
({
parent
[
d2v
[
dof_index
]]:
from_function
.
vector
()[
dof_index
]})
print
(
"
have written previous pressure interface values
\n
"
,
self
.
pressure_values_prev
[
subdomain_ind
][
phase
])
print
(
"
have written previous pressure interface values
\n
"
,
self
.
pressure_values_prev
[
subdomain_ind
][
phase
])
if
gl
:
def
write_gli_dofs
(
self
,
from_array
:
df
.
Function
,
#
interface_dofs
:
np
.
array
,
#
dof_to_vert_map
:
np
.
array
,
#
local_to_parent_vertex_map
:
np
.
array
,
#
phase
:
str
,
#
subdomain_ind
:
int
,
#
previous_iter
:
bool
=
False
,
#
)
->
None
:
"""
write dofs of from_array with indices interface_dofs to self.gli_term
Write the degrees of freedom of the array from_array with indices
interface_dofs, i.e. the dofs of the interface, to one of the dictionaries
of the interface
self.gli_term[subdomain_ind][phase], (if gl == True)
self.gli_term_prev[subdomain_ind][phase] (if previous_iter == True)
# Parameters
from_array: #type: np.array, array to save the dofs of
interface_dofs: #type: np.array, index array of dofs to be saved
dof_to_vert_map: #type: np.array, dof to vert map of the function
space on the submesh.
local_to_parent_vertex_map: #type: np.array,
phase #type: str is either
'
wetting
'
or
'
nonwetting
'
and determins
the dict to be written to.
subdomain_ind #type: int subdomain index
previous_iter #type: bool determins wether a previous
iterate is being written or not
"""
if
self
.
pressure_values
==
None
:
raise
RuntimeError
(
"
self.pressure_values not initiated. You forgot to
\
run self.init_interface_values
"
)
parent
=
local_to_parent_vertex_map
d2v
=
dof_to_vert_map
if
not
previous_iter
:
if
not
previous_iter
:
for
dof_index
in
interface_dofs
:
for
dof_index
in
interface_dofs
:
# from_
function.vector()
is orderd by dof and not by vertex numbering of the mesh.
# from_
array
is orderd by dof and not by vertex numbering of the mesh.
# parent needs a mesh vertex index of the submesh, therefore d2v is needed.
# parent needs a mesh vertex index of the submesh, therefore d2v is needed.
self
.
gli_term
[
subdomain_ind
][
phase
].
update
({
parent
[
d2v
[
dof_index
]]:
from_
function
.
vector
()
[
dof_index
]})
self
.
gli_term
[
subdomain_ind
][
phase
].
update
({
parent
[
d2v
[
dof_index
]]:
from_
array
[
dof_index
]})
print
(
"
have written gl interface values
\n
"
,
self
.
gli_term
[
subdomain_ind
][
phase
])
print
(
"
have written gl interface values
\n
"
,
self
.
gli_term
[
subdomain_ind
][
phase
])
else
:
else
:
for
dof_index
in
interface_dofs
:
for
dof_index
in
interface_dofs
:
# from_
function.vector()
is orderd by dof and not by vertex numbering of the mesh.
# from_
array
is orderd by dof and not by vertex numbering of the mesh.
# parent needs a mesh vertex index of the submesh, therefore d2v is needed.
# parent needs a mesh vertex index of the submesh, therefore d2v is needed.
self
.
gli_term_prev
[
subdomain_ind
][
phase
].
update
({
parent
[
d2v
[
dof_index
]]:
from_
function
.
vector
()
[
dof_index
]})
self
.
gli_term_prev
[
subdomain_ind
][
phase
].
update
({
parent
[
d2v
[
dof_index
]]:
from_
array
[
dof_index
]})
print
(
"
have written previous gl interface values
\n
"
,
self
.
gli_term_prev
[
subdomain_ind
][
phase
])
print
(
"
have written previous gl interface values
\n
"
,
self
.
gli_term_prev
[
subdomain_ind
][
phase
])
def
read_pressure_dofs
(
self
,
to_function
:
df
.
Function
,
#
def
read_pressure_dofs
(
self
,
to_function
:
df
.
Function
,
#
interface_dofs
:
np
.
array
,
#
interface_dofs
:
np
.
array
,
#
dof_to_vert_map
:
np
.
array
,
#
dof_to_vert_map
:
np
.
array
,
#
...
...
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