Changeset 4058 for trunk


Ignore:
Timestamp:
Feb 10, 2026, 9:46:10 AM (2 weeks ago)
Author:
emillour
Message:

Mars PCM:
Add a "output_diagfi" (default .true.) flag so that the user can decide if
a diagfi.nc file should be outputted.
Also do some cleaning around the few remaining calls to writediagfi
or reference to it througout the code; write_output() should be used.
EM

Location:
trunk/LMDZ.MARS
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/changelog.txt

    r4057 r4058  
    50565056== 09/02/2026 == EM
    50575057Minor OpenMP fix to dust coagulation.
     5058
     5059== 10/02/2026 == EM
     5060Add a "output_diagfi" (default .true.) flag so that the user can decide if
     5061a diagfi.nc file should be outputted.
     5062Also do some cleaning around the few remaining calls to writediagfi
     5063or reference to it througout the code; write_output() should be used.
     5064
  • trunk/LMDZ.MARS/libf/aeronomars/calchim_mod.F90

    r3726 r4058  
    4040      use iono_h, only: temp_elect
    4141      use wstats_mod, only: wstats
     42      use write_output_mod, only: write_output
    4243      use callkeys_mod, only: photochem
    4344
     
    223224!     for output:
    224225
    225       logical,save :: output        ! to issue calls to writediagfi and stats
     226      logical,save :: output        ! to issue calls to write_output and stats
    226227      real :: jo3_3d(ngrid,nlayer)  ! Photodissociation rate O3->O1D (s-1)
    227228      real :: jh2o_3d(ngrid,nlayer)  ! Photodissociation rate H2O->H+OH (s-1)
     
    956957      if (photochem .and. output) then
    957958         if (ngrid > 1) then
    958             call writediagfi(ngrid,'jo3','j o3->o1d',    &
    959                              's-1',3,jo3_3d(1,1))
    960             call writediagfi(ngrid,'jh2o','jh2o',    &
    961                              's-1',3,jh2o_3d(1,1))
    962             call writediagfi(ngrid,'iter','iterations',  &
    963                              ' ',3,iter_3d(1,1))
    964 
    965 !            if (.not. unichim) then
    966                call writediagfi(ngrid,'emission_no',        &
    967                     'NO nightglow emission rate','cm-3 s-1',3,emission_no)
    968                call writediagfi(ngrid,'emission_o2',        &
    969                     'O2 nightglow emission rate','cm-3 s-1',3,emission_o2)
    970 !            endif
     959           call write_output('jo3','j o3->o1d','s-1',jo3_3d)
     960           call write_output('jh2o','jh2o','s-1',jh2o_3d)
     961           call write_output('iter_chemistry','iterations',' ',iter_3d)
     962
     963           call write_output('emission_no', &
     964                             'NO nightglow emission rate','cm-3 s-1', &
     965                             emission_no)
     966           call write_output('emission_o2', &
     967                             'O2 nightglow emission rate','cm-3 s-1', &
     968                             emission_o2)
    971969           
    972                call wstats(ngrid,'jo3','j o3->o1d',       &
     970           call wstats(ngrid,'jo3','j o3->o1d',       &
    973971                           's-1',3,jo3_3d(1,1))
    974                call wstats(ngrid,'emission_no',           &
     972           call wstats(ngrid,'emission_no',           &
    975973                   'NO nightglow emission rate','cm-3 s-1',3,emission_no)
    976                call wstats(ngrid,'emission_o2',           &
     974           call wstats(ngrid,'emission_o2',           &
    977975                   'O2 nightglow emission rate','cm-3 s-1',3,emission_o2)
    978                call wstats(ngrid,'mmean','mean molecular mass',       &
     976           call wstats(ngrid,'mmean','mean molecular mass',       &
    979977                           'g.mole-1',3,mmean(1,1))
    980978         end if ! of if (ngrid.gt.1)
  • trunk/LMDZ.MARS/libf/aeronomars/surfacearea.F

    r3726 r4058  
    1616      use comcstfi_h, only: pi
    1717      use wstats_mod, only: wstats
     18      use write_output_mod, only: write_output
    1819      use callkeys_mod, only: microphys
    1920      implicit none
     
    126127     $            "micron2 cm-3",3,surfice*1.e6)
    127128
    128       call writediagfi(ngrid,"surfdust", "Dust surface area",
    129      $            "micron2 cm-3",3,surfdust*1.e6)
    130       call writediagfi(ngrid,"surfice", "Ice cloud surface area",
    131      $            "micron2 cm-3",3,surfice*1.e6)
     129      call write_output("surfdust","Dust surface area",
     130     &                  "micron2 cm-3",surfdust*1.e6)
     131      call write_output("surfice","Ice cloud surface area",
     132     &                  "micron2 cm-3",surfice*1.e6)
    132133
    133134      end subroutine surfacearea
  • trunk/LMDZ.MARS/libf/phymars/conf_phys.F

    r4054 r4058  
    7373     &                        kernel_g,kernel_de,kernel_ti,coal_kg,
    7474     &                        fullcoag
     75      use write_output_mod, only: output_diagfi
    7576
    7677      IMPLICIT NONE
     
    176177         write(*,*) " callstats = ",callstats
    177178
     179         write(*,*) "Write atmospheric fields in file diagfi.nc ?"
     180         output_diagfi=.true. ! default value
     181         call getin_p("output_diagfi",output_diagfi)
     182         write(*,*) " output_diagfi = ",output_diagfi
     183         
    178184         write(*,*) "Write sub-surface fields in file diagsoil.nc ?"
    179185         diagsoil=.false. ! default value
  • trunk/LMDZ.MARS/libf/phymars/physiq_mod.F

    r4054 r4058  
    32653265#ifndef MESOINI
    32663266
    3267 c        ==========================================================
    3268 c        WRITEDIAGFI: Outputs in netcdf file "DIAGFI", containing
    3269 c          any variable for diagnostic (output with period
    3270 c          "ecritphy", set in "run.def")
    3271 c        ==========================================================
    3272 c        WRITEDIAGFI can ALSO be called from any other subroutines
    3273 c        for any variables !!
     3267!        ==========================================================
     3268!        write_output: Outputs in netcdf files, diagfi and/or diagsoil
     3269!                      or via XIOS (variable should then be also defined
     3270!                      in field_def_physics_mars.xml)
     3271!        ==========================================================
     3272!        write_output can be called from any other subroutines
     3273!        for any variables !!
    32743274         call write_output("emis","Surface emissivity","",
    32753275     &                  emis(:,iflat))
     
    37023702           endif ! (doubleq)
    37033703
    3704            if (rdstorm) then  ! writediagfi tendencies stormdust tracers
     3704           if (rdstorm) then  ! output tendencies stormdust tracers
    37053705             call write_output('reffstormdust','reffstormdust',
    37063706     &                        'm',rstormdust(:,:)*ref_r0)
     
    39253925c        ----------------------------------------------------------
    39263926
    3927 c        ----------------------------------------------------------
    3928 c        Output in netcdf file "diagsoil.nc" for subterranean
    3929 c          variables (output every "ecritphy", as for writediagfi)
    3930 c        ----------------------------------------------------------
    39313927         ! Write soil temperature
    39323928        call write_output("soiltemp","Soil temperature","K",
     
    40434039
    40444040c        ==========================================================
    4045 c        END OF WRITEDIAGFI
     4041c        END OF WRITING OUTPUTS
    40464042c        ==========================================================
    40474043#endif
  • trunk/LMDZ.MARS/libf/phymars/rocketduststorm_mod.F90

    r3726 r4058  
    526526       
    527527!=======================================================================
    528 ! WRITEDIAGFI
     528! OUTPUTS
    529529
    530530        call write_output('rds_lapserate', &
  • trunk/LMDZ.MARS/libf/phymars/simpleclouds_mod.F

    r4007 r4058  
    222222      end do
    223223
    224 c     if (hdo) then
    225 c           CALL WRITEDIAGFI(ngrid,'alpha_c',
    226 c    &                       'alpha_c',
    227 c    &                       ' ',3,alpha_c)
    228 c     endif !hdo
    229224c------------------------------------------------------------------
    230225      end subroutine simpleclouds
  • trunk/LMDZ.MARS/libf/phymars/topmons_mod.F90

    r4010 r4058  
    643643
    644644! **********************************************************************
    645 ! WRITEDIAGFI
     645! OUTPUTS
    646646! **********************************************************************
    647647!               CALL write_output('wup_top', &
  • trunk/LMDZ.MARS/libf/phymars/vdif_kc.F

    r3727 r4058  
    627627c
    628628
    629 !        call writediagfi(ngrid,'vdif_kc_q2','','',3,q2(:,1:nlay))
    630 !        call writediagfi(ngrid,'vdif_kc_km','','',3,km(:,1:nlay))
    631 !        call writediagfi(ngrid,'vdif_kc_kn','','',3,kn(:,1:nlay))
    632 !        call writediagfi(ngrid,'vdif_kc_unsdz','','',3,unsdz(:,1:nlay))
    633 !        call writediagfi(ngrid,'vdif_kc_unsddecz','','',3,
    634 !     &                   unsdzdec(:,1:nlay))
    635 !        call writediagfi(ngrid,'vdif_kc_q','','',3,q(:,1:nlay))
    636 !        call writediagfi(ngrid,'vdif_kc_kmpre','','',3,
    637 !     &                   kmpre(:,1:nlay))
    638 !        call writediagfi(ngrid,'vdif_kc_long','','',3,long(:,1:nlay))
    639 !        call writediagfi(ngrid,'vdif_kc_sn','','',3,sn(:,1:nlay))
    640 !        call writediagfi(ngrid,'vdif_kc_sm','','',3,sm(:,1:nlay))
    641 
    642629      END SUBROUTINE vdif_kc
    643630
  • trunk/LMDZ.MARS/libf/phymars/write_output_mod.F90

    r3225 r4058  
    1313public write_output
    1414
     15logical,public,save :: output_diagfi ! global flag to trigger generating
     16                      ! a diagfi.nc file or not. Initialized in conf_phys()
     17!$OMP THREADPRIVATE(output_diagfi)
     18
     19
    1520!-----------------------------------------------------------------------
    1621contains
     
    3742logical :: is_active ! For XIOS, should this field be sent or not
    3843
    39 call writediagfi(ngrid,field_name,title,units,0,(/field/))
     44if (output_diagfi) call writediagfi(ngrid,field_name,title,units,0,(/field/))
    4045#ifdef CPP_XIOS
    4146!is_active=xios_is_active_field(field_name)
     
    6974logical :: is_active ! For XIOS, should this field be sent or not
    7075
    71 call writediagfi(ngrid,field_name,title,units,2,field)
     76if (output_diagfi) call writediagfi(ngrid,field_name,title,units,2,field)
    7277#ifdef CPP_XIOS
    7378!is_active=xios_is_active_field(field_name)
     
    107112    call writediagsoil(ngrid,field_name,title,units,3,field)
    108113else
    109     call writediagfi(ngrid,field_name,title,units,3,field)
     114  if (output_diagfi) call writediagfi(ngrid,field_name,title,units,3,field)
    110115endif
    111116
     
    141146logical :: is_active ! For XIOS, should this field be sent or not
    142147
    143 call writediagfi(ngrid,field_name,title,units,0,(/real(field)/))
     148if (output_diagfi) call writediagfi(ngrid,field_name,title,units,0,(/real(field)/))
     149
    144150#ifdef CPP_XIOS
    145151!is_active=xios_is_active_field(field_name)
     
    173179logical :: is_active ! For XIOS, should this field be sent or not
    174180
    175 call writediagfi(ngrid,field_name,title,units,2,real(field))
     181if (output_diagfi) call writediagfi(ngrid,field_name,title,units,2,real(field))
     182
    176183#ifdef CPP_XIOS
    177184!is_active=xios_is_active_field(field_name)
     
    211218    call writediagsoil(ngrid,field_name,title,units,3,real(field))
    212219else
    213     call writediagfi(ngrid,field_name,title,units,3,real(field))
     220  if (output_diagfi) call writediagfi(ngrid,field_name,title,units,3,real(field))
    214221endif
    215222#ifdef CPP_XIOS
     
    248255if (field) field_real = 1.
    249256
    250 call writediagfi(ngrid,field_name,title,units,0,field_real)
     257if (output_diagfi) call writediagfi(ngrid,field_name,title,units,0,field_real)
    251258#ifdef CPP_XIOS
    252259!is_active=xios_is_active_field(field_name)
     
    284291where (field) field_real = 1.
    285292
    286 call writediagfi(ngrid,field_name,title,units,2,field_real)
     293if (output_diagfi) call writediagfi(ngrid,field_name,title,units,2,field_real)
     294
    287295#ifdef CPP_XIOS
    288296!is_active=xios_is_active_field(field_name)
     
    327335    call writediagsoil(ngrid,field_name,title,units,3,field_real)
    328336else
    329     call writediagfi(ngrid,field_name,title,units,3,field_real)
     337  if (output_diagfi) call writediagfi(ngrid,field_name,title,units,3,field_real)
    330338endif
    331339
Note: See TracChangeset for help on using the changeset viewer.