EDmodel / ED2

Ecosystem Demography Model
78 stars 112 forks source link

Subroutine init_ed_cohort_vars() is incomplete? #99

Closed DanielNScott closed 9 years ago

DanielNScott commented 9 years ago

I've found it's missing at least cpatch%dbh and cpatch%basarea. Is there some reason these are not being initialized to zero there?

I have yet to perform a fuller check, but I will do so and report back...

mpaiao commented 9 years ago

@DanielNScott I'm 99% sure that there is a reason for some variables to not be initialized there, but I don't remember exactly why. I think variables that are not initialized there must be set in reproduction and during the main initialization (reading pss/css files).

DanielNScott commented 9 years ago

I just found out why! When I changed it, some debugging output I had put in told me that after initialization everything had a dbh of zero, then stuff blew up:

 === Finish initialization; CPU(sec)=0.37; Wall(sec)=0.03; Time integration starts (ed_master) ===

 === Time integration starts (model) ===
 - Simulating:   06/01/2010 00:00:00 UTC
==================================================
    No second guess for you...
==================================================
zstar  =            NaN rough  =            NaN
lnzoz0m=            NaN lnzoz0h=            NaN
rib    =            NaN ribuse=            NaN
stable = T
fun    =            NaN delta  =            NaN
zetaa  =            NaN funa   =            NaN
zetaz  =            NaN funz   =            NaN
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

--------------------------------------------------------------
                     !!! FATAL ERROR !!!
--------------------------------------------------------------
    ---> File:        canopy_air_coms.f90
    ---> Subroutine:  zoobukhov8
    ---> Reason:      Failed finding the second guess for regula falsi
--------------------------------------------------------------
 ED execution halts (see previous error message)...
--------------------------------------------------------------

Anyway, the issue I'm having is that grasses aren't getting their dbh or basarea initialized property (it would seem) so they get crazy values for things like basal area growth. It seems to be an issue related to reproduction, because it's only happening once recruits are formed and everything gets xferred to them.

Actually I think I figured out what the issue is: The routine ed_init_cohort_vars() is being used both for initialization when we already have characteristics we want to keep/not overwrite with zero, and when we want to ACTUALLY initialize everything with recruits before copying...

I'll see if that's the case anyway.

crollinson commented 9 years ago

@mpaiao @DanielNScott This could be related to some similar errors I've had in the past with apparently empty patches and some gross instability when trying to do a spinup. I think there might be something off with the order of patch creation/fusion and something's getting lost in the process (but I haven't checked it out yet).

DanielNScott commented 9 years ago

Hey @crollinson, would you like me to leave this open?

Looking at this SR was part of a check on basal area calculations in the model I've been doing and for now I'm not interested in this particular question anymore; I don't have any reason to believe the issue is actually an issue, and hence am inclined to close it.

crollinson commented 9 years ago

@DanielNScott Go ahead and close it. I'm not sure the issues I've been having are related to this or not. When I get a chance to finally dig into what's going on with the patch fusion etc, I can alway re-open or cite this issue if it turns out to be relevant.