- **OpenFOAM**
(*https://www.cfd-online.com/Forums/openfoam/*)

- - **Computation of kinetic energy of the flow**
(*https://www.cfd-online.com/Forums/openfoam/94233-computation-kinetic-energy-flow.html*)

Computation of kinetic energy of the flowHi foamers,
I am really puzzled about how tocompute the overall kinetic energy of the flow, i mean I(1/2*U^2)dV, where I is an integral over the given volume. I understand that I have to sum over all subvolumes but I do not even know how to start . Please help me |

volScalarField ke=0.5*(U&U);
dimensionedScalar ketotal = sum(ke*mesh.V()); |

Dear nimasam,
Thank you very much for your answer it was very useful. Just a small comment, It is better just to compute the Ek just by dimensionedScalar ketotal = sum(0.5*(U&U)*mesh.V()); In this way you do not need to construct an additional volScalar field which can save alot of memory Yuri |

Thinking about the issue once agin, the last change does not reduce the
memory consumption since U&U opration still consumpts the same amount of memory as if volScalarfield is defined explicitly. I would recommend another way , which is longer but allows you to save the memory: forAll (mesh.C().internalField(), patchI) { Ekin_= Ekin_+0.5* (sqr(U.internalField()[patchI].component(vector::X))+ sqr(U.internalField()[patchI].component(vector::Y))+ sqr(U.internalField()[patchI].component(vector::Z))) *mesh.V()[patchI]; } This is of course right for non-slip boundary conditions. Yuri |

All times are GMT -4. The time now is 03:02. |