[aspect-devel] muparser and Floating point exception from divide by zero.

Magali Billen mibillen at ucdavis.edu
Tue Jul 3 06:53:20 PDT 2018


Thanks for you help with this. I can rewrite this using the lazy expression ( ? : ), nesting them does not seem to be a problem.

Also, good idea to add some examples with this in the cookbooks … I had seen the ? :  syntax on the muparser page, but noticed that it
was not in any of the examples for aspect, so I wasn’t sure if I could use it or not.
-Magali


> On Jun 30, 2018, at 6:43 PM, Bob Myhill <myhill.bob at gmail.com> wrote:
> 
> Mea culpa. Thanks for the info, Timo! 
> Bob
> 
> On Sat, 30 Jun 2018, 16:57 Timo Heister, <heister at clemson.edu <mailto:heister at clemson.edu>> wrote:
> Bob,
> 
> > You're using a muParser if syntax that was deprecated a few years ago.
> 
> This is not quite correct. "if(expression, A, B)" is actually an a
> function we register with function parser inside deal.II. The problem
> is of course that A and B are evaluated before the expression is
> checked and divisions by zero would generate an error. This never
> occurred to me before. Oops. :-)
> 
> > The new syntax uses lazy evaluation to evaluate only the required branch of the if-statement. Try this:
> >
> > x>0 ? TS+(TM-TS)*(1-erfc((YMAX-y)/(2*sqrt(K*x/VSUB)))) : TM
> 
> I checked and this does work (my example would be "(expression) ? (A)
> : (B)") . Great!
> _______________________________________________
> Aspect-devel mailing list
> Aspect-devel at geodynamics.org <mailto:Aspect-devel at geodynamics.org>
> http://lists.geodynamics.org/cgi-bin/mailman/listinfo/aspect-devel <http://lists.geodynamics.org/cgi-bin/mailman/listinfo/aspect-devel>_______________________________________________
> Aspect-devel mailing list
> Aspect-devel at geodynamics.org
> http://lists.geodynamics.org/cgi-bin/mailman/listinfo/aspect-devel

____________________________________________________________
Professor of Geophysics 
Earth & Planetary Sciences Dept., UC Davis
Davis, CA 95616
2129 Earth & Physical Sciences Bldg.
Office Phone: (530) 752-4169
http://magalibillen.faculty.ucdavis.edu

Currently on Sabbatical at Munich University (LMU)
Department of Geophysics (PST + 9 hr)

Avoid implicit bias - check before you submit: 
http://www.tomforth.co.uk/genderbias/
___________________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geodynamics.org/pipermail/aspect-devel/attachments/20180703/dd5bbdeb/attachment.html>


More information about the Aspect-devel mailing list