Skip to content
Snippets Groups Projects
Commit 340f2e84 authored by RODIER Quentin's avatar RODIER Quentin
Browse files

Quentin 21/12/2023: add files from ecrad-1-4-0 official repo to...

Quentin 21/12/2023: add files from ecrad-1-4-0 official repo to ecrad-1-4-0_mnh before being modified
parent ddabe7cb
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
This diff is collapsed.
! radiation_delta_eddington.h - Delta-Eddington scaling
!
! (C) Copyright 2015- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities
! granted to it by virtue of its status as an intergovernmental organisation
! nor does it submit to any jurisdiction.
!
! Author: Robin Hogan
! Email: r.j.hogan@ecmwf.int
!
! This file is intended to be included inside a module to ensure that
! these simple functions may be inlined
!---------------------------------------------------------------------
! Perform in-place delta-Eddington scaling of the phase function
elemental subroutine delta_eddington(od, ssa, g)
use parkind1, only : jprb
! Total optical depth, single scattering albedo and asymmetry
! factor
real(jprb), intent(inout) :: od, ssa, g
! Fraction of the phase function deemed to be in the forward lobe
! and therefore treated as if it is not scattered at all
real(jprb) :: f
f = g*g
od = od * (1.0_jprb - ssa*f)
ssa = ssa * (1.0_jprb - f) / (1.0_jprb - ssa*f)
g = g / (1.0_jprb + g)
end subroutine delta_eddington
!---------------------------------------------------------------------
! Perform in-place delta-Eddington scaling of the phase function, but
! using extensive variables (i.e. the scattering optical depth,
! scat_od, rather than the single-scattering albedo, and the
! scattering-optical-depth-multiplied-by-asymmetry-factor, scat_od_g,
! rather than the asymmetry factor.
elemental subroutine delta_eddington_extensive(od, scat_od, scat_od_g)
use parkind1, only : jprb
! Total optical depth, scattering optical depth and asymmetry factor
! multiplied by the scattering optical depth
real(jprb), intent(inout) :: od, scat_od, scat_od_g
! Fraction of the phase function deemed to be in the forward lobe
! and therefore treated as if it is not scattered at all
real(jprb) :: f, g
if (scat_od > 0.0_jprb) then
g = scat_od_g / scat_od
else
g = 0.0
end if
f = g*g
od = od - scat_od * f
scat_od = scat_od * (1.0_jprb - f)
scat_od_g = scat_od * g / (1.0_jprb + g)
end subroutine delta_eddington_extensive
!---------------------------------------------------------------------
! Perform in-place delta-Eddington scaling of the phase function,
! using the scattering optical depth rather than the single scattering
! albedo
elemental subroutine delta_eddington_scat_od(od, scat_od, g)
use parkind1, only : jprb
! Total optical depth, scattering optical depth and asymmetry factor
real(jprb), intent(inout) :: od, scat_od, g
! Fraction of the phase function deemed to be in the forward lobe
! and therefore treated as if it is not scattered at all
real(jprb) :: f
f = g*g
od = od - scat_od * f
scat_od = scat_od * (1.0_jprb - f)
g = g / (1.0_jprb + g)
end subroutine delta_eddington_scat_od
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment