NTNUJAVA Virtual Physics Laboratory
JDK1.0.2 simulations (19962001) => Electromagnetics => Topic started by: computer on October 17, 2009, 04:05:21 am

Hi,people.
My question is about finite difference modeling of EM fields.
Exist some methods to force numeric divergence be zero,
not changing too much the overall field picture?
Like [E(x+dx,y,z)  E(xdx,y,z)] / dx + [E(x,y+dy,z)  E(x,ydy,z)] / dy + [E(x,y,z+dz)  E(x,y,zdz)] / dz = 0.
Theoretically Maxwell equations maintain divergence stable,
but numeric errors accumulate.Or it maybe necessary setting initial field state.
Thanks in advance.

The equestion you wrote is first order Euler's method for no free charge case.
You can modify it to second order differential method (use potential V)
$frac{partial^2 V}{partial x^2}+frac{partial^2 V}{partial y^2}+frac{partial^2 V}{partial z^2}=0$
and use relazation method (change to boundary value problem) to find the solution for V. Then calculate Ex,Ey,Ez from V.

As I'd understood,you propose convert vector field into scalar (easy to smooth),and vice versa.
But from no charge electric field we can not restore potentials unequivocally.It can be closed,circular.

I will try to help if you can describe your problem in more detail (all the background information).
Otherwise, I do not know how to help.

I use model for dynamic field visualization,so calculations must be fast,
not like solution of equations system.Field represented as structure of doubleprecision values,
three for electric vector Ex,Ey,Ez,and three for magnetic Hx,Hy,Hz.
Time step (dt) is equal to distance step (dl) divided by velocity of light (c).
Rectangular block of points.Finitedifference like algorithm calculates new vector values
after time step,like Ex += [dt * K] * [[Hz(x,y+dy,z)  Hz(x,ydy,z)] / [2 * dy]
 [Hy(x,y,z+dz)  Hy(x,y,zdz)] / [2 * dz]] with some factor K following from Maxwell equations
(background equation dEx/dt = K * [dHz/dy  dHy/dz]).The main problem arises
trying to zero divergence,as in realworld fields.For example,setting initial conditions
we wish to connect two regions described by different analytic functions.
It is difficult do it "manually" for each case.I seek an universal algorithm.
Seems I need rather some programming trick then deep scientific explanation.
Scalar fields are smoothed easily,but voluntary electric field we can not represent as some gradient.