CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Channel flow (

Niklas Nordin (Niklas) March 27, 2002 16:17

Hi, I want to run a channe

I want to run a channel which is very loong
and am only interested in the fully developed flow.

Is there an easy way to use a short channel instead where I map the outlet conditions to the inlet.

I don't have/know the pressure difference driving the
flow, only the inlet conditions.


Hrvoje Jasak (Hrvoje) March 27, 2002 17:45

Hi, Yes, we've got somethi

Yes, we've got something like that For starters, a fully developed channel is a 1-D problem, so you can actually save a lot with this.

The application you want is in the standard release and it's called boundaryFoam. Creata a 1-D mesh across the height of the channel and put a wall at the top and the bottm and a nothing all the way around. Then, you select your favourite turbulence model and into the transportPorperties dictionary add the Ubar entry to specify the average velocity. Run it for a bit and see what you get :-). You can then use our lovely mapping tools to transfer the solution where you need it (say a 3-D case).


P.S. If you get stuck, shout and we'll provide and example. Also, there is quite a powerful lobby over here to get the FoamX setup for the code (hello, Chris!) :-)

Niklas Nordin (Niklas) March 28, 2002 04:28

Thanks, Our problem is a b

Our problem is a bit more complex though.

The setup is like is -
Horizontal channel with gravity and two phase flow.

And we want to have a dispersion model for the discrete phase so all the particles don't end
up on the floor.

Do you think boundaryFoam can be extended to handle this?
I hear a yes, but is it easy/straightforward?


Hrvoje Jasak (Hrvoje) March 28, 2002 07:30

Hi, The idea is that in a

The idea is that in a fully developed channel flow you can formulate the problem in 1-D and get rid of the convection part. The flow is driven by a driving force, based on the averave velocity in the system - this is boundaryFoam.

If you have a fully developed system, you can play exactly the same trick, so gravity and two-phase flow (Eulerian) would be no problem. This leaves us with the problem of spray. The issue here is that the continuity normal to the wall is no longer simple, i.e. you now need the pressure eqaution and the boundaryFoam simplifications are no longer appropriate.

What you really want is to make a 1-D mesh as above, but slap the cyclic boundaries at the front and back in the direction of the flow. Then you take your standard code and add the driving force the way it has been done in boundaryFoam and run that on the case. Provided the spray modelling includes the treatment of cyclic boundaries (get uot on one end = get in at the other) all will be well.


Niklas Nordin (Niklas) March 28, 2002 07:45

Thanks, No spray in this c

No spray in this case, just 'simple' eulerian stuff.

I'll shout when I run into trouble


Eugene de Villiers April 2, 2002 06:30

Hi, I have a primitive pla

I have a primitive plane mapper, that will allow you to map any flow variable(s) from a specified plane onto the inlet (or some other boundary). If you run into trouble with the boundaryFoam approach, let me know and I'll send you a sample code and intructions.


Hrvoje Jasak (Hrvoje) April 2, 2002 15:00

Hi, Most of the code requi

Most of the code required for the primitive patch mapping has actually been included into the foam2.1 release in the sampling library (foam2.1/src/sampling) - thanks Eugene! If you are providing the example, I'd definitely be interested but please try and have a go at the foam2.1 release for it.


panara May 28, 2006 11:46

Dear all, I am trying to us
Dear all,

I am trying to use boundaryFoam but when I run the tutorial cases nothing happens.. the velocity profile remains always constant... I tryed also to change the starting values of k and epsilon but without any results...

what's the problem? anybody can help?


rcpoudel January 10, 2007 18:42

Dear Eugene and all, Eugene
Dear Eugene and all,

Eugene: I want to map flow variable from a specified plane to the inlet or oulet. Can I see your plane-mapper?

Does OpenFoam 1.3 has any plane-mapper tool with it?

Ram Poudel

hjasak January 10, 2007 19:49

Just use patctToPatch interpol
Just use patctToPatch interpolation.


rcpoudel January 11, 2007 00:31

Hrv, I execute simpleFoam s

I execute simpleFoam simulation for a 3D flat-plate. I want to extract velociy and other fields at a plane somewhere center of domain and use it as inlet condition for turbFoam on the same volume grid.

I check the code. However could not success on its implementation. Appreciate if you could give some detail hints/steps on how to use patchToPatchInterpolation for this case.

Thanks for you time.
Ram Poudel

hjasak January 11, 2007 09:50

Here comes: - First you cre
Here comes:

- First you create the face zone representing face you wish to sample. You can do this by writing a piece of top-level code or using a setSet utility. To create a face zone, you will select mesh faces and give them orientation (orientation is given with a flag saying if the face needs to be flipped or not to create an oriented surface).

- Second, you will choose the patch you wish to project on: that should be easy

- Third, you will create an object of type patchToPatch interpolation. As a "from patch" you will use the face zone and a "to patch" is the boundary. Thus

patchToPatchInterpolation pp

- Fourth, you will choose the information you wish to interpolate. patchToPatchInterpolation will interpolate both point-based and face-based data. I suspect you will wish to use face data.

- Fifth, you will need to select what data to map. You can either choose the face data or the data in front or behind the face zone. You will get the addressing from the faceZone class, either masterCells(), slaveCells(), or the actual face labels you've used. You will pack this information in a field, e.g. vectorField of velocities you wish to interpolate.

- Finally, you will get the mapped information doing the following:

vectorField zoneVel(...);

// fill zoneVel here, to match the faceZone)

vectorField mappedVel = pp.faceInterpolate(zoneVel);

Hope this is clear,


chegdan September 19, 2008 20:22

I tried to follow these steps,
I tried to follow these steps, but I need just a little bit more help on the above method by Jasak. I want to map the outlet boundary values to the inlet. Where do I implement steps 3-6 ? Is there an example of this somewhere?


JinBiao April 2, 2010 06:06

I am a beginner. I have a question why do we have to use boundaryFoam. Can we just compute, for example, for the flow in a long channel if we want a fully developed channel flow? It is just the time which make us prefer to choose boundaryFoam.

At the beginning I have no idea that we have something like boundaryFoam. So I computed the flow in a long channel and mapped the field to the geometry I want to calculate. The mapped part includes the inlet. I set the inlet boundary as fixedValue for U, k and epsilon. After mapping the field, I got nonuniform fixValue boundary at the inlet for these variables.

The problem is that I got an error as follow


Create time

Create mesh for time = 2

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type RASModel
Selecting RAS turbulence model LaunderSharmaKE
#0  Foam::error::printStack(Foam::Ostream&) in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/"
#1  Foam::sigFpe::sigFpeHandler(int) in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/"
#2  ?? in "/lib/"
#3  Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/"
#4  void Foam::divide<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/"
#5  Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator/<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/"
#6  Foam::incompressible::RASModels::LaunderSharmaKE::fMu() const in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/"
#7  Foam::incompressible::RASModels::LaunderSharmaKE::LaunderSharmaKE(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&) in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/"
#8  Foam::incompressible::RASModel::adddictionaryConstructorToTable<Foam::incompressible::RASModels::LaunderSharmaKE>::New(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&) in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/"
#9  Foam::incompressible::RASModel::New(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&) in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/"
#10  Foam::incompressible::turbulenceModel::addturbulenceModelConstructorToTable<Foam::incompressible::RASModel>::NewturbulenceModel(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&) in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/"
#11  Foam::incompressible::turbulenceModel::New(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&) in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/"
#12  main in "/home/openfoam/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/pisoFoam"
#13  __libc_start_main in "/lib/"
#14  _start at /build/buildd/glibc-2.9/csu/../sysdeps/x86_64/elf/start.S:116
Floating point exception

I donot know what is the difference between patchToPatch and mapFields. Is this problem caused by a wrong mapping?

Thanks in advance for any suggestion.


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