PartMC  2.6.1
Data Types | Functions/Subroutines | Variables
pmc_bin_grid Module Reference

The bin_grid_t structure and associated subroutines. More...

Data Types

type  bin_grid_t
 1D grid, either logarithmic or linear. More...
 

Functions/Subroutines

elemental integer function bin_grid_size (bin_grid)
 Return the number of bins in the grid, or -1 if the bin grid is not allocated. More...
 
subroutine vol_to_lnr (r, f_vol, f_lnr)
 Convert a concentration f(vol)d(vol) to f(ln(r))d(ln(r)) where vol = 4/3 pi r^3. More...
 
subroutine bin_grid_make (bin_grid, type, n_bin, min, max)
 Generates the bin grid given the range and number of bins. More...
 
integer function bin_grid_find (bin_grid, val)
 Find the bin number that contains a given value. More...
 
real(kind=dp) function, dimension(bin_grid_size(x_bin_grid)) bin_grid_histogram_1d (x_bin_grid, x_data, weight_data)
 Make a histogram with of the given weighted data, scaled by the bin sizes. More...
 
real(kind=dp) function, dimension(bin_grid_size(x_bin_grid), bin_grid_size(y_bin_grid)) bin_grid_histogram_2d (x_bin_grid, x_data, y_bin_grid, y_data, weight_data)
 Make a 2D histogram with of the given weighted data, scaled by the bin sizes. More...
 
integer function pmc_mpi_pack_size_bin_grid (val)
 Determines the number of bytes required to pack the given value. More...
 
subroutine pmc_mpi_pack_bin_grid (buffer, position, val)
 Packs the given value into the buffer, advancing position. More...
 
subroutine pmc_mpi_unpack_bin_grid (buffer, position, val)
 Unpacks the given value from the buffer, advancing position. More...
 
logical function pmc_mpi_allequal_bin_grid (val)
 Check whether all processors have the same value. More...
 
subroutine bin_grid_netcdf_dim (bin_grid, ncid, dim_name, unit, dimid, long_name, scale)
 Write a bin grid dimension to the given NetCDF file if it is not already present and in any case return the associated dimid. More...
 
subroutine bin_grid_output_netcdf (bin_grid, ncid, dim_name, unit, long_name, scale)
 Write a bin grid to the given NetCDF file. More...
 
subroutine bin_grid_input_netcdf (bin_grid, ncid, dim_name, scale)
 Read full state. More...
 

Variables

integer, parameter bin_grid_type_invalid = 0
 Invalid type of bin grid. More...
 
integer, parameter bin_grid_type_log = 1
 Logarithmically spaced bin grid. More...
 
integer, parameter bin_grid_type_linear = 2
 Linearly spaced bin grid. More...
 

Detailed Description

The bin_grid_t structure and associated subroutines.

Function/Subroutine Documentation

◆ bin_grid_find()

integer function pmc_bin_grid::bin_grid_find ( type(bin_grid_t), intent(in)  bin_grid,
real(kind=dp), intent(in)  val 
)

Find the bin number that contains a given value.

If a particle is below the smallest bin then its bin number is 0. If a particle is above the largest bin then its bin number is bin_grid_size(bin_grid) + 1.

Parameters
[in]bin_gridBin_grid.
[in]valValue to locate bin for.

Definition at line 143 of file bin_grid.F90.

◆ bin_grid_histogram_1d()

real(kind=dp) function, dimension(bin_grid_size(x_bin_grid)) pmc_bin_grid::bin_grid_histogram_1d ( type(bin_grid_t), intent(in)  x_bin_grid,
real(kind=dp), dimension(:), intent(in)  x_data,
real(kind=dp), dimension(size(x_data)), intent(in)  weight_data 
)

Make a histogram with of the given weighted data, scaled by the bin sizes.

Parameters
[in]x_bin_gridx-axis bin grid.
[in]x_dataData values on the x-axis.
[in]weight_dataData value weights.
Returns
Return histogram.

Definition at line 173 of file bin_grid.F90.

◆ bin_grid_histogram_2d()

real(kind=dp) function, dimension(bin_grid_size(x_bin_grid), bin_grid_size(y_bin_grid)) pmc_bin_grid::bin_grid_histogram_2d ( type(bin_grid_t), intent(in)  x_bin_grid,
real(kind=dp), dimension(:), intent(in)  x_data,
type(bin_grid_t), intent(in)  y_bin_grid,
real(kind=dp), dimension(size(x_data)), intent(in)  y_data,
real(kind=dp), dimension(size(x_data)), intent(in)  weight_data 
)

Make a 2D histogram with of the given weighted data, scaled by the bin sizes.

Parameters
[in]x_bin_gridx-axis bin grid.
[in]x_dataData values on the x-axis.
[in]y_bin_gridy-axis bin grid.
[in]y_dataData values on the y-axis.
[in]weight_dataData value weights.
Returns
Return histogram.

Definition at line 202 of file bin_grid.F90.

◆ bin_grid_input_netcdf()

subroutine pmc_bin_grid::bin_grid_input_netcdf ( type(bin_grid_t), intent(inout)  bin_grid,
integer, intent(in)  ncid,
character(len=*), intent(in)  dim_name,
real(kind=dp), intent(in), optional  scale 
)

Read full state.

Parameters
[in,out]bin_gridbin_grid to read.
[in]ncidNetCDF file ID, in data mode.
[in]dim_nameDimension name.
[in]scaleFactor to scale grid by after input.

Definition at line 523 of file bin_grid.F90.

◆ bin_grid_make()

subroutine pmc_bin_grid::bin_grid_make ( type(bin_grid_t), intent(inout)  bin_grid,
integer, intent(in)  type,
integer, intent(in)  n_bin,
real(kind=dp), intent(in)  min,
real(kind=dp), intent(in)  max 
)

Generates the bin grid given the range and number of bins.

Parameters
[in,out]bin_gridNew bin grid.
[in]typeType of bin grid.
[in]n_binNumber of bins.
[in]minMinimum edge value.
[in]maxMinimum edge value.

Definition at line 83 of file bin_grid.F90.

◆ bin_grid_netcdf_dim()

subroutine pmc_bin_grid::bin_grid_netcdf_dim ( type(bin_grid_t), intent(in)  bin_grid,
integer, intent(in)  ncid,
character(len=*), intent(in)  dim_name,
character(len=*), intent(in)  unit,
integer, intent(out)  dimid,
character(len=*), intent(in), optional  long_name,
real(kind=dp), intent(in), optional  scale 
)

Write a bin grid dimension to the given NetCDF file if it is not already present and in any case return the associated dimid.

Parameters
[in]bin_gridBin_grid structure.
[in]ncidNetCDF file ID, in data mode.
[in]dim_nameDimension name.
[in]unitUnits for the grid.
[out]dimidDimid of the grid dimension.
[in]long_nameLong dimension name to use.
[in]scaleFactor to scale grid by before output.

Definition at line 386 of file bin_grid.F90.

◆ bin_grid_output_netcdf()

subroutine pmc_bin_grid::bin_grid_output_netcdf ( type(bin_grid_t), intent(in)  bin_grid,
integer, intent(in)  ncid,
character(len=*), intent(in)  dim_name,
character(len=*), intent(in)  unit,
character(len=*), intent(in), optional  long_name,
real(kind=dp), intent(in), optional  scale 
)

Write a bin grid to the given NetCDF file.

Parameters
[in]bin_gridBin_grid structure.
[in]ncidNetCDF file ID, in data mode.
[in]dim_nameDimension name.
[in]unitUnits for the grid.
[in]long_nameLong dimension name to use.
[in]scaleFactor to scale grid by before output.

Definition at line 497 of file bin_grid.F90.

◆ bin_grid_size()

elemental integer function pmc_bin_grid::bin_grid_size ( type(bin_grid_t), intent(in)  bin_grid)

Return the number of bins in the grid, or -1 if the bin grid is not allocated.

Parameters
[in]bin_gridBin grid structure.

Definition at line 50 of file bin_grid.F90.

◆ pmc_mpi_allequal_bin_grid()

logical function pmc_bin_grid::pmc_mpi_allequal_bin_grid ( type(bin_grid_t), intent(inout)  val)

Check whether all processors have the same value.

Parameters
[in,out]valValue to compare.

Definition at line 349 of file bin_grid.F90.

◆ pmc_mpi_pack_bin_grid()

subroutine pmc_bin_grid::pmc_mpi_pack_bin_grid ( character, dimension(:), intent(inout)  buffer,
integer, intent(inout)  position,
type(bin_grid_t), intent(in)  val 
)

Packs the given value into the buffer, advancing position.

Parameters
[in,out]bufferMemory buffer.
[in,out]positionCurrent buffer position.
[in]valValue to pack.

Definition at line 297 of file bin_grid.F90.

◆ pmc_mpi_pack_size_bin_grid()

integer function pmc_bin_grid::pmc_mpi_pack_size_bin_grid ( type(bin_grid_t), intent(in)  val)

Determines the number of bytes required to pack the given value.

Parameters
[in]valValue to pack.

Definition at line 281 of file bin_grid.F90.

◆ pmc_mpi_unpack_bin_grid()

subroutine pmc_bin_grid::pmc_mpi_unpack_bin_grid ( character, dimension(:), intent(inout)  buffer,
integer, intent(inout)  position,
type(bin_grid_t), intent(inout)  val 
)

Unpacks the given value from the buffer, advancing position.

Parameters
[in,out]bufferMemory buffer.
[in,out]positionCurrent buffer position.
[in,out]valValue to pack.

Definition at line 323 of file bin_grid.F90.

◆ vol_to_lnr()

subroutine pmc_bin_grid::vol_to_lnr ( real(kind=dp), intent(in)  r,
real(kind=dp), intent(in)  f_vol,
real(kind=dp), intent(out)  f_lnr 
)

Convert a concentration f(vol)d(vol) to f(ln(r))d(ln(r)) where vol = 4/3 pi r^3.

Parameters
[in]rRadius (m).
[in]f_volConcentration as a function of volume.
[out]f_lnrConcentration as a function of ln(r).

Definition at line 67 of file bin_grid.F90.

Variable Documentation

◆ bin_grid_type_invalid

integer, parameter pmc_bin_grid::bin_grid_type_invalid = 0

Invalid type of bin grid.

Definition at line 21 of file bin_grid.F90.

◆ bin_grid_type_linear

integer, parameter pmc_bin_grid::bin_grid_type_linear = 2

Linearly spaced bin grid.

Definition at line 25 of file bin_grid.F90.

◆ bin_grid_type_log

integer, parameter pmc_bin_grid::bin_grid_type_log = 1

Logarithmically spaced bin grid.

Definition at line 23 of file bin_grid.F90.