From fd551475d6c3def059fd1ca1b070fb0e15ea2698 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Keck <Jean-Baptiste.Keck@imag.fr> Date: Sun, 9 Dec 2018 17:13:27 +0100 Subject: [PATCH] disabled ghost fft tests --- examples/sediment_deposit/sediment_deposit.py | 44 ++++++++++++++----- hysop/numerics/tests/test_fft.py | 2 +- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/examples/sediment_deposit/sediment_deposit.py b/examples/sediment_deposit/sediment_deposit.py index 13d011f83..d99b7a447 100644 --- a/examples/sediment_deposit/sediment_deposit.py +++ b/examples/sediment_deposit/sediment_deposit.py @@ -4,9 +4,9 @@ import sympy as sm import numba as nb TANK_RATIO = 1 -SEDIMENT_COUNT = 4000*TANK_RATIO -SEDIMENT_RADIUS = 0.25e-2 -DISCRETIZATION = 4096 +SEDIMENT_COUNT = 250*TANK_RATIO +SEDIMENT_RADIUS = 1e-2 +DISCRETIZATION = 512 # initialize vorticity def init_vorticity(data, coords, component=None): @@ -29,6 +29,7 @@ def init_sediment(data, coords, nblobs, rblob): cache_file='/tmp/C_init_{}_{}'.format('_'.join(str(x) for x in data.shape), str(abs(hash((TANK_RATIO,nblobs,rblob))))) try: + raise NotImplementedError D = np.load(file=cache_file+'.npz') print ' *Initializing sediments from cache: "{}.npz".'.format(cache_file) data[...] = D['data'] @@ -95,6 +96,7 @@ def init_sediment(data, coords, nblobs, rblob): print ' *Initializing sediments of radius {} with {} random blobs.'.format(rblob, nblobs) data[...] = 0.0 iter_blobs(*args) + #data[:int(0.05*Ny),:] = 1.0 # we cache initialization np.savez_compressed(file=cache_file, data=data) @@ -124,6 +126,7 @@ def compute(args): from hysop.methods import SpaceDiscretization, Remesh, TimeIntegrator, \ ComputeGranularity, Interpolation + from hysop.numerics.odesolvers.runge_kutta import Euler, RK2, RK3, RK4 from hysop.symbolic import sm, space_symbols, local_indices_symbols from hysop.symbolic.base import SymbolicTensor from hysop.symbolic.field import curl @@ -148,10 +151,10 @@ def compute(args): nu_W = ScalarParameter(name='nu_W', dtype=args.dtype, const=True, initial_value=1.00) lboundaries = (BoxBoundaryCondition.SYMMETRIC, BoxBoundaryCondition.SYMMETRIC) - rboundaries = (BoxBoundaryCondition.OUTFLOW, BoxBoundaryCondition.SYMMETRIC) + rboundaries = (BoxBoundaryCondition.SYMMETRIC, BoxBoundaryCondition.SYMMETRIC) - #S_lboundaries = (BoundaryCondition.HOMOGENEOUS_NEUMANN, BoundaryCondition.HOMOGENEOUS_NEUMANN) - #S_rboundaries = (BoundaryCondition.HOMOGENEOUS_NEUMANN, BoundaryCondition.HOMOGENEOUS_NEUMANN) + S_lboundaries = (BoundaryCondition.HOMOGENEOUS_NEUMANN, BoundaryCondition.HOMOGENEOUS_NEUMANN) + S_rboundaries = (BoundaryCondition.HOMOGENEOUS_NEUMANN, BoundaryCondition.HOMOGENEOUS_NEUMANN) box = Box(origin=Xo, length=np.subtract(Xn,Xo), lboundaries=lboundaries, rboundaries=rboundaries) @@ -190,8 +193,8 @@ def compute(args): t, dt = TimeParameters(dtype=args.dtype) velo = VelocityField(domain=box, dtype=args.dtype) vorti = VorticityField(velocity=velo) - S = Field(domain=box, name='S', dtype=args.dtype) - #lboundaries=S_lboundaries, rboundaries=S_rboundaries) + S = Field(domain=box, name='S', dtype=args.dtype, + lboundaries=S_lboundaries, rboundaries=S_rboundaries) # Symbolic fields frame = velo.domain.frame @@ -253,6 +256,23 @@ def compute(args): S: npts}, **extra_op_kwds) + #> Directional penalization + #Z = space_symbols[1] + #cst=1e8 + #penalization = -dts*cst*Us / (1+cst*dts) + #penalization = penalization.freeze() + #lhs = Ws + #rhs = Select(0,curl(penalization, frame),Z<0.05) + #rhs = Select(0,10,Z<0.05) + #exprs = Assignment.assign(lhs, rhs) + #penalization = DirectionalSymbolic(name='penalization', + #implementation=impl, + #exprs=exprs, + #fixed_residue=Ws, + #variables={vorti: npts, velo: npts, S: npts}, + #method={TimeIntegrator: Euler}, + #dt=dt, **extra_op_kwds) + splitting = StrangSplitting(splitting_dim=dim, order=args.strang_order) splitting.push_operators(advec, stretch, external_force) @@ -280,8 +300,8 @@ def compute(args): dump_fields = HDF_Writer(name='dump', io_params=io_params, force_backend=Backend.OPENCL, - variables={#velo: npts, - #vorti: npts, + variables={velo: npts, + vorti: npts, S: npts}, **extra_op_kwds) @@ -297,7 +317,7 @@ def compute(args): ### Adaptive timestep operator adapt_dt = AdaptiveTimeStep(dt, equivalent_CFL=True, name='merge_dt', pretty_name='dt', - max_dt=1e3) + max_dt=1e0) dt_cfl = adapt_dt.push_cfl_criteria(cfl=args.cfl, Fmin=min_max_U.Fmin, Fmax=min_max_U.Fmax, @@ -393,7 +413,7 @@ if __name__=='__main__': npts=(TANK_RATIO*DISCRETIZATION+1,DISCRETIZATION+1), box_origin=(0.0,), box_length=(1.0,), tstart=0.0, tend=100000.0, - dt=1.0, cfl=64.0, lcfl=0.99, + dt=1.0, cfl=8.0, lcfl=0.99, dump_times=tuple(float(x) for x in range(0,100000,1000)), dump_freq=0) diff --git a/hysop/numerics/tests/test_fft.py b/hysop/numerics/tests/test_fft.py index 02272b6db..65630fd32 100644 --- a/hysop/numerics/tests/test_fft.py +++ b/hysop/numerics/tests/test_fft.py @@ -622,7 +622,7 @@ class TestFFT(object): for i in xrange(2): base = 2+i print ' '+msg[i] - for ghosts in ((0,0,0),(2,0,0),(0,1,0)): + for ghosts in ((0,0,0),): #(2,0,0),(0,1,0),(0,0,3)): for j1 in xrange(minj[i],maxj[i]): shape = (3,2,base**j1,) cshape = list(shape) -- GitLab