CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   problem about cyclic boundary (https://www.cfd-online.com/Forums/openfoam/109921-problem-about-cyclic-boundary.html)

Sunxing November 29, 2012 22:14

problem about cyclic boundary
 
1 Attachment(s)
Hi foamers,

I am simulating a 2D channel flow. I used the pisoFoam solver for my case. After calculating for 5s, I have gotten an steady solution. Now I want to change the inlet and outlet boundary condition to periodic condition, which means I want to recycle the outflow back to the inflow. So I modified all the variables in the file of 5(t=5s)------the values of the internal field have not been changed, but for the inlet and outlet boundary I have changed them as cyclic type. However, after putting out several calculating results, I find the results are not what I have expected to. The velocities of the whole field just get more and more lower.

Do I have a wrong modification? or something else
Help me please.

Lieven November 30, 2012 03:17

Dear Sunxing,

The problem is that you don't impose a driving force in the latter case.

Have a look at http://www.cfd-online.com/Forums/ope...onditions.html . If it is still not clear, feel free to ask again :)

Regards,


L

Sunxing November 30, 2012 09:05

Quote:

Originally Posted by Lieven (Post 394979)
Dear Sunxing,

The problem is that you don't impose a driving force in the latter case.

Have a look at http://www.cfd-online.com/Forums/ope...onditions.html . If it is still not clear, feel free to ask again :)

Regards,


L



Hi Lieven,

Thanks for your repley. I also have recognized that there maybe should have a differencial pressure between the inlet boundary and outlet boundary. I will look the link you offered and have a try tomorrow.
thanks again.

best,
Sunxing

Sunxing November 30, 2012 21:24

1 Attachment(s)
Quote:

Originally Posted by Lieven (Post 394979)
Dear Sunxing,

The problem is that you don't impose a driving force in the latter case.

Have a look at http://www.cfd-online.com/Forums/ope...onditions.html . If it is still not clear, feel free to ask again :)

Regards,


L


Hi L,

Following your proposals in the link you offered, I have modified channelFoam to include RANS-models by comparing with pisoFoam. But I couldn't compile it successfully.
Here are the files:
Make/file
my_channelFoam.C
EXE = $(FOAM_USER_APPBIN)/my_channelFoam

Make/options
EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/LES/LESModel \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-lincompressibleLESModels \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lmeshTools

Sunxing November 30, 2012 21:25

Quote:

Originally Posted by Lieven (Post 394979)
Dear Sunxing,

The problem is that you don't impose a driving force in the latter case.

Have a look at http://www.cfd-online.com/Forums/ope...onditions.html . If it is still not clear, feel free to ask again :)

Regards,


L


Hi L,

Following your proposals in the link you offered, I have modified channelFoam to include RANS-models by comparing with pisoFoam. But I couldn't compile it successfully.
Here are the files:
Make/file
my_channelFoam.C
EXE = $(FOAM_USER_APPBIN)/my_channelFoam

Make/options
EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/LES/LESModel \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-lincompressibleLESModels \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lmeshTools

Can you give me some more tips please? Thanks very much!

Sunxing

Lieven December 1, 2012 01:53

Hey Sunxing,

What is the error you get? At first sight, the option-file looks ok.

Regards,


L

Sunxing December 1, 2012 02:08

Hi L,

Here is the error hint:

my_channelFoam.C: in function ‘int main(int, char**)’:
my_channelFoam.C:67:10: error: ‘turbulence’ has not yet been declared in this action scope
/home/sun/OpenFOAM/OpenFOAM-2.1.1/src/finiteVolume/lnInclude/readPISOControls.H:3:15: warning: 未使用的变量‘nOuterCorr’ [-Wunused-variable]
/home/sun/OpenFOAM/OpenFOAM-2.1.1/src/finiteVolume/lnInclude/readPISOControls.H:15:16: warning: 未使用的变量‘transonic’ [-Wunused-variable]
make: *** [Make/linuxGccDPOpt/my_channelFoam.o] error 1

Sunxing December 1, 2012 02:16

Hi L,

Please pay attention to the my_channelfoam.c document posted in #4. There maybe something wrong in the document, but I don't know what it is.

Regards,
Sunxing

Lieven December 1, 2012 10:58

In the file createFields.H, did you change

Code:

    autoPtr<incompressible::LESModel> sgsModel
    (
        incompressible::LESModel::New(U, phi, laminarTransport)
    );

to

Code:

    autoPtr<incompressible::turbulenceModel> turbulence
    (
        incompressible::turbulenceModel::New(U, phi, laminarTransport)
    );

Cheers,


L

Sunxing December 2, 2012 07:20

Hi L,

Yes, you are right. I didn't change the code. And after changing the code, I have compiled it successfully. I will check the new solver by calculating my case. Thanks for your generous help.

Best,

Sunxing

Sunxing December 2, 2012 21:09

Hey L,

I have simulated my channel case using the modified channelFoam solver. By using the modified solver, it did give me a result that with a cyclic boundary condition. But there is something wrong. For the velocity field, before I use the cyclic boundary condition, I just get a good result using the pisoFoam solver at the 5th second. Then I continued the simulation with the result at 5th second as a initial condition using the modified channelFoam.
Here are the velocities at on slice:
velocities of the 5th second using pisoFoam
(3.21537 0 0)
(3.79661 0 0)
(4.13732 0 0)
(4.4017 0 0)
(4.62863 0 0)
(4.83443 0 0)
(5.02694 0 0)
(5.21189 0 0)
(5.39214 0 0)
(5.56978 0 0)
(5.74597 0 0)
(5.92096 0 0)
(6.09656 0 0)
(6.27405 0 0)
(6.45347 0 0)
(6.63548 0 0)
(6.82096 0 0)
(7.00976 0 0)
(7.20203 0 0)
(7.39828 0 0)
(7.5988 0 0)
(7.80382 0 0)
(8.01358 0 0)
(8.22832 0 0)
(8.44825 0 0)
(8.67356 0 0)
(8.90448 0 0)
(9.14119 0 0)
(9.3839 0 0)
(9.6328 0 0)
(9.88807 0 0)
(10.1499 0 0)
(10.4186 0 0)
(10.6942 0 0)
(10.9629 0 0)
(11.2057 0 0)
(11.4205 0 0)
(11.6135 0 0)
(11.789 0 0)
(11.9501 0 0)
(12.0991 0 0)
(12.2379 0 0)
(12.3678 0 0)
(12.49 0 0)
(12.6055 0 0)
(12.7149 0 0)
(12.8189 0 0)
(12.9182 0 0)
(13.013 0 0)
(13.1039 0 0)
(13.1911 0 0)
(13.275 0 0)
(13.3559 0 0)
(13.4339 0 0)
(13.5092 0 0)
(13.5822 0 0)
(13.6528 0 0)
(13.7214 0 0)
(13.7879 0 0)
(13.8526 0 0)
(13.9155 0 0)
(13.9767 0 0)
(14.0364 0 0)
(14.0946 0 0)
(14.1514 0 0)
(14.2068 0 0)
(14.261 0 0)
(14.314 0 0)
(14.3658 0 0)
(14.4165 0 0)
(14.4662 0 0)
(14.5149 0 0)
(14.5626 0 0)
(14.6094 0 0)
(14.6553 0 0)
(14.7003 0 0)
(14.7446 0 0)
(14.788 0 0)
(14.8308 0 0)
(14.8727 0 0)
(14.914 0 0)
(14.9546 0 0)
(14.9946 0 0)
(15.0339 0 0)
(15.0727 0 0)
(15.1108 0 0)
(15.1484 0 0)
(15.1854 0 0)
(15.2219 0 0)
(15.2578 0 0)
(15.2933 0 0)
(15.3283 0 0)
(15.3628 0 0)
(15.3968 0 0)
(15.4304 0 0)
(15.4636 0 0)
(15.4963 0 0)
(15.5287 0 0)
(15.5606 0 0)
(15.5922 0 0)
(15.5922 0 0)
(15.5606 0 0)
(15.5287 0 0)
(15.4963 0 0)
(15.4636 0 0)
(15.4304 0 0)
(15.3968 0 0)
(15.3628 0 0)
(15.3283 0 0)
(15.2933 0 0)
(15.2578 0 0)
(15.2219 0 0)
(15.1854 0 0)
(15.1484 0 0)
(15.1108 0 0)
(15.0727 0 0)
(15.0339 0 0)
(14.9946 0 0)
(14.9546 0 0)
(14.914 0 0)
(14.8727 0 0)
(14.8308 0 0)
(14.788 0 0)
(14.7446 0 0)
(14.7003 0 0)
(14.6553 0 0)
(14.6094 0 0)
(14.5626 0 0)
(14.5149 0 0)
(14.4662 0 0)
(14.4165 0 0)
(14.3658 0 0)
(14.314 0 0)
(14.261 0 0)
(14.2068 0 0)
(14.1514 0 0)
(14.0946 0 0)
(14.0364 0 0)
(13.9767 0 0)
(13.9155 0 0)
(13.8526 0 0)
(13.7879 0 0)
(13.7214 0 0)
(13.6528 0 0)
(13.5822 0 0)
(13.5092 0 0)
(13.4339 0 0)
(13.3559 0 0)
(13.275 0 0)
(13.1911 0 0)
(13.1039 0 0)
(13.013 0 0)
(12.9182 0 0)
(12.8189 0 0)
(12.7149 0 0)
(12.6055 0 0)
(12.49 0 0)
(12.3678 0 0)
(12.2379 0 0)
(12.0991 0 0)
(11.9501 0 0)
(11.789 0 0)
(11.6135 0 0)
(11.4205 0 0)
(11.2057 0 0)
(10.9629 0 0)
(10.6942 0 0)
(10.4186 0 0)
(10.1499 0 0)
(9.88807 0 0)
(9.6328 0 0)
(9.3839 0 0)
(9.14119 0 0)
(8.90448 0 0)
(8.67356 0 0)
(8.44825 0 0)
(8.22832 0 0)
(8.01358 0 0)
(7.80382 0 0)
(7.5988 0 0)
(7.39828 0 0)
(7.20203 0 0)
(7.00976 0 0)
(6.82096 0 0)
(6.63548 0 0)
(6.45347 0 0)
(6.27405 0 0)
(6.09656 0 0)
(5.92096 0 0)
(5.74597 0 0)
(5.56978 0 0)
(5.39214 0 0)
(5.21189 0 0)
(5.02694 0 0)
(4.83443 0 0)
(4.62863 0 0)
(4.4017 0 0)
(4.13732 0 0)
(3.79661 0 0)
(3.21537 0 0)
)


velocities from the result simulated by modified channelFoam

(0.0121199 6.54506e-14 -1.24588e-24)
(0.0387828 2.96048e-13 0)
(0.070777 1.27878e-12 0)
(0.109168 2.99316e-12 0)
(0.155235 6.11546e-12 0)
(0.210512 1.12437e-11 0)
(0.276839 1.93505e-11 0)
(0.356423 3.18278e-11 0)
(0.451912 5.06432e-11 0)
(0.566479 7.85707e-11 0)
(0.703928 1.19505e-10 0)
(0.868816 1.78873e-10 0)
(1.06659 2.64189e-10 0)
(1.30374 3.85748e-10 0)
(1.58797 5.57427e-10 0)
(1.92825 7.97381e-10 0)
(2.33465 1.12826e-09 0)
(2.81703 1.57755e-09 0)
(3.3801 2.18251e-09 0)
(4.01052 3.00405e-09 0)
(4.66714 4.1331e-09 0)
(5.30211 5.69131e-09 0)
(5.88836 7.81885e-09 0)
(6.41863 1.06324e-08 0)
(6.89597 1.42212e-08 0)
(7.32797 1.86395e-08 0)
(7.72352 2.39051e-08 0)
(8.09103 3.00086e-08 0)
(8.43765 3.69018e-08 0)
(8.76912 4.45051e-08 0)
(9.08994 5.27133e-08 0)
(9.40359 6.13977e-08 0)
(9.71272 7.0381e-08 0)
(10.0194 7.94176e-08 0)
(10.309 8.79927e-08 0)
(10.5648 9.57437e-08 0)
(10.7876 1.02631e-07 0)
(10.9854 1.08794e-07 0)
(11.1635 1.1439e-07 0)
(11.3255 1.19552e-07 0)
(11.4743 1.24368e-07 0)
(11.6119 1.28851e-07 0)
(11.74 1.33067e-07 0)
(11.8598 1.37033e-07 0)
(11.9724 1.40776e-07 0)
(12.0786 1.44319e-07 0)
(12.1791 1.47685e-07 0)
(12.2745 1.50891e-07 0)
(12.3653 1.53948e-07 0)
(12.4519 1.56866e-07 0)
(12.5346 1.5965e-07 0)
(12.6137 1.62301e-07 0)
(12.6896 1.64818e-07 0)
(12.7624 1.672e-07 0)
(12.8324 1.69443e-07 0)
(12.8997 1.71539e-07 0)
(12.9645 1.73486e-07 0)
(13.027 1.75286e-07 0)
(13.0871 1.76917e-07 0)
(13.1452 1.78352e-07 0)
(13.2012 1.7959e-07 0)
(13.2553 1.80641e-07 0)
(13.3075 1.81478e-07 0)
(13.3579 1.82075e-07 0)
(13.4065 1.82418e-07 0)
(13.4535 1.82478e-07 0)
(13.4988 1.82229e-07 0)
(13.5425 1.81651e-07 0)
(13.5846 1.80736e-07 0)
(13.6252 1.79481e-07 0)
(13.6643 1.77889e-07 0)
(13.7019 1.75947e-07 0)
(13.7381 1.73643e-07 0)
(13.7728 1.70967e-07 0)
(13.8061 1.67913e-07 0)
(13.838 1.64479e-07 0)
(13.8684 1.60664e-07 0)
(13.8975 1.56476e-07 0)
(13.9252 1.51937e-07 0)
(13.9516 1.47004e-07 0)
(13.9766 1.41741e-07 0)
(14.0002 1.3617e-07 0)
(14.0224 1.30305e-07 0)
(14.0434 1.24164e-07 0)
(14.063 1.17764e-07 0)
(14.0813 1.11128e-07 0)
(14.0983 1.04277e-07 0)
(14.114 9.72324e-08 0)
(14.1284 9.00131e-08 0)
(14.1416 8.26374e-08 0)
(14.1535 7.51215e-08 0)
(14.1641 6.74939e-08 0)
(14.1735 5.97678e-08 0)
(14.1818 5.19607e-08 0)
(14.1888 4.40897e-08 0)
(14.1946 3.61849e-08 0)
(14.1992 2.81969e-08 0)
(14.2027 2.02247e-08 0)
(14.205 1.2223e-08 0)
(14.2062 4.19454e-09 0)
(14.2062 -3.78626e-09 0)
(14.205 -1.17996e-08 0)
(14.2027 -1.97858e-08 0)
(14.1992 -2.77476e-08 0)
(14.1946 -3.56773e-08 0)
(14.1888 -4.3565e-08 0)
(14.1818 -5.13996e-08 0)
(14.1735 -5.91682e-08 0)
(14.1641 -6.6855e-08 0)
(14.1535 -7.44454e-08 0)
(14.1416 -8.19257e-08 0)
(14.1284 -8.92701e-08 0)
(14.114 -9.64633e-08 0)
(14.0983 -1.03488e-07 0)
(14.0813 -1.10325e-07 0)
(14.063 -1.16954e-07 0)
(14.0434 -1.23354e-07 0)
(14.0224 -1.29502e-07 0)
(14.0002 -1.3538e-07 0)
(13.9766 -1.40969e-07 0)
(13.9516 -1.46255e-07 0)
(13.9252 -1.51217e-07 0)
(13.8975 -1.55789e-07 0)
(13.8684 -1.60011e-07 0)
(13.838 -1.63863e-07 0)
(13.8061 -1.67336e-07 0)
(13.7728 -1.70429e-07 0)
(13.7381 -1.73144e-07 0)
(13.7019 -1.75488e-07 0)
(13.6643 -1.77468e-07 0)
(13.6252 -1.79096e-07 0)
(13.5846 -1.80386e-07 0)
(13.5425 -1.81335e-07 0)
(13.4988 -1.81946e-07 0)
(13.4535 -1.82227e-07 0)
(13.4065 -1.82196e-07 0)
(13.3579 -1.81879e-07 0)
(13.3075 -1.81305e-07 0)
(13.2553 -1.8049e-07 0)
(13.2012 -1.7946e-07 0)
(13.1452 -1.7824e-07 0)
(13.0871 -1.76823e-07 0)
(13.027 -1.75213e-07 0)
(12.9645 -1.73425e-07 0)
(12.8997 -1.71493e-07 0)
(12.8324 -1.6941e-07 0)
(12.7624 -1.67181e-07 0)
(12.6896 -1.64811e-07 0)
(12.6137 -1.62305e-07 0)
(12.5346 -1.59665e-07 0)
(12.4519 -1.56892e-07 0)
(12.3653 -1.53983e-07 0)
(12.2745 -1.50934e-07 0)
(12.1791 -1.47736e-07 0)
(12.0786 -1.44377e-07 0)
(11.9724 -1.40839e-07 0)
(11.8598 -1.37102e-07 0)
(11.74 -1.33141e-07 0)
(11.6119 -1.28929e-07 0)
(11.4743 -1.24449e-07 0)
(11.3255 -1.19635e-07 0)
(11.1635 -1.14474e-07 0)
(10.9854 -1.08878e-07 0)
(10.7876 -1.02713e-07 0)
(10.5648 -9.58222e-08 0)
(10.309 -8.80663e-08 0)
(10.0194 -7.9483e-08 0)
(9.71272 -7.04349e-08 0)
(9.40359 -6.14401e-08 0)
(9.08994 -5.27443e-08 0)
(8.76912 -4.45252e-08 0)
(8.43765 -3.69125e-08 0)
(8.09103 -3.00115e-08 0)
(7.72352 -2.39021e-08 0)
(7.32797 -1.86326e-08 0)
(6.89597 -1.4212e-08 0)
(6.41863 -1.06226e-08 0)
(5.88836 -7.80965e-09 0)
(5.30211 -5.68348e-09 0)
(4.66714 -4.12679e-09 0)
(4.01052 -2.99948e-09 0)
(3.3801 -2.17945e-09 0)
(2.81703 -1.57561e-09 0)
(2.33465 -1.12706e-09 0)
(1.92825 -7.96643e-10 0)
(1.58797 -5.56977e-10 0)
(1.30374 -3.85472e-10 0)
(1.06659 -2.64019e-10 0)
(0.868816 -1.78767e-10 0)
(0.703928 -1.19439e-10 0)
(0.566479 -7.85314e-11 0)
(0.451912 -5.06207e-11 0)
(0.356423 -3.18162e-11 0)
(0.276839 -1.93446e-11 0)
(0.210512 -1.1239e-11 0)
(0.155235 -6.11725e-12 0)
(0.109168 -3.00226e-12 0)
(0.070777 -1.24716e-12 0)
(0.0387828 -3.4431e-13 0)
(0.0121199 -3.42311e-14 0)

Apparently the velocity filed has something wrong.
So I wander that what leads to the result. I think that maybe these are the reasons:
(1) I did not modify the channelFoam correctly.
(2) I did not give good initial condition for the case
(3) The property constants I offered are not accurate.
However I can't make sure what is the real reason. So please help me.

Sunxing December 2, 2012 21:15

Hey L,

Maybe I should give you the files of my case, but the size of my case is too be to be uploaded. So may I have your email address for further communication.

Regards,

Sunxing

Sunxing December 2, 2012 21:17

Hey L,

Maybe I should give you the files of my case, but the size of my case is too be to be uploaded. So may I have your email address for further communication.

Regards,

Sunxing

Lieven December 3, 2012 03:01

Hey Sunxing,

There are a few things you should check:
Is the channelFoam simulation fully converged?
Is the Ubar set correctly in constant/transportProperties?
Do the pressure gradients match?

Regards,

L

Sunxing December 3, 2012 04:01

Hey L

I have checked the three points you mentioned.
Firstly, the channelFoam simulation is fully converged.
Secondly I give the correct averaged velocity----Ubar.
Lastly, I can't make sure weather the pressure gradient match, for I just have taken the p file from the result at 5th second simulated by pisoFoam as the initial p file for modified channelFoam solver and changed the type of inlet/outlet to cyclic without any change in the internalField.

Regards,

Sunxing

Lieven December 3, 2012 04:44

Quote:

for I just have taken the p file from the result at 5th second simulated by pisoFoam as the initial p file for modified channelFoam solver
This is something you don't need to do (although it won't make a difference after converging). The pressure field in the channel calculated with channelFoam will not be the same as the pressure field from pisoFoam i.e. the pisoFoam solution will contain the pressure gradient explicitly in the solution while this won't be the case for channelFoam. Therefore, the channelFoam pressure solution should be a uniform field equal to zero for a flow in a pipe/between plates without any obstructions.

Btw are you using the same wall treatment for both? It's just that especially near the walls the difference is profiles is very big. How did you calculate the velocity profiles on the slice? Is this done in Openfoam (e.g. with postchannel) or with paraView?
Can you compare the results with analytic profiles? Flow between two parallel plates is for the laminar case known as a poiseuille flow. If necessary you can lower the reynolds number if the flow is not laminar. This way you can check your wall treatment cause zeroGradient for nut is not really appropriate...

Regards,

L

Sunxing December 3, 2012 05:54

Hi L,

Given your suggestions, I have modified my case:
1) In the p file, I set it uniform filed equal to zero.
2) Yes, I am using the same wall treatment for both.
3) As for the velocity, I have the experimental data as initial inlet data and it obeys the 1/7 power law i.e. u=u_max*(y/H)^(1/7), where u_max is the velocity at middle of the walls, y is the distance normal to the wall, H is the half height between two walls. So I just calculated out Ubar by the formula----Ubar=2*u_max/((1+1/7)*(2+1/7)).
4) in my case the nu is 1.5486e-05, so the Reynolds number is not big.

Did I make these changes correctly?

Regard,

Sunxing


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