SaveScalars: int mean for a volume

Numerical methods and mathematical models of Elmer
Post Reply
Kraut~salat
Posts: 9
Joined: 22 Jul 2012, 14:03
Antispam: Yes

SaveScalars: int mean for a volume

Post by Kraut~salat »

hi all,

I am somewhat confused on how to use the SaveScalars solver. I have the following setup: a tube for which I have a Navier-Stokes and a HeatSolver. The tube has boundary conditions for the input and output side setup. The material within the tube is water. I would like to know the temperature of the water at the output bondary, so this is an average over the output surface, and the average temperature for the entire volume of the tube.
Now I am confused about int mean and volume operators. Calculating the average temperatures at boundaries seems to work. But the average temperature of the entire volume does not work. Besides the boundary int mean operator needed for the boundaries I also tried the int mean and the volume operator for this solver. The solver, together with the NS and HeatSolver is assigned to my tube body. But the results for int mean and volume do not make sense: int mean gives 49.6deg and volume gives 9.41e-5, which is both impossible with my inlet temp of 40 and outlet temp of 43. So what am I missing here? Is there something like a "volume int mean"? I could not find any in the GUI SaveScalars solver settings.

Solver 2
Equation = SaveScalars
Variable 3 = Temperature
Variable 2 = Temperature
Filename = temps.dat
Procedure = "SaveData" "SaveScalars"
Operator 3 = volume
Operator 2 = int mean
Operator 1 = boundary int mean
Variable 1 = Temperature
Exec Solver = After Timestep
End

Thx all
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: SaveScalars: int mean for a volume

Post by mzenker »

Hi,

I have successfully used the following for calculating the max temperature of a body:

Code: Select all

Solver 1
  Equation = SaveScalars
  Operator 1 = max
  Variable 1 = Temperature
  Procedure = "SaveData" "SaveScalars"
  Target Variable 1 = String Tmax
  Exec Solver = Always
End
The max temperature is not saved in a file, but in the new variable Tmax which is visible everywhere in ElmerSolver.
I then have two Equation sections depending on the body I want to calculate the max temperature for. This is achieved in ElmerGUI by setting the SaveScalars solver active for the desired body only.

HTH,

Matthias
Last edited by mzenker on 30 Jul 2012, 15:54, edited 1 time in total.
Kraut~salat
Posts: 9
Joined: 22 Jul 2012, 14:03
Antispam: Yes

Re: SaveScalars: int mean for a volume

Post by Kraut~salat »

i'm not quite sure how this helps me. It finds the highest temperature of all the nodes within your body. But it does not compute an average.
As solvers area always computed on bodies the int mean should give me the mean of a body. The manual explicitly says so:
"There are also a few operators that use statistics over the volume, int mean
and int variance." But the following bit is what confuses me: "The volume used by a given variable is obtained by operator volume." I just said that int mean is my operator, now it's volume? Is it volume int mean? Int mean implies that it's used on a volume.
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: SaveScalars: int mean for a volume

Post by mzenker »

Hi,

after a quick glance at the source code "int mean" seems to calculate a weighted mean of the parameter, presumably referring to the volume of the relevant cell in the mesh, whereas "mean" just averages the parameter over all nodes. But I had only a short look, so I may be wrong. If you want to know more details, you can have a look yourself: it's the "FUNCTION BulkIntegrals" and "FUNCTION VectorStatistics" in SaveData.src.

Of course that doesn't explain why you get apparently inconsistent results. You might need to check if really there are no temperatures above 43 °C in your case. Maybe you can find that out by using the max operator.

HTH,

Matthias
Kraut~salat
Posts: 9
Joined: 22 Jul 2012, 14:03
Antispam: Yes

Re: SaveScalars: int mean for a volume

Post by Kraut~salat »

hmm, that (int) mean thing would be confusing from what yout said and what's in the manual. I used max and indeed it found a max of 74deg. But I cannot see that in my setup in postprocessing. The highest Temp I have in all of my setup is ~75, but that is far away from the body I run the SaveScalar solver on. The Temps in my body are dark blue, some light blue at the edges but never above 50. That somewhat baffles me.
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: SaveScalars: int mean for a volume

Post by raback »

Hi

I think Matthias got it rigtht. The documentation may be confusing but there are operators "volume", "mean" and "int mean". Volume is \int dV and "int mean" is \int f dV / \int dV. The values are computed where the corresponding variable is active. Errors are of course possible but I would like to see an minimalistic example where the computation of mean fails.

-Peter
Post Reply