|
[Sponsors] |
|
November 11, 2021, 03:45 |
Polynomial velocity boundary condition
|
#1 |
New Member
Zhang Yan
Join Date: Nov 2021
Posts: 15
Rep Power: 4 |
Hello FOAMers,
I'm trying to set a polynomial velocity Ux boundary condition in y-z inlet. Initial values: Ux relationship with Z coordinates into a polynomial. what should I do to create such polynomial velocity boundary condition. Is there a funtion that can implement it? or I need to program it. I heard the functionality in swak4Foam can fix it. Has anyone tried that? I would be grateful if someone could answer me. |
|
November 14, 2021, 06:31 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 670
Rep Power: 14 |
Swak4Foam is great, and very easy to use. But what version of OpenFOAM are you using - ESI or foundation? Swak4Foam cannot currently be used with v9 of the foundation flavour of OpenFOAM, but you could instead use a codedFixedValue BC.
|
|
November 14, 2021, 20:19 |
|
#3 |
New Member
Zhang Yan
Join Date: Nov 2021
Posts: 15
Rep Power: 4 |
||
November 15, 2021, 05:57 |
|
#4 |
New Member
Mattia Bressanelli
Join Date: Sep 2021
Posts: 1
Rep Power: 0 |
The video linked below explains how to set up a codedFixedValue boundary condition for a parabolic inlet velocity profile:
https://www.youtube.com/watch?v=3zcT...el=HyperLyceum Alternatively, you can use a .csv file as input for a fixedValue boundary condition. https://www.youtube.com/watch?v=rfNY...nicalModelling This explains more broadly the use of codedFixedValue: https://www.youtube.com/watch?v=cvWa...el=HolzmannCFD If I understand correctly, the following should be the end result (change the equation to the one you want to relate u(z) "field[i]" to z "Cf[i].z()"): Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 9 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (5.0 0 0); boundaryField { inlet { type codedFixedValue; value $internalField; name customVelocityInlet; code #{ // input values scalar U_ave = 5.0; // [m/s] scalar h_ref = 0.001; // [m] // get the patch const fvPatch& boundaryPatch = this->patch(); // get face centers "Cf" const vectorField& Cf = boundaryPatch.Cf(); vectorField& field = *this; forAll(boundaryPatch, i) { // u(z) = 1.5 * U_ave * (1 - (z/h_ref)^2) field[i] = vector(1.5 * U_ave * ( 1 - Foam::pow( Cf[i].z() / h_ref, 2 ) ), 0, 0); } // operator==(); #}; codeInclude #{ #include "fvCFD.H" #include <cmath> #include <iostream> #}; codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude #}; } outlet { type pressureInletOutletVelocity; value uniform (0 0 0); } ground { type noSlip; } #includeEtc "caseDicts/setConstraintTypes" } // ************************************************************************* // |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Import .csv - velocity profile - error | eSKa | CFX | 9 | April 3, 2021 13:38 |
Complex velocity boundary condition | Pavithra | OpenFOAM Running, Solving & CFD | 0 | October 2, 2019 00:17 |
Radiation in semi-transparent media with surface-to-surface model? | mpeppels | CFX | 11 | August 22, 2019 07:30 |
Basic Nozzle-Expander Design | karmavatar | CFX | 20 | March 20, 2016 08:44 |
Wrong flow in ratating domain problem | Sanyo | CFX | 17 | August 15, 2015 06:20 |