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

Interpolating scalarField values between two non conformal patches

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 22, 2019, 10:36
Default Interpolating scalarField values between two non conformal patches
  #1
New Member
 
Anubhav
Join Date: Apr 2019
Posts: 2
Rep Power: 0
goku15 is on a distinguished road
I am performing a simulation on an aircraft and needed to simulate the engine using a give fan pressure ratio and polytropic efficiency. I have implemented this using a CodedFixedValue boundary condition between two patches (fanInlet and fanOutlet) as below. This uses the values of the scalar field from one patch and assigns appropriate values to the inlet into my domain (fanOutlet).


My problem is that this requires both the patches to have same number of faces. I know tools like AMIInterpolation can be used to interpolate and assign values to patches with different number of faces. But I have no ídea how to implement this in my condition. I would really appreciate any help.



Code:
/*--------------------------------*- C++ -*----------------------------------*\
|                                                                             |
|    HiSA: High Speed Aerodynamic solver                                      |
|    Copyright (C) 2014-2017 Johan Heyns - CSIR, South Africa                 |
|    Copyright (C) 2014-2017 Oliver Oxtoby - CSIR, South Africa               |
|                                                                             |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

include         "include/freestreamConditions"

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform $k;

boundaryField
{
    inlet
    {
            type            turbulentIntensityKineticEnergyInlet;   // inletOutlet;
            intensity       0.001;                                  // = 0.1% intensity
            value           $internalField;
    }

    outlet
    {
               type         zeroGradient; 
    }

     atmosphere
    {
            type            zeroGradient; //fixedValue;
   //     uniform         $internalField;
    }

    nacelle
    {
            type            boundaryCorrectedFixedValue;
            value           uniform 0;

    }

     fuselage
    {
            type            boundaryCorrectedFixedValue;
            value           uniform 0;

    }


    fanInlet

    {
            type            zeroGradient;
    }


    fanOutlet 

    {

    type            codedFixedValue;
    value           $internalField; 
    redirectType    kOutletFanBC; 

    code 
        #{ 

            const dictionary& fvSolution = db().lookupObject<IOdictionary> ("fvSolution");
            scalar turbulentIntensity = fvSolution.subDict("fanCharacteristics").lookupOrDefault<scalar>("turbulentIntesity", 0.1);
            const word& inletPatchName = fvSolution.subDict("fanCharacteristics").lookup("inletPatch");
            const word& outletPatchName = fvSolution.subDict("fanCharacteristics").lookup("outletPatch");

            const fvPatch& p = this->patch();
            label inletPatchID = p.patch().boundaryMesh().findPatchID(inletPatchName);
            label outletPatchID = p.patch().boundaryMesh().findPatchID(outletPatchName);
            const fvPatch& inletPatch = p.boundaryMesh()[inletPatchID];
            const fvPatch& outletPatch = p.boundaryMesh()[outletPatchID];    

            const vectorField& uInlet = inletPatch.lookupPatchField<volVectorField, vector> ("U");
            const scalarField& k_FinalOut = outletPatch.lookupPatchField<volScalarField, scalar> ("k");

            // field values: 
            scalarField magu = mag(uInlet);
            scalar uMean = gSum(inletPatch.magSf() * magu) / gSum(inletPatch.magSf());
            scalarField k_Outlet = mag(uInlet);
            forAll (k_Outlet , faceI)
            {
                k_Outlet[faceI] = 3 * pow((uMean * turbulentIntensity), 2) / 2 ; 
            }
            
            scalarField& kOutletField = *this; 
            forAll (kOutletField, faceI)
            { 
                kOutletField[faceI] = k_Outlet[faceI];  
                operator == (k_Outlet);                 
            }

    
        

        #}; 

        codeInclude

            #{
                    #include "fvCFD.H"
            #};

        codeOptions

            #{
                      -I$(LIB_SRC)/finiteVolume/lnInclude \
                      -I$(LIB_SRC)/meshTools/lnInclude
            #};
    
        codeLibs
            #{
                    -lmeshTools \
                    -lfiniteVolume
            #};
    }
    
    frontAndBack_left

    {
            type            wedge;
    }
    
    frontAndBack_right

    {
            type            wedge;
    }
}


// ************************************************************************* //

Last edited by goku15; May 23, 2019 at 07:38.
goku15 is offline   Reply With Quote

Old   May 24, 2019, 09:39
Default
  #2
New Member
 
Anubhav
Join Date: Apr 2019
Posts: 2
Rep Power: 0
goku15 is on a distinguished road
Is there no one who can help?
goku15 is offline   Reply With Quote

Old   May 28, 2019, 10:51
Default
  #3
Senior Member
 
Muhammad Waqas
Join Date: Jul 2014
Location: Germany
Posts: 122
Rep Power: 11
mwaqas is on a distinguished road
Send a message via Skype™ to mwaqas
Hi,
Check out section 3.6. It might be helpful for you. I didn't try myself. But the example has been given when both patches have different number of faces.


http://openfoamwiki.net/index.php/Contrib/groovyBC


Regards
mwaqas is offline   Reply With Quote

Old   May 31, 2019, 12:17
Default
  #4
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
Maybe this is useful How to define a non-comformal interface
mAlletto is offline   Reply With Quote

Reply

Tags
boundary condition, boundary conditions


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
[Commercial meshers] fluentMeshToFoam: "fluent patch type shadow not recognised" preibie OpenFOAM Meshing & Mesh Conversion 28 March 29, 2017 04:56
Possible bug with stitchMesh and cyclics in OpenFoam Jack001 OpenFOAM Pre-Processing 0 May 21, 2016 08:00
Case running in serial, but Parallel run gives error atmcfd OpenFOAM Running, Solving & CFD 18 March 26, 2016 12:40
exact face values RubenG Main CFD Forum 0 June 22, 2009 11:09
strange node values @ solid/fluid interface - help JB FLUENT 2 November 1, 2008 12:04


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