DSSAT / dssat-csm-os

DSSAT Cropping System Model
BSD 3-Clause "New" or "Revised" License
143 stars 169 forks source link

for reserves to ROOT if conc too great (overflow!) #407

Open gelianxing opened 4 months ago

gelianxing commented 4 months ago

IF (((LFWT+GROLF-SENLFG-SENLFGRS) ! Prevent divide by zero & +(STWT+GROST)+(RSWT+GRORS)) .GT. 0.0)THEN TVR1 = ! Conc & (RSWT+GRORS-SENRS)/ & ((LFWT+GROLF-SENLFG-SENLFGRS) & +(STWT+GROST)+(RSWT+GRORS)) ELSE TVR1 = 0.0 END IF

SENLFG、SENLFGRS why these variables use yesterday’s variables,maybe can move to integr

chporter commented 4 months ago

This is in CER_Growth.for, line 737. TVR1 uses values SENLFG and SENLFGRS which are calculated later in the routine. Maybe this TVR1 calculation could be moved later in the routine to use today's senescence values. I don't think it should go to integrate because it is still a rate calculation. @palderman @GerritHoogenboom @fabiooliveira72 - if you have time, please have a look.

palderman commented 4 months ago

Linking directly for convenience:

https://github.com/DSSAT/dssat-csm-os/blob/185324fdc20d17bb3478950d2358f0f8268f26e2/Plant/CERES-Wheat_Barley/CER_Growth.for#L737-L745

Just did a quick search and we'd need to be careful about where we move it, because TVR1 is used to calculate RTWTGRS just below:

https://github.com/DSSAT/dssat-csm-os/blob/185324fdc20d17bb3478950d2358f0f8268f26e2/Plant/CERES-Wheat_Barley/CER_Growth.for#L748-L763

and RTWTGRS is then used subsequently:

https://github.com/DSSAT/dssat-csm-os/blob/185324fdc20d17bb3478950d2358f0f8268f26e2/Plant/CERES-Wheat_Barley/CER_Growth.for#L779

https://github.com/DSSAT/dssat-csm-os/blob/185324fdc20d17bb3478950d2358f0f8268f26e2/Plant/CERES-Wheat_Barley/CER_Growth.for#L884

The dependency graph seems to balloon rather quickly after that. Would it be easier to move senescence calculations earlier?

chporter commented 4 months ago

@palderman Thanks for looking. Yes, maybe. But it might be circular logic and we just need to live with the fact that this is a daily model.

gelianxing commented 4 months ago

I agree move senescence calculations earlier