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

Polynomial velocity boundary condition

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

Like Tree1Likes
  • 1 Post By MattiaBressanelli

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 11, 2021, 03:45
Default Polynomial velocity boundary condition
  #1
New Member
 
Zhang Yan
Join Date: Nov 2021
Posts: 15
Rep Power: 4
Erikaaa is on a distinguished road
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.
Erikaaa is offline   Reply With Quote

Old   November 14, 2021, 06:31
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 670
Rep Power: 14
Tobermory will become famous soon enough
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.
Tobermory is offline   Reply With Quote

Old   November 14, 2021, 20:19
Default
  #3
New Member
 
Zhang Yan
Join Date: Nov 2021
Posts: 15
Rep Power: 4
Erikaaa is on a distinguished road
Quote:
Originally Posted by Tobermory View Post
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.
I'm using openFOAM v8.
Erikaaa is offline   Reply With Quote

Old   November 15, 2021, 05:57
Default
  #4
New Member
 
Mattia Bressanelli
Join Date: Sep 2021
Posts: 1
Rep Power: 0
MattiaBressanelli is on a distinguished road
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"
}

// ************************************************************************* //
GCH likes this.
MattiaBressanelli is offline   Reply With Quote

Reply

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
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


All times are GMT -4. The time now is 09:38.