|
ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
|
What the two-stream sweep hands the building faces of the immersed-boundary surface energy balance (erf.ibseb.radiation = two_stream), and how a face reads it. More...
#include <AMReX_Array4.H>#include <AMReX_Extension.H>#include <AMReX_GpuQualifiers.H>#include <AMReX_MultiFab.H>#include <AMReX_REAL.H>#include <limits>

Go to the source code of this file.
Classes | |
| struct | TwoStreamCanopyView |
| The fields a level's faces read for one step: the beam and the cosine of the zenith the sweep of that step wrote, and that sweep's interface fluxes. All null when the level has not swept this step (the initial report). More... | |
| struct | TwoStreamFaceSky |
| What one face takes from its column (all W/m^2). More... | |
| struct | GroundWallTerms |
| What two_stream_ground_wall_terms() adds to the ground balance's net shortwave and longwave [W/m^2]. More... | |
Functions | |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int | two_stream_column_base (int i, int j, const amrex::Array4< const amrex::Real > &alb_dir) noexcept |
| The interface a column starts on, counted from the ground: 0, or the roof's with erf.ibseb.two_stream_roofs. It is the second component of the field of TwoStreamCanopyView::ground_albedo_dir, which the sweep writes with the albedo of the column's lower boundary. More... | |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void | two_stream_canopy_beam (int i, int j, int kmin, int m_top, const amrex::Array4< const amrex::Real > &scratch, int f_dir_comp, bool sw_on, amrex::Real cos_zenith, amrex::Real cloud_fraction, bool blend, const amrex::Array4< amrex::Real > &beam) |
Write the direct beam on a horizontal surface at the interfaces 0 .. m_top of column (i,j), from the scratch of the evaluation that has just run there, into beam: the clear-sky evaluation's beam as it is, and the cloudy evaluation's blended in with the cloud fraction, by the same expression as the fluxes ((1 - f) clear + f cloudy), so the two round alike in single precision and the shortwave down less the beam is the diffuse light. More... | |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int | two_stream_canopy_sample (int k, int k0, int dir, int side, amrex::Real &w_up) |
| Sample interface of a face and the weight of the one above. A z face takes the interface it lies on: a roof (solid below, side -1) the bottom of its fluid cell (m = k - k0), a ceiling (solid above, side +1, as under an overhang of a building from an STL file) the top of it (m = k - k0 + 1). A wall takes the mean of the two interfaces of its cell (m and m + 1), its mean height. More... | |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE TwoStreamFaceSky | two_stream_face_sky (int i, int j, int k, int k0, int dir, int side, const amrex::Array4< const amrex::Real > &beam, const amrex::Array4< const amrex::Real > &cosz, const amrex::Array4< const amrex::Real > &fluxes) |
The column radiation a face at fluid cell (i,j,k) of direction dir, with its solid on side side, takes: at its sample (two_stream_canopy_sample()), the direct-normal irradiance (the beam over the column's cosine of the zenith), the diffuse light (the shortwave down less the beam, floored at zero against round-off on a transparent column), the longwave down, and the shortwave and longwave up, which the face takes through its view of the ground. More... | |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real | two_stream_ground_beam_share (int i, int j, int k0, const amrex::Array4< const amrex::Real > &beam, const amrex::Array4< const amrex::Real > &fluxes, const amrex::Array4< const amrex::Real > &alb_dir) |
| The share of column (i,j)'s shortwave up that is its ground's reflection of the direct beam: (direct-beam albedo x beam at the surface) over the shortwave up at the surface, which is that reflection plus the ground's reflection of the diffuse light; in [0, 1], and 0 when nothing comes up. The building faces take this share of the shortwave up at their own height as the reflected beam (erf.ibseb.ground_view_shadow): exact where the air between the ground and the face only absorbs, as both parts are then dimmed alike on the way up; with scattering the light the air sends up from the beam and from the sky's diffuse light is split in the surface's proportion too. More... | |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GroundWallTerms | two_stream_ground_wall_terms (amrex::Real sw_net, amrex::Real sw_beam, amrex::Real wall_view, amrex::Real sw_walls, amrex::Real lw_walls, amrex::Real lw_down, amrex::Real absorb_dif, amrex::Real emis) noexcept |
The change of the open ground's net radiation beside walls (erf.ibseb.ground_sky_view). The walls take the share wall_view of the ground's view of the sky. Through it the ground loses the sky's diffuse light and longwave and gains the walls': d_sw = c [(1 - alb_dif) sw_walls - wall_view (sw_net - sw_beam)], d_lw = c emis (lw_walls - wall_view lw_down). The share comes from a count of rays and can exceed 1 in a column closed in by walls; a ground cannot see more than its whole view, so there c = 1 / wall_view scales the loss and the gain alike (the ground then sees no sky and the walls' mean); c = 1 otherwise. The direct beam is not touched (the shadow takes it). More... | |
What the two-stream sweep hands the building faces of the immersed-boundary surface energy balance (erf.ibseb.radiation = two_stream), and how a face reads it.
The sweep already writes the interface fluxes of every column into ERF's rad_fluxes (RRTMGP's level layout: index k the lower interface of layer k, component 0 SW up, 1 SW down, 2 LW up, 3 LW down, after the clear/cloudy blend). What it does not keep is the direct beam, which only its scratch holds, and the cosine of the zenith it used. On the levels where ERF::init_ibseb() asks for them (TwoStreamRadiation::supply_canopy_forcing()) every sweep also writes:
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void two_stream_canopy_beam | ( | int | i, |
| int | j, | ||
| int | kmin, | ||
| int | m_top, | ||
| const amrex::Array4< const amrex::Real > & | scratch, | ||
| int | f_dir_comp, | ||
| bool | sw_on, | ||
| amrex::Real | cos_zenith, | ||
| amrex::Real | cloud_fraction, | ||
| bool | blend, | ||
| const amrex::Array4< amrex::Real > & | beam | ||
| ) |
Write the direct beam on a horizontal surface at the interfaces 0 .. m_top of column (i,j), from the scratch of the evaluation that has just run there, into beam: the clear-sky evaluation's beam as it is, and the cloudy evaluation's blended in with the cloud fraction, by the same expression as the fluxes ((1 - f) clear + f cloudy), so the two round alike in single precision and the shortwave down less the beam is the diffuse light.
vertical_two_stream_sweep() keeps the Beer-Lambert beam of every interface in its scratch (TwoStreamScratch::F_DIR), but writes it only when the shortwave is on and the sun is up; otherwise the scratch holds the other evaluation's beam or nothing at all, and the beam is zero. Call it right after each evaluation, before the next one overwrites the scratch.
| scratch | the sweep's scratch, as vertical_two_stream_sweep() takes it |
| f_dir_comp | the scratch component of the beam (TwoStreamScratch::F_DIR) |
| kmin | lowest cell of the column (its surface interface) |
| m_top | highest interface of the beam field, at most the column's top |
| sw_on | whether the sweep ran its shortwave |
| cos_zenith | cosine of the zenith angle the sweep used (unfloored) |
| cloud_fraction | the cloud fraction (used only when blend) |
| blend | false for the clear-sky evaluation (overwrite), true for the cloudy one |
| beam | the beam field (component 0, index k = m) |
Referenced by TwoStreamRadiation::advance().

| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int two_stream_canopy_sample | ( | int | k, |
| int | k0, | ||
| int | dir, | ||
| int | side, | ||
| amrex::Real & | w_up | ||
| ) |
Sample interface of a face and the weight of the one above. A z face takes the interface it lies on: a roof (solid below, side -1) the bottom of its fluid cell (m = k - k0), a ceiling (solid above, side +1, as under an overhang of a building from an STL file) the top of it (m = k - k0 + 1). A wall takes the mean of the two interfaces of its cell (m and m + 1), its mean height.
| k | fluid cell of the face (the level's index) |
| k0 | the level's domain bottom |
| dir | face direction (0 x, 1 y, 2 z) |
| side | side of the fluid cell the solid is on (-1 or +1) |
| w_up | weight of interface m + 1 |
Referenced by two_stream_face_sky().

|
noexcept |
The interface a column starts on, counted from the ground: 0, or the roof's with erf.ibseb.two_stream_roofs. It is the second component of the field of TwoStreamCanopyView::ground_albedo_dir, which the sweep writes with the albedo of the column's lower boundary.
Referenced by IBFaceSet::compute_shortwave_two_stream(), and two_stream_ground_beam_share().

| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE TwoStreamFaceSky two_stream_face_sky | ( | int | i, |
| int | j, | ||
| int | k, | ||
| int | k0, | ||
| int | dir, | ||
| int | side, | ||
| const amrex::Array4< const amrex::Real > & | beam, | ||
| const amrex::Array4< const amrex::Real > & | cosz, | ||
| const amrex::Array4< const amrex::Real > & | fluxes | ||
| ) |
The column radiation a face at fluid cell (i,j,k) of direction dir, with its solid on side side, takes: at its sample (two_stream_canopy_sample()), the direct-normal irradiance (the beam over the column's cosine of the zenith), the diffuse light (the shortwave down less the beam, floored at zero against round-off on a transparent column), the longwave down, and the shortwave and longwave up, which the face takes through its view of the ground.
| beam | beam field (index k = m) |
| cosz | cosine of the zenith, floored at zero (2D) |
| fluxes | interface fluxes in RRTMGP's level layout (absolute k) |
Referenced by IBFaceSet::compute_longwave_two_stream(), and IBFaceSet::compute_shortwave_two_stream().


| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real two_stream_ground_beam_share | ( | int | i, |
| int | j, | ||
| int | k0, | ||
| const amrex::Array4< const amrex::Real > & | beam, | ||
| const amrex::Array4< const amrex::Real > & | fluxes, | ||
| const amrex::Array4< const amrex::Real > & | alb_dir | ||
| ) |
The share of column (i,j)'s shortwave up that is its ground's reflection of the direct beam: (direct-beam albedo x beam at the surface) over the shortwave up at the surface, which is that reflection plus the ground's reflection of the diffuse light; in [0, 1], and 0 when nothing comes up. The building faces take this share of the shortwave up at their own height as the reflected beam (erf.ibseb.ground_view_shadow): exact where the air between the ground and the face only absorbs, as both parts are then dimmed alike on the way up; with scattering the light the air sends up from the beam and from the sky's diffuse light is split in the surface's proportion too.
| k0 | the level's domain bottom (the surface interface of fluxes) |
| beam | beam field (index k = m; m = 0 the surface) |
| fluxes | interface fluxes in RRTMGP's level layout (absolute k; component 0 SW up) |
| alb_dir | the ground's direct-beam albedo (2D) |
Referenced by IBFaceSet::compute_shortwave_two_stream().


|
noexcept |
The change of the open ground's net radiation beside walls (erf.ibseb.ground_sky_view). The walls take the share wall_view of the ground's view of the sky. Through it the ground loses the sky's diffuse light and longwave and gains the walls': d_sw = c [(1 - alb_dif) sw_walls - wall_view (sw_net - sw_beam)], d_lw = c emis (lw_walls - wall_view lw_down). The share comes from a count of rays and can exceed 1 in a column closed in by walls; a ground cannot see more than its whole view, so there c = 1 / wall_view scales the loss and the gain alike (the ground then sees no sky and the walls' mean); c = 1 otherwise. The direct beam is not touched (the shadow takes it).
| sw_net | the sweep's absorbed shortwave at the ground, beam and diffuse [W/m^2] |
| sw_beam | its absorbed direct beam [W/m^2] |
| wall_view | the walls' share of the ground's view [1] |
| sw_walls | the walls' reflected shortwave arriving on the ground [W/m^2] |
| lw_walls | the walls' longwave arriving on the ground [W/m^2] |
| lw_down | the sky's longwave down at the ground [W/m^2] |
| absorb_dif | the ground's diffuse absorptance, 1 - alb_dif [1] |
| emis | the ground's longwave emissivity [1] |
Referenced by TwoStreamRadiation::advance().
