Fwd: full understanding of different grid points

10 views
Skip to first unread message

Andreas Ipp

unread,
Jun 3, 2012, 7:21:38 AM6/3/12
to open...@googlegroups.com
Hi Jan,

Let's continue this discussion on the developer mailing list, as you suggested.

Yes, I agree with your option B. With non-periodic boundary
conditions, it is better to increase the grid size. So the grid
continues into a region where particles can not enter, and for
interpolating particles to fields or fields to particles, one only
needs one kind of formula that works in the interior of the grid.

For solving the field equations themselves (i.e. solving Maxwell's
equations), the situation is slightly different. There are different
kinds of boundary conditions, so a physicist would have to implement
those anyway for each case separately.

To give you an example: Derivatives are formed by finite differences:
http://en.wikipedia.org/wiki/Finite_difference

In the interior, the central difference is used. This is possible,
since we have corner, edge, and center positions. It is symmetric and
accurate through second order in the distance between points.

At the border, instead of using the central difference, one could also
use forward difference on one side, and backward difference on the
other side. So that would be different formulae that one would have to
write specifically for the borders.

Instead of keeping the values at the boundary fixed to =0 (Dirichlet
boundary condition), one could keep the derivative at the boundary
fixed (Neumann boundary condition), so again, different boundary
solvers would have to be written for these different cases.

Even a mixture of these boundary conditions at different boundaries of
the system is possible:
http://en.wikipedia.org/wiki/Mixed_boundary_condition

Beyond that there is the possibility to introduce damping at the
boundary or other properties that specify what kind of material the
boundary is made of (and one could attach different kinds of materials
to different boundaries).

So in this case, it doesn't make sense to assume that it is enough to
specify the Maxwell solvers in the interior and to simply apply them
to the boundaries, but new solvers particulary for the boundaries have
to be written, and there are several ways to implement different
physical possibities for boundaries.

But a boundary could simple be a grid with a different field solver
attached (one that is written particularly for solving the field
equations at the boundary).

Cheers,
Andreas

---------- Forwarded message ----------
From: Jan Kis
Date: 2012/6/2
Subject: Re: full understanding of different grid points
To: Andreas Ipp


Hi Andreas,

thank you very much for the complete picture (picture is worth a
thousand words :))

I think this mystery of cell points is almost resolved :). The only
question that remains is: What exactly should happen if the particle
is in the last cell (see attached picture) and we are not using the
periodic boundary?

> The only subtleties can arise in non-periodic boundaries, so this is the only place where the cell points could / should be treated differently. But this can be easily done by using slightly different formulae for the borders. (for example, just update the corner and edge point 1, and ignore the center and edge point 2).


I understand this option as follows. Lets suppose we are interpolating
Jx which lie at edge point 1.
1) If we are interpolating particle-1, we interpolate to all
surrounding edge points 1 (00, 01, 10 and to 11).
2) If we are interpolating particle-2 we interpolate only to edge1-10
and edge1-11.
3) If we are interpolating particle-3 we interpolate only to edge1-11.
Is my understanding correct?

> Ok, one could probably reserve different size arrays for different kinds of fields (they would differ by where the border ends), but this would affect anyway only the borders. In the bulk of the interior (where most of the memory is allocated), it is a quite regular structure with no real beginning and no real end.


Oki, so basically we have two options.

A) We do not introduce the extra space for non periodic boundaries
(+) easy implementation of grid
(-) in interpolators one has to explicitly handle the situation when
the particle is in the last cell -> Ideally we want to avoid this
situation I would say. It would be nice if the physicist wanting to
implement a new interpolator would only need to implement one
interpolation and not two.

B) We introduce the extra space for non periodic boundaries
(+) only one kind of interpolation (the border cases do not need to be
handled separately)
(-) Few programming complications one has to take in mind:
  - With periodic boundary the statement getJx(numOfCellsX) should
return the first cell point whereas
  - with other kind of boundary the statement getJx(numOfCellsX)
should return the cell point from the extra space

From the design point of view the option B is cleaner and nicer. If it
is also acceptable from physics point of view I vote for it :) What do
you think Andreas?

Cheers,
Jan

p.s. Should we move this discussion to openpixi mailing list? (It
might be useful for Kirill and the others)


On Thu, May 31, 2012 at 9:21 AM, Andreas Ipp wrote:
>
> Hi Jan,
>
> I attach modified version of your picture which hopefully will clear some of your doubts :-)
>
> 1) There are 2 different kinds of edge points, which I labelled "edge point 1" and "edge point 2".
> If I do this, then you see that in each cell there is exactly 1 kind of point of each type (in the first cell marked by the blue dashed line).
>
> 2) rho: center point.
> phi: center point.
> Jx: Edge point 1 (arrow pointing to the right)
> Jy: Edge point 2 (arrow pointing downward - assuming x increases to the right and y increases to the bottom - maybe I should have plotted it horizontally mirrored so that y increases to the top)
> Ex: Edge point 1
> Ey: Edge point 2
> Bz: Corner point, but half a time step before or after all other quantities.
>
> 3) You can, without changing the physics, easily shift the array by half a cell size in each direction.
> E.g. shifting everything up by half a cell:
> rho: edge point 2
> phi: edge point 2
> Jx: corner point
> Jy: center point
> Ex: corner point
> Ey: center point
> Bz: edge point 1 (but half a time step off)
>
> or shift everything to the right by half a cell:
> rho: edge point 1
> phi: edge point 1
> Jx: center point
> Jy: corner point
> Ex: center point
> Ey: corner point
> Bz: edge point 2 (but half a time step off)
>
> or shifting by half a cell in both directions (you get the idea).
>
> If you are interested in a less accurate situation, one could also put all fields to the corner point only. The difference is similar to whether you use the trapezoidal rule or Simpson's rule for integrating.
>
> Since there is exactly 1 kind of point per cell, one can simply label them by their cell's coordinates. There is no problem if periodic boundary conditions are used or if several of such regions have to be patched together.
>
> The only subtleties can arise in non-periodic boundaries, so this is the only place where the cell points could / should be treated differently. But this can be easily done by using slightly different formulae for the borders. (for example, just update the corner and edge point 1, and ignore the center and edge point 2).
>
> Ok, one could probably reserve different size arrays for different kinds of fields (they would differ by where the border ends), but this would affect anyway only the borders. In the bulk of the interior (where most of the memory is allocated), it is a quite regular structure with no real beginning and no real end.
>
>
>
>
>
> On 05/30/12 19:12, Jan Kis wrote:
>>
>> Hi Andreas,
>>
>> to clarify the confusion I have about the different grid points I drew a picture (see attachment).
>> 1) Is the picture correct? Eg. are the edge points only on the edges between grids and not on the border edges?
>> 2) Can you please fill in the following table (replace the "?").
>>
>> What is the mapping of the arrays in the grid to the position on cell?
>> - rho (electric charge): center points
>> - phi (?): ?
>> - Jx, Jy (currents): edge points
>> - Ex, Ey (electric fields): ?
>> - Bz (magnetic field): corner points
>>
>> 3) Does it make sense to define one array at different positions in different simulations? If so, with which arrays this makes sense and what are the different positions the array can have?
>>
>> Thank you very much,
>>
>> Jan
>>
>>
>
> --
> Andreas Ipp
> Institute for Theoretical Physics
> Vienna University of Technology
> Wiedner Hauptstr. 8-10/136
> A-1040 Vienna, Austria
>
> phone: +43-1-58801-13635
> fax:   +43-1-58801-13699
> http://hep.itp.tuwien.ac.at/~ipp/
>
>
cellPoints3.svg

Jan Kis

unread,
Jun 3, 2012, 2:04:48 PM6/3/12
to open...@googlegroups.com
Thanks a lot Andreas. I think the fact that we want different grid solvers at the boundary of the grid is quite important and I am already taking it into consideration as I am analyzing what do we need from the grid and its boundaries.

Cheers,
Jan 
Reply all
Reply to author
Forward
0 new messages