Brownian walker

The Brownian walker model runs a single microscropic drift-diffusion using the ItoSolver, where the underlying transport kernel is

\[d\mathbf{X} = \mathbf{V}dt + \sqrt{2Ddt}\mathbf{W}\]

where \(\mathbf{X}\) is the spatial position of a particle \(\mathbf{V}\) is the drift velocity and \(D\) is the diffusion coefficient in the continuum limit.

Tip

Source code is located in $DISCHARGE_HOME/Physics/BrownianWalker.

The model consists of the following implementation files:

  • CD_BrownianWalkerStepper.H/cpp which implements TimeStepper.

  • CD_BrownianWalkerSpecies.H/cpp which implements initial conditions through ItoSpecies.

Initial data

The initial data is randomly generated by sampling from an exponential distribution with specified radius and center. The user can specify the number of particles, and control this sampling through the respective input options, see Solver configuration.

Transport specification

The default velocity field for this class is

\[\begin{split}v_x &= -r\omega\sin\theta, \\ v_y &= r\omega\cos\theta, \\ v_z &= 0,\end{split}\]

where \(r = \sqrt{x^2 + y^2}\), \(\tan\theta = \frac{x}{y}\). I.e. the flow field is a circulation around the Cartesian grid origin. The diffusion coefficient is simply set to a constant value.

To adjust the velocity field or diffusion coefficients, adjust the configuration options given in Solver configuration.

Time stepping

Time stepping in this module is performed using a simple Euler-Maruyama scheme, i.e.,

\[\mathbf{X}^{k+1} = \mathbf{X}^{k} + \mathbf{V}\Delta t + \sqrt{2D\Delta t}\mathbf{W}\]

It is possible to adjust the time step size by setting the appropriate option (BrownianWalker.cfl). The time step is then limited by a particle-like CFL time step condition on the advective part (i.e., on \(\mathbf{V}\)).

Superparticle handling

Superparticle handling in this module occurs via ItoSolver, so the user needs to specify the superparticle algorithm through the ItoSolver configuration options. However, the number of superparticles is adjusted through BrownianWalkerStepper, and is set through BrownianWalker.ppc. Setting this value to anything less than 1 will turn off super-particle handling.

Solver configuration

The BrownianWalkerStepper class comes with user-configurable input options that can be adjusted at runtime. The configuration options for BrownianWalkerStepper are given below:

# ====================================================================================================
# BrownianWalkerStepper class options.
# ====================================================================================================
BrownianWalker.verbosity          = -1        ## Verbosity
BrownianWalker.realm              = primal    ## Realm
BrownianWalker.diffusion          = true      ## Turn on/off diffusion
BrownianWalker.advection          = true      ## Turn on/off advection
BrownianWalker.blob_amplitude     = 1.0       ## Blob amplitude
BrownianWalker.blob_radius        = 0.1       ## Blob radius
BrownianWalker.blob_center        = 0 0       ## Blob center
BrownianWalker.seed               = 0         ## RNG seed
BrownianWalker.num_particles      = 100       ## Number of initial particles
BrownianWalker.cfl                = 1.0       ## CFL-like number.
BrownianWalker.ppc                = -1        ## Particles per cell. <= 0 turns off superparticles
BrownianWalker.load_balance       = true      ## Turn on/off particle load balancing
BrownianWalker.which_balance      = mesh      ## Switch for load balancing method. Either 'mesh' or 'particle'.

# Velocity, diffusion, and CFL
# ----------------------------
BrownianWalker.mobility     = 1.0    ## Mobility coefficient
BrownianWalker.diffco       = 1.0    ## Diffusion coefficient
BrownianWalker.omega        = 1.0    ## Rotation velocity for advection field

# Cell tagging stuff
# ------------------
BrownianWalker.refine_curv     = 0.1     ## Refine if curvature exceeds this
BrownianWalker.refine_magn     = 1E-2    ## Only tag if magnitude eceeds this
BrownianWalker.buffer          = 0       ## Grow tagged cells

Setting up a new problem

To set up a new problem, using the Python setup tools in $DISCHARGE_HOME/Physics/BrownianWalker is the simplest way. A full description is available in the README.md contained in the folder:

# Physics/BrownianWalker
This physics module solves for advection-diffusion process of a single scalar quantity. This module contains files for setting up the initial conditions
and species, integrators, and a cell tagger for refining grid cells. 

The source files consist of the following:

* **CD_BrownianWalkerSpecies.H/cpp** Implementation of ItoSpecies, for setting up initial conditions and turning on/off advection and diffusion.
* **CD_BrownianWalkerTagger.H/cpp**  Implementation of CellTagger, for flagging cells for refinement and coarsening.
* **CD_BrownianWalkerStepper.H/cpp** Implementation of TimeStepper, for advancing the advection-diffusion equation. 

## Setting up a new application
To set up a new problem, use the Python script. For example:

```shell
python setup.py -base_dir=/home/foo/MyApplications -app_name=MyBrownianWalker -geometry=Vessel
```

To install within chombo-discharge:

```shell
python setup.py -base_dir=$DISCHARGE_HOME/MyApplications -app_name=MyBrownianWalker -geometry=Vessel
```

The application will then be installed to $DISCHARGE_HOME/MyApplications/MyBrownianWalker.
The user will need to modify the geometry and set the initial conditions through the inputs file. 

## Modifying the application
The application is simply set up to advect and diffuse a scalar in a rotating flow.
Users are free to modify this application, e.g. adding new initial conditions and flow fields. 

To see available setup options, use

python setup.py --help