diff --git a/examples/channel_flow_force/input.yml b/examples/channel_flow_force/input.yml index 01270481ef3d641e8d9af34c1cffd2c54a47e7b5..b703c78a3ddb14124aa656d96e9cfe02f720daf7 100644 --- a/examples/channel_flow_force/input.yml +++ b/examples/channel_flow_force/input.yml @@ -15,12 +15,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -43,6 +50,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.1 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/examples/channel_flow_pressure/input.yml b/examples/channel_flow_pressure/input.yml index 83d9f477f208f4365516dc23f45454a52fbeceae..3727c2676491b711996e344ad43a343f2dfe3cb2 100644 --- a/examples/channel_flow_pressure/input.yml +++ b/examples/channel_flow_pressure/input.yml @@ -15,12 +15,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -43,6 +50,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.1 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/examples/knudsen_pump/input.yml b/examples/knudsen_pump/input.yml index 2f699f6b6916d35ba5c1156419d23293ad412adf..7c0243a0c3b5fafe9b3ccb09b5f0b9b5d73c07b1 100644 --- a/examples/knudsen_pump/input.yml +++ b/examples/knudsen_pump/input.yml @@ -16,12 +16,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -44,6 +51,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.1 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/examples/lid_driven_cavity/input.yml b/examples/lid_driven_cavity/input.yml index 35edc94a952327b3a96bfb4ff37fdf81f6b5f495..a26931e5967ea83f83a6ca02176859818a4df80d 100644 --- a/examples/lid_driven_cavity/input.yml +++ b/examples/lid_driven_cavity/input.yml @@ -15,12 +15,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -43,6 +50,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.1 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/examples/lid_two_regions/input.yml b/examples/lid_two_regions/input.yml index 656f2ca8677e47cc29ec1aeaf1dc58f00f44a245..f6d35b7ac9c0684ed0b200f622575fc0f45b8e43 100644 --- a/examples/lid_two_regions/input.yml +++ b/examples/lid_two_regions/input.yml @@ -15,12 +15,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -43,6 +50,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.1 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/fenicsR13/input.py b/fenicsR13/input.py index 0d3fb65b472096bacb847a1bfb51f97b86b445af..81e5f18ab6bb79dbea28e169256fe152b9373bcd 100644 --- a/fenicsR13/input.py +++ b/fenicsR13/input.py @@ -46,12 +46,19 @@ class Input: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 - # - stabilization: Must contain cip + # - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge + # - gls: Collection of Garlerkin Least Squares (GLS) parameters + # - enable: Enable GLS stabilization + # - tau_energy: Stabilization with energy eq. residual + # - tau_heatflux: Stabilization with heatflux eq. residual + # - tau_mass: Stabilization with mass eq. residual + # - tau_momentum: Stabilization with momentum eq. residual + # - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -74,6 +81,13 @@ class Input: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== @@ -341,27 +355,59 @@ class Input: "stabilization": { "type": "dict", "required": True, - "keysrules": {"type": "string", "regex": "cip"}, - "valuesrules": { - "type": "dict", - "schema": { - "enable": { - "type": "boolean", - "required": True - }, - "delta_theta": { - "type": "float", - "required": True - }, - "delta_u": { - "type": "float", - "required": True - }, - "delta_p": { - "type": "float", - "required": True - }, - } + "schema": { + "cip": { + "type": "dict", + "required": True, + "schema": { + "enable": { + "type": "boolean", + "required": True + }, + "delta_theta": { + "type": "float", + "required": True + }, + "delta_u": { + "type": "float", + "required": True + }, + "delta_p": { + "type": "float", + "required": True + }, + } + }, + "gls": { + "type": "dict", + "required": True, + "schema": { + "enable": { + "type": "boolean", + "required": True + }, + "tau_energy": { + "type": "float", + "required": True + }, + "tau_heatflux": { + "type": "float", + "required": True + }, + "tau_mass": { + "type": "float", + "required": True + }, + "tau_momentum": { + "type": "float", + "required": True + }, + "tau_stress": { + "type": "float", + "required": True + }, + } + }, } }, "elements": { diff --git a/fenicsR13/solver.py b/fenicsR13/solver.py index c68921a58a6bb43ec47f3b5a54415bf213a65f71..7e3e39f07402a4bb450a085cfdcd2e343bdc968c 100644 --- a/fenicsR13/solver.py +++ b/fenicsR13/solver.py @@ -69,11 +69,21 @@ class Solver: self.cell = self.mesh.ufl_cell() self.time = time self.mode = params["mode"] + + # CIP self.use_cip = self.params["stabilization"]["cip"]["enable"] self.delta_theta = self.params["stabilization"]["cip"]["delta_theta"] self.delta_u = self.params["stabilization"]["cip"]["delta_u"] self.delta_p = self.params["stabilization"]["cip"]["delta_p"] + # GLS + self.use_gls = self.params["stabilization"]["gls"]["enable"] + self.tau_energy = self.params["stabilization"]["gls"]["tau_energy"] + self.tau_heatflux = self.params["stabilization"]["gls"]["tau_heatflux"] + self.tau_mass = self.params["stabilization"]["gls"]["tau_mass"] + self.tau_momentum = self.params["stabilization"]["gls"]["tau_momentum"] + self.tau_stress = self.params["stabilization"]["gls"]["tau_stress"] + self.write_pdfs = self.params["postprocessing"]["write_pdfs"] self.write_vecs = self.params["postprocessing"]["write_vecs"] self.massflow = self.params["postprocessing"]["massflow"] @@ -509,6 +519,11 @@ class Solver: delta_theta = df.Constant(self.delta_theta) delta_u = df.Constant(self.delta_u) delta_p = df.Constant(self.delta_p) + tau_energy = df.Constant(self.tau_energy) + tau_heatflux = df.Constant(self.tau_heatflux) + tau_mass = df.Constant(self.tau_mass) + tau_momentum = df.Constant(self.tau_momentum) + tau_stress = df.Constant(self.tau_stress) # Define custom measeasures for boundary edges and inner edges df.dx = df.Measure("dx", domain=mesh, subdomain_data=regions) @@ -548,11 +563,15 @@ class Solver: else: cpl = 0 - # Stabilization switch + # Stabilization if self.use_cip: cip = 1 else: cip = 0 + if self.use_gls: + gls = 1 + else: + gls = 0 # Setup normal/tangential projections # => tangential (tx,ty) = (-ny,nx) = perp(n) only for 2D @@ -650,7 +669,7 @@ class Solver: df.inner(v, df.grad(p)) ) * df.dx(reg) for reg in regs.keys()]) - # 3) CIP Stabilization: + # 3.1) CIP Stabilization: def j_theta(theta, kappa): return ( + delta_theta * h_avg**3 * @@ -669,6 +688,56 @@ class Solver: df.jump(df.grad(p), n_vec) * df.jump(df.grad(q), n_vec) ) * df.dS + # 3.2) GLS Stabilization + def gls_heat(theta, kappa, s, r): + return sum([( + tau_energy * h_msh**1 * ( + df.inner( + df.div(s) + cpl * df.div(u) - f_heat, + df.div(r) + cpl * df.div(v) + ) + ) # energy + + tau_heatflux * h_msh**1 * + df.inner( + (5 / 2) * df.grad(theta) + - (12 / 5) * regs[reg]["kn"] * df.div(to.stf3d2(df.grad(s))) + - (1 / 6) * regs[reg]["kn"] * 12 * df.grad(df.div(s)) + + 1 / regs[reg]["kn"] * 2 / 3 * s, + (5 / 2) * df.grad(kappa) + - (12 / 5) * regs[reg]["kn"] * df.div(to.stf3d2(df.grad(r))) + - (1 / 6) * regs[reg]["kn"] * 12 * df.grad(df.div(r)) + + 1 / regs[reg]["kn"] * 2 / 3 * r + ) # heatflux + ) * df.dx(reg) for reg in regs.keys()]) + + def gls_stress(p, q, u, v, sigma, psi): + return sum([( + tau_mass * h_msh**1.5 * + df.inner( + df.div(v), df.div(u) - f_mass + ) # mass + + tau_momentum * h_msh**1.5 * + df.inner( + df.grad(q) + df.div(psi), + df.grad(p) + df.div(sigma) - f_body + ) # momentum + + tau_stress * h_msh**1.5 * + df.inner( + cpl * (4 / 5) * to.gen3dTF2(df.grad(r)) + + 2 * to.stf3d2(to.gen3d2(df.grad(v))) + - 2 * regs[reg]["kn"] * to.div3d3( + to.stf3d3(to.grad3dOf2(to.gen3dTF2(psi))) + ) + + (1 / regs[reg]["kn"]) * to.gen3dTF2(psi), + cpl * (4 / 5) * to.gen3dTF2(df.grad(s)) + + 2 * to.stf3d2(to.gen3d2(df.grad(u))) + - 2 * regs[reg]["kn"] * to.div3d3( + to.stf3d3(to.grad3dOf2(to.gen3dTF2(sigma))) + ) + + (1 / regs[reg]["kn"]) * to.gen3dTF2(sigma) + ) # stress + ) * df.dx(reg) for reg in regs.keys()]) + # Setup all equations A = [None] * 5 L = [None] * 5 @@ -701,20 +770,37 @@ class Solver: ) * q ) * df.ds(bc) for bc in bcs.keys()]) - # Combine all equations to compound weak form and add CIP + # Combine all equations to compound weak form and add stabilization if self.mode == "heat": - self.form_lhs = sum(A[0:2]) + cip * j_theta(theta, kappa) - self.form_rhs = sum(L[0:2]) + self.form_lhs = sum(A[0:2]) + ( + cip * (j_theta(theta, kappa)) + + gls * df.lhs(gls_heat(theta, kappa, s, r)) + ) + self.form_rhs = sum(L[0:2]) + ( + gls * df.rhs(gls_heat(theta, kappa, s, r)) + ) elif self.mode == "stress": - self.form_lhs = sum(A[2:5]) + cip * ( - j_u(u, v) + j_p(p, q) + self.form_lhs = sum(A[2:5]) + ( + cip * (j_u(u, v) + j_p(p, q)) + + gls * df.lhs(gls_stress(p, q, u, v, sigma, psi)) + ) + self.form_rhs = sum(L[2:5]) + ( + gls * df.rhs(gls_stress(p, q, u, v, sigma, psi)) ) - self.form_rhs = sum(L[2:5]) elif self.mode == "r13": - self.form_lhs = sum(A) + cip * ( - j_theta(theta, kappa) + j_u(u, v) + j_p(p, q) + self.form_lhs = sum(A) + ( + cip * (j_theta(theta, kappa) + j_u(u, v) + j_p(p, q)) + + gls * df.lhs( + gls_heat(theta, kappa, s, r) + + gls_stress(p, q, u, v, sigma, psi) + ) + ) + self.form_rhs = sum(L) + ( + gls * df.rhs( + gls_heat(theta, kappa, s, r) + + gls_stress(p, q, u, v, sigma, psi) + ) ) - self.form_rhs = sum(L) def solve(self): """ diff --git a/fenicsR13/tensoroperations.py b/fenicsR13/tensoroperations.py index 6cef0792bb3d36d70e651fc023eb9f8f2684b2c5..bfcc8aa14df4c1bc6c8ef20271d85694ba695db6 100644 --- a/fenicsR13/tensoroperations.py +++ b/fenicsR13/tensoroperations.py @@ -23,9 +23,14 @@ import ufl def stf3d2(rank2_2d): r""" - Return the synthetic 3D symmetric and trace-free part of a 2D 2-tensor. + Return the 3D symmetric and trace-free part of a 2D 2-tensor. - Return the synthetic 3D symmetric and trace-free (dev(sym(.))) + .. warning:: + + Return a 2-tensor with the same dimensions as the input tensor. + + For the :math:`2 \times 2` case, return the 3D symmetric and + trace-free (dev(sym(.))) :math:`B \in \mathbb{R}^{2 \times 2}` of the 2D 2-tensor :math:`A \in \mathbb{R}^{2 \times 2}`. @@ -39,8 +44,10 @@ def stf3d2(rank2_2d): B &= (A)_\mathrm{dev} = \frac{1}{2} (A)_\mathrm{sym} - \frac{1}{3} \mathrm{tr}(A) I_{2 \times 2} """ + dim = len(rank2_2d[:, 0]) symm = 1 / 2 * (rank2_2d + ufl.transpose(rank2_2d)) - return symm - (1 / 3) * ufl.tr(symm) * ufl.Identity(2) + + return symm - (1 / 3) * ufl.tr(symm) * ufl.Identity(dim) def sym3d3(rank3_3d): @@ -123,6 +130,27 @@ def stf3d3(rank3_3d): return ufl.as_tensor(tracefree_ijk, (i, j, k)) +def div3d3(rank3_3d): + r""" + Return the 3D divergence of a 3-tensor. + + Return the 3D divergence of a 3-tensor as + + .. math:: + + {(\mathrm{div}(m))}_{ij} = \frac{\partial m_{ijk}}{\partial x_k} + + Compare with [SCH2009]_ (p. 92). + + .. [SCH2009] Heinz Schade, Klaus Neemann (2009). “Tensoranalysis”. + 2. überarbeitete Auflage. + + """ + i, j, k = ufl.indices(3) + div_ij = rank3_3d[i, j, 0].dx(0) + rank3_3d[i, j, 1].dx(1) + return ufl.as_tensor(div_ij, (i, j)) + + def gen3dTF2(rank2_2d): r""" Generate a 3D tracefree 2-tensor from a 2D 2-tensor. @@ -170,6 +198,19 @@ def gen3dTF2(rank2_2d): ]) +def gen3d1(rank1_2d): + r""" + Return synthetic 3d version of 2d vector with zero last component. + + Return synthetic 3d version of 2d vector + :math:`s_{\mathrm{in}} = (s_x, s_y)` + as + :math:`s_{\mathrm{out}} = (s_x, s_y, 0)` + . + """ + return df.as_vector([rank1_2d[0], rank1_2d[1], 0]) + + def gen3d2(rank2_2d): r""" Generate a 3D 2-tensor from a 2D 2-tensor (add zeros to last dimensions). diff --git a/tests/heat/inputs/heat_01_coeffs_p1p1_gls.yml b/tests/heat/inputs/heat_01_coeffs_p1p1_gls.yml new file mode 100644 index 0000000000000000000000000000000000000000..6855e36c00d90c52c914d77ed07bdd65067fad04 --- /dev/null +++ b/tests/heat/inputs/heat_01_coeffs_p1p1_gls.yml @@ -0,0 +1,150 @@ +# General +# ======= +# - output_folder: Used as output folder +output_folder: heat_01_coeffs_p1p1_gls + +# Meshes +# ====== +# - meshes: List of input meshes in h5 format to run simulations on +meshes: + - ../mesh/ring0.h5 + - ../mesh/ring1.h5 + - ../mesh/ring2.h5 + - ../mesh/ring3.h5 + - ../mesh/ring4.h5 + # - ../mesh/ring5.h5 + # - ../mesh/ring6.h5 + # - ../mesh/ring7.h5 + +# Numerical Parameters +# ==================== +# - elements: Must contain the fields: theta, s, p, u, sigma +# - fields: List of FEM parameters (shape, degree) +# - shape: Element shape, e.g. Lagrange +# - degree: Element degree, e.g. 2 +# - stabilization: Must contain cip and gls +# - cip: Collection of Continous Interior Penalty (CIP) parameters +# - enable: Enable CIP stabilization +# - delta_theta: Stabilization of grad(T)*grad(T_test) over edge +# - delta_u: Stabilization of grad(u)*grad(u_test) over edge +# - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual +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 +stabilization: + cip: + enable: False + delta_theta: 1.0 + delta_u: 1.0 + delta_p: 0.1 + gls: + enable: True + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 + +# Formulation Parameters +# ====================== +# - nsd: Number of spatial dimensions == 2 +# - mode: Formulation mode, one of heat, stress, r13 +# - heat_source: Heat source function for mode==heat||r13 +# - mass_source: Mass source function for mode==stress||r13 +# - body_force: Body force for mode==stress||r13 +nsd: 2 +mode: heat +heat_source: 2.0 - 1.0 * pow(sqrt(pow(x[0],2)+pow(x[1],2)),2) +mass_source: 0 +body_force: [0,0] + +# Region Parameters +# ================= +# - regs: Dictionary of all mesh regions +# - reg_id: Must contain the following parameters: +# - kn: Knudsen number +regs: + 4000: + kn: 0.1 + +# Boundary Conditions +# =================== +# - bcs: Dictionary of all boundary IDs from mesh +# - bc_id: must contain the following parameters +# - chi_tilde: Refaction coefficient in Maxwell accomodation model +# - theta_w: Value for temperature at wall +# - u_t_w: Value for tangential velocity at wall +# - u_n_w: Value for normal velocity at wall +# - p_w: Value for pressure at wall +# - epsilon_w: Inflow-model parameter <=> Weight of pressure prescription +bcs: + 3000: + chi_tilde: 1.0 + theta_w: 1.0 + u_t_w: 10 + u_n_w: 0 + p_w: 0 + epsilon_w: 0 + 3100: + chi_tilde: 1.0 + theta_w: 0.5 + u_t_w: 0 + u_n_w: 0 + p_w: 0 + epsilon_w: 0 + +# Convergence Study +# ================= +# - enable: Enable convergence study on given meshes +# - exact_solution: Path to exact solution in cpp-format to compare errors +# - plot: Show errors in matplotlib window. PDF output is always per default. +# - write_systemmatrix: Writes out systemmatrix (LHS) to use for analysis +# - rescale_pressure: Rescale numerical pressure result to have zero mean +# - relative_errors: Use relative errors. If exact sol. is zero, use absolute. +convergence_study: + enable: True + exact_solution: esols/01_coeffs.cpp + plot: False # to avoid error exit code due to $DISPLAY + write_systemmatrix: False + rescale_pressure: True + relative_error: True + +# 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 +# ============== +# - enable: Repeat simulation with different p. values (study) +# - parameter_key: Key as list, e.g. ["elemenets", "p", "degree"] +# - parameter_values: List of value for parameter, e.g. [0.01,0.1,1,10] +parameter_study: + enable: False + parameter_key: [] + parameter_values: [] diff --git a/tests/heat/inputs/heat_01_coeffs_p1p1_stab.yml b/tests/heat/inputs/heat_01_coeffs_p1p1_stab.yml index 41373bad59155ab1a78429960fdd332dfe0cae87..0494a72d0d3e2c51c78fa31f3a4ff65492debf45 100644 --- a/tests/heat/inputs/heat_01_coeffs_p1p1_stab.yml +++ b/tests/heat/inputs/heat_01_coeffs_p1p1_stab.yml @@ -22,12 +22,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -50,6 +57,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.1 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/heat/inputs/heat_01_coeffs_p1p2_nostab.yml b/tests/heat/inputs/heat_01_coeffs_p1p2_nostab.yml index 6a648462a6c5fb3542509d3e145993ce71e8ca6d..157f9e683d74621e746320582f69edb7ec38518e 100644 --- a/tests/heat/inputs/heat_01_coeffs_p1p2_nostab.yml +++ b/tests/heat/inputs/heat_01_coeffs_p1p2_nostab.yml @@ -22,12 +22,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -50,6 +57,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.1 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/heat/inputs/heat_01_coeffs_p2p2_stab.yml b/tests/heat/inputs/heat_01_coeffs_p2p2_stab.yml index 59bcead78c135dc609423eb64f6765ea510b71f3..f2187e1446736c205494061ac12ad4e101ed0973 100644 --- a/tests/heat/inputs/heat_01_coeffs_p2p2_stab.yml +++ b/tests/heat/inputs/heat_01_coeffs_p2p2_stab.yml @@ -22,12 +22,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -50,6 +57,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.1 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/heat/inputs/heat_10_coeffs_p2p2_stab.yml b/tests/heat/inputs/heat_10_coeffs_p2p2_stab.yml index bdcc6ca5269c572ab021dc9727e4a1a6922e8f8e..13aaf21119635c7661328f5d3a665f4ca5a0106b 100644 --- a/tests/heat/inputs/heat_10_coeffs_p2p2_stab.yml +++ b/tests/heat/inputs/heat_10_coeffs_p2p2_stab.yml @@ -23,12 +23,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -51,6 +58,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.1 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/heat/referrors/heat_01_coeffs_p1p1_gls/errors.csv b/tests/heat/referrors/heat_01_coeffs_p1p1_gls/errors.csv new file mode 100644 index 0000000000000000000000000000000000000000..25161438d631d746ac023b99cdf62bff14330943 --- /dev/null +++ b/tests/heat/referrors/heat_01_coeffs_p1p1_gls/errors.csv @@ -0,0 +1,6 @@ +h,theta_L_2,theta_l_inf,sx_L_2,sx_l_inf,sy_L_2,sy_l_inf +0.9886573325052778,1.54827123662,1.62149201521,1.00942185916,0.684408805654,0.969775824979,0.684801384139 +0.6340332990709842,0.420128360844,0.432154380203,0.388393273485,0.307474307318,0.413722499237,0.361539742405 +0.32904683851469807,0.100135627076,0.167627602759,0.09439626861,0.0755590083394,0.0932158354332,0.103316104557 +0.16754966839339377,0.0268103852509,0.0710392978613,0.0233451008299,0.0380664937008,0.0232974633488,0.0286815969682 +0.08734460120995041,0.00638703647334,0.0273399665085,0.00548890785009,0.00663891526245,0.00545952968567,0.00690213773537 diff --git a/tests/heat/test_heat_convergence.py b/tests/heat/test_heat_convergence.py index 85909ae86564715704252f0392ba1789254aaa57..52e5d8f69e263228181d7d4a0ff4698eb81312a4 100644 --- a/tests/heat/test_heat_convergence.py +++ b/tests/heat/test_heat_convergence.py @@ -57,6 +57,24 @@ class TestHeatConvergence(object): """ subprocess.check_call(["python3", "create_meshes.py"], cwd="tests/mesh") + def test_heat_01_coeffs_p1p1_gls(self): + r""" + Execute decoupled heat system test and check with reference errors. + + ============= ======================= + Parameter Value + ============= ======================= + :math:`Kn` :math:`0.1` + Elements :math:`P_1P_1` + Stabilization GLS + ============= ======================= + """ + name = "heat_01_coeffs_p1p1_gls" + self.run_solver("inputs/" + name + ".yml") + errors = name + "/" + "errors.csv" + referrors = "referrors/" + name + "/errors.csv" + self.compare_errors(errors, referrors) + def test_heat_01_coeffs_p1p1_stab(self): r""" Execute decoupled heat system test and check with reference errors. diff --git a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls.yml b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls.yml new file mode 100644 index 0000000000000000000000000000000000000000..29b470c27afa2b8d16f021041db1dd8de63893ce --- /dev/null +++ b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls.yml @@ -0,0 +1,150 @@ +# General +# ======= +# - output_folder: Used as output folder +output_folder: r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls + +# Meshes +# ====== +# - meshes: List of input meshes in h5 format to run simulations on +meshes: + - ../mesh/ring0.h5 + - ../mesh/ring1.h5 + - ../mesh/ring2.h5 + - ../mesh/ring3.h5 + - ../mesh/ring4.h5 + # - ../mesh/ring5.h5 + # - ../mesh/ring6.h5 + # - ../mesh/ring7.h5 + +# Numerical Parameters +# ==================== +# - elements: Must contain the fields: theta, s, p, u, sigma +# - fields: List of FEM parameters (shape, degree) +# - shape: Element shape, e.g. Lagrange +# - degree: Element degree, e.g. 2 +# - stabilization: Must contain cip and gls +# - cip: Collection of Continous Interior Penalty (CIP) parameters +# - enable: Enable CIP stabilization +# - delta_theta: Stabilization of grad(T)*grad(T_test) over edge +# - delta_u: Stabilization of grad(u)*grad(u_test) over edge +# - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual +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 +stabilization: + cip: + enable: False + delta_theta: 1.0 + delta_u: 1.0 + delta_p: 0.01 + gls: + enable: True + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 + +# Formulation Parameters +# ====================== +# - nsd: Number of spatial dimensions == 2 +# - mode: Formulation mode, one of heat, stress, r13 +# - heat_source: Heat source function for mode==heat||r13 +# - mass_source: Mass source function for mode==stress||r13 +# - body_force: Body force for mode==stress||r13 +nsd: 2 +mode: r13 +heat_source: 0 +mass_source: 0 +body_force: [0,0] + +# Region Parameters +# ================= +# - regs: Dictionary of all mesh regions +# - reg_id: Must contain the following parameters: +# - kn: Knudsen number +regs: + 4000: + kn: 1.0 + +# Boundary Conditions +# =================== +# - bcs: Dictionary of all boundary IDs from mesh +# - bc_id: must contain the following parameters +# - chi_tilde: Refaction coefficient in Maxwell accomodation model +# - theta_w: Value for temperature at wall +# - u_t_w: Value for tangential velocity at wall +# - u_n_w: Value for normal velocity at wall +# - p_w: Value for pressure at wall +# - epsilon_w: Inflow-model parameter <=> Weight of pressure prescription +bcs: + 3000: + chi_tilde: 1.0 + theta_w: 1 + u_t_w: 0 + u_n_w: 0 + p_w: 0 + epsilon_w: pow(10,-3) + 3100: + chi_tilde: 1.0 + theta_w: 2 + u_t_w: -1.00 * sin(phi) + u_n_w: +1.00 * cos(phi) + p_w: -0.27 * cos(phi) + epsilon_w: pow(10,+3) + +# Convergence Study +# ================= +# - enable: Enable convergence study on given meshes +# - exact_solution: Path to exact solution in cpp-format to compare errors +# - plot: Show errors in matplotlib window. PDF output is always per default. +# - write_systemmatrix: Writes out systemmatrix (LHS) to use for analysis +# - rescale_pressure: Rescale numerical pressure result to have zero mean +# - relative_errors: Use relative errors. If exact sol. is zero, use absolute. +convergence_study: + enable: True + exact_solution: esols/1_coeffs_nosources_norot_inflow_positive.cpp + plot: False + write_systemmatrix: False + rescale_pressure: False + relative_error: True + +# 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 +# ============== +# - enable: Repeat simulation with different p. values (study) +# - parameter_key: Key as list, e.g. ["elemenets", "p", "degree"] +# - parameter_values: List of value for parameter, e.g. [0.01,0.1,1,10] +parameter_study: + enable: False + parameter_key: [] + parameter_values: [] diff --git a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml index 4d71cbbb66790d64357e36962d424b7ffe98f76f..31deaf639de532e1b86731727fe6b231a5eb7c62 100644 --- a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml +++ b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml @@ -22,12 +22,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -50,6 +57,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p2p1p1p2_nostab.yml b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p2p1p1p2_nostab.yml index 14c4d5f35ab0418dfeab9494d2d474b4d88427c1..6da34550a008f24035510bcd3da714beafb38b3c 100644 --- a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p2p1p1p2_nostab.yml +++ b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p2p1p1p2_nostab.yml @@ -21,12 +21,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -49,6 +56,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_stab.yml b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_stab.yml index ca4e3ff30e3320d8ab45d70931adeb9357a4c4b5..5f30460f54a7f3e4d3670112f21b478a88b26c03 100644 --- a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_stab.yml +++ b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_stab.yml @@ -20,12 +20,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -48,6 +55,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab.yml b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab.yml index c3a53c31866bf443c76a11ab52129c440a420f1a..fd7474a8abfa11f78b197e94193b94880a9cce4f 100644 --- a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab.yml +++ b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab.yml @@ -22,12 +22,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -50,6 +57,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab.yml b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab.yml index 1aca1ce35eaeeb31f1d193e3e5cc1d3d9ea790c2..e58ac1bc3a092b24a18ffebaef3d2fe1b529a076 100644 --- a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab.yml +++ b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab.yml @@ -20,12 +20,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -48,6 +55,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/r13/referrors/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls/errors.csv b/tests/r13/referrors/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls/errors.csv new file mode 100644 index 0000000000000000000000000000000000000000..b5d24d5440920f7fb4e2b4c9bf8bd878b7ca11fa --- /dev/null +++ b/tests/r13/referrors/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls/errors.csv @@ -0,0 +1,6 @@ +h,theta_L_2,theta_l_inf,sx_L_2,sx_l_inf,sy_L_2,sy_l_inf,p_L_2,p_l_inf,ux_L_2,ux_l_inf,uy_L_2,uy_l_inf,sigmaxx_L_2,sigmaxx_l_inf,sigmaxy_L_2,sigmaxy_l_inf,sigmayy_L_2,sigmayy_l_inf +0.9886573325052778,0.180605313071,0.261114230569,0.377807012621,0.306646244746,0.413002680559,0.317306187036,0.316168943416,0.470672089665,1.91599181943,1.06969671752,0.648739970729,0.698682742711,0.808664933249,0.851958111861,1.09942707914,0.595159375448,1.26705484475,1.13814783912 +0.6340332990709842,0.15528892383,0.222440558532,0.249169406581,0.220462494934,0.263565998481,0.21145098483,0.197515549887,0.301427043379,0.796882046201,0.427583880196,0.279701836461,0.284743047308,0.52333139814,0.495456150171,0.647837181536,0.406716508026,0.76698418419,0.627667942693 +0.32904683851469807,0.0609243854636,0.169733939726,0.0840591868686,0.077815069942,0.0946018825755,0.104775999231,0.0713854110081,0.104789584129,0.326036736288,0.196051991843,0.112227133269,0.176450314621,0.206512959909,0.174139380121,0.286476100683,0.191625302388,0.283413370874,0.215322914926 +0.16754966839339377,0.0209231699323,0.0753524519726,0.026555408525,0.032704825765,0.0250525678851,0.0247859112886,0.0223401437921,0.0307390323959,0.0985192883511,0.0903003117193,0.0347113677067,0.0829711137882,0.066948805771,0.0550913992393,0.093050002277,0.0655105695883,0.0929858751815,0.066300113921 +0.08734460120995041,0.00498118391959,0.0256461854468,0.00651868965854,0.00782373825314,0.00627629744909,0.00687484128807,0.00650793370863,0.00974935692896,0.0248769021146,0.0209030082005,0.00964008648834,0.0263561301934,0.0199636758501,0.0175289574347,0.0278166117552,0.0177819509853,0.0279462682097,0.0198214469802 diff --git a/tests/r13/test_r13_convergence.py b/tests/r13/test_r13_convergence.py index e196034a36481da0db7abc51cf0bcad7de15f657..6a61317a0a7e36e99f4188eb20b4e2a93ac1c296 100644 --- a/tests/r13/test_r13_convergence.py +++ b/tests/r13/test_r13_convergence.py @@ -58,70 +58,37 @@ class TestR13Convergence(object): """ subprocess.check_call(["python3", "create_meshes.py"], cwd="tests/mesh") - def test_r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab(self): + def test_r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls(self): r""" Execute full linear R13 system test and check with reference errors. - Test case is similar to [WES2019]_. + Test case is similar to [TOR2017]_. - .. [WES2019] A. Westerkamp and M. Torrilhon. “Finite Element Methods - for the Linear Regularized 13-Moment Equations Describing Slow - Rarefied Gas Flows”. In: Journal of Computational Physics 389 - (2019). + .. [TOR2017] Torrilhon, M. et al. (2017). “Hierarchical Boltzmann + simulations and model error estimation”. In: Journal of + Computational Physics 342 (2017), pp. 66–84. ==================== =================================================== Parameter Value ==================== =================================================== :math:`Kn` :math:`1.0` - :math:`\dot{m}` :math:`(1-\frac{5R^2}{18{Kn}^2})\cos(\phi)` + :math:`\dot{m}` :math:`0` :math:`r` :math:`0` :math:`\theta_w^1` :math:`1.0` - :math:`v_t^1` :math:`10.0` + :math:`v_t^1` :math:`0` :math:`v_n^1` :math:`0` :math:`p_w^1` :math:`0` - :math:`\epsilon_w^1` :math:`0` - :math:`\theta_w^2` :math:`0.5` - :math:`v_t^2` :math:`0.0` - :math:`v_n^2` :math:`0` - :math:`p_w^2` :math:`0` - :math:`\epsilon_w^2` :math:`0` + :math:`\epsilon_w^1` :math:`10^{-3}` + :math:`\theta_w^2` :math:`2.0` + :math:`v_t^2` :math:`-1.00 \sin(\phi)` + :math:`v_n^2` :math:`+1.00 \cos(\phi)` + :math:`p_w^2` :math:`-0.27 \cos(\phi)` + :math:`\epsilon_w^2` :math:`10^{3}` Elements :math:`P_1P_1P_1P_1P_1` - Stabilization CIP: :math:`\delta_\theta,\delta_u=1,\delta_p=0.01` + Stabilization GLS ==================== =================================================== """ - name = "r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab" - self.run_solver("inputs/" + name + ".yml") - errors = name + "/" + "errors.csv" - referrors = "referrors/" + name + "/errors.csv" - self.compare_errors(errors, referrors) - - def test_r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab(self): - r""" - Execute full linear R13 system test and check with reference errors. - - Test case is similar to [WES2019]_. - - ==================== =================================================== - Parameter Value - ==================== =================================================== - :math:`Kn` :math:`1.0` - :math:`\dot{m}` :math:`(1-\frac{5R^2}{18{Kn}^2})\cos(\phi)` - :math:`r` :math:`0` - :math:`\theta_w^1` :math:`1.0` - :math:`v_t^1` :math:`10.0` - :math:`v_n^1` :math:`0` - :math:`p_w^1` :math:`0` - :math:`\epsilon_w^1` :math:`0` - :math:`\theta_w^2` :math:`0.5` - :math:`v_t^2` :math:`0.0` - :math:`v_n^2` :math:`0` - :math:`p_w^2` :math:`0` - :math:`\epsilon_w^2` :math:`0` - Elements :math:`P_2P_2P_2P_2P_2` - Stabilization CIP: :math:`\delta_\theta,\delta_u=1,\delta_p=0.01` - ==================== =================================================== - """ - name = "r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab" + name = "r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls" self.run_solver("inputs/" + name + ".yml") errors = name + "/" + "errors.csv" referrors = "referrors/" + name + "/errors.csv" @@ -236,3 +203,72 @@ class TestR13Convergence(object): errors = name + "/" + "errors.csv" referrors = "referrors/" + name + "/errors.csv" self.compare_errors(errors, referrors) + + def test_r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab(self): + r""" + Execute full linear R13 system test and check with reference errors. + + Test case is similar to [WES2019]_. + + .. [WES2019] A. Westerkamp and M. Torrilhon. “Finite Element Methods + for the Linear Regularized 13-Moment Equations Describing Slow + Rarefied Gas Flows”. In: Journal of Computational Physics 389 + (2019). + + ==================== =================================================== + Parameter Value + ==================== =================================================== + :math:`Kn` :math:`1.0` + :math:`\dot{m}` :math:`(1-\frac{5R^2}{18{Kn}^2})\cos(\phi)` + :math:`r` :math:`0` + :math:`\theta_w^1` :math:`1.0` + :math:`v_t^1` :math:`10.0` + :math:`v_n^1` :math:`0` + :math:`p_w^1` :math:`0` + :math:`\epsilon_w^1` :math:`0` + :math:`\theta_w^2` :math:`0.5` + :math:`v_t^2` :math:`0.0` + :math:`v_n^2` :math:`0` + :math:`p_w^2` :math:`0` + :math:`\epsilon_w^2` :math:`0` + Elements :math:`P_1P_1P_1P_1P_1` + Stabilization CIP: :math:`\delta_\theta,\delta_u=1,\delta_p=0.01` + ==================== =================================================== + """ + name = "r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab" + self.run_solver("inputs/" + name + ".yml") + errors = name + "/" + "errors.csv" + referrors = "referrors/" + name + "/errors.csv" + self.compare_errors(errors, referrors) + + def test_r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab(self): + r""" + Execute full linear R13 system test and check with reference errors. + + Test case is similar to [WES2019]_. + + ==================== =================================================== + Parameter Value + ==================== =================================================== + :math:`Kn` :math:`1.0` + :math:`\dot{m}` :math:`(1-\frac{5R^2}{18{Kn}^2})\cos(\phi)` + :math:`r` :math:`0` + :math:`\theta_w^1` :math:`1.0` + :math:`v_t^1` :math:`10.0` + :math:`v_n^1` :math:`0` + :math:`p_w^1` :math:`0` + :math:`\epsilon_w^1` :math:`0` + :math:`\theta_w^2` :math:`0.5` + :math:`v_t^2` :math:`0.0` + :math:`v_n^2` :math:`0` + :math:`p_w^2` :math:`0` + :math:`\epsilon_w^2` :math:`0` + Elements :math:`P_2P_2P_2P_2P_2` + Stabilization CIP: :math:`\delta_\theta,\delta_u=1,\delta_p=0.01` + ==================== =================================================== + """ + name = "r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab" + self.run_solver("inputs/" + name + ".yml") + errors = name + "/" + "errors.csv" + referrors = "referrors/" + name + "/errors.csv" + self.compare_errors(errors, referrors) diff --git a/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_gls.yml b/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_gls.yml new file mode 100644 index 0000000000000000000000000000000000000000..91b9200aeeeeff2cdad536d2de194c47238c65e9 --- /dev/null +++ b/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_gls.yml @@ -0,0 +1,150 @@ +# General +# ======= +# - output_folder: Used as output folder +output_folder: stress_01_nosource_rot_p1p1p1_gls + +# Meshes +# ====== +# - meshes: List of input meshes in h5 format to run simulations on +meshes: + - ../mesh/ring0.h5 + - ../mesh/ring1.h5 + - ../mesh/ring2.h5 + - ../mesh/ring3.h5 + - ../mesh/ring4.h5 + # - ../mesh/ring5.h5 + # - ../mesh/ring6.h5 + # - ../mesh/ring7.h5 + +# Numerical Parameters +# ==================== +# - elements: Must contain the fields: theta, s, p, u, sigma +# - fields: List of FEM parameters (shape, degree) +# - shape: Element shape, e.g. Lagrange +# - degree: Element degree, e.g. 2 +# - stabilization: Must contain cip and gls +# - cip: Collection of Continous Interior Penalty (CIP) parameters +# - enable: Enable CIP stabilization +# - delta_theta: Stabilization of grad(T)*grad(T_test) over edge +# - delta_u: Stabilization of grad(u)*grad(u_test) over edge +# - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual +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 +stabilization: + cip: + enable: False + delta_theta: 1.0 + delta_u: 1.0 + delta_p: 0.01 + gls: + enable: True + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 + +# Formulation Parameters +# ====================== +# - nsd: Number of spatial dimensions == 2 +# - mode: Formulation mode, one of heat, stress, r13 +# - heat_source: Heat source function for mode==heat||r13 +# - mass_source: Mass source function for mode==stress||r13 +# - body_force: Body force for mode==stress||r13 +nsd: 2 +mode: stress +heat_source: 0 +mass_source: 0 +body_force: [0,0] + +# Region Parameters +# ================= +# - regs: Dictionary of all mesh regions +# - reg_id: Must contain the following parameters: +# - kn: Knudsen number +regs: + 4000: + kn: 0.1 + +# Boundary Conditions +# =================== +# - bcs: Dictionary of all boundary IDs from mesh +# - bc_id: must contain the following parameters +# - chi_tilde: Refaction coefficient in Maxwell accomodation model +# - theta_w: Value for temperature at wall +# - u_t_w: Value for tangential velocity at wall +# - u_n_w: Value for normal velocity at wall +# - p_w: Value for pressure at wall +# - epsilon_w: Inflow-model parameter <=> Weight of pressure prescription +bcs: + 3000: + chi_tilde: 1.0 + theta_w: 1.0 + u_t_w: -10 + u_n_w: 0 + p_w: 0 + epsilon_w: 0 + 3100: + chi_tilde: 1.0 + theta_w: 0.5 + u_t_w: 0 + u_n_w: 0 + p_w: 0 + epsilon_w: 0 + +# Convergence Study +# ================= +# - enable: Enable convergence study on given meshes +# - exact_solution: Path to exact solution in cpp-format to compare errors +# - plot: Show errors in matplotlib window. PDF output is always per default. +# - write_systemmatrix: Writes out systemmatrix (LHS) to use for analysis +# - rescale_pressure: Rescale numerical pressure result to have zero mean +# - relative_errors: Use relative errors. If exact sol. is zero, use absolute. +convergence_study: + enable: True + exact_solution: esols/01_nosource_rot.cpp + plot: False + write_systemmatrix: False + rescale_pressure: True + relative_error: True + +# 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 +# ============== +# - enable: Repeat simulation with different p. values (study) +# - parameter_key: Key as list, e.g. ["elemenets", "p", "degree"] +# - parameter_values: List of value for parameter, e.g. [0.01,0.1,1,10] +parameter_study: + enable: False + parameter_key: [] + parameter_values: [] diff --git a/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_stab.yml b/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_stab.yml index fca4e52860eb892f989510bd2efddf5a4d80aad1..6c5c4b9bd9e80eae3213fc715f3f421ec8e56fae 100644 --- a/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_stab.yml +++ b/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_stab.yml @@ -22,12 +22,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -50,6 +57,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/stress/inputs/stress_01_source_norot_p1p1p1_stab.yml b/tests/stress/inputs/stress_01_source_norot_p1p1p1_stab.yml index 3d9df99e5a977e69c45f63d3c43ef0dc0f9a48ee..50a1ff6d6206ad5760d07831dd27080a6913760a 100644 --- a/tests/stress/inputs/stress_01_source_norot_p1p1p1_stab.yml +++ b/tests/stress/inputs/stress_01_source_norot_p1p1p1_stab.yml @@ -23,12 +23,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -51,6 +58,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/stress/inputs/stress_01_source_rot_p1p1p1_stab.yml b/tests/stress/inputs/stress_01_source_rot_p1p1p1_stab.yml index 49fb7529d4d7519df7cc82c2304434f04f324d92..82faaf36812fdf37fc62562f2556b78f13905a88 100644 --- a/tests/stress/inputs/stress_01_source_rot_p1p1p1_stab.yml +++ b/tests/stress/inputs/stress_01_source_rot_p1p1p1_stab.yml @@ -22,12 +22,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -50,6 +57,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/stress/inputs/stress_01_source_rot_p1p2p3_nostab.yml b/tests/stress/inputs/stress_01_source_rot_p1p2p3_nostab.yml index 8129f7012f7333e1fafa560e607fa6d6a60f5ff1..866dbc5994e9e3f341505f3f48ab2981a3b325c1 100644 --- a/tests/stress/inputs/stress_01_source_rot_p1p2p3_nostab.yml +++ b/tests/stress/inputs/stress_01_source_rot_p1p2p3_nostab.yml @@ -20,12 +20,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -48,6 +55,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/stress/inputs/stress_01_source_rot_p2p2p2_stab.yml b/tests/stress/inputs/stress_01_source_rot_p2p2p2_stab.yml index dd1acc8b9c49886c875f82a72751eae799c2e68a..9b1310470dcb5c50ea646d97b80b0555b8e3d0fd 100644 --- a/tests/stress/inputs/stress_01_source_rot_p2p2p2_stab.yml +++ b/tests/stress/inputs/stress_01_source_rot_p2p2p2_stab.yml @@ -21,12 +21,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -49,6 +56,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/stress/inputs/stress_10_source_rot_p1p1p1_stab.yml b/tests/stress/inputs/stress_10_source_rot_p1p1p1_stab.yml index b423331d6d1777c2c8380a5f5176899401198edb..acdbd677b69702c47abbef6e0d572c6b841c1fdc 100644 --- a/tests/stress/inputs/stress_10_source_rot_p1p1p1_stab.yml +++ b/tests/stress/inputs/stress_10_source_rot_p1p1p1_stab.yml @@ -23,12 +23,19 @@ meshes: # - fields: List of FEM parameters (shape, degree) # - shape: Element shape, e.g. Lagrange # - degree: Element degree, e.g. 2 -# - stabilization: Must contain cip +# - stabilization: Must contain cip and gls # - cip: Collection of Continous Interior Penalty (CIP) parameters # - enable: Enable CIP stabilization # - delta_theta: Stabilization of grad(T)*grad(T_test) over edge # - delta_u: Stabilization of grad(u)*grad(u_test) over edge # - delta_p: Stabilization of grad(p)*grad(p_test) over edge +# - gls: Collection of Garlerkin Least Squares (GLS) parameters +# - enable: Enable GLS stabilization +# - tau_energy: Stabilization with energy eq. residual +# - tau_heatflux: Stabilization with heatflux eq. residual +# - tau_mass: Stabilization with mass eq. residual +# - tau_momentum: Stabilization with momentum eq. residual +# - tau_stress: Stabilization with stress eq. residual elements: theta: shape: Lagrange @@ -51,6 +58,13 @@ stabilization: delta_theta: 1.0 delta_u: 1.0 delta_p: 0.01 + gls: + enable: False + tau_energy: 0.001 + tau_heatflux: 0.001 + tau_mass: 0.01 + tau_momentum: 0.01 + tau_stress: 0.01 # Formulation Parameters # ====================== diff --git a/tests/stress/referrors/stress_01_nosource_rot_p1p1p1_gls/errors.csv b/tests/stress/referrors/stress_01_nosource_rot_p1p1p1_gls/errors.csv new file mode 100644 index 0000000000000000000000000000000000000000..fb07b431b03fe63f677acc3e41050b39b314dabb --- /dev/null +++ b/tests/stress/referrors/stress_01_nosource_rot_p1p1p1_gls/errors.csv @@ -0,0 +1,6 @@ +h,p_L_2,p_l_inf,ux_L_2,ux_l_inf,uy_L_2,uy_l_inf,sigmaxx_L_2,sigmaxx_l_inf,sigmaxy_L_2,sigmaxy_l_inf,sigmayy_L_2,sigmayy_l_inf +0.9886573325052778,0.10771857641864614,0.105939438429,0.723607402641,0.795497443805,0.647439076362,0.851023497751,0.397276172543,0.32784237169,0.343900368666,0.319416192918,0.397113486891,0.326816241804 +0.6340332990709842,0.06754169652180457,0.0849862769214,0.39962139918,0.618447518832,0.401542405182,0.6326940211,0.222672238811,0.202221689489,0.221649255484,0.199127575732,0.22295246501,0.201583227709 +0.32904683851469807,0.10622018638703018,0.269422604494,0.126808920717,0.285291627571,0.114681020887,0.296562560258,0.0636621790268,0.123137898881,0.0633543562486,0.126378488896,0.0631949949887,0.120329259987 +0.16754966839339377,0.038374419632813225,0.185906343223,0.0377433288126,0.168329583112,0.0349890742874,0.133606573652,0.0172117074922,0.0360818726905,0.0171852266263,0.0357812236443,0.0175042898684,0.0392426854436 +0.08734460120995041,0.007426209753327028,0.0342087280184,0.00965733583543,0.0641500581063,0.00972738394416,0.0573071258727,0.00395077262269,0.0122349033458,0.00390330160633,0.0100627451988,0.00392195954984,0.0101084333533 diff --git a/tests/stress/test_stress_convergence.py b/tests/stress/test_stress_convergence.py index ffdb90058988526ef6d1b1e686536b7fe3072a6e..a29218a2d7831bb63c94913cc5ff7b66be59bde1 100644 --- a/tests/stress/test_stress_convergence.py +++ b/tests/stress/test_stress_convergence.py @@ -57,6 +57,26 @@ class TestStressConvergence(object): """ subprocess.check_call(["python3", "create_meshes.py"], cwd="tests/mesh") + def test_stress_01_nosource_rot_p1p1p1_gls(self): + r""" + Execute decoupled heat system test and check with reference errors. + + ========================= ============================================= + Parameter Value + ========================= ============================================= + :math:`Kn` :math:`0.1` + :math:`f_{\mathrm{mass}}` :math:`0` + :math:`v_t^1` :math:`10.0` + Elements :math:`P_1P_1P_1` + Stabilization GLS + ========================= ============================================= + """ + name = "stress_01_nosource_rot_p1p1p1_gls" + self.run_solver("inputs/" + name + ".yml") + errors = name + "/" + "errors.csv" + referrors = "referrors/" + name + "/errors.csv" + self.compare_errors(errors, referrors) + def test_stress_01_nosource_rot_p1p1p1_stab(self): r""" Execute decoupled heat system test and check with reference errors.