|
[Sponsors] |
June 6, 2023, 07:48 |
Dynamic Boundary Conditions
|
#1 |
New Member
Elena
Join Date: Jun 2023
Posts: 1
Rep Power: 0 |
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 |
|
Tags |
boundary conditions, code, codedfixedvalue, conditions, pipe |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Multiphase flow - incorrect velocity on inlet | Mike_Tom | CFX | 6 | September 29, 2016 02:27 |
Error - Solar absorber - Solar Thermal Radiation | MichaelK | CFX | 12 | September 1, 2016 06:15 |
Velocity vector in impeller passage | ngoc_tran_bao | CFX | 24 | May 3, 2016 22:16 |
Difficulty In Setting Boundary Conditions | Moinul Haque | CFX | 4 | November 25, 2014 18:30 |
Error finding variable "THERMX" | sunilpatil | CFX | 8 | April 26, 2013 08:00 |