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
21 stars 11 forks source link

Forwardeuler #38

Closed msl3v closed 2 years ago

msl3v commented 2 years ago

Forward Euler is in and has been tested with multiple mechanism iterations.

msl3v commented 2 years ago

This is for a non-stiff mechanism, to be clear. But the basic ability of KPP to preprocess the mechanism and generate working f90 is unparalleled, in my experience... stiff or non-stiff.

yantosca commented 2 years ago

Hi all, am running into an issue building the feuler test. Because feuler.def uses #JACOBIAN off, the JacobianSP module doesn't get built. But the Makefile assumes that it will be there:

JACSRC = feuler_JacobianSP.F90  feuler_Jacobian.F90
JACOBJ = feuler_JacobianSP.o    feuler_Jacobian.o
...
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# User: modify the line below to include only the
#       objects needed by your application
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ALLOBJ = $(GENOBJ) $(FUNOBJ) $(JACOBJ) $(HESOBJ) $(STMOBJ) \
     $(UTLOBJ) $(LAOBJ)

...

feuler_Main.o: feuler_Main.F90  $(ALLOBJ) feuler_Initialize.o feuler_Model.o feuler_Integrator.o
    $(FC) $(FOPT) -c $<

Wondering if you have a suggested workaround @RolfSander & @msl3v. One thing would be to create an empty JacobianSP file and then it should compile.

yantosca commented 2 years ago

Actually I think I can do this:

ifeq ($(shell test -e KPP_ROOT_JacobianSp.F90 && echo -n yes),yes)
     JACSRC = KPP_ROOT_JacobianSP.F90  KPP_ROOT_Jacobian.F90
     JACOBJ = KPP_ROOT_JacobianSP.o    KPP_ROOT_Jacobian.o
else
     JACSRC = KPP_ROOT_Jacobian.F90
     JACOBJ = KPP_ROOT_Jacobian.o
endif
RolfSander commented 2 years ago

This looks like a general problem when using static dependencies in a Makefile. For our model, we create the dependencies dynamically with the sfmakedepend tool: https://marine.rutgers.edu/po/tools/perl/sfmakedepend

I'm not sure though if the implementation of sfmakedepend is worth the effort in this case. As you already have a solution with test -e, that's fine here.

yantosca commented 2 years ago

Thanks @RolfSander. I've now pushed a fix that works. ForwardEuler is now in dev. Last thing to do is the ReadTheDocs.