 # How to calculate the energy remained in the system?

Hi everybody,
Recently I am working on applying OpenGeoSys in ATES system. After a certain time of simulation, there is still some energy left in the system. I am supposed to calculate the energy remained. However, in OpenGeoSys, the simulation result shows the temperature at each point defined in mesh file. I have no clue how I can sum them up to get the total energy in the system.
Best wishes,
Haoyue Liu

Dear Haoyue,

I assume that you are referring to the sensible heat stored in the subsurface after ATES system. If that’s the case, the amount of sensible heat H = rho_s * c_p * (T1-T0), where rho_s is the soil/rock density, and c_p denotes the specific heat capacity of the soil/rock. Let T0 be the initial temperature before ATES operation and T1 be the value after.

Just as you have suggested, the above task can be splitted into two individual operations, each of which should do an iteration through all element and sum up all the product value of multiplication between T, rho_s and c_p. Then, just do a subtraction operation would deliver the result.

This is not a task for OGS but more commonly achievable by Paraview.
By simply google the key words “paraview+sum+up+value+on+cell”, I have found the following thread.
https://www.cfd-online.com/Forums/paraview/214348-python-script-sum-up-variable-all-cells.html
This guy is trying to do the similar thing, just summing up the result of
( component of a vector field ) * ( cell volume )

Well, it’s already very close to what you want…

In your case, I can imagine the proper procedure would be
Step 1: Figure out how to interpolate point-wise temperature values to element-wise (cell based) temperatures. Hint: This can be done by a Paraview filter.
Step 2: Set up a calculator filter following the thread above. Applying rho_s and c_p for the multiplication.May be also do the subtraction together.
Step 3: Convert the above procedure to a Python script that can be re-loaded re-run on Paraview.

This should not be a too difficult task. Have fun!

Best,
Haibing

Dear Haibing,
Really appreciate for your suggestion. My problem has been solved.
Best wishes,
Haoyue Liu