From 0fd297ed3261747b55021ff16efce8f76e40047a Mon Sep 17 00:00:00 2001 From: Juan Escobar <escj@aero.obs-mip.fr> Date: Wed, 10 Apr 2019 15:32:35 +0200 Subject: [PATCH] Juan 10/04/2019: calcul LuseO/LuseT identique en monprocesseur , todo MPI communication.f90 --- .../mode_mg_read_param.f90 | 7 +- tensorproductmultigrid_Source/parameters.f90 | 4 +- tensorproductmultigrid_Source/profiles.f90 | 93 ++++++++++++------- 3 files changed, 67 insertions(+), 37 deletions(-) diff --git a/tensorproductmultigrid_Source/mode_mg_read_param.f90 b/tensorproductmultigrid_Source/mode_mg_read_param.f90 index de7b908c7..713eb21fe 100644 --- a/tensorproductmultigrid_Source/mode_mg_read_param.f90 +++ b/tensorproductmultigrid_Source/mode_mg_read_param.f90 @@ -78,13 +78,16 @@ subroutine read_solver_parameters(filename,solver_param_out) integer :: maxiter integer, parameter :: file_id = 16 integer :: ierr - namelist /parameters_solver/ solvertype,resreduction, maxiter + namelist /parameters_solver/ solvertype,resreduction, maxiter & + , LUseO , LUseT if (i_am_master_mpi) then open(file_id,file=filename) read(file_id,NML=parameters_solver) close(file_id) write(STDOUT,NML=parameters_solver) write(STDOUT,'("---------------------------------------------- ")') + write(STDOUT,'(" LUseO = ",L8)') LUseO + write(STDOUT,'(" LUseT = ",L8)') LUseT write(STDOUT,'("Solver parameters ")') if (solvertype == SOLVER_RICHARDSON) then write(STDOUT,'(" solver = Richardson")') @@ -101,6 +104,8 @@ subroutine read_solver_parameters(filename,solver_param_out) call mpi_bcast(solvertype,1,MPI_INTEGER,master_rank,MPI_COMM_WORLD,ierr) call mpi_bcast(maxiter,1,MPI_INTEGER,master_rank,MPI_COMM_WORLD,ierr) call mpi_bcast(resreduction,1,MPI_DOUBLE_PRECISION,master_rank,MPI_COMM_WORLD,ierr) + call mpi_bcast(LUseO,1,MPI_LOGICAL,master_rank,MPI_COMM_WORLD,ierr) + call mpi_bcast(LUseT,1,MPI_LOGICAL,master_rank,MPI_COMM_WORLD,ierr) solver_param_out%solvertype = solvertype solver_param_out%maxiter = maxiter solver_param_out%resreduction = resreduction diff --git a/tensorproductmultigrid_Source/parameters.f90 b/tensorproductmultigrid_Source/parameters.f90 index 27a8ad145..a578dcf17 100644 --- a/tensorproductmultigrid_Source/parameters.f90 +++ b/tensorproductmultigrid_Source/parameters.f90 @@ -56,7 +56,7 @@ module parameters real(kind=rl), parameter :: two_pi = 6.2831853071795862_rl ! Use Original (K,J,I) or Transposed (I,J,K) array - logical , parameter :: LUseO = .true. - logical , parameter :: LUseT = .true. ! .true. + logical :: LUseO = .false. + logical :: LUseT = .true. ! .false. ! .true. end module parameters diff --git a/tensorproductmultigrid_Source/profiles.f90 b/tensorproductmultigrid_Source/profiles.f90 index ba92f389e..f383dbaa7 100644 --- a/tensorproductmultigrid_Source/profiles.f90 +++ b/tensorproductmultigrid_Source/profiles.f90 @@ -82,13 +82,24 @@ private end do ELSE ! Initialise RHS - do ix=ix_min, ix_max - do iy=iy_min, iy_max - do iz=1,u%grid_param%nz - u%s(iz,iy-iy_min+1,ix-ix_min+1) = PU(IX-ix_min+KIB,IY-iy_min+KJB,IZ) - end do - end do - end do + if (LUseO) then + do ix=ix_min, ix_max + do iy=iy_min, iy_max + do iz=1,u%grid_param%nz + u%s(iz,iy-iy_min+1,ix-ix_min+1) = PU(IX-ix_min+KIB,IY-iy_min+KJB,IZ) + end do + end do + end do + end if + if (LUseT) then + do iz=1,u%grid_param%nz + do iy=iy_min, iy_max + do ix=ix_min, ix_max + u%st(ix-ix_min+1,iy-iy_min+1,iz) = PU(IX-ix_min+KIB,IY-iy_min+KJB,IZ) + end do + end do + end do + end if END IF end subroutine initialise_u_mnh !================================================================== @@ -111,25 +122,26 @@ private iy_min = u%iy_min iy_max = u%iy_max IF (.NOT. PRESENT(KIB) ) THEN - ! Initialise RHS - do ix=ix_min, ix_max - do iy=iy_min, iy_max - do iz=1,u%grid_param%nz - - PU(IX-ix_min+KIB,IY-iy_min+KJB,IZ) = 0.0_rl - - end do - end do - end do + ! ELSE - ! Initialise RHS - do ix=ix_min, ix_max - do iy=iy_min, iy_max - do iz=1,u%grid_param%nz - PU(IX-ix_min+KIB,IY-iy_min+KJB,IZ) = u%s(iz,iy-iy_min+1,ix-ix_min+1) - end do - end do - end do + ! Get PU + if (LUseO) then + do ix=ix_min, ix_max + do iy=iy_min, iy_max + do iz=1,u%grid_param%nz + PU(IX-ix_min+KIB,IY-iy_min+KJB,IZ) = u%s(iz,iy-iy_min+1,ix-ix_min+1) + end do + end do + end do + else + do iz=1,u%grid_param%nz + do iy=iy_min, iy_max + do ix=ix_min, ix_max + PU(IX-ix_min+KIB,IY-iy_min+KJB,IZ) = u%st(ix-ix_min+1,iy-iy_min+1,iz) + end do + end do + end do + end if END IF end subroutine get_u_mnh !================================================================== @@ -160,13 +172,15 @@ private y = 1.0_rl*((iy-0.5_rl)/(1.0_rl*b%grid_param%n)) z = 1.0_rl*((iz-0.5_rl)/(1.0_rl*b%grid_param%nz)) - b%s(iz,iy-iy_min+1,ix-ix_min+1) = 0.0_rl + if (LUseO) b%s(iz,iy-iy_min+1,ix-ix_min+1) = 0.0_rl + if (LUseT) b%st(ix-ix_min+1,iy-iy_min+1,iz) = 0.0_rl if ( ( x .ge. 0.1_rl ) .and. ( x .le. 0.4_rl ) & .and. (y .ge. 0.3_rl ) .and. ( y .le. 0.6_rl ) & .and. (z .ge. 0.2_rl ) .and. ( z .le. 0.7_rl ) ) & then - b%s(iz,iy-iy_min+1,ix-ix_min+1) = 1.0_rl + if (LUseO) b%s(iz,iy-iy_min+1,ix-ix_min+1) = 1.0_rl + if (LUseT) b%st(ix-ix_min+1,iy-iy_min+1,iz) = 1.0_rl end if end do @@ -174,13 +188,24 @@ private end do ELSE ! Initialise RHS - do ix=ix_min, ix_max - do iy=iy_min, iy_max - do iz=1,b%grid_param%nz - b%s(iz,iy-iy_min+1,ix-ix_min+1) = PY(IX-ix_min+KIB,IY-iy_min+KJB,IZ) - end do - end do - end do + if (LUseO) then + do ix=ix_min, ix_max + do iy=iy_min, iy_max + do iz=1,b%grid_param%nz + b%s(iz,iy-iy_min+1,ix-ix_min+1) = PY(IX-ix_min+KIB,IY-iy_min+KJB,IZ) + end do + end do + end do + end if + if (LUseT) then + do iz=1,b%grid_param%nz + do iy=iy_min, iy_max + do ix=ix_min, ix_max + b%st(ix-ix_min+1,iy-iy_min+1,iz) = PY(IX-ix_min+KIB,IY-iy_min+KJB,IZ) + end do + end do + end do + end if END IF end subroutine initialise_rhs_mnh !================================================================== -- GitLab