|
[Sponsors] |
June 7, 2010, 07:07 |
funkySetFields
|
#1 |
Senior Member
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16 |
Hi,
I discovered the lib funkySetFields to define nonconformal initial conditions. I would like to know, if it is possible to set for one zone of the mesh a initial condition with fixed value (k=0) with funkySetFields. Therby I want to define a porous zone as a laminar zone. If you have an other idea to define a laminar zone without using mutliRegion, I would be glad about. Best regards Chrisi |
|
June 7, 2010, 08:16 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Bernhard |
||
June 7, 2010, 09:13 |
|
#3 |
Senior Member
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16 |
Thank you,
I understood right, it is possible to define fixed values as initial conditon, but k=0 is bad? Would mut=0 be a better definition? Regards Chrisi |
|
June 9, 2010, 05:31 |
|
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
k=0 anywhere usually results in a divisionByZero-error (try it). No. That is calculated from other values. |
||
June 9, 2010, 06:22 |
|
#5 |
Senior Member
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 18 |
Hi Chrisi,
if you only want your porous zones to be treated as laminar, I would suggest to use mut=0 is this region. Because can't be done directly, I'd suggest the following workaround. Just replace your UEqn Code:
tmp<fvVectorMatrix> UEqn ( fvm::div(phi, U) - fvm::Sp(fvc::div(phi), U) + turbulence->divDevRhoReff(U) ); Code:
volScalarField muEff = turbulence->muEff(); volScalarField muLam = turbulence->mu(); forAll(mesh.cellZones(), iZone) { //if this is a porousZone forAll(mesh.cellZones()[iZone], iCell) { label actualCell = mesh.cellZones()[iZone][iCell]; //replace effective viscosity by the molecular one muEff[actualCell] = muLam[actualCell]; } } tmp<fvVectorMatrix> UEqn ( fvm::div(phi, U) - fvm::Sp(fvc::div(phi), U) - fvm::laplacian(muEff, U) - fvc::div(muEff*dev2(fvc::grad(U)().T())) ); Regards, Stefan |
|
June 11, 2010, 04:18 |
|
#6 |
Senior Member
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16 |
Hi,
Thank you for your suggestion. I tried solving with this, but I did not get a laminar zone. Perhabs I have to define somewhere in the code you gave me the name of my porous zone, haven't I? I tried solving with exactly your posted code. Or should I personalize your code in a different way for my case? Thanks in advance! Regards Chrisi |
|
June 11, 2010, 04:58 |
|
#7 |
Senior Member
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 18 |
Hi Chrisi,
yes indeed, you might add some code at Code:
//if this is a porous zone One more thing I have forgotten: You will have to do the same thing for alphaEff used in hEqn, because the changes in mut are not reported back to the turbulence model and therefore won't effect calculation of alphaEff from mut. BTW: Maybe there is still a more elegant way to solve your problem. Keep on trying... Regards, Stefan |
|
June 11, 2010, 09:08 |
|
#8 |
Senior Member
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16 |
Hi Herbert,
thanks for your efforts. But I 'm sorry I dont know how to put in this if statement. Because I have only one porous zone inside my mesh, it would be easier not to exclude all other zones I think. How can I make an if statement to call different cell zones. Can you translate your code for me? That would be so nice of you. Regards Chrisi |
|
June 14, 2010, 05:30 |
|
#9 |
Senior Member
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 18 |
Hi Chrisi,
I thought about something like this: Code:
forAll(mesh.cellZones(), iZone) //loop over all cellZones { if (mesh.cellZones()[iZone].name() == "bla") //with bla being name of porous cellZone { forAll(mesh.cellZones()[iZone], iCell) //loop over all cells in Zone { label actualCell = mesh.cellZones()[iZone][iCell]; //"global" cell index of actual cell //replace effective viscosity by the molecular (laminar) one muEff[actualCell] = muLam[actualCell]; } } } Regards, Stefan |
|
June 15, 2010, 03:21 |
|
#10 |
Senior Member
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16 |
Hi,
thank you again. At the moment your suggestions did not change really much, but it can be right anyhow. So now why what I want to do: I want to find an equivalent for the laminar zone for porous regions like in Fluent. That there are no turbulent swirls in my porous zone. I must check with an other case, if your code allow exactly this. Best regards Chrisi Last edited by Chrisi1984; June 16, 2010 at 08:33. |
|
June 17, 2010, 04:26 |
|
#11 |
Senior Member
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16 |
Hi,
Is it possible to call setFields during the calculation to overwirte mut only in my porous zone with zero in every time step? Regards Chrisi |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] groovyBC and funkySetFields married and got a kid named swak4Foam | gschaider | OpenFOAM Community Contributions | 169 | August 10, 2023 10:01 |
[swak4Foam] how to use funkySetFields function in muliregion case | bryant_k | OpenFOAM Community Contributions | 15 | October 15, 2021 03:50 |
[swak4Foam] funkySetFields and funkySetBoundaryFields | zxj160 | OpenFOAM Community Contributions | 19 | February 14, 2018 20:07 |
[swak4Foam] funkySetFields: problem with processor boundary | nmikhailov | OpenFOAM Community Contributions | 4 | May 26, 2015 10:48 |
[swak4Foam] Problem with funkySetFields: How to set field on patch? | DanielPT | OpenFOAM Community Contributions | 4 | May 6, 2011 10:45 |