[FLASH-USERS] Grid_bcApplyToRegionSpecialized
Klaus Weide
klaus at flash.uchicago.edu
Mon Aug 24 14:42:16 EDT 2009
Sylvain and Dongwook,
I believe Dongwook's code has several improvements (using
gr_extendedGetCellCoords, correct upper bound in 'do i=1,guard'
loop), but additionally needs an offset for the y direction, as indicated
below.
Klaus
On Thu, 20 Aug 2009, Dongwook Lee wrote:
> Hi Sylvain,
>
> I assume you're applying user BC only on the x=xmin boundary.
> If this is not true, and if you're also applying user BC on the
> y direction(s) with the current setups of x,y coordinates, this
> will not work for you, because your BC_DIR also varies.
>
> My first suggestion is to replace Grid_getCellCoords with
> gr_extendedGetCellCoords. This routine has an extended functionality
> that should be used internally within the Grid
> unit (i.e., should be called from Grid_*.F90) and can give you
> coordinate information even for remote blocks.
>
> I suggest your do loop look like (assuming userBC on x=xmin,
> i.e., axis=IAXIS, secondDir=JAXIS, thirdDir=KAXIS):
> (For more general cases, please have a look how secondDir
> and thirdDir are set in gr_bcApplyToOneFace.F90.)
>
> ------------------------------------------------------
> sizeX = regionSize(axis)
> sizeY = regionSize(secondDir)
> sizeZ = regionSize(thirdDir)
>
> allocate(xCoord(sizeX))
> allocate(yCoord(sizeY))
>
> call gr_extendedGetCellCoords&
> (axis, blockHandle, gr_myPE, CENTER, .true., xCoord, sizeX)
>
> call gr_extendedGetCellCoords&
> (secondDir, blockHandle, gr_myPE, CENTER, .true., yCoord, sizeY)
>
jOffset = endPoints(LOW,secondDir) - 1
> do i=1,guard
> do j=1,sizeY
>! regionData(i,j,1:ke,VELY_VAR)=value(xCoord(i),yCoord(j))
regionData(i,j,1:ke,VELY_VAR)=value(xCoord(i),yCoord(j+jOffset))
> enddo
> enddo
>
> ---------------------------------------------------------
>
> Note again that if you're applying userBC to x=xmax, as well
> as y=ymin or y=ymax, then you have to be more careful in
> setting up your xCoord and yCoord in using axis, secondDir
> as well as proper offsets for face=HIGH.
>
> If you need a BC for that case, I can give you an example
> of Grid_bcApplyToRegionSpecialized.F90 I've implemented.
More information about the flash-users
mailing list