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

volScalarField question

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 23, 2011, 11:23
Default volScalarField question
  #1
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Pennsylvania, United States
Posts: 101
Rep Power: 6
adhiraj is on a distinguished road
Hi all,
I am trying to define a new volScalarField mu. I want to use it as a diffusivity in the transport equation. Now since this field is to be calculated, and not solved for, I cannot specify boundary conditions for it. But how do I make sure that the boundary fields also get updated? This would be important in my mind, as the value might need to be interpolated to call faces during use.
It would be very helpful if some one could come up with an answer.
Thanks.
adhiraj is offline   Reply With Quote

Old   April 26, 2011, 09:16
Default
  #2
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 10
benk is on a distinguished road
You can specify boundary conditions for any field. Normally a diffusivity would have zeroGradient boundary conditions but you could also just make them fixedValue and then update the fixedValue boundaries appropriately.

After updating the field, do a:
Code:
mu.correctBoundaryConditions();
I think this is only required if you have a zeroGradient boundary condition and you update the internal fields, but I run this command each time I update the field (even if I don't have zeroGradient BCs) just to be safe.
benk is offline   Reply With Quote

Old   April 26, 2011, 10:02
Default
  #3
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Pennsylvania, United States
Posts: 101
Rep Power: 6
adhiraj is on a distinguished road
Quote:
Originally Posted by benk View Post
You can specify boundary conditions for any field. Normally a diffusivity would have zeroGradient boundary conditions but you could also just make them fixedValue and then update the fixedValue boundaries appropriately.

After updating the field, do a:
Code:
mu.correctBoundaryConditions();
I think this is only required if you have a zeroGradient boundary condition and you update the internal fields, but I run this command each time I update the field (even if I don't have zeroGradient BCs) just to be safe.
Thanks for replying. Can you give me a heads up as to what this function does? Like say for example, it takes the vales from the first row of cells at the boundary and puts them at the boundary faces.
Thanks.
adhiraj is offline   Reply With Quote

Old   April 26, 2011, 10:28
Default
  #4
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 10
benk is on a distinguished road
Quote:
Originally Posted by adhiraj View Post
Thanks for replying. Can you give me a heads up as to what this function does? Like say for example, it takes the vales from the first row of cells at the boundary and puts them at the boundary faces.
Thanks.
I'm pretty sure that's how it works (ie. takes the neighboring cells and copies them to the boundary to ensure the zeroGradient BC). You can check to see if it works by doing something like this:


Code:
label wall = mesh.boundaryMesh().findPatchID("INSERT_PATCH_NAME_HERE");

Info << mu.boundaryField()[wall][0] << endl;
mu.correctBoundaryFields();
Info << mu.boundaryField()[wall][0] << endl;
This will print out the value of your mu field at the boundary for cell index 0 (or any other boundary index you want) before and after updating the boundaries.

I did find this post though: CorrectBoundaryConditions affecting processor patch in parallel operations which implies it may not work in parallel...but I haven't verified this and it's quite an old post.
benk is offline   Reply With Quote

Old   January 22, 2013, 08:41
Default correcting internalfield of a not-solving volscalarfield in each time step
  #5
Member
 
Hossein
Join Date: Apr 2010
Posts: 62
Rep Power: 7
atoof is on a distinguished road
Send a message via Yahoo to atoof
Quote:
Originally Posted by benk View Post
You can specify boundary conditions for any field. Normally a diffusivity would have zeroGradient boundary conditions but you could also just make them fixedValue and then update the fixedValue boundaries appropriately.

After updating the field, do a:
Code:
mu.correctBoundaryConditions();
I think this is only required if you have a zeroGradient boundary condition and you update the internal fields, but I run this command each time I update the field (even if I don't have zeroGradient BCs) just to be safe.
Dear benk,

I have a the following variable:
Code:
volScalarField diffus
(
        IOobject
        (
            "diffus",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
            ),
        lambda/cp
        );
where lambda and cp are volScalarField variables and varies in the fields in each time step.
How can I correct "diffus" before using it?

Thanks,

Mohammad
atoof 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
Syntax question relating volScalarField sabin.ceuca OpenFOAM Programming & Development 3 April 2, 2015 04:05
Calculate volume average of volScalarField tangd OpenFOAM Running, Solving & CFD 3 May 1, 2013 13:37
Problems with creating a volScalarField georlade OpenFOAM Programming & Development 2 July 6, 2010 02:19
A question about the source code of realizableKE.C yuhai OpenFOAM Programming & Development 1 June 26, 2009 08:05
question K.L.Huang CD-adapco 1 March 29, 2000 04:57


All times are GMT -4. The time now is 05:14.