Skip to content
Snippets Groups Projects
Commit 02b9b221 authored by Franck Pérignon's avatar Franck Pérignon
Browse files

Fix tests

parent 06db3ab0
No related branches found
No related tags found
No related merge requests found
...@@ -126,8 +126,7 @@ class VelocityCorrection_D(DiscreteOperator): ...@@ -126,8 +126,7 @@ class VelocityCorrection_D(DiscreteOperator):
self.req_flowrate.update(simulation) self.req_flowrate.update(simulation)
# warning : the flow rate value is divided by surf. # warning : the flow rate value is divided by surf.
self.req_flowrate_val = self.req_flowrate[self.req_flowrate.name] \ self.req_flowrate_val = self.req_flowrate.data * self._inv_ds
* self._inv_ds
# Computation of the required velocity shift # Computation of the required velocity shift
# for the current state # for the current state
self.computeCorrection() self.computeCorrection()
......
...@@ -12,6 +12,8 @@ import numpy as np ...@@ -12,6 +12,8 @@ import numpy as np
import hysop.tools.numpywrappers as npw import hysop.tools.numpywrappers as npw
import math import math
from hysop.domain.subsets import SubBox from hysop.domain.subsets import SubBox
from hysop import testsenv
pi = math.pi pi = math.pi
sin = np.sin sin = np.sin
...@@ -94,6 +96,7 @@ def computeRef2D(res, x, y, t): ...@@ -94,6 +96,7 @@ def computeRef2D(res, x, y, t):
return res return res
@testsenv.fftw_failed
def test_Poisson_Pressure_3D(): def test_Poisson_Pressure_3D():
dom = pp.Box(length=LL) dom = pp.Box(length=LL)
...@@ -125,6 +128,7 @@ def test_Poisson_Pressure_3D(): ...@@ -125,6 +128,7 @@ def test_Poisson_Pressure_3D():
poisson.finalize() poisson.finalize()
@testsenv.fftw_failed
def test_Poisson3D(): def test_Poisson3D():
dom = pp.Box(length=LL) dom = pp.Box(length=LL)
...@@ -156,6 +160,7 @@ def test_Poisson3D(): ...@@ -156,6 +160,7 @@ def test_Poisson3D():
poisson.finalize() poisson.finalize()
@testsenv.fftw_failed
def test_Poisson2D(): def test_Poisson2D():
dom = pp.Box(length=[2. * pi, 2. * pi], origin=[0., 0.]) dom = pp.Box(length=[2. * pi, 2. * pi], origin=[0., 0.])
...@@ -189,6 +194,7 @@ def test_Poisson2D(): ...@@ -189,6 +194,7 @@ def test_Poisson2D():
poisson.finalize() poisson.finalize()
@testsenv.fftw_failed
def test_Poisson3D_correction(): def test_Poisson3D_correction():
dom = pp.Box(length=LL) dom = pp.Box(length=LL)
...@@ -200,7 +206,7 @@ def test_Poisson3D_correction(): ...@@ -200,7 +206,7 @@ def test_Poisson3D_correction():
# Definition of the Poisson operator # Definition of the Poisson operator
ref_rate = npw.zeros(3) ref_rate = npw.zeros(3)
ref_rate[0] = uinf * LL[1] * LL[2] ref_rate[0] = uinf * LL[1] * LL[2]
rate = pp.VariableParameter(data=ref_rate, name='flowrate') rate = pp.VariableParameter(data=ref_rate)
poisson = Poisson(velocity, vorticity, discretization=d3D, flowrate=rate) poisson = Poisson(velocity, vorticity, discretization=d3D, flowrate=rate)
poisson.discretize() poisson.discretize()
...@@ -228,6 +234,7 @@ def test_Poisson3D_correction(): ...@@ -228,6 +234,7 @@ def test_Poisson3D_correction():
poisson.finalize() poisson.finalize()
@testsenv.fftw_failed
def test_Poisson3D_projection_1(): def test_Poisson3D_projection_1():
dom = pp.Box(length=LL) dom = pp.Box(length=LL)
...@@ -262,6 +269,7 @@ def test_Poisson3D_projection_1(): ...@@ -262,6 +269,7 @@ def test_Poisson3D_projection_1():
poisson.finalize() poisson.finalize()
@testsenv.fftw_failed
def test_Poisson3D_projection_2(): def test_Poisson3D_projection_2():
dom = pp.Box(length=LL) dom = pp.Box(length=LL)
......
...@@ -62,7 +62,7 @@ def test_velocity_correction_3D(): ...@@ -62,7 +62,7 @@ def test_velocity_correction_3D():
ref_rate = npw.zeros(3) ref_rate = npw.zeros(3)
ref_rate[0] = uinf * box.length[1] * box.length[2] ref_rate[0] = uinf * box.length[1] * box.length[2]
rate = pp.VariableParameter(data=ref_rate, name='flowrate') rate = pp.VariableParameter(data=ref_rate)
op = VelocityCorrection(velo, vorti, req_flowrate=rate, op = VelocityCorrection(velo, vorti, req_flowrate=rate,
discretization=topo, io_params={}) discretization=topo, io_params={})
op.discretize() op.discretize()
...@@ -95,7 +95,7 @@ def test_velocity_correction_2D(): ...@@ -95,7 +95,7 @@ def test_velocity_correction_2D():
ref_rate = npw.zeros(2) ref_rate = npw.zeros(2)
ref_rate[0] = uinf * box.length[1] ref_rate[0] = uinf * box.length[1]
rate = pp.VariableParameter(data=ref_rate, name='flowrate') rate = pp.VariableParameter(data=ref_rate)
op = VelocityCorrection(velo, vorti, req_flowrate=rate, op = VelocityCorrection(velo, vorti, req_flowrate=rate,
discretization=topo) discretization=topo)
op.discretize() op.discretize()
......
...@@ -33,7 +33,7 @@ class FProfiler(object): ...@@ -33,7 +33,7 @@ class FProfiler(object):
Usage: Usage:
>>> from hysop.tools.profiler FProfiler, ftime >>> from hysop.tools.profiler import FProfiler, ftime
>>> prof = FProfiler('some_name') >>> prof = FProfiler('some_name')
>>> start = ftime() >>> start = ftime()
>>> # do something ... [1] >>> # do something ... [1]
...@@ -41,7 +41,7 @@ class FProfiler(object): ...@@ -41,7 +41,7 @@ class FProfiler(object):
>>> # do something else ... [2] >>> # do something else ... [2]
>>> prof += ftime() - start >>> prof += ftime() - start
>>> # ... >>> # ...
>>> print prof >>> # print prof
>>> # --> display total time spent in do [1] and [2] >>> # --> display total time spent in do [1] and [2]
>>> # and number of calls of prof >>> # and number of calls of prof
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment