Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
fenicsR13
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lambert Theisen
fenicsR13
Commits
2d9a7181
Commit
2d9a7181
authored
Jul 13, 2020
by
Lambert Theisen
🔥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add write_vec option and lid_two_region example
parent
8817df3b
Pipeline
#307465
passed with stages
in 21 minutes and 50 seconds
Changes
23
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
109 additions
and
3 deletions
+109
-3
examples/channel_flow_force/input.yml
examples/channel_flow_force/input.yml
+2
-0
examples/channel_flow_pressure/input.yml
examples/channel_flow_pressure/input.yml
+2
-0
examples/knudsen_pump/input.yml
examples/knudsen_pump/input.yml
+2
-0
examples/lid_driven_cavity/input.yml
examples/lid_driven_cavity/input.yml
+2
-0
examples/lid_two_regions/input.yml
examples/lid_two_regions/input.yml
+5
-3
examples/test_examples.py
examples/test_examples.py
+8
-0
fenicsR13/input.py
fenicsR13/input.py
+7
-0
fenicsR13/solver.py
fenicsR13/solver.py
+51
-0
tests/heat/inputs/heat_01_coeffs_p1p1_stab.yml
tests/heat/inputs/heat_01_coeffs_p1p1_stab.yml
+2
-0
tests/heat/inputs/heat_01_coeffs_p1p2_nostab.yml
tests/heat/inputs/heat_01_coeffs_p1p2_nostab.yml
+2
-0
tests/heat/inputs/heat_01_coeffs_p2p2_stab.yml
tests/heat/inputs/heat_01_coeffs_p2p2_stab.yml
+2
-0
tests/heat/inputs/heat_10_coeffs_p2p2_stab.yml
tests/heat/inputs/heat_10_coeffs_p2p2_stab.yml
+2
-0
tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml
...s/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml
+2
-0
tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p2p1p1p2_nostab.yml
...r13_1_coeffs_nosources_norot_inflow_p1p2p1p1p2_nostab.yml
+2
-0
tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_stab.yml
...s/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_stab.yml
+2
-0
tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab.yml
...uts/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab.yml
+2
-0
tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab.yml
...uts/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab.yml
+2
-0
tests/stress/inputs/stress_01_nosource_rot_p1p1p1_stab.yml
tests/stress/inputs/stress_01_nosource_rot_p1p1p1_stab.yml
+2
-0
tests/stress/inputs/stress_01_source_norot_p1p1p1_stab.yml
tests/stress/inputs/stress_01_source_norot_p1p1p1_stab.yml
+2
-0
tests/stress/inputs/stress_01_source_rot_p1p1p1_stab.yml
tests/stress/inputs/stress_01_source_rot_p1p1p1_stab.yml
+2
-0
tests/stress/inputs/stress_01_source_rot_p1p2p3_nostab.yml
tests/stress/inputs/stress_01_source_rot_p1p2p3_nostab.yml
+2
-0
tests/stress/inputs/stress_01_source_rot_p2p2p2_stab.yml
tests/stress/inputs/stress_01_source_rot_p2p2p2_stab.yml
+2
-0
tests/stress/inputs/stress_10_source_rot_p1p1p1_stab.yml
tests/stress/inputs/stress_10_source_rot_p1p1p1_stab.yml
+2
-0
No files found.
examples/channel_flow_force/input.yml
View file @
2d9a7181
...
...
@@ -125,9 +125,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
True
write_vecs
:
False
massflow
:
[
3002
]
# Parameter Study
...
...
examples/channel_flow_pressure/input.yml
View file @
2d9a7181
...
...
@@ -125,9 +125,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
True
write_vecs
:
False
massflow
:
[
3002
]
# Parameter Study
...
...
examples/knudsen_pump/input.yml
View file @
2d9a7181
...
...
@@ -154,9 +154,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
True
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
examples/lid_driven_cavity/input.yml
View file @
2d9a7181
...
...
@@ -111,9 +111,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
True
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
examples/lid_two_regions/input.yml
View file @
2d9a7181
# General
# =======
# - output_folder: Used as output folder
output_folder
:
results_lid_
driven_cavity
output_folder
:
results_lid_
two_regions
# Meshes
# ======
...
...
@@ -64,9 +64,9 @@ body_force: [0,0]
# - kn: Knudsen number
regs
:
4000
:
# top
kn
:
0.
08
kn
:
0.
1
4100
:
# bot
kn
:
0.08
kn
:
1.0
# Boundary Conditions
# ===================
...
...
@@ -113,9 +113,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
True
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
examples/test_examples.py
View file @
2d9a7181
...
...
@@ -45,6 +45,14 @@ class TestExamples(object):
self
.
create_meshes
(
working_dir
)
self
.
run_solver
(
"input.yml"
,
working_dir
)
def
test_lid_two_regions
(
self
):
r
"""
Test the lid case with two region.
"""
working_dir
=
"examples/lid_two_regions"
self
.
create_meshes
(
working_dir
)
self
.
run_solver
(
"input.yml"
,
working_dir
)
@
pytest
.
mark
.
skip
(
reason
=
"Skip, needs too much time"
)
def
test_channel_flow_pressure
(
self
):
r
"""
...
...
fenicsR13/input.py
View file @
2d9a7181
...
...
@@ -140,9 +140,12 @@ class Input:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing:
write_pdfs: True
write_vecs: True
massflow: []
# Parameter Study
...
...
@@ -272,6 +275,10 @@ class Input:
"type"
:
"boolean"
,
"required"
:
True
},
"write_vecs"
:
{
"type"
:
"boolean"
,
"required"
:
True
},
"massflow"
:
{
"type"
:
"list"
,
"required"
:
True
,
...
...
fenicsR13/solver.py
View file @
2d9a7181
...
...
@@ -75,6 +75,7 @@ class Solver:
self
.
delta_p
=
self
.
params
[
"stabilization"
][
"cip"
][
"delta_p"
]
self
.
write_pdfs
=
self
.
params
[
"postprocessing"
][
"write_pdfs"
]
self
.
write_vecs
=
self
.
params
[
"postprocessing"
][
"write_vecs"
]
self
.
massflow
=
self
.
params
[
"postprocessing"
][
"massflow"
]
# Create region field expressions
...
...
@@ -1145,6 +1146,8 @@ class Solver:
print
(
"Write fields.."
)
self
.
__write_solutions
()
if
self
.
write_vecs
:
self
.
__write_vecs
()
self
.
__write_parameters
()
if
self
.
write_systemmatrix
:
self
.
__write_discrete_system
()
...
...
@@ -1156,6 +1159,13 @@ class Solver:
if
sols
[
field
]
is
not
None
:
self
.
__write_xdmf
(
field
,
sols
[
field
],
self
.
write_pdfs
)
def
__write_vecs
(
self
):
"""Write all solutions to vectors."""
sols
=
self
.
sol
for
field
in
sols
:
if
sols
[
field
]
is
not
None
:
self
.
__write_vec
(
field
,
sols
[
field
],
self
.
write_pdfs
)
def
__write_parameters
(
self
):
"""
Write parameter functions for debug reasons.
...
...
@@ -1356,3 +1366,44 @@ class Solver:
print
(
"Write {}"
.
format
(
fname_pdf
))
plt
.
savefig
(
fname_pdf
,
dpi
=
150
)
plt
.
close
()
def
__write_vec
(
self
,
name
,
field
,
write_pdf
):
"""
Write a given field to a vector.
"""
dimension
=
len
(
field
.
value_shape
())
if
dimension
==
0
:
# scalar
fname_mat
=
(
self
.
output_folder
+
name
+
"_"
+
str
(
self
.
time
)
+
".mat"
)
np
.
savetxt
(
self
.
output_folder
+
name
+
"_"
+
str
(
self
.
time
)
+
".mat"
,
field
.
compute_vertex_values
()
)
print
(
"Write {}"
.
format
(
fname_mat
))
else
:
# vector or tensor
components
=
len
(
field
.
split
())
indexMap
=
{
1
:
{
1
:
"x"
,
2
:
"y"
},
2
:
{
1
:
"xx"
,
2
:
"xy"
,
3
:
"yx"
,
4
:
"yy"
,
}
}
for
i
in
range
(
components
):
fieldname
=
name
+
"_"
+
str
(
indexMap
[
dimension
][
i
+
1
])
fname_mat
=
(
self
.
output_folder
+
fieldname
+
"_"
+
str
(
self
.
time
)
+
".mat"
)
np
.
savetxt
(
fname_mat
,
field
.
split
()[
i
].
compute_vertex_values
())
print
(
"Write {}"
.
format
(
fname_mat
))
tests/heat/inputs/heat_01_coeffs_p1p1_stab.yml
View file @
2d9a7181
...
...
@@ -118,9 +118,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/heat/inputs/heat_01_coeffs_p1p2_nostab.yml
View file @
2d9a7181
...
...
@@ -118,9 +118,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/heat/inputs/heat_01_coeffs_p2p2_stab.yml
View file @
2d9a7181
...
...
@@ -118,9 +118,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/heat/inputs/heat_10_coeffs_p2p2_stab.yml
View file @
2d9a7181
...
...
@@ -119,9 +119,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml
View file @
2d9a7181
...
...
@@ -118,9 +118,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p2p1p1p2_nostab.yml
View file @
2d9a7181
...
...
@@ -117,9 +117,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_stab.yml
View file @
2d9a7181
...
...
@@ -116,9 +116,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab.yml
View file @
2d9a7181
...
...
@@ -118,9 +118,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab.yml
View file @
2d9a7181
...
...
@@ -116,9 +116,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/stress/inputs/stress_01_nosource_rot_p1p1p1_stab.yml
View file @
2d9a7181
...
...
@@ -118,9 +118,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/stress/inputs/stress_01_source_norot_p1p1p1_stab.yml
View file @
2d9a7181
...
...
@@ -119,9 +119,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/stress/inputs/stress_01_source_rot_p1p1p1_stab.yml
View file @
2d9a7181
...
...
@@ -118,9 +118,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/stress/inputs/stress_01_source_rot_p1p2p3_nostab.yml
View file @
2d9a7181
...
...
@@ -116,9 +116,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/stress/inputs/stress_01_source_rot_p2p2p2_stab.yml
View file @
2d9a7181
...
...
@@ -117,9 +117,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
tests/stress/inputs/stress_10_source_rot_p1p1p1_stab.yml
View file @
2d9a7181
...
...
@@ -119,9 +119,11 @@ convergence_study:
# Postprocessing
# ==============
# - write_pdfs: Write all solution fields as PDF plot
# - write_vecs: Write all solution fields as vectors
# - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds
postprocessing
:
write_pdfs
:
False
write_vecs
:
False
massflow
:
[]
# Parameter Study
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment