Afivo  0.3
Data Types | Functions/Subroutines | Variables
m_af_surface Module Reference

This module contains routines for including flat surfaces between changes in epsilon (some material property). This can for example be used to include flat dielectrics in electrostatic computations. More...

Data Types

type  surface_t
 Type for a single surface. More...
 
type  surfaces_t
 Type for storing all the surfaces on a mesh. More...
 
interface  value_func
 

Functions/Subroutines

subroutine, public surface_initialize (tree, i_eps, diel, n_variables)
 Initialize a set of surfaces based on the value of epsilon. More...
 
integer function get_new_surface_ix (diel)
 Get index for new surface. More...
 
subroutine, public surface_set_values (tree, diel, iv, user_func)
 Set values on a dielectric with a user-defined function. More...
 
subroutine, public surface_set_weighted_sum (diel, i_out, i_in, w_in)
 Set surface variable to a weighted sum of other variables. More...
 
subroutine, public surface_copy_variable (diel, i_in, i_out)
 Copy surface variable to another index. More...
 
subroutine, public surface_get_integral (tree, diel, i_surf, surf_int)
 Compute integral of surface variable. More...
 
subroutine, public surface_update_after_refinement (tree, diel, ref_info)
 Update the dielectric surface after the mesh has been refined. More...
 
subroutine prolong_surface_from_parent (tree, diel, p_ix, p_id)
 Prolong a parent surface to newly created child surfaces. More...
 
subroutine restrict_surface_to_parent (tree, diel, ix)
 Restrict a child surface to its parent. More...
 
subroutine, public surface_get_refinement_links (diel, refinement_links)
 Get an array of pairs of boxes (their indices) across a surface. This can be used in af_adjust_refinement to prevent refinement jumps over the surface. More...
 
subroutine, public surface_surface_charge_to_rhs (tree, diel, i_sigma, i_rhs, fac)
 Map surface charge to a cell-centered right-hand side. More...
 
subroutine surface_charge_to_rhs (boxes, surface, i_sigma, i_rhs, fac)
 Routine that implements the mapping of surface charge to a cell-centered right-hand side. More...
 
subroutine, public surface_inside_layer_to_surface (tree, diel, i_cc, i_sigma, fac, clear_cc, clear_surf)
 Map first layer inside the dielectric to surface density. More...
 
subroutine inside_layer_to_surface (boxes, surface, i_cc, i_sigma, fac, clear_cc, clear_surf)
 Map first layer inside the dielectric to surface density. More...
 
subroutine, public surface_correct_field_fc (tree, diel, i_sigma, i_fld, i_phi, fac)
 Compute the electric field at face centers near surfaces. More...
 
subroutine, public surface_correct_field_cc (tree, diel, i_sigma, i_fld, i_phi, fac)
 Compute the electric field at cell centers near surfaces. More...
 
subroutine, public surface_get_surface_cell (tree, diel, x, ix_surf, ix_cell)
 
subroutine, public surface_write_output (tree, diel, i_vars, var_names, output_name, output_cnt)
 Write surface quantities to a separate output file. More...
 

Variables

integer, parameter, public surface_none = -1
 Value indicating there is no surface. More...
 

Detailed Description

This module contains routines for including flat surfaces between changes in epsilon (some material property). This can for example be used to include flat dielectrics in electrostatic computations.

Function/Subroutine Documentation

◆ surface_initialize()

subroutine, public m_af_surface::surface_initialize ( type(af_t), intent(inout)  tree,
integer, intent(in)  i_eps,
type(surfaces_t), intent(inout)  diel,
integer, intent(in)  n_variables 
)

Initialize a set of surfaces based on the value of epsilon.

Parameters
[in,out]treeInitialized grid
[in]i_epsWhich variable stores epsilon
[in,out]dielThe dielectric surface
[in]n_variablesNumber of surface variables

Definition at line 89 of file m_af_surface.f90.

◆ get_new_surface_ix()

integer function m_af_surface::get_new_surface_ix ( type(surfaces_t), intent(inout)  diel)

Get index for new surface.

Definition at line 175 of file m_af_surface.f90.

◆ surface_set_values()

subroutine, public m_af_surface::surface_set_values ( type(af_t), intent(in)  tree,
type(surfaces_t), intent(inout)  diel,
integer, intent(in)  iv,
procedure(value_func user_func 
)

Set values on a dielectric with a user-defined function.

Parameters
[in]ivSurface variable
user_funcUser supplied function

Definition at line 205 of file m_af_surface.f90.

◆ surface_set_weighted_sum()

subroutine, public m_af_surface::surface_set_weighted_sum ( type(surfaces_t), intent(inout)  diel,
integer, intent(in)  i_out,
integer, dimension(:), intent(in)  i_in,
real(dp), dimension(:), intent(in)  w_in 
)

Set surface variable to a weighted sum of other variables.

Parameters
[in]i_outOutput surface density
[in]i_inList of input surface densities
[in]w_inWeights of input densities

Definition at line 247 of file m_af_surface.f90.

◆ surface_copy_variable()

subroutine, public m_af_surface::surface_copy_variable ( type(surfaces_t), intent(inout)  diel,
integer, intent(in)  i_in,
integer, intent(in)  i_out 
)

Copy surface variable to another index.

Parameters
[in]i_inInput surface density
[in]i_outOutput surface density

Definition at line 275 of file m_af_surface.f90.

◆ surface_get_integral()

subroutine, public m_af_surface::surface_get_integral ( type(af_t), intent(in)  tree,
type(surfaces_t), intent(in)  diel,
integer, intent(in)  i_surf,
real(dp), intent(out)  surf_int 
)

Compute integral of surface variable.

Parameters
[in]i_surfSurface variables
[out]surf_intSurface integral

Definition at line 293 of file m_af_surface.f90.

◆ surface_update_after_refinement()

subroutine, public m_af_surface::surface_update_after_refinement ( type(af_t), intent(in)  tree,
type(surfaces_t), intent(inout)  diel,
type(ref_info_t), intent(in)  ref_info 
)

Update the dielectric surface after the mesh has been refined.

Definition at line 327 of file m_af_surface.f90.

◆ prolong_surface_from_parent()

subroutine m_af_surface::prolong_surface_from_parent ( type(af_t), intent(in)  tree,
type(surfaces_t), intent(inout)  diel,
integer, intent(in)  p_ix,
integer, intent(in)  p_id 
)
private

Prolong a parent surface to newly created child surfaces.

Parameters
[in]p_ixIndex of parent surface
[in]p_idIndex of parent box (on outside)

Definition at line 366 of file m_af_surface.f90.

◆ restrict_surface_to_parent()

subroutine m_af_surface::restrict_surface_to_parent ( type(af_t), intent(in)  tree,
type(surfaces_t), intent(inout)  diel,
integer, intent(in)  ix 
)
private

Restrict a child surface to its parent.

Definition at line 432 of file m_af_surface.f90.

◆ surface_get_refinement_links()

subroutine, public m_af_surface::surface_get_refinement_links ( type(surfaces_t), intent(in)  diel,
integer, dimension(:, :), intent(inout), allocatable  refinement_links 
)

Get an array of pairs of boxes (their indices) across a surface. This can be used in af_adjust_refinement to prevent refinement jumps over the surface.

Parameters
[in,out]refinement_linksArray of linked boxes, on output of size (2, n_links)

Definition at line 472 of file m_af_surface.f90.

◆ surface_surface_charge_to_rhs()

subroutine, public m_af_surface::surface_surface_charge_to_rhs ( type(af_t), intent(inout)  tree,
type(surfaces_t), intent(in)  diel,
integer, intent(in)  i_sigma,
integer, intent(in)  i_rhs,
real(dp), intent(in)  fac 
)

Map surface charge to a cell-centered right-hand side.

Parameters
[in]i_sigmaSurface charage variable
[in]i_rhsRhs variable (in the tree)
[in]facMultiplication factor

Definition at line 494 of file m_af_surface.f90.

◆ surface_charge_to_rhs()

subroutine m_af_surface::surface_charge_to_rhs ( type(box_t), dimension(:), intent(inout)  boxes,
type(surface_t), intent(in)  surface,
integer, intent(in)  i_sigma,
integer, intent(in)  i_rhs,
real(dp), intent(in)  fac 
)
private

Routine that implements the mapping of surface charge to a cell-centered right-hand side.

Parameters
[in]i_sigmaSurface charage variable
[in]i_rhsRhs variable (in the tree)
[in]facMultiplication factor

Definition at line 514 of file m_af_surface.f90.

◆ surface_inside_layer_to_surface()

subroutine, public m_af_surface::surface_inside_layer_to_surface ( type(af_t), intent(inout)  tree,
type(surfaces_t), intent(inout)  diel,
integer, intent(in)  i_cc,
integer, intent(in)  i_sigma,
real(dp), intent(in)  fac,
logical, intent(in)  clear_cc,
logical, intent(in)  clear_surf 
)

Map first layer inside the dielectric to surface density.

Parameters
[in]i_ccCell-centered variable (in the tree)
[in]i_sigmaSurface charage variable
[in]facMultiplication factor
[in]clear_ccSet density to zero afterwards
[in]clear_surfSet surface density to zero initially

Definition at line 569 of file m_af_surface.f90.

◆ inside_layer_to_surface()

subroutine m_af_surface::inside_layer_to_surface ( type(box_t), dimension(:), intent(inout)  boxes,
type(surface_t), intent(inout)  surface,
integer, intent(in)  i_cc,
integer, intent(in)  i_sigma,
real(dp), intent(in)  fac,
logical, intent(in)  clear_cc,
logical, intent(in)  clear_surf 
)
private

Map first layer inside the dielectric to surface density.

Parameters
[in]i_ccCell-centered variable (in the tree)
[in]i_sigmaSurface charage variable
[in]facMultiplication factor
[in]clear_ccSet density to zero afterwards
[in]clear_surfSet surface density to zero initially

Definition at line 591 of file m_af_surface.f90.

◆ surface_correct_field_fc()

subroutine, public m_af_surface::surface_correct_field_fc ( type(af_t), intent(inout)  tree,
type(surfaces_t), intent(in)  diel,
integer, intent(in)  i_sigma,
integer, intent(in)  i_fld,
integer, intent(in)  i_phi,
real(dp), intent(in)  fac 
)

Compute the electric field at face centers near surfaces.

Parameters
[in]i_sigmaSurface charge variable
[in]i_fldFace-centered field variable
[in]i_phiCell-centered potential variable
[in]facElementary charge over eps0

Definition at line 629 of file m_af_surface.f90.

◆ surface_correct_field_cc()

subroutine, public m_af_surface::surface_correct_field_cc ( type(af_t), intent(inout)  tree,
type(surfaces_t), intent(in)  diel,
integer, intent(in)  i_sigma,
integer, dimension(ndim), intent(in)  i_fld,
integer, intent(in)  i_phi,
real(dp), intent(in)  fac 
)

Compute the electric field at cell centers near surfaces.

Parameters
[in]i_sigmaSurface charge variable
[in]i_fldCell-centered field variables
[in]i_phiCell-centered potential variable
[in]facElementary charge over eps0

Definition at line 731 of file m_af_surface.f90.

◆ surface_get_surface_cell()

subroutine, public m_af_surface::surface_get_surface_cell ( type(af_t), intent(in)  tree,
type(surfaces_t), intent(in)  diel,
real(dp), dimension(ndim), intent(in)  x,
integer, intent(out)  ix_surf,
integer, dimension(ndim-1), intent(out)  ix_cell 
)
Parameters
[in]xCoordinate inside dielectric
[out]ix_surfIndex of surface
[out]ix_cellIndex of cell on surface

Definition at line 822 of file m_af_surface.f90.

◆ surface_write_output()

subroutine, public m_af_surface::surface_write_output ( type(af_t), intent(inout)  tree,
type(surfaces_t), intent(in)  diel,
integer, dimension(:), intent(in)  i_vars,
character(len=*), dimension(:), intent(in)  var_names,
character(len=*), intent(in)  output_name,
integer, intent(in)  output_cnt 
)

Write surface quantities to a separate output file.

Parameters
[in]i_varsIndices of the variables
[in]var_namesNames of the variables
[in]output_nameBase name for output
[in]output_cntIndex of output

Definition at line 851 of file m_af_surface.f90.

Variable Documentation

◆ surface_none

integer, parameter, public m_af_surface::surface_none = -1

Value indicating there is no surface.

Definition at line 27 of file m_af_surface.f90.