Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct calculations of snow precipitation #279

Open
MostafaGomaa93 opened this issue Feb 14, 2025 · 9 comments · May be fixed by #282
Open

Correct calculations of snow precipitation #279

MostafaGomaa93 opened this issue Feb 14, 2025 · 9 comments · May be fixed by #282
Labels
code enhancement New feature or request

Comments

@MostafaGomaa93
Copy link
Contributor

MostafaGomaa93 commented Feb 14, 2025

The snow precipitation was not calculated correctly in the code. There are a couple of issues that are solved in this branch

In principle, at any timestep, if surface temperature is <= zero, then precipitation is snow (not liquid) and should not be used in this time step. Rather, this snow_precipitation should be accumulated and go to next time step. At any of the further time steps, once surface temperature becomes > 0, then the accumulated snow precipitation is added to the liquid precipitation of this particular time step to define the total available precipitation. Then also proper runoff and infiltration will be calculated

The following corrections are implemented

  1. The accumulated snow precipitation was set to zero every timestep (see here), so the accumulation is wrong. Instead, the accumulated snow precipitation:
    a) has a more representative name Precip_snowAccum
    b) is initialized with zero value at the first time step (Lines 48-52)
    c) goes back to zero again once the surface temperature becomes > 0 (Line 70).
  2. Proper accumulation based on the surface temperature value is done:
    a) As long as surface temperature is < 0 -> then precipitation will be accumulated in snow precipitation (Lines 54-62).
    b) Once surface temperature is > 0 -> accumulated snow precipitation is added to liquid precipitation (lines 63-71).
  3. Because these modifications are done in the +soilmoisture/calculateBoundaryConditions.m, which runs through the STEMMUS iteration loop within every time step (loop start here, and the calculations are part of the loop here), these snow_precipitation calculations has to be done only once per time step (and not per every iteration within the time step), so an if condition is added for that purpose (Line 58 and Line 64).
  4. This Precip variable refers actually to the applied infiltration (after removing runoff) so, it got a more representative name applied_inf (here) and added to the ForcingData structure (also for BMI purposes)
@MostafaGomaa93 MostafaGomaa93 added the code enhancement New feature or request label Feb 14, 2025
@MostafaGomaa93
Copy link
Contributor Author

Here is also a half-day example that shows the precipitation calculations. From time steps 8 to 11, surface temperature is less than zero, and snow precipitation is accumulated. At time step 12, surface temperature is > 0, and the accumulated snow precipitation goes to liquid precipitation. Same again in time step 23 and 24.

timestep Surface_temp Precip Precip_liquid Precip_snow Precip_snowAccumlated Applied_inf R_Hort R_Dunn Runoff
  C mm 30min-1 mm 30min-1 mm 30min-1 mm 30min-1 mm 30min-1 mm 30min-1 mm 30min-1 mm 30min-1
1 1.12 5.04 5.04 0 0 4.41 0 0.63 0.63
2 1.13 5.04 5.04 0 0 4.41 0 0.63 0.63
3 1.03 12.24 12.24 0 0 8.57 2.15 1.52 3.67
4 0.96 10.44 10.44 0 0 4.39 4.76 1.3 6.05
5 0.85 5.04 5.04 0 0 4.41 0 0.63 0.63
6 0.67 0 0 0 0 0 0 0 0
7 0.54 0 0 0 0 0 0 0 0
8 -0.93 6.84 0 6.84 6.84 0 0 0 0
9 -0.91 0.05 0 0.05 6.89 0 0 0 0
10 -0.87 14.94 0 14.94 21.83 0 0 0 0
11 -0.84 0.15 0 0.15 21.98 0 0 0 0
12 2.82 0 21.98 0 0 4.38 17.6 0 17.6
13 3.25 0 0 0 0 0 0 0 0
14 3.19 0.05 0.05 0 0 0.04 0 0.01 0.01
15 0.46 0.05 0.05 0 0 0.04 0 0.01 0.01
16 0.06 0.2 0.2 0 0 0.18 0 0.02 0.02
17 -0.04 0.2 0 0.2 0.2 0 0 0 0
18 -0.09 0.15 0 0.15 0.35 0 0 0 0
19 -0.12 0.15 0 0.15 0.5 0 0 0 0
20 -0.14 0.35 0 0.35 0.85 0 0 0 0
21 -0.16 0.35 0 0.35 1.2 0 0 0 0
22 -0.17 0.3 0 0.3 1.5 0 0 0 0
23 -0.18 0.3 0 0.3 1.8 0 0 0 0
24 0.18 10.08 11.88 0 0 0.29 10.33 1.25 11.58

@bobzsu
Copy link
Contributor

bobzsu commented Feb 16, 2025

Thanks a lot for these efforts, Mustafa.

https://gmd.copernicus.org/articles/14/7345/2021/

I suggest to integrate the snow module UEB if we think this capacity is needed for certain simulations.

Snow melting is a process that depends on precipitation, temperature, the accumulated snow as well as topological, soil and canopy characteristics. All these need to be properly considered if we want to simulate such processes adequately.

@bobzsu
Copy link
Contributor

bobzsu commented Feb 16, 2025

Btw the snow melting itself has also important feedback to radiation balance (by modulating albedo and emissivity) thus affecting in turn water and carbon processes.

Note: albedo, emissivity and surface temperature are observables that can be obtained by remote sensing. These can be assimilated into STEMMUS-SCOPE via BMI and open-DA.

@MostafaGomaa93
Copy link
Contributor Author

Thanks a lot for these efforts, Mustafa.

Snow melting is a process that depends on precipitation, temperature, the accumulated snow as well as topological, soil and canopy characteristics. All these need to be properly considered if we want to simulate such processes adequately.

Hi @bobzsu, I am not sure if the snow module is already in the code or not. But I agree with you about integrating it (if it is not done yet). I just heard this week from @yijianzeng that part of the research of Chen Yunfei is going to focus on snow processes. We could then after his qualifier start to implement the snow module and make it an option (to switch it on/off) based on user request. and also make sure that all characteristics that affect the snow processes are integrated and work correctly with other functions in the code. That will need a couple of testing and checking and we can all as a group contribute to that.

@yijianzeng
Copy link
Contributor

Hi @bobzsu, I am not sure if the snow module is already in the code or not.

@MostafaGomaa93 Hi Mostafa, UEB is not yet in the current STEMMUS-SCOPE version. It is published on Zenodo, though. https://zenodo.org/records/3975846

I just heard this week from @yijianzeng that part of the research of Chen Yunfei is going to focus on snow processes.

Yunfei Chen is not going to focus on snow processes but on the freezing/thawing process.

start to implement the snow module and make it an option (to switch it on/off) based on user request. and also make sure that all characteristics that affect the snow processes are integrated and work correctly with other functions in the code. That will need a couple of testing and checking and we can all as a group contribute to that.

this is a good suggestion.

@yijianzeng
Copy link
Contributor

2. b) Once surface temperature is > 0 -> accumulated snow precipitation is added to liquid precipitation (lines 63-71).

It is suggested to move Line 69-70 after Line 65

As such, Precip_snow, and Precip_snowAccum do not need to be assigned with 0 at every iteration.

@MostafaGomaa93
Copy link
Contributor Author

It is suggested to move Line 69-70 after Line 65

As such, Precip_snow, and Precip_snowAccum do not need to be assigned with 0 at every iteration.

Hi @yijianzeng, I think it is the other way around, if Lines 69-70 are moved after Line 65, then the Precip_snow and Precip_snowAccum will be within the iteration loop (Line 64) and will be assigned every iteration as zero. But in both cases (before or after the lines movement), the results will not be affected (only it will affect a little the speed of the calculations)

@yijianzeng
Copy link
Contributor

Hi @yijianzeng, I think it is the other way around,

@MostafaGomaa93
below is the part linked to our discussion

        if KIT == 1 % add accumulated snow of previous time steps to liquid precipitation at first time step when surface temperature > zero
            Precip_liquid = Precip + Precip_snowAccum;
        else
            Precip_liquid = ForcingData.Precip_liquid;
        end
        Precip_snow = 0;
        Precip_snowAccum = 0;

What i suggest is below

        if KIT == 1 % add accumulated snow of previous time steps to liquid precipitation at first time step when surface temperature > zero
            Precip_liquid = Precip + Precip_snowAccum;
            Precip_snow = 0;
            Precip_snowAccum = 0;
        else
            Precip_liquid = ForcingData.Precip_liquid;
        end

As such, 'Precip_snow' and 'Precip_snowAccum' are only assigned with 0, when KIT==1, so they are not assigned with zeros again when KIT=2, 3, ..., 30.

@MostafaGomaa93 MostafaGomaa93 linked a pull request Feb 18, 2025 that will close this issue
9 tasks
@MostafaGomaa93
Copy link
Contributor Author

What i suggest is below

        if KIT == 1 % add accumulated snow of previous time steps to liquid precipitation at first time step when surface temperature > zero
            Precip_liquid = Precip + Precip_snowAccum;
            Precip_snow = 0;
            Precip_snowAccum = 0;
        else
            Precip_liquid = ForcingData.Precip_liquid;
        end

As such, 'Precip_snow' and 'Precip_snowAccum' are only assigned with 0, when KIT==1, so they are not assigned with zeros again when KIT=2, 3, ..., 30.

Ah okay, I test your suggestion but I received an error (Unrecognized function or variable 'Precip_snow')

So, a solution is

    if KIT == 1 % add accumulated snow of previous time steps to liquid precipitation at first time step when surface temperature > zero
        Precip_liquid = Precip + Precip_snowAccum;
        Precip_snowAccum = 0;
    else
        Precip_liquid = ForcingData.Precip_liquid;
    end
    Precip_snow = 0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code enhancement New feature or request
Projects
None yet
3 participants