|
[Sponsors] |
Introducing a scalar field for buoyancy production in k-epsilon |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 22, 2018, 14:20 |
Introducing a scalar field for buoyancy production in k-epsilon
|
#1 |
Senior Member
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11 |
Hi dear FOAMers!
I want to add the gradient of a scalar filed (like S) for calculation the production term due to buoyancy in k and epsilon equations. So I can make the new turbulence model by defining the coefficients and gravitational acceleration which are needed for calculating the buoyancy production. But I have no idea how should I do the procedure to make the modified k-epsilon model read the scalar values from the case?!? In brief: production due to buoyancy=Gb=beta*C3e*g*(dS/dy) Problem is dS/dy , S is the scalar filed which is advected in the domain by velocity. Best REGARDS |
|
October 23, 2018, 10:12 |
|
#2 | |
Senior Member
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11 |
Quote:
nothing? |
||
October 25, 2018, 20:41 |
|
#3 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 |
There already is a buoyant kEpsilon model : https://github.com/OpenFOAM/OpenFOAM...yantKEpsilon.H. If, after checking out its implementation, it is not what you want it should be a good starting point for implementing your own variation.
Caelan |
|
October 26, 2018, 03:03 |
|
#4 | |
Senior Member
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11 |
Quote:
Thank you for your help. I am already dealing with that. My another question is about the thermal expansion coefficient which is appearing in buoyancy tern (G) called beta. Is there any equivalent for this beta for scalar flux?? Because most of the literature is devoted to thermal plume and beta is adopted for buoyancy due to non-zero temperature gradient field. Regards Sina. G=(beta)*gi*(nut/Prt)*(DT/Dxi). T is temperature or scalar filed. But beta is only defined for temperature not any scalar |
||
October 26, 2018, 06:04 |
|
#5 | |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
Quote:
if you have defined the scalarField somewhere you can retrieve it with the above function |
||
October 27, 2018, 08:40 |
|
#6 | |
Senior Member
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11 |
Quote:
thank you for your answer yes exactly i figured this out. but do you have any idea about what i asked in my response to another friend Clealan: My another question is about the thermal expansion coefficient which is appearing in buoyancy tern (G) called beta. Is there any equivalent for this beta for scalar flux?? Because most of the literature is devoted to thermal plume and beta is adopted for buoyancy due to non-zero temperature gradient field. Regards Sina. G=(beta)*gi*(nut/Prt)*(DT/Dxi). T is temperature or scalar filed. But beta is only defined for temperature not any scalar |
||
October 27, 2018, 12:36 |
|
#7 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
Which scalar are you interested in? The term accounting for the buoyancy production in the k equation comes into the equation when the buoyancy is present also in the momentum equation. If one derives the equation for k from the momentum equation with the term accounting for the buoyancy one gets the terrm rho* beta * gi * ui'T'. So if you try to derive the k equation from the momentum equation with your scalar you should see which constant you need instead of beta.
|
|
October 27, 2018, 12:52 |
|
#8 | |
Senior Member
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11 |
Quote:
Thank you for your response again, I understand the general formulation of buoyancy and its relation with momentum equations. But the question is still remaining. My scalar filed is Salinity which is entering the domain due to momentum as a jet flow. So the density is affected by salinity with the Millero-Poission eqn of state (P=f(S,T)). So what should I do for beta, when I am dealing with salinity concentration as a scalar of my domain? Regards |
||
October 27, 2018, 14:39 |
|
#9 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
A ok I got it. Ok the beta in the momentum equtions comes from the Boussinesq Approximation, i.e. you linearize the density around a a given value and expand it as a function of temperature. The same could be done for the salinity: you can expend it around a given salinity value (see http://www.o3d.org/eas-ocean-modelin...3-EqMotion.pdf)
so i assume you can substitude the coefficient of termal expansion beta by the coeffcient of salinity concentration, i.e this is what I assume after a short search about change of density as a function of salinity. Hope this is usefull |
|
October 28, 2018, 02:47 |
|
#10 | |
Senior Member
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11 |
Quote:
Hi! Thank you for your research and quick response. I got your hints. Actually I am testing the results of this approach now. So for every specific scalar in a domain one should go after finding the relation between rho and that specific scalar to find a similar manner of beta? Is that true? Regards, Sina. |
||
October 29, 2018, 03:41 |
|
#11 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
In some manner. You should really write down the derivation of the transport equation for the turbulent kinetic energy equation considering buoyancy to understand if everything is correct (see e.g. https://www.cambridge.org/core/books...A39631674EC3C9).
In principle what you do if you have a source term in the momentum equation: you decompose it into mean and fluctuation and multiply it with the velocity velocity fluctuation and you end up something like this: |
|
October 29, 2018, 04:14 |
|
#12 | |
Senior Member
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11 |
Quote:
Regards Sina |
||
October 29, 2018, 05:38 |
|
#13 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
Just one question out of curiosity:
What are the applications you are doing the modeling? |
|
October 30, 2018, 08:37 |
|
#14 | |
Senior Member
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11 |
Quote:
can I ask another question ? I want to make a if statement with < and > : if ( a> ...) do... else do... but the error is concerned about "<" and ">" and value which I entroduced for comparison :a> 0 (the zero)! how come? I am doing this in the .C of my solver. the last part of the error is : ' Foam:: tmp<Foam::GeomtericField<double, Foam::fvpatchField, Foam::volMesh> >' is not derived from 'const Foam::Pair <Type>' Regards Sina |
||
October 30, 2018, 08:49 |
|
#15 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
Form the short code you sent i presume you want to compare a volumetric viele with a float. But hard to say without and code.
|
|
October 30, 2018, 09:11 |
|
#16 | |
Senior Member
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11 |
Quote:
if (U.component(1) > 0) var1=1.0; else var1=0.5; and I want to consider U.component(1) as Uy (U.component(1)=Uy) of velocity field. Regards Sina |
||
October 30, 2018, 10:13 |
|
#17 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
What you are doing ist comparing a volScalarField with a float.
You should write Code:
forAll(U.component(0),Celli) { If (U.component(0)[Celli] < 0) {Do somethine} Else {Do something else} } Michael |
|
October 30, 2018, 11:46 |
|
#18 | |
Senior Member
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11 |
Quote:
I tried this now and I also checked the synax you wrote in other posts and discussions about forAll loops, the synax is correct but I get two error: in brief: ..... has no member named 'size' for (Foam::label i=; i<(list).size(); i++) ....in expansion of macro 'forAll' forAll (U.component(1) , Celli) ^ ...no match for operator []' ... if (U.component(1)[Celli] > 0) ^ (***this ^ is under the [ ***) Regards Sina |
||
October 30, 2018, 12:06 |
|
#19 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
Maybe
forAll (U , Celli) U[Celli].component(0) |
|
October 30, 2018, 12:32 |
|
#20 |
Senior Member
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Temperature calculation from total enthalpy in OpenFOAM (XiFOAM) | sharifi | OpenFOAM Running, Solving & CFD | 1 | October 8, 2020 10:16 |
Type mismatch: Assigning a scalar to a Field<Type> inside templated BC code | karlli | OpenFOAM Programming & Development | 2 | August 28, 2017 02:25 |
OpenFOAM floating point Error | upuli | OpenFOAM Programming & Development | 5 | June 20, 2016 04:19 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
SimpleFoam k and epsilon bounded | nedved | OpenFOAM Running, Solving & CFD | 1 | November 25, 2008 21:21 |