Re: 3D PetClaw

6 views
Skip to first unread message

Grady Lemoine

unread,
Apr 29, 2013, 11:04:10 PM4/29/13
to claw-...@googlegroups.com, claw...@googlegroups.com
That sounds good, although it's not completely clear what the right way would be to do this.  I can see two obvious approaches:

1. The Clawpack Classic way -- create the qbc and auxbc arrays before the source term is called, and pass the whole array into the source routine for Strang splitting.  This would be the most flexible approach, but might confuse existing PyClaw source routines if any of them expect arrays without ghost cells.

2. The PyClaw-ish way -- apply the source routine separately to the ghost cells.  This might be less flexible if, say, the source routine is actually the solution operator of some PDE, not just something that can be applied pointwise.  (This is actually what I'm doing in my own code right now.)

I'm CC'ing claw-dev, and since I've got my user-type questions answered, this probably doesn't need to go to claw-users any more.

--Grady


On Mon, Apr 29, 2013 at 5:04 PM, Kyle Mandli <kyle....@gmail.com> wrote:
Great to hear!  I think we should really put in an issue for this in PyClaw as we do support Strang splitting and this is an obvious pitfall.  


On Mon, Apr 29, 2013 at 6:58 PM, Grady Lemoine <grady....@gmail.com> wrote:
And it's working.  I made a small before_step routine that checks the solver object to see if Strang splitting is being used; it records the result of that check and the time step length in a couple of Fortran module variables, which the BC routine uses to apply the source term if necessary.  I don't like using those module variables because they're global, mutable state, but I think it should work out.  I couldn't think of any other way to get the time step length into the BC routine.  With this change, the Claw Classic and serial PyClaw versions of my code give almost bit-for-bit identical results.  I'll be trying PetClaw tomorrow.

--Grady


On Mon, Apr 29, 2013 at 2:50 PM, Grady Lemoine <grady....@gmail.com> wrote:
It looks like before_step really is happening as the very first thing in ClawSolver.step().  This may be useful to me.

--Grady


On Mon, Apr 29, 2013 at 2:47 PM, Grady Lemoine <grady....@gmail.com> wrote:
I think before_step probably should happen outside the hyperbolic step, really truly before anything happens in the step.  As for the rest ... PyClaw seems to have a different philosophy than Claw Classic regarding boundary conditions, and I don't fully understand it.  I'm assuming you guys had a plan when you put it together, so I'll defer to your judgement.

--Grady


On Mon, Apr 29, 2013 at 2:43 PM, Kyle Mandli <kyle....@gmail.com> wrote:
Hmmm, that's an interesting point, should we apply the BCs outside of the hyperbolic step?  Seems like we should since the boundary conditions are independent of the hyperbolic time step and need to be set at the beginning of any computation.  For that matter, shouldn't the before_step routine also be outside of the hyperbolic step and in the generic step routine?


On Mon, Apr 29, 2013 at 4:37 PM, Grady Lemoine <grady....@gmail.com> wrote:
Found the problem.  I was seeing discrepancies in the interior of the domain because in Claw Classic the BCs are set first thing, before anything else happens in the time step, whereas in PyClaw they're set when the hyperbolic part of the solution is advanced.  For Strang splitting, in my Classic code I apply the source term to the boundary cells too in that first half-step before the hyperbolic part, whereas in PyClaw the boundary cell values don't even exist yet for that first half-step.

So ... in essence, my BCs are supposed to depend on the length of my time step.  It seems like the easiest way to deal with this would be to pass the time step length into my custom BC routine, but now I need to figure out the appropriate data plumbing to get it in there.

--Grady

On Mon, Apr 29, 2013 at 12:29 PM, Grady Lemoine <grady....@gmail.com> wrote:
Either way, I probably don't actually have time for this.  Right now, I'm struggling with some rather odd problems.  After I call qinit, the interiors of the Classic and PyClaw domains have exactly the same q array, but by the time they reach the BC setting routines (bc3 and solver.user_bc_* respectively) the two codes have different data on the domain interiors.  I do not understand this.  I've got group meeting right now, but afterward I will be tracking this down and seeing what the two codes do differently; any input would be welcome, however.

--Grady

--
You received this message because you are subscribed to the Google Groups "claw-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+...@googlegroups.com.
To post to this group, send email to claw-...@googlegroups.com.
Visit this group at http://groups.google.com/group/claw-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "claw-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+...@googlegroups.com.
To post to this group, send email to claw-...@googlegroups.com.
Visit this group at http://groups.google.com/group/claw-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
You received this message because you are subscribed to the Google Groups "claw-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+...@googlegroups.com.
To post to this group, send email to claw-...@googlegroups.com.
Visit this group at http://groups.google.com/group/claw-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "claw-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+...@googlegroups.com.
To post to this group, send email to claw-...@googlegroups.com.
Visit this group at http://groups.google.com/group/claw-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages