re-calculate the magnetic field from the vector potential in a completely divergency free way
subroutine recalculateB use mod_global_parameters use mod_fix_conserve use mod_physics use mod_ghostcells_update integer :: igrid,iigrid call init_comm_fix_conserve(1,ndim,3) do iigrid=1,igridstail; igrid=igrids(iigrid); ! Make zero the magnetic fluxes ! Fake advance, storing electric fields at edges block=>ps(igrid) call fake_advance(igrid,1,3,ps(igrid)) end do ! Do correction call recvflux(1,ndim) call sendflux(1,ndim) call fix_conserve(1,1,ndim,1,3) call fix_edges(ps,1,3) ! Now we fill the centers for the staggered variables do iigrid=1,igridstail_active; igrid=igrids_active(iigrid); call phys_to_primitive(ixGlo1,ixGlo2,ixGlo3,ixGhi1,ixGhi2,ixGhi3,ixMlo1,& ixMlo2,ixMlo3,ixMhi1,ixMhi2,ixMhi3,ps(igrid)%w,ps(igrid)%x) ! update cell center magnetic field call phys_face_to_center(ixMlo1,ixMlo2,ixMlo3,ixMhi1,ixMhi2,ixMhi3,& ps(igrid)) call phys_to_conserved(ixGlo1,ixGlo2,ixGlo3,ixGhi1,ixGhi2,ixGhi3,ixMlo1,& ixMlo2,ixMlo3,ixMhi1,ixMhi2,ixMhi3,ps(igrid)%w,ps(igrid)%x) end do call getbc(global_time,0.d0,ps,iwstart,nwgc) end subroutine recalculateB