========================================================= test session starts =========================================================
platform linux -- Python 3.6.7, pytest-4.0.1, py-1.7.0, pluggy-0.8.0
rootdir: /home/allan/codes/reaktoro-main, inifile:
plugins: xdist-1.24.1, timeout-1.3.3, regressions-1.0.5, lazy-fixture-0.4.2, forked-0.2, datadir-1.2.1
collected 124 items
tests/test_reaktoro_misc.py x.. [ 2%]
tests/regression/test_equilibrium_path.py . [ 3%]
tests/regression/test_equilibrium_solver.py .............................. [ 27%]
tests/regression/test_equilibrium_utils.py ........................................................................ [ 85%]
tests/regression/test_kinetic_solver.py ............ [ 95%]
tests/regression/test_transport_solver.py FFF... [100%]
============================================================== FAILURES ===============================================================
_____________________________________ test_transport_solver_diffusion[diffusion-source rate q=0] ______________________________________
source_parameters = source_parameters(a=0, b=0)
num_regression = <pytest_regressions.num_regression.NumericRegressionFixture object at 0x7fdf2a6d9438>
@pytest.mark.parametrize(
"source_parameters",
[
pytest.param(source_parameters(0, 0), id="diffusion-source rate q=0"),
pytest.param(source_parameters(0, 1), id="diffusion-source rate q=1"),
pytest.param(source_parameters(1, 1), id="diffusion-source rate q=x+1"),
],
)
def test_transport_solver_diffusion(source_parameters, num_regression):
"""
A test to check the solution of a advection-diffusion equation with v = 0
and du/dt = 0
Eq:
du/dt + v du/dx = D d²u/dx² + q
The result were compared with the following analytic solution and got
near results when we increase the number of cells. We decided to compare with
numerical solve to save some computational time and analytic result, but with
relative error of 1e-1.
analytic_u = -((a*x**3)/(6*D)) - ((b*x**2)/(2*D)) + ((a*x*xr**2)/(2*D)) + ((b*x*xr)/(D)) + ul
@param source_parameters
a tuple that has values of a and b coefficient of a source term
that behaves as q a*x+b
"""
a = source_parameters.a
b = source_parameters.b
D = 0.0002
v = 0
ul = 1
dt = 100
num_steps = 1000
num_cells = 10
xl = 0
xr = 1.0
mesh = rkt.Mesh(num_cells, xl, xr)
x = mesh.xcells()
q = a * x + b
transp_solver = rkt.TransportSolver()
transp_solver.setMesh(mesh)
transp_solver.setVelocity(v)
transp_solver.setDiffusionCoeff(D)
transp_solver.setBoundaryValue(ul)
transp_solver.setTimeStep(dt)
transp_solver.initialize()
numerical_u = np.zeros(num_cells)
transp_solver.step(numerical_u, q)
for i in range(num_steps):
transp_solver.step(numerical_u, q)
> num_regression.check({"u": numerical_u})
E AssertionError: Values are not sufficiently close.
E To update values, use --force-regen option.
E
E u:
E obtained_u expected_u diff
E 0 0 0.99999999999999956 0.99999999999999956
E 1 0 0.99999999999999944 0.99999999999999944
E 2 0 0.99999999999999878 0.99999999999999878
E 3 0 0.99999999999999845 0.99999999999999845
E 4 0 0.99999999999999822 0.99999999999999822
E 5 0 0.99999999999999789 0.99999999999999789
E 6 0 0.99999999999999789 0.99999999999999789
E 7 0 0.99999999999999789 0.99999999999999789
E 8 0 0.99999999999999778 0.99999999999999778
E 9 0 0.99999999999999778 0.99999999999999778
tests/regression/test_transport_solver.py:69: AssertionError
_____________________________________ test_transport_solver_diffusion[diffusion-source rate q=1] ______________________________________
source_parameters = source_parameters(a=0, b=1)
num_regression = <pytest_regressions.num_regression.NumericRegressionFixture object at 0x7fdf2a641cc0>
@pytest.mark.parametrize(
"source_parameters",
[
pytest.param(source_parameters(0, 0), id="diffusion-source rate q=0"),
pytest.param(source_parameters(0, 1), id="diffusion-source rate q=1"),
pytest.param(source_parameters(1, 1), id="diffusion-source rate q=x+1"),
],
)
def test_transport_solver_diffusion(source_parameters, num_regression):
"""
A test to check the solution of a advection-diffusion equation with v = 0
and du/dt = 0
Eq:
du/dt + v du/dx = D d²u/dx² + q
The result were compared with the following analytic solution and got
near results when we increase the number of cells. We decided to compare with
numerical solve to save some computational time and analytic result, but with
relative error of 1e-1.
analytic_u = -((a*x**3)/(6*D)) - ((b*x**2)/(2*D)) + ((a*x*xr**2)/(2*D)) + ((b*x*xr)/(D)) + ul
@param source_parameters
a tuple that has values of a and b coefficient of a source term
that behaves as q a*x+b
"""
a = source_parameters.a
b = source_parameters.b
D = 0.0002
v = 0
ul = 1
dt = 100
num_steps = 1000
num_cells = 10
xl = 0
xr = 1.0
mesh = rkt.Mesh(num_cells, xl, xr)
x = mesh.xcells()
q = a * x + b
transp_solver = rkt.TransportSolver()
transp_solver.setMesh(mesh)
transp_solver.setVelocity(v)
transp_solver.setDiffusionCoeff(D)
transp_solver.setBoundaryValue(ul)
transp_solver.setTimeStep(dt)
transp_solver.initialize()
numerical_u = np.zeros(num_cells)
transp_solver.step(numerical_u, q)
for i in range(num_steps):
transp_solver.step(numerical_u, q)
> num_regression.check({"u": numerical_u})
E AssertionError: Values are not sufficiently close.
E To update values, use --force-regen option.
E
E u:
E obtained_u expected_u diff
E 0 100100.00000000672298484 242.66666666666645824 99857.33333334005146753
E 1 100100.00000000673753675 692.66666666666594665 99407.33333334006601945
E 2 100100.00000000675208867 1092.66666666666560559 99007.33333334008057136
E 3 100100.00000000675208867 1442.66666666666469609 98657.33333334008057136
E 4 100100.00000000675208867 1742.66666666666401397 98357.33333334009512328
E 5 100100.00000000675208867 1992.66666666666401397 98107.33333334009512328
E 6 100100.00000000675208867 2192.66666666666333185 97907.33333334009512328
E 7 100100.00000000675208867 2342.66666666666287711 97757.33333334009512328
E 8 100100.00000000675208867 2442.66666666666333185 97657.33333334009512328
E 9 100100.00000000675208867 2492.66666666666242236 97607.33333334009512328
tests/regression/test_transport_solver.py:69: AssertionError
____________________________________ test_transport_solver_diffusion[diffusion-source rate q=x+1] _____________________________________
source_parameters = source_parameters(a=1, b=1)
num_regression = <pytest_regressions.num_regression.NumericRegressionFixture object at 0x7fdf2a668470>
@pytest.mark.parametrize(
"source_parameters",
[
pytest.param(source_parameters(0, 0), id="diffusion-source rate q=0"),
pytest.param(source_parameters(0, 1), id="diffusion-source rate q=1"),
pytest.param(source_parameters(1, 1), id="diffusion-source rate q=x+1"),
],
)
def test_transport_solver_diffusion(source_parameters, num_regression):
"""
A test to check the solution of a advection-diffusion equation with v = 0
and du/dt = 0
Eq:
du/dt + v du/dx = D d²u/dx² + q
The result were compared with the following analytic solution and got
near results when we increase the number of cells. We decided to compare with
numerical solve to save some computational time and analytic result, but with
relative error of 1e-1.
analytic_u = -((a*x**3)/(6*D)) - ((b*x**2)/(2*D)) + ((a*x*xr**2)/(2*D)) + ((b*x*xr)/(D)) + ul
@param source_parameters
a tuple that has values of a and b coefficient of a source term
that behaves as q a*x+b
"""
a = source_parameters.a
b = source_parameters.b
D = 0.0002
v = 0
ul = 1
dt = 100
num_steps = 1000
num_cells = 10
xl = 0
xr = 1.0
mesh = rkt.Mesh(num_cells, xl, xr)
x = mesh.xcells()
q = a * x + b
transp_solver = rkt.TransportSolver()
transp_solver.setMesh(mesh)
transp_solver.setVelocity(v)
transp_solver.setDiffusionCoeff(D)
transp_solver.setBoundaryValue(ul)
transp_solver.setTimeStep(dt)
transp_solver.initialize()
numerical_u = np.zeros(num_cells)
transp_solver.step(numerical_u, q)
for i in range(num_steps):
transp_solver.step(numerical_u, q)
> num_regression.check({"u": numerical_u})
E AssertionError: Values are not sufficiently close.
E To update values, use --force-regen option.
E
E u:
E obtained_u expected_u diff
E 0 149943.75000000742147677 367.25000000000017053 149576.50000000742147677
E 1 149966.25000000745058060 1064.75000000000068212 148901.50000000745058060
E 2 150006.25000000745058060 1704.75000000000159162 148301.50000000745058060
E 3 150058.75000000745058060 2282.25000000000136424 147776.50000000745058060
E 4 150118.75000000745058060 2792.25000000000227374 147326.50000000745058060
E 5 150181.25000000747968443 3229.75000000000318323 146951.50000000747968443
E 6 150241.25000000747968443 3589.75000000000409273 146651.50000000747968443
E 7 150293.75000000745058060 3867.25000000000500222 146426.50000000745058060
E 8 150333.75000000745058060 4057.25000000000545697 146276.50000000745058060
E 9 150356.25000000742147677 4154.75000000000545697 146201.50000000742147677
tests/regression/test_transport_solver.py:69: AssertionError
========================================== 3 failed, 120 passed, 1 xfailed in 36.89 seconds ===========================================
-- Using ccache to potentially speed up the build operation.
-- The CXX compiler identification is GNU 7.3.0
-- Check for working CXX compiler: /home/allan/miniconda3/envs/reaktoro/bin/x86_64-conda_cos6-linux-gnu-c++
-- Check for working CXX compiler: /home/allan/miniconda3/envs/reaktoro/bin/x86_64-conda_cos6-linux-gnu-c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conda environment recognized in /home/allan/miniconda3/envs/reaktoro
-- Boost version: 1.67.0
-- Found PythonInterp: /home/allan/miniconda3/envs/reaktoro/bin/python (found version "3.6.7")
-- Found PythonLibs: /home/allan/miniconda3/envs/reaktoro/lib/libpython3.6m.so
-- Found pybind11 v2.2.4: /home/allan/miniconda3/envs/reaktoro/include/python3.6m;/home/allan/miniconda3/envs/reaktoro/include/python3.6m
-- Configuring done
-- Generating done
-- Build files have been written to: /home/allan/codes/reaktoro-main/build