[2293] | 1 | PROGRAM ce0l |
---|
[524] | 2 | ! |
---|
[1319] | 3 | !------------------------------------------------------------------------------- |
---|
| 4 | ! Purpose: Calls etat0, creates initial states and limit_netcdf |
---|
| 5 | ! |
---|
| 6 | ! interbar=.T. for barycentric interpolation inter_barxy |
---|
| 7 | ! extrap =.T. for data extrapolation, like for the SSTs when file does not |
---|
| 8 | ! contain ocean points only. |
---|
| 9 | ! oldice =.T. for old-style ice, obtained using grille_m (grid_atob). |
---|
| 10 | ! masque is created in etat0, passed to limit to ensure consistancy. |
---|
| 11 | !------------------------------------------------------------------------------- |
---|
[1403] | 12 | USE control_mod |
---|
[2293] | 13 | |
---|
| 14 | !#ifdef CPP_EARTH |
---|
| 15 | !! This prog. is designed to work for Earth |
---|
| 16 | USE etat0dyn |
---|
| 17 | USE netcdf, ONLY: NF90_OPEN, NF90_NOWRITE, NF90_CLOSE, NF90_NOERR |
---|
| 18 | USE ioipsl, ONLY: ioconf_calendar, getin, flininfo, flinopen, flinget, flinclo |
---|
| 19 | |
---|
| 20 | #ifdef CPP_PHYS |
---|
| 21 | USE etat0phys |
---|
[1319] | 22 | USE dimphy |
---|
| 23 | USE comgeomphy |
---|
| 24 | USE infotrac |
---|
[1785] | 25 | USE indice_sol_mod |
---|
[2293] | 26 | USE test_disvert_m, ONLY: test_disvert |
---|
[1279] | 27 | #endif |
---|
[2293] | 28 | ! of #ifdef CPP_PHYS |
---|
[524] | 29 | |
---|
[2293] | 30 | !#endif |
---|
| 31 | !! of #ifdef CPP_EARTH |
---|
| 32 | |
---|
[1319] | 33 | IMPLICIT NONE |
---|
[2293] | 34 | |
---|
[1319] | 35 | !------------------------------------------------------------------------------- |
---|
| 36 | ! Local variables: |
---|
[2293] | 37 | !#ifndef CPP_EARTH |
---|
| 38 | ! include "iniprint.h" |
---|
| 39 | !!------------------------------------------------------------------------------- |
---|
| 40 | ! WRITE(lunout,*)'ce0l: Earth-specific routine, needs Earth physics' |
---|
| 41 | !#else |
---|
| 42 | include "dimensions.h" |
---|
| 43 | include "paramet.h" |
---|
| 44 | include "comconst.h" |
---|
| 45 | include "comvert.h" |
---|
| 46 | include "iniprint.h" |
---|
| 47 | include "temps.h" |
---|
| 48 | include "logic.h" |
---|
| 49 | REAL :: masque(iip1,jjp1) !--- CONTINENTAL MASK |
---|
| 50 | REAL :: phis (iip1,jjp1) !--- GROUND GEOPOTENTIAL |
---|
| 51 | CHARACTER(LEN=256) :: modname, fmt, calnd !--- CALENDAR TYPE |
---|
| 52 | LOGICAL :: use_filtre_fft |
---|
[1319] | 53 | LOGICAL, PARAMETER :: interbar=.TRUE., extrap=.FALSE., oldice=.FALSE. |
---|
[2293] | 54 | |
---|
| 55 | !--- Local variables for ocean mask reading: |
---|
| 56 | INTEGER :: nid_o2a, iml_omask, jml_omask, j |
---|
| 57 | INTEGER :: fid, iret, llm_tmp, ttm_tmp, itaul(1) |
---|
| 58 | REAL, ALLOCATABLE :: lon_omask(:,:), dlon_omask(:), ocemask(:,:) |
---|
| 59 | REAL, ALLOCATABLE :: lat_omask(:,:), dlat_omask(:), ocetmp (:,:) |
---|
| 60 | REAL :: date, lev(1) |
---|
[1319] | 61 | !------------------------------------------------------------------------------- |
---|
[2293] | 62 | modname="ce0l" |
---|
| 63 | |
---|
| 64 | !--- Constants |
---|
| 65 | pi = 4. * ATAN(1.) |
---|
| 66 | rad = 6371229. |
---|
| 67 | daysec = 86400. |
---|
| 68 | omeg = 2.*pi/daysec |
---|
| 69 | g = 9.8 |
---|
| 70 | kappa = 0.2857143 |
---|
| 71 | cpp = 1004.70885 |
---|
| 72 | jmp1 = jjm + 1 |
---|
| 73 | preff = 101325. |
---|
| 74 | pa = 50000. |
---|
| 75 | |
---|
[2221] | 76 | CALL conf_gcm( 99, .TRUE. ) |
---|
[524] | 77 | |
---|
[2293] | 78 | dtvr = daysec/FLOAT(day_step) |
---|
| 79 | WRITE(lunout,*)'dtvr',dtvr |
---|
[2248] | 80 | |
---|
[2293] | 81 | CALL iniconst() |
---|
| 82 | #ifdef CPP_PHYS |
---|
| 83 | IF(pressure_exner) CALL test_disvert |
---|
| 84 | #endif |
---|
| 85 | CALL inigeom() |
---|
[822] | 86 | |
---|
[1279] | 87 | #ifdef CPP_IOIPSL |
---|
[2293] | 88 | calnd='gregorian' |
---|
[1319] | 89 | SELECT CASE(calend) |
---|
[2293] | 90 | CASE('earth_360d');CALL ioconf_calendar('360d'); calnd='with 360 days/year' |
---|
| 91 | CASE('earth_365d');CALL ioconf_calendar('noleap'); calnd='with no leap year' |
---|
| 92 | CASE('earth_366d');CALL ioconf_calendar('366d'); calnd='with leap years only' |
---|
| 93 | CASE('gregorian'); CALL ioconf_calendar('gregorian') |
---|
| 94 | CASE('standard'); CALL ioconf_calendar('gregorian') |
---|
| 95 | CASE('julian'); CALL ioconf_calendar('julian'); calnd='julian' |
---|
[1319] | 96 | CASE('proleptic_gregorian'); CALL ioconf_calendar('gregorian') |
---|
| 97 | !--- DC Bof... => IOIPSL a mettre a jour: proleptic_gregorian /= gregorian |
---|
| 98 | CASE DEFAULT |
---|
[2293] | 99 | CALL abort_gcm('ce0l','Bad choice for calendar',1) |
---|
[1319] | 100 | END SELECT |
---|
[2293] | 101 | WRITE(lunout,*)'CHOSEN CALENDAR: Earth '//TRIM(calnd) |
---|
[1279] | 102 | #endif |
---|
| 103 | |
---|
[2293] | 104 | use_filtre_fft=.FALSE. |
---|
| 105 | CALL getin('use_filtre_fft',use_filtre_fft) |
---|
| 106 | IF(use_filtre_fft) THEN |
---|
| 107 | WRITE(lunout,*)"FFT filter not available for sequential dynamics." |
---|
| 108 | WRITE(lunout,*)"Your setting of variable use_filtre_fft is not used." |
---|
| 109 | ENDIF |
---|
| 110 | |
---|
| 111 | !--- LAND MASK. TWO CASES: |
---|
| 112 | ! 1) read from ocean model file "o2a.nc" (coupled runs) |
---|
| 113 | ! 2) computed from topography file "Relief.nc" (masque(:,:)=-99999.) |
---|
| 114 | ! Coupled simulations (case 1) use the ocean model mask to compute the |
---|
| 115 | ! weights to ensure ocean fractions are the same for atmosphere and ocean. |
---|
| 116 | !******************************************************************************* |
---|
| 117 | IF(NF90_OPEN("o2a.nc", NF90_NOWRITE, nid_o2a)/=NF90_NOERR) THEN |
---|
| 118 | WRITE(lunout,*)'BEWARE !! No ocean mask "o2a.nc" file found' |
---|
| 119 | WRITE(lunout,*)'Forced run.' |
---|
| 120 | masque(:,:)=-99999. |
---|
| 121 | ELSE |
---|
| 122 | iret=NF90_CLOSE(nid_o2a) |
---|
| 123 | WRITE(lunout,*)'BEWARE !! Ocean mask "o2a.nc" file found' |
---|
| 124 | WRITE(lunout,*)'Coupled run.' |
---|
| 125 | CALL flininfo("o2a.nc", iml_omask, jml_omask, llm_tmp, ttm_tmp, nid_o2a) |
---|
| 126 | IF(iml_omask/=iim .OR.jml_omask/=jjp1) THEN |
---|
| 127 | WRITE(lunout,*)'Mismatching dimensions for ocean mask' |
---|
| 128 | WRITE(lunout,*)'iim = ',iim ,' iml_omask = ',iml_omask |
---|
| 129 | WRITE(lunout,*)'jjp1 = ',jjp1,' jml_omask = ',jml_omask |
---|
| 130 | CALL abort_gcm(modname,'',1) |
---|
| 131 | END IF |
---|
| 132 | ALLOCATE(ocemask(iim,jjp1),lon_omask(iim,jjp1),dlon_omask(iim )) |
---|
| 133 | ALLOCATE(ocetmp (iim,jjp1),lat_omask(iim,jjp1),dlat_omask(jjp1)) |
---|
| 134 | CALL flinopen("o2a.nc", .FALSE.,iim,jjp1,llm_tmp,lon_omask,lat_omask,lev, & |
---|
| 135 | & ttm_tmp,itaul,date,dt,fid) |
---|
| 136 | CALL flinget(fid, "OceMask", iim,jjp1,llm_tmp,ttm_tmp,1,1,ocetmp) |
---|
| 137 | CALL flinclo(fid) |
---|
| 138 | dlon_omask(1:iim ) = lon_omask(1:iim,1) |
---|
| 139 | dlat_omask(1:jjp1) = lat_omask(1,1:jjp1) |
---|
| 140 | ocemask = ocetmp |
---|
| 141 | IF(dlat_omask(1)<dlat_omask(jml_omask)) THEN |
---|
| 142 | DO j=1,jjp1; ocemask(:,j) = ocetmp(:,jjp1-j+1); END DO |
---|
| 143 | END IF |
---|
| 144 | DEALLOCATE(ocetmp,lon_omask,lat_omask,dlon_omask,dlat_omask) |
---|
| 145 | IF(prt_level>=1) THEN |
---|
| 146 | WRITE(fmt,"(i4,'i1)')")iim ; fmt='('//ADJUSTL(fmt) |
---|
| 147 | WRITE(lunout,*)'OCEAN MASK :' |
---|
| 148 | WRITE(lunout,fmt) NINT(ocemask) |
---|
| 149 | END IF |
---|
| 150 | masque(1:iim,:)=1.-ocemask(:,:) |
---|
| 151 | masque(iip1 ,:)=masque(1,:) |
---|
| 152 | DEALLOCATE(ocemask) |
---|
| 153 | END IF |
---|
| 154 | phis(:,:)=-99999. |
---|
| 155 | |
---|
| 156 | #ifdef CPP_PHYS |
---|
| 157 | CALL Init_Phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/)) |
---|
| 158 | WRITE(lunout,*)'---> klon=',klon |
---|
| 159 | CALL InitComgeomphy |
---|
| 160 | |
---|
[1563] | 161 | IF (type_trac == 'inca') THEN |
---|
[1319] | 162 | #ifdef INCA |
---|
| 163 | CALL init_const_lmdz(nbtr,anneeref,dayref,iphysiq,day_step,nday) |
---|
| 164 | CALL init_inca_para(iim,jjm+1,klon,1,klon_mpi_para_nb,0) |
---|
| 165 | WRITE(lunout,*)'nbtr =' , nbtr |
---|
| 166 | #endif |
---|
[2293] | 167 | ! of #ifdef INCA |
---|
[1319] | 168 | END IF |
---|
[2293] | 169 | IF(ok_etat0) THEN |
---|
| 170 | WRITE(lunout,'(//)') |
---|
| 171 | WRITE(lunout,*) ' ************************ ' |
---|
| 172 | WRITE(lunout,*) ' *** etat0phy_netcdf *** ' |
---|
| 173 | WRITE(lunout,*) ' ************************ ' |
---|
| 174 | WRITE(lunout,'(//)') |
---|
| 175 | WRITE(lunout,*) ' interbar = ',interbar |
---|
| 176 | CALL etat0phys_netcdf(interbar,masque,phis) |
---|
| 177 | END IF |
---|
| 178 | #endif |
---|
| 179 | ! of #ifdef CPP_PHYS |
---|
[524] | 180 | |
---|
[2293] | 181 | IF(ok_etat0) THEN |
---|
| 182 | WRITE(lunout,'(//)') |
---|
| 183 | WRITE(lunout,*) ' ************************ ' |
---|
| 184 | WRITE(lunout,*) ' *** etat0dyn_netcdf *** ' |
---|
| 185 | WRITE(lunout,*) ' ************************ ' |
---|
| 186 | WRITE(lunout,'(//)') |
---|
| 187 | WRITE(lunout,*) ' interbar = ',interbar |
---|
| 188 | CALL etat0dyn_netcdf(interbar,masque,phis) |
---|
| 189 | END IF |
---|
[524] | 190 | |
---|
[2293] | 191 | #ifdef CPP_PHYS |
---|
[1319] | 192 | IF(ok_limit) THEN |
---|
[2293] | 193 | WRITE(lunout,'(//)') |
---|
| 194 | WRITE(lunout,*) ' ********************* ' |
---|
| 195 | WRITE(lunout,*) ' *** Limit_netcdf *** ' |
---|
| 196 | WRITE(lunout,*) ' ********************* ' |
---|
| 197 | WRITE(lunout,'(//)') |
---|
| 198 | CALL limit_netcdf(interbar,extrap,oldice,masque) |
---|
[1319] | 199 | END IF |
---|
[2293] | 200 | #endif |
---|
[1319] | 201 | |
---|
[1984] | 202 | WRITE(lunout,'(//)') |
---|
| 203 | WRITE(lunout,*) ' *************************** ' |
---|
| 204 | WRITE(lunout,*) ' *** grilles_gcm_netcdf *** ' |
---|
| 205 | WRITE(lunout,*) ' *************************** ' |
---|
| 206 | WRITE(lunout,'(//)') |
---|
| 207 | CALL grilles_gcm_netcdf_sub(masque,phis) |
---|
| 208 | |
---|
[2293] | 209 | !#endif |
---|
[1319] | 210 | ! of #ifndef CPP_EARTH #else |
---|
| 211 | |
---|
| 212 | END PROGRAM ce0l |
---|
| 213 | ! |
---|
| 214 | !------------------------------------------------------------------------------- |
---|