mod_multigrid_coupling Module

Module to couple the octree-mg library to AMRVAC. This file uses the VACPP preprocessor, but its use is kept to a minimum.


Uses

  • module~~mod_multigrid_coupling~~UsesGraph module~mod_multigrid_coupling mod_multigrid_coupling module~m_octree_mg_3d m_octree_mg_3d module~mod_multigrid_coupling->module~m_octree_mg_3d module~mod_mpi_wrapper mod_mpi_wrapper module~m_octree_mg_3d->module~mod_mpi_wrapper mpi mpi module~m_octree_mg_3d->mpi module~mod_mpi_wrapper->mpi

Used by

  • module~~mod_multigrid_coupling~~UsedByGraph module~mod_multigrid_coupling mod_multigrid_coupling proc~amr_coarsen_refine amr_coarsen_refine proc~amr_coarsen_refine->module~mod_multigrid_coupling proc~improve_initial_condition improve_initial_condition proc~improve_initial_condition->module~mod_multigrid_coupling proc~main main proc~main->module~mod_multigrid_coupling proc~timeintegration timeintegration proc~timeintegration->module~mod_multigrid_coupling

Variables

Type Visibility Attributes Name Initial
type(mg_t), public :: mg

Data structure containing the multigrid tree.

procedure(after_new_tree), public, pointer :: mg_after_new_tree => null()

If defined, this routine is called after a new multigrid tree is constructed.


Interfaces

interface

  • public subroutine after_new_tree()

    Arguments

    None

Subroutines

public subroutine mg_copy_boundary_conditions(mg, iw)

Set multigrid boundary conditions for the solution according to variable iw

Arguments

Type IntentOptional Attributes Name
type(mg_t), intent(inout) :: mg
integer, intent(in) :: iw

public subroutine mg_copy_from_tree(iw_from, iw_to, state_to)

Copy a variable from the multigrid tree

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iw_from

Variable to use as right-hand side

integer, intent(in) :: iw_to

Copy to this variable

type(state), intent(inout), optional, target :: state_to(max_blocks)

If present, use this as the output state

public subroutine mg_copy_from_tree_gc(iw_from, iw_to, state_to)

Copy from multigrid tree with one layer of ghost cells. Corner ghost cells are not used/set.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iw_from

Variable to use as right-hand side

integer, intent(in) :: iw_to

Copy to this variable

type(state), intent(inout), optional, target :: state_to(max_blocks)

If present, use this as the output state

public subroutine mg_copy_to_tree(iw_from, iw_to, restrict, restrict_gc, factor, state_from)

Copy a variable to the multigrid tree, including a layer of ghost cells

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iw_from

Variable to use as right-hand side

integer, intent(in) :: iw_to

Copy to this variable

logical, intent(in), optional :: restrict

Restrict variable on multigrid tree

logical, intent(in), optional :: restrict_gc

Fill ghost cells after restrict

real(kind=dp), intent(in), optional :: factor

out = factor * in

type(state), intent(in), optional, target :: state_from(max_blocks)

If present, use this as the input state

public subroutine mg_setup_multigrid()

Setup multigrid for usage

Arguments

None

public subroutine mg_tree_from_amrvac(mg)

Generate a multigrid tree that includes the amrvac tree, but also contains coarser grid levels. A number of checks has already been performed in mg_setup_multigrid, so we don't repeat these checks here.

Arguments

Type IntentOptional Attributes Name
type(mg_t), intent(inout) :: mg

public subroutine mg_update_refinement(n_coarsen, n_refine)

If the grid has changed, rebuild the full multigrid tree

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n_coarsen
integer, intent(in) :: n_refine