Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Lambert Theisen
fenicsR13
Commits
5a74b7c0
Commit
5a74b7c0
authored
Aug 09, 2019
by
Lambert Theisen
Browse files
Change style of input files
- Allows for either float or cpp string containing phi, R, tau
parent
44f3785f
Changes
19
Hide whitespace changes
Inline
Side-by-side
src/input.py
View file @
5a74b7c0
...
...
@@ -50,34 +50,34 @@ class Input:
"type"
:
"dict"
,
"schema"
:
{
"theta_w"
:
{
'
anyof
'
:
[{
'
type
'
:
"string"
},
{
'
type
'
:
"float"
}],
"
anyof
"
:
[{
"
type
"
:
"string"
},
{
"
type
"
:
"float"
}],
"required"
:
True
,
},
"v_t"
:
{
'
anyof
'
:
[{
'
type
'
:
"string"
},
{
'
type
'
:
"float"
}],
"
anyof
"
:
[{
"
type
"
:
"string"
},
{
"
type
"
:
"float"
}],
"required"
:
True
},
"v_n"
:
{
'
anyof
'
:
[{
'
type
'
:
"string"
},
{
'
type
'
:
"float"
}],
"
anyof
"
:
[{
"
type
"
:
"string"
},
{
"
type
"
:
"float"
}],
"required"
:
True
},
"p_w"
:
{
'
anyof
'
:
[{
'
type
'
:
"string"
},
{
'
type
'
:
"float"
}],
"
anyof
"
:
[{
"
type
"
:
"string"
},
{
"
type
"
:
"float"
}],
"required"
:
True
},
"gamma"
:
{
'
anyof
'
:
[{
'
type
'
:
"string"
},
{
'
type
'
:
"float"
}],
"
anyof
"
:
[{
"
type
"
:
"string"
},
{
"
type
"
:
"float"
}],
"required"
:
True
},
}
}
},
"heat_source"
:
{
"type"
:
"string"
,
"anyof"
:
[{
"type"
:
"string"
},
{
"type"
:
"float"
}]
,
"required"
:
True
,
},
"mass_source"
:
{
"type"
:
"string"
,
"anyof"
:
[{
"type"
:
"string"
},
{
"type"
:
"float"
}]
,
"required"
:
True
,
},
"convergence_study"
:
{
...
...
src/solver.py
View file @
5a74b7c0
...
...
@@ -57,6 +57,7 @@ class Solver:
self
.
phi
=
df
.
Expression
(
"atan2(x[1],x[0])"
,
degree
=
2
)
# Create boundary field expressions
# FIXME: Create function to create dolfin expression, also for sources
self
.
bcs
=
copy
.
deepcopy
(
self
.
params
[
"bcs"
])
for
edge_id
in
self
.
bcs
:
for
field
in
self
.
bcs
[
edge_id
].
keys
():
...
...
@@ -66,11 +67,11 @@ class Solver:
)
self
.
heat_source
=
df
.
Expression
(
self
.
params
[
"heat_source"
],
degree
=
2
,
str
(
self
.
params
[
"heat_source"
]
)
,
degree
=
2
,
tau
=
self
.
tau
,
phi
=
self
.
phi
,
R
=
self
.
R
)
self
.
mass_source
=
df
.
Expression
(
self
.
params
[
"mass_source"
],
degree
=
2
,
str
(
self
.
params
[
"mass_source"
]
)
,
degree
=
2
,
tau
=
self
.
tau
,
phi
=
self
.
phi
,
R
=
self
.
R
)
...
...
tests/coupled/inputs/1_coeffs_sources_rot_p1p1p1p1p1_stab.yml
View file @
5a74b7c0
...
...
@@ -17,21 +17,21 @@ meshes:
# - ../mesh/ring6.h5
elements
:
"
theta
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
s"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
p"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
u"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
sigma
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
theta
:
shape
:
Lagrange
degree
:
1
s
:
shape
:
Lagrange
degree
:
1
p
:
shape
:
Lagrange
degree
:
1
u
:
shape
:
Lagrange
degree
:
1
sigma
:
shape
:
Lagrange
degree
:
1
# Stabilization
# =============
...
...
@@ -50,7 +50,7 @@ stabilization:
nsd
:
2
# heat, stress, coupled
mode
:
"
coupled
"
mode
:
coupled
# Coefficients as in westerkamp2019 or without as in torrilhon2017
use_coeffs
:
True
...
...
@@ -77,10 +77,10 @@ bcs:
gamma
:
0
# heat source
heat_source
:
"
0"
heat_source
:
0
# mass source
mass_source
:
"
1.0
*
(1.0
-
(5.0*pow(R,2))/(18.0*pow(tau,2)))
*
cos(phi)
"
mass_source
:
1.0 * (1.0 - (5.0*pow(R,2))/(18.0*pow(tau,2))) * cos(phi)
# Perform convergence study on given set of meshes with exact solution
convergence_study
:
...
...
tests/coupled/inputs/1_coeffs_sources_rot_p2p2p2p2p2_stab.yml
View file @
5a74b7c0
...
...
@@ -17,21 +17,21 @@ meshes:
# - ../mesh/ring6.h5
elements
:
"
theta
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
2
"
s"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
2
"
p"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
2
"
u"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
2
"
sigma
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
2
theta
:
shape
:
Lagrange
degree
:
2
s
:
shape
:
Lagrange
degree
:
2
p
:
shape
:
Lagrange
degree
:
2
u
:
shape
:
Lagrange
degree
:
2
sigma
:
shape
:
Lagrange
degree
:
2
# Stabilization
# =============
...
...
@@ -50,7 +50,7 @@ stabilization:
nsd
:
2
# heat, stress, coupled
mode
:
"
coupled
"
mode
:
coupled
# Coefficients as in westerkamp2019 or without as in torrilhon2017
use_coeffs
:
True
...
...
@@ -79,10 +79,10 @@ bcs:
# heat source
heat_source
:
"
0"
heat_source
:
0
# mass source
mass_source
:
"
1.0
*
(1.0
-
(5.0*pow(R,2))/(18.0*pow(tau,2)))
*
cos(phi)
"
mass_source
:
1.0 * (1.0 - (5.0*pow(R,2))/(18.0*pow(tau,2))) * cos(phi)
# Perform convergence study on given set of meshes with exact solution
convergence_study
:
...
...
tests/coupled/test_coupled_convergence.py
View file @
5a74b7c0
...
...
@@ -35,10 +35,10 @@ class TestCoupledConvergence(object):
"diff", "-u", "--strip-trailing-cr", errorsfile, ref_errorsfile
], cwd=self.working_dir)
"""
subprocess
.
check_
call
([
print
(
subprocess
.
check_
output
([
"numdiff"
,
"-s"
,
"
\"\n\r
,
\"
"
,
"-a"
,
"1E-10"
,
errorsfile
,
ref_errorsfile
],
cwd
=
self
.
working_dir
)
],
cwd
=
self
.
working_dir
)
)
# @pytest.fixture(scope="module", autouse=True)
@
pytest
.
mark
.
skip
(
reason
=
"Not needed because meshes are in repo"
)
...
...
tests/full/inputs/1_coeffs_p1p1p1p1p1_stab.yml
View file @
5a74b7c0
...
...
@@ -17,21 +17,21 @@ meshes:
# - ../mesh/ring6.h5
elements
:
"
theta
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
s"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
p"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
u"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
sigma
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
theta
:
shape
:
Lagrange
degree
:
1
s
:
shape
:
Lagrange
degree
:
1
p
:
shape
:
Lagrange
degree
:
1
u
:
shape
:
Lagrange
degree
:
1
sigma
:
shape
:
Lagrange
degree
:
1
# Stabilization
# =============
...
...
@@ -50,7 +50,7 @@ stabilization:
nsd
:
2
# heat, stress, coupled
mode
:
"
coupled
"
mode
:
coupled
# Coefficients as in westerkamp2019 or without as in torrilhon2017
use_coeffs
:
True
...
...
@@ -77,10 +77,10 @@ bcs:
gamma
:
pow(10,+3)
# heat source
heat_source
:
"
0"
heat_source
:
0
# mass source
mass_source
:
"
0"
mass_source
:
0
# Perform convergence study on given set of meshes with exact solution
convergence_study
:
...
...
tests/heat/inputs/01_coeffs_p1p1_stab.yml
View file @
5a74b7c0
...
...
@@ -16,21 +16,21 @@ meshes:
# - ../mesh/ring7.h5 # fails at 8GB with P1P1
elements
:
"
theta
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
s"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
p"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
u"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
sigma
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
theta
:
shape
:
Lagrange
degree
:
1
s
:
shape
:
Lagrange
degree
:
1
p
:
shape
:
Lagrange
degree
:
1
u
:
shape
:
Lagrange
degree
:
1
sigma
:
shape
:
Lagrange
degree
:
1
# Stabilization
# =============
...
...
@@ -49,7 +49,7 @@ stabilization:
nsd
:
2
# heat, stress, coupled
mode
:
"
heat
"
mode
:
heat
# Coefficients as in westerkamp2019 or without as in torrilhon2017
use_coeffs
:
True
...
...
@@ -75,10 +75,10 @@ bcs:
gamma
:
0
# heat source
heat_source
:
"
2.0
-
1.0
*
pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
"
heat_source
:
2.0 - 1.0 * pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
# mass source
mass_source
:
"
2.0/5.0
*
(1.0
-
(5.0*std::pow(sqrt(pow(x[0],2)+pow(x[1],2)),2))/(18.0*pow(tau,2)))
*
std::cos(phi)
"
mass_source
:
2.0/5.0 * (1.0 - (5.0*std::pow(sqrt(pow(x[0],2)+pow(x[1],2)),2))/(18.0*pow(tau,2))) * std::cos(phi)
# Perform convergence study on given set of meshes with exact solution
convergence_study
:
...
...
tests/heat/inputs/01_coeffs_p1p2_nostab.yml
View file @
5a74b7c0
...
...
@@ -16,21 +16,21 @@ meshes:
# - ../mesh/ring7.h5 # fails at 8GB with P1P1
elements
:
"
theta
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
s"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
2
"
p"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
u"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
sigma
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
theta
:
shape
:
Lagrange
degree
:
1
s
:
shape
:
Lagrange
degree
:
2
p
:
shape
:
Lagrange
degree
:
1
u
:
shape
:
Lagrange
degree
:
1
sigma
:
shape
:
Lagrange
degree
:
1
# Stabilization
# =============
...
...
@@ -49,7 +49,7 @@ stabilization:
nsd
:
2
# heat, stress, coupled
mode
:
"
heat
"
mode
:
heat
# Coefficients as in westerkamp2019 or without as in torrilhon2017
use_coeffs
:
True
...
...
@@ -75,10 +75,10 @@ bcs:
gamma
:
0
# heat source
heat_source
:
"
2.0
-
1.0
*
pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
"
heat_source
:
2.0 - 1.0 * pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
# mass source
mass_source
:
"
2.0/5.0
*
(1.0
-
(5.0*std::pow(sqrt(pow(x[0],2)+pow(x[1],2)),2))/(18.0*pow(tau,2)))
*
std::cos(phi)
"
mass_source
:
2.0/5.0 * (1.0 - (5.0*std::pow(sqrt(pow(x[0],2)+pow(x[1],2)),2))/(18.0*pow(tau,2))) * std::cos(phi)
# Perform convergence study on given set of meshes with exact solution
convergence_study
:
...
...
tests/heat/inputs/01_coeffs_p2p2_stab.yml
View file @
5a74b7c0
...
...
@@ -18,21 +18,21 @@ meshes:
# - ../mesh/ring9.h5
elements
:
"
theta
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
2
"
s"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
2
"
p"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
u"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
sigma
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
theta
:
shape
:
Lagrange
degree
:
2
s
:
shape
:
Lagrange
degree
:
2
p
:
shape
:
Lagrange
degree
:
1
u
:
shape
:
Lagrange
degree
:
1
sigma
:
shape
:
Lagrange
degree
:
1
# Stabilization
# =============
...
...
@@ -51,7 +51,7 @@ stabilization:
nsd
:
2
# heat, stress, coupled
mode
:
"
heat
"
mode
:
heat
# Coefficients as in westerkamp2019 or without as in torrilhon2017
use_coeffs
:
True
...
...
@@ -77,10 +77,10 @@ bcs:
gamma
:
0
# heat source
heat_source
:
"
2.0
-
1.0
*
pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
"
heat_source
:
2.0 - 1.0 * pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
# mass source
mass_source
:
"
2.0/5.0
*
(1.0
-
(5.0*std::pow(sqrt(pow(x[0],2)+pow(x[1],2)),2))/(18.0*pow(tau,2)))
*
std::cos(phi)
"
mass_source
:
2.0/5.0 * (1.0 - (5.0*std::pow(sqrt(pow(x[0],2)+pow(x[1],2)),2))/(18.0*pow(tau,2))) * std::cos(phi)
# Perform convergence study on given set of meshes with exact solution
convergence_study
:
...
...
tests/heat/inputs/01_nocoeffs_p1p2_nostab.yml
View file @
5a74b7c0
...
...
@@ -16,21 +16,21 @@ meshes:
# - ../mesh/ring7.h5 # fails at 8GB with P1P1
elements
:
"
theta
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
s"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
2
"
p"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
u"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
sigma
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
theta
:
shape
:
Lagrange
degree
:
1
s
:
shape
:
Lagrange
degree
:
2
p
:
shape
:
Lagrange
degree
:
1
u
:
shape
:
Lagrange
degree
:
1
sigma
:
shape
:
Lagrange
degree
:
1
# Stabilization
# =============
...
...
@@ -49,7 +49,7 @@ stabilization:
nsd
:
2
# heat, stress, coupled
mode
:
"
heat
"
mode
:
heat
# Coefficients as in westerkamp2019 or without as in torrilhon2017
use_coeffs
:
False
...
...
@@ -75,10 +75,10 @@ bcs:
gamma
:
0
# heat source
heat_source
:
"
2.0
-
1.0
*
pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
"
heat_source
:
2.0 - 1.0 * pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
# mass source
mass_source
:
"
2.0/5.0
*
(1.0
-
(5.0*std::pow(sqrt(pow(x[0],2)+pow(x[1],2)),2))/(18.0*pow(tau,2)))
*
std::cos(phi)
"
mass_source
:
2.0/5.0 * (1.0 - (5.0*std::pow(sqrt(pow(x[0],2)+pow(x[1],2)),2))/(18.0*pow(tau,2))) * std::cos(phi)
# Perform convergence study on given set of meshes with exact solution
convergence_study
:
...
...
tests/heat/inputs/10_coeffs_p2p2_stab.yml
View file @
5a74b7c0
...
...
@@ -16,21 +16,21 @@ meshes:
# - ../mesh/ring7.h5 # fails at 8GB with P1P1
elements
:
"
theta
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
s"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
p"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
u"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
sigma
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
theta
:
shape
:
Lagrange
degree
:
1
s
:
shape
:
Lagrange
degree
:
1
p
:
shape
:
Lagrange
degree
:
1
u
:
shape
:
Lagrange
degree
:
1
sigma
:
shape
:
Lagrange
degree
:
1
# Stabilization
# =============
...
...
@@ -49,7 +49,7 @@ stabilization:
nsd
:
2
# heat, stress, coupled
mode
:
"
heat
"
mode
:
heat
# Coefficients as in westerkamp2019 or without as in torrilhon2017
use_coeffs
:
True
...
...
@@ -75,10 +75,10 @@ bcs:
gamma
:
0
# heat source
heat_source
:
"
2.0
-
1.0
*
pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
"
heat_source
:
2.0 - 1.0 * pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)
# mass source
mass_source
:
"
2.0/5.0
*
(1.0
-
(5.0*std::pow(sqrt(pow(x[0],2)+pow(x[1],2)),2))/(18.0*pow(tau,2)))
*
std::cos(phi)
"
mass_source
:
2.0/5.0 * (1.0 - (5.0*std::pow(sqrt(pow(x[0],2)+pow(x[1],2)),2))/(18.0*pow(tau,2))) * std::cos(phi)
# Perform convergence study on given set of meshes with exact solution
convergence_study
:
...
...
tests/heat/test_heat_convergence.py
View file @
5a74b7c0
...
...
@@ -35,10 +35,10 @@ class TestHeatConvergence(object):
"diff", "-u", "--strip-trailing-cr", errorsfile, ref_errorsfile
], cwd=self.working_dir)
"""
subprocess
.
check_
call
([
print
(
subprocess
.
check_
output
([
"numdiff"
,
"-s"
,
"
\"\n\r
,
\"
"
,
"-a"
,
"1E-10"
,
errorsfile
,
ref_errorsfile
],
cwd
=
self
.
working_dir
)
],
cwd
=
self
.
working_dir
)
)
# @pytest.fixture(scope="module", autouse=True)
@
pytest
.
mark
.
skip
(
reason
=
"Not needed because meshes are in repo"
)
...
...
tests/stress/inputs/01_nosource_rot_p1p1p1_stab.yml
View file @
5a74b7c0
...
...
@@ -17,21 +17,21 @@ meshes:
# - ../mesh/ring6.h5
elements
:
"
theta
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
s"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
p"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
u"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
"
sigma
"
:
"
shape
"
:
"
Lagrange
"
"
degree
"
:
1
theta
:
shape
:
Lagrange
degree
:
1
s
:
shape
:
Lagrange
degree
:
1
p
:
shape
:
Lagrange
degree
:
1
u
:
shape
:
Lagrange
degree
:
1
sigma
:
shape
:
Lagrange
degree
:
1
# Stabilization
# =============
...
...
@@ -50,7 +50,7 @@ stabilization:
nsd
:
2