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.