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
5277a42e
Commit
5277a42e
authored
Sep 3, 2019
by
David Seus
Browse files
Options
Downloads
Patches
Plain Diff
clean _init_dof_maps
parent
b13f64b7
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
LDDsimulation/domainPatch.py
+19
-28
19 additions, 28 deletions
LDDsimulation/domainPatch.py
with
19 additions
and
28 deletions
LDDsimulation/domainPatch.py
+
19
−
28
View file @
5277a42e
...
@@ -379,9 +379,9 @@ class DomainPatch(df.SubDomain):
...
@@ -379,9 +379,9 @@ class DomainPatch(df.SubDomain):
# assumes a Richards model, we assume constant normalised atmospheric pressure
# assumes a Richards model, we assume constant normalised atmospheric pressure
# and no interface term is practically appearing.
# and no interface term is practically appearing.
# interface_forms += (df.Constant(0)*phi_a)*ds(interface)
# interface_forms += (df.Constant(0)*phi_a)*ds(interface)
#
pass
pass
interface_forms
.
append
((
0
*
pa
*
phi_a
)
*
ds
(
marker_value
))
#
interface_forms.append((0*pa*phi_a)*ds(marker_value))
gli_forms
.
append
((
0
*
phi_a
)
*
ds
(
marker_value
))
#
gli_forms.append((0*phi_a)*ds(marker_value))
else
:
else
:
# interface_forms += (dt*Lambda_a*pa*phi_a)*ds(interface)
# interface_forms += (dt*Lambda_a*pa*phi_a)*ds(interface)
interface_forms
.
append
((
dt
*
Lambda_a
*
pa
*
phi_a
)
*
ds
(
marker_value
))
interface_forms
.
append
((
dt
*
Lambda_a
*
pa
*
phi_a
)
*
ds
(
marker_value
))
...
@@ -797,47 +797,35 @@ class DomainPatch(df.SubDomain):
...
@@ -797,47 +797,35 @@ class DomainPatch(df.SubDomain):
# we want the same space for both primary variables (pw
# we want the same space for both primary variables (pw
# and pnw) to be able to calculate pnw-pw without issues.
# and pnw) to be able to calculate pnw-pw without issues.
pressure_space
=
df
.
FunctionSpace
(
self
.
mesh
,
'
P
'
,
degree
)
pressure_space
=
df
.
FunctionSpace
(
self
.
mesh
,
'
P
'
,
degree
)
gli_space
=
df
.
FunctionSpace
(
self
.
mesh
,
'
DG
'
,
degree
)
flux_space
=
df
.
VectorFunctionSpace
(
self
.
mesh
,
'
DG
'
,
degree
)
for
phase
in
self
.
has_phases
:
for
phase
in
self
.
has_phases
:
if
function
==
"
pressure
"
:
if
function
==
"
pressure
"
:
self
.
function_space
[
function
].
update
({
phase
:
pressure_space
})
self
.
function_space
[
function
].
update
({
phase
:
pressure_space
})
self
.
trialfunction
.
update
({
phase
:
df
.
TrialFunction
(
self
.
function_space
[
"
pressure
"
][
phase
])})
self
.
trialfunction
.
update
({
phase
:
df
.
TrialFunction
(
self
.
function_space
[
"
pressure
"
][
phase
])})
self
.
testfunction
.
update
({
phase
:
df
.
TestFunction
(
self
.
function_space
[
"
pressure
"
][
phase
])})
self
.
testfunction
.
update
({
phase
:
df
.
TestFunction
(
self
.
function_space
[
"
pressure
"
][
phase
])})
elif
function
==
"
gli
"
:
elif
function
==
"
gli
"
:
degree
=
self
.
function_space
[
"
pressure
"
][
phase
].
ufl_element
().
degree
()
self
.
function_space
[
function
].
update
({
phase
:
gli_space
})
self
.
function_space
[
function
].
update
({
phase
:
df
.
FunctionSpace
(
self
.
mesh
,
'
DG
'
,
degree
)})
else
:
else
:
# here function = flux
# here function = flux
degree
=
self
.
function_space
[
"
pressure
"
][
phase
].
ufl_element
().
degree
()
#
degree = self.function_space["pressure"][phase].ufl_element().degree()
self
.
function_space
[
function
].
update
({
phase
:
df
.
VectorFunctionSpace
(
self
.
mesh
,
'
DG
'
,
degree
)
})
self
.
function_space
[
function
].
update
({
phase
:
flux_space
})
def
_init_dof_maps
(
self
)
->
None
:
def
_init_dof_maps
(
self
)
->
None
:
"""
calculate dof maps and the vertex to parent map.
"""
calculate and save dof maps of the different function spaces. This is needed for
writing the communication over the interface.
This method
set
s the class
Variabl
es
This method
populate
s the class
dictionari
es
self.dof
2vertex
self.dof
map
self.vertex2dof
Note, that the flux dofmap is split into x and y coordinates.
"""
"""
mesh_data
=
self
.
mesh
.
data
()
mesh_data
=
self
.
mesh
.
data
()
# # local to parent vertex index map
# if self.has_interface is not None:
# self.parent_mesh_index = mesh_data.array('parent_vertex_indices',0)
# print(f"on subdomain{self.subdomain_index} parent_vertex_indices: {self.parent_mesh_index}")
self
.
dof2vertex
=
dict
()
self
.
vertex2dof
=
dict
()
self
.
dofmap
=
dict
()
self
.
dofmap
=
dict
()
self
.
dofmap
.
update
({
"
pressure
"
:
dict
()})
self
.
dofmap
.
update
({
"
pressure
"
:
dict
()})
self
.
dofmap
.
update
({
"
gli
"
:
dict
()})
self
.
dofmap
.
update
({
"
gli
"
:
dict
()})
self
.
dofmap
.
update
({
"
flux
"
:
dict
()})
self
.
dofmap
.
update
({
"
flux
"
:
dict
()})
for
phase
in
self
.
has_phases
:
for
phase
in
self
.
has_phases
:
self
.
dof2vertex
.
update
(
#
{
phase
:
df
.
dof_to_vertex_map
(
self
.
function_space
[
"
pressure
"
][
phase
])}
#
)
# print(f"on subdomain{self.subdomain_index} dof2vertex: {self.dof2vertex[phase]}")
self
.
vertex2dof
.
update
(
#
{
phase
:
df
.
vertex_to_dof_map
(
self
.
function_space
[
"
pressure
"
][
phase
])}
#
)
# print(f"on subdomain{self.subdomain_index} vertex2dof: {self.vertex2dof[phase]}")
self
.
dofmap
[
"
pressure
"
].
update
(
self
.
dofmap
[
"
pressure
"
].
update
(
{
phase
:
self
.
function_space
[
"
pressure
"
][
phase
].
dofmap
()}
{
phase
:
self
.
function_space
[
"
pressure
"
][
phase
].
dofmap
()}
)
)
...
@@ -1125,9 +1113,12 @@ class DomainPatch(df.SubDomain):
...
@@ -1125,9 +1113,12 @@ class DomainPatch(df.SubDomain):
for
phase
in
self
.
has_phases
:
for
phase
in
self
.
has_phases
:
rho
=
df
.
Constant
(
self
.
densities
[
phase
])
rho
=
df
.
Constant
(
self
.
densities
[
phase
])
self
.
gravity_term
.
update
(
self
.
gravity_term
.
update
(
{
phase
:
df
.
Expression
(
'
-g*rho*x[1]
'
,
domain
=
self
.
mesh
,
#
{
phase
:
df
.
Expression
(
'
-g*rho*x[1]
'
,
domain
=
self
.
mesh
,
#
degree
=
self
.
interpolation_degree
,
degree
=
self
.
interpolation_degree
,
g
=
g
,
rho
=
rho
)}
g
=
g
,
rho
=
rho
)}
)
)
def
write_solution_to_xdmf
(
self
,
file
:
tp
.
Type
[
SolutionFile
],
#
def
write_solution_to_xdmf
(
self
,
file
:
tp
.
Type
[
SolutionFile
],
#
...
...
...
...
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
sign in
to comment