Skip to content

[BUG/ISSUE] FIX must be the 2nd argument passed to FunTemplate in int/feuler.f90- #60

@yantosca

Description

@yantosca

While testing the carboncycle simulation in GEOS-Chem (which uses the Forward-Euler integrator, int/feuler.f90), I was getting negative concentrations that were hard to pin down. Long story short, I traced this to this line of code:

KPP/int/feuler.f90

Lines 199 to 200 in d690142

!~~~> Compute equation rates and time derivative of variable species
CALL Fun( Y, VAR, RCONST, Ydot )

but the generated Fun routine always takes the vector of fixed species concentrations (FIX) as the 2nd argument:

SUBROUTINE Fun ( V, F, RCT, Vdot, Aout, Vdotout )

! V - Concentrations of variable species (local)
  REAL(kind=dp) :: V(NVAR)
! F - Concentrations of fixed species (local)
  REAL(kind=dp) :: F(NFIX)

This led to the F dummy-argument variable being set to a random negative number and propagating negatives through the code.

The fix is just to change

CALL Fun( Y, VAR, RCONST, Ydot ) 

to

CALL Fun( Y, FIX, RCONST, Ydot ) 

in int/feuler.f90. I will submit a PR soon for this for KPP 3.0.0.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingintegratorsRelated to numerical integrators

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions