Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tempus: Add a new temporal integrator #13669

Open
delcmo opened this issue Dec 13, 2024 · 7 comments
Open

Tempus: Add a new temporal integrator #13669

delcmo opened this issue Dec 13, 2024 · 7 comments

Comments

@delcmo
Copy link

delcmo commented Dec 13, 2024

Question

Hello,

I am looking at adding a new temporal integrator to a Trilinos-based application. I currently rely on SDIRK steppers but would also like to test exponential integrators. As a first step, I would like to duplicate one of the Tempus steppers and have it available in my application. It is not clear to me how to add a new stepper to packages/tempus/src/Tempus_StepperFactory_impl.hpp. Is there an example that shows how to do that? Is that the correct approach?

Thanks,

Marco

@cgcgcg
Copy link
Contributor

cgcgcg commented Dec 13, 2024

@ccober6

@ccober6
Copy link
Contributor

ccober6 commented Dec 16, 2024

Morning @delcmo! The Tempus Stepper Factory is just a simple "if-else if" factory (never got a chance to add in an better factory :) ), so to add another stepper you can just add another "else if" conditional with your stepper in createStepper(stepperType, stepperPL, model). Make sure your new stepper has a non-member constructor, e.g., createStepperNewStepperName(model, pl) for the "else if" statement, and make sure it is included in packages/tempus/src/Tempus_StepperFactory_impl.hpp.

If you are looking for the ability to have the application add its stepper to the factory during runtime, Tempus currently does not have that capability, and would need a better factory. :)

@delcmo
Copy link
Author

delcmo commented Dec 16, 2024

@ccober6 Thanks for your reply.

We noticed that each stepper class has a *.ccp file, a *_decl.hpp file, and a *_impl.hpp file. We also noticed that a *.hpp file is also included in the factory class. How is the *hpp file generated?

@ccober6
Copy link
Contributor

ccober6 commented Dec 16, 2024

The .hpp files are generated during the build. If you look at the Backward Euler stepper files (i.e., Tempus_StepperBackwardEuler), it gives you a template of what is needed. It is pretty much boilerplate.

If you would like to talk through the AppAction, it might be better to have a meeting.

@delcmo
Copy link
Author

delcmo commented Dec 17, 2024

Ok, thanks. We were able to duplicate Backward Euler stepper files and test it with unit tests. We will try to call that duplicated Backward Euler stepper from our application.

@ccober6 what do you mean by AppAction?

@ccober6
Copy link
Contributor

ccober6 commented Dec 17, 2024

AppAction is a generalized Observer class that Steppers use to inject "application actions" into a Stepper (e.g., monitor solution, compute intermediate variables (energy), suggest next time step size, ...). For example, Tempus_StepperBackward_impl.hpp, there are four action locations: BEGIN_STEP, BEFORE_SOLVER, AFTER_SOLVER, and END_STEP. If the application would like it can inject some code at these locations (i.e., a call-back to the application).

Each Stepper may have different action locations. For example, DIRK methods (Tempus_StepperDIRK_impl.hpp) have the following action locations: BEGIN_STEP, BEGIN_STAGE, BEFORE_SOLVER, AFTER_SOLVER, BEFORE_EXPLICIT_EVAL, END_STAGE, and END_STEP.

For your stepper, you can ignore the AppAction capability unless you would like to have it. If you would like to add it to the Trilinos repo, we can work with you to include the AppAction if you like.

@delcmo
Copy link
Author

delcmo commented Dec 18, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants