Ignore:
Timestamp:
Nov 4, 2024, 4:15:02 PM (3 weeks ago)
Author:
emillour
Message:

Mars PCM:
Get rid of "start2archive_SSO.F" and adapt start2archive.F to allow adding
sub-grid-scale fields in start_archive.nc. This optional behavior is
triggered at run time by specifying "start2archive.e --add-sso".
EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/start2archive.F

    r3316 r3491  
    3838      USE comcstfi_h, only: pi
    3939      use surfini_mod, only: surfini
     40! SSO parameters:
     41      USE surfdat_h, ONLY: phisfi, albedodat, z0, z0_default,
     42     &    zmea, zstd, zsig, zgam, zthe, hmons, summit, base
    4043      implicit none
    4144
     
    100103      REAL, ALLOCATABLE :: subslope_distS(:,:)
    101104
     105! For SSO parameters:
     106      REAL zmeaS(ip1jmp1)
     107      REAL zsigS(ip1jmp1)
     108      REAL zstdS(ip1jmp1)
     109      REAL zgamS(ip1jmp1)
     110      REAL ztheS(ip1jmp1)
     111      REAL albedodatS(ip1jmp1)
     112      REAL z0S(ip1jmp1)
     113      REAL hmonsS(ip1jmp1)
     114      REAL summitS(ip1jmp1)
     115      REAL baseS(ip1jmp1)
     116
     117      logical :: add_sso_fields=.false. ! default, don't include SSO fields
     118
     119
    102120c Variables intermediaires : vent naturel, mais pas coord scalaire
    103121c----------------------------------------------------------------
     
    128146      integer varid,dimid,timelen
    129147      INTEGER nid,nid1
     148
     149C get command line arguments
     150C here we assume and check that if there is an argument #1 then
     151C it should be --add-sso to signal adding SSO fileds to start_archive.nc
     152
     153      CALL get_command_argument(1,txt,j,ierr)
     154      ! will return ierr==0 if there is an argument #1 to command line
     155      IF (ierr==0) THEN
     156        ! Check that argument is indeed "--add-sso" or signal the error
     157        IF (trim(txt)=="--add-sso") THEN
     158          add_sso_fields=.true.
     159          write(*,*) "SSO fields will be included in start_archive"
     160        ELSE
     161          write(*,*) "start2archive error: unexpected command line "//
     162     &    "argument: ",trim(txt)
     163          write(*,*) " (only --add-sso currently accepted)"
     164          write(*,*) "Might as well stop here."
     165          stop
     166        ENDIF
     167      ENDIF ! of IF (ierr==0)
    130168
    131169c-----------------------------------------------------------------------
     
    326364     &    watercaptagS(:))
    327365
     366! SSO parameters, if needed:
     367      if (add_sso_fields) then
     368        call gr_fi_dyn(1,ngridmx,iip1,jjp1,zmea,zmeaS)
     369        call gr_fi_dyn(1,ngridmx,iip1,jjp1,zstd,zstdS)
     370        call gr_fi_dyn(1,ngridmx,iip1,jjp1,zsig,zsigS)
     371        call gr_fi_dyn(1,ngridmx,iip1,jjp1,zthe,ztheS)
     372        call gr_fi_dyn(1,ngridmx,iip1,jjp1,zgam,zgamS)
     373        call gr_fi_dyn(1,ngridmx,iip1,jjp1,albedodat,albedodatS)
     374        call gr_fi_dyn(1,ngridmx,iip1,jjp1,z0,z0S)
     375        call gr_fi_dyn(1,ngridmx,iip1,jjp1,hmons,hmonsS)
     376        call gr_fi_dyn(1,ngridmx,iip1,jjp1,summit,summitS)
     377        call gr_fi_dyn(1,ngridmx,iip1,jjp1,base,baseS)
     378      endif
     379
    328380c=======================================================================
    329381c Info pour controler
     
    445497      call write_archive(nid,ntime,'q2atm','wind variance','m2.s-2',3,
    446498     .              q2S(1,2))
     499! SSO parameters, if needed
     500      if (add_sso_fields) then
     501        call write_archive(nid,ntime,'ZMEA','zmea',' ',2,zmeaS)
     502        call write_archive(nid,ntime,'ZSTD','zstd',' ',2,zstdS)
     503        call write_archive(nid,ntime,'ZSIG','zsig',' ',2,zsigS)
     504        call write_archive(nid,ntime,'ZTHE','zthe',' ',2,ztheS)
     505        call write_archive(nid,ntime,'ZGAM','zgam',' ',2,zgamS)
     506        call write_archive(nid,ntime,'albedodat','albedodat',
     507     &                             ' ',2,albedodatS)
     508        call write_archive(nid,ntime,'z0','z0',' ',2,z0S)
     509        call write_archive(nid,ntime,'summit','summit',
     510     &                             ' ',2,summitS)
     511        call write_archive(nid,ntime,'hmons','hmons',' ',2,hmonsS)
     512        call write_archive(nid,ntime,'base','base',' ',2,baseS)
     513      endif
    447514
    448515c-----------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.