CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

codedFixedValue not assigning values to the inlet

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

LinkBack Thread Tools Search this Thread Display Modes
Old   October 13, 2021, 11:49
Default codedFixedValue not assigning values to the inlet
New Member
Join Date: Jul 2021
Posts: 12
Rep Power: 4
Legacy is on a distinguished road
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

        type            codedFixedValue;
        value           uniform (0 0 0);
        name            inletBC;

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



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


Legacy is offline   Reply With Quote


codedfixedvalue, interfoam, openfoam

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

All times are GMT -4. The time now is 10:25.