Ignore:
Timestamp:
Feb 18, 2026, 10:28:23 AM (6 weeks ago)
Author:
mturbet
Message:

renaming and merging of radiative routines in phygeneric

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phygeneric/rad_ring_shadowing.F90

    r4076 r4077  
    1 subroutine call_rings(ngrid, ptime, pday, diurnal)
     1subroutine rad_ring_shadowing(ngrid, ptime, pday, diurnal)
    22    ! A subroutine to compute the day fraction in case of rings shadowing.
    33
     
    4141        do m=1, nb_hours
    4242            ptime_day = m*pas
    43             call stellarlong(pday+ptime_day,tmp_zls)
    44             call orbite(tmp_zls,tmp_dist_star,tmp_declin,tmp_right_ascen)
     43            call ephemeris_stellar_longitude(pday+ptime_day,tmp_zls)
     44            call ephemeris_orbit(tmp_zls,tmp_dist_star,tmp_declin,tmp_right_ascen)
    4545           
    4646            ztim1=SIN(tmp_declin)
     
    4848            ztim3=-COS(tmp_declin)*SIN(2.*pi*(pday+ptime_day-.5))
    4949
    50             call stelang(ngrid,sinlon,coslon,sinlat,coslat,    &
     50            call ephemeris_stellar_angle(ngrid,sinlon,coslon,sinlat,coslat,    &
    5151                        ztim1,ztim2,ztim3,tmp_mu0,tmp_fract, flatten)       
    52             call rings(ngrid, tmp_declin, ptime_day, rad, flatten, eclipse)
     52            call saturn_rings(ngrid, tmp_declin, ptime_day, rad, flatten, eclipse)
    5353            fract(:) = fract(:) + (1.-eclipse(:))*tmp_fract(:) !! fract takes into account the rings shadow and the day/night alternation
    5454
     
    6161                 
    6262     else   ! instant insolation is weighted by the rings shadow
    63             call rings(ngrid, declin, ptime, rad, 0., eclipse)
     63            call saturn_rings(ngrid, declin, ptime, rad, 0., eclipse)
    6464            fract(:) = fract(:) * (1.-eclipse)
    6565    endif
     
    6767    IF (ALLOCATED(eclipse)) DEALLOCATE(eclipse)
    6868
    69 end subroutine call_rings
     69end subroutine rad_ring_shadowing
     70
     71
     72SUBROUTINE saturn_rings(ngrid, declin, ptime, rad, flat, eclipse)
     73! Calculates Saturn's rings shadowing
     74! Includes rings opacities measured by Cassini/UVIS
     75! Authors: M. Sylvestre, M. Capderou, S. Guerlet, A. Spiga
     76
     77    use comdiurn_h, only: sinlat, sinlon, coslat, coslon
     78    use geometry_mod, only: latitude ! (rad)
     79 
     80    implicit none   
     81
     82    INTEGER, INTENT(IN) :: ngrid  ! horizontal grid dimension
     83    REAL, INTENT(IN) :: declin    ! latitude of the subsolar point
     84    REAL, INTENT(IN) :: ptime     ! UTC time in sol fraction : ptime=0.5 at noon
     85    REAL, INTENT(IN) :: rad       ! equatorial radius of the planet
     86    REAL, INTENT(IN) :: flat      ! flattening of the planet
     87    REAL, DIMENSION(ngrid), INTENT(OUT) :: eclipse ! absorption of the light by the rings   
     88   
     89    REAL :: rpol   ! polar radius of the planet
     90    REAL :: e      ! shape excentricity of the planet : (1-e*e) = (1-f)*(1-f)   
     91    INTEGER, PARAMETER :: nb_a = 4 ! number of subdivisions of the A ring
     92    INTEGER, PARAMETER :: nb_b = 3 ! number of subdivisions of the B ring
     93    INTEGER, PARAMETER :: nb_c = 3 ! number of subdivisions of the C ring
     94    INTEGER, PARAMETER :: nb_ca = 2 ! number of subdivisions in the Cassini division
     95    INTEGER :: i
     96
     97    ! arrays for the rings. TBD: dynamical?
     98    REAL, DIMENSION(nb_a) :: A_Rint ! internal radii of the subdivisions of the A ring
     99    REAL, DIMENSION(nb_a) :: A_Rext ! external radii of the subdivisions of the A ring
     100    REAL, DIMENSION(nb_b) :: B_Rint ! internal radii of the subdivisions of the B ring
     101    REAL, DIMENSION(nb_b) :: B_Rext ! external radii of the subdivisions of the B ring
     102    REAL, DIMENSION(nb_c) :: C_Rint ! internal radii of the subdivisions of the C ring
     103    REAL, DIMENSION(nb_c) :: C_Rext ! external radii of the subdivisions of the C ring
     104    REAL, DIMENSION(nb_ca) :: Ca_Rint ! internal radii of the subdivisions of the Cassini Division
     105    REAL, DIMENSION(nb_ca) :: Ca_Rext ! external radii of the subdivisions of the Cassini Division
     106
     107    ! Opacities of the rings : for each one we can give different opacities for each part
     108    REAL, DIMENSION(nb_a) :: tau_A ! opacity of the A ring
     109    REAL, DIMENSION(nb_b) :: tau_B ! opacity of the B ring
     110    REAL, DIMENSION(nb_c) :: tau_C ! opacity of the C ring
     111    REAL, DIMENSION(nb_ca) :: tau_Ca ! opacity of the Cassini Division
     112
     113    ! Parameters used to calculate if a point is under a ring subdivision's shadow
     114    REAL :: phi_S                             ! subsolar point longitude
     115    REAL, PARAMETER :: pi=acos(-1.0)   
     116    REAL, DIMENSION(:), ALLOCATABLE:: x, y, z ! cartesian coordinates of the points on the planet
     117    REAL :: xs, ys, zs                        ! cartesian coordinates of the points of the subsolar point
     118    REAL, DIMENSION(:), ALLOCATABLE :: k
     119    REAL, DIMENSION(:), ALLOCATABLE :: N      ! parameter to compute cartesian coordinates on a ellipsoidal planet
     120    REAL, DIMENSION(:), ALLOCATABLE :: r      ! distance at which the incident ray of sun crosses the equatorial plane
     121                                              ! measured from the center of the planet   
     122    REAL :: Ns                                ! (same for the subsolar point)
     123   
     124    ! equinox --> no shadow (AS: why is this needed?)
     125    if(declin .eq. 0.) then
     126        eclipse(:) = 0.
     127        return
     128    endif
     129
     130! 1) INITIALIZATION
     131
     132    ! Generic
     133    rpol = (1.- flat)*rad
     134    e = sqrt(2*flat - flat**2)
     135    ALLOCATE(x(ngrid))
     136    ALLOCATE(y(ngrid))
     137    ALLOCATE(z(ngrid))
     138    ALLOCATE(k(ngrid))
     139    ALLOCATE(N(ngrid))
     140    ALLOCATE(r(ngrid))
     141    eclipse(:) = 2000.
     142
     143! Model of the rings with Cassini/UVIS opacities
     144
     145    ! Size of the rings
     146    A_Rint(1) = 2.03*rad
     147    A_Rext(1) = 2.06*rad
     148    A_Rint(2) = 2.06*rad
     149    A_Rext(2) = 2.09*rad
     150    A_Rint(3) = 2.09*rad
     151    A_Rext(3) = 2.12*rad
     152    A_Rint(4) = 2.12*rad
     153    A_Rext(4) = 2.27*rad
     154
     155    B_Rint(1) = 1.53*rad
     156    B_Rext(1) = 1.64*rad
     157    B_Rint(2) = 1.64*rad
     158    B_Rext(2) = 1.83*rad
     159    B_Rint(3) = 1.83*rad
     160    B_Rext(3) = 1.95*rad
     161   
     162    C_Rint(1) = 1.24*rad
     163    C_Rext(1) = 1.29*rad
     164    C_Rint(2) = 1.29*rad
     165    C_Rext(2) = 1.43*rad
     166    C_Rint(3) = 1.43*rad
     167    C_Rext(3) = 1.53*rad
     168
     169    Ca_Rint(1) = 1.95*rad
     170    Ca_Rext(1) = 1.99*rad
     171    Ca_Rint(2) = 1.99*rad
     172    Ca_Rext(2) = 2.03*rad
     173
     174
     175    ! Opacities of the rings
     176    tau_A(1) = 1.24
     177    tau_A(2) = 0.81
     178    tau_A(3) = 0.67
     179    tau_A(4) = 0.58
     180               
     181    tau_B(1) = 1.29
     182    tau_B(2) = 5.13
     183    tau_B(3) = 2.84
     184   
     185    tau_C(1) = 0.06
     186    tau_C(2) = 0.10
     187    tau_C(3) = 0.14
     188
     189    tau_Ca(1) = 0.06
     190    tau_Ca(2) = 0.24
     191
     192    ! Convert to cartesian coordinates
     193    N(:) = rad / sqrt(1-(e**2)*sinlat(:)**2)
     194    x(:) = N(:)*coslat(:)*coslon(:)
     195    y(:) = N(:)*coslat(:)*sinlon(:)
     196    z(:) = N(:)*(1-e**2)*sinlat(:)
     197
     198! 2) LOCATION OF THE SUBSOLAR POINT
     199 
     200    ! subsolar longitude is deduced from time fraction ptime
     201    ! SG: the minus sign is important! ... otherwise subsolar point adopts a reverse rotation
     202    phi_S = -(ptime - 0.5)*2.*pi
     203!    write(*,*) 'subsol point coords : ', declin*180./pi, phi_S*180./pi
     204
     205    ! subsolar latitude is declin (declination of the sun)
     206    ! now convert in cartesian coordinates :
     207    Ns = rad/sqrt(1-(e**2)*sin(declin)**2)
     208    xs = Ns*cos(declin)*cos(phi_S)
     209    ys = Ns*cos(declin)*sin(phi_S)
     210    zs = Ns*(1-e**2)*sin(declin)
     211
     212! 3) WHERE DOES THE INCIDENT RAY OF SUN CROSS THE EQUATORIAL PLAN ?
     213
     214    k(:) = -z(:)/zs
     215    r(:) = (k(:)*xs + x(:))**2 + (k(:)*ys + y(:))**2
     216    r(:) = sqrt(r(:))
     217
     218! 4) SO WHERE ARE THE SHADOW OF THESE RINGS ?
     219
     220    ! Summer hemisphere is not under the shadow of the rings
     221    where(latitude(:)*declin .gt. 0.)
     222       eclipse(:) = 1000.
     223    end where
     224
     225    ! No shadow of the rings by night
     226    where(x(:)*xs + y(:)*ys + z(:)*zs .lt. 0.)
     227       eclipse(:) = 1000.
     228    end where
     229
     230    ! if the incident rays of sun cross a ring, there is a shadow
     231    do i=1, nb_A
     232        where(r(:) .ge. A_Rint(i) .and. r(:) .le. A_Rext(i) .and. eclipse(:) .ne. 1000.)
     233            eclipse(:) = 1. - exp(-tau_A(i)/abs(sin(declin)))
     234        end where
     235    end do
     236
     237    do i=1, nb_B
     238        where(r(:) .ge. B_Rint(i) .and. r(:) .le. B_Rext(i) .and. eclipse(:) .ne. 1000.)
     239            eclipse(:) = 1. - exp(-tau_B(i)/abs(sin(declin)))
     240        end where
     241    enddo
     242   
     243    do i=1, nb_C
     244        where(r(:) .ge. C_Rint(i) .and. r(:) .le. C_Rext(i) .and. eclipse(:) .ne. 1000.)
     245            eclipse(:) = 1. - exp(-tau_C(i)/abs(sin(declin)))
     246        end where
     247    enddo
     248
     249    do i=1, nb_ca
     250        where(r(:) .ge. Ca_Rint(i) .and. r(:) .le. Ca_Rext(i) .and. eclipse(:) .ne. 1000.)
     251            eclipse(:) = 1. - exp(-tau_Ca(i)/abs(sin(declin)))
     252        end where
     253    enddo
     254
     255    ! At the other places and the excluded ones, eclipse is 0.
     256    where(eclipse(:) .eq. 2000. .or. eclipse(:) .eq. 1000.)
     257        eclipse(:) = 0.
     258    end where
     259
     260! 5) CLEAN THE PLACE
     261    DEALLOCATE(x)
     262    DEALLOCATE(y)
     263    DEALLOCATE(z)
     264    DEALLOCATE(k)
     265    DEALLOCATE(N)
     266    DEALLOCATE(r)
     267
     268END SUBROUTINE saturn_rings
Note: See TracChangeset for help on using the changeset viewer.