Author Topic: divergence modeling  (Read 7399 times)

computer

  • Newbie
  • *
  • Posts: 0
divergence modeling
« 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(x-dx,y,z)] / dx + [E(x,y+dy,z) - E(x,y-dy,z)] / dy + [E(x,y,z+dz) - E(x,y,z-dz)] / dz = 0.
Theoretically Maxwell equations maintain divergence stable,
but numeric errors accumulate.Or it maybe necessary setting initial field state.
Thanks in advance.

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: divergence modeling
« Reply #1 on: October 17, 2009, 11:25:25 am »
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.

computer

  • Newbie
  • *
  • Posts: 0
Re: divergence modeling
« Reply #2 on: October 21, 2009, 07:33:12 pm »
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.

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: divergence modeling
« Reply #3 on: October 21, 2009, 09:26:11 pm »
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.

computer

  • Newbie
  • *
  • Posts: 0
Re: divergence modeling
« Reply #4 on: October 22, 2009, 09:55:25 pm »
I use model for dynamic field visualization,so calculations must be fast,
not like solution of equations system.Field represented as structure of double-precision 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.Finite-difference like algorithm calculates new vector values
after time step,like Ex += [dt * K] * [[Hz(x,y+dy,z) - Hz(x,y-dy,z)] / [2 * dy]
- [Hy(x,y,z+dz) - Hy(x,y,z-dz)] / [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 real-world 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.
« Last Edit: October 22, 2009, 10:03:36 pm by computer »