diff --git a/examples/particles_above_salt/particles_above_salt_periodic.py b/examples/particles_above_salt/particles_above_salt_periodic.py index 26c9625aefd9b4abd01d41d018e39b1e87c542f4..e90f8a67b039e192943202132f973d5e315f5382 100644 --- a/examples/particles_above_salt/particles_above_salt_periodic.py +++ b/examples/particles_above_salt/particles_above_salt_periodic.py @@ -76,8 +76,7 @@ def compute(args): # Constants l0 = 1.5 #initial thickness of the profile - (Sc, tau, Vp, Rs, Xo, Xn, N) = (0.70, 25, 0.04, 2.0, (-600,0), (600,750), (1537, 487)) - #(Sc, tau, Vp, Rs, Xo, Xn, N) = (7.00, 25, 0.04, 2.0, (-110,0,0), (65,100,100), (1537, 512, 512)) + (Sc, tau, Vp, Rs, Xo, Xn, N) = (0.70, 25, 0.04, 2.0, (-600,0), (600,750), (1536, 512)) nu_S = 1.0/Sc nu_C = 1.0/(tau*Sc) diff --git a/examples/particles_above_salt/particles_above_salt_symmetrized.py b/examples/particles_above_salt/particles_above_salt_symmetrized.py index af63fdc06586e94a4b48611efe30d97102bada3d..d48a421ee7e3855c070043dc882a05c394b890c8 100644 --- a/examples/particles_above_salt/particles_above_salt_symmetrized.py +++ b/examples/particles_above_salt/particles_above_salt_symmetrized.py @@ -71,7 +71,7 @@ def compute(args): # Constants l0 = 1.5 #initial thickness of the profile - (Sc, tau, Vp, Rs, Xo, Xn, N) = (0.70, 25, 0.04, 2.0, (-600,0), (600,750), (1537, 487)) + (Sc, tau, Vp, Rs, Xo, Xn, N) = (0.70, 25, 0.04, 2.0, (-600,0), (600,750), (1537, 512)) #(Sc, tau, Vp, Rs, Xo, Xn, N) = (7.00, 25, 0.04, 2.0, (-110,0,0), (65,100,100), (1537, 512, 512)) nu_S = ScalarParameter(name='nu_S', dtype=args.dtype, const=True, initial_value=1.0/Sc) @@ -103,6 +103,8 @@ def compute(args): cl_env = get_or_create_opencl_env(mpi_params=mpi_params, platform_id=args.cl_platform_id, device_id=args.cl_device_id) + + tg = cl_env.build_typegen(args.dtype, 'dec', False, False) # Configure OpenCL kernel generation and tuning (already done by HysopArgParser) from hysop.methods import OpenClKernelConfig diff --git a/hysop/operator/base/spectral_operator.py b/hysop/operator/base/spectral_operator.py index 347403136f434c69327ebc1770cb94ff448b66fe..b79db00b67edd4dd7022ef9452b941c41c89e360 100644 --- a/hysop/operator/base/spectral_operator.py +++ b/hysop/operator/base/spectral_operator.py @@ -1225,7 +1225,8 @@ class PlannedSpectralTransform(object): buf_nbytes = compute_nbytes(buf.shape, buf.dtype) input_nbytes = compute_nbytes(input_shape, input_dtype) assert buf_nbytes >= input_nbytes, (buf_nbytes, input_nbytes) - buf = buf.view(dtype=np.int8)[:input_nbytes].view(dtype=input_dtype).reshape(input_shape) + if (buf.shape!=input_shape) or (buf.dtype!=input_dtype): + buf = buf.view(dtype=np.int8)[:input_nbytes].view(dtype=input_dtype).reshape(input_shape) if isinstance(buf, Array): buf = buf.handle input_buffer = buf[self.input_slices] @@ -1242,7 +1243,8 @@ class PlannedSpectralTransform(object): buf_nbytes = compute_nbytes(buf.shape, buf.dtype) output_nbytes = compute_nbytes(output_shape, output_dtype) assert buf_nbytes >= output_nbytes, (buf_nbytes, output_nbytes) - buf = buf.view(dtype=np.int8)[:output_nbytes].view(dtype=output_dtype).reshape(output_shape) + if (buf.shape!=output_shape) or (buf.dtype!=output_dtype): + buf = buf.view(dtype=np.int8)[:output_nbytes].view(dtype=output_dtype).reshape(output_shape) if isinstance(buf, Array): buf = buf.handle output_buffer = buf[self.output_slices] diff --git a/test_examples.sh b/test_examples.sh index c4abfbb60224ebc8b1e545ad71252c3e70e196fc..4af3534c49b6d7a060e2c413c85862fde6269900 100755 --- a/test_examples.sh +++ b/test_examples.sh @@ -28,5 +28,6 @@ python "$EXAMPLE_DIR/bubble/periodic_bubble_levelset_penalization.py" $EXAMPLE_O python "$EXAMPLE_DIR/bubble/periodic_jet_levelset.py" $EXAMPLE_OPTIONS python "$EXAMPLE_DIR/particles_above_salt/particles_above_salt_periodic.py" $EXAMPLE_OPTIONS python "$EXAMPLE_DIR/particles_above_salt/particles_above_salt_symmetrized.py" $EXAMPLE_OPTIONS +python "$EXAMPLE_DIR/particles_above_salt/particles_above_salt_bc.py" $EXAMPLE_OPTIONS exit 0