Smagorinsky LES: output and average k value
Dear Foamers,
I am simulating a wind turbine in a wind tunnel, and I am performing a LES simulation using the Smagorinsky model and the pisoFoam solver. I am also averaging the velocity, pressure and subgrid scale kinetic energy ( p U k) by the use of the fieldAverage library. While everything works fine for p and U, I cannot average the k and I get the following error: Code:
> FOAM FATAL ERROR: If I switch LES model to oneEqEddy f.ex., then everything runs smooth, I get all the averages including k and the k is written in the output time folders. My question is: is there a way to force OF to write and average the k value when using the Smagorinsky model? I have tried to use the swak4foam utility but did not get any luck. Thanks in advance for your help! Fabio 
Smagorinksy model does not use/write field k.

Guess maybe I could be a little more helpful. The Smagorinsky is a zeroequation model so there is no additional transport eqn for k. You can compute this but it depends if you are looking for the resolved TKE or just the subgrid TKE. Take a look here:
http://www.cfdonline.com/Forums/cfx...tml#post334843 From that post (which is just a copypaste from Pope, 2000) the total TKE is the sum of the resolved part: k_res = 1/2 * avg(U) * avg(U) and the SGS part k_sgs = 1/2 * tau_ii_R = 1/2 * avg(U^2) * [avg(U) * avg(U)] I think this is correct anyway. Hope this helps. Kent 
Hello Kent,
thanks for your help, your solution is good enough for my case. I can use swak4foam to output k at runtime according to the equations. Anyway I'd like to know, out of curiosity/future need, one more thing. From Smagorinsky.C,line 115, looks to me that k is actually calculated as: Code:
Fabio 
I have been thinking over your answer, and I think that I cannot calculate the subgrid scale energy in that way, since it is impossible to calculate the average of the squared velocity field:
0.5*avg(U^2) which is also one of the reasons why we need subgrid scale modeling, if I am not wrong? Fabio 
Any help with this issue would be greatly appreciated :)
Fabio 
Hello,
About obtaining the k_sgs, why not directly use the following? turbulence>k(); Quote:

mistake
I would like to report a mistake:
k_sgs== 1/2 * tau_ii_R = 1/2 * filtered(U U)  [filtered(U) * filtered(U)] But you don't know the filtered(U U) so perhaps you have to use: return (2.0*ck_/ce_)*sqr(delta())*magSqr(dev(symm(gradU))) which is very similar to the rate of transfer energy yo the residual motion: Pr=2*nuSgs* filtered(Sij) * filtered (Sij) But I attend any suggestion Best Regard Giulio Quote:

Dear OFers, for kinetic energy K in LES, my understanding is (maybe not correct),
1. Note that if u = Filtered(u) + uprime, then resolved velocity vector Filtered(u) is not usually equal to Filter(Filter(u)), while Filtered(uprime) isn't equal to zero, where u is turbulence instantaneous velocity field, or u = u(x, t). However, <uprime> maybe is equal to zero under the isotropic assumptions, <.> denotes Reynolds averaging or time averaging. 2. According to Giulio and Pope, kinetic energy K_total = k_res + k_sgs, where k_res is the resolved kinetic energy and k_sgs the subgrid kinetic energy. Firstly, for k_sgs, if Smagorinsky model, then k_sgs = (2.0*ck_/ce_)*sqr(delta())*magSqr(dev(symm(gradU))), note that it is obtained by the resolved velocity field Filtered(u) (=U). So k_sgs can be got easily. Secondly, k_res = 0.5*Filtered(u)_i*Filtered(u)_i = 0.5U_i*U_i, note also that it is instantaneous or is at current timestep, obviously，we can get it. However, most of the cases, we hope to get <K_total> because we simply concern a equilibrium flow rather than a evolutive flow. If really so, we can ignore <k_sgs> and the reason is that the scale of the subgrid energy vortex (k_sgs) is much smaller than the resolved vortex scale (k_res) based on the Kolmogorov energy cascade. In brief, for OFers we can get <Ktotal> = <k_res> by the "UprimeMean" in the ontheflyprocessing founction "fieldAverage" specified in controlDict file. if any wrong , don't hesitate to correct me please 
Quote:
Especially around y+=11 the sgs energy rises, in my case to nearly 50% of the resolved kinetic energy. Just my thoughts. Any suggestions? 
Hi All,
I am also in this problem of calculating Ksgs and Kres. But i am unable to get K field as an output from Smagorinsky Model. Could anyone help me out there?? I agree with HanSolo. I think that instantaneous Ktotal = 1/2(u^2 v^2 w^2) , and Ksgs is calculated from the LES model. Kres = Ktotal  Ksgs. 
Quote:
To do so, create a new field in createFields.H, for example: Code:
volScalarField ksgs_ Code:
while (runTime.run()) With that new field, you can and of course have to average to get proper results. So in your /systems/controlDict inside the functions>fieldAverage use Code:
ksgs I got very good results with this procedure. Dont forget to rename your utilities! 
All times are GMT 4. The time now is 09:45. 