diff --git a/Examples/TaylorGreen3D.py b/Examples/TaylorGreen3D.py index c385475bce3b9bc27e2763871cf00b5451768e3d..f7d99ea95da72844a5e1cdc5f0549a5a87abe4f7 100755 --- a/Examples/TaylorGreen3D.py +++ b/Examples/TaylorGreen3D.py @@ -9,7 +9,7 @@ All parameters are set and defined in python module dataTG. import parmepy as pp from parmepy.f2py import fftw2py -import math as m +import numpy as np from parmepy.fields.continuous import Field from parmepy.mpi.topology import Cartesian from parmepy.operator.advection import Advection @@ -22,12 +22,11 @@ from parmepy.operator.monitors.printer import Printer from parmepy.operator.monitors.energy_enstrophy import Energy_enstrophy from dataTG import dim, nb, NBGHOSTS, ADVECTION_METHOD, VISCOSITY, \ OUTPUT_FREQ, FILENAME, simu -import numpy as np ## ----------- A 3d problem ----------- print " ========= Start Navier-Stokes 3D (Taylor Green benchmark) =========" ## pi constant -pi = m.pi +pi = np.pi cos = np.cos sin = np.sin ## Domain @@ -96,15 +95,18 @@ poisson = Poisson(velo, vorti, # Bridges between the different topologies in order to # redistribute data. # 1 -Advection to stretching -distrAdvStr = Redistribute([vorti, velo], advec, stretch) -distrStrA = Redistribute([vorti, velo], stretch, advec) +distrAdvStr_vorti = Redistribute([vorti], advec, stretch) +distrPoiStr_velo = Redistribute([velo], poisson, stretch) # 2 - Stretching to Poisson/Diffusion -distrStrPoiss = Redistribute([vorti, velo], stretch, poisson) +distrStrDiff = Redistribute([vorti], stretch, diffusion) ## Define the problem to solve -pb = NSProblem(operators=[advec, distrAdvStr, stretch, - distrStrPoiss, - diffusion, poisson], +pb = NSProblem(operators=[distrPoiStr_velo, advec, # Redistribute wile advec + distrAdvStr_vorti, + stretch, + distrStrDiff, + diffusion, + poisson], simulation=simu, dumpFreq=-1) ## Setting solver to Problem (only operators for computational tasks) diff --git a/Examples/TaylorGreen3D_GPU.py b/Examples/TaylorGreen3D_GPU.py index bc4e78b2fe4fc1722b9b4017172b0302fdc0734b..1044198a328201a0101216847825a079b59f7750 100644 --- a/Examples/TaylorGreen3D_GPU.py +++ b/Examples/TaylorGreen3D_GPU.py @@ -17,10 +17,9 @@ from parmepy.operator.stretching import Stretching from parmepy.operator.poisson import Poisson from parmepy.operator.diffusion import Diffusion from parmepy.operator.redistribute import Redistribute -from parmepy.gpu import PARMES_DOUBLE_GPU as gpu_prec from parmepy.problem.navier_stokes import NSProblem from parmepy.operator.monitors.energy_enstrophy import Energy_enstrophy -from dataTG import dim, nb, NBGHOSTS, VISCOSITY, \ +from dataTG import dim, nb, NBGHOSTS, VISCOSITY, FILENAME, \ OUTPUT_FREQ, simu from parmepy.methods_keys import TimeIntegrator, Interpolation, Remesh,\ Support, Splitting @@ -83,8 +82,7 @@ advec = Advection(velo, vorti, Interpolation: Linear, Remesh: rmsh, Support: 'gpu_1k', - Splitting: 'o2'}, - precision=gpu_prec, + Splitting: 'o2_FullHalf'}, ) advec.discretize() @@ -112,7 +110,7 @@ vorti_advec_stretch = Redistribute([vorti], advec, stretch) # 1.2 -Streching input is already uptodate on cpu from Poisson output velo_poisson_stretch = Redistribute([velo], poisson, stretch) # 2 -Stretching to Poisson/Diffusion -vorti_stretch_poisson = Redistribute([vorti, velo], stretch, poisson) +vorti_stretch_diffusion = Redistribute([vorti], stretch, diffusion) # 3 -Advection input to GPU from Poisson/Diffusion vorti_diff_advec = Redistribute([vorti], diffusion, advec) velo_diff_advec_X = Redistribute([velo], poisson, advec.advecDir[0], @@ -123,15 +121,18 @@ velo_diff_advec_Z = Redistribute([velo], poisson, advec.advecDir[2], component=2) ## Define the problem to solve -pb = NSProblem(operators=[velo_poisson_stretch, advec, +pb = NSProblem(operators=[velo_poisson_stretch, + advec, vorti_advec_stretch, stretch, - vorti_stretch_poisson, + vorti_stretch_diffusion, diffusion, vorti_diff_advec, poisson, - velo_diff_advec_X, velo_diff_advec_Y, - velo_diff_advec_Z], + velo_diff_advec_X, + velo_diff_advec_Y, + velo_diff_advec_Z + ], simulation=simu, dumpFreq=-1) ## Setting solver to Problem (only operators for computational tasks) @@ -142,7 +143,7 @@ energy = Energy_enstrophy(velo, vorti, topo=topofft, viscosity=VISCOSITY, frequency=OUTPUT_FREQ, - prefix='./TG/energy_GPU.dat') + prefix=FILENAME) ## printer = Printer(variables=[velo, vorti], ## topo=topo,