GSI_Toolbox 1.0.0
A toolbox for Gas-Surface Interaction simulations
Loading...
Searching...
No Matches
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.
 
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.
 
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.
 
kirchhoff_pdf (T theta_r1, T theta_r2, std::vector< T > parameters)
 Calculate the reflected particle angular PDF according to the Kirchhoff model.
 
shadow (T theta_r1, T height, int direction)
 Calculate the probability of a reflected particle to escape the surface.
 
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.
 
height_0_pdf (T height_0, std::vector< T > parameters)
 Calculate the PDF for the height_0 parameter.
 
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
TThe 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
surfaceThe Surface object representing the surface properties.
gasThe Gas object representing the gas properties.
local_kernelPointer to the local kernel function.
incident_velocityMatrix of incident velocities.
num_particlesNumber of particles.
sim_nameName 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_iThe theta_i value.
theta_r1The theta_r1 value.
theta_r2The 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
filenameThe name of the file.
num_procsThe 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
distanceThe distance value.
parametersVector 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_vectorThe global vector.
theta_iThe theta_i value.
theta_r1The theta_r1 value.
theta_r2The 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_0The height_0 value.
parametersVector 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
filenameThe 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_r1The theta_r1 angle value.
theta_r2The theta_r2 angle value.
parametersAuxiliary 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_vectorThe local vector.
theta_iThe theta_i value.
theta_r1The theta_r1 value.
theta_r2The 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
gammaThe gamma value.
gamma_dotThe gamma_dot value.
parametersVector 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_r1The theta_r1 angle.
heightThe non-dimensional height of the particle.
distanceThe horizontal distance value.
directionThe 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
pdfPointer to the PDF function.
parametersVector of parameters for the PDF function.
x0Initial position.
sizeSize of the sampling range.
domain_xArray 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
pdfPointer to the PDF function.
parametersVector of parameters for the PDF function.
x0Initial x position.
y0Initial y position.
size_xSize of the x sampling range.
size_ySize of the y sampling range.
domain_xArray of x domain limits.
domain_yArray 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
pdfPointer to the PDF function.
parametersVector of parameters for the PDF function.
x0Initial x position.
y0Initial y position.
size_xSize of the x sampling range.
size_ySize of the y sampling range.
domain_xArray of x domain limits.
domain_yArray 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
trajectoriesThe trajectories to save.
filenameThe 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_particlesThe 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_r1The theta_r1 angle.
heightThe non-dimensional height of the particle.
directionThe direction of the particle trajectory.
Returns
T The value of the probability.

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