mus_particle_MEM_module Module

mus_particle_MEM module contains routines needed for the simulation of fully resolved Momentum Exchange Method particles

-------------------- AUXILIARY ROUTINES ------------------------!!



Subroutines

public subroutine initParticle_MEM(particle, particleID, geometry, scheme, myRank, comm, rmflag)

Routine to initialize a newly created MEM particle

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: particle

Particle to initialize

integer, intent(in) :: particleID

Number to uniquely identify particle particle

type(mus_geom_type), intent(in) :: geometry

Geometry to determine TreeIDs of elements 'covered' by particle

type(mus_scheme_type), intent(inout) :: scheme

Scheme for access to level descriptor

integer, intent(in) :: myRank

MPI rank of this process

type(mus_particles_communication_type) :: comm

Communication data type for particles

logical, intent(out) :: rmflag

flag to indicate whether particle exists on this process or should be removed

public subroutine applyHydrodynamicForces(this, scheme, stencil, params, rho_p_lat)

ApplyHydrodynamicForces performs the momentum transfer from fluid TO particle

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this
type(mus_scheme_type), intent(inout) :: scheme

Scheme for access to level descriptor

type(tem_stencilHeader_type), intent(in) :: stencil

fluid stencil

type(mus_param_type), intent(in) :: params

Parameters for access to conversion factors between units

real(kind=rk), intent(in), optional :: rho_p_lat

Density value to compute equilibrium PDFs with in case local fluid density is not available because i.e. the adjacent element is a wall or another particle.

public subroutine mapToLattice(this, particleGroup, scheme, stencil, geometry, params, rmflag)

mapToLattice is the high-level routine performs a full re-mapping each time step

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this
type(mus_particle_group_type), intent(inout) :: particleGroup

Particle group in which to search for collisions

type(mus_scheme_type), intent(inout) :: scheme

Scheme for access to level descriptor

type(tem_stencilHeader_type), intent(in) :: stencil

fluid stencil

type(mus_geom_type), intent(in) :: geometry

Geometry to determine TreeIDs of elements 'covered' by particle

type(mus_param_type), intent(in) :: params

Parameters for access to e.g. time step dt

logical, intent(out) :: rmflag

Flag that tells whether to remove this particle from this process

public subroutine updateCoordOfOrigin(this, geometry)

updateCoordOfOrigin updates the integer coordinate of the origin of a particle

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this

Particle to update coordOfOrigin of

type(mus_geom_type), intent(in) :: geometry

Geometry information to determine new coord of origin

public subroutine updateExclusionList(this, scheme, geometry, myRank, procs, nProcs, dx, rmflag)

UpdateExclusionList uses the continuous particle position and particle radius to determine which lattice elements belong to the particle. These are stored in the 'ExclusionList' of elements which do not participate in stream-and-collide. It also checks if particles exist or should exist on some other process and stores this information in the logical masks of the particle.

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this
type(mus_scheme_type), intent(inout) :: scheme

Scheme for access to level descriptor

type(mus_geom_type), intent(in) :: geometry

Geometry information to determine TreeIDs of elements 'covered' by particle

integer, intent(in) :: myRank

This process's rank

integer, intent(in) :: procs(:)

Array of neighbor procs on which particle could possibly exist

integer, intent(in) :: nProcs

Number of procs in array procs

real(kind=rk), intent(in) :: dx

Mesh size

logical, intent(out) :: rmflag

Logical to indicate whether particle should be removed from this process

public subroutine updateSolidNodes(this, scheme, stencil)

updateSolidNodes modifies connectivity of scheme%pdf%neigh such that the particle cells do not participate in the streaming process. Specifically it: * runs over the elements in this%exclusionList * sets kernel neighbor list values to the particle elements themselves. * This way they are effectively excluded from the streaming process. * Sets the property bit prp_solid to 1 to indicate elements belonging to a particle

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this
type(mus_scheme_type), intent(inout) :: scheme

Scheme for access to pdf%neigh

type(tem_stencilHeader_type), intent(in) :: stencil

fluid stencil

public subroutine updateFluidNeighbors(this, scheme, stencil)

updateFluidNeighbors Runs over all particle elements (those in exclusionList) and then over each stencil direction. When it finds a fluid neighbor in a direction it sets the bounceback condition for that neighbor

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this
type(mus_scheme_type), intent(inout) :: scheme

Scheme for access to level descriptor

type(tem_stencilHeader_type), intent(in) :: stencil

fluid stencil

public subroutine updateNewFluidNodes(this, scheme, stencil)

updateNewFluidNodes restores the correct connectivity for new fluid elements which were particle elements in the previous time step.

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this
type(mus_scheme_type), intent(inout) :: scheme

Scheme for access to level descriptor

type(tem_stencilHeader_type), intent(in) :: stencil

fluid stencil

public subroutine destroyParticle_MEM(this, particleGroup, scheme, params)

destroyParticle_MEM removes a particle from the lattice and the particleGroup It will * empty the exclusionList * initialize all the former particle elements to new fluid elements * restore connectivity for all these new fluid elements This routine should be followed up by a call to remove_particle_from_da_particle_MEM!

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this
type(mus_particle_group_type), intent(inout) :: particleGroup

Particle group in which to search for collisions

type(mus_scheme_type), intent(inout) :: scheme

Scheme for access to level descriptor

type(mus_param_type), intent(in) :: params

Parameters for access to dx and dt

public subroutine applyVelocityBounceback(this, scheme, stencil, params)

ApplyVelocityBounceback adds the momentum exchange term to the distribution function at the particle neighboring fluid nodes this term accounts for the moving boundary of the particle.

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this
type(mus_scheme_type), intent(inout) :: scheme

Scheme for access to level descriptor

type(tem_stencilHeader_type), intent(in) :: stencil

fluid stencil

type(mus_param_type), intent(in) :: params

Parameters for access to dt, dx, conversion factors between units

public subroutine checkForParticleOverlap(this, particleGroup, scheme, overlapsOtherParticle)

handleParticleOverlap checks for overlap with discrete representations of other particles. Returns overlapsOtherParticle = TRUE if there is overlap. This does not require communication with other processes.

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this

Particle we are currently checking overlap for

type(mus_particle_group_type), intent(inout) :: particleGroup

particleGroup to search for overlapping particles in

type(mus_scheme_type), intent(in) :: scheme

Scheme for access to level descriptor

logical, intent(out) :: overlapsOtherParticle

logical indicating if a overlap has been detected (1) or not (0)

public subroutine setToEquilibrium(elemList, N, lev, scheme, rho, vel)

setToEquilibrium sets elements to equilibrium distribution

Arguments

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

list containing positions in state vector of elements to set to equilibrium distribution

integer, intent(in) :: N

number of values in elemList

integer, intent(in) :: lev

level

type(mus_scheme_type), intent(inout) :: scheme

scheme for access to levelDesc and pdf

real(kind=rk), intent(in) :: rho(:)

density value for computing fEq

real(kind=rk), intent(in) :: vel(:,:)

velocity vector

public subroutine make_pdf_tiny(scheme, particle, lev)

make_pdf_tiny sets the state vector (particle distribution function) values to some tiny value. This is done for visualization purposes. It has no effect on the flow as the particle elements do not participate in the stream-and-collide process.

Arguments

Type IntentOptional Attributes Name
type(mus_scheme_type) :: scheme
type(mus_particle_MEM_type) :: particle
integer :: lev

private subroutine updateParticleOwner(this, scheme, geometry, myRank, procs, nProcs)

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this
type(mus_scheme_type), intent(inout) :: scheme

Scheme for access to level descriptor

type(mus_geom_type), intent(in) :: geometry

Geometry information to determine TreeIDs of elements 'covered' by particle

integer, intent(in) :: myRank

This process's rank

integer, intent(in) :: procs(:)

Array of neighbor procs on which particle could possibly exist

integer, intent(in) :: nProcs

Number of procs in array procs

private subroutine updateExistsOnProc(this, scheme, geometry, myRank, procs, nProcs, rmflag)

updateExistsOnProc updates the mask that tells us whether a particle exists on our neighboring procs. It does this by checking which processes are intersected by the bounding box of the particle + a "bumper" of one lattice cell to account for the fact that a particle can also exist on a proc as purely halos

Arguments

Type IntentOptional Attributes Name
type(mus_particle_MEM_type), intent(inout) :: this
type(mus_scheme_type), intent(inout) :: scheme

Scheme for access to level descriptor

type(mus_geom_type), intent(in) :: geometry

Geometry information to determine TreeIDs of elements 'covered' by particle

integer, intent(in) :: myRank

This process's rank

integer, intent(in) :: procs(:)

Array of neighbor procs on which particle could possibly exist

integer, intent(in) :: nProcs

Number of procs in array procs

logical, intent(out) :: rmflag

logical to set whether particle should be removed from this proc

private subroutine findParticleFromElem(particleGroup, elemPos, thisParticleIndex, findParticleIndex, particleID)

find particle index and ID in particleGroup array

Arguments

Type IntentOptional Attributes Name
type(mus_particle_group_type), intent(in) :: particleGroup

Array of particles

integer, intent(in) :: elemPos

Index of element for which to find particle in state array

integer :: thisParticleIndex

Index of particle that was found in particleGroup%particles

integer :: findParticleIndex
integer :: particleID

ID of particle that was found