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

codedFixedValue not assigning values to the inlet

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 13, 2021, 12:49
Default codedFixedValue not assigning values to the inlet
  #1
New Member
 
Join Date: Jul 2021
Posts: 16
Rep Power: 5
Legacy is on a distinguished road
Hello,
I'm new to OpenFOAM and trying to simulate a flow in a channel to learn OpenFOAM. I'm running multiphase (water and air) case so I would like to assign flowrate where alpha.water is 1 (which is z<=0.8 in my case. I used the following code in my 0/U file but nothing is happening to the model. Can someone who has experience with codedFixedValue chime in on this? I would appreciate the help. Thanks.

Here in the inlet BC from 0/U file

Code:
inlet
    {
        type            codedFixedValue;
        value           uniform (0 0 0);
        name            inletBC;
        code            

        #{
                const fvPatch& boundaryPatch = patch();
                const vectorField& Cf = boundaryPatch.Cf();
                vectorField& field = *this;

                forAll (Cf, faceI) // loop over all the patch faces
                {
                    const scalar x = Cf[faceI].x(); // y coordinate of the face
                    const scalar y = Cf[faceI].y(); // y coordinate of the face
                    const scalar z = Cf[faceI].z(); //  y coordinate of the face

                    if (z <= 0.80 && y <= 2 && x <=0.1 )
                    {
                        field[faceI] = vector(1, 0, 0);

                    }

                    else
                    {

                    field[faceI] = vector (0, 0, 0);

                    }

                }
            #};
    }
Legacy is offline   Reply With Quote

Reply

Tags
codedfixedvalue, interfoam, openfoam


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
Assigning values from 2d double array to Field<Type> yousefaz OpenFOAM Programming & Development 0 June 2, 2021 21:23
Assigning values to read-only location saumavadey OpenFOAM Running, Solving & CFD 0 February 10, 2021 09:20
How can we use dimensionless values as inlet and out let BC? granzer FLUENT 3 November 8, 2019 00:29
Assigning values to a cartesian grid from a binary image (or stl) Cyp OpenFOAM Pre-Processing 1 August 5, 2014 19:02
units for inlet values of contaminant in star-ccm+ judge Siemens 0 August 13, 2008 08:29


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