[FLASH-BUGS] reflecting BC for MHD

Sean Matt matt at physics.mcmaster.ca
Fri Mar 7 14:07:38 CST 2003


Hello,

	We have been running a new 3D MHD test case in FLASH (spin down of
a magnetic rotator), and upon getting an incorrect result, we have
realized that the standard "reflecting" boundary condition is not properly
set for the magnetic field parameters.  The fix should be trivial, but
since we believe this is incorrect for any general MHD problem in any
number of dimensions, it should probably be fixed in the main source tree.
	The reflecting boundary condition (and others) is set in the
paramesh routine source/mesh/amr/paramesh2.0/tot_bnd.F90.  It is
correctly set for hydrodynamics.  That is, all quantities are constant,
except that the component of velocity that is normal to the boundary
(e.g., velx for an x boundary) should reverse sign across the boundary.
	For MHD, in addition to the normal hydro conditions, the component
of the magnetic field that is parallel to the boundary (e.g., both magy
and magz for an x boundary) should reverse sign.
	The fix may look something like the following:


If the original BC looks like this:

...
        ivelx = dBaseKeyNumber("velx")
...
!               -X reflecting boundary
...
               do i = 1, nguard

                 solnData(:,i,j,k)     = solnData(:,ic,j,k)
                 if (ivelx .gt. 0) then
                    solnData(ivelx,i,j,k) = -solnData(ivelx,ic,j,k)
                 endif
                 ic = ic - 1

               end do
... 


The new BC should look something like this:

...
        ivelx = dBaseKeyNumber("velx")
        imagy = dBaseKeyNumber("magy")
        imagz = dBaseKeyNumber("magz")
...
!               -X reflecting boundary
...
               do i = 1, nguard

                 solnData(:,i,j,k)     = solnData(:,ic,j,k)
                 if (ivelx .gt. 0) then
                    solnData(ivelx,i,j,k) = -solnData(ivelx,ic,j,k)
                 endif
                 if (imagy .gt. 0) then
                    solnData(imagy,i,j,k) = -solnData(imagy,ic,j,k)
                 endif
                 if (imagz .gt. 0) then
                    solnData(imagz,i,j,k) = -solnData(imagz,ic,j,k)
                 endif
                 ic = ic - 1

               end do
...





More information about the flash-bugs mailing list