-
Notifications
You must be signed in to change notification settings - Fork 6
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
Values of soil temperature when groundwater coupling #242
Comments
🔴 This issue should be fixed before releasing stemmus_scope, see details in #239 |
@BSchilperoort I found the reason for the artifact in your plot, the value of @MostafaGomaa93 is there any condition for the values of |
I also noticed the implementation of |
The issue is still there, it occurs at the groundwater depth. See: If the groundwater level was set to 4 m under the surface, the issue would occur there. |
These are the values of the test that creates the plots: Location=ZA-Kru
|
After our meeting today, I test again by replacing the |
This depends on the temperature value you set for groundwater temperature. See my other comments here. |
Yes, I mean your suggestion by fixing the groundwater temperature = soil temperature wherever GW reaches a certain depth of the soil column. didn't solve the problem yet. So, it looks like there is a bug indeed |
Please have a look at these two sheets at the column with first value = 230 (depth = 230), the depth above the groundwater table (groundwater depth = 250). In both cases, you will find the values at that column are lower than the two columns before and after that column (columns 220 and 245) which case these strange peaks in @BSchilperoort figures case 1: setting bottom boundary = groundwater temperature = 23 case 2: setting bottom temperature boundary = soil temperature, which is = 22.96 |
From this plot, it seems to me at 50cm the groundwater temperature of 23 degree is used to replace soil temperature profile below 50cm? |
'TT' is the soil temperature updated after the current time step running. And i agree with you that this should be standardized. |
I would say this is not the issue, but the artifact induced by manually setting the groundwater temperature. |
The issue also occurs if we set |
Hi Mostafa, please try the following:
|
Another point i want to mention is that, in STEMMUS-SCOPE, the moisture and heat flow are coupled. So when coupled with groundwater flow, the moisture content of the bottom soil layer will increase, which will impact soil temperature simulation as well, see below: Zhao, H., Zeng, Y., Lv, S., and Su, Z.: Analysis of soil hydraulic and thermal properties for land surface modeling over the Tibetan Plateau, Earth Syst. Sci. Data, 10, 1031–1061, https://doi.org/10.5194/essd-10-1031-2018, 2018. |
I think the problem is relaxed with the time. Have a look at this figure of 8-days simulation This solution is without the modification in this line (once agreed, we can delete it). Also, same results if we set |
The current coupling implementation has several issues related to coding and setting physical parameters. Here is a summary: Coding issues: 2- setting the values of RHS in modules 3- (major)The soil temperature 4- (minor issue) RHS should be defined in module Setting physical parameters: 1- (major)The coupling only sets soil temperature 2- in coupling BoundaryCondition.NBChB = 1;, which is only valid for the sites with landcover 'Croplands'. But, for example 3- Values of 4- (major)The condition in |
@MostafaGomaa93 here are the codes that we discussed at our meeting. Codes for plotting the soil temperature values:import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import xarray as xr
# Read the CSV file
csv_path = "/path_to/output/ZA-Kru_2023-09-06-1228/Sim_Temp.csv"
# Read the CSV file
df = pd.read_csv(csv_path, header=None)
# Get the first row as depths
depths = df.iloc[0].values.astype(float) * -1
# Get the rest of the data as soil_temperature
soil_temperature = df.iloc[3:].values.astype(float)
# Create a time index
time = np.arange(1, len(df)-2)
# Create the xarray DataArray
da_t = xr.DataArray(
data=soil_temperature,
dims=("time", "depth"),
coords={"time": time, "depth": depths},
)
da_t.isel(time=0).plot(y="depth")
da_t.isel(time=1).plot(y="depth")
da_t.isel(time=2).plot(y="depth") Codes for setting values through BMI:The notebook is available in pull request EcoExtreML/STEMMUS_SCOPE_Processing#101. # as an example, every time step i, the value of groundwater_head_bottom_layer is set to [1950.-i*4])
model.set_value("groundwater_head_bottom_layer", np.array([1950.-i*4])) Git commands for working with BMI implementation:Based on the pystemmusscope documentation. git clone https://github.com/EcoExtreML/STEMMUS_SCOPE_Processing.git
cd STEMMUS_SCOPE_Processing
git checkout bmi-groundwater-coupling # switch to BMI branch
git checkout -b name_of_your_branch # create your own branch
pip install -e .[dev] # install pystemmusscope in development mode
pip install jupyterlab
jupyter lab # start jupyter lab |
Thanks a lot @SarahAlidoost for the comments. here are my replies
Yes, those 3 are my mistakes, I have corrected them in the new pull request. However, the changes doesn't change the soil temperature results because the three changes are in the condition when
The model indeed should calculate the RHS for all layers. However, when we set the location of the groundwater table as the bottom boundary of the soil, then all layers below the groundwater table are saturated layers (full with water), so there is no soil anymore and STEMMUS is not adapted to calculate the variables below the groundwater table, and thats why we will couple STEMMUS_SCOPE to MODFLOW. So, the RHS of the saturated layers in the
Okay, I add them here
Okay, I have add this in this line. However, it doesn't change the soil temperature results
I add the
The
If the
I removed this condition while testing but found that no difference in the results. Maybe Yijian could clarify what is the purpose of this condition |
Thanks so much for the codes. I have used the plotting code to observe the spikes in the figures below. However, the lines in my figures are sharp and not that smooth as in @BSchilperoort figures (don't know why) In principle, I think as we increase the model run time, spikes will be minor and/or totally disappear and the problem is relaxed |
For all the figures ->
|
Another two examples at
|
The code that I provided plots the entire depth profile (0, 5 m). In your plots here, the y axis is between (-20, 2.5 cm). Please make sure that you can create the exact same plots. So we are looking at the same things. You can also generate an exe file and run the BMI notebook to make sure that plots are the same. |
@MostafaGomaa93 the plots below are created using your changed code in #245, for two sites: ZA-Kru "Savannas" and DE-Geb "cropland". The plots show soil temperature and soil moisture in case no coupling and coupling with different temperatures and depths. The issues are indicated in each plot. it seems that results are better for DE-Geb "cropland" than ZA-Kru "Savannas". But the results are the same for DE-Geb with different temperatures 23 and 17, e.g. see Fig 3. It would be good to check the code for one more site with "cropland". The issue of the first time step can be fixed by setting TT in the update section, see here. As mentioned before, in stemmusscope (without coupling), |
@MostafaGomaa93 Another physical condition that should be set correctly is |
@MostafaGomaa93 This is the output csv file for Fig 2 without setting groundwater_temperature:
|
Thanks for the observation. I have updated my figures. I think the provided code may need this slight change After i have updated my figures, i think there are spikes in the first couple of time steps (time step = 1, and time step = 20, spikes are marked with grey circle). At longer timestep (timestep = 60, timestep = 300, spikes are marked with black circle), spikes are very minor or not there at all. So, the spikes problem relaxed with the time. I also think that it is the same case with the figures that @SarahAlidoost posted |
Indeed, if |
Mostafa, as i mentioned the soil moisture content will impact soil temperature simulations. This is about soil physics. |
'SoilVariables.T' means the soil temperature calculated from the last time step. 'TT' means soil temperature calculated at this time step. |
I agree with Mostafa, that the bottom boundary condition is not related to landcover type. |
I think Lianyu added this to allow the numerical model to converge better. |
Most of time, we say the bottom boundary condition is free drainage. When it is coupled with groundwater model, we know the soil profile emerged in groundwater will be saturated, then we know the matric head will be '0'. In short, yes, it is a valid assumption. |
I would say, we shall provide a warning message saying something like 'Ground water table depth is larger than the total soil column thickness! Please enlarge the total depth of the soil column.' |
@BSchilperoort here are the results of the model for other sites, showing that there is an issue when the temperature is Nan and is set to soil temperature. This has been discussed with @MostafaGomaa93. The coupling results look okay for other sites except for some spikes in |
Originally posted by @BSchilperoort in #239 (comment)
The text was updated successfully, but these errors were encountered: