Ignore:
Timestamp:
Oct 11, 2023, 12:36:59 PM (13 months ago)
Author:
yjaziri
Message:

Generic PCM:

Move mu0 (cosinus of solar zenith angle) calculation out of callrad
This was a issue for photochemistry because mu0 was updated only iradia times

YJ

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90

    r2987 r3081  
    903903!---------------------------------
    904904
     905      ! Compute local stellar zenith angles
     906      ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     907      if (tlocked) then
     908      ! JL14 corrects tidally resonant (and inclined) cases. nres=omega_rot/omega_orb
     909         ztim1=SIN(declin)
     910         ztim2=COS(declin)*COS(zlss)
     911         ztim3=COS(declin)*SIN(zlss)
     912
     913         call stelang(ngrid,sinlon,coslon,sinlat,coslat,    &
     914                        ztim1,ztim2,ztim3,mu0,fract, flatten)
     915
     916      elseif (diurnal) then
     917         ztim1=SIN(declin)
     918         ztim2=COS(declin)*COS(2.*pi*(zday-.5))
     919         ztim3=-COS(declin)*SIN(2.*pi*(zday-.5))
     920
     921         call stelang(ngrid,sinlon,coslon,sinlat,coslat,    &
     922                        ztim1,ztim2,ztim3,mu0,fract, flatten)
     923      else if(diurnal .eqv. .false.) then
     924
     925         call mucorr(ngrid,declin,latitude,mu0,fract,10000.,rad,flatten)
     926         ! WARNING: this function appears not to work in 1D
     927
     928         if ((ngrid.eq.1).and.(global1d)) then ! Fixed zenith angle 'szangle' in 1D simulations w/ globally-averaged sunlight.
     929            mu0 = cos(pi*szangle/180.0)
     930         endif
     931
     932      endif
     933
    905934      if (callrad) then
    906935         if( mod(icount-1,iradia).eq.0.or.lastcall) then
    907 
    908           ! Compute local stellar zenith angles
    909           ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    910             if (tlocked) then
    911             ! JL14 corrects tidally resonant (and inclined) cases. nres=omega_rot/omega_orb
    912                ztim1=SIN(declin)
    913                ztim2=COS(declin)*COS(zlss)
    914                ztim3=COS(declin)*SIN(zlss)
    915 
    916                call stelang(ngrid,sinlon,coslon,sinlat,coslat,    &
    917                             ztim1,ztim2,ztim3,mu0,fract, flatten)
    918 
    919             elseif (diurnal) then
    920                ztim1=SIN(declin)
    921                ztim2=COS(declin)*COS(2.*pi*(zday-.5))
    922                ztim3=-COS(declin)*SIN(2.*pi*(zday-.5))
    923 
    924                call stelang(ngrid,sinlon,coslon,sinlat,coslat,    &
    925                             ztim1,ztim2,ztim3,mu0,fract, flatten)
    926             else if(diurnal .eqv. .false.) then
    927 
    928                call mucorr(ngrid,declin,latitude,mu0,fract,10000.,rad,flatten)
    929                ! WARNING: this function appears not to work in 1D
    930 
    931                if ((ngrid.eq.1).and.(global1d)) then ! Fixed zenith angle 'szangle' in 1D simulations w/ globally-averaged sunlight.
    932                   mu0 = cos(pi*szangle/180.0)
    933                   !print*,'acosz=',mu0,', szangle=',szangle
    934                endif
    935 
    936             endif
    937936           
    938937            ! Eclipse incoming sunlight (e.g. Saturn ring shadowing).       
Note: See TracChangeset for help on using the changeset viewer.