mus_particle_interpolation_module Module

In this module the routines and data types for interpolation of fluid properties at particle locations are implemented.



Abstract Interfaces

abstract interface

  • public function wghtFunc(r_lat) result(wght)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=rk), intent(in) :: r_lat

    Return Value real(kind=rk)


Derived Types

type, public ::  mus_particle_interpolator_type

Data type containing information required by routines to interpolate fluid properties to particle locations

Components

Type Visibility Attributes Name Initial
integer, public :: bnd_x(2)

Boundaries of interpolation stencil This indicates the offset of cells to each side of the cell containing the point to be interpolated intpBnds = (/ x_lo, x_hi, y_lo, y_hi, z_lo, z_hi /) For example: intpBnds = (/ -1, 1, -1, 1, -1, 1 /) will loop over all neighbor cells, intpBnds = (/ -1 1, -1, 1, 0, 0 /) will only loop over neighbors in x and y direction etc.

integer, public :: bnd_y(2)
integer, public :: bnd_z(2)
integer, public, allocatable :: neighDirs(:,:)

Directions of neighboring elements to interpolate from

integer, public, allocatable :: neighPaths(:,:)

"Paths" in terms of iDirs with which to reach neighboring stencil elements This depends on the stencil being used. We need this because not every element to interpolate from is accessible using just one neighDir e.g. when using the D3Q19 stencil the "corner elements" cannot be reached using just one neighDir.

integer, public :: Nelems

Number of elements (neighbors + the center element) to interpolate from. If all direct neighbors are used this is 27 in 3D and 9 in 2D.

procedure(wghtFunc), public, pointer, nopass :: getWght_x

Functions to calculate interpolation weights

procedure(wghtFunc), public, pointer, nopass :: getWght_y
procedure(wghtFunc), public, pointer, nopass :: getWght_z
character(len=labelLen), public :: interpolation_kind

Label of interpolation scheme used can be e.g. 'delta', 'linear', or 'peskin' Peskin stencil currently only works in serial.


Functions

public pure function intp_1D_delta(r_lat) result(del)

1D discrete delta interpolation function. Used to interpolate the fluid property of a lattice cell with barycenter xf to the position of a particle xp.

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: r_lat

Distance from particle to barycenter of fluid cell

Return Value real(kind=rk)

public pure function intp_1D_peskin(r_lat) result(del)

1D discrete delta interpolation function according to Peskin. Used to interpolate the fluid property of a lattice cell with barycenter xf to the position of a particle xp. Note that this function has a support of 2*dx so requires both neighbor and next-neighbor for interpolation

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: r_lat

Distance from particle to barycenter of fluid cell (must be positive)

Return Value real(kind=rk)

public pure function getwght1d_linear(r) result(weight)

Weight function for 1d linear interpolation or distribution. Given the distance from particle to fluid cell barycenter, it returns weight, where weight is a linear function of the distance between the position of the particle and the barycenter of the lattice site we are distributing to.

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: r

Distance r = xp - x/dx from particle to lattice barycenter

Return Value real(kind=rk)

public pure function one(r_lat) result(del)

Function to return interpolation weight 1.0 regardless of input. We need this as the weight for the z-direction interpolation in case of d2q9 stencil.

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: r_lat

Distance from particle to barycenter of fluid cell

Return Value real(kind=rk)

public pure function intp1d_linear(xd, f0, f1) result(f)

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: xd
real(kind=rk), intent(in) :: f0(0:)
real(kind=rk), intent(in) :: f1(0:)

Return Value real(kind=rk), (lbound(f0,1):ubound(f0,1))

public pure function get_xd(x_lat) result(xd)

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: x_lat

to particle position. Choose x, y or z component depending on which direction we are interpolating

Return Value real(kind=rk)

xd = (x-x0)/(x1-x0) = (x-x0)/dx


Subroutines

public subroutine init_particle_interpolator(interpolator, stencil)

Arguments

Type IntentOptional Attributes Name
type(mus_particle_interpolator_type), intent(inout) :: interpolator
type(tem_stencilHeader_type), intent(in) :: stencil

public subroutine finalize_particle_interpolator(interpolator)

Arguments

Type IntentOptional Attributes Name
type(mus_particle_interpolator_type), intent(inout) :: interpolator

public subroutine getInterpolationBnds(r_lat, lo_x, up_x, lo_y, up_y, lo_z, up_z)

getInterpolationBnds is used to determine which cells to interpolate fluid quantities from for a particle positioned at its coordOfOrigin + r_lat. The 8 cells obtained are the cells whose barycenter forms the tightest bounding cube around the particle.

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: r_lat(3)
integer, intent(out) :: lo_x
integer, intent(out) :: up_x
integer, intent(out) :: lo_y
integer, intent(out) :: up_y
integer, intent(out) :: lo_z
integer, intent(out) :: up_z

public subroutine printParticleInterpolator(interpolator, logUnit)

Arguments

Type IntentOptional Attributes Name
type(mus_particle_interpolator_type), intent(in) :: interpolator
integer, intent(in) :: logUnit