source: LMDZ6/trunk/libf/phylmd/ecrad.v1.5.1/radiation_delta_eddington.h @ 4976

Last change on this file since 4976 was 4489, checked in by lguez, 20 months ago

Merge LMDZ_ECRad branch back into trunk!

File size: 3.6 KB
Line 
1! radiation_delta_eddington.h - Delta-Eddington scaling -*- f90 -*-
2!
3! (C) Copyright 2015- ECMWF.
4!
5! This software is licensed under the terms of the Apache Licence Version 2.0
6! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
7!
8! In applying this licence, ECMWF does not waive the privileges and immunities
9! granted to it by virtue of its status as an intergovernmental organisation
10! nor does it submit to any jurisdiction.
11!
12! Author:  Robin Hogan
13! Email:   r.j.hogan@ecmwf.int
14!
15! This file is intended to be included inside a module to ensure that
16! these simple functions may be inlined
17
18!---------------------------------------------------------------------
19! Perform in-place delta-Eddington scaling of the phase function
20elemental subroutine delta_eddington(od, ssa, g)
21
22  use parkind1, only : jprb
23 
24  ! Total optical depth, single scattering albedo and asymmetry
25  ! factor
26  real(jprb), intent(inout) :: od, ssa, g
27 
28  ! Fraction of the phase function deemed to be in the forward lobe
29  ! and therefore treated as if it is not scattered at all
30  real(jprb) :: f
31 
32  f   = g*g
33  od  = od * (1.0_jprb - ssa*f)
34  ssa = ssa * (1.0_jprb - f) / (1.0_jprb - ssa*f)
35  g   = g / (1.0_jprb + g)
36 
37end subroutine delta_eddington
38
39
40!---------------------------------------------------------------------
41! Perform in-place delta-Eddington scaling of the phase function, but
42! using extensive variables (i.e. the scattering optical depth,
43! scat_od, rather than the single-scattering albedo, and the
44! scattering-optical-depth-multiplied-by-asymmetry-factor, scat_od_g,
45! rather than the asymmetry factor.
46elemental subroutine delta_eddington_extensive(od, scat_od, scat_od_g)
47
48  use parkind1, only : jprb
49
50  ! Total optical depth, scattering optical depth and asymmetry factor
51  ! multiplied by the scattering optical depth
52  real(jprb), intent(inout) :: od, scat_od, scat_od_g
53
54  ! Fraction of the phase function deemed to be in the forward lobe
55  ! and therefore treated as if it is not scattered at all
56  real(jprb) :: f, g
57
58  if (scat_od > 0.0_jprb) then
59    g = scat_od_g / scat_od
60  else
61    g = 0.0
62  end if
63
64  f         = g*g
65  od        = od - scat_od * f
66  scat_od   = scat_od * (1.0_jprb - f)
67  scat_od_g = scat_od * g / (1.0_jprb + g)
68 
69end subroutine delta_eddington_extensive
70
71
72!---------------------------------------------------------------------
73! Perform in-place delta-Eddington scaling of the phase function,
74! using the scattering optical depth rather than the single scattering
75! albedo
76elemental subroutine delta_eddington_scat_od(od, scat_od, g)
77
78  use parkind1, only : jprb
79 
80  ! Total optical depth, scattering optical depth and asymmetry factor
81  real(jprb), intent(inout) :: od, scat_od, g
82
83  ! Fraction of the phase function deemed to be in the forward lobe
84  ! and therefore treated as if it is not scattered at all
85  real(jprb) :: f
86
87  f       = g*g
88  od      = od - scat_od * f
89  scat_od = scat_od * (1.0_jprb - f)
90  g       = g / (1.0_jprb + g)
91
92end subroutine delta_eddington_scat_od
93
94
95!---------------------------------------------------------------------
96! Revert delta-Eddington-scaled quantities in-place, back to their
97! original state
98elemental subroutine revert_delta_eddington(od, ssa, g)
99
100  use parkind1, only : jprb
101 
102  ! Total optical depth, single scattering albedo and asymmetry
103  ! factor
104  real(jprb), intent(inout) :: od, ssa, g
105 
106  ! Fraction of the phase function deemed to be in the forward lobe
107  ! and therefore treated as if it is not scattered at all
108  real(jprb) :: f
109 
110  g   = g / (1.0_jprb - g)
111  f   = g*g
112  ssa = ssa / (1.0_jprb - f + f*ssa);
113  od  = od / (1.0_jprb - ssa*f)
114 
115end subroutine revert_delta_eddington
Note: See TracBrowser for help on using the repository browser.