Eawag-AppliedSystemAnalysis / Simstrat

Simstrat - 1D lake model
http://www.eawag.ch/en/department/surf/projects/simstrat/
GNU General Public License v3.0
18 stars 8 forks source link

Double forcing read for forcing_model==1 #57

Closed akesandgren closed 2 years ago

akesandgren commented 2 years ago

In forcing_update there is a double read when forcing_model == 1

      ! Forcing mode 1 (date, U10, V10, T_lake, H_sol)
      if (cfg%forcing_mode == 1) then
         if (cfg%ice_model == 1) then
            call error('Ice module not compatible with forcing mode 1, use 2, 3 or 5.')
         end if

         call self%read (state%datum, A_s, A_e, A_cur, 4 + nval_offset, state%first_timestep)
         call self%read (state%datum, A_s, A_e, A_cur, 4 + nval_offset, state%first_timestep)
         state%u10 = A_cur(1)*param%f_wind ! MS 2014: added f_wind
         state%v10 = A_cur(2)*param%f_wind ! MS 2014: added f_wind
f-baerenbold commented 2 years ago

I agree with you, there is no need for a double line there. Have you checked whether it changes the simulation when you delete one of the "reads"? I think it should not change because the right time interval is checked in the read function. So it just reads the same values twice.

akesandgren commented 2 years ago

It may cause problems when state%first_timestep=true for newer GCC compilers since it will then open the file twice with the same descriptor. Otherwise it doesn't look like it will cause any problems.

It's just something I noticed when looking for the problem in issue 58

f-baerenbold commented 2 years ago

Yes, sure I'll delete it. Was just curious.

f-baerenbold commented 2 years ago

Closed with 84baf85ab78963c8564a5b75204630a06795ede4