mus_particle_blob_module Module

mus_particle_blob_module contains types for particle "blobs" representing data that can be used to quickly create groups (blobs) of particles with certain shapes like prisms, cylinders etc.



Variables

Type Visibility Attributes Name Initial
type(mus_particle_blob_cylinder_type), public, save :: particleblob
type(mus_particle_blob_prism_type), public, save :: particleblob_prism

Interfaces

public interface fill_prism

  • public subroutine fill_prism_by_distance(lx, ly, lz, d, positions)

    Arguments

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

    Vector spanning the prism in x-direction

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

    Vector spanning the prism in y-direction

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

    Vector spanning the prism in z-direction

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

    Distance between particles

    type(grw_real2darray_type), intent(inout) :: positions
  • public subroutine fill_prism_by_number(lx, ly, lz, Nx, Ny, Nz, positions)

    Arguments

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

    Vector spanning the prism in x-direction

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

    Vector spanning the prism in y-direction

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

    Vector spanning the prism in z-direction

    integer, intent(in) :: Nx

    Number of particles in x-direction

    integer, intent(in) :: Ny

    Number of particles in y-direction

    integer, intent(in) :: Nz

    Number of particles in z-direction

    type(grw_real2darray_type), intent(inout) :: positions

public interface init_particle_blob_prob

  • public subroutine init_particle_blob_prob_circle(blob, d, R, mu, sigma, Nchosen)

    Arguments

    Type IntentOptional Attributes Name
    type(mus_particle_blob_prob_type), intent(inout) :: blob
    real(kind=rk), intent(in) :: d

    Distance between particle positions. This should be chosen larger than one particle diameter to prevent overlap.

    real(kind=rk) :: R

    Radius within which all positions must be located

    real(kind=rk) :: mu(2)

    Mean value of the probability distributions in x and y directions (mu_x, mu_y)

    real(kind=rk) :: sigma(2)

    Standard deviation of the probability distributions in x and y directions (sig_x, sig_y)

    integer, intent(in) :: Nchosen

    Number of particles we plan to choose. This determines the size to which the chosen_positions array will be allocated

  • public subroutine init_particle_blob_prob_square(blob, d, xlim, ylim, mu, sigma, Nchosen)

    Arguments

    Type IntentOptional Attributes Name
    type(mus_particle_blob_prob_type), intent(inout) :: blob
    real(kind=rk), intent(in) :: d

    Distance between particle positions. This should be chosen larger than one particle diameter to prevent overlap.

    real(kind=rk) :: xlim(2)

    Range of x-positions particles can have [xmin, xmax]

    real(kind=rk) :: ylim(2)

    Range of y-positions particles can have [ymin, ymax]

    real(kind=rk) :: mu(2)

    Mean value of the probability distributions in x and y directions (mu_x, mu_y)

    real(kind=rk) :: sigma(2)

    Standard deviation of the probability distributions in x and y directions (sig_x, sig_y)

    integer, intent(in) :: Nchosen

    Number of particles we plan to choose. This determines the size to which the chosen_positions array will be allocated


Derived Types

type, public ::  mus_particle_blob_prob_type

Components

Type Visibility Attributes Name Initial
character(len=labelLen), public :: kind
integer, public :: seed
real(kind=rk), public :: mu(2)
real(kind=rk), public :: sigma(2)
type(grw_real2darray_type), public :: available_positions

Positions that can be picked at random. Stored in a 2D array as [ [x1, x2, ... xn], [y1, y2, ...yn] ] So the i-th position is given by [x,y] = available_positions%val(1:2,i)

type(grw_real2darray_type), public :: chosen_positions
type(grw_realarray_type), public :: probabilities
type(grw_realarray_type), public :: bins

type, public ::  mus_particle_blob_cylinder_type

Components

Type Visibility Attributes Name Initial
real(kind=rk), public :: origin(3)
real(kind=rk), public :: vec(3)
real(kind=rk), public :: radius
real(kind=rk), public :: particle_radius
real(kind=rk), public :: particle_mass
real(kind=rk), public :: particle_vel(6)
real(kind=rk), public :: particle_force(6)
logical, public :: init_particles_to_fluid_vel

If this is TRUE, particles will be initialized to the local fluid velocity instead of particle_vel

type(mus_particle_blob_prob_type), public :: distribution

Probability distribution to use to place particles inside the cylindrical blob

type, public ::  mus_particle_blob_prism_type

Components

Type Visibility Attributes Name Initial
real(kind=rk), public :: origin(3)
real(kind=rk), public :: vec_x(3)
real(kind=rk), public :: vec_y(3)
real(kind=rk), public :: vec_z(3)
integer, public :: nx
integer, public :: ny
integer, public :: nz
real(kind=rk), public :: particle_radius
real(kind=rk), public :: particle_mass
real(kind=rk), public :: particle_vel(6)
real(kind=rk), public :: particle_force(6)
logical, public :: init_particles_to_fluid_vel

If this is TRUE, particles will be initialized to the local fluid velocity instead of particle_vel

type(mus_particle_blob_prob_type), public :: distribution

Probability distribution to use to place particles inside the cylindrical blob


Functions

public function rodriguez_rotation(n1, n2, v) result(v_rot)

Arguments

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

Unit vector describing the orientation to rotate from

real(kind=rk), intent(in) :: n2(3)

Unit vector describing orientation to rotate to

real(kind=rk), intent(in) :: v(3)

Vector to rotate

Return Value real(kind=rk), (3)


Subroutines

public subroutine set_random_seed(s)

Arguments

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

public subroutine init_particle_blob_prob_circle(blob, d, R, mu, sigma, Nchosen)

Arguments

Type IntentOptional Attributes Name
type(mus_particle_blob_prob_type), intent(inout) :: blob
real(kind=rk), intent(in) :: d

Distance between particle positions. This should be chosen larger than one particle diameter to prevent overlap.

real(kind=rk) :: R

Radius within which all positions must be located

real(kind=rk) :: mu(2)

Mean value of the probability distributions in x and y directions (mu_x, mu_y)

real(kind=rk) :: sigma(2)

Standard deviation of the probability distributions in x and y directions (sig_x, sig_y)

integer, intent(in) :: Nchosen

Number of particles we plan to choose. This determines the size to which the chosen_positions array will be allocated

public subroutine init_particle_blob_prob_square(blob, d, xlim, ylim, mu, sigma, Nchosen)

Arguments

Type IntentOptional Attributes Name
type(mus_particle_blob_prob_type), intent(inout) :: blob
real(kind=rk), intent(in) :: d

Distance between particle positions. This should be chosen larger than one particle diameter to prevent overlap.

real(kind=rk) :: xlim(2)

Range of x-positions particles can have [xmin, xmax]

real(kind=rk) :: ylim(2)

Range of y-positions particles can have [ymin, ymax]

real(kind=rk) :: mu(2)

Mean value of the probability distributions in x and y directions (mu_x, mu_y)

real(kind=rk) :: sigma(2)

Standard deviation of the probability distributions in x and y directions (sig_x, sig_y)

integer, intent(in) :: Nchosen

Number of particles we plan to choose. This determines the size to which the chosen_positions array will be allocated

public subroutine fill_bins(blob)

Routine which fills the bins in mus_particle_blob_prob_type

Arguments

Type IntentOptional Attributes Name
type(mus_particle_blob_prob_type), intent(inout) :: blob

public subroutine normalize_probabilities(blob)

Arguments

Type IntentOptional Attributes Name
type(mus_particle_blob_prob_type), intent(inout) :: blob

public subroutine pick_random_position(blob)

Arguments

Type IntentOptional Attributes Name
type(mus_particle_blob_prob_type), intent(inout) :: blob

public subroutine map_to_bin(x, bins, N, ibin)

Arguments

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

Number to map to a bin

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

Array containing the boundaries of each bin Should be monotonic increasing i.e. bin(0) < bin(1) < ... bin(Nbins)

integer, intent(in) :: N

Number of elements in bins array

integer, intent(out) :: ibin

so that bins(ibin) < x <= bins(ibin+1)

Read more…

public subroutine swap_grw_real2darray(me, i, j, array_width)

Arguments

Type IntentOptional Attributes Name
type(grw_real2darray_type), intent(inout) :: me
integer, intent(in) :: i
integer, intent(in) :: j
integer, intent(in) :: array_width

public subroutine swap_grw_realarray(me, i, j)

Arguments

Type IntentOptional Attributes Name
type(grw_realarray_type), intent(inout) :: me
integer, intent(in) :: i
integer, intent(in) :: j

public subroutine remove_elem_grw_real2darray(me, i, array_width)

Arguments

Type IntentOptional Attributes Name
type(grw_real2darray_type), intent(inout) :: me
integer, intent(in) :: i
integer, intent(in) :: array_width

public subroutine remove_elem_grw_realarray(me, i)

Arguments

Type IntentOptional Attributes Name
type(grw_realarray_type), intent(inout) :: me
integer, intent(in) :: i

public subroutine fill_cylinder(R, L, d, positions)

Fill_cylinder fills the dynamic array positions with coordinates of particles spaced a distance d apart inside a cylinder with faces z = 0 and z = L and radius R. For cylinders of different position and orientation, these coordinates can be transformed.

Arguments

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

Radius of the cylinder

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

Length of the cylinder

real(kind=rk) :: d

Distance between particles

type(grw_real2darray_type), intent(inout) :: positions

public subroutine fill_prism_by_distance(lx, ly, lz, d, positions)

Arguments

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

Vector spanning the prism in x-direction

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

Vector spanning the prism in y-direction

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

Vector spanning the prism in z-direction

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

Distance between particles

type(grw_real2darray_type), intent(inout) :: positions

public subroutine fill_prism_by_number(lx, ly, lz, Nx, Ny, Nz, positions)

Arguments

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

Vector spanning the prism in x-direction

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

Vector spanning the prism in y-direction

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

Vector spanning the prism in z-direction

integer, intent(in) :: Nx

Number of particles in x-direction

integer, intent(in) :: Ny

Number of particles in y-direction

integer, intent(in) :: Nz

Number of particles in z-direction

type(grw_real2darray_type), intent(inout) :: positions

public subroutine rotate_positions(positions, n1, n2)

Arguments

Type IntentOptional Attributes Name
type(grw_real2darray_type), intent(inout) :: positions

Output: coordinates of the particles

real(kind=rk), intent(in) :: n1(3)

Unit vector describing the input cylinder axis

real(kind=rk), intent(in) :: n2(3)

Unit vector describing the output cylinder axis.

public subroutine translate_positions(positions, translation_vec)

Arguments

Type IntentOptional Attributes Name
type(grw_real2darray_type), intent(inout) :: positions

Output: coordinates of the particles

real(kind=rk), intent(in) :: translation_vec(3)

Vector with which to translate positions by

public subroutine print_positions(positions, logUnit)

Arguments

Type IntentOptional Attributes Name
type(grw_real2darray_type), intent(in) :: positions

Input: coordinates of the particles

integer, intent(in) :: logUnit

public subroutine print_particleblob(particleblob, logUnit)

Arguments

Type IntentOptional Attributes Name
type(mus_particle_blob_cylinder_type), intent(in) :: particleblob
integer, intent(in) :: logUnit

public subroutine print_particleblob_prism(particleblob, logUnit)

Arguments

Type IntentOptional Attributes Name
type(mus_particle_blob_prism_type), intent(in) :: particleblob
integer, intent(in) :: logUnit

public subroutine print_particleblob_prob(particleblob, logUnit)

Arguments

Type IntentOptional Attributes Name
type(mus_particle_blob_prob_type), intent(in) :: particleblob
integer, intent(in) :: logUnit