That makes sense. So, here
https://gist.github.com/raybsmith/b0b6ee7c90efdcc35d6a0658319f1a01
I've changed it so that the error is calculated as
sum( (\phi-phi*)^2 * mesh.cellVolumes )
and depending on the value I choose for the ratio of dx_{i+1} / dx_i, I get
convergence for exponential spacing ranging from 2nd order (at that ratio =
1) and decreasing order as that ratio decreases from unity.

On Wed, Jul 20, 2016 at 5:16 PM, Daniel Wheeler <daniel.wheel...@gmail.com>
wrote:

> I think you need to wait by volume, basically you're calculating "\int
> ( \phi - \phi^*)^2 dV" for the L2 norm, where \phi^* is the ideal
> solution and \phi is the calculated solution.
>
> You may also need to do a second order accurate integral in order to
> see second order convergence.
>
> On Wed, Jul 20, 2016 at 5:03 PM, Raymond Smith <smit...@mit.edu> wrote:
> > Thanks.
> >
> > And no, I'm not sure about the normalization for grid spacing. I very
> well
> > could have calculated the error incorrectly. I just reported the root
> mean
> > square error of the points and didn't weight by volume or anything like
> > that. I can change that, but I'm not sure of the correct approach.
> >
> > On Wed, Jul 20, 2016 at 4:25 PM, Daniel Wheeler <
> daniel.wheel...@gmail.com>
> > wrote:
> >>
> >> On Wed, Jul 20, 2016 at 1:30 PM, Raymond Smith <smit...@mit.edu> wrote:
> >> > Hi, FiPy.
> >> >
> >> > I was looking over the diffusion term documentation,
> >> >
> >> >
> http://www.ctcms.nist.gov/fipy/documentation/numerical/discret.html#diffusion-term
> >> > and I was wondering, do we lose second order spatial accuracy as soon
> as
> >> > we
> >> > introduce any non-uniform spacing (anywhere) into our mesh? I think
> the
> >> > equation right after (3) for the normal component of the flux is only
> >> > second
> >> > order if the face is half-way between cell centers. If this does lead
> to
> >> > loss of second order accuracy, is there a standard way to retain 2nd
> >> > order
> >> > accuracy for non-uniform meshes?
> >>
> >> This is a different issue than the non-orthogonality issue, my mistake
> >> in the previous reply.
> >>
> >> > I was playing around with this question here:
> >> > https://gist.github.com/raybsmith/e57f6f4739e24ff9c97039ad573a3621
> >> > with output attached, and I couldn't explain why I got the trends I
> saw.
> >> > The goal was to look at convergence -- using various meshes -- of a
> >> > simple
> >> > diffusion equation with a solution both analytical and non-trivial,
> so I
> >> > picked a case in which the transport coefficient varies with position
> >> > such
> >> > that the solution variable is an arcsinh(x). I used three different
> >> > styles
> >> > of mesh spacing:
> >> > * When I use a uniform mesh, I see second order convergence, as I'd
> >> > expect.
> >> > * When I use a non-uniform mesh with three segments and different dx
> in
> >> > each
> >> > segment, I still see 2nd order convergence. In my experience, even
> >> > having a
> >> > single mesh point with 1st order accuracy can drop the overall
> accuracy
> >> > of
> >> > the solution, but I'm not seeing that here.
> >> > * When I use a mesh with exponentially decreasing dx (dx_i = 0.96^i *
> >> > dx0),
> >> > I see 0.5-order convergence.
> >>
> >> That's strange. Are you sure that all the normalization for grid
> >> spacing is correct when calculation the norms in that last case?
> >>
> >> > I can't really explain either of the non-uniform mesh cases, and was
> >> > curious
> >> > if anyone here had some insight.
> >>
> >> I don't have any immediate insight, but certainly needs to addressed.
> >>
> >> --
> >> Daniel Wheeler
> >> _______________________________________________
> >> fipy mailing list
> >> fipy@nist.gov
> >> http://www.ctcms.nist.gov/fipy
> >>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
> >
> >
> >
> > _______________________________________________
> > fipy mailing list
> > fipy@nist.gov
> > http://www.ctcms.nist.gov/fipy
> >   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
> >
>
>
>
> --
> Daniel Wheeler
> _______________________________________________
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to