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

How to specify flow rate boundary condition using codedFixedValue method

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 22, 2021, 11:30
Post How to specify flow rate boundary condition using codedFixedValue method
  #1
New Member
 
Ali
Join Date: Aug 2021
Posts: 3
Rep Power: 5
Ali_Sh is on a distinguished road
I would like to specify a small section of a wall to be outlet. So, I have used codedFixedValue to specify some meshes which centers are within a considered circle on the wall. The code will not be difficult when the boundary condition would be specified by velocity only, not the flow rate. The model is as the following photo:
image.jpg
The inletWalls in the code is written only for showing how flow rate can be written for a patch. How to specify this boundary condition i.e. type flowRateOutletVelocity and its value in the outletWalls section?
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  | =========                 |                                                 |
  | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
  |  \\    /   O peration     | Version:  v3.0+                                 |
  |   \\  /    A nd           | Web:      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
{
  inletWalls
  {
    type                 flowRateInletVelocity;
    volumetricFlowRate   0.3;
    value                uniform (0 0 0);
  }
  outletWalls
  {
   	type            codedFixedValue;
    	value           uniform (0 0 0);
    	redirectType    perf_outlet;

	code
    	#{
            const fvPatch& boundaryPatch = patch(); 
            const vectorField& Cf = boundaryPatch.Cf(); 
            vectorField& field = *this; 
        
            const scalar perf_r = 0.12;          // radius of the circle

 	    	forAll(Cf, faceI)
            {
                if (
		   //(Cf[faceI].y() == 1.1) &&
                   (pow(Cf[faceI].x(),2) * pow(Cf[faceI].z(),2) <= pow(perf_r,2))     // when the circle is on Y-plane
                   )
            	   {
               		field[faceI] = vector(0,1,0);   // It must be modified for specifying flowrate
	           }
	    }
   	#};         

  	codeOptions
  	#{
       	    -I$(LIB_SRC)/finiteVolume/lnInclude \
       	    -I$(LIB_SRC)/meshTools/lnInclude
   	#};

  	codeInclude
   	#{
      	    #include "fvCFD.H"
      	    #include <cmath>
     	    #include <iostream>
	#};

  }
  fixedWalls
  {
    type            slip;
  }
}

// ************************************************************************* //
I would be grateful if someone would like to help me.

Last edited by Ali_Sh; September 22, 2021 at 11:34. Reason: some changes
Ali_Sh is offline   Reply With Quote

Reply

Tags
boundary condition, boundary condition u, codedfixedvalue, flowrate, flowrateoutletvelocity


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
3D Windturbine simulation in SU2 k.vimalakanthan SU2 15 October 12, 2023 06:53
Issues on the simulation of high-speed compressible flow within turbomachinery dowlee OpenFOAM Running, Solving & CFD 11 August 6, 2021 07:40
Constant mass flow rate boundary condition sahm OpenFOAM 0 June 20, 2018 23:45
Volume of Flow Rate (VFR) boundary condition therockyy FLOW-3D 0 May 23, 2011 15:19
How can apply mass flow rate boundary condition? Sima Phoenics 1 December 1, 2007 19:55


All times are GMT -4. The time now is 21:28.