moy_undefSTD.f90 Source File


This file depends on

sourcefile~~moy_undefstd.f90~2~~EfferentGraph sourcefile~moy_undefstd.f90~2 moy_undefSTD.f90 sourcefile~dimphy.f90 dimphy.f90 sourcefile~moy_undefstd.f90~2->sourcefile~dimphy.f90 sourcefile~phys_output_var_mod.f90 phys_output_var_mod.f90 sourcefile~moy_undefstd.f90~2->sourcefile~phys_output_var_mod.f90 sourcefile~phys_state_var_mod.f90 phys_state_var_mod.F90 sourcefile~moy_undefstd.f90~2->sourcefile~phys_state_var_mod.f90 sourcefile~wxios_mod.f90 wxios_mod.F90 sourcefile~moy_undefstd.f90~2->sourcefile~wxios_mod.f90 sourcefile~clesphys_mod_h.f90 clesphys_mod_h.f90 sourcefile~moy_undefstd.f90~2->sourcefile~clesphys_mod_h.f90 sourcefile~phys_cal_mod.f90 phys_cal_mod.f90 sourcefile~moy_undefstd.f90~2->sourcefile~phys_cal_mod.f90 sourcefile~phys_output_var_mod.f90->sourcefile~dimphy.f90 sourcefile~phys_output_var_mod.f90->sourcefile~clesphys_mod_h.f90 sourcefile~strings_mod.f90 strings_mod.f90 sourcefile~phys_output_var_mod.f90->sourcefile~strings_mod.f90 sourcefile~config_ocean_skin_m.f90 config_ocean_skin_m.F90 sourcefile~phys_output_var_mod.f90->sourcefile~config_ocean_skin_m.f90 sourcefile~phys_state_var_mod.f90->sourcefile~dimphy.f90 sourcefile~phys_state_var_mod.f90->sourcefile~clesphys_mod_h.f90 sourcefile~indice_sol_mod.f90 indice_sol_mod.f90 sourcefile~phys_state_var_mod.f90->sourcefile~indice_sol_mod.f90 sourcefile~surface_data.f90 surface_data.f90 sourcefile~phys_state_var_mod.f90->sourcefile~surface_data.f90 sourcefile~aero_mod.f90 aero_mod.f90 sourcefile~phys_state_var_mod.f90->sourcefile~aero_mod.f90 sourcefile~phys_state_var_mod.f90->sourcefile~config_ocean_skin_m.f90 sourcefile~dimsoil_mod_h.f90 dimsoil_mod_h.f90 sourcefile~phys_state_var_mod.f90->sourcefile~dimsoil_mod_h.f90 sourcefile~infotrac_phy.f90 infotrac_phy.F90 sourcefile~phys_state_var_mod.f90->sourcefile~infotrac_phy.f90 sourcefile~wxios_mod.f90->sourcefile~dimphy.f90 sourcefile~lmdz_xios.f90 lmdz_xios.F90 sourcefile~wxios_mod.f90->sourcefile~lmdz_xios.f90 sourcefile~mod_phys_lmdz_para.f90 mod_phys_lmdz_para.f90 sourcefile~wxios_mod.f90->sourcefile~mod_phys_lmdz_para.f90 sourcefile~mod_phys_lmdz_mpi_data.f90 mod_phys_lmdz_mpi_data.f90 sourcefile~wxios_mod.f90->sourcefile~mod_phys_lmdz_mpi_data.f90 sourcefile~geometry_mod.f90 geometry_mod.f90 sourcefile~wxios_mod.f90->sourcefile~geometry_mod.f90 sourcefile~iniprint_mod_h.f90 iniprint_mod_h.f90 sourcefile~wxios_mod.f90->sourcefile~iniprint_mod_h.f90 sourcefile~wxios_mod.f90->sourcefile~strings_mod.f90 sourcefile~print_control_mod.f90 print_control_mod.f90 sourcefile~wxios_mod.f90->sourcefile~print_control_mod.f90 sourcefile~mod_phys_lmdz_transfert_para.f90 mod_phys_lmdz_transfert_para.f90 sourcefile~wxios_mod.f90->sourcefile~mod_phys_lmdz_transfert_para.f90 sourcefile~mod_grid_phy_lmdz.f90 mod_grid_phy_lmdz.f90 sourcefile~wxios_mod.f90->sourcefile~mod_grid_phy_lmdz.f90 sourcefile~nrtype.f90 nrtype.f90 sourcefile~wxios_mod.f90->sourcefile~nrtype.f90 sourcefile~wxios_mod.f90->sourcefile~infotrac_phy.f90 sourcefile~ioipsl_getin_p_mod.f90 ioipsl_getin_p_mod.f90 sourcefile~wxios_mod.f90->sourcefile~ioipsl_getin_p_mod.f90 sourcefile~phys_cal_mod.f90->sourcefile~mod_phys_lmdz_para.f90 sourcefile~phys_cal_mod.f90->sourcefile~ioipsl_getin_p_mod.f90 sourcefile~mod_phys_lmdz_para.f90->sourcefile~mod_phys_lmdz_mpi_data.f90 sourcefile~mod_phys_lmdz_para.f90->sourcefile~print_control_mod.f90 sourcefile~mod_phys_lmdz_para.f90->sourcefile~mod_phys_lmdz_transfert_para.f90 sourcefile~mod_phys_lmdz_para.f90->sourcefile~mod_grid_phy_lmdz.f90 sourcefile~mod_phys_lmdz_omp_data.f90 mod_phys_lmdz_omp_data.F90 sourcefile~mod_phys_lmdz_para.f90->sourcefile~mod_phys_lmdz_omp_data.f90 sourcefile~mod_phys_lmdz_mpi_data.f90->sourcefile~print_control_mod.f90 sourcefile~lmdz_mpi.f90 lmdz_mpi.F90 sourcefile~mod_phys_lmdz_mpi_data.f90->sourcefile~lmdz_mpi.f90 sourcefile~lmdz_cppkeys_wrapper.f90 lmdz_cppkeys_wrapper.F90 sourcefile~mod_phys_lmdz_mpi_data.f90->sourcefile~lmdz_cppkeys_wrapper.f90 sourcefile~geometry_mod.f90->sourcefile~mod_grid_phy_lmdz.f90 sourcefile~geometry_mod.f90->sourcefile~nrtype.f90 sourcefile~mod_phys_lmdz_transfert_para.f90->sourcefile~mod_phys_lmdz_mpi_data.f90 sourcefile~mod_phys_lmdz_omp_transfert.f90 mod_phys_lmdz_omp_transfert.f90 sourcefile~mod_phys_lmdz_transfert_para.f90->sourcefile~mod_phys_lmdz_omp_transfert.f90 sourcefile~mod_phys_lmdz_mpi_transfert.f90 mod_phys_lmdz_mpi_transfert.f90 sourcefile~mod_phys_lmdz_transfert_para.f90->sourcefile~mod_phys_lmdz_mpi_transfert.f90 sourcefile~infotrac_phy.f90->sourcefile~mod_phys_lmdz_para.f90 sourcefile~infotrac_phy.f90->sourcefile~iniprint_mod_h.f90 sourcefile~infotrac_phy.f90->sourcefile~strings_mod.f90 sourcefile~infotrac_phy.f90->sourcefile~ioipsl_getin_p_mod.f90 sourcefile~infotrac_phy.f90->sourcefile~lmdz_cppkeys_wrapper.f90 sourcefile~readtracfiles_mod.f90 readTracFiles_mod.f90 sourcefile~infotrac_phy.f90->sourcefile~readtracfiles_mod.f90 sourcefile~lmdz_reprobus_wrappers.f90 lmdz_reprobus_wrappers.F90 sourcefile~infotrac_phy.f90->sourcefile~lmdz_reprobus_wrappers.f90 sourcefile~ioipsl_getin_p_mod.f90->sourcefile~mod_phys_lmdz_para.f90 sourcefile~ioipsl_getin_p_mod.f90->sourcefile~strings_mod.f90 sourcefile~ioipsl_getin_p_mod.f90->sourcefile~mod_phys_lmdz_transfert_para.f90 sourcefile~mod_phys_lmdz_omp_transfert.f90->sourcefile~mod_phys_lmdz_mpi_data.f90 sourcefile~mod_phys_lmdz_omp_transfert.f90->sourcefile~mod_phys_lmdz_omp_data.f90 sourcefile~mod_phys_lmdz_mpi_transfert.f90->sourcefile~mod_phys_lmdz_mpi_data.f90 sourcefile~mod_phys_lmdz_mpi_transfert.f90->sourcefile~mod_grid_phy_lmdz.f90 sourcefile~mod_phys_lmdz_mpi_transfert.f90->sourcefile~lmdz_mpi.f90 sourcefile~readtracfiles_mod.f90->sourcefile~strings_mod.f90 sourcefile~readtracfiles_mod.f90->sourcefile~ioipsl_getin_p_mod.f90 sourcefile~lmdz_reprobus_wrappers.f90->sourcefile~mod_grid_phy_lmdz.f90 sourcefile~mod_phys_lmdz_omp_data.f90->sourcefile~dimphy.f90 sourcefile~mod_phys_lmdz_omp_data.f90->sourcefile~mod_phys_lmdz_mpi_data.f90 sourcefile~mod_phys_lmdz_omp_data.f90->sourcefile~print_control_mod.f90

Contents

Source Code


Source Code

! $Id: moy_undefSTD.f90 5685 2025-05-27 11:07:44Z fhourdin $

SUBROUTINE moy_undefstd(itap)
USE clesphys_mod_h, ONLY : freq_calnmc, freq_outnmc
USE netcdf
USE dimphy, ONLY : klon
USE phys_state_var_mod, ONLY : missing_val_nf90,nlevstd,nout,o3daysumstd,o3sumstd,phisumstd,phys_tstep
USE phys_state_var_mod, ONLY : qsumstd,rhsumstd,t2sumstd,tnondef,tsumstd,u2sumstd,usumstd,uvsumstd,v2sumstd
USE phys_state_var_mod, ONLY : vphisumstd,vqsumstd,vsumstd,vtsumstd,wqsumstd,wsumstd,wtsumstd
USE wxios_mod, ONLY: missing_val_xios => missing_val, using_xios
USE phys_cal_mod, ONLY: mth_len
USE phys_output_var_mod, ONLY : clef_files


  IMPLICIT NONE
  REAL :: missing_val

  ! ====================================================================

  ! I. Musat : 09.2004

  ! Moyenne - a des frequences differentes - des valeurs bien definies
  ! (.NE.missing_val) des variables interpolees a un niveau de
  ! pression.
  ! 1) les variables de type "day" (nout=1) ou "mth" (nout=2) sont sommees
  ! tous les pas de temps de la physique

  ! 2) les variables de type "NMC" (nout=3) sont calculees a partir
  ! des valeurs instantannees toutes les 6 heures


  ! NB: mettre "inst(X)" dans le write_hist*NMC.h !
  ! ====================================================================


  ! variables Input
  ! INTEGER nlevSTD, klevSTD, itap
  ! PARAMETER(klevSTD=17)
  INTEGER itap

  ! variables locales
  ! INTEGER i, k, nout, n
  ! PARAMETER(nout=3) !nout=1 day/nout=2 mth/nout=3 NMC
  INTEGER i, k, n
  ! REAL dtime, freq_outNMC(nout), freq_moyNMC(nout)
  ! REAL freq_outNMC(nout), freq_calNMC(nout)
  REAL freq_moynmc(nout)

  ! variables Output
  ! REAL tnondef(klon,klevSTD,nout)
  ! REAL tsumSTD(klon,klevSTD,nout)

  REAL un_jour
  PARAMETER (un_jour=86400.)
! REAL missing_val

! missing_val = nf90_fill_real
  IF (using_xios) THEN
    missing_val = missing_val_xios
  ELSE
    missing_val=missing_val_nf90
  ENDIF

  DO n = 1, nout
    IF (freq_outnmc(n)<0) THEN
      freq_moynmc(n) = (mth_len*un_jour)/freq_calnmc(n)
      ! print*,'moy_undefSTD n freq_out freq_moy =',
      ! $n,freq_moyNMC(n)
    ELSE
      freq_moynmc(n) = freq_outnmc(n)/freq_calnmc(n)
    END IF

    ! calcul 1 fois pas mois, 1 fois par jour ou toutes les 6h
 
!   print*,'STDSTD n,freq_outnmc(n),phys_tstep',n,freq_outnmc(n),phys_tstep

    IF ( clef_files(n) .and. mod(itap,nint(freq_outnmc(n)/phys_tstep))==0) THEN

      DO k = 1, nlevstd
        DO i = 1, klon
          IF (tnondef(i,k,n)/=(freq_moynmc(n))) THEN
            tsumstd(i, k, n) = tsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            usumstd(i, k, n) = usumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            vsumstd(i, k, n) = vsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            wsumstd(i, k, n) = wsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            phisumstd(i, k, n) = phisumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            qsumstd(i, k, n) = qsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            rhsumstd(i, k, n) = rhsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            uvsumstd(i, k, n) = uvsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            vqsumstd(i, k, n) = vqsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            vtsumstd(i, k, n) = vtsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            wqsumstd(i, k, n) = wqsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            vphisumstd(i, k, n) = vphisumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            wtsumstd(i, k, n) = wtsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            u2sumstd(i, k, n) = u2sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            v2sumstd(i, k, n) = v2sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            t2sumstd(i, k, n) = t2sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            o3sumstd(i, k, n) = o3sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
            o3daysumstd(i, k, n) = o3daysumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n))
          ELSE
            tsumstd(i, k, n) = missing_val
            usumstd(i, k, n) = missing_val
            vsumstd(i, k, n) = missing_val
            wsumstd(i, k, n) = missing_val
            phisumstd(i, k, n) = missing_val
            qsumstd(i, k, n) = missing_val
            rhsumstd(i, k, n) = missing_val
            uvsumstd(i, k, n) = missing_val
            vqsumstd(i, k, n) = missing_val
            vtsumstd(i, k, n) = missing_val
            wqsumstd(i, k, n) = missing_val
            vphisumstd(i, k, n) = missing_val
            wtsumstd(i, k, n) = missing_val
            u2sumstd(i, k, n) = missing_val
            v2sumstd(i, k, n) = missing_val
            t2sumstd(i, k, n) = missing_val
            o3sumstd(i, k, n) = missing_val
            o3daysumstd(i, k, n) = missing_val
          END IF !tnondef(i,k,n).NE.(freq_moyNMC(n))
        END DO !i
      END DO !k
    END IF !MOD(itap,NINT(freq_outNMC(n)/phys_tstep)).EQ.0

  END DO !n

  RETURN
END SUBROUTINE moy_undefstd