A module for 2D-advection. More...
Public Member Functions | |
subroutine | init_advection (distrib, nb) |
Allocate and init data. More... | |
subroutine | free_advection () |
subroutine | advection_iteration (k, distrib, nb_parts) |
One advection step for all partitions. More... | |
subroutine | advection_wrapper (part, k) |
subroutine | basic_splitting (part) |
Basic operation splitting : zonal then advection. More... | |
subroutine | alternate_directions (part, k) |
Alternate operation splitting : on each timestep, try a direction different of the previous. More... | |
subroutine | new_mass (rank, distrib) |
subroutine | print_mass (m_i, m_f) |
subroutine | print_iteration (k, rank, to_screen) |
Write to log file for master rank and eventually to stdout. More... | |
subroutine | set_estimation (input, distrib, is_timestep) |
Set simulation time step (in minutes) with 2D CFL condition (is_timestep=true), or CFL from timestep (is_timestep=false). More... | |
double precision function | find_local_estim (input, part, dummy, is_timestep) |
Winds are in degree/s and we return a timestep in minutes. More... | |
subroutine | update_local_estim (estim, input, i, j, k_z, k_m, dlat, dlon, part, is_timestep) |
Compute the timestep or CFL inside the cell (i,j) according to the type of advection. More... | |
subroutine | zonal_advection (part, first_split) |
Zonal advection on a partition, west to east. More... | |
subroutine | meridional_advection (part, first_split) |
Meridional advection on a partition, north to south. More... | |
subroutine | zonal_advection_sequential (part, first_split) |
Sequential zonaladvection Not optimized as we do not need to store the fluxes. More... | |
subroutine | merid_advection_sequential (part, first_split) |
Sequential meridional advection Not optimized as we do not need to store the fluxes. More... | |
subroutine | zonal_advection_nocomm (grid, first_split) |
Zonal advection for all cells (except ghost cells) Fluxes must be computed Assumes i_start <= i_end and j_start <= j_end. More... | |
subroutine | merid_advection_nocomm (part, first_split) |
Meridional advection (except for ghost cells) Need fluxes to be computed. More... | |
subroutine | update_tracer_zonal (i, j, k_f, grid, m_i, tracer, first_split) |
Update the tracer ratio and air mass for zonal advection according to a Van Leer finite-volume scheme. More... | |
subroutine | check_positivity (str_type, m_air, m_tracer) |
subroutine | check_cell_ratio (mesg, q_new) |
Must be positive and inferior to 1. More... | |
subroutine | update_tracer_merid (i, j, k_p, k_n, tracer, m_i, part, first_split) |
Update the tracer ratio and air mass for meridional advection according to a Van Leer finite-volume scheme. We use the mass set in the zonal advection. More... | |
subroutine | zonal_tracer_fluxes (part, interior) |
Compute the tracer transfers and store them. More... | |
integer function | count_zonal_tracer_fluxes (part, interior) |
subroutine | skip_merid_flux (k_f, i, j, part) |
Update array indice so we skip the cell south fluxes. Assume there are neighbours. More... | |
subroutine | set_zonal_gradient (part, interior) |
Compute the zonal gradients for meridional advection. More... | |
subroutine | zonal_gradient_interior (i_start, i_end, grid) |
integer function | count_zonal_gradient_interior (grid) |
subroutine | zonal_gradient_border (i_start, i_end, grid) |
integer function | count_zonal_gradient_border (grid) |
subroutine | merid_tracer_fluxes (part, interior) |
Compute the tracer transfers and store them. More... | |
subroutine | merid_fluxes_border (i_start, i_end, part) |
Compute the fluxes at the interior. The lat indices must be precomputed. More... | |
integer function | count_merid_tracer_fluxes (part, interior) |
integer function | count_merid_fluxes_border (i_start, i_end, part) |
subroutine | merid_interior (int_start, int_end, i, i_end, grid) |
Compute the indices for interior cells in respect to meridional fluxes (toward the south only) More... | |
subroutine | merid_fluxes_interior (i_start, i_end, part) |
Compute the fluxes at the interior. The lat indices must be precomputed. More... | |
integer function | count_merid_fluxes_interior (i_start, i_end, part) |
subroutine | merid_tracer_cell_fluxes (i, j, k_f, tracer, part) |
Set the meridional south fluxes of cells at (i,j) More... | |
double precision function | zonal_tracer_flux (i, j, j_neighb, k, tracer, part) |
Compute tracer flux between cell (i,j) and cell (i, j_neighb) More... | |
double precision function | merid_tracer_flux (i, j, j_neighb, k, tracer, part) |
Compute tracer flux between cell (i,j) and (i+1, j_neighb) More... | |
double precision function | merid_air_flux (i, j, i_neighb, j_neighb, k, grid) |
Compute air transfer at interface k between cell (i,j) and (i_neighb, j_neighb) More... | |
double precision function | zonal_air_flux (k, grid) |
Compute air transfer at interface k. More... | |
double precision function | compute_q_hat (q_var, i, j, i_neighb, j_neighb, tracer, part) |
Compute q hat with a second order scheme between (i,j) and (i_neighb,j_neighb) Works for zonal and meridional. More... | |
subroutine | set_zonal_slope (grid, interior) |
Set zonal slope for zonal border cells or the interior (the rest) More... | |
subroutine | set_merid_slope (part, interior) |
Set meridional slope for meridional border cells or the interior (the rest) The border has 2 layers in this case due to neighbour interpolation. More... | |
integer function | count_merid_slope (part, interior) |
double precision function | zonal_slope (i, j, tracer, grid) |
Compute zonal slope at i,j with limitation. More... | |
double precision function | merid_slope (i, j, tracer, part) |
Compute meridional slope at i,j with limitation. More... | |
double precision function | ratio_merid_interpolation (i, j, i_neighb, tracer, part) |
Piecewise interpolation of neighbouring cells concentrations Better than a linear interpolation from the cell concentrations directly. More... | |
double precision function | zonal_gradient (i, j, tracer, grid) |
Compute zonal gradient, used for meridional advection (in neighbour interpolation) interpolation. More... | |
double precision function | slope_limitation (q_prev, q_cur, q_next) |
Compute slope with limitation (van Leer) More... | |
subroutine | meridional_advection_interior (part) |
Meridional advection for border cells (which do need ghost cells) More... | |
subroutine | meridional_advection_border (part) |
Meridional advection for border cells (which do need ghost cells) More... | |
subroutine | fake_chemistry (distrib, nb) |
Sleep instead of chemistry. More... | |
subroutine | wait_request (request) |
Wait for a request to finish (blocking) More... | |
subroutine | count_halo_interior (part) |
Count interior and border cells Gather all data to master proc which write it to a file. More... | |
character(line_width) function | nbcells_filename (nb_procs) |
Public Attributes | |
logical | can_do_zonal |
logical | can_do_merid |
double precision | dt = 0 |
double precision, dimension(:), allocatable | mass_init |
double precision, dimension(:), allocatable | mass_final |
character(*), parameter | fname_advection = "advection_2d.F90" |
integer, dimension(4) | errors_mass = 0 |
integer, dimension(4) | errors_q = 0 |
A module for 2D-advection.
subroutine advection_2d::advection_iteration | ( | integer, intent(in) | k, |
type(partitioning), target | distrib, | ||
integer, intent(in) | nb_parts | ||
) |
One advection step for all partitions.
subroutine advection_2d::advection_wrapper | ( | type (partition) | part, |
integer, intent(in) | k | ||
) |
subroutine advection_2d::alternate_directions | ( | type (partition) | part, |
integer, intent(in) | k | ||
) |
Alternate operation splitting : on each timestep, try a direction different of the previous.
subroutine advection_2d::basic_splitting | ( | type (partition) | part | ) |
Basic operation splitting : zonal then advection.
subroutine advection_2d::check_cell_ratio | ( | character(*) | mesg, |
double precision, intent(in) | q_new | ||
) |
Must be positive and inferior to 1.
subroutine advection_2d::check_positivity | ( | character(*), intent(in) | str_type, |
double precision | m_air, | ||
double precision | m_tracer | ||
) |
double precision function advection_2d::compute_q_hat | ( | double precision, intent(in) | q_var, |
integer, intent(in) | i, | ||
integer, intent(in) | j, | ||
integer, intent(in) | i_neighb, | ||
integer, intent(in) | j_neighb, | ||
integer, intent(in) | tracer, | ||
type (partition) | part | ||
) |
Compute q hat with a second order scheme between (i,j) and (i_neighb,j_neighb) Works for zonal and meridional.
q_var | : proportion of tracer going out/in. It is better than to compute U/m_i as we can simply the fraction |
tracer | : tracer id |
subroutine advection_2d::count_halo_interior | ( | type (partition) | part | ) |
Count interior and border cells Gather all data to master proc which write it to a file.
integer function advection_2d::count_merid_fluxes_border | ( | integer, intent(in) | i_start, |
integer, intent(in) | i_end, | ||
type (partition), target | part | ||
) |
integer function advection_2d::count_merid_fluxes_interior | ( | integer, intent(in) | i_start, |
integer, intent(in) | i_end, | ||
type (partition), target | part | ||
) |
integer function advection_2d::count_merid_slope | ( | type (partition), target | part, |
logical, intent(in) | interior | ||
) |
integer function advection_2d::count_merid_tracer_fluxes | ( | type (partition), target | part, |
logical, intent(in) | interior | ||
) |
integer function advection_2d::count_zonal_gradient_border | ( | type (band_grid) | grid | ) |
integer function advection_2d::count_zonal_gradient_interior | ( | type (band_grid) | grid | ) |
integer function advection_2d::count_zonal_tracer_fluxes | ( | type (partition), target | part, |
logical, intent(in) | interior | ||
) |
subroutine advection_2d::fake_chemistry | ( | type(partitioning), pointer | distrib, |
integer, intent(in) | nb | ||
) |
Sleep instead of chemistry.
double precision function advection_2d::find_local_estim | ( | double precision, intent(in) | input, |
type(partition), pointer | part, | ||
double precision, intent(in) | dummy, | ||
logical, intent(in) | is_timestep | ||
) |
Winds are in degree/s and we return a timestep in minutes.
subroutine advection_2d::free_advection | ( | ) |
subroutine advection_2d::init_advection | ( | type (partitioning), target | distrib, |
integer, intent(in) | nb | ||
) |
Allocate and init data.
subroutine advection_2d::merid_advection_nocomm | ( | type (partition), target | part, |
logical, intent(in) | first_split | ||
) |
Meridional advection (except for ghost cells) Need fluxes to be computed.
subroutine advection_2d::merid_advection_sequential | ( | type (partition), target | part, |
logical, intent(in) | first_split | ||
) |
Sequential meridional advection Not optimized as we do not need to store the fluxes.
double precision function advection_2d::merid_air_flux | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer, intent(in) | i_neighb, | ||
integer, intent(in) | j_neighb, | ||
integer, intent(in) | k, | ||
type (band_grid) | grid | ||
) |
Compute air transfer at interface k between cell (i,j) and (i_neighb, j_neighb)
subroutine advection_2d::merid_fluxes_border | ( | integer, intent(in) | i_start, |
integer, intent(in) | i_end, | ||
type (partition), target | part | ||
) |
Compute the fluxes at the interior. The lat indices must be precomputed.
subroutine advection_2d::merid_fluxes_interior | ( | integer, intent(in) | i_start, |
integer, intent(in) | i_end, | ||
type (partition), target | part | ||
) |
Compute the fluxes at the interior. The lat indices must be precomputed.
subroutine advection_2d::merid_interior | ( | integer | int_start, |
integer | int_end, | ||
integer, intent(in) | i, | ||
integer, intent(in) | i_end, | ||
type (band_grid) | grid | ||
) |
Compute the indices for interior cells in respect to meridional fluxes (toward the south only)
double precision function advection_2d::merid_slope | ( | integer | i, |
integer | j, | ||
integer, intent(in) | tracer, | ||
type (partition), target | part | ||
) |
Compute meridional slope at i,j with limitation.
subroutine advection_2d::merid_tracer_cell_fluxes | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer | k_f, | ||
integer, intent(in) | tracer, | ||
type (partition) | part | ||
) |
Set the meridional south fluxes of cells at (i,j)
k_f | : position in the flux array |
tracer | : tracer id |
double precision function advection_2d::merid_tracer_flux | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer, intent(in) | j_neighb, | ||
integer | k, | ||
integer, intent(in) | tracer, | ||
type (partition) | part | ||
) |
Compute tracer flux between cell (i,j) and (i+1, j_neighb)
k | : position in the winds array |
tracer | : tracer id |
subroutine advection_2d::merid_tracer_fluxes | ( | type (partition), target | part, |
logical, intent(in) | interior | ||
) |
Compute the tracer transfers and store them.
subroutine advection_2d::meridional_advection | ( | type (partition) | part, |
logical, intent(in) | first_split | ||
) |
Meridional advection on a partition, north to south.
subroutine advection_2d::meridional_advection_border | ( | type (partition) | part | ) |
Meridional advection for border cells (which do need ghost cells)
subroutine advection_2d::meridional_advection_interior | ( | type (partition) | part | ) |
Meridional advection for border cells (which do need ghost cells)
character(line_width) function advection_2d::nbcells_filename | ( | integer, intent(in) | nb_procs | ) |
subroutine advection_2d::new_mass | ( | integer, intent(in) | rank, |
type (partitioning) | distrib | ||
) |
subroutine advection_2d::print_iteration | ( | integer, intent(in) | k, |
integer, intent(in) | rank, | ||
logical, optional | to_screen | ||
) |
Write to log file for master rank and eventually to stdout.
subroutine advection_2d::print_mass | ( | double precision, intent(in) | m_i, |
double precision, intent(in) | m_f | ||
) |
double precision function advection_2d::ratio_merid_interpolation | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer, intent(in) | i_neighb, | ||
integer, intent(in) | tracer, | ||
type (partition), target | part | ||
) |
Piecewise interpolation of neighbouring cells concentrations Better than a linear interpolation from the cell concentrations directly.
subroutine advection_2d::set_estimation | ( | double precision, intent(in) | input, |
type(partitioning), target | distrib, | ||
logical, intent(in) | is_timestep | ||
) |
Set simulation time step (in minutes) with 2D CFL condition (is_timestep=true), or CFL from timestep (is_timestep=false).
input | : either timestep (in seconds) or CFL |
subroutine advection_2d::set_merid_slope | ( | type (partition), target | part, |
logical, intent(in) | interior | ||
) |
Set meridional slope for meridional border cells or the interior (the rest) The border has 2 layers in this case due to neighbour interpolation.
subroutine advection_2d::set_zonal_gradient | ( | type (partition), target | part, |
logical, intent(in) | interior | ||
) |
Compute the zonal gradients for meridional advection.
subroutine advection_2d::set_zonal_slope | ( | type (band_grid) | grid, |
logical, intent(in) | interior | ||
) |
Set zonal slope for zonal border cells or the interior (the rest)
subroutine advection_2d::skip_merid_flux | ( | integer | k_f, |
integer, intent(in) | i, | ||
integer, intent(in) | j, | ||
type (partition) | part | ||
) |
Update array indice so we skip the cell south fluxes. Assume there are neighbours.
double precision function advection_2d::slope_limitation | ( | double precision | q_prev, |
double precision | q_cur, | ||
double precision | q_next | ||
) |
Compute slope with limitation (van Leer)
subroutine advection_2d::update_local_estim | ( | double precision | estim, |
double precision, intent(in) | input, | ||
integer, intent(in) | i, | ||
integer, intent(in) | j, | ||
integer | k_z, | ||
integer | k_m, | ||
double precision, intent(in) | dlat, | ||
double precision, intent(in) | dlon, | ||
type (partition), target | part, | ||
logical | is_timestep | ||
) |
Compute the timestep or CFL inside the cell (i,j) according to the type of advection.
input | : either given cfl or timestep dlon : true distance on the sphere |
subroutine advection_2d::update_tracer_merid | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer | k_p, | ||
integer | k_n, | ||
integer, intent(in) | tracer, | ||
double precision, intent(in) | m_i, | ||
type (partition), target | part, | ||
logical, intent(in) | first_split | ||
) |
Update the tracer ratio and air mass for meridional advection according to a Van Leer finite-volume scheme. We use the mass set in the zonal advection.
k_p,k_n | : position in the flux array of the prev (next) flux |
m_i | : air mass at the beginning of timestep |
subroutine advection_2d::update_tracer_zonal | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer, intent(in) | k_f, | ||
type (band_grid) | grid, | ||
double precision, intent(in) | m_i, | ||
integer, intent(in) | tracer, | ||
logical, intent(in) | first_split | ||
) |
Update the tracer ratio and air mass for zonal advection according to a Van Leer finite-volume scheme.
m_i | : the cell area is equal to the mass |
k_f | : position in the flux array of the west flux |
subroutine advection_2d::wait_request | ( | integer | request | ) |
Wait for a request to finish (blocking)
subroutine advection_2d::zonal_advection | ( | type (partition), target | part, |
logical, intent(in) | first_split | ||
) |
Zonal advection on a partition, west to east.
subroutine advection_2d::zonal_advection_nocomm | ( | type (band_grid) | grid, |
logical, intent(in) | first_split | ||
) |
Zonal advection for all cells (except ghost cells) Fluxes must be computed Assumes i_start <= i_end and j_start <= j_end.
subroutine advection_2d::zonal_advection_sequential | ( | type (partition), target | part, |
logical, intent(in) | first_split | ||
) |
Sequential zonaladvection Not optimized as we do not need to store the fluxes.
double precision function advection_2d::zonal_air_flux | ( | integer, intent(in) | k, |
type (band_grid) | grid | ||
) |
Compute air transfer at interface k.
double precision function advection_2d::zonal_gradient | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer, intent(in) | tracer, | ||
type (band_grid) | grid | ||
) |
Compute zonal gradient, used for meridional advection (in neighbour interpolation) interpolation.
i,j | : current cell |
subroutine advection_2d::zonal_gradient_border | ( | integer, intent(in) | i_start, |
integer, intent(in) | i_end, | ||
type (band_grid) | grid | ||
) |
subroutine advection_2d::zonal_gradient_interior | ( | integer, intent(in) | i_start, |
integer, intent(in) | i_end, | ||
type (band_grid) | grid | ||
) |
double precision function advection_2d::zonal_slope | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer, intent(in) | tracer, | ||
type (band_grid) | grid | ||
) |
Compute zonal slope at i,j with limitation.
double precision function advection_2d::zonal_tracer_flux | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer, intent(in) | j_neighb, | ||
integer | k, | ||
integer, intent(in) | tracer, | ||
type (partition) | part | ||
) |
Compute tracer flux between cell (i,j) and cell (i, j_neighb)
k | : position in the winds array |
subroutine advection_2d::zonal_tracer_fluxes | ( | type (partition), target | part, |
logical, intent(in) | interior | ||
) |
Compute the tracer transfers and store them.
k | : the position in the slope array |
logical advection_2d::can_do_merid |
logical advection_2d::can_do_zonal |
double precision advection_2d::dt = 0 |
integer, dimension(4) advection_2d::errors_mass = 0 |
integer, dimension(4) advection_2d::errors_q = 0 |
character(*), parameter advection_2d::fname_advection = "advection_2d.F90" |
double precision, dimension(:), allocatable advection_2d::mass_final |
double precision, dimension(:), allocatable advection_2d::mass_init |