Afivo
0.3
|
This module contains all kinds of different 'helper' routines for Afivo. If the number of routines for a particular topic becomes large, they should probably be put in a separate module. More...
Functions/Subroutines | |
subroutine, public | af_loop_box (tree, my_procedure, leaves_only) |
Call procedure for each box in tree. More... | |
subroutine, public | af_loop_box_arg (tree, my_procedure, rarg, leaves_only) |
Call procedure for each box in tree, with argument rarg. More... | |
subroutine, public | af_loop_boxes (tree, my_procedure, leaves_only) |
Call procedure for each id in tree, giving the list of boxes. More... | |
subroutine, public | af_loop_boxes_arg (tree, my_procedure, rarg, leaves_only) |
Call procedure for each id in tree, giving the list of boxes. More... | |
subroutine, public | af_loop_tree (tree, my_procedure, leaves_only) |
Call procedure for each id in tree, passing the tree as first argument. More... | |
subroutine, public | af_loop_tree_arg (tree, my_procedure, rarg, leaves_only) |
Call procedure for each id in tree, passing the tree as first argument. More... | |
pure logical function, public | af_r_inside (box, r, d) |
Returns whether r is inside or within a distance d from box. More... | |
pure integer function, public | af_get_id_at (tree, rr, highest_lvl, guess) |
Get the id of the finest box containing rr. If highest_lvl is present, do not go to a finer level than highest_lvl. If there is no box containing rr, return a location of -1. More... | |
pure type(af_loc_t) function, public | af_get_loc (tree, rr, highest_lvl, guess) |
Get the location of the finest cell containing rr. If highest_lvl is present, do not go to a finer level than highest_lvl. If there is no box containing rr, return a location of -1. More... | |
pure integer function | child_that_contains (box, rr) |
For a box with children that contains rr, find in which child rr lies. More... | |
pure real(dp) function, dimension(ndim), public | af_r_loc (tree, loc) |
Get the coordinate of the cell-center at loc. More... | |
subroutine, public | af_tree_clear_cc (tree, iv) |
subroutine, public | af_box_clear_cc (box, iv) |
Set cc(..., iv) = 0. More... | |
subroutine, public | af_tree_clear_ghostcells (tree, iv) |
subroutine, public | af_box_clear_ghostcells (box, iv) |
Set cc(..., iv) = 0. More... | |
subroutine, public | af_box_add_cc (box, iv_from, iv_to) |
Add cc(..., iv_from) to boxcc(..., iv_to) More... | |
subroutine, public | af_box_sub_cc (box, iv_from, iv_to) |
Subtract cc(..., iv_from) from boxcc(..., iv_to) More... | |
subroutine, public | af_tree_apply (tree, iv_a, iv_b, op, eps) |
Perform cc(..., iv_a) = cc(..., iv_a) 'op' cc(..., iv_b), where 'op' can be '+', '*' or '/'. More... | |
subroutine, public | af_tree_times_cc (tree, ivs, facs) |
subroutine, public | af_box_times_cc (box, a, iv) |
Multipy cc(..., iv) with a. More... | |
subroutine, public | af_box_lincomb_cc (box, a, iv_a, b, iv_b) |
Set cc(..., iv_b) = a * cc(..., iv_a) + b * cc(..., iv_b) More... | |
subroutine, public | af_box_copy_cc_to (box_from, iv_from, box_to, iv_to) |
Copy cc(..., iv_from) from box_in to cc(..., iv_to) on box_out. More... | |
subroutine, public | af_box_copy_cc (box, iv_from, iv_to) |
Copy cc(..., iv_from) to boxcc(..., iv_to) More... | |
subroutine, public | af_box_copy_ccs (box, iv_from, iv_to) |
Copy cc(..., iv_from) to boxcc(..., iv_to) More... | |
subroutine, public | af_boxes_copy_cc (boxes, ids, iv_from, iv_to) |
Copy cc(..., iv_from) to boxcc(..., iv_to) for all ids. More... | |
subroutine, public | af_boxes_copy_ccs (boxes, ids, iv_from, iv_to) |
Copy cc(..., iv_from) to boxcc(..., iv_to) for all ids. More... | |
subroutine, public | af_tree_copy_cc (tree, iv_from, iv_to) |
Copy cc(..., iv_from) to boxcc(..., iv_to) for full tree. More... | |
subroutine, public | af_tree_copy_ccs (tree, iv_from, iv_to) |
Copy cc(..., iv_from) to boxcc(..., iv_to) for full tree. More... | |
subroutine, public | af_reduction (tree, box_func, reduction, init_val, out_val) |
A general scalar reduction method. More... | |
subroutine, public | af_reduction_vec (tree, box_func, reduction, init_val, out_val, n_vals) |
A general vector reduction method. More... | |
subroutine, public | af_reduction_loc (tree, iv, box_subr, reduction, init_val, out_val, out_loc) |
A general scalar reduction method, that returns the location of the minimum/maximum value found. More... | |
subroutine, public | af_tree_max_cc (tree, iv, cc_max, loc) |
Find maximum value of cc(..., iv). By default, only loop over leaves, and ghost cells are not used. More... | |
subroutine, public | af_tree_maxabs_cc (tree, iv, cc_max, loc) |
Find maximum value of abs(cc(..., iv)). By default, only loop over leaves, and ghost cells are not used. More... | |
subroutine, public | af_tree_min_cc (tree, iv, cc_min, loc) |
Find minimum value of cc(..., iv). By default, only loop over leaves, and ghost cells are not used. More... | |
subroutine, public | af_tree_max_fc (tree, dim, iv, fc_max, loc) |
Find maximum value of fc(..., dim, iv). By default, only loop over leaves. More... | |
subroutine, public | af_tree_min_fc (tree, dim, iv, fc_min, loc) |
Find maximum value of fc(..., dim, iv). By default, only loop over leaves. More... | |
subroutine | box_max_cc (box, iv, val, ix) |
subroutine | box_maxabs_cc (box, iv, val, ix) |
subroutine | box_min_cc (box, iv, val, ix) |
subroutine | box_max_fc (box, dim_iv, val, ix) |
subroutine | box_min_fc (box, dim_iv, val, ix) |
real(dp) function | reduce_max (a, b) |
real(dp) function | reduce_min (a, b) |
subroutine, public | af_tree_sum_cc (tree, iv, cc_sum, power) |
Find weighted sum of cc(..., iv). Only loop over leaves, and ghost cells are not used. More... | |
subroutine, public | af_box_copy_fc (box, iv_from, iv_to) |
Copy fx/fy/fz(..., iv_from) to fx/fy/fz(..., iv_to) More... | |
subroutine, public | af_boxes_copy_fc (boxes, ids, iv_from, iv_to) |
Copy fx/fy/fz(..., iv_from) to fx/fy/fz(..., iv_to) for all ids. More... | |
subroutine, public | af_tree_copy_fc (tree, iv_from, iv_to) |
Copy fx/fy/fz(..., iv_from) to fx/fy/fz(..., iv_to) for full tree. More... | |
This module contains all kinds of different 'helper' routines for Afivo. If the number of routines for a particular topic becomes large, they should probably be put in a separate module.
subroutine, public m_af_utils::af_loop_box | ( | type(af_t), intent(inout) | tree, |
procedure(af_subr) | my_procedure, | ||
logical, intent(in), optional | leaves_only | ||
) |
Call procedure for each box in tree.
Definition at line 57 of file m_af_utils.f90.
subroutine, public m_af_utils::af_loop_box_arg | ( | type(af_t), intent(inout) | tree, |
procedure(af_subr_arg) | my_procedure, | ||
real(dp), dimension(:), intent(in) | rarg, | ||
logical, intent(in), optional | leaves_only | ||
) |
Call procedure for each box in tree, with argument rarg.
Definition at line 89 of file m_af_utils.f90.
subroutine, public m_af_utils::af_loop_boxes | ( | type(af_t), intent(inout) | tree, |
procedure(af_subr_boxes) | my_procedure, | ||
logical, intent(in), optional | leaves_only | ||
) |
Call procedure for each id in tree, giving the list of boxes.
Definition at line 122 of file m_af_utils.f90.
subroutine, public m_af_utils::af_loop_boxes_arg | ( | type(af_t), intent(inout) | tree, |
procedure(af_subr_boxes_arg) | my_procedure, | ||
real(dp), dimension(:), intent(in) | rarg, | ||
logical, intent(in), optional | leaves_only | ||
) |
Call procedure for each id in tree, giving the list of boxes.
Definition at line 154 of file m_af_utils.f90.
subroutine, public m_af_utils::af_loop_tree | ( | type(af_t), intent(inout) | tree, |
procedure(af_subr_tree) | my_procedure, | ||
logical, intent(in), optional | leaves_only | ||
) |
Call procedure for each id in tree, passing the tree as first argument.
Definition at line 187 of file m_af_utils.f90.
subroutine, public m_af_utils::af_loop_tree_arg | ( | type(af_t), intent(inout) | tree, |
procedure(af_subr_tree_arg) | my_procedure, | ||
real(dp), dimension(:), intent(in) | rarg, | ||
logical, intent(in), optional | leaves_only | ||
) |
Call procedure for each id in tree, passing the tree as first argument.
Definition at line 217 of file m_af_utils.f90.
pure logical function, public m_af_utils::af_r_inside | ( | type(box_t), intent(in) | box, |
real(dp), dimension(ndim), intent(in) | r, | ||
real(dp), intent(in), optional | d | ||
) |
Returns whether r is inside or within a distance d from box.
Definition at line 248 of file m_af_utils.f90.
pure integer function, public m_af_utils::af_get_id_at | ( | type(af_t), intent(in) | tree, |
real(dp), dimension(ndim), intent(in) | rr, | ||
integer, intent(in), optional | highest_lvl, | ||
integer, intent(in), optional | guess | ||
) |
Get the id of the finest box containing rr. If highest_lvl is present, do not go to a finer level than highest_lvl. If there is no box containing rr, return a location of -1.
[in] | tree | Full grid |
[in] | rr | Coordinate |
[in] | highest_lvl | Maximum level of box |
[in] | guess | Guess of box id, cannot be used with highest_lvl |
Definition at line 266 of file m_af_utils.f90.
pure type(af_loc_t) function, public m_af_utils::af_get_loc | ( | type(af_t), intent(in) | tree, |
real(dp), dimension(ndim), intent(in) | rr, | ||
integer, intent(in), optional | highest_lvl, | ||
integer, intent(in), optional | guess | ||
) |
Get the location of the finest cell containing rr. If highest_lvl is present, do not go to a finer level than highest_lvl. If there is no box containing rr, return a location of -1.
[in] | tree | Full grid |
[in] | rr | Coordinate |
[in] | highest_lvl | Maximum level of box |
[in] | guess | Guess of box id, cannot be used with highest_lvl |
Definition at line 317 of file m_af_utils.f90.
|
private |
For a box with children that contains rr, find in which child rr lies.
[in] | box | A box with children |
[in] | rr | Location inside the box |
Definition at line 340 of file m_af_utils.f90.
pure real(dp) function, dimension(ndim), public m_af_utils::af_r_loc | ( | type(af_t), intent(in) | tree, |
type(af_loc_t), intent(in) | loc | ||
) |
Get the coordinate of the cell-center at loc.
[in] | tree | Full grid |
[in] | loc | Location object |
Definition at line 359 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_clear_cc | ( | type(af_t), intent(inout) | tree, |
integer, intent(in) | iv | ||
) |
[in] | iv | Variable to clear |
Definition at line 367 of file m_af_utils.f90.
subroutine, public m_af_utils::af_box_clear_cc | ( | type(box_t), intent(inout) | box, |
integer, intent(in) | iv | ||
) |
Set cc(..., iv) = 0.
[in] | iv | Variable to clear |
Definition at line 385 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_clear_ghostcells | ( | type(af_t), intent(inout) | tree, |
integer, intent(in) | iv | ||
) |
[in] | iv | Variable to clear |
Definition at line 391 of file m_af_utils.f90.
subroutine, public m_af_utils::af_box_clear_ghostcells | ( | type(box_t), intent(inout) | box, |
integer, intent(in) | iv | ||
) |
Set cc(..., iv) = 0.
[in] | iv | Variable to clear |
Definition at line 409 of file m_af_utils.f90.
subroutine, public m_af_utils::af_box_add_cc | ( | type(box_t), intent(inout) | box, |
integer, intent(in) | iv_from, | ||
integer, intent(in) | iv_to | ||
) |
Add cc(..., iv_from) to boxcc(..., iv_to)
Definition at line 435 of file m_af_utils.f90.
subroutine, public m_af_utils::af_box_sub_cc | ( | type(box_t), intent(inout) | box, |
integer, intent(in) | iv_from, | ||
integer, intent(in) | iv_to | ||
) |
Subtract cc(..., iv_from) from boxcc(..., iv_to)
Definition at line 443 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_apply | ( | type(af_t), intent(inout) | tree, |
integer, intent(in) | iv_a, | ||
integer, intent(in) | iv_b, | ||
character(len=*), intent(in) | op, | ||
real(dp), intent(in), optional | eps | ||
) |
Perform cc(..., iv_a) = cc(..., iv_a) 'op' cc(..., iv_b), where 'op' can be '+', '*' or '/'.
[in] | eps | Min value for division |
Definition at line 452 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_times_cc | ( | type(af_t), intent(inout) | tree, |
integer, dimension(:), intent(in) | ivs, | ||
real(dp), dimension(:), intent(in) | facs | ||
) |
Definition at line 490 of file m_af_utils.f90.
subroutine, public m_af_utils::af_box_times_cc | ( | type(box_t), intent(inout) | box, |
real(dp), intent(in) | a, | ||
integer, intent(in) | iv | ||
) |
Multipy cc(..., iv) with a.
Definition at line 514 of file m_af_utils.f90.
subroutine, public m_af_utils::af_box_lincomb_cc | ( | type(box_t), intent(inout) | box, |
real(dp), intent(in) | a, | ||
integer, intent(in) | iv_a, | ||
real(dp), intent(in) | b, | ||
integer, intent(in) | iv_b | ||
) |
Set cc(..., iv_b) = a * cc(..., iv_a) + b * cc(..., iv_b)
Definition at line 522 of file m_af_utils.f90.
subroutine, public m_af_utils::af_box_copy_cc_to | ( | type(box_t), intent(in) | box_from, |
integer, intent(in) | iv_from, | ||
type(box_t), intent(inout) | box_to, | ||
integer, intent(in) | iv_to | ||
) |
Copy cc(..., iv_from) from box_in to cc(..., iv_to) on box_out.
Definition at line 531 of file m_af_utils.f90.
subroutine, public m_af_utils::af_box_copy_cc | ( | type(box_t), intent(inout) | box, |
integer, intent(in) | iv_from, | ||
integer, intent(in) | iv_to | ||
) |
Copy cc(..., iv_from) to boxcc(..., iv_to)
Definition at line 539 of file m_af_utils.f90.
subroutine, public m_af_utils::af_box_copy_ccs | ( | type(box_t), intent(inout) | box, |
integer, dimension(:), intent(in) | iv_from, | ||
integer, dimension(:), intent(in) | iv_to | ||
) |
Copy cc(..., iv_from) to boxcc(..., iv_to)
Definition at line 546 of file m_af_utils.f90.
subroutine, public m_af_utils::af_boxes_copy_cc | ( | type(box_t), dimension(:), intent(inout) | boxes, |
integer, dimension(:), intent(in) | ids, | ||
integer, intent(in) | iv_from, | ||
integer, intent(in) | iv_to | ||
) |
Copy cc(..., iv_from) to boxcc(..., iv_to) for all ids.
Definition at line 553 of file m_af_utils.f90.
subroutine, public m_af_utils::af_boxes_copy_ccs | ( | type(box_t), dimension(:), intent(inout) | boxes, |
integer, dimension(:), intent(in) | ids, | ||
integer, dimension(:), intent(in) | iv_from, | ||
integer, dimension(:), intent(in) | iv_to | ||
) |
Copy cc(..., iv_from) to boxcc(..., iv_to) for all ids.
Definition at line 566 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_copy_cc | ( | type(af_t), intent(inout) | tree, |
integer, intent(in) | iv_from, | ||
integer, intent(in) | iv_to | ||
) |
Copy cc(..., iv_from) to boxcc(..., iv_to) for full tree.
Definition at line 579 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_copy_ccs | ( | type(af_t), intent(inout) | tree, |
integer, dimension(:), intent(in) | iv_from, | ||
integer, dimension(:), intent(in) | iv_to | ||
) |
Copy cc(..., iv_from) to boxcc(..., iv_to) for full tree.
Definition at line 590 of file m_af_utils.f90.
subroutine, public m_af_utils::af_reduction | ( | type(af_t), intent(in) | tree, |
box_func, | |||
reduction, | |||
real(dp), intent(in) | init_val, | ||
real(dp), intent(out) | out_val | ||
) |
A general scalar reduction method.
[in] | tree | Tree to do the reduction on |
[in] | init_val | Initial value for the reduction |
[out] | out_val | Result of the reduction |
Definition at line 601 of file m_af_utils.f90.
subroutine, public m_af_utils::af_reduction_vec | ( | type(af_t), intent(in) | tree, |
box_func, | |||
reduction, | |||
real(dp), dimension(n_vals), intent(in) | init_val, | ||
real(dp), dimension(n_vals), intent(out) | out_val, | ||
integer, intent(in) | n_vals | ||
) |
A general vector reduction method.
[in] | tree | Tree to do the reduction on |
[in] | n_vals | Size of vector |
[in] | init_val | Initial value for the reduction |
[out] | out_val | Result of the reduction |
Definition at line 644 of file m_af_utils.f90.
subroutine, public m_af_utils::af_reduction_loc | ( | type(af_t), intent(in) | tree, |
integer, intent(in) | iv, | ||
box_subr, | |||
reduction, | |||
real(dp), intent(in) | init_val, | ||
real(dp), intent(out) | out_val, | ||
type(af_loc_t), intent(out) | out_loc | ||
) |
A general scalar reduction method, that returns the location of the minimum/maximum value found.
[in] | tree | Tree to do the reduction on |
[in] | iv | Variable to operate on (can be ignored) |
[in] | init_val | Initial value for the reduction |
[out] | out_val | Result of the reduction |
[out] | out_loc | Location |
Definition at line 694 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_max_cc | ( | type(af_t), intent(in) | tree, |
integer, intent(in) | iv, | ||
real(dp), intent(out) | cc_max, | ||
type(af_loc_t), intent(out), optional | loc | ||
) |
Find maximum value of cc(..., iv). By default, only loop over leaves, and ghost cells are not used.
[in] | tree | Full grid |
[in] | iv | Index of variable |
[out] | cc_max | Maximum value |
[out] | loc | Location of maximum |
Definition at line 758 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_maxabs_cc | ( | type(af_t), intent(in) | tree, |
integer, intent(in) | iv, | ||
real(dp), intent(out) | cc_max, | ||
type(af_loc_t), intent(out), optional | loc | ||
) |
Find maximum value of abs(cc(..., iv)). By default, only loop over leaves, and ghost cells are not used.
[in] | tree | Full grid |
[in] | iv | Index of variable |
[out] | cc_max | Maximum value |
[out] | loc | Location of maximum |
Definition at line 773 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_min_cc | ( | type(af_t), intent(in) | tree, |
integer, intent(in) | iv, | ||
real(dp), intent(out) | cc_min, | ||
type(af_loc_t), intent(out), optional | loc | ||
) |
Find minimum value of cc(..., iv). By default, only loop over leaves, and ghost cells are not used.
[in] | tree | Full grid |
[in] | iv | Index of variable |
[out] | cc_min | Minimum value |
[out] | loc | Location of minimum |
Definition at line 788 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_max_fc | ( | type(af_t), intent(in) | tree, |
integer, intent(in) | dim, | ||
integer, intent(in) | iv, | ||
real(dp), intent(out) | fc_max, | ||
type(af_loc_t), intent(out), optional | loc | ||
) |
Find maximum value of fc(..., dim, iv). By default, only loop over leaves.
[in] | tree | Full grid |
[in] | dim | Flux dimension |
[in] | iv | Index of face variable |
[out] | fc_max | Maximum value |
[out] | loc | Location of maximum |
Definition at line 803 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_min_fc | ( | type(af_t), intent(in) | tree, |
integer, intent(in) | dim, | ||
integer, intent(in) | iv, | ||
real(dp), intent(out) | fc_min, | ||
type(af_loc_t), intent(out), optional | loc | ||
) |
Find maximum value of fc(..., dim, iv). By default, only loop over leaves.
[in] | tree | Full grid |
[in] | dim | Flux dimension |
[in] | iv | Index of face variable |
[out] | fc_min | Minimum value |
[out] | loc | Location of minimum |
Definition at line 822 of file m_af_utils.f90.
|
private |
Definition at line 840 of file m_af_utils.f90.
|
private |
Definition at line 852 of file m_af_utils.f90.
|
private |
Definition at line 864 of file m_af_utils.f90.
|
private |
Definition at line 876 of file m_af_utils.f90.
|
private |
Definition at line 915 of file m_af_utils.f90.
|
private |
Definition at line 954 of file m_af_utils.f90.
|
private |
Definition at line 959 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_sum_cc | ( | type(af_t), intent(in) | tree, |
integer, intent(in) | iv, | ||
real(dp), intent(out) | cc_sum, | ||
integer, intent(in), optional | power | ||
) |
Find weighted sum of cc(..., iv). Only loop over leaves, and ghost cells are not used.
[in] | tree | Full grid |
[in] | iv | Index of variable |
[out] | cc_sum | Volume-integrated sum of variable |
[in] | power | Sum of values**power (default: 1) |
Definition at line 966 of file m_af_utils.f90.
subroutine, public m_af_utils::af_box_copy_fc | ( | type(box_t), intent(inout) | box, |
integer, intent(in) | iv_from, | ||
integer, intent(in) | iv_to | ||
) |
Copy fx/fy/fz(..., iv_from) to fx/fy/fz(..., iv_to)
[in,out] | box | Operate on this box |
[in] | iv_from | From this variable |
[in] | iv_to | To this variable |
Definition at line 1029 of file m_af_utils.f90.
subroutine, public m_af_utils::af_boxes_copy_fc | ( | type(box_t), dimension(:), intent(inout) | boxes, |
integer, dimension(:), intent(in) | ids, | ||
integer, intent(in) | iv_from, | ||
integer, intent(in) | iv_to | ||
) |
Copy fx/fy/fz(..., iv_from) to fx/fy/fz(..., iv_to) for all ids.
[in,out] | boxes | List of all boxes |
[in] | ids | Operate on these boxes |
[in] | iv_from | From this variable |
[in] | iv_to | To this variable |
Definition at line 1037 of file m_af_utils.f90.
subroutine, public m_af_utils::af_tree_copy_fc | ( | type(af_t), intent(inout) | tree, |
integer, intent(in) | iv_from, | ||
integer, intent(in) | iv_to | ||
) |
Copy fx/fy/fz(..., iv_from) to fx/fy/fz(..., iv_to) for full tree.
[in,out] | tree | Full grid |
[in] | iv_from | From this variable |
[in] | iv_to | To this variable |
Definition at line 1052 of file m_af_utils.f90.