CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Wall BC varying with tube radius

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By babakflame

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 26, 2016, 04:49
Default Wall BC varying with tube radius
  #1
New Member
 
Giannokostas Konstantinos
Join Date: Aug 2016
Posts: 6
Rep Power: 9
k.giannoko is on a distinguished road
Hello Everyone,

If i have a pipe flow and I want to impose a slip condition at the wall varying with local tube radius, cause the tube is not straight but it's radius is different from point to point. How can I insert R in this expression :

Wall
{
type codedFixedValue;
value uniform (0 0 0);
redirectType rampedFixedValue;
code
#{
vector (0, 0 , f(R)*DUz/Dy);
#};
}



Thank you very much
k.giannoko is offline   Reply With Quote

Old   October 2, 2016, 13:50
Default
  #2
Senior Member
 
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 15
babakflame is on a distinguished road
Hey Giannokostas

Look at these two samples. Hope you find the idea
Before defining your vector, you need to define your function correctly.

Code:
 inlet     {         
type            codedFixedValue;
         value           uniform (0 0 0);
         redirectType    velocitySquareInlet;
             code         #{
             const fvPatch& boundaryPatch = patch();
              const vectorField& Cf = boundaryPatch.Cf();
               vectorField& field = *this;
              scalar min = 0.501;
               scalar max = 0.751;    
           forAll(Cf, faceI)             {
                if (
                     (Cf[faceI].z() > min) && 
                    (Cf[faceI].z() < max) &&
                     (Cf[faceI].y() > min) && 
                    (Cf[faceI].y() < max)
                  )
                 { 
                    field[faceI] = vector(0.1, 0, 0); 
                } 
            } 
        #};
    }
Code:
right
    {
        type codedFixedValue; 
    value uniform 0; 
    redirectType rampedFixedValue; 
    code 
    #{ 

        (*this)==scalar(1.1*log(1.0));
//      (*this)==vector(0.5*sin(3.141592)*this->db().time().value())/2,0,0);

    #};
You can roughly do anything with codedFixedValue boundary Type.

Hope this helps.

Last edited by babakflame; October 2, 2016 at 16:20.
babakflame is offline   Reply With Quote

Old   October 6, 2016, 03:52
Default
  #3
New Member
 
Sachin
Join Date: Sep 2016
Location: Poitiers,France
Posts: 17
Rep Power: 9
smodh is on a distinguished road
I am using codedFixedValue bc for implementing ΔV=0 ;where V=x2+y2+z2
my boundarycondition at 0/phi is:
inlet
{
type codedFixedValue;
value uniform 0;
redirectType velocitySquareInlet;

code
#{
const fvPatch& boundaryPatch = patch();
const vectorField& Cf = boundaryPatch.Cf();

scalarField& field = *this;

forAll(Cf, faceI)
{
(
(Cf[faceI].x()=0) &&
(Cf[faceI].y()=0) &&
(Cf[faceI].z()=0)
)
{
field[faceI] = ((Cf[faceI].x()*Cf[faceI].x())
+(Cf[faceI].y()*Cf[faceI].y())
+(Cf[faceI].z()*Cf[faceI].z()));
}
}
#};


But in terminal I have error in BC
does anyone have idea where I am wrong?
thanks
smodh is offline   Reply With Quote

Old   October 6, 2016, 16:34
Default
  #4
Senior Member
 
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 15
babakflame is on a distinguished road
Hey Sachin

Can u post the error and describing your boundary a little more? Is it a scalar or vector??

You are trying to define a gradient. Isn't gradient a vector?

Last edited by babakflame; October 6, 2016 at 17:42.
babakflame is offline   Reply With Quote

Old   October 7, 2016, 03:43
Default
  #5
New Member
 
Sachin
Join Date: Sep 2016
Location: Poitiers,France
Posts: 17
Rep Power: 9
smodh is on a distinguished road
Good morning Bobi,

I solved problem. actually it is a scalar and the solution is

FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object phi;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [1 2 -3 0 0 -1 0];

internalField uniform 0;

boundaryField
{
inlet
{
type codedFixedValue;
value uniform 0;
redirectType velocitySquareInlet;

code
#{
const fvPatch& boundaryPatch = patch();
const vectorField& Cf[/B] = boundaryPatch.Cf();

scalarField& field = *this;

forAll(Cf, faceI)
{
{
field[faceI] = ((Cf[faceI].x()*Cf[faceI].x())
+(Cf[faceI].y()*Cf[faceI].y())
+(Cf[faceI].z()*Cf[faceI].z()));
}
}

#};
}

I don't under one thing in the code is, my class is scalar.
but in the code beginning, I have to write "const vectorField& CF"
why? My field is scalar.
now code is work perfectly....but still dont understand this function meaning.
smodh is offline   Reply With Quote

Old   October 7, 2016, 10:36
Default
  #6
Senior Member
 
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 15
babakflame is on a distinguished road
Hey Sachin

Good thing that u posted the final code for others.

It would be even nicer if u use the link for code so as your posted code becomes distinguishable from other lines.

cf() member function returns the location of the face center as a vector. So, when u want to use it to as a member function for an object (boundaryPatch) of class fvPatch, the result is a vectorField.

I tried to describe it clearly. Hope this helped you.
smodh likes this.
babakflame is offline   Reply With Quote

Old   October 14, 2016, 06:09
Default Navier Slip condition
  #7
New Member
 
Giannokostas Konstantinos
Join Date: Aug 2016
Posts: 6
Rep Power: 9
k.giannoko is on a distinguished road
Hello everyone ,

Thanks for your replies i found them very useful. But still wonder , how can I insert a velocity component derivative (i.e. dUz/dy) to impose a Navier-Slip condition at the wall using the codeFixed utility..


Thank you

K.G
k.giannoko is offline   Reply With Quote

Reply


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
Basic Nozzle-Expander Design karmavatar CFX 20 March 20, 2016 08:44
Difficulty In Setting Boundary Conditions Moinul Haque CFX 4 November 25, 2014 17:30
U Tube Heat transfer- unable to get Nusselt No on wall Gowrav FLUENT 0 March 20, 2013 12:51
[Other] How to set up a dynamic mesh for a piston moving through a tube of variable diameter? karkar OpenFOAM Meshing & Mesh Conversion 0 July 4, 2012 06:54
Wall functions Abhijit Tilak Main CFD Forum 6 February 5, 1999 01:16


All times are GMT -4. The time now is 07:34.