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

Using codedFixedvalue to apply totalPressure Boundary Condition

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

Like Tree2Likes
  • 2 Post By cdm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 12, 2013, 14:16
Default Using codedFixedvalue to apply totalPressure Boundary Condition
  #1
cdm
Member
 
Join Date: May 2013
Location: Canada
Posts: 32
Rep Power: 12
cdm is on a distinguished road
Using OF 2.1.1, I'm trying to use the codedFixedValue boundary condition to apply a polynomial temperature distribution at my inlet. I can apply a static temperature distribution using the following code in my 0/P file:

Code:
    INLET
    {
        type            codedFixedValue;
        value           $internalField;
        redirectType    polyTemperatureInletDistribution;   // name of generated BC

        code
        #{
            vector dir=vector(0,0.866026,-0.5);  // unit vector (30-deg CCW from Y)
            scalarField var=patch().Cf()&dir;
            scalarField value = -8508888.202118 * pow(var,4)
                                -  76279.680124 * pow(var,3)
                                +   5489.594313 * pow(var,2)
                                +    639.763780 * var
                                +   1200;
            operator==(value);
        #};

    }
This generates the following boundary condition:



However, I want to define this temperature distribution as the totalTemperature at the inlet, not a static temperature. How can I modify my codedFixedValue BC to apply a totalTemperature?

Alternatively, would setting the inlet velocity, U, as fixedValue uniform(0 0 0) force a total temperature condition at the inlet? I'm worried that this could cause adverse effects on the solution, though, so I'd rather code a totalTemperature if possible.

Thanks for having a read, and for any help.

Last edited by cdm; June 12, 2013 at 21:27.
cdm is offline   Reply With Quote

Old   June 12, 2013, 21:41
Default
  #2
cdm
Member
 
Join Date: May 2013
Location: Canada
Posts: 32
Rep Power: 12
cdm is on a distinguished road
Looking through the source code in src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/ I implemented the equivalent calculation as shown below. I'm currently running my case to check whether this yields the desired results, and if anyone spots any potential issues I'd be grateful for the assistance; this is my first time analysing the source code and trying to understand it. However, the BC does compile properly. I'll update again later after running a number of iterations and checking the results.

Code:
    INLET
    {

        type            codedFixedValue;
        value           $internalField;
        redirectType    polyTempInletDistribution;   // name of generated BC

        code
        #{

            const scalar gamma_ = 1.34;

            const fvPatchVectorField& Up =
                patch().lookupPatchField<volVectorField, vector>("U");

            const fvsPatchField<scalar>& phip =
                patch().lookupPatchField<surfaceScalarField, scalar>("phi");

            const fvPatchField<scalar>& psip =
                patch().lookupPatchField<volScalarField, scalar>("psi");

            scalar gM1ByG = (gamma_ - 1.0)/gamma_;

            vector dir=vector(0,0.8660255047,-0.4999998252);
            scalarField var=patch().Cf()&dir;
            scalarField value = -8508888.202118 * pow(var,4)
                                -  76279.680124 * pow(var,3)
                                +   5489.594313 * pow(var,2)
                                +    639.763780 * var
                                +   1200;

            operator==
            (
                value/(1.0 + 0.5*psip*gM1ByG*(1.0 - pos(phip))*magSqr(Up))
            );

        #};
    }
Pagoda and lpz456 like this.
cdm is offline   Reply With Quote

Old   June 22, 2013, 15:10
Default
  #3
cdm
Member
 
Join Date: May 2013
Location: Canada
Posts: 32
Rep Power: 12
cdm is on a distinguished road
This worked as needed. For anyone looking at this for their own work, please note that the direction vector must be specified as a unit vector (magnitude = 1) otherwise it will scale your temperatures on you.

Here's a thread on implementing time in your BC: http://www.cfd-online.com/Forums/blo...condition.html
cdm is offline   Reply With Quote

Reply

Tags
boundary conditions, codedfixedvalue, totalpressure

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time dependant pressure boundary condition yosuke1984 OpenFOAM Verification & Validation 3 May 6, 2015 07:16
Radiation interface hinca CFX 15 January 26, 2014 18:11
domain imbalance for enrgy equation happy CFX 14 September 6, 2012 02:54
totalPressure Boundary Condition implementation tsikroria0 OpenFOAM 0 June 28, 2011 17:39
How can apply mass flow rate boundary condition? Sima Phoenics 1 December 1, 2007 19:55


All times are GMT -4. The time now is 06:04.