|
[Sponsors] |
December 12, 2012, 13:47 |
how to change code in channelFoam for RAS
|
#1 |
Member
Join Date: Jun 2012
Posts: 65
Rep Power: 13 |
Hi everyone, I wanna use channelFoam with RAS model. However, the solver seems to be designed specially for LES, which leads to incredible large Courant number and pressure, pressure gradient and velocity as below then OpenFoam crashes, so I hope someone can tell me how to change the code in solver for RAS, thanks!
Time = 0.18 Debug: gSum(mesh.V().field())16 gSum(sumPhi)4.84696e+66 gMax(sumPhi/mesh.V().field())4.12859e+69 Courant Number mean: 3.02935e+63 max: 4.12859e+67 DILUPBiCG: Solving for epsilon, Initial residual = 1, Final residual = 19.3092, No Iterations 1001 bounding epsilon, min: -2.73732e+98 max: 8.22502e+99 average: 1.61408e+95 DILUPBiCG: Solving for k, Initial residual = 1, Final residual = 758720, No Iterations 1001 bounding k, min: -3.0437e+89 max: 3.58778e+97 average: 5.9839e+92 #0 Foam::error:rintStack(Foam::Ostream&) in "/usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/platforms/linux64Gcc44DPOpt/lib/libOpenFOAM.so" #1 Foam::sigFpe::sigHandler(int) in "/usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/platforms/linux64Gcc44DPOpt/lib/libOpenFOAM.so" #2 __restore_rt at sigaction.c:0 #3 Foam:ILUPreconditioner::calcReciprocalD(Foam::Fi eld<double>&, Foam::lduMatrix const&) in "/usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/platforms/linux64Gcc44DPOpt/lib/libOpenFOAM.so" #4 Foam:ILUPreconditioner:ILUPreconditioner(Foam: :lduMatrix::solver const&, Foam::dictionary const&) in "/usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/platforms/linux64Gcc44DPOpt/lib/libOpenFOAM.so" #5 Foam::lduMatrix:reconditioner::addasymMatrixCons tructorToTable<Foam:ILUPreconditioner>::New(Foam ::lduMatrix::solver const&, Foam::dictionary const&) in "/usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/platforms/linux64Gcc44DPOpt/lib/libOpenFOAM.so" #6 Foam::lduMatrix:reconditioner::New(Foam::lduMatr ix::solver const&, Foam::dictionary const&) in "/usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/platforms/linux64Gcc44DPOpt/lib/libOpenFOAM.so" #7 Foam::PBiCG::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const in "/usr/apps1/openfoam-2.1.1/OpenFOAM-2.1.1/platforms/linux64Gcc44DPOpt/lib/libOpenFOAM.so" #8 Foam::fvMatrix<Foam::Vector<double> >::solve(Foam::dictionary const&) in "/usr/erc/people/liao23/OpenFOAM/liao23-2.1.1/platforms/linux64Gcc44DPOpt/bin/mychannelFoam_RAS" #9 Foam::fvMatrix<Foam::Vector<double> >::solve() in "/usr/erc/people/liao23/OpenFOAM/liao23-2.1.1/platforms/linux64Gcc44DPOpt/bin/mychannelFoam_RAS" #10 main in "/usr/erc/people/liao23/OpenFOAM/liao23-2.1.1/platforms/linux64Gcc44DPOpt/bin/mychannelFoam_RAS" #11 __libc_start_main in "/lib64/libc.so.6" #12 Foam::UOPstream::write(char) in "/usr/erc/people/liao23/OpenFOAM/liao23-2.1.1/platforms/linux64Gcc44DPOpt/bin/mychannelFoam_RAS" |
|
December 12, 2012, 14:49 |
|
#2 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22 |
Hi conceptone,
channelFoam is in the end an extension of pisoFoam. So just have a look at how the turbulence is implemented in pisoFoam and modify it accordingly in the channelFoam solver. In summary, you need to modify createFields.H, the include statements in channelFoam.C, and of course the momentum equation. To compile it afterwards, have a look at the Make/option file of pisoFoam as well... Cheers, L |
|
December 12, 2012, 15:41 |
|
#3 |
Member
Join Date: Jun 2012
Posts: 65
Rep Power: 13 |
Thanks Lieven, I guess what you mentioned is the declaration of that pointer in createFields.H, which I have done below and in solver. If I didn't do this modification, the solver even can't be compiled well. However, my issue is that channelFoam returns the very large Courant No. and pressure and velocities, which exceeds the extent of C++ calculation capability so openfoam crashed after runs some time...I don't know whether there are bugs here or other codes need to be changed..
Modified Coding: autoPtr<incompressible::turbulenceModel> sgsModel ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); #include "RASModel.H" #include "turbulenceModel.H" (I've already deleted #include "LESModel.H" in solver.C) fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) + sgsModel->divDevReff(U) == flowDirection*gradP ); Thanks |
|
December 13, 2012, 05:09 |
|
#4 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22 |
That's indeed how you needed to change it.
The problem with the courant number is not related to the solver but to your time step. You can try two things to solve it: 1. Use a small, constant time step such that the max courant number < 1 at all times 2. Enable variable time stepping based on courant number control as explained in http://www.idurun.com/?p=371 . This way you can use the maximal "allowable" time step. Both approaches work with RANS and LES Regards, L |
|
December 13, 2012, 15:25 |
|
#5 |
Member
Join Date: Jun 2012
Posts: 65
Rep Power: 13 |
Hi Lieven, yep, the problem is done, it turns out the time step leads to this. I tried small time step before, but not small enough. This time I try really small one, which works. This may turn out LES's advantage in time step compared with RAS.
Thanks so much! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Radiation interface | hinca | CFX | 15 | January 26, 2014 17:11 |
Cfd code for phase change model | mohsen.kh | Main CFD Forum | 0 | June 10, 2009 08:07 |
Multicomponent fluid | Andrea | CFX | 2 | October 11, 2004 05:12 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 15:56 |
What is the Better Way to Do CFD? | John C. Chien | Main CFD Forum | 54 | April 23, 2001 08:10 |