CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   question about swirlMassFlowRateInletVelocity boundary type (

mcjicpm2 March 19, 2009 06:33

question about swirlMassFlowRateInletVelocity boundary type
I am trying to use the swirlMassFlowRateInletVelocity boundary type:written by olesen in the following discussion room

as below:
You might try the swirlMassFlowRateInletVelocity boundary type: swirlbc.tar.gz

Describes an massflow normal vector boundary condition by its
magnitude as an integral over its area, with a swirl component.
The current density is used to correct the velocity.
Note: The value is positive for inward pointing vectors
Swirl is defined in RPM about the patch centre-axis according
to a right-hand rule (inwards axis).
Only useful for planar patches.

Example of the BC specification:

type swirlMassFlowRateInletVelocity;
massFlowRate 0.2; // [kg/s]
rpm 5000;

Can anybody please tel me after I downloaded the files what should I do after? where should I copy the files? should I compile something?

please help me since I am very new to openfoam and it is needed for me to learn it .

leonardo.morita April 24, 2009 05:30


I don't know if it is too late, but I'll try to help you and to get some help too.

I was suggested to install all personal applications in OpenFOAM\<user>-<version> folder, not to mix with OpenFOAM's already installed applications.
In the case of one new BC, you can copy the files into the \src\<newBC> folder, for example. After that, you have to create one other folder, named Make, in the same address of the .C file. In this Make folder, you need to create two files: options and files. So in the end you'll have something like:

- <newBC>.C
- Make\files
- Make\option

(in general, you may have more than just one .C and even some .H files)

And I can't help you I'll ask somebody to explain what I should exactly write in these Make\files and Make\options.
I think that in the Make\files we must list the files that are going to be compiled and at the end, the address and name of the file (.so, in this case) that will be created. For this case (swirlMassFlowRateInletVelocity), I tried:


LIB = $(FOAM_USER_LIBBIN)/swirlMassFlowRateInletVelocity

In the case of the Make\options, I just know we have to show what libraries etc will be needed during the compilation (with -I), but I can't understand the meaning of the rest of the code. In this case, I have:



After I give the wmake libso comand, I receive some error messages (backslash-newline at the end of file, no match function to call etc) and no library is created.

Could anybody help?

Thank you,


leonardo.morita April 28, 2009 04:08

Hello again,

After some help from Mark, the code's developer, I could finally solve my problem. Here is a brief guide for those who have the same problem:

1. The organisation of the files is very important and it is higly recommended to keep your own applications in your personal folder, OpenFOAM/<user>-<version>. So you should/may have (you can replace src by one other folder, like a foamUser, for example):


where, in this case:

<newlib> = swirlFlowRateInletVelocity
<file>.C = swirlFlowRateInletVelocityFvPatchVectorField.C
<file>.H = swirlFlowRateInletVelocityFvPatchVectorField.H

2. The content of the Make/files file is:

<newlib>/<file>.C //relative address of the file to be compiled


3. And that of the Make/options is:



4. The only library that will be created is, which will gather information about all your own libraries listed in the Make/files file. If you want to add some other library later, all you have to do is to create a new folder with the .C and .H files and to put an extra line in the Make/files, like:

<newlib>/<file>.C //relative address of the file to be compiled

5. Once the files are well placed, you can compile it using wmake libso in the ~/src/ folder

Hope this will be useful!

tian November 16, 2009 14:41


it is also working for the OpenFOAM 1.5-dev Version?


tian November 17, 2009 14:16

1 Attachment(s)

I changed the code for OpenFOAM-1.5-dev Version. Thanks


S_teph_2000 August 28, 2014 03:08

Modify swirlFlowRateInletVelocityFvPatchVectorField

I would like to modify swirlFlowRateInletVelocityFvPatchVectorField in order to use velocity components (in cylindrical coordinates if possible) instead of rpm. I will also add that each velocity component is a function of the radial component of U.

instead of:
type swirlMassFlowRateInletVelocity;
massFlowRate 0.2; // [kg/s]
rpm 5000;

we would have
type swirlMassFlowRateInletVelocity;
massFlowRate 0.2; // [kg/s]
Ur = f1(r); //I also need to find a way to input an expression "f(r)" instead of a value. maybe with Swak{...}, or groovyBC???
Ut = f2(r);
Uz = f3(r);

with r=x^2+y^2

I an trying to set the BC for the inlet of a steam turbine...HELP PLEASE!!


All times are GMT -4. The time now is 16:05.