Introduction
To provide more flexibility and to reduce the number of configuration parameters, certain methods can be customized by users. For example to use custom grid refinement or to write custom output.
List of methods that can be modified
procedure(af_subr_ref), pointer :: user_refine => null()
procedure(af_subr), pointer :: user_initial_conditions => null()
procedure(af_subr), pointer :: user_new_pulse_conditions => null()
procedure(af_subr_bc), pointer :: user_potential_bc => null()
procedure(gas_dens_func), pointer :: user_gas_density => null()
procedure(field_func), pointer :: user_field_amplitude => null()
procedure(generic_subr), pointer :: user_generic_method => null()
procedure(log_subr), pointer :: user_write_log => null()
procedure(log_vars), pointer :: user_log_variables => null()
procedure(mg_func_lsf), pointer :: user_lsf => null()
procedure(mg_func_lsf), pointer :: user_lsf_bc => null()
How to set a custom method
In the m_user.f90
file, first add your custom routine. For example, it could be a method for initial conditions called my_init_cond
. This method can then be activated in the user_initialize
subroutine:
subroutine user_initialize(cfg, tree)
type(CFG_t), intent(inout) :: cfg
type(af_t), intent(inout) :: tree
user_initial_conditions => my_init_cond
end subroutine user_initialize
Interfaces of the methods
For some of the interfaces, check out the Afivo documentation. The other interfaces are listed below.
subroutine log_subr(tree, filename, out_cnt)
import
type(af_t), intent(in) :: tree
character(len=*), intent(in) :: filename
integer, intent(in) :: out_cnt
subroutine log_vars(tree, n_vars, var_names, var_values)
import
type(af_t), intent(in) :: tree
integer, intent(out) :: n_vars
character(len=name_len), intent(inout) :: var_names(user_max_log_vars)
real(dp), intent(inout) :: var_values(user_max_log_vars)
import
type(box_t), intent(in) :: box
integer, intent(in) :: IJK
real(dp) :: dens
import
type(af_t), intent(in) :: tree
real(dp), intent(in) :: time
real(dp) :: amplitude
import
type(af_t), intent(in) :: tree
real(dp), intent(in) :: time
import
type(af_t), intent(in) :: tree
real(dp), intent(in) :: time