Ignore:
Timestamp:
Jan 21, 2014, 4:07:42 PM (11 years ago)
Author:
msylvestre
Message:

LMDZ.GENERIC/UNIVERSAL. rings shadow added in the case diurnal=.false. (daily average of the shadow)

File:
1 edited

Legend:

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

    r1157 r1161  
    199199      character*80 fichier
    200200      integer l,ig,ierr,iq,iaer
    201 
     201     
    202202      !!! this is saved for diagnostic
    203203      real,dimension(:),allocatable,save :: fluxsurf_lw ! incident LW (IR) surface flux (W.m-2)
     
    411411      logical,save :: ice_update
    412412
     413!     included by MS to compute the daily average of rings shadowing
     414      integer, parameter :: nb_hours = 1536 ! set how many times per day are used
     415      real :: pas
     416      integer :: m
     417      ! temporary variables computed at each step of this average
     418      real :: ptime_day ! Universal time in sol fraction
     419      real :: tmp_zls   ! solar longitude
     420      real, dimension(:), allocatable :: tmp_fract ! day fraction of the time interval
     421      real, dimension(:), allocatable :: tmp_mu0 ! equivalent solar angle
    413422!=======================================================================
    414423
     
    455464        ALLOCATE(tau_col(ngrid))
    456465
    457          !! this is defined in comsaison_h
    458          ALLOCATE(mu0(ngrid))
    459          ALLOCATE(fract(ngrid))
    460 
     466        !! this is defined in comsaison_h
     467        ALLOCATE(mu0(ngrid))
     468        ALLOCATE(fract(ngrid))
     469
     470           
    461471         !! this is defined in radcommon_h
    462472         ALLOCATE(eclipse(ngrid))
     
    681691              ztim1=SIN(declin)
    682692!              ztim2=COS(declin)*COS(2.*pi*(zday/year_day) - zls*nres)
    683 !              ztim3=-COS(declin)*SIN(2.*pi*(zday/year_day) - zls*nres)
     693!              ztim3=-COS(declin)*SIN(2.  zday/year_day) - zls*nres)
    684694! JL12 corrects tidally resonant cases. nres=omega_rot/omega_orb
    685695              ztim2=COS(declin)*COS(2.*pi*(zday/year_day)*nres - zls)
     
    696706               call stelang(ngrid,sinlon,coslon,sinlat,coslat,    &
    697707               ztim1,ztim2,ztim3,mu0,fract)
    698 
    699            else
     708           else if(diurnal .eq. .false.) then
    700709
    701710               call mucorr(ngrid,declin,lati,mu0,fract,10000.,rad)
    702 
    703            endif
    704 
     711!               write(*,*) 'mu0 =', mu0
     712!               write(*,*) 'hello, l 738'
     713               ! WARNING: this function appears not to work in 1D
     714
     715           endif
     716           
    705717           !! Eclipse incoming sunlight (e.g. Saturn ring shadowing)
    706            if (rings_shadow) then
    707              if (diurnal) then
    708                call rings(ngrid, declin, ptime, rad, 0., eclipse)
    709                call writediagfi(ngrid,"shad","rings"," ", 2, 1.-eclipse)
    710                write(*,*) "Ring shadow activated."
    711              else
    712                write(*,*) "Ring shadow + diurnal=F not supported yet."
    713              endif
    714            else
    715                eclipse(:) = 0.0
    716            endif
     718
     719           if(rings_shadow) then
     720                write(*,*) 'Rings shadow activated'
     721                if(diurnal .eq. .false.) then ! we need to compute the daily average insolation
     722                    pas = 1./nb_hours
     723                    ptime_day = 0.
     724                    fract(:) = 0.
     725                    ALLOCATE(tmp_fract(ngrid))
     726                    ALLOCATE(tmp_mu0(ngrid))
     727                    tmp_fract(:) = 0.
     728                    eclipse(:) = 0.
     729                    tmp_mu0(:) = 0.
     730                   
     731                    do m=1, nb_hours
     732                        ptime_day = m*pas
     733                        call stellarlong(pday+ptime_day,tmp_zls)
     734                        call orbite(tmp_zls,dist_star,declin)
     735                        ztim1=SIN(declin)
     736                        ztim2=COS(declin)*COS(2.*pi*(pday+ptime_day-.5))
     737                        ztim3=-COS(declin)*SIN(2.*pi*(pday+ptime_day-.5))
     738                 
     739                        call stelang(ngrid,sinlon,coslon,sinlat,coslat,    &
     740                                 ztim1,ztim2,ztim3,tmp_mu0,tmp_fract)
     741                 
     742                        call rings(ngrid, declin, ptime_day, rad, 0., eclipse)
     743                 
     744                        fract(:) = fract(:) + (1.-eclipse(:))*tmp_fract(:) !! fract prend en compte l'ombre des anneaux et l'alternance jour/nuit
     745                    enddo
     746               
     747                    DEALLOCATE(tmp_fract)
     748                    DEALLOCATE(tmp_mu0)
     749           
     750                    fract(:) = fract(:)/nb_hours
     751                 
     752                 else   
     753                    call rings(ngrid, declin, ptime, rad, 0., eclipse)
     754                    fract(:) = fract(:) * (1.-eclipse)
     755                 endif
     756            else
     757                 eclipse(:) = 0.0
     758            endif
     759
    717760
    718761           if (corrk) then
     
    14311474      if(corrk)then
    14321475
     1476         if(ISNAN(sum(fluxtop_dn))) then
     1477            write(*,*) 'err fluxtop_dn'
     1478         else if(ISNAN(sum(area))) then
     1479            write(*,*) 'err area'
     1480         else if(ISNAN(totarea)) then
     1481            write(*,*) 'area is nan'
     1482         endif
     1483
    14331484         ISR = SUM(area(:)*fluxtop_dn(:))/totarea
    14341485         ASR = SUM(area(:)*fluxabs_sw(:))/totarea
     
    17171768           call writediagfi(ngrid,"ASR","absorbed stellar rad.","W m-2",2,fluxabs_sw)
    17181769           call writediagfi(ngrid,"OLR","outgoing longwave rad.","W m-2",2,fluxtop_lw)
     1770           call writediagfi(ngrid,"shad","rings"," ", 2, fract)
    17191771!           call writediagfi(ngrid,"ASRcs","absorbed stellar rad (cs).","W m-2",2,fluxabs_sw1)
    17201772!           call writediagfi(ngrid,"OLRcs","outgoing longwave rad (cs).","W m-2",2,fluxtop_lw1)
     
    18681920        !! this is defined in comsaison_h
    18691921        IF ( ALLOCATED(mu0)) DEALLOCATE(mu0)
     1922
    18701923        IF ( ALLOCATED(fract)) DEALLOCATE(fract)
     1924
     1925
     1926        !! this is defined in radcommon_h
     1927        IF ( ALLOCATED(eclipse)) DEALLOCATE(eclipse)
    18711928
    18721929        !! this is defined in comsoil_h
Note: See TracChangeset for help on using the changeset viewer.