From 7391014cd7625f5b09eb2fbdb3dc5960a9c096cf Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Lagaert <Jean-Baptiste.Lagaert@math.u-psud.fr>
Date: Wed, 12 Oct 2011 13:00:37 +0000
Subject: [PATCH] =?UTF-8?q?+=20Ajout=20de=20la=20version=20cens=C3=A9e=20d?=
 =?UTF-8?q?evenir=20commune=20des=20solveur=20d'advection.=20+=20Le=20doss?=
 =?UTF-8?q?ier=20avec=20le=20code=20du=20LEGI=20est=20d=C3=A9plac=C3=A9=20?=
 =?UTF-8?q?et=20commence=20=C3=A0=20=C3=AAtre=20mis=20=C3=A0=20jour?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Code_LEGI/Makefile                            | 39 +++++++++++++++++++
 {FFTPARO2COR => Code_LEGI}/data.f90           |  0
 .../discretisation2.f90                       |  0
 .../discretisation3.f90                       |  0
 {FFTPARO2COR => Code_LEGI}/fileio.f90         |  0
 {FFTPARO2COR => Code_LEGI}/forcing.f90        |  0
 {FFTPARO2COR => Code_LEGI}/init_plane_jet.f90 |  0
 {FFTPARO2COR => Code_LEGI}/init_test_case.f90 |  0
 {FFTPARO2COR => Code_LEGI}/initscal.f90       |  1 -
 {FFTPARO2COR => Code_LEGI}/lesmodel.f90       |  0
 {FFTPARO2COR => Code_LEGI}/main.f90           | 18 +++++----
 {FFTPARO2COR => Code_LEGI}/mpi_init.f90       |  4 +-
 {FFTPARO2COR => Code_LEGI}/parinit.f90        |  9 ++---
 {FFTPARO2COR => Code_LEGI}/parser.f90         |  0
 {FFTPARO2COR => Code_LEGI}/postprocess.f90    |  1 -
 {FFTPARO2COR => Code_LEGI}/postprocess5.f90   |  0
 {FFTPARO2COR => Code_LEGI}/postprocess6.f90   |  0
 {FFTPARO2COR => Code_LEGI}/postprocess7.f90   |  0
 .../postprocessparaview.f90                   |  0
 .../postprocesstools.f90                      |  0
 {FFTPARO2COR => Code_LEGI}/precision.f90      |  0
 {FFTPARO2COR => Code_LEGI}/random.f90         |  0
 {FFTPARO2COR => Code_LEGI}/solver.f90         | 20 ++++++----
 {FFTPARO2COR => Code_LEGI}/string.f90         |  0
 {FFTPARO2COR => Code_LEGI}/tg_init.f90        |  0
 {FFTPARO2COR => Code_LEGI}/tools.f90          |  0
 {FFTPARO2COR => Code_LEGI}/tout.f90           |  0
 {FFTPARO2COR => Code_LEGI}/transforms.f90     |  0
 {FFTPARO2COR => Code_LEGI}/x_advec.f90        |  0
 {FFTPARO2COR => Code_LEGI}/y_advec.f90        |  0
 {FFTPARO2COR => Code_LEGI}/z_advec.f90        |  0
 FFTPARO2COR/Makefile                          | 39 -------------------
 32 files changed, 68 insertions(+), 63 deletions(-)
 create mode 100755 Code_LEGI/Makefile
 rename {FFTPARO2COR => Code_LEGI}/data.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/discretisation2.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/discretisation3.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/fileio.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/forcing.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/init_plane_jet.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/init_test_case.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/initscal.f90 (99%)
 rename {FFTPARO2COR => Code_LEGI}/lesmodel.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/main.f90 (81%)
 rename {FFTPARO2COR => Code_LEGI}/mpi_init.f90 (95%)
 rename {FFTPARO2COR => Code_LEGI}/parinit.f90 (99%)
 rename {FFTPARO2COR => Code_LEGI}/parser.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/postprocess.f90 (99%)
 rename {FFTPARO2COR => Code_LEGI}/postprocess5.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/postprocess6.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/postprocess7.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/postprocessparaview.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/postprocesstools.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/precision.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/random.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/solver.f90 (98%)
 rename {FFTPARO2COR => Code_LEGI}/string.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/tg_init.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/tools.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/tout.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/transforms.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/x_advec.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/y_advec.f90 (100%)
 rename {FFTPARO2COR => Code_LEGI}/z_advec.f90 (100%)
 delete mode 100755 FFTPARO2COR/Makefile

diff --git a/Code_LEGI/Makefile b/Code_LEGI/Makefile
new file mode 100755
index 000000000..50f8619f3
--- /dev/null
+++ b/Code_LEGI/Makefile
@@ -0,0 +1,39 @@
+F90 = mpif90
+CODE = fft_2
+FILES = precision.F90 fileio.F90 string.F90 parser.F90 mpi_init.F90 data.F90 transforms.F90 initscal.F90 parinit.F90 tg_init.F90 init_plane_jet.F90 init_test_case.F90 advecVAR.F90 advec.F90 advecX.F90 advecY.F90 advecZ.F90 solver.F90 forcing.F90 tools.F90 postprocesstools.F90 postprocess.F90 postprocess5.F90 postprocessparaview.F90 discretisation2.F90 postprocess6.F90 postprocess7.F90 discretisation3.F90 lesmodel.F90 main.F90
+#lesmodel.F90 lesmodelsca.F90 lesmodelsca2.F90 lestools.F90 lesmodelsca3.F90 lesmodelsca4.F90 lesmodelsca5.F90 lesmodelsca6.F90 lesmodelsca7.F90 lesmodelsca8.F90 lesmodelsca9.F90 lesmodelsca10.F90
+
+LIB = /opt/fftw/lib
+LIBFFTW = -L$(LIB) -lfftw3
+FFTWINC = -I/usr/include
+
+BLAS_DIR = /opt/lapack/
+BLAS_LIB = -L$(BLAS_DIR) -lblas
+LAPACK_DIR = /opt/lapack
+LAPACK_LIB = -L$(LAPACK_DIR) -llapack
+
+
+OFILES = $(FILES:.F90=.o)
+MODFILES = $(FILES:.F90=.mod)
+
+FFLAGS = -O3
+# -qzerosize
+
+.SUFFIXES: .o .F90
+
+default:Makefile
+	@make $(OFILES)
+	@make $(CODE)
+
+
+$(CODE):$(OFILES) Makefile
+	$(F90) $(OFILES) $(FFLAGS) -o $(CODE) $(LIBFFTW)
+
+
+
+clean:
+	rm -f *.o *.mod
+
+
+.F90.o:
+	$(F90) $(FFTWINC) $(FFLAGS) -c $*.F90 
diff --git a/FFTPARO2COR/data.f90 b/Code_LEGI/data.f90
similarity index 100%
rename from FFTPARO2COR/data.f90
rename to Code_LEGI/data.f90
diff --git a/FFTPARO2COR/discretisation2.f90 b/Code_LEGI/discretisation2.f90
similarity index 100%
rename from FFTPARO2COR/discretisation2.f90
rename to Code_LEGI/discretisation2.f90
diff --git a/FFTPARO2COR/discretisation3.f90 b/Code_LEGI/discretisation3.f90
similarity index 100%
rename from FFTPARO2COR/discretisation3.f90
rename to Code_LEGI/discretisation3.f90
diff --git a/FFTPARO2COR/fileio.f90 b/Code_LEGI/fileio.f90
similarity index 100%
rename from FFTPARO2COR/fileio.f90
rename to Code_LEGI/fileio.f90
diff --git a/FFTPARO2COR/forcing.f90 b/Code_LEGI/forcing.f90
similarity index 100%
rename from FFTPARO2COR/forcing.f90
rename to Code_LEGI/forcing.f90
diff --git a/FFTPARO2COR/init_plane_jet.f90 b/Code_LEGI/init_plane_jet.f90
similarity index 100%
rename from FFTPARO2COR/init_plane_jet.f90
rename to Code_LEGI/init_plane_jet.f90
diff --git a/FFTPARO2COR/init_test_case.f90 b/Code_LEGI/init_test_case.f90
similarity index 100%
rename from FFTPARO2COR/init_test_case.f90
rename to Code_LEGI/init_test_case.f90
diff --git a/FFTPARO2COR/initscal.f90 b/Code_LEGI/initscal.f90
similarity index 99%
rename from FFTPARO2COR/initscal.f90
rename to Code_LEGI/initscal.f90
index 46d50f10e..2450600f1 100755
--- a/FFTPARO2COR/initscal.f90
+++ b/Code_LEGI/initscal.f90
@@ -1,7 +1,6 @@
 subroutine init_scalar
 
   use parallel
-  use random
   use transform
   use data
   implicit none
diff --git a/FFTPARO2COR/lesmodel.f90 b/Code_LEGI/lesmodel.f90
similarity index 100%
rename from FFTPARO2COR/lesmodel.f90
rename to Code_LEGI/lesmodel.f90
diff --git a/FFTPARO2COR/main.f90 b/Code_LEGI/main.f90
similarity index 81%
rename from FFTPARO2COR/main.f90
rename to Code_LEGI/main.f90
index 64b8364e4..c5665ebf0 100755
--- a/FFTPARO2COR/main.f90
+++ b/Code_LEGI/main.f90
@@ -3,25 +3,29 @@ subroutine main_init
   use parallel
   use parser
   use string
+  use advec
   implicit none
 
   character(len=str_long) :: sim_name
-  integer :: itype, ipost, iscal
+  integer :: simtype, ipost, iscal
 
+  ! Traitement du fichier contenant les paramètres de simulation
   call parser_init
   call parser_parsefile('input')
 
+  ! Initialisation
   call mpi_initialize
-  call random_init
   call transform_init
   call data_init
   
-  call parser_read('Simulation name', sim_name)
-  call parser_read('Simulation type', itype)
+
+  call parser_read('Simulation name', sim_name)     ! Typ d'écoulement choisi
+  call parser_read('Simulation type', simtype)
   call parser_read('Re-init scalar', iscal)
+  !call parser_read('Particule_order', part_method)  ! Méthode numérique utilisée pour advecter le scalaire
 
   
-  if (itype.eq.0) then !!!! Initialize and compute
+  if (simtype.eq.0) then !!!! Initialize and compute
      if (trim(sim_name).eq.'Taylor Green') then
         call tg_init
      elseif(trim(sim_name).eq.'Isotropic turbulence') then
@@ -34,7 +38,7 @@ subroutine main_init
         print *,' Unknown Simulation Name'
         stop
      endif
-  elseif (itype.eq.1) then
+  elseif (simtype.eq.1) then
      call data_read
      if( iscal.eq.1) then
        call init_test_case
@@ -46,7 +50,7 @@ subroutine main_init
   
   call solver_init
 
-  call x_advec_init
+  call advec_init
 
 !  call parser_read('Postprocessing', ipost)
 !  if (ipost.eq.1) print*,'not yet implemented'
diff --git a/FFTPARO2COR/mpi_init.f90 b/Code_LEGI/mpi_init.f90
similarity index 95%
rename from FFTPARO2COR/mpi_init.f90
rename to Code_LEGI/mpi_init.f90
index 5b7845d17..fabf5660d 100755
--- a/FFTPARO2COR/mpi_init.f90
+++ b/Code_LEGI/mpi_init.f90
@@ -5,8 +5,8 @@ module parallel
 
   integer :: nproc, rank
 
-  integer :: nx,ny,nz
-  integer :: nxsc,nysc,nzsc
+  integer :: nx,ny,nz           ! Number of mesh for the velocity
+  integer :: nxsc,nysc,nzsc     ! Number of mesh for the scalar
 
   integer :: ns1,ns2,ns3,nk
   integer :: fns1, fns2, fns3
diff --git a/FFTPARO2COR/parinit.f90 b/Code_LEGI/parinit.f90
similarity index 99%
rename from FFTPARO2COR/parinit.f90
rename to Code_LEGI/parinit.f90
index fb92674d9..20f7dd9dc 100755
--- a/FFTPARO2COR/parinit.f90
+++ b/Code_LEGI/parinit.f90
@@ -1,7 +1,6 @@
 subroutine hit_init
 
   use parallel
-  use random
   use transform
   use data
   implicit none
@@ -11,7 +10,7 @@ subroutine hit_init
   real(WP) :: psr,ps1,ps2, xx, yy, zz
   real(WP) :: ke,kd,ks,dk,ksk0ratio,kc,kcksratio,kk,kx,ky,kz,kk2,kcut
   real(WP) :: alpha,spec_amp,eps,amp_disc,f_phi,sch
-  integer  :: kl,jl,il,impose,itype
+  integer  :: kl,jl,il,impose,simtype
   real(WP) :: e_total,energy_spec,diss_total,ndense
   real(WP), dimension(:,:), pointer :: spect,sg
   real(WP), dimension(:), pointer :: s1,tabs2
@@ -321,8 +320,8 @@ subroutine hit_init
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 
-  call parser_read('Simulation type',itype)
-  if(itype.eq.0) then 
+  call parser_read('Simulation type',simtype)
+  if(simtype.eq.0) then 
 
   call btran_wrap(Uk,U,ns1,ns2,ns3,fns1,fns2,fns3)
   call btran_wrap(Vk,V,ns1,ns2,ns3,fns1,fns2,fns3)
@@ -424,7 +423,7 @@ subroutine hit_init
   
 !!$  call data_write_fourier(Uk,Vk,Wk,fns1,fns2,fns3)
   
-  if(itype.eq.0) then 
+  if(simtype.eq.0) then 
 
   call btran_wrap(Uk,U,ns1,ns2,ns3,fns1,fns2,fns3)
   call btran_wrap(Vk,V,ns1,ns2,ns3,fns1,fns2,fns3)
diff --git a/FFTPARO2COR/parser.f90 b/Code_LEGI/parser.f90
similarity index 100%
rename from FFTPARO2COR/parser.f90
rename to Code_LEGI/parser.f90
diff --git a/FFTPARO2COR/postprocess.f90 b/Code_LEGI/postprocess.f90
similarity index 99%
rename from FFTPARO2COR/postprocess.f90
rename to Code_LEGI/postprocess.f90
index 7e6bf65c6..58a81727e 100755
--- a/FFTPARO2COR/postprocess.f90
+++ b/Code_LEGI/postprocess.f90
@@ -193,7 +193,6 @@ subroutine postprocess
   fnzssc = 1
   fnzesc = fns3sc
 
-  call random_init
   call transform_init
   deallocate(data_storesc)
   call data_init
diff --git a/FFTPARO2COR/postprocess5.f90 b/Code_LEGI/postprocess5.f90
similarity index 100%
rename from FFTPARO2COR/postprocess5.f90
rename to Code_LEGI/postprocess5.f90
diff --git a/FFTPARO2COR/postprocess6.f90 b/Code_LEGI/postprocess6.f90
similarity index 100%
rename from FFTPARO2COR/postprocess6.f90
rename to Code_LEGI/postprocess6.f90
diff --git a/FFTPARO2COR/postprocess7.f90 b/Code_LEGI/postprocess7.f90
similarity index 100%
rename from FFTPARO2COR/postprocess7.f90
rename to Code_LEGI/postprocess7.f90
diff --git a/FFTPARO2COR/postprocessparaview.f90 b/Code_LEGI/postprocessparaview.f90
similarity index 100%
rename from FFTPARO2COR/postprocessparaview.f90
rename to Code_LEGI/postprocessparaview.f90
diff --git a/FFTPARO2COR/postprocesstools.f90 b/Code_LEGI/postprocesstools.f90
similarity index 100%
rename from FFTPARO2COR/postprocesstools.f90
rename to Code_LEGI/postprocesstools.f90
diff --git a/FFTPARO2COR/precision.f90 b/Code_LEGI/precision.f90
similarity index 100%
rename from FFTPARO2COR/precision.f90
rename to Code_LEGI/precision.f90
diff --git a/FFTPARO2COR/random.f90 b/Code_LEGI/random.f90
similarity index 100%
rename from FFTPARO2COR/random.f90
rename to Code_LEGI/random.f90
diff --git a/FFTPARO2COR/solver.f90 b/Code_LEGI/solver.f90
similarity index 98%
rename from FFTPARO2COR/solver.f90
rename to Code_LEGI/solver.f90
index 6b062d589..a13fbb94a 100755
--- a/FFTPARO2COR/solver.f90
+++ b/Code_LEGI/solver.f90
@@ -1,6 +1,9 @@
 module solver
 
   use precision
+  use advecX
+  use advecY
+  use advecZ
 
   implicit none
   
@@ -26,9 +29,10 @@ module solver
   complex(WP), dimension(:,:,:), allocatable :: Vk
   complex(WP), dimension(:,:,:), allocatable :: Wk
   complex(WP), dimension(:,:,:), allocatable :: Zk
-  real(WP), dimension(:,:,:), allocatable :: Usc
-  real(WP), dimension(:,:,:), allocatable :: Vsc
-  real(WP), dimension(:,:,:), allocatable :: Wsc
+  ! Velocity used to advec the scalar
+  real(WP), dimension(:,:,:), allocatable       :: Usc  ! along x 
+  real(WP), dimension(:,:,:), allocatable       :: Vsc  ! along y
+  real(WP), dimension(:,:,:), allocatable       :: Wsc  ! along z
 
   complex(WP), dimension(:,:,:),pointer :: Udummy
   complex(WP), dimension(:,:,:),pointer :: Vdummy
@@ -67,7 +71,7 @@ subroutine solver_init
 
   implicit none
 
-  integer ::  i,j,k,il,jl,kl,gg(3),itype
+  integer ::  i,j,k,il,jl,kl,gg(3),simtype
   real(WP) :: pi 
   real(WP) :: umax,vmax,wmax
 
@@ -218,7 +222,7 @@ subroutine solver_init
 !!!! Determine if it is required to solver the scalar equation
 !!!! If running from scratch with forcing, dont solver scalar equation
 
-  call parser_read('Simulation type', itype)
+  call parser_read('Simulation type', simtype)
   call parser_read('Compute scalar', iscalar)
   if (iscalar.eq.0) then
      if (rank.eq.0) print *,'Not solving scalar transport equation .....'
@@ -405,9 +409,9 @@ endif
      end if
 
 !!PAR!! 2. appelle du transport particulaire
-  call x_advec
-  call y_advec
-  call z_advec
+  call advecX_calc(dt, Usc, SC)
+  call advecY_calc(dt, Vsc, SC)
+  call advecZ_calc(dt, Wsc, SC)
 
   end if
 !!PAR!! - FIN - INTERFACAGE AVEC LA METHODE PARTICULAIRE
diff --git a/FFTPARO2COR/string.f90 b/Code_LEGI/string.f90
similarity index 100%
rename from FFTPARO2COR/string.f90
rename to Code_LEGI/string.f90
diff --git a/FFTPARO2COR/tg_init.f90 b/Code_LEGI/tg_init.f90
similarity index 100%
rename from FFTPARO2COR/tg_init.f90
rename to Code_LEGI/tg_init.f90
diff --git a/FFTPARO2COR/tools.f90 b/Code_LEGI/tools.f90
similarity index 100%
rename from FFTPARO2COR/tools.f90
rename to Code_LEGI/tools.f90
diff --git a/FFTPARO2COR/tout.f90 b/Code_LEGI/tout.f90
similarity index 100%
rename from FFTPARO2COR/tout.f90
rename to Code_LEGI/tout.f90
diff --git a/FFTPARO2COR/transforms.f90 b/Code_LEGI/transforms.f90
similarity index 100%
rename from FFTPARO2COR/transforms.f90
rename to Code_LEGI/transforms.f90
diff --git a/FFTPARO2COR/x_advec.f90 b/Code_LEGI/x_advec.f90
similarity index 100%
rename from FFTPARO2COR/x_advec.f90
rename to Code_LEGI/x_advec.f90
diff --git a/FFTPARO2COR/y_advec.f90 b/Code_LEGI/y_advec.f90
similarity index 100%
rename from FFTPARO2COR/y_advec.f90
rename to Code_LEGI/y_advec.f90
diff --git a/FFTPARO2COR/z_advec.f90 b/Code_LEGI/z_advec.f90
similarity index 100%
rename from FFTPARO2COR/z_advec.f90
rename to Code_LEGI/z_advec.f90
diff --git a/FFTPARO2COR/Makefile b/FFTPARO2COR/Makefile
deleted file mode 100755
index 5047f58b3..000000000
--- a/FFTPARO2COR/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-F90 = mpif90
-CODE = fft_2
-FILES = precision.f90 fileio.f90 string.f90 parser.f90 mpi_init.f90 data.f90 random.f90 transforms.f90 initscal.f90 parinit.f90 tg_init.f90 init_plane_jet.f90 init_test_case.f90 solver.f90 forcing.f90 tools.f90 main.f90 postprocesstools.f90 postprocess.f90 postprocess5.f90 postprocessparaview.f90 discretisation2.f90 postprocess6.f90 postprocess7.f90 discretisation3.f90 x_advec.f90 y_advec.f90 z_advec.f90 lesmodel.f90
-#lesmodel.f90 lesmodelsca.f90 lesmodelsca2.f90 lestools.f90 lesmodelsca3.f90 lesmodelsca4.f90 lesmodelsca5.f90 lesmodelsca6.f90 lesmodelsca7.f90 lesmodelsca8.f90 lesmodelsca9.f90 lesmodelsca10.f90
-
-LIB = /opt/fftw/lib
-LIBFFTW = -L$(LIB) -lfftw3
-FFTWINC = -I/usr/include
-
-BLAS_DIR = /opt/lapack/
-BLAS_LIB = -L$(BLAS_DIR) -lblas
-LAPACK_DIR = /opt/lapack
-LAPACK_LIB = -L$(LAPACK_DIR) -llapack
-
-
-OFILES = $(FILES:.f90=.o)
-MODFILES = $(FILES:.f90=.mod)
-
-FFLAGS = -O3
-# -qzerosize
-
-.SUFFIXES: .o .f90
-
-default:Makefile
-	@make $(OFILES)
-	@make $(CODE)
-
-
-$(CODE):$(OFILES) Makefile
-	$(F90) $(OFILES) $(FFLAGS) -o $(CODE) $(LIBFFTW)
-
-
-
-clean:
-	rm -f *.o *.mod
-
-
-.f90.o:
-	$(F90) $(FFTWINC) $(FFLAGS) -c $*.f90 
-- 
GitLab