# Initial condition is not being loaded correctly

Dear Helpdesk,

Hope everything is well. I have set up initial condition in my rose suite file but when I output it the initial value becomes something different. I am not sure what is happening. I wonder if you have some knowledge about this.

Thanks a lot for your help.

Best,
Wenyao

Hi Wenyao:
You can address most of your JULES HelpDesk topics/tickets with ‘Dear Patrick’ instead of ‘Dear Helpdesk’, since I am the only person who has been answering these topics/tickets. If it is about something else, or if you know that I am not available, then ‘Dear Helpdesk’ is fine.

Isn’t `t_growth_gb` the time-average of the last 30 days of the near-surface air-temperature? Do you know what happens on the 1st day of the simulation? How does it handle the averaging from an initial condition of the previous time-step together with the 29 days prior to the previous time-step?
Patrick

Hi Patrick,

Thanks for your help. I will address to you directly from now on. I am showing the simulation of the first day of BE_VIE in my previous post.

I have changed the t_growth_gb to calculate a 15 day average of noon condition (10.30-13.30). So t_growth_gb for time before 1999-07-18 10:30:00 should be the same as the initial condition I provide which is 278.314? As you can seen above, it is updating as required but the values are different. I am not sure what is happening in between.
This is my alteration to the t_growth_gb

Best,
Wenyao

Hi Wenyao:
According to your code, `t_growth_gb(l)` should be `t1(l)` after the first time step; it shouldn’t be equal to 278.314 Kelvin after the first time step. This is since `t1(l) - t_growth_gb(l) = 0.0`, so the 2nd line where the `t_growth_gb(l)` is adjusted, sets `t_growth_gb(l)` equal to itself.

I don’t see the code for after the first time step. Maybe you want to put and `END IF` on the next line after `t_growth_gb(l) = t1(l)`? You might want to put your initial values for `l_growth_gb(l)` and `pstar_growth_gb(l)` inside that `IF` statement as well?

You can also put print statements inside this loop, to verify that it’s doing what you want.

Are you doing a spinup prior to this initialization?
Patrick

``````    start_hour = 10
start_minute = 30
end_hour = 13
end_minute = 30
! Calculate the corresponding start and end time steps within the timestep
start_timestep = (start_hour * 3600. + start_minute * 60.)
end_timestep = (end_hour * 3600. + end_minute * 60.)
current_time_pmodel = current_time%TIME

IF (current_time_pmodel >= start_timestep                                 &
.AND. current_time_pmodel <= end_timestep) THEN
print *, 'running if'
DO m = 1,veg_pts
l = veg_index(m)
! Check if the current timestep is within the desired time range
! print *, current_time_pmodel >= start_timestep                           &
!                        .AND. current_time_pmodel <= end_timestep
alpha_acclim = 1.0 - EXP( -1.0 * timestep_real                           &
/ ( n_day_photo_acclim * rsec_per_day_noon ) )
IF (t_growth_gb(l) == 278.314) THEN
! Load initial value, update initial with the first available data
t_growth_gb(l) = t1(l)
t_growth_gb(l)  =   t_growth_gb(l)                                     &
+ alpha_acclim * ( t1(l) - t_growth_gb(l) )
l_growth_gb(l) = l_growth_gb(l)                                        &
+ alpha_acclim * ( fpar(l)*icr(l) - l_growth_gb(l))
l_growth_gb(l) = fpar(l) * icr(l)
pstar_growth_gb(l) = pstar(l)
pstar_growth_gb(l) = pstar_growth_gb(l)                                &
+ alpha_acclim *  (pstar(l) -pstar_growth_gb(l) )
vpd(l) = 611.2 * EXP((17.62 * (t1(l) - 273.15))                        &
/(243.12 + (t1(l) - 273.15))) - dq(l) * pstar(l)      &
/((1- repsilon) * dq(l) + repsilon)
vpd_growth_gb(l) = vpd(l)
vpd_growth_gb(l) = vpd_growth_gb(l)                                    &
+ alpha_acclim *  (vpd(l) -vpd_growth_gb(l) )
co2_growth_gb(l) = ca(l)
co2_growth_gb(l) = co2_growth_gb(l)                                    &
+ alpha_acclim * ( ca(l) - co2_growth_gb(l) )
ELSE
t_growth_gb(l)  =   t_growth_gb(l)                                 &
+ alpha_acclim * ( t1(l) - t_growth_gb(l) )
!Update the growth temp for the thermal acclimation of photosynthesis K

l_growth_gb(l) = l_growth_gb(l)                                    &
+ alpha_acclim * ( fpar(l)*icr(l) - l_growth_gb(l))
!Update the growth light for the thermal acclimation of photosynthesis and
! units of light from mol to umol

pstar_growth_gb(l) = pstar_growth_gb(l)                              &
+ alpha_acclim *  (pstar(l) -pstar_growth_gb(l) )
!Update the growth surface pressure for the thermal acclimation of
!photosynthesis.

vpd(l) = 611.2 * EXP((17.62 * (t1(l) - 273.15))                      &
/ (243.12 + (t1(l) - 273.15)))
vpd_growth_gb(l) = vpd_growth_gb(l)                                  &
+ alpha_acclim *  (vpd(l) -vpd_growth_gb(l) )
!Update the growth vapour pressure deficit for the thermal acclimation of
!photosynthesis.Three coefficients of the Magnus equation for saturated
!vapour pressure

co2_growth_gb(l) = co2_growth_gb(l)                                  &
+ alpha_acclim * ( ca(l) - co2_growth_gb(l) )

END IF
END DO
END IF
``````

Dear Patrick,

I have copied my code in. So the logic is during 10.30-13.30, if the t_growth_gb == 278.314 (initial condition hence first timestep), t_growth_gb is then t(1), if t_growth_gb no longer equals to 278.314 (hence not first time step), they do acclimation t_growth_gb(l) = t_growth_gb(l) &
+ alpha_acclim * ( t1(l) - t_growth_gb(l) )

Thanks, Wenyao:
So, does `t1(l) = 275.2168` Kelvin at the 1st time step? If it does, then `t_growth_gb(l) = t1(l)`, and then maybe your code is working properly?

How often are you printing out `t_growth_gb(l)`? Is it every hour or every day?

Do you want to initialize `l_growth_gb(l)` in the same way as you initialize `t_growth_gb(l)`? If you do, then maybe you can put the line `l_growth_gb(l) = fpar(l) * icr(l)` in a position that is one line earlier. Or you can get rid of these 3 lines in the code block of `IF (t_growth_gb(l) == 278.314) THEN `:

``````         t_growth_gb(l)  =   t_growth_gb(l)                                     &
+ alpha_acclim * ( t1(l) - t_growth_gb(l) )
l_growth_gb(l) = l_growth_gb(l)                                        &
+ alpha_acclim * ( fpar(l)*icr(l) - l_growth_gb(l))
pstar_growth_gb(l) = pstar_growth_gb(l)                                &
+ alpha_acclim *  (pstar(l) -pstar_growth_gb(l) )
``````

Those 3 lines don’t really do anything, due to your initializations.

How would your code work if sometime after the first time step the temperature is equal to the first time step’s temperature? (t_growth_gb(l) == 278.314). I know this might be a small chance, but you might need to deal with that chance someday.
Patrick

Dear Patrick,

Here’s the thing. Since I have set t_growth_gb to be 278.314 initially. That means all valued of t_growth_gb before 10.30 should remain 278.314 because acclimation hasnt started yet. But now it has become 275.2168. That is the thing that been confusing.
figure below shows how I think the code should do?

As for your questions: I am printing out t_growth_gb every half hour.
and for your concern I totally get it, I am just using this for a test. I guess we can change this to a more extreme value to avoid this? or if you have got a better solution for this.

Thanks agin for your time and help.

Best,
Wenyao

Hi Wenyao:
Thanks for explaining so well.

Maybe you need an `ELSE` statement before the last `END IF` and after the last `END DO` in your code, explaining what your code should do if `current_time_pmodel < start_timestep` or if `current_time_pmodel > end_timestep`?

I don’t think your code ever reaches the statement `IF (t_growth_gb(l) == 278.314) THEN `, since you have a conditional before that about the `current_time_pmodel`.
Patrick

is never reached. Then at one point the t_growth_gb should be 278.314 because it’s not been updated. I don’t get why the number gets to something 275.

Best,
Wenyao

Hi Wenyao:
Maybe `t_growth_gb` gets set to something like `275` in some other part of the code? You can do a `grep -ir t_growth_gb *`, to find out about any other places that `t_growth_gb` is used.
Patrick

Hi Wenyao:
One more thing: maybe you can also try to put different print statements in different parts of the code which show the value of `t_growth_gb(l)`? Maybe that would help?
Patrick

Dear Patrick,

I wonder which temperature variable is corresponding to the FLUXNET temperature? would spin up affect the value? I discovered that the value of t1 variable in the sf_stom is is different the temperature value from the driving data that’s in the rose suite.

Best,
Wenyao

Hi Wenyao:
Yes, the t1 variable in the Acclimation code for FORTRAN for JULES is the temperature of the lowest atmospheric level (level 1), for the ice or liquid water temperature. The lowest atmospheric level used by the UM is variable height, I think, and it could be as high as 10 meters, but I could be mistaken.