Changeset 4446 for LMDZ6/branches/Portage_acc/libf/dyn3d/dynetat0.F90
- Timestamp:
- Mar 1, 2023, 6:22:39 PM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Portage_acc/libf/dyn3d/dynetat0.F90
r4124 r4446 6 6 ! Purpose: Initial state reading. 7 7 !------------------------------------------------------------------------------- 8 USE infotrac, ONLY: nqtot, tracers, niso, iq iso, iso_indnum, iso_num, tnat, alpha_ideal, iH2O9 USE strings_mod, ONLY: maxlen, msg, strStack, real2str 8 USE infotrac, ONLY: nqtot, tracers, niso, iqIsoPha, iH2O, isoName 9 USE strings_mod, ONLY: maxlen, msg, strStack, real2str, int2str 10 10 USE netcdf, ONLY: NF90_OPEN, NF90_NOWRITE, NF90_INQ_VARID, & 11 11 NF90_CLOSE, NF90_GET_VAR, NF90_NoErr 12 USE readTracFiles_mod, ONLY: new2old Name12 USE readTracFiles_mod, ONLY: new2oldH2O, newHNO3, oldHNO3, getKey 13 13 USE control_mod, ONLY: planet_type 14 14 USE assert_eq_m, ONLY: assert_eq … … 41 41 INTEGER, PARAMETER :: length=100 42 42 INTEGER :: iq, fID, vID, idecal, iqParent, iName, iZone, iPhase 43 REAL :: time, tab_cntrl(length) !--- RUN PARAMS TABLE 43 REAL :: time, tnat, alpha_ideal, tab_cntrl(length) !--- RUN PARAMS TABLE 44 LOGICAL :: lSkip, ll 44 45 !------------------------------------------------------------------------------- 45 46 modname="dynetat0" … … 127 128 128 129 !--- Tracers 130 ll=.FALSE. 131 #ifdef REPROBUS 132 ll = NF90_INQ_VARID(fID, 'HNO3tot', vID) /= NF90_NoErr !--- DETECT OLD REPRO start.nc FILE 133 #endif 129 134 DO iq=1,nqtot 130 135 var = tracers(iq)%name 131 oldVar = new2oldName(var) 132 !-------------------------------------------------------------------------------------------------------------------------- 133 IF(NF90_INQ_VARID(fID, var, vID) == NF90_NoErr) THEN !=== REGULAR CASE 136 oldVar = new2oldH2O(var) 137 lSkip = ll .AND. var == 'HNO3' !--- FORCE "HNO3_g" READING FOR "HNO3" 138 #ifdef REPROBUS 139 ix = strIdx(newHNO3, var); IF(ix /= 0) oldVar = oldHNO3(ix) !--- REPROBUS HNO3 exceptions 140 #endif 141 #ifdef INCA 142 IF(var == 'O3') oldVar = 'OX' !--- DEAL WITH INCA OZONE EXCEPTION 143 #endif 144 !-------------------------------------------------------------------------------------------------------------------------- 145 IF(NF90_INQ_VARID(fID, var, vID) == NF90_NoErr .AND. .NOT.lSkip) THEN !=== REGULAR CASE: AVAILABLE VARIABLE 134 146 CALL err(NF90_GET_VAR(fID,vID,q(:,:,:,iq)),"get",var) 135 147 !-------------------------------------------------------------------------------------------------------------------------- 136 ELSE IF(NF90_INQ_VARID(fID, oldVar, vID) == NF90_NoErr) THEN !=== OLDNAME148 ELSE IF(NF90_INQ_VARID(fID, oldVar, vID) == NF90_NoErr) THEN !=== TRY WITH ALTERNATE NAME 137 149 CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to <'//TRIM(oldVar)//'>', modname) 138 150 CALL err(NF90_GET_VAR(fID,vID,q(:,:,:,iq)),"get",oldVar) 139 151 !-------------------------------------------------------------------------------------------------------------------------- 140 #ifdef INCA141 ELSE IF(NF90_INQ_VARID(fID, 'OX', vID) == NF90_NoErr .AND. var == 'O3') THEN !=== INCA: OX INSTEAD OF O3142 CALL msg('Tracer <O3> is missing => initialized to <OX>', modname)143 CALL err(NF90_GET_VAR(fID,vID,q(:,:,:,iq)),"get",'OX')144 !--------------------------------------------------------------------------------------------------------------------------145 #endif146 152 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) 153 iName = tracers(iq)%iso_iName 149 154 iPhase = tracers(iq)%iso_iPhase 150 155 iqParent = tracers(iq)%iqParent 151 156 IF(tracers(iq)%iso_iZone == 0) THEN 157 IF(getKey('tnat', tnat, isoName(iName)) .OR. getKey('alpha', alpha_ideal, isoName(iName))) & 158 CALL abort_gcm(TRIM(modname), 'missing isotopic parameters', 1) 152 159 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.)160 q(:,:,:,iq) = q(:,:,:,iqParent)*tnat*(q(:,:,:,iqParent)/30.e-3)**(alpha_ideal-1.) 154 161 ELSE 155 162 CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to its parent isotope concentration.', modname) 156 q(:,:,:,iq) = q(:,:,:,iq iso(iso_indnum(iq),iPhase))163 q(:,:,:,iq) = q(:,:,:,iqIsoPha(iName,iPhase)) 157 164 END IF 158 165 !-------------------------------------------------------------------------------------------------------------------------- … … 176 183 CHARACTER(LEN=*), INTENT(IN) :: str1, str2 177 184 CHARACTER(LEN=maxlen) :: s1, s2 178 IF(n1/=n2) THEN 179 s1='value of '//TRIM(str1)//' =' 180 s2=' read in starting file differs from parametrized '//TRIM(str2)//' =' 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) 183 END IF 185 IF(n1/=n2) CALL abort_gcm(TRIM(modname), 'value of "'//TRIM(str1)//'" = '//TRIM(int2str(n1))// & 186 ' read in starting file differs from gcm value of "'//TRIM(str2)//'" = '//TRIM(int2str(n2)), 1) 184 187 END SUBROUTINE check_dim 185 188
Note: See TracChangeset
for help on using the changeset viewer.