DP Langevin
|
Base class for Langevin equation integrator. More...
#include <langevin_base.hpp>
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. |
Base class for Langevin equation integrator.
Definition at line 15 of file langevin_base.hpp.
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.
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.
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.
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.
BaseLangevin | integrator Parameters bundle. |
Definition at line 26 of file langevin_construct_grid2d.cpp.
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.
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.
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.
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.
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.
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.
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.
|
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.
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.
|
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.
|
protected |
Temporary density grid used to perform an integration step.
Definition at line 55 of file langevin_base.hpp.
|
protected |
Temporary density grid used to perform an integration step.
Definition at line 57 of file langevin_base.hpp.
|
protected |
Density field grid.
Definition at line 21 of file langevin_base.hpp.
|
protected |
Time step, i.e, epoch-to-epoch Δt.
Definition at line 26 of file langevin_base.hpp.
|
protected |
Grid spacing, i.e., spacing Δx between cell centers in all directions.
Definition at line 28 of file langevin_base.hpp.
|
protected |
Function generating gamma variates.
Definition at line 35 of file langevin_base.hpp.
|
protected |
Function generating normal variates.
Definition at line 37 of file langevin_base.hpp.
|
protected |
Neighorhood topology for all grid cells.
Definition at line 23 of file langevin_base.hpp.
|
protected |
Runge-Kutta variable grid #1.
Definition at line 49 of file langevin_base.hpp.
|
protected |
Runge-Kutta variable grid #2.
Definition at line 51 of file langevin_base.hpp.
|
protected |
Runge-Kutta variable grid #3.
Definition at line 53 of file langevin_base.hpp.
|
protected |
Dornic method stochastic-step variable.
Definition at line 44 of file langevin_base.hpp.
|
protected |
Dornic method stochastic-step variable.
Definition at line 46 of file langevin_base.hpp.
|
protected |
Dornic method coefficient.
Definition at line 40 of file langevin_base.hpp.
|
protected |
Grid-average of density field.
Definition at line 30 of file langevin_base.hpp.
|
protected |
Total number of cells in n-D grid.
Definition at line 19 of file langevin_base.hpp.
|
protected |
Dornic method coefficient.
Definition at line 42 of file langevin_base.hpp.
|
protected |
Function generating Poisson variates.
Definition at line 33 of file langevin_base.hpp.