CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Inlet conditions for cyclic problem

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 18, 2010, 07:42
Default Inlet conditions for cyclic problem
  #1
New Member
 
jan
Join Date: Oct 2009
Posts: 6
Rep Power: 7
fluent145 is on a distinguished road
Hi all,

I made a simple application for the calculation of a fully developped flow in a duct. For this, I created a small piece of duct (2D) and coupled the IN and OUT using cyclic boundary conditions (see some of the other threads to know how).

This may be a dumb question, but how can I set the bulk velocity of the flow to some constant in this case ? I have the initial conditions set, but it rapidly converges to a 0 m/s flow regime.

thanks
fluent145 is offline   Reply With Quote

Old   May 18, 2010, 07:57
Default
  #2
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 8
herbert is on a distinguished road
Hi fluent145,

you are having another problem you might not see at the moment. The pressure field will not be cyclic, when you have some flow. Instead you will have a uniform pressure gradient in your flow direction.

Please have a look at openFoam's channelFoam. Its a solver for exactly your problem, handling pressure gradient explicitly. You can set the mean velocity in the domain to the value you want it to be. It's using LES but its not a big deal to make it run with RANS or laminar as well.

Good luck,
Stefan
herbert is offline   Reply With Quote

Old   May 18, 2010, 08:31
Default
  #3
New Member
 
jan
Join Date: Oct 2009
Posts: 6
Rep Power: 7
fluent145 is on a distinguished road
Hi Stefan,

Thanks for the reply.

I already looked at the channelFoam example, but I can't figure out how I have to implement a pressure gradient to my field. In the initial conditions (0.org folder) all parameters (even pressure) are set to cyclic. There is however a p.gr file in the "0" directory which holds some scalar values for pressure (I presume for all cells ?), but is this actually used in the program ?

I actually wanted to apply some massflow (say velocity) inlet condition and let the program calculate the pressure drop. This way, it seems I have to work the other way around ?
fluent145 is offline   Reply With Quote

Old   May 18, 2010, 08:50
Default
  #4
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 8
herbert is on a distinguished road
I don't think you have to work around. The pressure gradient in flow direction is an output of this solver and doesn't have to be initialized. You can give an input for you target mass flow by checking the parameter Ubar in your transportProperties. This is the target mean velocity vector giving the flow direction, too. The pressure gradient in this flow direction will be modified iteratively until this mean velocity is reached. So it's independent of any initial conditions (but, of course, the initial conditions will affect the number of iterations until reaching convergence). The pressure gradient will be saved in uniform/gradP in your time directories.

You can set the pressure field p to uniform 0 for initial condition. This pressure field will have no gradient in your flow direction to satisfy cyclic BC. In the other direction, of course, you can have a gradient.

Just check it out. You can save a lot of work using this solver. If there will arise further doubts, please fell free to ask me.

Regards,
Stefan
herbert is offline   Reply With Quote

Old   May 18, 2010, 10:14
Default
  #5
New Member
 
jan
Join Date: Oct 2009
Posts: 6
Rep Power: 7
fluent145 is on a distinguished road
I don't how I can implement this in my simpleFoam application.

Could you maybe tell me step by step how to do this ?
fluent145 is offline   Reply With Quote

Old   May 20, 2010, 03:09
Default
  #6
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 8
herbert is on a distinguished road
Hi,

you can build up your code based on channelFoam. Just replace all the terms related to LES through RANS-Terms. You could have a look at simpleFoam to get the expressions you need. Furthermore, if you want to use SIMPLE instead of PISO you can replace it from simpleFoam, too. You must insert the "-flowDirection * gradP" into your UEqn. Take care that rUA you will need for later correction of gradP is the same as 1.0/AU using SIMPLE.

Hope it helps,
Stefan
herbert is offline   Reply With Quote

Old   May 22, 2010, 16:14
Default
  #7
Member
 
David
Join Date: Dec 2009
Location: Spain
Posts: 58
Rep Power: 7
David_010 is on a distinguished road
Hi Herbert

First of all, thanks for your attention. Im trying to create a new solver from conjugateHeatFoam, but with the SIMPLE algorithm (for steady state) and adding the ciyclic condition from chanelOodles that allows to fix the average velocity. I have done the first part of my solver: changing the conjugateHeatFoam to SIMPLE algorithm, but when I add the part which calculates the pressure gradient for the cyclic condition I obtain an error due to the class tmp<fvVectorMatrix> and if I change it to fvVectorMatrix, the "clear" operator for the UEqn.clear(); is not available. The UEqn.clear() is necessary for the SIMPLE algorithm.

Do you have any idea? I would really thank you.

Regards

David

Last edited by David_010; May 23, 2010 at 05:53.
David_010 is offline   Reply With Quote

Old   May 25, 2010, 03:11
Default
  #8
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 8
herbert is on a distinguished road
Hi David,

which error is it that you recieve? If you want to access a member that's not available in tmp<fvVectorMatrix> but in fvVectorMatrix try UEqn() istead of UEqn when calling this member.

Regards,
Stefan
herbert is offline   Reply With Quote

Old   May 25, 2010, 04:04
Default
  #9
Member
 
David
Join Date: Dec 2009
Location: Spain
Posts: 58
Rep Power: 7
David_010 is on a distinguished road
Hi Stefan

Thank you very much, it works! Now I have another problem, in the solid region, I want to make periodic the temperature gradient instead of temperature. To do that I have thought in solve the temperature field in the fluid region and the temperature gradient field in the solid region. Then, if the temperature gradient is a variable (e.g GT), I would can apply cyclic conditions. I have change the solveEnergy.H solid equation in the following manner:

Code:
 // Add solid equation
        TEqns.set
        (
            1,
            new fvScalarMatrix
            (
              - fvc::div(GT*fvc::interpolate(DTsolid))
              - Q
            )
        );
where GT is a surfaceScalarField, instead of:
Code:
 // Add solid equation
        TEqns.set
        (
            1,
            new fvScalarMatrix
            (
              - fvm::laplacian(DTsolid, Tsolid)
              - Q
            )
        );
but when I try to compile the code, I obtain the error:

Code:
In file included from Prototipe01.C:63:
solveEnergy.H: In function ‘int main(int, char**)’:
solveEnergy.H:32: error: no matching function for call to ‘Foam::fvMatrix<double>::fvMatrix(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >)’
/home/david/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude/fvMatrix.C:323: note: candidates are: Foam::fvMatrix<Type>::fvMatrix(Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, Foam::Istream&) [with Type = double]
/home/david/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude/fvMatrix.C:266: note:                 Foam::fvMatrix<Type>::fvMatrix(const Foam::tmp<Foam::fvMatrix<Type> >&) [with Type = double]
/home/david/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude/fvMatrix.C:235: note:                 Foam::fvMatrix<Type>::fvMatrix(const Foam::fvMatrix<Type>&) [with Type = double]
/home/david/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude/fvMatrix.C:184: note:                 Foam::fvMatrix<Type>::fvMatrix(Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::dimensionSet&) [with Type = double]
make: *** [Make/linux64GccDPOpt/Prototipe01.o] Error 1
May be it isn't the correct way to do that...I don't know. Anyway, thank you very much for your help.

Regards

David
David_010 is offline   Reply With Quote

Old   May 25, 2010, 05:30
Default
  #10
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 8
herbert is on a distinguished road
Hi David,

I think there are several problems. Firstly fvc::div() will return an volField and no matrix. Only fvm::div(DTSolid*GT) will return a matrix. Secondly I don't understand how you are evaluating GT. Are you solving an equation for this field in order to get cyclic boundary conditions involved? And what boundary conditions are you thinking about to apply for Tsolid?

Regards,
Stefan
herbert is offline   Reply With Quote

Old   May 25, 2010, 08:47
Default
  #11
Member
 
David
Join Date: Dec 2009
Location: Spain
Posts: 58
Rep Power: 7
David_010 is on a distinguished road
Hi Stefan

Thanks for reply. I have to say that I'm using conjugateHeatFoam solver. Because I need to apply cyclic conditions to the temperature gradient and not to the temperature Tsolid (in the solid region), I have created a new variable named GT which I want that it be the temperature gradient (surfaceScalarField) and deleted the Tsolid variable. So I want so solve a equation where the variables will be the temperature gradient GT (in the solid region) and the temperature T (in the fluid region).

I don't know if there is any other way to specify a cyclic temperature gradient condition. That would be ideal for me, because the temperature b.c for my solid region (a wall duct) are zeroGradient for the outer wall, coupled with fluid for the inner wall and cyclic gradient for the extremes wall. The last one is the one I unknow.

Thanks a lot for your help

Regards

David
David_010 is offline   Reply With Quote

Old   June 1, 2010, 05:18
Default
  #12
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 8
herbert is on a distinguished road
Hi David,

I wonder if you have already solved your problem. If not I would suggest to make an explicit iteration process for the temperature in your solid region instead of applying cyclic conditions. I would create a fixedValue-patch 1 and a fixedGradient-patch 2 and then patch gradient from 1 to 2 and the value form 2 to 1 (I think with an homogenous shift in your case). Normally such iteration converges pretty fast.
The advantage of this method is, that you don't have to care about the coupling with fluid region, because you are solving for Tsolid (and not for the gradient).

Regards,
Stefan
herbert is offline   Reply With Quote

Old   June 1, 2010, 13:11
Default
  #13
Member
 
David
Join Date: Dec 2009
Location: Spain
Posts: 58
Rep Power: 7
David_010 is on a distinguished road
Hi Stefan

Thanks a lot for your help. I still haven't solved the problem. Your suggestion sounds great! but I have two problems:

1. How I can do that? Do you know if there are any tutorial case or anything similar where I can learn it from?
2. The problem is that the solid region has a heat/volume generation, and the temperature increases along the axial tube direction. Then, the temperature in one patch will be higher than in the other patch, and I cannot patch from one to other. The only thing is equal in both patches is the temperature gradient. That is the reason because I cannot apply a simple cyclic condition for the temperature. I don't know if I am explaining it well.

For the fluid region I have used the directMapped condition for both temperature and velocity (for the temperature the outlet is zeroGradient and the inlet is directMapped and averaged to 300). But in the solid region I cannot do the same because I unknow the temperature gradient, I only know that it is cyclic.

I really appreciate your help.

Regards

David
David_010 is offline   Reply With Quote

Reply

Tags
boundary conditions, cyclic

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind turbine simulation Saturn CFX 34 October 16, 2014 05:27
Problem with centrifugal pump calculation Michiel Main CFD Forum 2 June 17, 2012 21:32
Face ordering problem for nonrectangular cyclic boundary conditions cfdmarkus OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 3 August 17, 2011 15:07
problem specifying alpha at inlet during a parallel run phsieh2005 OpenFOAM Running, Solving & CFD 2 August 13, 2009 08:23
UDF 3D inlet b.c. problem Andrew FLUENT 4 May 25, 2004 04:24


All times are GMT -4. The time now is 15:34.