CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

funkySetFields

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   June 7, 2010, 06:07
Default funkySetFields
  #1
Senior Member
 
Join Date: Jan 2010
Location: Stuttgart
Posts: 129
Rep Power: 7
Chrisi1984 is on a distinguished road
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
Chrisi1984 is offline   Reply With Quote

Old   June 7, 2010, 07:16
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Chrisi1984 View Post
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
Have a look at the end of section 4 of http://openfoamwiki.net/index.php/Co...funkySetFields . Use the function described there in the -contition-option and you should be set (BTW: k=0 is not a good idea in my opinion. You'll get a divison by zero)

Bernhard
gschaider is offline   Reply With Quote

Old   June 7, 2010, 08:13
Default
  #3
Senior Member
 
Join Date: Jan 2010
Location: Stuttgart
Posts: 129
Rep Power: 7
Chrisi1984 is on a distinguished road
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
Chrisi1984 is offline   Reply With Quote

Old   June 9, 2010, 04:31
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Chrisi1984 View Post
Thank you,

I understood right, it is possible to define fixed values as initial conditon, but k=0 is bad?
No. k will only be set as an initial condition. It will be calculated in later time-steps.

k=0 anywhere usually results in a divisionByZero-error (try it).

Quote:
Originally Posted by Chrisi1984 View Post
Would mut=0 be a better definition?
No. That is calculated from other values.
gschaider is offline   Reply With Quote

Old   June 9, 2010, 05:22
Default
  #5
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 8
herbert is on a distinguished road
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)
);
by

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()))
);
Please tell me, if it works.

Regards,
Stefan
herbert is offline   Reply With Quote

Old   June 11, 2010, 03:18
Default
  #6
Senior Member
 
Join Date: Jan 2010
Location: Stuttgart
Posts: 129
Rep Power: 7
Chrisi1984 is on a distinguished road
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
Chrisi1984 is offline   Reply With Quote

Old   June 11, 2010, 03:58
Default
  #7
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 8
herbert is on a distinguished road
Hi Chrisi,

yes indeed, you might add some code at
Code:
//if this is a porous zone
My code actually goes through all cells included in any cell Zone and replaces the effective viscosity by the molecular (laminar) one. If there is a cell Zones that isn't a porous zone you have to exlude it from the loop via in if statement (e.g. by its name).

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
herbert is offline   Reply With Quote

Old   June 11, 2010, 08:08
Default
  #8
Senior Member
 
Join Date: Jan 2010
Location: Stuttgart
Posts: 129
Rep Power: 7
Chrisi1984 is on a distinguished road
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
Chrisi1984 is offline   Reply With Quote

Old   June 14, 2010, 04:30
Default
  #9
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 8
herbert is on a distinguished road
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];
          }
      }
}
BTW: What do you mean talking about "laminar"? If you want the flow to have a certain direction (e.g. in x-direction) you can influence by the loss coefficients. Just set the coefficients in the directions you want to have zero velocity to -1000. Then it should be 1000 times higher than in the specified flow direction. In this case you won't have to manipulate code.

Regards,
Stefan
herbert is offline   Reply With Quote

Old   June 15, 2010, 02:21
Default
  #10
Senior Member
 
Join Date: Jan 2010
Location: Stuttgart
Posts: 129
Rep Power: 7
Chrisi1984 is on a distinguished road
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 07:33.
Chrisi1984 is offline   Reply With Quote

Old   June 17, 2010, 03:26
Default
  #11
Senior Member
 
Join Date: Jan 2010
Location: Stuttgart
Posts: 129
Rep Power: 7
Chrisi1984 is on a distinguished road
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
Chrisi1984 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running funkySetFields sara OpenFOAM Running, Solving & CFD 10 October 3, 2012 10:08
funkySetFields Chioma OpenFOAM Running, Solving & CFD 10 December 7, 2011 15:28
funkySetFields - how to set two "zones"? gwierink OpenFOAM Pre-Processing 24 July 5, 2010 10:12
funkySetFields complex boundary Svensson OpenFOAM 3 January 11, 2010 05:48
FunkySetFields for cyclic bc zakifoam OpenFOAM Pre-Processing 1 December 18, 2007 08:24


All times are GMT -4. The time now is 12:35.