Ignore:
Timestamp:
Jan 10, 2018, 6:21:35 PM (7 years ago)
Author:
jvatant
Message:

Making chemistry handling more flexible - step 3
+ Added the horizontal interpolation for chemistry fields
+ Next step : deal with vertical interp !
--JVO

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/lect_start_archive.F

    r1891 r1892  
    1010!      USE control_mod
    1111! to use  'getin'
     12      USE callkeys_mod, only: callchim
    1213      USE comvert_mod, ONLY: ap,bp,aps,bps,preff
    1314      USE comconst_mod, ONLY: kappa,g,pi
     
    256257      ierr= NF_INQ_DIMID(nid,"upper_chemistry_layers",dimid)
    257258      ierr= NF_INQ_DIMLEN(nid,dimid,nlaykimold)
    258 
    259       ! NB : The vertical regriding, if needed cannot be done here since the new
    260       ! pressure grid is only computed at the end of newstart
    261       ! Here we will just do the horizontal interpolation on scalar grid.
    262259
    263260! 1.3 Report dimensions
     
    307304     
    308305      allocate(preskimold(nlaykimold))
    309       allocate(ykim_upS(44,iip1,jjp1))
    310       allocate(ykim_upoldS(44,imold+1,jmold+1))
     306      allocate(ykim_upS(44,iip1,jjp1,nlaykimold))
     307      allocate(ykim_upoldS(44,imold+1,jmold+1,nlaykimold))
     308      allocate(ykim_up_oldv(44,ngrid,nlaykimold))
    311309
    312310      allocate(var (imold+1,jmold+1,llm))
     
    830828!      endif
    831829
    832 c-----------------------------------------------------------------------
    833 c 5.3   Lecture des champs 3D (t,u,v, q2atm,q)
     830
     831c-----------------------------------------------------------------------
     832c 5.3 Read 3D upper chemistry fields, if needed
     833c----------------------------------------------------------------------- 
     834       
     835      start=(/1,1,1,memo/)
     836      count=(/imold+1,jmold+1,nlaykimold,1/)
     837   
     838c NB : The sanity check on callchim is on H_up but could be on any chem. field
     839c as we assume we can't do incomplete chemistry - JVO 18
     840   
     841      PRINT*, "lect_start_archive: loading upper chemistry fields..."
     842     
     843      ierr=NF_INQ_VARID(nid,"H_up",nvarid)
     844     
     845      IF (ierr .NE. NF_NOERR) THEN
     846     
     847         PRINT*, "lect_start_archive: Le champ <H_up> est absent..."       
     848         IF (callchim) THEN
     849           PRINT*, "... mais callchim=.TRUE. dans callphys.def !"
     850           PRINT*, "Verifiez start_archive.nc ou desactivez callchim !"
     851           CALL abort
     852         ELSE
     853           PRINT*, '... je suppose que les autres champs aussi et je
     854     &passerai donc mon chemin pour tout ce qui concerne la chimie !'
     855           WRITE (*,*)
     856         ENDIF
     857         
     858      ELSE
     859     
     860        IF (.not.callchim) THEN
     861          PRINT*, "lect_start_archive: Le champ <H_up> est present..."
     862          PRINT*, "... mais callchim=.FALSE. dans callphys.def !"
     863          PRINT*, "Veuillez activer callchim pour gerer ce champ !"
     864          CALL abort
     865        ELSE
     866#ifdef NC_DOUBLE
     867          ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,count,
     868     &                             ykim_upoldS(1,:,:,:))
     869#else
     870          ierr = NF_GET_VARA_REAL(nid,nvarid,start,count,
     871     &                            ykim_upoldS(1,:,:,:))
     872#endif
     873          IF (ierr .NE. NF_NOERR) THEN
     874             PRINT*, "lect_start_archive: Lecture echouee pour <H_up>"
     875             CALL abort
     876          ENDIF         
     877          ! Then read all the others by their name if needed
     878          CALL read_startarch_kim(nid,start,count)             
     879         ENDIF
     880         
     881      ENDIF  ! if ierr.ne.nf_no_err
     882
     883c-----------------------------------------------------------------------
     884c 5.4   Lecture des champs 3D (t,u,v, q2atm,q)
    834885c-----------------------------------------------------------------------
    835886
     
    11611212      ! Reshape tsoilS to scalar grid as tsoil
    11621213       call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngrid,tsoilS,tsoil)
    1163 
    1164 c-----------------------------------------------------------------------
    1165 c 6.3 Variable 3d :
     1214       
     1215c-----------------------------------------------------------------------
     1216c 6.3 Upper chemistry 3d fields:
     1217c
     1218c NB : The vertical regriding, if needed cannot be done here since the
     1219c new pressure grid is only computed at the end of newstart.
     1220c Here we will just do the horizontal interpolation on scalar grid.
     1221c
     1222c-----------------------------------------------------------------------
     1223
     1224      ! Do the horizontal interpolation
     1225      DO i=1,44
     1226        call interp_horiz(ykim_upoldS(i,:,:,:),ykim_upS(i,:,:,:),
     1227     &                  imold,jmold,iim,jjm,nlaykimold,
     1228     &                   rlonuold,rlatvold,rlonu,rlatv)
     1229
     1230        ! Reshape ykim_upS to scalar grid as ykim_up_oldv
     1231        call gr_dyn_fi(nlaykimold,iim+1,jjm+1,ngrid,
     1232     &                 ykim_upS(i,:,:,:),ykim_up_oldv(i,:,:))
     1233      ENDDO
     1234
     1235
     1236c-----------------------------------------------------------------------
     1237c 6.4 Variable 3d :
    11661238c-----------------------------------------------------------------------
    11671239     
     
    13281400      deallocate(qsurfold)
    13291401      deallocate(var,varp1)
     1402     
     1403      deallocate(ykim_upS)
     1404      deallocate(ykim_upoldS)
    13301405
    13311406!      write(*,*)'lect_start_archive: END'
Note: See TracChangeset for help on using the changeset viewer.