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

Dynamic Boundary Conditions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2023, 06:48
Question Dynamic Boundary Conditions
  #1
New Member
 
Elena
Join Date: Jun 2023
Posts: 1
Rep Power: 0
ekhramen is on a distinguished road
Hey everyone! I am a new user of openfoam and I am struggling with defining the correct boundary conditions for a pipeline. I would like to implement the conditions for the velocity outlet which is updated at every time step and depends on the velocity inlet value and current pressure in the pipeline.
The conditions I want to implement:
if velocity_inlet < 0.88 * P_previous_step - 0.7:
velocity_outlet = 0.88 * P_previous_step - 0.7
elif velocity_inlet > 0.88 * P_previous_step - 0.7 and P_previous_step < 40:
velocity_outlet = 0.88 * P_previous_step - 0.7
elif velocity_inlet > 0.88 * P_previous_step - 0.7 and P_previous_step > 40:
velocity_outlet = velocity_inlet

I use pimplefoam and the 0/U file includes the following:


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2212 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{

walls
{
type fixedValue;
value uniform (0 0 0);
}

inlet
{
type uniformFixedValue;
uniformValue table
(
(1 (0.5371 0 0))
(2 (0.5412 0 0))
(3 (0.5453 0 0))
(4 (0.5478 0 0))
...
(599 (0.5714 0 0))
(600 (0.5657 0 0))
);
}

outlet
{
type codedFixedValue;
value uniform (0 0 0);
name pipe_outflow;

code
#{

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

forAll(Cf, faceI)
{
// Pressure values
// const label& patchLabel = boundaryPatch.index();
// const volScalarField& p = this->db().lookupObject<volScalarField>("p");
// fvPatchScalarField pressure = p.boundaryField()[patchLabel];

// Velocity values
//const volVectorField& u = db().lookupObject<vectorField>("U");
//fvPatchVectorField velocity_inlet = u.boundaryField()[0];

// CONDITIONS

const scalar x = Cf[faceI].component(0); // outlet velocity value
field[faceI] = vector(x, 0, 0);
}

#};


}

}

Can anyone help me with defining the conditions and extracting the pressure and velocity inlet values? Thank you!

Cheers, Elena
ekhramen is offline   Reply With Quote

Reply

Tags
boundary conditions, code, codedfixedvalue, conditions, pipe


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
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 01:27
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 05:15
Velocity vector in impeller passage ngoc_tran_bao CFX 24 May 3, 2016 21:16
Difficulty In Setting Boundary Conditions Moinul Haque CFX 4 November 25, 2014 17:30
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00


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