DP Langevin
Loading...
Searching...
No Matches
BaseLangevin Class Reference

Base class for Langevin equation integrator. More...

#include <langevin_base.hpp>

Inheritance diagram for BaseLangevin:
DPLangevin

Public Member Functions

 BaseLangevin ()=default
 Default constructor.
bool construct_grid (const Parameters parameters)
 Construct Langevin density field grid of appropriate n-D dimension.
bool construct_1D_grid (const Parameters parameters)
 Build 1d Langevin density field grid & topology.
bool construct_2D_grid (const Parameters parameters)
 Build 2d Langevin density field grid & mixed topology.
bool initialize_grid (const Parameters parameters, rng_t &rng)
 Initial condition for density field: uniformly random.
void prepare (const Coefficients &coefficients)
 Set initial condition of Langevin density field grid.
bool check_boundary_conditions (const Parameters parameters)
 Check we have 2N boundary conditions for an N-dimensional grid.
void apply_boundary_conditions (const Parameters parameters, int i_epoch)
 Set density field values only the grid edges per bc specs.
void integrate_rungekutta (rng_t &rng)
 Runge-Kutta + stochastic integration + grid update.
void integrate_euler (rng_t &rng)
 Explicit Euler + stochastic integration + grid update.
double get_density_grid_value (const int) const
 Return the Langevin density field grid value at a given "node".
double get_mean_density () const
 Expose mean density.
double get_poisson_mean () const
 Compute Poisson RNG mean.
virtual void set_nonlinear_coefficients (const Coefficients &coefficients)
 Method to set nonlinear coefficients for deterministic integration step: to be defined by application.
virtual double nonlinear_rhs (const int i_cell, const grid_t &field) const
 Method to set nonlinear RHS of Langevin equation for deterministic integration step: to be defined by application.

Protected Attributes

int n_cells
 Total number of cells in n-D grid.
grid_t density_grid
 Density field grid.
grid_wiring_t grid_wiring
 Neighorhood topology for all grid cells.
double dt
 Time step, i.e, epoch-to-epoch Δt.
double dx
 Grid spacing, i.e., spacing Δx between cell centers in all directions.
double mean_density
 Grid-average of density field.
poisson_dist_t poisson_sampler
 Function generating Poisson variates.
gamma_dist_t gamma_sampler
 Function generating gamma variates.
gaussian_dist_t gaussian_sampler
 Function generating normal variates.
double linear_coefficient
 Dornic method coefficient.
double noise_coefficient
 Dornic method coefficient.
double lambda
 Dornic method stochastic-step variable.
double lambda_on_explcdt
 Dornic method stochastic-step variable.
grid_t k1_grid
 Runge-Kutta variable grid #1.
grid_t k2_grid
 Runge-Kutta variable grid #2.
grid_t k3_grid
 Runge-Kutta variable grid #3.
grid_t aux_grid1
 Temporary density grid used to perform an integration step.
grid_t aux_grid2
 Temporary density grid used to perform an integration step.

Detailed Description

Base class for Langevin equation integrator.

Definition at line 15 of file langevin_base.hpp.

Member Function Documentation

◆ apply_boundary_conditions()

void BaseLangevin::apply_boundary_conditions ( const Parameters parameters,
int i_epoch )

Set density field values only the grid edges per bc specs.

Apply boundary conditions along each edge in turn.

Definition at line 26 of file langevin_bc.cpp.

◆ check_boundary_conditions()

bool BaseLangevin::check_boundary_conditions ( const Parameters parameters)

Check we have 2N boundary conditions for an N-dimensional grid.

Check that 2x bcs are specified for each grid dimension, one for each edge.

Definition at line 10 of file langevin_bc.cpp.

◆ construct_1D_grid()

bool BaseLangevin::construct_1D_grid ( const Parameters parameters)

Build 1d Langevin density field grid & topology.

Construct 1D density field ρ(x,t) grid and corresponding cell-cell topologies.

Definition at line 10 of file langevin_construct_grid1d.cpp.

◆ construct_2D_grid()

bool BaseLangevin::construct_2D_grid ( const Parameters p)

Build 2d Langevin density field grid & mixed topology.

Construct a connected 2D grid to be used for solving the evolution of a density field ρ(x,t).

Implements mixed grid edge topology: i.e., x and y grid edges can separately be specified as "bounded" or "periodic". The "bounded" edge topology simply means those exterior grid cells are only connected to their neighboring grid-interior cells. The "periodic" edge topology means the grid cells along one edge are also connected to those on the opposite edge. If both x and y edges are periodic, the grid topology is toroidal. If only one edge is periodic, the grid topology is cylindrical. If both are bounded, the grid topology is a bounded plane.

Parameters
BaseLangevinintegrator Parameters bundle.

Definition at line 26 of file langevin_construct_grid2d.cpp.

◆ construct_grid()

bool BaseLangevin::construct_grid ( const Parameters parameters)

Construct Langevin density field grid of appropriate n-D dimension.

Definition at line 9 of file langevin_construct_grid.cpp.

◆ get_density_grid_value()

double BaseLangevin::get_density_grid_value ( const int i) const

Return the Langevin density field grid value at a given "node".

Definition at line 10 of file langevin_utilities.cpp.

◆ get_mean_density()

double BaseLangevin::get_mean_density ( ) const

Expose mean density.

Return the grid-averaged Langevin field mean value.

Definition at line 16 of file langevin_utilities.cpp.

◆ get_poisson_mean()

double BaseLangevin::get_poisson_mean ( ) const

Compute Poisson RNG mean.

Compute the mean field density times "lamba_product", which should be equal to the Poisson distribution mean

Definition at line 23 of file langevin_utilities.cpp.

◆ initialize_grid()

bool BaseLangevin::initialize_grid ( const Parameters parameters,
rng_t & rng )

Initial condition for density field: uniformly random.

Definition at line 9 of file langevin_ic.cpp.

◆ integrate_euler()

void BaseLangevin::integrate_euler ( rng_t & rng)

Explicit Euler + stochastic integration + grid update.

Perform explicit-Euler then stochastic integration steps, then update grid.

Definition at line 10 of file langevin_integrate_euler.cpp.

◆ integrate_rungekutta()

void BaseLangevin::integrate_rungekutta ( rng_t & rng)

Runge-Kutta + stochastic integration + grid update.

Runge-Kutta integration of the nonlinear and diffusion terms in the Langevin equation. Update of cells is done in the same loop as last Runge-Kutta step for efficiency.

Definition at line 13 of file langevin_integrate_rungekutta.cpp.

◆ nonlinear_rhs()

virtual double BaseLangevin::nonlinear_rhs ( const int i_cell,
const grid_t & field ) const
inlinevirtual

Method to set nonlinear RHS of Langevin equation for deterministic integration step: to be defined by application.

Reimplemented in DPLangevin.

Definition at line 89 of file langevin_base.hpp.

◆ prepare()

void BaseLangevin::prepare ( const Coefficients & coefficients)

Set initial condition of Langevin density field grid.

Set the Langevin equation coefficients and "lambda" coefficients.

Definition at line 11 of file langevin_prepare.cpp.

◆ set_nonlinear_coefficients()

virtual void BaseLangevin::set_nonlinear_coefficients ( const Coefficients & coefficients)
inlinevirtual

Method to set nonlinear coefficients for deterministic integration step: to be defined by application.

Reimplemented in DPLangevin.

Definition at line 87 of file langevin_base.hpp.

Member Data Documentation

◆ aux_grid1

grid_t BaseLangevin::aux_grid1
protected

Temporary density grid used to perform an integration step.

Definition at line 55 of file langevin_base.hpp.

◆ aux_grid2

grid_t BaseLangevin::aux_grid2
protected

Temporary density grid used to perform an integration step.

Definition at line 57 of file langevin_base.hpp.

◆ density_grid

grid_t BaseLangevin::density_grid
protected

Density field grid.

Definition at line 21 of file langevin_base.hpp.

◆ dt

double BaseLangevin::dt
protected

Time step, i.e, epoch-to-epoch Δt.

Definition at line 26 of file langevin_base.hpp.

◆ dx

double BaseLangevin::dx
protected

Grid spacing, i.e., spacing Δx between cell centers in all directions.

Definition at line 28 of file langevin_base.hpp.

◆ gamma_sampler

gamma_dist_t BaseLangevin::gamma_sampler
protected

Function generating gamma variates.

Definition at line 35 of file langevin_base.hpp.

◆ gaussian_sampler

gaussian_dist_t BaseLangevin::gaussian_sampler
protected

Function generating normal variates.

Definition at line 37 of file langevin_base.hpp.

◆ grid_wiring

grid_wiring_t BaseLangevin::grid_wiring
protected

Neighorhood topology for all grid cells.

Definition at line 23 of file langevin_base.hpp.

◆ k1_grid

grid_t BaseLangevin::k1_grid
protected

Runge-Kutta variable grid #1.

Definition at line 49 of file langevin_base.hpp.

◆ k2_grid

grid_t BaseLangevin::k2_grid
protected

Runge-Kutta variable grid #2.

Definition at line 51 of file langevin_base.hpp.

◆ k3_grid

grid_t BaseLangevin::k3_grid
protected

Runge-Kutta variable grid #3.

Definition at line 53 of file langevin_base.hpp.

◆ lambda

double BaseLangevin::lambda
protected

Dornic method stochastic-step variable.

Definition at line 44 of file langevin_base.hpp.

◆ lambda_on_explcdt

double BaseLangevin::lambda_on_explcdt
protected

Dornic method stochastic-step variable.

Definition at line 46 of file langevin_base.hpp.

◆ linear_coefficient

double BaseLangevin::linear_coefficient
protected

Dornic method coefficient.

Definition at line 40 of file langevin_base.hpp.

◆ mean_density

double BaseLangevin::mean_density
protected

Grid-average of density field.

Definition at line 30 of file langevin_base.hpp.

◆ n_cells

int BaseLangevin::n_cells
protected

Total number of cells in n-D grid.

Definition at line 19 of file langevin_base.hpp.

◆ noise_coefficient

double BaseLangevin::noise_coefficient
protected

Dornic method coefficient.

Definition at line 42 of file langevin_base.hpp.

◆ poisson_sampler

poisson_dist_t BaseLangevin::poisson_sampler
protected

Function generating Poisson variates.

Definition at line 33 of file langevin_base.hpp.


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