MADNESS 0.10.1
Classes | Functions | Variables
siam_example.cc File Reference

A simple example of solving PDEs with MADNESS. More...

#include <madness/mra/mra.h>
#include <madness/constants.h>
#include <madness/mra/nonlinsol.h>
Include dependency graph for siam_example.cc:

Classes

class  DSphere
 Functor representing the log-derivative of $\epsilon$ along an axis. More...
 

Functions

int main (int argc, char **argv)
 Main function. Project the functions and solve the PDE.
 
double rho_function (const coord_3d &r)
 Function that provides the charge density, $ \rho $.
 

Variables

const double eps_ext =10.0
 Exterior dielectric.
 
const double eps_int = 1.0
 Interior dielectric.
 
const double R = 2.0
 Radius of sphere.
 
const double sigma = 0.1
 Surface "width".
 
const double xi = 100.0
 Exponent for delta function approx.
 

Detailed Description

A simple example of solving PDEs with MADNESS.

This example solves Poisson's equation for a system with an inhomogeneous dielectric constant,

\[ \nabla \cdot{} \left[ \epsilon(\vec{r}) \nabla u(\vec{r}) \right] = - 4 \pi \rho(\vec{r}). \]

$ \epsilon(\vec{r}) = \epsilon_\mathrm{int}$ for $ |\vec{r}| < R$ and $ \epsilon(\vec{r}) = \epsilon_\mathrm{ext}$ for $ |\vec{r}| > R.$ The PDE is converted to a fixed point iteration using the Green's function for the Laplacian (with free-space boundary conditions) and then solved using a fixed point iteration.

Other objectives are to demonstrate the use of functors when projecting MADNESS functions.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

◆ rho_function()

double rho_function ( const coord_3d r)

Function that provides the charge density, $ \rho $.

Parameters
[in]rThe coordinate at which to evaluate the function.
Returns
The value of $ \rho $ at the point.

References madness::constants::pi, pow(), and xi.

Referenced by main().

Variable Documentation

◆ eps_ext

const double eps_ext =10.0

Exterior dielectric.

Referenced by main().

◆ eps_int

const double eps_int = 1.0

Interior dielectric.

Referenced by main().

◆ R

const double R = 2.0

Radius of sphere.

◆ sigma

const double sigma = 0.1

Surface "width".

◆ xi

const double xi = 100.0