       Re: solving poisson equation with Mathematica

• To: mathgroup at smc.vnet.net
• Subject: [mg124426] Re: solving poisson equation with Mathematica
• From: JUN <noeckel at gmail.com>
• Date: Thu, 19 Jan 2012 05:12:02 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <jf6961\$gdh\$1@smc.vnet.net>

```On Jan 18, 3:07 am, Farhad Bazyari <farhad.bazy... at gmail.com> wrote:
> Hi guys,
>
> I have a vector field, vf, in 3D. I need to find a scalar function
> f(x,y,z) such that Laplacian of f(x,y,z) equals divergence of vf (the
> vector field)
> I need to find f(x,y,z) in the unit cube, and vf is defined in that
> area.
>
> can anyone help me with that please?

This looks suspiciously like a homework problem, so I won't address
the specific case you're describing, except to say that you probably
won't need a Poisson solver at all because you are given more
information than you perhaps realized in the form of vf.

However, if you _do_ want to implement one in 3D, I can point you to
the following page that contains a teaching resource for my
electromagnetism class:
uoregon.edu/~noeckel/computernotes/Mathematica/poissonEquation.html

This shows one way to solve the Poisson equation in 2D.

To implement second derivatives (as required for the Laplacian), I use
RotateRight and RotateLeft on the grid containing the potential. One
can instead also use ListConvolve to achieve the same thing.

Another important aspect is how to impose the boundary conditions. In
electrostatics, these are typically Dirichlet conditions on conductors
of arbitrary shape. To allow arbitrary shapes, I include the
conductors in the computational grid but combine each relaxation step
with a step in which a mask is applied to the grid that sets the
conductors to their given fixed potential.

Jens

```

• Prev by Date: Re: NIntegrate and Plot solution of differ. equa. over initial conditions
• Next by Date: Re: Is there any efficient easy way to compare two lists with the same length with Mathematica?
• Previous by thread: solving poisson equation with Mathematica
• Next by thread: Re: solving poisson equation with Mathematica