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
278cee2e
Commit
278cee2e
authored
Jun 5, 2020
by
David Seus
Browse files
Options
Downloads
Patches
Plain Diff
there were some unstaged changes: rename Sw to Sw_exact etc. and do something with postprocessing
parent
e6305c51
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
LDDsimulation/LDDsimulation.py
+59
-59
59 additions, 59 deletions
LDDsimulation/LDDsimulation.py
with
59 additions
and
59 deletions
LDDsimulation/LDDsimulation.py
+
59
−
59
View file @
278cee2e
...
@@ -938,12 +938,12 @@ class LDDsimulation(object):
...
@@ -938,12 +938,12 @@ class LDDsimulation(object):
file
.
write
(
exact_capillary_pressure
,
timestep
)
file
.
write
(
exact_capillary_pressure
,
timestep
)
saturation_w
=
df
.
project
(
S
(
exact_capillary_pressure
),
subdomain
.
function_space
[
"
pressure
"
][
"
wetting
"
])
saturation_w
=
df
.
project
(
S
(
exact_capillary_pressure
),
subdomain
.
function_space
[
"
pressure
"
][
"
wetting
"
])
# saturation_w.assign(Sat_w)
# saturation_w.assign(Sat_w)
saturation_w
.
rename
(
"
Sw
"
,
"
Sw
"
)
saturation_w
.
rename
(
"
Sw
_exact
"
,
"
Sw_exact
"
)
file
.
write
(
saturation_w
,
timestep
)
file
.
write
(
saturation_w
,
timestep
)
# S_nw = 1-S(exact_capillary_pressure).vector().get_local()
# S_nw = 1-S(exact_capillary_pressure).vector().get_local()
saturation_nw
=
df
.
project
(
1
-
S
(
exact_capillary_pressure
),
subdomain
.
function_space
[
"
pressure
"
][
"
wetting
"
])
saturation_nw
=
df
.
project
(
1
-
S
(
exact_capillary_pressure
),
subdomain
.
function_space
[
"
pressure
"
][
"
wetting
"
])
# saturation_nw.assign(S_nw)
# saturation_nw.assign(S_nw)
saturation_nw
.
rename
(
"
Snw
"
,
"
Snw
"
)
saturation_nw
.
rename
(
"
Snw
_exact
"
,
"
Snw
_exact
"
)
file
.
write
(
saturation_nw
,
timestep
)
file
.
write
(
saturation_nw
,
timestep
)
...
@@ -1459,63 +1459,63 @@ class LDDsimulation(object):
...
@@ -1459,63 +1459,63 @@ class LDDsimulation(object):
)
)
# def post_processing(self):
def
post_processing
(
self
):
# """post processing of the simulation.
"""
post processing of the simulation.
# calculate
calculate
# - pc_exact and pc_num
- pc_exact and pc_num
# - absolute differences to exact solution if present.
- absolute differences to exact solution if present.
# - relative errors to exact solution if present
- relative errors to exact solution if present
# """
"""
# for subdom_ind, subdomain in self.subdomain.items():
for
subdom_ind
,
subdomain
in
self
.
subdomain
.
items
():
# self._mesh = df.Mesh()
self
.
_mesh
=
df
.
Mesh
()
# solution_file = self.solution_file[subdom_ind]
solution_file
=
self
.
solution_file
[
subdom_ind
]
# post_solution_file = self.postprocessed_solution_file[subdom_ind]
post_solution_file
=
self
.
postprocessed_solution_file
[
subdom_ind
]
# pressure = dict()
pressure
=
dict
()
# # the internal time series counter in df.XDMFFile starts at 0 and
# the internal time series counter in df.XDMFFile starts at 0 and
# # refers to the first saved value. This corresponds to the initial
# refers to the first saved value. This corresponds to the initial
# # values. We then calculated self.number_of_timesteps many timesteps.
# values. We then calculated self.number_of_timesteps many timesteps.
# t = self.starttime
t
=
self
.
starttime
# for internal_timestep in range(self.number_of_timesteps+1):
for
internal_timestep
in
range
(
self
.
number_of_timesteps
+
1
):
for
phase
in
subdomain
.
has_phases
:
pressure
.
update
(
{
phase
:
df
.
Function
(
subdomain
.
function_space
[
"
pressure
"
][
phase
])}
)
phase_pressure_string
=
"
pressure_
"
+
"
{}
"
.
format
(
phase
)
solution_file
.
read_checkpoint
(
u
=
pressure
[
phase
],
name
=
phase_pressure_string
,
counter
=
internal_timestep
)
pressure
[
phase
].
rename
(
"
pressure_
"
+
"
{}
"
.
format
(
phase
),
"
pressure_
"
+
"
{}
"
.
format
(
phase
))
post_solution_file
.
write
(
pressure
[
phase
],
t
)
t
+=
self
.
timestep_size
print
(
f
"
read pressure of
{
phase
}
phase:
"
)
print
(
pressure
[
phase
].
vector
()[:])
solution_file
.
close
()
# # if we have an exact solution, write out the |u -uh|_L2 to see the
# # absolute error.
# if subdomain.pressure_exact is not None:
# relative_L2_errornorm = dict()
# for phase in subdomain.has_phases:
# for phase in subdomain.has_phases:
# pressure.update(
# pa_exact = subdomain.pressure_exact[phase]
# {phase: df.Function(subdomain.function_space["pressure"][phase])}
# pa_exact.t = self.t
# norm_pa_exact = df.norm(pa_exact, norm_type='L2', mesh=subdomain.mesh)
# error_calculated = df.errornorm(pa_exact, subdomain.pressure[phase], 'L2', degree_rise=6)
# if norm_pa_exact > self.tol:
# relative_L2_errornorm.update(
# {phase: error_calculated/norm_pa_exact}
# )
# else:
# relative_L2_errornorm.update(
# {phase: error_calculated}
# )
# )
# phase_pressure_string = "pressure_"+"{}".format(phase)
# errornorm_filename = self.output_dir+self.output_filename_parameter_part[subdom_ind]+\
# solution_file.read_checkpoint(
# "_L2_errornorms_over_time" +".csv"
# u=pressure[phase],
# self.write_errornorms_to_csv(
# name=phase_pressure_string,
# filename = errornorm_filename, #
# counter=internal_timestep
# subdomain_index = subdom_ind,
# errors = relative_L2_errornorm,
# )
# )
# pressure[phase].rename("pressure_"+"{}".format(phase), "pressure_"+"{}".format(phase))
# post_solution_file.write(pressure[phase], t)
# t += self.timestep_size
# print(f"read pressure of {phase}phase:")
# print(pressure[phase].vector()[:])
# solution_file.close()
# # # if we have an exact solution, write out the |u -uh|_L2 to see the
# # # absolute error.
# # if subdomain.pressure_exact is not None:
# # relative_L2_errornorm = dict()
# # for phase in subdomain.has_phases:
# # pa_exact = subdomain.pressure_exact[phase]
# # pa_exact.t = self.t
# # norm_pa_exact = df.norm(pa_exact, norm_type='L2', mesh=subdomain.mesh)
# # error_calculated = df.errornorm(pa_exact, subdomain.pressure[phase], 'L2', degree_rise=6)
# # if norm_pa_exact > self.tol:
# # relative_L2_errornorm.update(
# # {phase: error_calculated/norm_pa_exact}
# # )
# # else:
# # relative_L2_errornorm.update(
# # {phase: error_calculated}
# # )
# # errornorm_filename = self.output_dir+self.output_filename_parameter_part[subdom_ind]+\
# # "_L2_errornorms_over_time" +".csv"
# # self.write_errornorms_to_csv(
# # filename = errornorm_filename, #
# # subdomain_index = subdom_ind,
# # errors = relative_L2_errornorm,
# # )
def
_init_exact_solution_expression
(
self
):
def
_init_exact_solution_expression
(
self
):
...
...
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