GSI_Toolbox 1.0.0 A toolbox for Gas-Surface Interaction simulations

Loading...
Searching...
No Matches
Public Member Functions | List of all members
PG_Kernel< T > Class Template Reference

Represents a class for the proposed rough surface kernel applied to Poly-Gaussian surfaces. More...

`#include <PG_Kernel.h>`

## Public Member Functions
| PG_Kernel ()
| Default constructor for PG_Kernel.
| PG_Kernel (Surface< T > surface, Gas< T > gas, void(*local_kernel)(T *, T *, T *, T *, T *), Matrix< T > incident_velocity, unsigned long num_particles, std::string sim_name)
| Constructor for PG_Kernel.
| ~PG_Kernel ()
| Destructor for PG_Kernel.
Gas< T > & | get_gas ()
| Get the Gas object.
Surface< T > & | get_surface ()
| Get the Surface object.
T | random_sampler_1D (T(PG_Kernel::*pdf)(T, std::vector< T >), std::vector< T > parameters, T x0, T size, T domain_x[])
| Perform random sampling in 1D using the Metropolis-Hastings algorithm.
std::tuple< T, T > | random_sampler_2D (T(PG_Kernel::*pdf)(T, T, std::vector< T >), std::vector< T > parameters, T x0, T y0, T size_x, T size_y, T domain_x[], T domain_y[])
| Perform random sampling in 2D using the Metropolis-Hastings algorithm.
std::tuple< T, T > | random_sampler_angles (T(PG_Kernel::*pdf)(T, T, std::vector< T >), std::vector< T > parameters, T x0, T y0, T size_x, T size_y, T domain_x[], T domain_y[])
| Perform random sampling of angles in 2D using the Metropolis-Hastings algorithm.
T | mixture_pdf (T gamma, T gamma_dot, std::vector< T > parameters)
| Calculate the PDF of the control process gamma and its derivative gamma_dot, for Poly-Gaussian surfaces.
T | kirchhoff_pdf (T theta_r1, T theta_r2, std::vector< T > parameters)
| Calculate the reflected particle angular PDF according to the Kirchhoff model.
T | shadow (T theta_r1, T height, int direction)
| Calculate the probability of a reflected particle to escape the surface.
T | occlusion (T theta_r1, T height, T distance, int direction)
| Calculate the probability of a reflected particle to escape the surface, given a certain travelled horizontal distance.
T | height_0_pdf (T height_0, std::vector< T > parameters)
| Calculate the PDF for the height_0 parameter.
T | distance_pdf (T distance, std::vector< T > parameters)
| Calculate the PDF for the distance parameter.
Matrix< T > | global_to_local (Matrix< T > global_vector, T theta_i, T theta_r1, T theta_r2)
| Convert global coordinates to local coordinates.
Matrix< T > | local_to_global (Matrix< T > local_vector, T theta_i, T theta_r1, T theta_r2)
| Convert local coordinates to global coordinates.
Matrix< T > | angles_to_slopes (T theta_i, T theta_r1, T theta_r2)
| Convert angles to slopes.
trajectory< T > | sample_particle ()
| Sample a single particle trajectory.
std::vector< trajectory< T > > | sample_batch ()
| Sample a batch of particle trajectories.
void | save (std::vector< trajectory< T > > trajectories, std::string filename)
| Save the trajectories to a file.
void | combine_files (std::string filename, int num_procs)
| Combine multiple trajectory files into one.
void | set_num_particles (unsigned long num_particles)
| Set the number of particles.
std::vector< trajectory< T > > | import_data (std::string filename)
| Import trajectory data from a file.
std::string & | get_sim_name ()
| Get the simulation name.
unsigned long | get_num_particles ()
| Get the number of particles.

## Detailed Description

template<typename T>
class PG_Kernel< T >

Represents a class for the proposed rough surface kernel applied to Poly-Gaussian surfaces.

This class implements the rough GSI kernel algorithm for trajectory sampling. It returns the trajectories of free-molecular-flow gas particles on a rough surface.

Template Parameters

  T | The type of the elements in the PG_Kernel.

## Constructor & Destructor Documentation

## ◆ PG_Kernel() [1/2]

template<typename T >

PG_Kernel< T >::PG_Kernel | ( |  | ) |
| inline

Default constructor for PG_Kernel.

Initializes the PG_Kernel object with default values.

## ◆ PG_Kernel() [2/2]

template<typename T >

PG_Kernel< T >::PG_Kernel | ( | Surface< T > | surface,
|  | Gas< T > | gas,
|  | void(* | local_kernel )(T *, T *, T *, T *, T *),
|  | Matrix< T > | incident_velocity,
|  | unsigned long | num_particles,
|  | std::string | sim_name )
| inline

Constructor for PG_Kernel.

Initializes the PG_Kernel object with the given parameters.

Parameters

  surface | The Surface object representing the surface properties.
  gas | The Gas object representing the gas properties.
  local_kernel | Pointer to the local kernel function.
  incident_velocity | Matrix of incident velocities.
  num_particles | Number of particles.
  sim_name | Name of the simulation.

## ◆ ~PG_Kernel()

template<typename T >

PG_Kernel< T >::~PG_Kernel | ( |  | ) |
| inline

Destructor for PG_Kernel.

Cleans up the PG_Kernel object.

## Member Function Documentation

## ◆ angles_to_slopes()

template<typename T >

Matrix< T > PG_Kernel< T >::angles_to_slopes | ( | T | theta_i,
|  | T | theta_r1,
|  | T | theta_r2 )

Convert angles to slopes.

Parameters

  theta_i | The theta_i value.
  theta_r1 | The theta_r1 value.
  theta_r2 | The theta_r2 value.

Returns
  Matrix<T> The slopes.

## ◆ combine_files()

template<typename T >

void PG_Kernel< T >::combine_files | ( | std::string | filename,
|  | int | num_procs )

Combine multiple trajectory files into one.

Parameters

  filename | The name of the file.
  num_procs | The number of processes.

## ◆ distance_pdf()

template<typename T >

T PG_Kernel< T >::distance_pdf | ( | T | distance,
|  | std::vector< T > | parameters )

Calculate the PDF for the distance parameter.

Parameters

  distance | The distance value.
  parameters | Vector of parameters for the PDF function.

Returns
  T The PDF value.

## ◆ get_gas()

template<typename T >

Gas< T > & PG_Kernel< T >::get_gas | ( |  | ) |
| inline

Get the Gas object.

Returns
  Gas<T>& The Gas object.

## ◆ get_num_particles()

template<typename T >

unsigned long PG_Kernel< T >::get_num_particles | ( |  | ) |
| inline

Get the number of particles.

Returns
  unsigned long The number of particles.

## ◆ get_sim_name()

template<typename T >

std::string & PG_Kernel< T >::get_sim_name | ( |  | ) |
| inline

Get the simulation name.

Returns
  std::string& The simulation name.

## ◆ get_surface()

template<typename T >

Surface< T > & PG_Kernel< T >::get_surface | ( |  | ) |
| inline

Get the Surface object.

Returns
  Surface<T>& The Surface object.

## ◆ global_to_local()

template<typename T >

Matrix< T > PG_Kernel< T >::global_to_local | ( | Matrix< T > | global_vector,
|  | T | theta_i,
|  | T | theta_r1,
|  | T | theta_r2 )

Convert global coordinates to local coordinates.

Parameters

  global_vector | The global vector.
  theta_i | The theta_i value.
  theta_r1 | The theta_r1 value.
  theta_r2 | The theta_r2 value.

Returns
  Matrix<T> The local vector.

## ◆ height_0_pdf()

template<typename T >

T PG_Kernel< T >::height_0_pdf | ( | T | height_0,
|  | std::vector< T > | parameters )

Calculate the PDF for the height_0 parameter.

Parameters

  height_0 | The height_0 value.
  parameters | Vector of parameters for the PDF function.

Returns
  T The PDF value.

## ◆ import_data()

template<typename T >

std::vector< trajectory< T > > PG_Kernel< T >::import_data | ( | std::string | filename | ) |

Import trajectory data from a file.

Parameters

  filename | The name of the file.

Returns
  std::vector<trajectory<T>> The imported trajectories.

## ◆ kirchhoff_pdf()

template<typename T >

T PG_Kernel< T >::kirchhoff_pdf | ( | T | theta_r1,
|  | T | theta_r2,
|  | std::vector< T > | parameters )

Calculate the reflected particle angular PDF according to the Kirchhoff model.

Parameters

  theta_r1 | The theta_r1 angle value.
  theta_r2 | The theta_r2 angle value.
  parameters | Auxiliary parameters required: incidence angle and control process values.

Returns
  T The PDF value.

## ◆ local_to_global()

template<typename T >

Matrix< T > PG_Kernel< T >::local_to_global | ( | Matrix< T > | local_vector,
|  | T | theta_i,
|  | T | theta_r1,
|  | T | theta_r2 )

Convert local coordinates to global coordinates.

Parameters

  local_vector | The local vector.
  theta_i | The theta_i value.
  theta_r1 | The theta_r1 value.
  theta_r2 | The theta_r2 value.

Returns
  Matrix<T> The global vector.

## ◆ mixture_pdf()

template<typename T >

T PG_Kernel< T >::mixture_pdf | ( | T | gamma,
|  | T | gamma_dot,
|  | std::vector< T > | parameters )

Calculate the PDF of the control process gamma and its derivative gamma_dot, for Poly-Gaussian surfaces.

Parameters

  gamma | The gamma value.
  gamma_dot | The gamma_dot value.
  parameters | Vector of parameters for the PDF function.

Returns
  T The PDF value.

## ◆ occlusion()

template<typename T >

T PG_Kernel< T >::occlusion | ( | T | theta_r1,
|  | T | height,
|  | T | distance,
|  | int | direction )

Calculate the probability of a reflected particle to escape the surface, given a certain travelled horizontal distance.

Parameters

  theta_r1 | The theta_r1 angle.
  height | The non-dimensional height of the particle.
  distance | The horizontal distance value.
  direction | The direction of the particle trajectory.

Returns
  T The value of the probability.

## ◆ random_sampler_1D()

template<typename T >

T PG_Kernel< T >::random_sampler_1D | ( | T(PG_Kernel< T >::* | pdf )(T, std::vector< T >),
|  | std::vector< T > | parameters,
|  | T | x0,
|  | T | size,
|  | T | domain_x[] )

Perform random sampling in 1D using the Metropolis-Hastings algorithm.

Parameters

  pdf | Pointer to the PDF function.
  parameters | Vector of parameters for the PDF function.
  x0 | Initial position.
  size | Size of the sampling range.
  domain_x | Array of domain limits.

Returns
  T The sampled value.

## ◆ random_sampler_2D()

template<typename T >

std::tuple< T, T > PG_Kernel< T >::random_sampler_2D | ( | T(PG_Kernel< T >::* | pdf )(T, T, std::vector< T >),
|  | std::vector< T > | parameters,
|  | T | x0,
|  | T | y0,
|  | T | size_x,
|  | T | size_y,
|  | T | domain_x[],
|  | T | domain_y[] )

Perform random sampling in 2D using the Metropolis-Hastings algorithm.

Parameters

  pdf | Pointer to the PDF function.
  parameters | Vector of parameters for the PDF function.
  x0 | Initial x position.
  y0 | Initial y position.
  size_x | Size of the x sampling range.
  size_y | Size of the y sampling range.
  domain_x | Array of x domain limits.
  domain_y | Array of y domain limits.

Returns
  std::tuple<T, T> The sampled x and y values.

## ◆ random_sampler_angles()

template<typename T >

std::tuple< T, T > PG_Kernel< T >::random_sampler_angles | ( | T(PG_Kernel< T >::* | pdf )(T, T, std::vector< T >),
|  | std::vector< T > | parameters,
|  | T | x0,
|  | T | y0,
|  | T | size_x,
|  | T | size_y,
|  | T | domain_x[],
|  | T | domain_y[] )

Perform random sampling of angles in 2D using the Metropolis-Hastings algorithm.

Parameters

  pdf | Pointer to the PDF function.
  parameters | Vector of parameters for the PDF function.
  x0 | Initial x position.
  y0 | Initial y position.
  size_x | Size of the x sampling range.
  size_y | Size of the y sampling range.
  domain_x | Array of x domain limits.
  domain_y | Array of y domain limits.

Returns
  std::tuple<T, T> The sampled theta_r1 and theta_r2 values.

## ◆ sample_batch()

template<typename T >

std::vector< trajectory< T > > PG_Kernel< T >::sample_batch | ( |  | ) |

Sample a batch of particle trajectories.

Returns
  std::vector<trajectory<T>> The sampled trajectories.

## ◆ sample_particle()

template<typename T >

trajectory< T > PG_Kernel< T >::sample_particle | ( |  | ) |

Sample a single particle trajectory.

Returns
  trajectory<T> The sampled trajectory.

## ◆ save()

template<typename T >

void PG_Kernel< T >::save | ( | std::vector< trajectory< T > > | trajectories,
|  | std::string | filename )

Save the trajectories to a file.

Parameters

  trajectories | The trajectories to save.
  filename | The name of the file.

## ◆ set_num_particles()

template<typename T >

void PG_Kernel< T >::set_num_particles | ( | unsigned long | num_particles | ) |
| inline

Set the number of particles.

Parameters

  num_particles | The number of particles.

## ◆ shadow()

template<typename T >

T PG_Kernel< T >::shadow | ( | T | theta_r1,
|  | T | height,
|  | int | direction )

Calculate the probability of a reflected particle to escape the surface.

Parameters

  theta_r1 | The theta_r1 angle.
  height | The non-dimensional height of the particle.
  direction | The direction of the particle trajectory.

Returns
  T The value of the probability.

The documentation for this class was generated from the following file:

- src/PG_Kernel.h