|
[Sponsors] |
Interpolating scalarField values between two non conformal patches |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 22, 2019, 11:36 |
Interpolating scalarField values between two non conformal patches
|
#1 |
New Member
Anubhav
Join Date: Apr 2019
Posts: 2
Rep Power: 0 |
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 08:38. |
|
May 24, 2019, 10:39 |
|
#2 |
New Member
Anubhav
Join Date: Apr 2019
Posts: 2
Rep Power: 0 |
Is there no one who can help?
|
|
May 28, 2019, 11:51 |
|
#3 |
Senior Member
|
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 |
|
May 31, 2019, 13:17 |
|
#4 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
Maybe this is useful How to define a non-comformal interface
|
|
Tags |
boundary condition, boundary conditions |
|
|
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 05:56 |
Possible bug with stitchMesh and cyclics in OpenFoam | Jack001 | OpenFOAM Pre-Processing | 0 | May 21, 2016 09:00 |
Case running in serial, but Parallel run gives error | atmcfd | OpenFOAM Running, Solving & CFD | 18 | March 26, 2016 13:40 |
exact face values | RubenG | Main CFD Forum | 0 | June 22, 2009 12:09 |
strange node values @ solid/fluid interface - help | JB | FLUENT | 2 | November 1, 2008 13:04 |