KineticPreProcessor / KPP

The KPP kinetic preprocessor is a software tool that assists the computer simulation of chemical kinetic systems
GNU General Public License v3.0
22 stars 11 forks source link

uploading the implicit12 solver files #101

Open maqsoodrajput opened 4 months ago

maqsoodrajput commented 4 months ago

I have designed a new solver that is faster than the default Rosenbrock solvers. This new solver is inspired by the IMEX solver. I developed it using the standard BE and Sdirk2a because an explicit method would not work for stiff problems. This new solver gave me a 5X speed-up when I used it with the ICON-ART model. The speed-up outweighed the minor loss in accuracy.

There are two files added:

yantosca commented 3 months ago

Thanks @maqsoodrajput for this. I am at the International GEOS-Chem Conference this week so I may be slow to get to this PR. But this sounds like a great new feature for KPP. I can also try to set up the C-I tests for this integrator.

Also tagging @RolfSander @obin1 @msl3v @jimmielin

msl3v commented 3 months ago

@maqsoodrajput excellent!

RolfSander commented 3 months ago

Thanks @maqsoodrajput for providing the new KPP integrator! I will run it with my MECCA chemistry and compare it to Rosenbrock. Hopefully, I'll find the time next week for this...

yantosca commented 3 months ago

@maqsoodrajput @RolfSander: I have been running into an issue where the updated time isn't getting passed back via RSTATUS. I set up a test case with the small_strato mechanism.

   0.0%. T=0.432E+05  O1D= 0.9906E+02; O= 0.6624E+09; O3= 0.5326E+12; NO= 0.8725E+09; NO2= 0.2240E+09; O2= 0.1697E+17; 
 ### TIN, TOUT, in main    43200.000000000000        44100.000000000000 
 ### ierr:, in sdirk           0 
 ### tinitial, tfinal, in sdirk before calling sdirk_integrator:    43200.000000000000        44100.000000000000  
 ### RSTATUS in Sdirk:   0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000     
 ### RSTATE in Main    0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000        0.0000000000000000     
 ### T   0.0000000000000000 

I'm still digging but this means that the simulation is basically stuck in an infinite loop on the same timestep. Feedback greatly appreciated! My updates are in the feature/imex-solver branch.

yantosca commented 3 months ago

I'm still digging but this means that the simulation is basically stuck in an infinite loop on the same timestep. Feedback greatly appreciated! My updates are in the feature/imex-solver branch.

I've added the following code at the end of SDirk_Integrator, which solves the issue in the previous comment:

!~~~>  End of simplified Newton iterations

      ! Successful return
      Ierr  = 1

      ! Return updated time
      RSTATUS(Ntexit) = Tfinal
      RSTATUS(Nhexit) = H

      END SUBROUTINE SDIRK_Integrator

Let me know if you all think this isn't the right thing to do.

RolfSander commented 3 months ago

@maqsoodrajput: Would you like to write a few lines about your new solver which we can add to our KPP documentation? Probably somewhere here: https://kpp.readthedocs.io/en/stable/tech_info/07_numerical_methods.html#sdirk