Re: [firedrake] upwind example remark; extension to CN in time
Hi Onno, But + and - are not on the inside or outside, they are just two arbitrary sides. I'll look into why the code is crashing today hopefully, I have a phone conference about admissions until 4pm. all the best --cjc On 27 June 2016 at 04:34, Onno Bokhove <O.Bokhove@leeds.ac.uk> wrote:
Hi Colin,
I know that of course as that is how I loop in my own c or matlab
programs! One loop over elements and one loop over the faces.
I am just saying state in the documentation example
that plus is on the inside when the normal is pointing outward,
and minus on the outside. Just add one sentence.
I usually tend to do that the other way around as
it is the limit with -epsilon and epsilon positive that is on the inside (so minus not plus is my usual convention; it does not matter but define it also
in the documentation example for clarity).
* The one remaining issue in my code seems that FD does not like me to use D_(+) or D_(-) while D(+) and D(-) are allowed, with the one
difference being that D is a TrailFunction
and D_ (previous time step) a Function.
I guess I don't understand that difference yet.
Thanks for the UFL link. That will help.
Best wishes,
------------------------------ *From:* firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Colin Cotter <colin.cotter@imperial.ac.uk> *Sent:* Sunday, June 26, 2016 3:11 PM
*To:* firedrake *Subject:* Re: [firedrake] upwind example remark; extension to CN in time
Hi Onno, This is documented in the UFL manual (the plusses, minusses etc.).
fenicsproject.org/pub/documents/*ufl*/*ufl*-user-*manual*/*ufl*-user- *manual*.pdf
The reason for this notation is that UFL is written for a global domain, in particular for facets it is the union of all interior facets, and when surface integrals are done, the facets are visited one by one instead of the cells. This means that there needs to be an (arbitrary) labelling of + and - sides of each facet. The notation was originally invented to write down global inner products to analyse DG methods for elliptic problems, where it is completely standard. This notation was set out in Arnold, Douglas N., et al. "Unified analysis of discontinuous Galerkin methods for elliptic problems." *SIAM journal on numerical analysis* 39.5 (2002): 1749-1779.
all the best --cjc
On 26 June 2016 at 14:08, Onno Bokhove <O.Bokhove@leeds.ac.uk> wrote:
Sure I knew that. D+ is on the inside of a cell with n pointing outward
unless I am blinded by being on the other side of the world.
Bit unusual convention in the DG world. Usually minus is on the inside.
But could it as such be defined in the write-up/documentation please?
In any DG article the convention whatever it is gets defined.
------------------------------ *From:* firedrake-bounces@imperial.ac.uk < firedrake-bounces@imperial.ac.uk> on behalf of Andrew McRae < A.T.T.McRae@bath.ac.uk> *Sent:* Sunday, June 26, 2016 12:40 PM *To:* firedrake@imperial.ac.uk *Subject:* Re: [firedrake] upwind example remark; extension to CN in time
D+ and D- refer to the values either side of an interior facet between two cells.
On the boundary (exterior facets), there is no such ambiguity, so just D is used.
In the steady-state example on the website, this D enters the left-hand-side integral over the outflow part of the boundary, while the prescribed function D0 is used in the integral over the inflow part.
"In general", you can write a term that contains both D and D0 and 'picks the right one' depending on the sign of u.n (this is how the interior facet integral works). Note that n always points *outwards* on the exterior boundary facets.
On 26 June 2016 at 12:24, Onno Bokhove <O.Bokhove@leeds.ac.uk> wrote:
The issue is that D_('+') (or D_('-')) is not defined but I don't understand why not, or how to fix it?
------------------------------ *From:* firedrake-bounces@imperial.ac.uk < firedrake-bounces@imperial.ac.uk> on behalf of Onno Bokhove < O.Bokhove@leeds.ac.uk> *Sent:* Sunday, June 26, 2016 12:21 PM
*To:* firedrake *Subject:* Re: [firedrake] upwind example remark; extension to CN in time
Yes that was my point indeed.
To build any more advanced code upon this one, one
would need to use an alternate approach entirely
through the flux.
That is why it may be useful to extend the
example with two alternatives: the simple one shown
and one flux-based only.
By the way, in the attached I have L2=0 and thet=0;
if I uncomment the actual L2 there is a complaint,
even though they=0.
Obviously I need this term for the general theta-scheme,
including thet=0.5 (Crank-Nicolson).
I am doing the above simple extensions to get used to FD! Small steps ...
The example is ties such that value 1 advects into through the entire domain in the time set. ------------------------------ *From:* firedrake-bounces@imperial.ac.uk < firedrake-bounces@imperial.ac.uk> on behalf of Colin Cotter < colin.cotter@imperial.ac.uk> *Sent:* Sunday, June 26, 2016 11:26 AM *To:* firedrake *Subject:* Re: [firedrake] upwind example remark; extension to CN in time
Hi Onno, In answer to your first question. Things are simplified in the advection demo because we know which edges are upwind, which are downwind, and which have no flow through them. If you wanted to generalise this, then we would need a surface integral over the entire external boundary with a switch that either gave the internal value of the tracer or the inflow boundary condition, depending on the direction of u.n, just like we did for the interior facets. Instead, in this example, on the outflow boundary we just write an integral involving the interior value, and on the inflow boundary we write an integral setting the inflow values.
all the best -cjc
On 25 June 2016 at 16:05, Onno Bokhove <O.Bokhove@leeds.ac.uk> wrote:
Hi FDs,
(i) The upwind example is odd in that the real boundaries are treated
in a special way rather than setting the outside value in
the same numerical flux as anywhere else;
my question is how this can be fixed?
So no special terms at the in- and outflow, just specify
the outside velocity used. This is imo the proper DG way not was is done
now.
(ii) Attached my attempt to do a time dependent advection
with Crank Nicolson, which works but does not yet
give the right answer, in part due to (i).
[I don't understand why I have to make
my theta variable that a constant but other wise it did not work.]
Any suggestions, corrections, also on other silly things done by me?
Next step is to extend to system with 3 equations; hence the few extra but unused variables.
Thanks, from midnight Seoul in old style Korean guesthouse.
Onno ------------------------------
-- http://www.imperial.ac.uk/people/colin.cotter
www.cambridge.org/9781107663916
-- http://www.imperial.ac.uk/people/colin.cotter
www.cambridge.org/9781107663916
-- http://www.imperial.ac.uk/people/colin.cotter www.cambridge.org/9781107663916
Ah, that is: in our usual set-up at any face there is an orientation chosen with one of the normals being called outside. That is arbitrary but once fixed it is known. In the interior that does not matter but at real boundaries the convention is always that the normal assigned is the normal pointing outside the domain. That is why at real boundaries one knows which sign convention concerns outside information. Otherwise how do you know whether to assign an outside the domain value to + or -? You would not know. In my convention with - inside, the + side is then the given information from the outside. ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Colin Cotter <colin.cotter@imperial.ac.uk> Sent: Monday, June 27, 2016 7:41 AM To: firedrake Subject: Re: [firedrake] upwind example remark; extension to CN in time Hi Onno, But + and - are not on the inside or outside, they are just two arbitrary sides. I'll look into why the code is crashing today hopefully, I have a phone conference about admissions until 4pm. all the best --cjc On 27 June 2016 at 04:34, Onno Bokhove <O.Bokhove@leeds.ac.uk<mailto:O.Bokhove@leeds.ac.uk>> wrote: Hi Colin, I know that of course as that is how I loop in my own c or matlab programs! One loop over elements and one loop over the faces. I am just saying state in the documentation example that plus is on the inside when the normal is pointing outward, and minus on the outside. Just add one sentence. I usually tend to do that the other way around as it is the limit with -epsilon and epsilon positive that is on the inside (so minus not plus is my usual convention; it does not matter but define it also in the documentation example for clarity). * The one remaining issue in my code seems that FD does not like me to use D_(+) or D_(-) while D(+) and D(-) are allowed, with the one difference being that D is a TrailFunction and D_ (previous time step) a Function. I guess I don't understand that difference yet. Thanks for the UFL link. That will help. Best wishes, ________________________________ From: firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk> <firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk>> on behalf of Colin Cotter <colin.cotter@imperial.ac.uk<mailto:colin.cotter@imperial.ac.uk>> Sent: Sunday, June 26, 2016 3:11 PM To: firedrake Subject: Re: [firedrake] upwind example remark; extension to CN in time Hi Onno, This is documented in the UFL manual (the plusses, minusses etc.). fenicsproject.org/pub/documents/<http://fenicsproject.org/pub/documents/>ufl/ufl-user-manual/ufl-user-manual.pdf The reason for this notation is that UFL is written for a global domain, in particular for facets it is the union of all interior facets, and when surface integrals are done, the facets are visited one by one instead of the cells. This means that there needs to be an (arbitrary) labelling of + and - sides of each facet. The notation was originally invented to write down global inner products to analyse DG methods for elliptic problems, where it is completely standard. This notation was set out in Arnold, Douglas N., et al. "Unified analysis of discontinuous Galerkin methods for elliptic problems." SIAM journal on numerical analysis 39.5 (2002): 1749-1779. all the best --cjc On 26 June 2016 at 14:08, Onno Bokhove <O.Bokhove@leeds.ac.uk<mailto:O.Bokhove@leeds.ac.uk>> wrote: Sure I knew that. D+ is on the inside of a cell with n pointing outward unless I am blinded by being on the other side of the world. Bit unusual convention in the DG world. Usually minus is on the inside. But could it as such be defined in the write-up/documentation please? In any DG article the convention whatever it is gets defined. ________________________________ From: firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk> <firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk>> on behalf of Andrew McRae <A.T.T.McRae@bath.ac.uk<mailto:A.T.T.McRae@bath.ac.uk>> Sent: Sunday, June 26, 2016 12:40 PM To: firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> Subject: Re: [firedrake] upwind example remark; extension to CN in time D+ and D- refer to the values either side of an interior facet between two cells. On the boundary (exterior facets), there is no such ambiguity, so just D is used. In the steady-state example on the website, this D enters the left-hand-side integral over the outflow part of the boundary, while the prescribed function D0 is used in the integral over the inflow part. "In general", you can write a term that contains both D and D0 and 'picks the right one' depending on the sign of u.n (this is how the interior facet integral works). Note that n always points *outwards* on the exterior boundary facets. On 26 June 2016 at 12:24, Onno Bokhove <O.Bokhove@leeds.ac.uk<mailto:O.Bokhove@leeds.ac.uk>> wrote: The issue is that D_('+') (or D_('-')) is not defined but I don't understand why not, or how to fix it? ________________________________ From: firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk> <firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk>> on behalf of Onno Bokhove <O.Bokhove@leeds.ac.uk<mailto:O.Bokhove@leeds.ac.uk>> Sent: Sunday, June 26, 2016 12:21 PM To: firedrake Subject: Re: [firedrake] upwind example remark; extension to CN in time Yes that was my point indeed. To build any more advanced code upon this one, one would need to use an alternate approach entirely through the flux. That is why it may be useful to extend the example with two alternatives: the simple one shown and one flux-based only. By the way, in the attached I have L2=0 and thet=0; if I uncomment the actual L2 there is a complaint, even though they=0. Obviously I need this term for the general theta-scheme, including thet=0.5 (Crank-Nicolson). I am doing the above simple extensions to get used to FD! Small steps ... The example is ties such that value 1 advects into through the entire domain in the time set. ________________________________ From: firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk> <firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk>> on behalf of Colin Cotter <colin.cotter@imperial.ac.uk<mailto:colin.cotter@imperial.ac.uk>> Sent: Sunday, June 26, 2016 11:26 AM To: firedrake Subject: Re: [firedrake] upwind example remark; extension to CN in time Hi Onno, In answer to your first question. Things are simplified in the advection demo because we know which edges are upwind, which are downwind, and which have no flow through them. If you wanted to generalise this, then we would need a surface integral over the entire external boundary with a switch that either gave the internal value of the tracer or the inflow boundary condition, depending on the direction of u.n, just like we did for the interior facets. Instead, in this example, on the outflow boundary we just write an integral involving the interior value, and on the inflow boundary we write an integral setting the inflow values. all the best -cjc On 25 June 2016 at 16:05, Onno Bokhove <O.Bokhove@leeds.ac.uk<mailto:O.Bokhove@leeds.ac.uk>> wrote: Hi FDs, (i) The upwind example is odd in that the real boundaries are treated in a special way rather than setting the outside value in the same numerical flux as anywhere else; my question is how this can be fixed? So no special terms at the in- and outflow, just specify the outside velocity used. This is imo the proper DG way not was is done now. (ii) Attached my attempt to do a time dependent advection with Crank Nicolson, which works but does not yet give the right answer, in part due to (i). [I don't understand why I have to make my theta variable that a constant but other wise it did not work.] Any suggestions, corrections, also on other silly things done by me? Next step is to extend to system with 3 equations; hence the few extra but unused variables. Thanks, from midnight Seoul in old style Korean guesthouse. Onno ________________________________ -- http://www.imperial.ac.uk/people/colin.cotter www.cambridge.org/9781107663916<http://www.cambridge.org/9781107663916> [X] -- http://www.imperial.ac.uk/people/colin.cotter www.cambridge.org/9781107663916<http://www.cambridge.org/9781107663916> [http://assets.cambridge.org/97811076/63916/cover/9781107663916.jpg] -- http://www.imperial.ac.uk/people/colin.cotter www.cambridge.org/9781107663916<http://www.cambridge.org/9781107663916> [http://assets.cambridge.org/97811076/63916/cover/9781107663916.jpg]
participants (2)
- 
                
                Colin Cotter
- 
                
                Onno Bokhove