Skip to content

Commit

Permalink
Merge commit '8e2f03437a0168ce1f4ff201f4a7a56c29263c8b' into 5.2-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
chantal-pic committed Jan 8, 2024
2 parents 1018931 + 8e2f034 commit 1a5bd80
Show file tree
Hide file tree
Showing 16 changed files with 489 additions and 87 deletions.
1 change: 0 additions & 1 deletion src/gemdyn/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*.[oa]
*~
include/gemdyn_version.inc
src/main/maingemgrid.F90
src/main/maincheckdmpart.F90
5 changes: 1 addition & 4 deletions src/gemdyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ include(ec_init) # Initialise compilers and ec specific functions
ec_git_version() # Get version from git state
ec_parse_manifest() # Parse MANIFEST file

project(${NAME} DESCRIPTION "${DESCRIPTION}")
project(${NAME} DESCRIPTION "${DESCRIPTION}" LANGUAGES C Fortran)
set(PROJECT_VERSION ${VERSION}${STATE})
set(gemdyn_VERSION ${PROJECT_VERSION} CACHE INTERNAL "gemdyn version" FORCE) # Needed for cascaded version identification
message(STATUS "(EC) ${PROJECT_NAME} version = ${PROJECT_VERSION}")

enable_language(C Fortran)

ec_build_info() # Generate build information
include(ec_compiler_presets)

Expand Down Expand Up @@ -62,7 +60,6 @@ endif()
if(DEFINED ENV{ORDENV_ARCH})
set(EC_ORDENV_ARCH "$ENV{ORDENV_ARCH}")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/gemdyn_version.in ${CMAKE_CURRENT_SOURCE_DIR}/include/gemdyn_version.inc @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/main/maincheckdmpart.in ${CMAKE_CURRENT_SOURCE_DIR}/src/main/maincheckdmpart.F90)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/main/maingemgrid.in ${CMAKE_CURRENT_SOURCE_DIR}/src/main/maingemgrid.F90)

Expand Down
2 changes: 1 addition & 1 deletion src/gemdyn/MANIFEST
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME : gemdyn
VERSION : 5.2.0-rc2
VERSION : 5.2.0
BUILD :
DESCRIPTION: GEM dynamical core
SUMMARY :
Expand Down
10 changes: 4 additions & 6 deletions src/gemdyn/bin/gemdyn_nml_mkref
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# @Object: Create a reference nml for gemdyn
# @Author: S.Chamberland
# @Date: Feb 2016, Jan 2021
# @Date: Aug 2022, modified by Chantal Pic for GoaS

DESC='Create a reference nml for gemdyn'

Expand All @@ -27,16 +28,15 @@ fi

if [[ x"${gemdyn_version}" == x"" ]] ; then
cat 1>&2 <<EOF
ERROR: gemdyn environement not properly set, \${gemdyn_version} not defined.
ERROR: gemdyn environment not properly set, \${gemdyn_version} not defined.
EOF
exit 1
fi

abs=$(which gemprnml_${BASE_ARCH}.Abs)
abs=$(which prgemnml)
if [[ x"${abs}" == x"" ]] ; then
cat 1>&2 <<EOF
ERROR: gemdyn environement not properly set, cannot find all print nml prog
gemprnml=${abs:-gemprnml_${BASE_ARCH}.Abs}
ERROR: gemdyn environment not properly set, cannot find all print nml prog, prgemnml
EOF
exit 1
fi
Expand All @@ -56,5 +56,3 @@ mv ${nmlfilename} ${myfile}
cd ${here}
rm -rf ${localtmp}
exit 0


1 change: 1 addition & 0 deletions src/gemdyn/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_library(gemdyn STATIC ${F_FILES} ${C_FILES})
add_dependencies(gemdyn ${PROJECT_NAME}_build_info)

target_include_directories(gemdyn PUBLIC $<BUILD_INTERFACE:${PROJECT_INCLUDE_DIRECTORY}>)
target_include_directories(gemdyn PUBLIC $<BUILD_INTERFACE:${CMAKE_Fortran_MODULE_DIRECTORY}>)
target_include_directories(gemdyn PRIVATE base)

target_link_libraries(gemdyn PUBLIC
Expand Down
2 changes: 0 additions & 2 deletions src/gemdyn/src/base/VERgrid_options.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ module VERgrid_options
!# a level (in the units of hyb or hyb_H above which
!# the vertical coordinate becomes flat
real :: Hyb_flat = -1.
namelist /vert_layers / Hyb_flat
namelist /vert_layers_p/ Hyb_flat

contains

Expand Down
75 changes: 33 additions & 42 deletions src/gemdyn/src/base/ens_marfield_ptp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ subroutine ens_marfield_ptp()
! idum Semence du g?n?rateur de nombres al?atoires
!
integer :: nlat, nlon, lmin, lmax, dlen
integer :: l ,m, n, nc,np, i, j, indx, ier, gmmstat, istat, gdyy
integer :: l ,m, n, nc,np, i, j, indx, gmmstat, istat, gdyy
real :: fstd, fstr, tau, sumsp , fact, fact2, offi, offj
real :: xfi(l_ni),yfi(l_nj)
real(kind=REAL64) :: rad2deg_8, deg2rad_8, pri_8
Expand All @@ -84,11 +84,11 @@ subroutine ens_marfield_ptp()
real, dimension(:,:,:),pointer :: ptr3d, fgem_str
integer, dimension(2) :: spp_trn
integer, dimension(Ens_ptp_ncha+spp_ncha) :: vlmin, vlmax, vnlon, vnlat
integer :: itstep_s, iperiod_iau, err, errop, ierr ,unf0, unf1, nch2d, spp_indx, stat
integer :: itstep_s, iperiod_iau, err, ier ,unf0, nch2d, spp_indx, stat
integer :: lmx,mmx,mch2d
character(len=WB_MAXNAMELENGTH) :: prefix, key, spp_type
character(len=WB_MAXNAMELENGTH), dimension(Ens_ptp_ncha+spp_ncha) :: vname
character(len=1024) :: fn0, fn1
character(len=1024) :: fn
!
!-------------------------------------------------------------------
!
Expand Down Expand Up @@ -221,16 +221,14 @@ subroutine ens_marfield_ptp()
if(Ens_recycle_mc) then
!Read saved stochastic numbers and spectral coeffs ar,br.ai,bi
err=0
if (ptopo_myproc==0 ) then
if (ptopo_couleur == 0 .and. ptopo_myproc == 0) then
do nc=1,nch2d
unf0=0
np=nc+1
fn0= trim(Path_input_S)//'/MODEL_INPUT'//'/MRKV_SPP_'//trim(vname(nc))//'.bin'
open ( unf0,file=trim(fn0),status='OLD', &
form='unformatted',iostat=errop )
if (errop == 0) then
err=0
write(output_unit,2000) 'READING', trim(fn0)
np=nc+1
unf0=0
fn= trim(Path_input_S)//'/MODEL_INPUT'//'/MRKV_SPP_'//trim(vname(nc))//'.bin'
ier=fnom(unf0,fn,'SEQ+UNF+OLD',0)
if (ier == 0) then
write(output_unit,2000) 'READING', trim(fn)
do i=1,36
read (unf0)dumdum(i,np)
end do
Expand All @@ -242,21 +240,20 @@ subroutine ens_marfield_ptp()
read(unf0)bi_p(lmax-l+1,m,nc)
end do
end do
close(unf0)
ier=fclos(unf0)
else
err = -1
write(output_unit, *) 'Error: problem opening Markov file '//trim(fn0)
write(output_unit, *) 'Error: problem opening Markov file '//trim(fn)
endif
enddo
endif
call gem_error(err,'Ens_marfield_ptp','Error in reading Markov files')


call RPN_COMM_bcast (dumdum,36*mch2d,"MPI_INTEGER",0,"MULTIGRID", ierr)
call RPN_COMM_bcast (ar_p, lmx*mmx*nch2d, "MPI_REAL",0, "MULTIGRID", ierr)
call RPN_COMM_bcast (ai_p, lmx*mmx*nch2d, "MPI_REAL",0, "MULTIGRID", ierr)
call RPN_COMM_bcast (br_p, lmx*mmx*nch2d, "MPI_REAL",0, "MULTIGRID", ierr)
call RPN_COMM_bcast (bi_p, lmx*mmx*nch2d, "MPI_REAL",0, "MULTIGRID", ierr)
call RPN_COMM_bcast (dumdum,36*mch2d,"MPI_INTEGER",0,"MULTIGRID", ier)
call RPN_COMM_bcast (ar_p, lmx*mmx*nch2d, "MPI_REAL",0, "MULTIGRID", ier)
call RPN_COMM_bcast (ai_p, lmx*mmx*nch2d, "MPI_REAL",0, "MULTIGRID", ier)
call RPN_COMM_bcast (br_p, lmx*mmx*nch2d, "MPI_REAL",0, "MULTIGRID", ier)
call RPN_COMM_bcast (bi_p, lmx*mmx*nch2d, "MPI_REAL",0, "MULTIGRID", ier)

else
do nc=1,nch2d
Expand Down Expand Up @@ -352,29 +349,32 @@ subroutine ens_marfield_ptp()

! Save random numbers and coefficient ar,ai,br,bi
if (write_markov_l) then
err = 0
if (ptopo_couleur == 0 .and. ptopo_myproc == 0) then
fn1=trim(Out_dirname_S)//'/'// 'MRKV_SPP_'//trim(vname(nc))//'.bin'
unf1=1
open ( unf1,file=trim(fn1),status='NEW', &
form='unformatted',iostat=errop )
if ( errop == 0 ) then
write(output_unit,2000) 'WRITING', trim(fn1)
unf0=0
fn=trim(Out_dirname_S)//'/'// 'MRKV_SPP_'//trim(vname(nc))//'.bin'
ier=fnom(unf0,fn,'SEQ+UNF+NEW',0)

if ( ier == 0 ) then
write(output_unit,2000) 'WRITING', trim(fn)
do i=1,36
write (unf1)dumdum(i,np)
write (unf0)dumdum(i,np)
end do
do l=lmin,lmax
do m=1,l+1
write(unf1)ar_p(lmax-l+1,m,nc)
write(unf1)ai_p(lmax-l+1,m,nc)
write(unf1)br_p(lmax-l+1,m,nc)
write(unf1)bi_p(lmax-l+1,m,nc)
write(unf0)ar_p(lmax-l+1,m,nc)
write(unf0)ai_p(lmax-l+1,m,nc)
write(unf0)br_p(lmax-l+1,m,nc)
write(unf0)bi_p(lmax-l+1,m,nc)
end do
end do
close(unf1)
ier=fclos(unf0)
else
write(output_unit,4000) 'WRITING', trim(fn1)
err = -1
write(output_unit, *) 'Error: problem writing Markov Chain file '//trim(fn)
endif
endif
call gem_error(err,'Ens_marfield_ptp','Error in writing Markov Chains files')
endif

do l=lmin,lmax
Expand Down Expand Up @@ -490,16 +490,7 @@ subroutine ens_marfield_ptp()
1000 format( &
/,'INITIALIZE SCHEMES CONTROL PARAMETERS (S/R ENS_MARFIELD_PTP_SPP)', &
/,'======================================================')
1005 format (/' Problem:Cannot find Markov file: ',a)
2000 format (/' MARKOV: ',a,' FILE ',a)

3000 format (/' S/R ENS_MARFIELD_PTP : problem in opening MRKV_PARAM_PTP_SPP file: ',a)

!3000 format(' S/R ENS_MARFIELD_PTP : problem in opening MRKV_PARAM_PTP_SPP file)', &
! ',a,')

4000 format(' S/R ENS_MARFIELD_PTP : problem in WRITING MRKV_PARAM_PTP_SPP file)', &
/,'======================================================')
6000 format('ens_marfield_ptp at gmm_get(',A,')')


Expand Down
57 changes: 28 additions & 29 deletions src/gemdyn/src/base/ens_marfield_skeb.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ subroutine ens_marfield_skeb(fgem)

real, dimension(l_ni,l_nj), intent(out) :: fgem
!
!author: Rabah Aider R.P.N-A
!
!arguments none
!
#include <rmnlib_basics.hf>

Expand Down Expand Up @@ -71,8 +68,8 @@ subroutine ens_marfield_skeb(fgem)
real(kind=REAL64), dimension(:), allocatable :: wrk1
real(kind=REAL64), dimension(:,:,:),allocatable :: cc
real , dimension(:,:),allocatable :: f
integer :: unf0, unf1, err, errop, itstep_s, iperiod_iau
character(len=1024) fn0, fn1
integer :: unf0, err, itstep_s, iperiod_iau
character(len=1024) fn
!
!---------------------------------------------------------------------
!
Expand Down Expand Up @@ -137,13 +134,13 @@ subroutine ens_marfield_skeb(fgem)
!Initialise spectral coeffs and stochastic params
if(Ens_recycle_mc) then
!Read saved stochastic numbers and spectral coeffs ar,br.ai,bi
if (ptopo_myproc==0 .and. ptopo_couleur==0) then
unf0=1
fn0= trim(Path_input_S)//'/MODEL_INPUT'//'/MRKV_SKEB.bin'
open ( unf0,file=trim(fn0),status='OLD', &
form='unformatted',iostat=errop )
if (errop == 0) then
write(output_unit,2000) 'READING', trim(fn0)
if (ptopo_couleur == 0 .and. ptopo_myproc == 0) then
unf0=0
fn= trim(Path_input_S)//'/MODEL_INPUT'//'/MRKV_SKEB.bin'
ier=fnom(unf0,fn,'SEQ+UNF+OLD',0)

if (ier == 0) then
write(output_unit,2000) 'READING', trim(fn)
do i=1,36
read (unf0)dumdum(i,1)
end do
Expand All @@ -155,12 +152,13 @@ subroutine ens_marfield_skeb(fgem)
read(unf0)bi_s(lmax-l+1,m)
end do
end do
close(unf0)
ier = fclos(unf0)
else
write (output_unit, 3000) trim(fn0)
call gem_error ( err,'read_markov_skeb', 'problem reading file' )
write (output_unit, 3000) trim(fn)
endif
endif
call gem_error ( ier,'read_markov_skeb', 'problem reading file' )

dim=ens_skeb_l*ens_skeb_m
call RPN_COMM_bcast (dumdum,36,"MPI_INTEGER",0,"MULTIGRID", err)
call RPN_COMM_bcast (ar_s,dim,"MPI_REAL",0, "MULTIGRID", err)
Expand Down Expand Up @@ -242,28 +240,29 @@ subroutine ens_marfield_skeb(fgem)
! Save random numbers and coefficient ar,ai,br,bi
if (write_markov_l) then
if (ptopo_couleur == 0 .and. ptopo_myproc == 0) then
fn1=trim(Out_dirname_S)//'/'// 'MRKV_SKEB.bin'
unf1=1
open ( unf1,file=trim(fn1),status='NEW', &
form='unformatted',iostat=errop )
if ( errop == 0 ) then
write(output_unit,2000) 'WRITING', trim(fn1)
unf0=0
fn=trim(Out_dirname_S)//'/'// 'MRKV_SKEB.bin'
ier=fnom(unf0,fn,'SEQ+UNF+NEW',0)

if ( ier == 0 ) then
write(output_unit,2000) 'WRITING', trim(fn)
do i=1,36
write (unf1)dumdum(i,1)
write (unf0)dumdum(i,1)
end do
do l=lmin,lmax
do m=1,l+1
write(unf1)ar_s(lmax-l+1,m)
write(unf1)ai_s(lmax-l+1,m)
write(unf1)br_s(lmax-l+1,m)
write(unf1)bi_s(lmax-l+1,m)
write(unf0)ar_s(lmax-l+1,m)
write(unf0)ai_s(lmax-l+1,m)
write(unf0)br_s(lmax-l+1,m)
write(unf0)bi_s(lmax-l+1,m)
end do
end do
close(unf1)
ier=fclos(unf0)
else
write(output_unit,4000) 'WRITING', trim(fn1)
write(output_unit, 4000) 'WRITING ', trim(fn)
endif
endif
call gem_error(ier,'Ens_marfield_SKEB','Error in writing Markov Chains files')
endif

do l=lmin,lmax
Expand Down Expand Up @@ -359,7 +358,7 @@ subroutine ens_marfield_skeb(fgem)
/,'INITIALIZE SCHEMES CONTROL PARAMETERS (S/R ENS_MARFIELD_SKEB)', &
/,'======================================================')

2000 format (/' MARKOV: ',a,' FILE ',a)
2000 format (/' ENS_MARFIELD_SKEB : ',a,' FILE ',a)

3000 format(' S/R ENS_MARFIELD_SKEB : problem in opening MRKV_PARAM_SKEB file)', &
/,'======================================================')
Expand Down
5 changes: 5 additions & 0 deletions src/gemdyn/src/base/gemdm_config.F90
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ integer function gemdm_config()
return
endif

if (Dynamics_hauteur_L.and.Iau_interval > 0.) then
if(lun_out>0) write (Lun_out, '(/" ====> IAU Not allowed with GEM-H")' )
return
endif

select case ( trim(Dynamics_Kernel_S) )
case ('DYNAMICS_FISL_P')
call set_zeta ( hyb, G_nk )
Expand Down
1 change: 0 additions & 1 deletion src/gemdyn/src/base/init_component.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ subroutine init_component()
implicit none

include 'rpn_comm.inc'
include 'gemdyn_version.inc'
#include <rmnlib_basics.hf>

integer, external :: model_timeout_alarm, OMP_get_max_threads
Expand Down
2 changes: 1 addition & 1 deletion src/gemdyn/src/base/out_tracer.F90
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ subroutine out_tracer (levset, set)
!
lijk(3) = G_nk+1
uijk(3) = G_nk+1
ptr3d => w4(Grd_lphy_i0:Grd_lphy_in,Grd_lphy_j0:Grd_lphy_jn,1:G_nk+1)
ptr3d => w4(Grd_lphy_i0:Grd_lphy_in,Grd_lphy_j0:Grd_lphy_jn,G_nk+1:G_nk+1)

if (Level_typ_S(levset) == 'M') then ! output tracers on model levels

Expand Down
1 change: 1 addition & 0 deletions src/gemdyn/src/base/set_sol.F90
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ subroutine set_sol
vv(sol_imin:sol_imax,sol_jmin:sol_jmax,1:l_nk,1:sol_im+1),&
wint_8(sol_ii0:sol_iin,sol_jj0:sol_jjn,1:l_nk,1:sol_im+1))
allocate (thread_s(1:4,0:OMP_get_max_threads()-1),&
thread_s128(1:4,0:OMP_get_max_threads()-1),&
thread_s2(1:2,1:sol_im+1,0:OMP_get_max_threads()-1))

allocate (A1(l_minx:l_maxx, l_miny:l_maxy,1:l_nk,1:15),&
Expand Down
5 changes: 5 additions & 0 deletions src/gemdyn/src/base/sol_fgmres.F90
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ subroutine sol_fgmres ( solution, rhs_b, F_print_L )
!
! ---------------------------------------------------------------
!
if (Sol_quadnorm_L) then
call sol_fgmres_QUAD ( solution, rhs_b, F_print_L )
return
endif

outiter= 0 ; nbiter= 0 ; conv= 0.d0

! Residual of the initial iterate
Expand Down
Loading

0 comments on commit 1a5bd80

Please sign in to comment.