-
Notifications
You must be signed in to change notification settings - Fork 26
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
Internal energy question #93
Comments
Hi Chenxi - what answer are you expecting for the first value? Should it be higher/lower than the second one? The code extends the deepest measurement down to the bottom to perform this calculation, so the two evaluations are equivalent in the code. rLA will give you an answer, but the accuracy of that answer depends on the data you give it. If your provide data that are more resolved vertically, it will yield a more accurate result. |
Dear Jordan: Many thanks for the quick replo! If the maximum depth of wtr is smaller than the maximum bthD, the internal energy should be calculated based on the the real water level. For this example, the first value should be smaller than the second one. Best Cheers |
If that is the case, then you should adjust the bthA and bthD to reflect it. I don't think rLA supports time-varying lake levels in these calculations except by modifying the bthD and bthA vectors. Is that right @lawinslow ? |
Dear Jordan: I mean if we used If we can't change the bahty under differet time, there will be some problems when using the ts.schmidt.stability and ts.internal.energy (especially if the water level shows big changes during the calculating period). Best Cheers |
Correct. The |
Dear Jordan: Got it! Then I need to write a loop so as to use ts. functions to calculate internal energy at different time. I just suppose if there is a ts.bathy function in rLakeAnalyzer, it will be very convenient for calculating the schmidt stability and internal energy over time. Best Cheers |
yes, but if you are using a loop w/ time, you don't need to use the |
Dear Jordan: Got it ! Many thanks! Chenxi |
Just a quick reference, there is an example of dealing with variable depths with rLA here |
Seems these questions were answered. Closing this issue. |
Hi
From the source code to calculate internal.energy in rLakeAnalyzer, I found there may exist some problems which is shown below:
From line 51-53 of internal.energy.R, it shows that:
if(max(bthD) > depths[numD]){ wtr[numD+1] = wtr[numD] depths[numD+1] = max(bthD)
From line 76-79 , it shows that:
layerD = seq(min(depths), max(depths), by=dz) layerP = stats::approx(depths, rhoL, layerD)$y layerT = stats::approx(depths,wtr, layerD)$y layerA = stats::approx(bthD, bthA, layerD)$y
It means that if the maximum depth of wtr is smaller the the maximum bthD, it will automatically add the maximum bthD as the maximum depth for calculation. However, when the water level is lower than the maximum bthD(which is very commom), the results of internal energy is wrong.
For example, if we write
bthA <- c(1000,900,864,820,200,10) bthD <- c(0,2.3,2.5,4.2,5.8,7) wtr1 <- c(28,28,27) depth1 <- c(0,1,2) internal.energy(wtr1, depth1, bthA, bthD)
the results is
However, if we write
bthA <- c(1000,900,864,820,200,10) bthD <- c(0,2.3,2.5,4.2,5.8,7) wtr2 <- c(28,28,27,27) depth2 <- c(0,1,2,7)
the result is also
When the water level decreases to 2m, the internal energy is the same as the level of 7m. So I suppose there should be some changes about the source code.
Best Cheers
Chenxi
The text was updated successfully, but these errors were encountered: