[petsc-users] Structured Finite Difference Method With Periodic BC Help
Paul Stephen Urbanczyk
gomer at stanford.edu
Sat May 7 19:58:10 CDT 2016
Hi Barry and Jed,
Thank you for responding. I greatly appreciate it. I'm still wrapping my head around the periodic BC case.
In the meantime, putting the periodic BC case aside, I'm wondering how best to set ghost points outside the computational domain, generally (for example if i need to set values for other types of BCs like inflow/outflow/wall/sponge/etc)?
In my earlier experiments, scattering the global vector to local vectors, setting the ghost point values using a local array reference to the local vectors, and then scattering the local vectors back to the global vectors didn't seem to work.
Any help is appreciated.
Thanks,
Paul
________________________________________
From: Jed Brown <jed at jedbrown.org>
Sent: Friday, May 6, 2016 4:13:20 PM
To: Barry Smith; Paul Stephen Urbanczyk
Cc: petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] Structured Finite Difference Method With Periodic BC Help
Barry Smith <bsmith at mcs.anl.gov> writes:
>> On May 6, 2016, at 5:09 PM, Paul Stephen Urbanczyk <gomer at stanford.edu> wrote:
>>
>> However, this raises another question: shouldn't the coordinates behave differently than other field variables? In other words, shouldn't the periodic ghost points at the left end have coordinates (0-h) and (0-2h), rather than (1-h) and (1-2h)? And, at the right side, shouldn't the x-coordinates be 1 and 1+h?
>
> I don't know. But I believe they should not; periodic boundary
> conditions can be interpreted as having the domain [0,1) connected
> at the two ends so there would never be coordinates less than 0 or
> 1 or larger. Another way, I think, of saying the same thing is that
> if you take a point x in domain and add some positive distance d
> then the coordinate of the result is give by fractionalpart(x + d)
> something similar can be done for subtracting some distance.
Additionally, making up coordinates for ghost points is not well-defined
for non-uniform or distorted grids.
More information about the petsc-users
mailing list