Right, ok, it should be as simple as throwing CutTimeStep instead of Errors::Message, though that may be an implicit thing only, or possible just returning false in Advance step rather than throwing. I can take a look – is the run a simple one that you could send me xml?
Ethan
--
-------------------------------------------------------------------------
Ethan Coon
Senior Research Scientist
Oak Ridge National Laboratory
https://www.ornl.gov/staff-profile/ethan-t-coon
-------------------------------------------------------------------------
I’m not sure what you would like to have happen. Behavior == RAISE and behavior == ABORT will both terminate the simulation. Behavior == ABORT terminates immediately, do not pass go, with SIGABRT. Behavior == RAISE throws an error, which then unwinds through the calling stack to see if someone is going to catch it. If no one catches it, it also terminates with SIGABRT.
ATS does not wrap the entire “main” in a try/catch. So currently all calls to amanzi_throw(Errors::Message) will terminate with SIGABRT.
I believe this mechanism was introduced in Day 1 of Amanzi when the thinking was that it would get wrapped in Akuna, which would be doing UQ with Amanzi, and would therefore catch Errors::Message as a way of just saying “this set of parameters resulted in a bad run, move on.”
Don’t try to catch Errors::Message. If you’re going to catch something, throw a special error and catch that. A bit of explanation of what you’re trying to throw and catch would help.
Ethan
From: ats-...@googlegroups.com <ats-...@googlegroups.com> on behalf of Sergi Molins Rafa <smo...@lbl.gov>
Date: Thursday, August 3, 2023 at 4:56 PM
To: Coon, Ethan <coo...@ornl.gov>
Cc: Amanzi-ATS Users <ats-...@googlegroups.com>
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-users/CAP9Hfk7pCv103hqEyPvLNFRa-hYm1tZV2_0RC%3D7OCXQEELXtBA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-users/4308936a-dfc2-4b88-8d06-86b73499a4d7n%40googlegroups.com.
Great, I’ll look at it ASAP. We have quite the backlog of PRs for Konstantin and I to go through, in both ATS and Amanzi! Which is great. We’ll work through these and hopefully get out a new release this fiscal year.
As to users of TimestepController, the only one I’m aware of currently is in src/time_integration/BDF1_TI.hh, which isn’t really a PK, but should help show how to use it. Obviously that one is set up around nonlinear iteration counts for a single, collective nonlinear solve. I’m not sure whether you want that or not – you’d have to come up with some way of choosing the dt based on iteration counts from NCELL different solves.
Alternatively, you could just enforce in code that min_iterations to 1, max_iterations to INF, and effectively just use the “time step reduction factor” to decrease dt on failure. The question then is whether you want to recover the bigger dt once you get through the “hard” part. Since you’re not really subcycling here, I’m assuming that you have to have the same dt across all cells... Some more thought required!
Ethan
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-users/CAP9Hfk4yw5jO%3Dje%3DwG5yrVtiU%3DHmwb-5RFCW41_iWa-QcMqbSg%40mail.gmail.com.