Opened 7 years ago

Closed 5 years ago

#115 closed defect (fixed)

Hydrology unitilialized variables and hydrol_split_soil

Reported by: mmcgrath Owned by: jgipsl
Priority: minor Milestone:
Component: Physical processes Version:
Keywords: Cc:

Description

Hi. I was compiling the branch with NAG on Curie, and I found what seem to be a couple bugs also present in the trunk in hydrol.f90.

The first is with hydrol_split_soil. It is called at the beginning of subroutine. However, all of the variables to it are INTENT(IN) (it looks like it is used for some diagnostics). The variable evap_bare_lim is used in hydrol_split_soil, but it is only calculated in hydrol_soil after hydrol_split_soil is called. It is an INTENT(OUT) in hydrol_soil, so it is never initalized when hydrol_split_soil is called.

The second is with resdist, which is declared as an array of DIMENSION(kjpindex, nvm) in hydrol_vegupd. In the rest of hydrology, it is declared as (kjpindex, nstm). This seems to be a bug, and could have some influences elsewhere if memory is getting overwritten (nvm is greater than nstm).

The last is with qsintveg. It is an INTENT(OUT) in hydrol_main, but it is treated as a SAVED variable, i.e. it is initialized in the first call, but not in subsequent calls. So after the first call it is passed to hydrol_vegupd and hydrol_tmc_update uninitialized. It seems like it should either be a SAVED variable or set to zero at the beginning of hydrol_main every time.

Change History (6)

comment:1 Changed 7 years ago by aducharne

Hi Matthew.

Firstly, the dimension of resdist should be (kjpindex, nstm).

Regarding evap_bare_lim, its role is to convey information about the control of soil moisture onto bare evaporation from one time step to the next one. The variable that is computed at the end of hydrol_soil and saved is evap_bare_lim_ns, holding the values of evap_bare_lim per soiltile. And the variable that is used in hydrol_soil is evap_bare_lim, which is only an INTENT(OUT) argument of hydrol_soil.

So I'm afraid you're right, and I wonder how it can impact the calculation of bare soil evaporation, over which we are struggling right now.

It also seems this problem is similar to the one you report on qsintveg.

Agnès

comment:2 Changed 7 years ago by aducharne

evap_bare_lim and qsintveg are declared as SAVED variables in sechiba.f90
-- Agnès

comment:3 Changed 7 years ago by aducharne

  • Owner changed from somebody to aducharne
  • Status changed from new to accepted

comment:4 Changed 6 years ago by jgipsl

  • Owner changed from aducharne to jgipsl

1) evap_bare_lim and evap_bare_lim_ns are used in hydrol_split_soil(intent IN) before they are calculated further down in hydrol_soil. None of them are set in restart file.

Following will be done:

  • evap_bare_lim_ns added in restart file, read in hydrol_var_init
  • evap_bare_lim : calculated from evap_bare_lim_ns in hydrol_var_init using vegtot and soiltile from previous time step(restart file):
    evap_bare_lim(ji) =  SUM(evap_bare_lim_ns(ji,:)*vegtot(ji)*soiltile(ji,:))
    
  • evap_bare_lim will be set to INOUT in hydrol_main, hydrol_soil and hydrol_split_soil

2) resdist corrected in trunk rev [2399]

3) qsintveg

  • is read from restart file in hydrol_init.
  • in hydrol_var_init, hydrol_tmc_update is called with qsintveg INOUT. It not supposed to change the values if the vegetation did not change. This needs to be checked'''
  • qsintveg is saved in sechiba.
  • qsintveg needs to be intent(INOUT) in hydrol_main. Done in trunk rev [2400]

Agnes, Josefine

comment:5 Changed 5 years ago by jgipsl

Remaining issuses have been treated when resolving 1+1=2, see ticket #143 and commit [2868]

1) evap_bare_lim and evap_bare_lim_ns have been set in restart file. evap_bare_lim can not be calculated as it depends on vegtot in the beginning of the previous time step. veget_max is updated in slowproc after the calculation of evap_bare_lim in hydrol.

evap_bare_lim is INTENT(OUT) in hydrol_soil, INTENT(IN) in hydrol_split_soil and INTENT(INOUT) in hydrol_main.

3) qsintveg : hydrol_tmc_update has been removed from hydrol_var_init for the case were restart file was read.

I believe that this ticket now can be closed.

comment:6 Changed 5 years ago by jgipsl

  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.