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
47ea421c
Commit
47ea421c
authored
5 years ago
by
David Seus
Browse files
Options
Downloads
Patches
Plain Diff
explain implementaiton details of calc_gli_term method and recheck.
parent
d96b819c
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/domainPatch.py
+97
-3
97 additions, 3 deletions
LDDsimulation/domainPatch.py
with
97 additions
and
3 deletions
LDDsimulation/domainPatch.py
+
97
−
3
View file @
47ea421c
...
@@ -293,6 +293,8 @@ class DomainPatch(df.SubDomain):
...
@@ -293,6 +293,8 @@ class DomainPatch(df.SubDomain):
for
dof_index
,
dof_coord
in
facet_dof_coord_dict
.
items
():
for
dof_index
,
dof_coord
in
facet_dof_coord_dict
.
items
():
dof_coord_tupel
=
(
dof_coord
[
0
],
dof_coord
[
1
])
dof_coord_tupel
=
(
dof_coord
[
0
],
dof_coord
[
1
])
save_dict
.
update
({
dof_coord_tupel
:
self
.
pressure
[
phase
].
vector
()[
dof_index
]})
save_dict
.
update
({
dof_coord_tupel
:
self
.
pressure
[
phase
].
vector
()[
dof_index
]})
else
:
pass
def
governing_problem
(
self
,
phase
:
str
)
->
tp
.
Dict
[
str
,
fl
.
Form
]:
def
governing_problem
(
self
,
phase
:
str
)
->
tp
.
Dict
[
str
,
fl
.
Form
]:
...
@@ -503,6 +505,7 @@ class DomainPatch(df.SubDomain):
...
@@ -503,6 +505,7 @@ class DomainPatch(df.SubDomain):
corresponding_dof_index
=
self
.
interface_corresponding_dof_index
[
interf_ind
][
phase
]
corresponding_dof_index
=
self
.
interface_corresponding_dof_index
[
interf_ind
][
phase
]
for
local_facet_ind
,
normal
in
interface
.
outer_normals
[
subdomain
].
items
():
for
local_facet_ind
,
normal
in
interface
.
outer_normals
[
subdomain
].
items
():
gli_dofs_along_facet
=
gli_dof_coordinates
[
local_facet_ind
]
gli_dofs_along_facet
=
gli_dof_coordinates
[
local_facet_ind
]
global_facet_ind
=
local2global_facet
[
local_facet_ind
]
for
gli_dof_index
,
gli_dof_coord
in
gli_dofs_along_facet
.
items
():
for
gli_dof_index
,
gli_dof_coord
in
gli_dofs_along_facet
.
items
():
flux_x_dof_index
=
corresponding_dof_index
[
local_facet_ind
][
gli_dof_index
][
"
flux_x
"
]
flux_x_dof_index
=
corresponding_dof_index
[
local_facet_ind
][
gli_dof_index
][
"
flux_x
"
]
flux_y_dof_index
=
corresponding_dof_index
[
local_facet_ind
][
gli_dof_index
][
"
flux_y
"
]
flux_y_dof_index
=
corresponding_dof_index
[
local_facet_ind
][
gli_dof_index
][
"
flux_y
"
]
...
@@ -516,7 +519,6 @@ class DomainPatch(df.SubDomain):
...
@@ -516,7 +519,6 @@ class DomainPatch(df.SubDomain):
# save this newly calculated dof to the interface
# save this newly calculated dof to the interface
# dictionary gli_term_prev
# dictionary gli_term_prev
global_facet_ind
=
local2global_facet
[
local_facet_ind
]
dof_coord_tupel
=
(
gli_dof_coord
[
0
],
gli_dof_coord
[
1
])
dof_coord_tupel
=
(
gli_dof_coord
[
0
],
gli_dof_coord
[
1
])
interface
.
gli_term_prev
[
subdomain
][
phase
][
global_facet_ind
].
update
(
interface
.
gli_term_prev
[
subdomain
][
phase
][
global_facet_ind
].
update
(
{
dof_coord_tupel
:
gl0
.
vector
()[
gli_dof_index
]}
{
dof_coord_tupel
:
gl0
.
vector
()[
gli_dof_index
]}
...
@@ -535,6 +537,98 @@ class DomainPatch(df.SubDomain):
...
@@ -535,6 +537,98 @@ class DomainPatch(df.SubDomain):
the iteration number of the subdomain and return it as a dolfin Function
the iteration number of the subdomain and return it as a dolfin Function
used for assembling the governing form in self.govering_problem. Additionally,
used for assembling the governing form in self.govering_problem. Additionally,
save the newly computed gli_term to the gli dictionries of the interface.
save the newly computed gli_term to the gli dictionries of the interface.
PARAMETERS
------------------------------------
interface_index int interface index for which to calculate the
gli term.
phase str phase to calculate the gli term for.
# DEBUG: bool toggle the debug output.
IMPLEMENTATION DETAILS
Each interface has several dictionaries to store the gli terms and interface
pressures. Let interface be the interface with the index interface_index.
For each phase in self.has_phases we have four dictionaries
interface.gli_term[subdomain][phase],
interface.gli_term_prev[subdomain][phase],
interface.gli_term[neighbour][phase],
interface.gli_term_prev[neighbour][phase],
storing the gli term of the current iteration as well as the previous one,
for both the subdomain and its neighbour that it shares the interface with.
The same holds true for the pressure terms.
This is needed because the neighbouring subdomain (relative to the subdomain
we are currently on) might still need the gli term and the pressures of
the previous iteration depending on wether or not it is one iteration ahead or not.
So, depending on the current iteration number self.iteration_number (which
is updated by the solver method LDDsimulation.LDDsolver) in relation to
the iteration number of the neighbouring subdomain, we choose different
dictionaries to read the neighbouring previous pressures from.
Similarly the dictionaries used to save the newly computed gli terms must
be chosen appropriately.
The paradigm for reading the neighbouring gli_terms is, that the correct
terms we need to read are ALWAYS stored in interface.gli_term_prev.
The self.calc_gl0_method e.g. stores the gl0 values in the interface.gli_term_prev
dictionaries.
Baring in mind, that for each iteration the solver loops over the subdomains,
and the first thing it does is raise the iteration number of the subdomain
it tackles, we know that the iteration numbers can only differ by at most 1.
We get the follwing two cases:
a) subdomain_iteration == neighbour_iter_num + 1:
subdomain and neighbour started with the same iteration number when the
solver entered the new iteration. The solver raised the subodomain iteration
number by 1, so our subdomain is now ahead of the neighbouring subdomain.
The following steps are carried out.
1. step: read previous neighbouring pressure values from interface
dictionary. Since in this case the neighbour has not yet iterated beyond
the iteration we are currently in,
pressure_prev = interface.pressure_values[neighbour][phase]
holds the
"
previous pressure
"
we need.
2. step: choose the dictionary to save the gli_term in once they are
calculated. Since in this case, the neighbour has not done the next
iteration the neighbouring subdomain will need the values stored in
interface.gli_term_prev[subdomain][phase]
of the current subdomain. Therefore we cannot overwrite these values
and save the newly calculated gli_terms to
gli_save_dictionary = interface.gli_term[subdomain][phase]
b) subdomain_iteration == neighbour_iter_num:
1. step: read previous neighbouring pressure values from interface
dictionary. In this case the neighbour has iterated once beyond the
iteration we are currently in, so
pressure_prev = interface.pressure_values_prev[neighbour][phase]
holds the
"
previous pressure
"
, since the LDDsolver always writes
newly calculated pressures to the dictionary interface.pressure_values.
2. step: choose the dictionary to save the gli_term in once they are
calculated.
In this case, the neighbour has done the next iteration already
will has already used the previous gli term stored in gli_term_prev
of the current subdomain. Therefor, we save the the newly calculated
gli terms to
gli_save_dictionary = interface.gli_term_prev[subdomain][phase]
After calculating gli:
Now, since our neighbour previously was in situation a) it saved the
gli_term to interface.gli_term[neighbour] and this will be overwritten
in the next step, if we don
'
t save it to gli_term_prev of the neighbour.
Similarly for the pressure values. So in the present case, we need to
save interface.gli_term[neighbour][phase] to
interface.gli_term_prev[neighbour][phase]
and interface.pressure_values[neighbour][phase] to
interface.pressure_values_prev[neighbour][phase]
"""
"""
# this is the number of the current iteration of the subdomain.
# this is the number of the current iteration of the subdomain.
iteration
=
self
.
iteration_number
iteration
=
self
.
iteration_number
...
@@ -560,7 +654,7 @@ class DomainPatch(df.SubDomain):
...
@@ -560,7 +654,7 @@ class DomainPatch(df.SubDomain):
# in this case the neighbour has not yet iterated beyond
# in this case the neighbour has not yet iterated beyond
# the iteration we are currently in, so
# the iteration we are currently in, so
# interface.pressure_values[neighbour] holds the "previous pressure"
# interface.pressure_values[neighbour] holds the "previous pressure"
# we need to read from the interface to calculate the current gli.
# we need to read
these values
from the interface to calculate the current gli.
pressure_prev
=
interface
.
pressure_values
[
neighbour
][
phase
]
pressure_prev
=
interface
.
pressure_values
[
neighbour
][
phase
]
# choose dictionary to save the newly calculated dofs to.
# choose dictionary to save the newly calculated dofs to.
...
@@ -862,7 +956,7 @@ class DomainPatch(df.SubDomain):
...
@@ -862,7 +956,7 @@ class DomainPatch(df.SubDomain):
)
)
def
_calc_corresponding_dof_indices
(
self
,
debug
=
Fals
e
):
def
_calc_corresponding_dof_indices
(
self
,
debug
=
Tru
e
):
"""
calculate dictionary which for each interface and each phase holds
"""
calculate dictionary which for each interface and each phase holds
for each facet index, the dof indices of the pressures and flux components
for each facet index, the dof indices of the pressures and flux components
corresponding to a given dof index of the gli function.
corresponding to a given dof index of the gli function.
...
...
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