source: LMDZ5/trunk/libf/dynlonlat_phylonlat/phylmd/ce0l.F90 @ 2349

Last change on this file since 2349 was 2349, checked in by Ehouarn Millour, 9 years ago

Fix call to iniphysiq in ce0l.
EM

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.2 KB
RevLine 
[2293]1PROGRAM ce0l
[2336]2!
3!-------------------------------------------------------------------------------
4! Purpose: Initial states and boundary conditions files creation:
5!     * start.nc    for dynamics    (using etat0dyn     routine)
6!     * startphy.nc for physics     (using etat0phys    routine)
7!     * limit.nc    for forced runs (using limit_netcdf routine)
8!-------------------------------------------------------------------------------
9! Notes:
10!     * extrap=.T. (default) for data extrapolation, like for the SSTs when file
11!                   does contain ocean points only.
12!     * "masque" can be:
13!       - read from file "o2a.nc"          (for coupled runs).
14!       - created in etat0phys or etat0dyn (for forced  runs).
15!     It is then passed to limit_netcdf to ensure consistancy.
16!-------------------------------------------------------------------------------
[2293]17  USE ioipsl, ONLY: ioconf_calendar, getin, flininfo, flinopen, flinget, flinclo
[2336]18  USE control_mod,    ONLY: day_step, dayref, nsplit_phys
19  USE etat0dyn,       ONLY: etat0dyn_netcdf
20  USE etat0phys,      ONLY: etat0phys_netcdf
21  USE limit,          ONLY: limit_netcdf
22  USE netcdf,         ONLY: NF90_OPEN, NF90_NOWRITE, NF90_CLOSE, NF90_NOERR
23  USE infotrac,       ONLY: type_trac, infotrac_init
24  USE dimphy,         ONLY: klon
[2293]25  USE test_disvert_m, ONLY: test_disvert
[2336]26  USE filtreg_mod,    ONLY: inifilr
[2349]27  USE iniphysiq_mod,  ONLY: iniphysiq
[2336]28#ifdef inca
29  USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic
30#endif
31#ifdef CPP_PARA
32  USE mod_const_mpi,  ONLY: init_const_mpi
33  USE parallel_lmdz,  ONLY: init_parallel, mpi_rank, omp_rank, mpi_size
34  USE bands,          ONLY: read_distrib, distrib_phys
35  USE mod_hallo,      ONLY: init_mod_hallo
36  USE mod_interface_dyn_phys, ONLY: init_interface_dyn_phys
37#endif
[524]38
[1319]39  IMPLICIT NONE
[2293]40
[2336]41!-------------------------------------------------------------------------------
42! Local variables:
[2293]43  include "dimensions.h"
44  include "paramet.h"
[2336]45  include "comgeom2.h"
[2293]46  include "comconst.h"
47  include "comvert.h"
48  include "iniprint.h"
49  include "temps.h"
50  include "logic.h"
[2336]51  REAL               :: masque(iip1,jjp1)             !--- CONTINENTAL MASK
52  REAL               :: phis  (iip1,jjp1)             !--- GROUND GEOPOTENTIAL
[2293]53  CHARACTER(LEN=256) :: modname, fmt, calnd           !--- CALENDAR TYPE
54  LOGICAL            :: use_filtre_fft
[2336]55  LOGICAL, PARAMETER :: extrap=.FALSE.
[2293]56
[2336]57!--- Local variables for ocean mask reading:
[2293]58  INTEGER            :: nid_o2a, iml_omask, jml_omask, j
59  INTEGER            :: fid, iret, llm_tmp, ttm_tmp, itaul(1)
[2336]60  REAL, ALLOCATABLE  :: lon_omask(:,:), dlon_omask(:), ocemask(:,:)
61  REAL, ALLOCATABLE  :: lat_omask(:,:), dlat_omask(:), ocetmp (:,:)
[2293]62  REAL               :: date, lev(1)
[2336]63!-------------------------------------------------------------------------------
[2293]64  modname="ce0l"
65
[2336]66!--- Constants
[2293]67  pi     = 4. * ATAN(1.)
68  rad    = 6371229.
69  daysec = 86400.
70  omeg   = 2.*pi/daysec
71  g      = 9.8
72  kappa  = 0.2857143
73  cpp    = 1004.70885
74  jmp1   = jjm + 1
75  preff   = 101325.
76  pa      = 50000.
77
[2221]78  CALL conf_gcm( 99, .TRUE. )
[2331]79  dtvr = daysec/REAL(day_step)
[2336]80  WRITE(lunout,*)'dtvr',dtvr
[2293]81  CALL iniconst()
82  CALL inigeom()
[822]83
[2336]84!--- Calendar choice
[1279]85#ifdef CPP_IOIPSL
[2293]86  calnd='gregorian'
[1319]87  SELECT CASE(calend)
[2336]88    CASE('earth_360d');CALL ioconf_calendar('360d');   calnd='with 360 days/year'
89    CASE('earth_365d');CALL ioconf_calendar('noleap'); calnd='with no leap year'
90    CASE('earth_366d');CALL ioconf_calendar('366d');   calnd='with leap years only'
91    CASE('gregorian'); CALL ioconf_calendar('gregorian')
92    CASE('standard');  CALL ioconf_calendar('gregorian')
93    CASE('julian');    CALL ioconf_calendar('julian'); calnd='julian'
94    CASE('proleptic_gregorian'); CALL ioconf_calendar('gregorian')
95  !--- DC Bof...  => IOIPSL a mettre a jour: proleptic_gregorian /= gregorian
96    CASE DEFAULT
97      CALL abort_gcm('ce0l','Bad choice for calendar',1)
[1319]98  END SELECT
[2336]99  WRITE(lunout,*)'CHOSEN CALENDAR: Earth '//TRIM(calnd)
[1279]100#endif
101
[2336]102#ifdef CPP_PARA
103!--- Physical grid + parallel initializations
104  CALL init_const_mpi()
105  CALL init_parallel()
106  CALL read_distrib()
107  CALL init_mod_hallo()
108  CALL Init_Phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
109  CALL init_interface_dyn_phys()
110#else
111  CALL Init_Phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
112#endif
113  WRITE(lunout,*)'---> klon=',klon
114
115!--- Tracers initializations
116  IF (type_trac == 'inca') THEN
117#ifdef INCA
118    CALL init_const_lmdz(nbtr,anneeref,dayref,iphysiq,day_step,nday,&
119                         nbsrf,is_oce,is_sic,is_ter,is_lic,calend)
120    CALL init_inca_para(iim,jjp1,llm,klon_glo,mpi_size,distrib_phys,&
121                        COMM_LMDZ)
122    WRITE(lunout,*)'nbtr =' , nbtr
123#endif
124  END IF
125  CALL infotrac_init()
126
127  CALL inifilr()
128  CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys/nsplit_phys, &
[2349]129                 rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp,iflag_phys)
[2336]130  IF(pressure_exner) CALL test_disvert
131
132#ifdef CPP_PARA
133  IF (mpi_rank==0.AND.omp_rank==0) THEN
134#endif
[2293]135  use_filtre_fft=.FALSE.
[2336]136  CALL getin('use_filtre_fft',use_filtre_fft)
[2293]137  IF(use_filtre_fft) THEN
[2336]138     WRITE(lunout,*)"FFT filter not available for sequential dynamics."
139     WRITE(lunout,*)"Your setting of variable use_filtre_fft is not used."
[2293]140  ENDIF
141
[2336]142!--- LAND MASK. TWO CASES:
143!   1) read from ocean model    file "o2a.nc"    (coupled runs)
144!   2) computed from topography file "Relief.nc" (masque(:,:)=-99999.)
145! Coupled simulations (case 1) use the ocean model mask to compute the
146! weights to ensure ocean fractions are the same for atmosphere and ocean.
147!*******************************************************************************
[2293]148  IF(NF90_OPEN("o2a.nc", NF90_NOWRITE, nid_o2a)/=NF90_NOERR) THEN
[2336]149    WRITE(lunout,*)'BEWARE !! No ocean mask "o2a.nc" file found'
150    WRITE(lunout,*)'Forced run.'
151    masque(:,:)=-99999.
[2293]152  ELSE
[2336]153    iret=NF90_CLOSE(nid_o2a)
154    WRITE(lunout,*)'BEWARE !! Ocean mask "o2a.nc" file found'
155    WRITE(lunout,*)'Coupled run.'
156    CALL flininfo("o2a.nc", iml_omask, jml_omask, llm_tmp, ttm_tmp, nid_o2a)
157    IF(iml_omask/=iim .OR.jml_omask/=jjp1) THEN
158      WRITE(lunout,*)'Mismatching dimensions for ocean mask'
159      WRITE(lunout,*)'iim  = ',iim ,' iml_omask = ',iml_omask
160      WRITE(lunout,*)'jjp1 = ',jjp1,' jml_omask = ',jml_omask
161      CALL abort_gcm(modname,'',1)
162    END IF
163    ALLOCATE(ocemask(iim,jjp1),lon_omask(iim,jjp1),dlon_omask(iim ))
164    ALLOCATE(ocetmp (iim,jjp1),lat_omask(iim,jjp1),dlat_omask(jjp1))
[2338]165    CALL flinopen("o2a.nc", .FALSE.,iml_omask,jml_omask,llm_tmp,               &
166                  lon_omask,lat_omask,lev,ttm_tmp,itaul,date,dt,fid)
[2336]167    CALL flinget(fid, "OceMask",    iim,jjp1,llm_tmp,ttm_tmp,1,1,ocetmp)
168    CALL flinclo(fid)
169    dlon_omask(1:iim ) = lon_omask(1:iim,1)
170    dlat_omask(1:jjp1) = lat_omask(1,1:jjp1)
171    ocemask = ocetmp
172    IF(dlat_omask(1)<dlat_omask(jml_omask)) THEN
173      DO j=1,jjp1; ocemask(:,j) = ocetmp(:,jjp1-j+1); END DO
174    END IF
175    DEALLOCATE(ocetmp,lon_omask,lat_omask,dlon_omask,dlat_omask)
176    IF(prt_level>=1) THEN
177      WRITE(fmt,"(i4,'i1)')")iim ; fmt='('//ADJUSTL(fmt)
178      WRITE(lunout,*)'OCEAN MASK :'
179      WRITE(lunout,fmt) NINT(ocemask)
180    END IF
181    masque(1:iim,:)=1.-ocemask(:,:)
182    masque(iip1 ,:)=masque(1,:)
183    DEALLOCATE(ocemask)
[2293]184  END IF
[2336]185  phis(:,:)=-99999.
[2293]186
187  IF(ok_etat0) THEN
[2336]188    WRITE(lunout,'(//)')
189    WRITE(lunout,*) '  ************************  '
190    WRITE(lunout,*) '  ***  etat0phy_netcdf ***  '
191    WRITE(lunout,*) '  ************************  '
192    CALL etat0phys_netcdf(masque,phis)
193    WRITE(lunout,'(//)')
194    WRITE(lunout,*) '  ************************  '
195    WRITE(lunout,*) '  ***  etat0dyn_netcdf ***  '
196    WRITE(lunout,*) '  ************************  '
197    CALL etat0dyn_netcdf(masque,phis)
[2293]198  END IF
[524]199
[2336]200  IF(ok_limit) THEN
201    WRITE(lunout,'(//)')
202    WRITE(lunout,*) '  *********************  '
203    WRITE(lunout,*) '  ***  Limit_netcdf ***  '
204    WRITE(lunout,*) '  *********************  '
205    WRITE(lunout,'(//)')
206    CALL limit_netcdf(masque,phis,extrap)
[2293]207  END IF
[524]208
[2336]209  WRITE(lunout,'(//)')
210  WRITE(lunout,*) '  ***************************  '
211  WRITE(lunout,*) '  ***  grilles_gcm_netcdf ***  '
212  WRITE(lunout,*) '  ***************************  '
213  WRITE(lunout,'(//)')
214  CALL grilles_gcm_netcdf_sub(masque,phis)
215
216#ifdef CPP_PARA
[1319]217  END IF
[2336]218#endif
[1319]219
220END PROGRAM ce0l
[2336]221!
222!-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.