Commit 5a74b7c0 authored by Lambert Theisen's avatar Lambert Theisen
Browse files

Change style of input files

- Allows for either float or cpp string containing phi, R, tau
parent 44f3785f
......@@ -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": {
......
......@@ -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
)
......
......@@ -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:
......
......@@ -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:
......
......@@ -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")
......
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
......@@ -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")
......
......@@ -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