Changeset 3750 for trunk


Ignore:
Timestamp:
Apr 30, 2025, 5:54:42 PM (2 months ago)
Author:
afalco
Message:

Pluto: write restartfi during the run, not just at the end. It is written every diagfi_output_rate.
AF

Location:
trunk/LMDZ.PLUTO/libf/phypluto
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.PLUTO/libf/phypluto/iostart.F90

    r3747 r3750  
    720720      IF (field_size==1) THEN
    721721        ! input is a 1D "surface field" array
    722         if (.not.present(time)) then ! for a time-independent field
     722        ierr=NF90_INQ_VARID(nid_restart,field_name,nvarid)
     723        if (ierr/=NF90_NOERR.or..not.present(time)) then ! for a time-independent field
    723724          ierr=NF90_REDEF(nid_restart)
    724725#ifdef NC_DOUBLE
     
    762763      ELSE IF (field_size==klev) THEN
    763764        ! input is a 2D "atmospheric field" array
    764         if (.not.present(time)) then ! for a time-independent field
     765        ierr=NF90_INQ_VARID(nid_restart,field_name,nvarid)
     766        if (ierr/=NF90_NOERR.or..not.present(time)) then ! for a time-independent field
    765767          ierr=NF90_REDEF(nid_restart)
    766768#ifdef NC_DOUBLE
     
    804806      ELSE IF (field_size==klevp1) THEN
    805807        ! input is a 2D "interlayer atmospheric field" array
    806         if (.not.present(time)) then ! for a time-independent field
     808        ierr=NF90_INQ_VARID(nid_restart,field_name,nvarid)
     809        if (ierr/=NF90_NOERR.or..not.present(time)) then ! for a time-independent field
    807810          ierr=NF90_REDEF(nid_restart)
    808811#ifdef NC_DOUBLE
     
    846849      ELSE IF (field_size==nsoilmx) THEN
    847850        ! input is a 2D "subsurface field" array
    848         if (.not.present(time)) then ! for a time-independent field
     851        ierr=NF90_INQ_VARID(nid_restart,field_name,nvarid)
     852        if (ierr/=NF90_NOERR.or..not.present(time)) then ! for a time-independent field
    849853          ierr = NF90_REDEF(nid_restart)
    850854#ifdef NC_DOUBLE
     
    893897      ENDIF
    894898
    895       ! Check the writting of field to file went OK
     899      ! Check the writing of field to file went OK
    896900      if (ierr.ne.NF90_NOERR) then
    897901        write(*,*) " Error phyredem(put_field_rgen) : failed writing ",trim(field_name)
  • trunk/LMDZ.PLUTO/libf/phypluto/physiq_mod.F90

    r3749 r3750  
    406406      REAL zdum2(ngrid,nlayer)
    407407      real ztim1,ztim2,ztim3, z1,z2
    408       real ztime_fin
     408      real ztime_restart
    409409      real zdh(ngrid,nlayer)
    410410      real gmplanet
     
    490490      logical, save ::  check_physics_outputs=.false.
    491491!$OPM THREADPRIVATE(check_physics_inputs,check_physics_outputs)
     492      LOGICAL write_restartfi
    492493
    493494      ! Misc
     
    19811982      if (is_master) print*,'--> Ls =',zls*180./pi
    19821983
     1984      write_restartfi = .false.
    19831985      if(lastcall) then
    1984          IF (grid_type==unstructured) THEN !IF DYNAMICO
    1985             ! DYNAMICO: no need to add a dynamics time step to ztime_fin
    1986             ztime_fin = ptime
    1987          ELSE ! LMDZ
    1988             ztime_fin = ptime + ptimestep/(float(iphysiq)*daysec)
    1989          ENDIF ! of IF (grid_type==unstructured)
    1990          !! Update surface ice distribution to iterate to steady state if requested
    1991          !! AF24: removed
    1992 
    1993          ! endif
     1986         write_restartfi = .true.
     1987
    19941988         if (paleo) then
    19951989            ! time range for tendencies of ice flux qsurfyear
     
    20722066            if (is_master) write(*,*) "Paleo eccpal=",eccpal,"  tpal=",tpalnew
    20732067
     2068            ! create restartfi
     2069            if (ngrid.ne.1) then
     2070               print*, "physdem1pal not yet implemented"
     2071               stop
     2072               !TODO: import this routine from pluto.old
     2073               ! call physdem1pal("restartfi.nc",long,lati,nsoilmx,nq, &
     2074               !      ptimestep,pdaypal, &
     2075               !      ztime_restart,tsurf,tsoil,emis,q2,qsurfpal, &
     2076               !      cell_area,albedodat,therm_inertia,zmea,zstd,zsig, &
     2077               !      zgam,zthe,oblipal,eccpal,tpalnew,adjustnew,phisfipal,  &
     2078               !      peri_daypal)
     2079            endif
     2080         else ! 'paleo'
     2081
     2082
     2083         endif ! end of 'paleo'
     2084      endif ! end of 'lastcall'
     2085
     2086      if(mod(icount,diagfi_output_rate).eq.0) then
     2087         write_restartfi = .true.
     2088      endif
    20742089!----------------------------------------------------------------------
    20752090!        Writing NetCDF file  "RESTARTFI" at the end of the run
     
    20812096!              thus we store for time=time+dtvr
    20822097
    2083             ! create restartfi
    2084             if (ngrid.ne.1) then
    2085                print*, "physdem1pal not yet implemented"
    2086                stop
    2087                !TODO: import this routine from pluto.old
    2088                ! call physdem1pal("restartfi.nc",long,lati,nsoilmx,nq, &
    2089                !      ptimestep,pdaypal, &
    2090                !      ztime_fin,tsurf,tsoil,emis,q2,qsurfpal, &
    2091                !      cell_area,albedodat,therm_inertia,zmea,zstd,zsig, &
    2092                !      zgam,zthe,oblipal,eccpal,tpalnew,adjustnew,phisfipal,  &
    2093                !      peri_daypal)
    2094             endif
    2095          else ! 'paleo'
    2096 
    2097             if (ngrid.ne.1) then
    2098                write(*,*)'PHYSIQ: for physdem ztime_fin =',ztime_fin
    2099 
    2100                call physdem1("restartfi.nc",nsoilmx,ngrid,nlayer,nq, &
    2101                            ptimestep,ztime_fin,tsurf,                &
    2102                            tsoil,therm_inertia,emis,albedo,q2,qsurf)
    2103             endif
    2104 
    2105          endif ! end of 'paleo'
    2106       endif ! end of 'lastcall'
     2098      if (is_omp_master.and.write_restartfi) then
     2099         if (ngrid.ne.1) then
     2100            IF (grid_type==unstructured) THEN !IF DYNAMICO
     2101               ! DYNAMICO: no need to add a dynamics time step to ztime_restart
     2102               ztime_restart = ptime
     2103            ELSE ! LMDZ
     2104               ztime_restart = ptime + (ptimestep/daysec)
     2105            ENDIF ! of IF (grid_type==unstructured)
     2106
     2107            write(*,*)'PHYSIQ: writing restartfi at time =',ztime_restart
     2108
     2109            call physdem1("restartfi.nc",nsoilmx,ngrid,nlayer,nq, &
     2110                        ptimestep,ztime_restart,tsurf,                &
     2111                        tsoil,therm_inertia,emis,albedo,q2,qsurf)
     2112         endif ! ngrid
     2113      endif ! is_omp_master
     2114
     2115
    21072116
    21082117!------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.