[FLASH-USERS] Novice FLASH3 questions

dongwook at flash.uchicago.edu dongwook at flash.uchicago.edu
Tue May 26 13:32:08 EDT 2009


Hi Andy,

What kind of boundary condition do you exactly want to setup for
your simulation? I understand you want to simulate an MHD problem
and hope to learn more about your BC in order to help you.

> I am working on constructing a new problem setup.  For my problem I will
> need to supply (time-variable) boundary conditions, including magnetic
> fields.
> I am a big fan of starting with a (working) example, and modifying it.
> So I've been working through the included demos, and have not found
> quite enough of relevance.
>
> Here are a list of questions/comments I've generated - I'd appreciate
> any feedback any gurus wish to contribute...
>
> (1) Does anyone have a setup along the lines I've mentioned that they
> are willing to let me see?
>
> WindTunnel is the only demo I'm finding w/ its own boundary condition
> routines:
>
> (2) am I correct that the user_bnd.F90 routine is not used in FLASH3?
> (I suspect that this may be a FLASH2 remnant, and perhaps should be
> removed from the distribution, as it is potentially confusing for the
> newbies).
>
> (3) The BC routine in the WindTunnel sim is Grid_applyBCEdge.F90. It
> explicitly errors out if called with a face variable, and I'm relatively
> sure I need to able to set face variables in order to insert magnetic
> fields at the boundaries. Am I correct that I should probably do my
> setup with a custom Grid_bcApplyToRegion.F90 (or
> Grid_bcApplyToRegionSpecialized.F90)?

Does your boundary condition needs any injections of magnetic fields
from boundaries, or some such a thing? We don't have such a working
example in FLASH release but I am sure it is not hard to do.


> (4) I'm examining CurrentSheet which has an example of establishing
> divergenceless conditions in the initBlock routine - are there any
> obvious gotchas as I'm going to try to implement similar conditions in
> the guard cells in the Grid_bcApplyToRegion routine?


The divergence-free BC for magnetic fields is all taken care
of if you setup any MHD problem (for simple boundary conditions such as
periodic, reflecting, outflow, etc.), but not IC.
This means that user need to make sure divergence-free condition holds
for magnetic fields initially. Such divergence-free fields will then remain
divergence-free in later times within given orders of magnetitude
that MHD solver(s) can provide.

This IC implementation is what you saw in the CurrentSheet
problem that uses vector potential Az and take numerical derivatives
of it to initialize magnetic fields.

So, my guess is that you may want to apply a boundary condition
that injects magnetic fields (or magnetic pressure) from boundaries
and want to make sure the fields to be divergence-free. Is that right?

If this is true, you can try one of the followings:


(1) "Analytically" you make sure your B fields are divergence-free and
    inject the fields from the boundaries. But this may not truly
    guarantee divergence-free condition at guardcells (boundaries)
    for complicated magnetic fields configurations. This is because
analytical
    divergence-free conditions is not always true numerically.
    However, in the simplest setup with constant B-fields, this analytical
    treatment should work.

(2) As in the current sheet setup, you can use a vector potential, (e.g.,
    Az for 2D) to make sure your B fields are always divergence-free
"numerically"
    at boundaries.

Note that there are two MHD solvers, the 8-wave and Unsplit Staggered Mesh
(USM). Face-centered magnetic fields are only meaningful for the USM
solver,
and if you are trying to work on your own customized BC then you are going
to include both face-centered B fields as well as cell-centered B fields
in your Grid_bcApplyToRegionSpecialized.F90.

If you wish to look at details of the USM solver in FLASH then please look
at my recent JCP paper D. Lee and A Deane, "An unsplit staggered mesh
scheme for multidimensional magnetohydrodynamics", 228(2009) pp. 952-975.

One more thing: when you setup an MHD problem, your simulation directory
should be under "source/Simulation/SimulationMain/magnetoHD/"
in order to make sure divergence-free prolongations on AMR.

Also, in your setup line, you don't want to forget including either
"+usm" for setting up with the USM solver, or "+8wave" with
the 8-wave solver.

Please feel free to ask me more detailed question on your MHD setup.

Best regards,
Dongwook




More information about the flash-users mailing list