Commit 47f9699a authored by Lambert Theisen's avatar Lambert Theisen
Browse files

Ad rescale_pressure keyword

- Should be disabled when using inflow model because pressure is determined uniquely
parent 46bb5407
Pipeline #170321 passed with stages
in 9 minutes and 11 seconds
......@@ -100,6 +100,10 @@ class Input:
"type": "boolean",
"required": True
},
"rescale_pressure": {
"type": "boolean",
"required": True
},
}
},
"case_name": {
......
......@@ -76,6 +76,7 @@ class Solver:
)
self.exact_solution = self.params["convergence_study"]["exact_solution"]
self.rescale_p = self.params["convergence_study"]["rescale_pressure"]
self.output_folder = self.params["case_name"] + "/"
self.var_ranks = {
"theta": 0,
......@@ -412,13 +413,14 @@ class Solver:
) = sol.split()
if self.mode == "stress" or self.mode == "coupled":
# Scale pressure to have zero mean
p_i = df.interpolate(self.sol["p"], self.fspaces["p"])
mean_p_value = self.calc_sf_mean(p_i)
mean_p_fct = df.Function(self.fspaces["p"])
mean_p_fct.assign(df.Constant(mean_p_value))
p_i.assign(p_i - mean_p_fct)
self.sol["p"] = p_i
if self.rescale_p:
# Scale pressure to have zero mean
p_i = df.interpolate(self.sol["p"], self.fspaces["p"])
mean_p_value = self.calc_sf_mean(p_i)
mean_p_fct = df.Function(self.fspaces["p"])
mean_p_fct.assign(df.Constant(mean_p_value))
p_i.assign(p_i - mean_p_fct)
self.sol["p"] = p_i
def load_exact_solution(self):
"Writes exact solution"
......
......@@ -12,9 +12,9 @@ meshes:
- ../mesh/ring3.h5
- ../mesh/ring4.h5
- ../mesh/ring5.h5
# - ../mesh/ring6.h5 # fails on Macbook 8GB
# - ../mesh/ring7.h5 # fails on iMac 24GB, works on iMac 48GB
# - ../mesh/ring6.h5
- ../mesh/ring6.h5 # fails on Macbook 8GB
# - ../mesh/ring7.h5 # works on iMac 48GB
# - ../mesh/ring8.h5
elements:
theta:
......@@ -88,3 +88,4 @@ convergence_study:
exact_solution: esols/1_coeffs_nosources_norot_inflow.cpp
plot: True
write_systemmatrix: False
rescale_pressure: False
......@@ -88,3 +88,4 @@ convergence_study:
exact_solution: esols/1_coeffs_sources_rot.cpp
plot: False
write_systemmatrix: False
rescale_pressure: True
......@@ -90,3 +90,4 @@ convergence_study:
exact_solution: esols/1_coeffs_sources_rot.cpp
plot: False
write_systemmatrix: False
rescale_pressure: True
......@@ -86,3 +86,4 @@ convergence_study:
exact_solution: esols/01_coeffs.cpp
plot: False # to avoid error exit code due to $DISPLAY
write_systemmatrix: False
rescale_pressure: True
......@@ -86,3 +86,4 @@ convergence_study:
exact_solution: esols/01_coeffs.cpp
plot: False # to avoid error exit code due to $DISPLAY
write_systemmatrix: False
rescale_pressure: True
......@@ -88,3 +88,4 @@ convergence_study:
exact_solution: esols/01_coeffs.cpp
plot: False # to avoid error exit code due to $DISPLAY
write_systemmatrix: False
rescale_pressure: True
......@@ -86,3 +86,4 @@ convergence_study:
exact_solution: esols/01_nocoeffs.cpp
plot: False # to avoid error exit code due to $DISPLAY
write_systemmatrix: False
rescale_pressure: True
......@@ -86,3 +86,4 @@ convergence_study:
exact_solution: esols/10_coeffs.cpp
plot: False # to avoid error exit code due to $DISPLAY
write_systemmatrix: False
rescale_pressure: True
......@@ -32,5 +32,5 @@ def create_mesh(exponent):
return (mesh, subdomains, boundaries)
for p in range(4+1, 7+1):
for p in range(5, 7+1):
create_mesh(p)
......@@ -88,3 +88,4 @@ convergence_study:
exact_solution: esols/01_nosource_rot.cpp
plot: False
write_systemmatrix: False
rescale_pressure: True
......@@ -88,3 +88,4 @@ convergence_study:
exact_solution: esols/01_source_norot.cpp
plot: False
write_systemmatrix: False
rescale_pressure: True
......@@ -88,3 +88,4 @@ convergence_study:
exact_solution: esols/01_source_rot.cpp
plot: False
write_systemmatrix: False
rescale_pressure: True
......@@ -88,3 +88,4 @@ convergence_study:
exact_solution: esols/01_source_rot.cpp
plot: False
write_systemmatrix: False
rescale_pressure: True
......@@ -88,3 +88,4 @@ convergence_study:
exact_solution: esols/01_source_rot.cpp
plot: False
write_systemmatrix: False
rescale_pressure: True
......@@ -88,3 +88,4 @@ convergence_study:
exact_solution: esols/10_source_rot.cpp
plot: False
write_systemmatrix: False
rescale_pressure: True
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment