Commit 1c3aea5d authored by Lambert Theisen's avatar Lambert Theisen
Browse files

Add tests for coupled

parent 5a41efcd
Pipeline #167505 passed with stages
in 9 minutes and 47 seconds
......@@ -61,6 +61,7 @@ pages:
- sphinx-apidoc -o source/src ../src
- sphinx-apidoc -o source/tests/heat ../tests/heat
- sphinx-apidoc -o source/tests/stress ../tests/stress
- sphinx-apidoc -o source/tests/coupled ../tests/coupled
- make html
- mv _build/html/ ${CI_PROJECT_DIR}/public/
artifacts:
......
......@@ -15,6 +15,7 @@ import sys
sys.path.insert(0, os.path.abspath('../src'))
sys.path.insert(0, os.path.abspath('../tests/heat'))
sys.path.insert(0, os.path.abspath('../tests/stress'))
sys.path.insert(0, os.path.abspath('../tests/coupled'))
# -- Project information -----------------------------------------------------
......
......@@ -15,7 +15,9 @@ Contents
--------
.. toctree::
:glob:
source/src/modules.rst
source/tests/heat/modules.rst
source/tests/stress/modules.rst
source/tests/coupled/modules.rst
coupled
=======
.. toctree::
:maxdepth: 4
test_coupled_convergence
test\_coupled\_convergence module
=================================
.. automodule:: test_coupled_convergence
:members:
:undoc-members:
:show-inheritance:
!*errors.csv
\ No newline at end of file
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.09694979259351534,0.07650367375589406,0.08577886770302906,0.0558539156109,0.08144521607617977,0.058188882626,1.8379670300128577,2.0726256345198335,0.7358137385543471,0.806805880926,0.5314561575161063,0.558967195136,0.3735682219163951,0.374688498057,0.3577096590466282,0.396890838286,0.36883554832912185,0.386880075256
0.6340332990709842,0.05943030930491017,0.04656490716403461,0.06760276721130587,0.0387195751386,0.062151164899164946,0.0425082203439,1.032823724321196,1.201748727604658,0.5618595544192228,0.980571227229,0.41781408090326955,0.641208620443,0.2555734975773327,0.255282142729,0.253279083444981,0.267749417711,0.2517828036397983,0.262839444172
0.32904683851469807,0.017751066845977173,0.03494701248444021,0.020654012203209553,0.0166832409625,0.01754108697666697,0.0123078459661,0.15708358196551503,0.20872813950482833,0.2733757917546112,0.790952923241,0.24000413905322748,0.575877864078,0.09870326246649042,0.0952921648218,0.09845529358273729,0.103759268504,0.09831576905594486,0.0925944207632
0.16754966839339377,0.00696245184037249,0.020343282189288547,0.005030441934531329,0.00568013330565,0.004543342100374149,0.0051265833176,0.018277256737650738,0.04221725504981061,0.12477895450116827,0.509479434719,0.11810119891693953,0.388615891418,0.032776024276683316,0.0455447994591,0.03157615451348728,0.0400071899874,0.03261468216603714,0.0415930978982
0.08734460120995041,0.0021986733048795968,0.009223005375054605,0.0010447784535277903,0.00124630438857,0.001049239172555221,0.00139689947437,0.0017712618377634486,0.0055961523930284085,0.04256047368582481,0.217745233676,0.04153319207332618,0.187420576014,0.008049678761230796,0.0129564775146,0.007841227451495535,0.0116496185235,0.008064996402255994,0.0126357554015
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.030210275684418943,0.02429180957756477,0.04049721616819536,0.0403289177398,0.03756932796667624,0.0390287728472,0.36518778220625553,0.33770092368949783,0.36491789555962284,0.589240860654,0.313593543669313,0.393584536439,0.29141581679356254,0.908956178911,0.2891277945549829,1.0183261928,0.2897610067580188,0.910833022809
0.6340332990709842,0.009017983138613527,0.014891207723885413,0.020771071978920783,0.0212219260186,0.02036511812909916,0.0216678204059,0.08586795274499158,0.11248815714506116,0.17184375063894722,0.477195578767,0.13475346931947263,0.280089133682,0.14968283331076207,0.496032873587,0.15025592765124288,0.507021706892,0.1499528307886097,0.49703119508
0.32904683851469807,0.0020651943446027944,0.006817677188161508,0.006930182921767688,0.00844760527521,0.006917227521651642,0.00746955969123,0.010724928635810125,0.02475476818054423,0.04019045144532897,0.166155949852,0.03048744180046288,0.113655073028,0.04928873449460034,0.141924697867,0.04947257508800806,0.140393299336,0.04957728133781554,0.139609907751
0.16754966839339377,0.0006455300701972477,0.002776321537126425,0.0020565638036603674,0.00257478743115,0.0020318085954892794,0.00243047009215,0.002981153567662327,0.006989584866925191,0.0096459005375483,0.0803021639541,0.007381793970352605,0.0390140010815,0.014648177745084054,0.0327761838034,0.014573211439510948,0.0305352815273,0.014631314286490926,0.0319380005977
0.08734460120995041,0.00014979380968250223,0.0006472306438135567,0.000515138210815425,0.000649936568118,0.0005094194068122359,0.000595218260429,0.0009061775293570407,0.0012091041848839579,0.0015937396934959447,0.0121083237519,0.0016774128272329832,0.0149340304297,0.0036596870725424616,0.00741335757727,0.0036572410503872225,0.00760793103613,0.003655696190166183,0.00748570920944
"""
Module to gather tests for convergence of decoupled coupled system.
"""
import subprocess
import pytest
class TestCoupledConvergence(object):
"""
Class to bundle all coupled convergence tests.
All tests are compared against reference errors.
"""
working_dir = "tests/coupled"
solver_path = "../../src/fenicsR13.py"
def run_solver(self, inputfile):
"""
Runs the solver as subprocess with the given input file.
"""
subprocess.check_call([
"python3", self.solver_path, inputfile
], cwd=self.working_dir)
def compare_errors(self, errorsfile, ref_errorsfile):
"""
Check against reference errors.
Return exception if diff returns with !=0
"""
subprocess.check_call([
"diff", "-u", "--strip-trailing-cr", errorsfile, ref_errorsfile
], cwd=self.working_dir)
# @pytest.fixture(scope="module", autouse=True)
@pytest.mark.skip(reason="Not needed because meshes are in repo")
def create_meshes(self):
"""
Creates the test meshes. Executed before any test of the class.
"""
subprocess.check_call(["python3", "create_meshes.py"], cwd="tests/mesh")
def test_1_coeffs_sources_rot_p1p1p1p1p1_stab(self):
r"""
Executes westerkamp2019 coupled system test and check with
reference errors.
========================= ==============================================
Parameter Value
========================= ==============================================
:math:`\tau` :math:`1.0`
:math:`f_{\mathrm{mass}}` :math:`(1-\frac{5R^2}{18\tau^2})\cos(\phi)`
:math:`f_{\mathrm{heat}}` :math:`0`
:math:`v_t^1` :math:`10.0`
:math:`v_t^2` :math:`0.0`
Elements :math:`P_1P_1P_1P_1P_1`
Stabilization CIP: :math:`\delta_1,\delta_2=1,\delta_3=0.01`
========================= ==============================================
"""
name = "1_coeffs_sources_rot_p1p1p1p1p1_stab"
self.run_solver("inputs/" + name + ".yml")
errors = name + "/" + "errors.csv"
referrors = "referrors/" + name + "/errors.csv"
self.compare_errors(errors, referrors)
def test_1_coeffs_sources_rot_p2p2p2p2p2_stab(self):
r"""
Executes westerkamp2019 coupled system test and check with
reference errors.
========================= ==============================================
Parameter Value
========================= ==============================================
:math:`\tau` :math:`1.0`
:math:`f_{\mathrm{mass}}` :math:`(1-\frac{5R^2}{18\tau^2})\cos(\phi)`
:math:`f_{\mathrm{heat}}` :math:`0`
:math:`v_t^1` :math:`10.0`
:math:`v_t^2` :math:`0.0`
Elements :math:`P_2P_2P_2P_2P_2`
Stabilization CIP: :math:`\delta_1,\delta_2=1,\delta_3=0.01`
========================= ==============================================
"""
name = "1_coeffs_sources_rot_p2p2p2p2p2_stab"
self.run_solver("inputs/" + name + ".yml")
errors = name + "/" + "errors.csv"
referrors = "referrors/" + name + "/errors.csv"
self.compare_errors(errors, referrors)
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