September 22, 2021, 11:30
|
How to specify flow rate boundary condition using codedFixedValue method
|
#1
|
New Member
Ali
Join Date: Aug 2021
Posts: 3
Rep Power: 4
|
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
|
|
|