Posts in category mGlobal

Put a circle on the grid

Hi everyone. I put a circle on the grid:

I learned a bit about the global.data file that I think I will share here (unless there might be a better place to do so)…

So in global.data, Gmx controls the number of cells on the grid. This must be in agreement with Domain%mGlobal, that is, mGlobal is a domain-by-domain decomposition of the number of cells per domain. It must run from AT LEAST 1 to the max number of cells in each dimension (i.e. mx). I ran into issues when mGlobal did not match mx. If I increased the number of cells in my domain, with out a concomitant increase in mGlobal, the cells were squeezed into a smaller and smaller region… Both mGlobal and mx refer to indices of the cells. They therefore cannot be real or floating point numbers; they must be integers. Also, they can't have values below 1 (a negative or 0 value for a cell index does not make sense). On the other hand, there is GxBounds. This refers to the actual spatial coords of the grid. These can run from negative to positive numbers. To convert between the cell indices and their spatial location, I wrote this into my module:

Do k=1-zrmbc, mz+zrmbc

Do j=1-rmbc, my+rmbc

Do i=1-rmbc, mx+rmbc

x=(xlower + (REAL(i, xPrec)-half)*dx) y=(ylower + (REAL(j, xPrec)-half)*dx) z=(zlower + (REAL(k, xPrec)-half)*dx)

Visit does not produce a grid with negative values. So if you have your domain running from -10 to 10, Visit will produce a grid from 0 to 20. This is relevant to keep in mind when visualizing output.

Okay, lastly, when one writes the grid init subroutine in their problem module, it is useful to assign an alias for certain variables that are assigned elsewhere in the astrobear "net". For instance:

mx=Info%mx(1); xlower=Info%Xbounds(1,1) my=Info%mx(2); ylower=Info%Xbounds(2,1) mz=Info%mx(3); zlower=Info%Xbounds(3,1)

Here we are calling a local variable, mx, and giving it the value Info%mx(1). Info%mx(1), however, is populated in another module, receiving its value from global.data — gmx. mGlobal is discrete, cell-centered indices. xBounds are contiguous, spatial coords.