Changeset 4120 for LMDZ6/trunk/libf/dyn3d/dynetat0.F90
- Timestamp:
- Apr 5, 2022, 3:44:30 PM (2 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/dyn3d/dynetat0.F90
r4119 r4120 6 6 ! Purpose: Initial state reading. 7 7 !------------------------------------------------------------------------------- 8 USE infotrac, ONLY: nqtot, tracers, iqiso, iso_indnum, tnat, alpha_ideal, &9 ok_isotopes10 USE strings_mod, ONLY: maxlen11 USE netcdf, ONLY: NF90_OPEN, NF90_NOWRITE, NF90_INQ_VARID, NF90_NoErr, &12 NF90_CLOSE, NF90_GET_VAR8 USE infotrac, ONLY: nqtot, tracers, niso, iqiso, iso_indnum, iso_num, tnat, alpha_ideal, ok_isotopes, iH2O 9 USE strings_mod, ONLY: maxlen, msg, strStack, real2str 10 USE netcdf, ONLY: NF90_OPEN, NF90_NOWRITE, NF90_INQ_VARID, & 11 NF90_CLOSE, NF90_GET_VAR, NF90_NoErr 12 USE readTracFiles_mod, ONLY: new2oldName 13 13 USE control_mod, ONLY: planet_type 14 14 USE assert_eq_m, ONLY: assert_eq … … 38 38 !=============================================================================== 39 39 ! Local variables: 40 CHARACTER(LEN=maxlen) :: m sg, var, modname40 CHARACTER(LEN=maxlen) :: mesg, var, modname, oldVar 41 41 INTEGER, PARAMETER :: length=100 42 42 INTEGER :: iq, fID, vID, idecal, iqParent, iName, iZone, iPhase … … 53 53 !!! .... while keeping everything OK for LMDZ EARTH 54 54 IF(planet_type=="generic") THEN 55 WRITE(lunout,*)'NOTE NOTE NOTE : Planeto-like start files'55 CALL msg('NOTE NOTE NOTE : Planeto-like start files', modname) 56 56 idecal = 4 57 57 annee_ref = 2000 58 58 ELSE 59 WRITE(lunout,*)'NOTE NOTE NOTE : Earth-like start files'59 CALL msg('NOTE NOTE NOTE : Earth-like start files', modname) 60 60 idecal = 5 61 61 annee_ref = tab_cntrl(5) … … 101 101 102 102 !------------------------------------------------------------------------------- 103 WRITE(lunout,*)TRIM(modname)//': rad,omeg,g,cpp,kappa',rad,omeg,g,cpp,kappa103 CALL msg('rad, omeg, g, cpp, kappa = '//TRIM(strStack(real2str([rad,omeg,g,cpp,kappa]))), modname) 104 104 CALL check_dim(im,iim,'im','im') 105 105 CALL check_dim(jm,jjm,'jm','jm') … … 114 114 var="temps" 115 115 IF(NF90_INQ_VARID(fID,var,vID)/=NF90_NoErr) THEN 116 WRITE(lunout,*)TRIM(modname)//": missing field <temps>"117 WRITE(lunout,*)TRIM(modname)//": trying with <Time>";var="Time"116 CALL msg('missing field <temps> ; trying with <Time>', modname) 117 var="Time" 118 118 CALL err(NF90_INQ_VARID(fID,var,vID),"inq",var) 119 119 END IF … … 128 128 !--- Tracers 129 129 DO iq=1,nqtot 130 var=TRIM(tracers(iq)%name) 131 IF(NF90_INQ_VARID(fID,var,vID)==NF90_NoErr) THEN 132 CALL err(NF90_GET_VAR(fID,vID,q(:,:,:,iq)),"get",var); CYCLE 130 var = tracers(iq)%name 131 oldVar = new2oldName(var) 132 !-------------------------------------------------------------------------------------------------------------------------- 133 IF(NF90_INQ_VARID(fID, var, vID) == NF90_NoErr) THEN !=== REGULAR CASE 134 CALL err(NF90_GET_VAR(fID,vID,q(:,:,:,iq)),"get",var) 135 !-------------------------------------------------------------------------------------------------------------------------- 136 ELSE IF(NF90_INQ_VARID(fID, oldVar, vID) == NF90_NoErr) THEN !=== OLD NAME 137 CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to <'//TRIM(oldVar)//'>', modname) 138 CALL err(NF90_GET_VAR(fID,vID,q(:,:,:,iq)),"get",oldVar) 139 !-------------------------------------------------------------------------------------------------------------------------- 140 #ifdef INCA 141 ELSE IF(NF90_INQ_VARID(fID, 'OX', vID) == NF90_NoErr .AND. var == 'O3') THEN !=== INCA: OX INSTEAD OF O3 142 CALL msg('Tracer <O3> is missing => initialized to <OX>', modname) 143 CALL err(NF90_GET_VAR(fID,vID,q(:,:,:,iq)),"get",'OX') 144 !-------------------------------------------------------------------------------------------------------------------------- 145 #endif 146 ELSE IF(tracers(iq)%iso_iGroup == iH2O .AND. niso > 0) THEN !=== WATER ISOTOPES 147 ! iName = tracers(iq)%iso_iName ! (next commit) 148 iName = iso_num(iq) 149 iPhase = tracers(iq)%iso_iPhase 150 iqParent = tracers(iq)%iqParent 151 IF(tracers(iq)%iso_iZone == 0) THEN 152 CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized with a simplified Rayleigh distillation law.', modname) 153 q(:,:,:,iq) = q(:,:,:,iqParent)*tnat(iName)*(q(:,:,:,iqParent)/30.e-3)**(alpha_ideal(iName)-1.) 154 ELSE 155 CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to its parent isotope concentration.', modname) 156 q(:,:,:,iq) = q(:,:,:,iqiso(iso_indnum(iq),iPhase)) 157 END IF 158 !-------------------------------------------------------------------------------------------------------------------------- 159 ELSE !=== MISSING: SET TO 0 160 CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to zero', modname) 161 q(:,:,:,iq)=0. 162 !-------------------------------------------------------------------------------------------------------------------------- 133 163 END IF 134 WRITE(lunout,*)TRIM(modname)//": Tracer <"//TRIM(var)//"> is missing"135 WRITE(lunout,*)" It is hence initialized to zero"136 q(:,:,:,iq)=0.137 !--- CRisi: for isotops, theoretical initialization using very simplified138 ! Rayleigh distillation law.139 iName = tracers(iq)%iso_iName140 IF(.NOT.ok_isotopes .OR. iName<=0) CYCLE141 iZone = tracers(iq)%iso_iZone142 iPhase= tracers(iq)%iso_iPhase143 iqParent = tracers(iq)%iqParent144 IF(iZone==0) q(:,:,:,iq) = q(:,:,:,iqParent)*tnat(iName) &145 *(q(:,:,:,iqParent)/30.e-3)**(alpha_ideal(iName)-1.)146 IF(iZone==1) q(:,:,:,iq) = q(:,:,:,iqiso(iso_indnum(iq),iPhase))147 164 END DO 148 165 … … 162 179 s1='value of '//TRIM(str1)//' =' 163 180 s2=' read in starting file differs from parametrized '//TRIM(str2)//' =' 164 WRITE(m sg,'(10x,a,i4,2x,a,i4)')TRIM(ADJUSTL(s1)),n1,TRIM(ADJUSTL(s2)),n2165 CALL ABORT_gcm(TRIM(modname),TRIM(m sg),1)181 WRITE(mesg,'(10x,a,i4,2x,a,i4)')TRIM(ADJUSTL(s1)),n1,TRIM(ADJUSTL(s2)),n2 182 CALL ABORT_gcm(TRIM(modname),TRIM(mesg),1) 166 183 END IF 167 184 END SUBROUTINE check_dim … … 198 215 IF(ierr==NF90_NoERR) RETURN 199 216 SELECT CASE(typ) 200 CASE('inq'); m sg="Field <"//TRIM(nam)//"> is missing"201 CASE('get'); m sg="Reading failed for <"//TRIM(nam)//">"202 CASE('open'); m sg="File opening failed for <"//TRIM(nam)//">"203 CASE('close'); m sg="File closing failed for <"//TRIM(nam)//">"217 CASE('inq'); mesg="Field <"//TRIM(nam)//"> is missing" 218 CASE('get'); mesg="Reading failed for <"//TRIM(nam)//">" 219 CASE('open'); mesg="File opening failed for <"//TRIM(nam)//">" 220 CASE('close'); mesg="File closing failed for <"//TRIM(nam)//">" 204 221 END SELECT 205 CALL ABORT_gcm(TRIM(modname),TRIM(m sg),1)222 CALL ABORT_gcm(TRIM(modname),TRIM(mesg),ierr) 206 223 END SUBROUTINE err 207 224
Note: See TracChangeset
for help on using the changeset viewer.