CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

potentialFoam porousBafflePressure turbulence

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 20, 2014, 19:49
Default potentialFoam porousBafflePressure turbulence
  #1
Member
 
Brock Lee
Join Date: Sep 2012
Location: Midwest
Posts: 40
Rep Power: 14
GRAUPS is on a distinguished road
Foamers,

As a preface, I'm just starting to dig into the openfoam code. So if I say something silly or ask an obvious question, please just roll with it.

I'm attempting to modify the porousBafflePressure boundary condition in OF so that it is compatible with potentialFoam. Currently the porousBafflePressure boundary condition requires that a turbulence model be present, and thus throws an error when I run potentialFoam. I'd like the BC to run with a constant nu if potentialFoam is called. A code snippet of the original incompressible half of the BC is below...

Code:
if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
    {
        const incompressible::turbulenceModel& turbModel =
            db().lookupObject<incompressible::turbulenceModel>
            (
                "turbulenceModel"
            );

        const scalarField nuEffw = turbModel.nuEff()().boundaryField()[patchI];

        jump_ = -sign(Un)*(I_*nuEffw + D_*0.5*magUn)*magUn*length_;
    }
... And this is what I have so far for a modification...

Code:
if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
    {
        if solver == potentialFoam
	{
	    const dictionary& transportProperties = 
	    	db().lookupObject<IOdictionary>
	    (
   		"transportProperties"
	    ); 
	    
	    dimensionedScalar nu(transportProperties.lookup("nu"));
	    jump_ = -sign(Un)*(I_*nu + D_*0.5*magUn)*magUn*length_;
	}
	else
	{
	    const incompressible::turbulenceModel& turbModel =
            	db().lookupObject<incompressible::turbulenceModel>
            	(
                    "turbulenceModel"
            	);

            const scalarField nuEffw = turbModel.nuEff()().boundaryField()[patchI];
	    jump_ = -sign(Un)*(I_*nuEffw + D_*0.5*magUn)*magUn*length_;
	}        
    }
I'm unsure if I did the lookup of nu correctly... but my biggest issue is I'm unsure how to identify if the solver is potentialFoam. Can someone suggest a code snippet to identify the solver? Or is there an overall better way to accomplish what I want?

I appreciate the help!
GRAUPS is offline   Reply With Quote

Old   January 21, 2014, 16:28
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Brock,

As far as I know, you do know have any means of detecting, whether the solver is potentialFoam, but there might be hidden something in the Time object. You could try to track down, where the solver-name in the header of the log file is written.

That aside, I believe it is a bad approach. I would rather propose that you make use of the foundObject and its bolean return. If it returns true, then a turbulence model is found, and you are not running potentialFoam, otherwise you are running potentialFoam, and you can apply your modifications.

Kind regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   January 21, 2014, 20:46
Default
  #3
Member
 
Brock Lee
Join Date: Sep 2012
Location: Midwest
Posts: 40
Rep Power: 14
GRAUPS is on a distinguished road
Quote:
Originally Posted by ngj View Post
I would rather propose that you make use of the foundObject and its bolean return. If it returns true, then a turbulence model is found, and you are not running potentialFoam, otherwise you are running potentialFoam, and you can apply your modifications.
^^This worked great, thank you.

I have another question regarding the loading of the transportProperties dictionary. It appears that potentialFoam does not load this inside its createFields.H source code, and therefore isn't available to me when I try to look it up via lookupObject. I think I need to stick one of these somewhere...

Code:
IOdictionary transportProperties
        (
            IOobject
            (
                "transportProperties",
                runTime.constant(),
                mesh,
                IOobject::MUST_READ_IF_MODIFIED,
                IOobject::NO_WRITE
            )
        );
... but I'm unsure where the proper place to put it is. I was hoping to not have to modify the potentialFoam solver createFields.H.

What's the best way to load transportProperties for use by the porousBafflePressure boundary condition?

Thanks again for any suggestions you can provide!
GRAUPS is offline   Reply With Quote

Old   January 23, 2014, 15:11
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Brock,

Before I answer you question, allow me to ask:

"What is the meaning of having the viscosity included in a solver, which solves for an inviscid fluid?"

Kind regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Reply

Tags
porousbafflepressure, potentialfoam


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Turbulence postprocessing Mohsin FLUENT 2 October 3, 2016 15:18
Turbulence length scale and integral length scale rizhang CFX 2 April 22, 2016 08:22
Question on Turbulence Intensity Eric FLUENT 1 March 7, 2012 05:30
Discussion: Reason of Turbulence!! Wen Long Main CFD Forum 3 May 15, 2009 10:52
Code release: Flow Transition and Turbulence Chaoqun Liu Main CFD Forum 0 September 26, 2008 18:15


All times are GMT -4. The time now is 13:11.