[FLASH-USERS] boundary conditions

Klaus Weide klaus at flash.uchicago.edu
Sat Jun 26 15:14:17 EDT 2021


On Sat, 26 Jun 2021, vadim romansky wrote:

> I don't understand how to set boundary conditions on upper boundary. In the
> comment in file Grid_bcApplyToRegionSpecialized is written
> regionData(regionSize(BC_DIR)-guard+1:regionSize(BC_DIR),:,:,variables) =
>  boundary values
> but below, in the code, in all examples, there is something like
> k = 2*guard+1
> do i = 1,guard
>    regionData(k-i,1:je,1:ke,ivar)= regionData(i,1:je,1:ke,ivar)*sign
>  end do
> 
> but why we set condition on the upper boundary, using the beginning of
> array regionData? not its end, like regionData(regionSize(BC_DIR)) in
> comment?

Assuming the common case that guard=4, and we are dealing with 
cell-centered variables (so that regionSize(BC_DIR) should be 8),
then

  k = 9,

and on the DO loop, while 

  i runs through the values 1,2,3,4,
  (k-1) runs through the 8,7,6,5.

So the loop is filling the parts of regionData it should, just in a 
different order from what you might expect, but the order does not matter 
for results.

Klaus







More information about the flash-users mailing list