Adding source term with fvOptions to k-e model
5 Attachment(s)
Hi everyone!
I got some issue to implement a source term via fvOptions to the k-e model. The source term is apply on epsilon(only) to the k-e turbulence model for 1D (x=1mm, y=150mm, z=1mm) ABL simulation in order to simplify the simulation. Y+ is around 50. The y component I used in the formula is the center of the cells so, y-coordinate of internal cells (distance from the wall to the center of each cells,see text file, 3rd column). From the results, the calculation by the equation "epsilonSource[i]" are good since I printed out the results in a text file and verified the validity but the source term doesn't seems to be applied correctly to the domain(see picture). The boundary wall seems to work (in the epsilon patch I choose the BC "epsilonWallFunction"). The simulation stop after 11 step of iteration... If someone has a clue, an idea what could be the issue, it would be appreciated. Do you guys think the source term is applied automatically in the epsilon-BC as well? If don't, should I? Best Regards, Paper where I found the term source: https://www.sciencedirect.com/scienc...6761051100002X https://www.researchgate.net/publica...n_of_ABL_flows fvOptions file: Code:
/*--------------------------------*- C++ -*----------------------------------*\ Code:
/*---------------------------------------------------------------------------*\ |
Hi, do you get an floating point error after t=11? I am not sure about the "+=" maybe try simple "=".
|
I already tried ''+='', ''='' and ''-='', and I got the same error.
That is the last part of the log: Code:
Time = 11 |
Maybe the problem is somewhere else, I mean the solver crashes for p calculation and need maximum iterations. And without the source everything works fine? Otherwise check BC.
|
1 Attachment(s)
Yes, everything work just fine if I don't apply the source term.
I see what you mean by the calculation for the pressure. The bounding value on epsilon are really high.....and the results on nut also, which is translate to a high value on k too(the picture is not there since I can't upload more than 5 files). Since I use the following paper as a reference and a set of BC from my previous successful simulation without the source term, from what I understand, the BC don't need to be change because the source term on epsilon has been obtain by using the Inlet profile's equation shown in attachment and the BC are base from these profiles. The source term on k vanish. So there is no need to apply a source term on k with fvOptions. Paper: https://www.researchgate.net/publica...n_of_ABL_flows |
Ok theres are now really just guesses...maybe first lower your relaxation factors? And you can try to lower yor source with a const factor like 1e-1 and look what happens. Do you have any restrictions on the mesh? Maybe refine it.
|
what I use for relaxation is: p=0.2, U=k=e=0.3, then I tried lowering these already and it didn't help. Still doing the same thing.
About multiplying by a factor, like I mentioned in the other thread that we talk together, I mutiplied the function by V[i], which is 1e-9 (cells volume=0.001mx0.001mx0.001m) and it did converge. So, it probably safe to say that the term V[i] has been use like a factor at this point. What is limiting me on the mesh resolution is the resource, but I didn't try this option. The computer I use is not that powerful. For sure it is always better having a refined mesh but, Y+=50, which I think is relatively in the good range. Thank again for your suggestion! Stay safe! Regards, |
1 Attachment(s)
I revisited the finite volume method and I saw the following formula in attachment.
From what I saw in this formula, I was about right. The source term need to be multiply by the volume of the cell. |
Some of the new fvOptions related to the ABL modelling in the following link may help for the epsilon-/omega-based fvOptions you try to achieve? Have a look at `src/atmosphericModels/fvOptions/*` ?
https://develop.openfoam.com/Develop...e_requests/363 Hope this helps. |
Thank for the information!
I was trying to figure how the whole thing work with the 'fvOptions' framework by trying a simple case with a 'k' uniform profile. Since I passed this step, my main goal has always been to implement an neutral ABL with a non-uniform 'k' and 'e' profile at the Inlet (varies with z). That give a bit more flexibility of matching wind tunnel results, which I want to achieve (for instance: https://www.sciencedirect.com/scienc...67610508001815). That involve having new set of source term and BC. Again, thank for the link. But, from what I've seen quickly is that the package is design for uniform 'k' profile which it don't apply in my case for the reason mentioned above. Even though, I always save good reference. Best regards, |
Hi,
Is there any reason why you think `k` is uniform? `k`-input can be spatiotemporal variant if it is a volScalarField or PatchFunction1<scalar> type. As far as I see, `k`-input of any of these functionalities is either of them. Do I miss something? Thanks. |
From what I have noticed and understand in the literature is that using the k-e turbulence model for neutral ABL (steady-state), without any modification of the transport equation, the 'k' profile is uniform (spike can appear close to the wall though but become uniform after) and follow the relationship u*^2/Cmu^(1/2) and 'epsilon' u*^3/(kappa*(z+z0)). Specific BC at the Top and Bottom must be added if you want to match the velocity profile U obtain at the Outlet compare to the one used at the Inlet. (see: https://onlinelibrary.wiley.com/doi/....1002/fld.2709)
If I want to change the 'k' profile from uniform to a custom profile/log profile at the Inlet, often used to match wind tunnel results (see the paper I linked in the previous post I did), to obtain a neutral ABL and having the corresponding results at the Outlet, there is 2 options in order to reflecting these new conditions at the Inlet: 1- Changing the transport equation, 2- Adding a source term to the original transport equation (see: https://www.researchgate.net/publica...n_of_ABL_flows). Obviously, the BC at the Top and Bottom must be different also. So, what I have seen from the results presented for 'k' in the link you shared is that you can see what we call the 'spike' and then it become basically uniform. So, this make me think that the transport equation, the fvOptions and the wall functions are not adapted for a new type of 'k' profile that I'm looking for at the Inlet. |
Hi @Nasim99!
No problem. If you find something new or if you find something that I said is wrong and you can confirm it, don't hesitate to comment. If you try to do something similar, it would be nice to compare and share the BC. It don't converge right now and since I confirmed that I use the right source term for my case, I think the issue is from the BC. The only thing I wondering is, if it's possible to use Cmu constant if 'k' is non-uniform(varies with 'z') and adding a source term instead of modifying the transport equation? If someone could confirm that, it would be appreciated. Regards, |
3 Attachment(s)
Hello,
I want to apply a source term to the k-epsilon model using the fvOptions ScalarcodedSource. Attached herewith is the source term I want to apply from the literature. This source term is applied in a particular location defined as cellZone in topoSet (see attached schematic) I first applied the source term to the k field only to verify the code is ok before adding the epsilon source. my problem is that The k & epsilon becomes zero just after few cells from the inlet (see attached file kSource.csv) but the fields gives good result without the source terms the source term is applied on the cellzone zone1 as shown in the logfile below. how can I rectify the problem please? is my code ok? attached herewith is my fvOptions code for the kSource Code:
kSource Code:
Selecting finite volume options type actuationDiskSource |
I think you have to use the correct cell indices like it is done here:
https://github.com/OpenFOAM/OpenFOAM...emplates.C#L62 Code:
kSource[CellC[i]] += epsIn_; |
Quote:
I made the correction as suggested but I get this error message fvOptions Code:
kSource Code:
Creating finite volume options from "constant/fvOptions" |
I checked again: https://www.openfoam.com/documentati...ces-coded.html
mesh_.C() seems to be cell centres cooridnates. You want the list of the cells in the cell set. See the example in this bug report: https://bugs.openfoam.org/view.php?id=2361 Modified with your source: Code:
const labelList& cellIDs = cells(); |
3 Attachment(s)
Quote:
Thank you very much for the assistance. the simulation is running but the result is sketchy Code:
kSource The results show the source term added in k & epsilon in the region but reduces to zero afterwards. I attached herewith a comparison between source and no source. Thank you very much. Have a nice weekend |
Hello,
Can you please tell me what is "epsilonSource()" in the kepsilon.C file ? |
Take a look at kEpsilon.H and you will see that it is a virtual function for the source term in the epsilon equation:
Code:
virtual tmp<fvScalarMatrix> epsilonSource() const; |
All times are GMT -4. The time now is 23:30. |