|
[Sponsors] |
November 13, 2024, 10:35 |
Speeding up CHT Heatsink simulation
|
#1 |
New Member
anonymous
Join Date: Nov 2024
Location: Germany
Posts: 2
Rep Power: 0 |
Hello all,
I'm new to OpenFoam, but have been able to run a few cases successfully using the tutorials and this forum. Basically the case is a simple Blower-Heatsink-Heater case, which I'm trying to simulate using a chtMultiRegionFoam in a OpenFoam v2112 Linux engine. The fluid domain has a patch for the mouth of the blower (inlet), an outlet for air to escape and all the walls surrounding the fluid domain. My question: My first case is the one with the blower off(0 velocity at the inlet boundary) and it works well. with a run time of 17s per second of simulation. Here are the boundary conditions for the fluid region: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: dev | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object changeDictionaryDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // U { internalField uniform (0 0 0); boundaryField { airwalls { type noSlip; } inlet { type fixedValue; inletValue uniform (0 0 0); } outlet { type pressureInletOutletVelocity; value uniform (0 0 0); } air_to_pla { type noSlip; } air_to_res { type noSlip; } air_to_fin { type noSlip; } } } T { internalField uniform 294; boundaryField { airwalls { type fixedValue; inletValue uniform 294; } inlet { type inletOutlet; inletValue uniform 294; } outlet { type inletOutlet; inletValue uniform 294; } air_to_pla { type compressible::turbulentTemperatureCoupledBaffleMixed; Tnbr T; kappaMethod fluidThermo; value uniform 294; } air_to_res { type compressible::turbulentTemperatureCoupledBaffleMixed; Tnbr T; kappaMethod fluidThermo; value uniform 294; } air_to_fin { type compressible::turbulentTemperatureCoupledBaffleMixed; Tnbr T; kappaMethod fluidThermo; value uniform 294; } } } p_rgh { internalField uniform 0; boundaryField { airwalls { type fixedFluxPressure; value uniform 0; } inlet { type fixedFluxPressure; value uniform 0; } outlet { type totalPressure; p0 uniform 0; } air_to_pla { type fixedFluxPressure; value uniform 0; } air_to_res { type fixedFluxPressure; value uniform 0; } air_to_fin { type fixedFluxPressure; value uniform 0; } } } p { internalField uniform 0; boundaryField { airwalls { type fixedValue; value uniform 0; } inlet { type zeroGradient; value uniform 0; } outlet { type totalPressure; p0 uniform 0; } air_to_pla { type fixedValue; value uniform 0; } air_to_res { type fixedValue; value uniform 0; } air_to_fin { type fixedValue; value uniform 0; } } } // ************************************************************************* // Code:
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 DILUPBiCGStab: Solving for h, Initial residual = 0.0007659, Final residual = 5.29e-09, No Iterations 1 Min/max T:294 294.8 Solving for fluid region air GAMG: Solving for p_rgh, Initial residual = 0.0004052, Final residual = 1.994e-06, No Iterations 3 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors (air): sum local = 9.467e-14, global = -5.288e-15, cumulative = -4.651e-08 GAMG: Solving for p_rgh, Initial residual = 0.0001121, Final residual = 4.75e-08, No Iterations 7 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors (air): sum local = 2.269e-15, global = -2.194e-16, cumulative = -4.651e-08 Solving for solid region res DICPCG: Solving for h, Initial residual = 0.002468, Final residual = 7.609e-09, No Iterations 2 limitTemperature limitTemperature Lower limited 0 (0%) of cells limitTemperature limitTemperature Upper limited 0 (0%) of cells limitTemperature limitTemperature Unlimited Tmax 294.8 Unlimited Tmin 294.2 Min/max T:294.1 294.8 Solving for solid region pla DICPCG: Solving for h, Initial residual = 0.002341, Final residual = 2.106e-07, No Iterations 3 Min/max T:294 294.3 Solving for solid region fin DICPCG: Solving for h, Initial residual = 0.001642, Final residual = 4.425e-07, No Iterations 3 Min/max T:294 294.2 ExecutionTime = 37.09 s ClockTime = 37 s Region: air Courant Number mean: 7.986e-05 max: 0.005518 Region: res Diffusion Number mean: 0.003037 max: 0.226 Region: pla Diffusion Number mean: 0.05351 max: 2.3 Region: fin Diffusion Number mean: 0.07386 max: 10 deltaT = 0.003142 Time = 2.13 But when I turn the blower on (a velocity at the inlet boundary) like prescribed below Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: dev | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object changeDictionaryDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // U { internalField uniform (0 0 0); boundaryField { airwalls { type noSlip; } inlet { type fixedValue; inletValue uniform (3.9 0 0); } outlet { type pressureInletOutletVelocity; value uniform (0 0 0); } air_to_pla { type noSlip; } air_to_res { type noSlip; } air_to_fin { type noSlip; } } } T { internalField uniform 294; boundaryField { airwalls { type fixedValue; inletValue uniform 294; } inlet { type inletOutlet; inletValue uniform 294; } outlet { type inletOutlet; inletValue uniform 294; } air_to_pla { type compressible::turbulentTemperatureCoupledBaffleMixed; Tnbr T; kappaMethod fluidThermo; value uniform 294; } air_to_res { type compressible::turbulentTemperatureCoupledBaffleMixed; Tnbr T; kappaMethod fluidThermo; value uniform 294; } air_to_fin { type compressible::turbulentTemperatureCoupledBaffleMixed; Tnbr T; kappaMethod fluidThermo; value uniform 294; } } } p_rgh { internalField uniform 0; boundaryField { airwalls { type fixedFluxPressure; value uniform 0; } inlet { type fixedFluxPressure; value uniform 0; } outlet { type totalPressure; p0 uniform 0; } air_to_pla { type fixedFluxPressure; value uniform 0; } air_to_res { type fixedFluxPressure; value uniform 0; } air_to_fin { type fixedFluxPressure; value uniform 0; } } } p { internalField uniform 0; boundaryField { airwalls { type fixedValue; value uniform 0; } inlet { type zeroGradient; value uniform 0; } outlet { type totalPressure; p0 uniform 0; } air_to_pla { type fixedValue; value uniform 0; } air_to_res { type fixedValue; value uniform 0; } air_to_fin { type fixedValue; value uniform 0; } } } // ************************************************************************* // Here are the residuals: Code:
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 DILUPBiCGStab: Solving for h, Initial residual = 0.03133, Final residual = 4.604e-08, No Iterations 2 Min/max T:293.6 295 Solving for fluid region air GAMG: Solving for p_rgh, Initial residual = 0.0004678, Final residual = 2.737e-06, No Iterations 8 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors (air): sum local = 1.755e-10, global = 5.574e-11, cumulative = 7.951e-06 GAMG: Solving for p_rgh, Initial residual = 0.002553, Final residual = 9.803e-08, No Iterations 11 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors (air): sum local = 6.243e-12, global = -1.666e-12, cumulative = 7.951e-06 Solving for solid region res DICPCG: Solving for h, Initial residual = 9.365e-06, Final residual = 1.143e-10, No Iterations 1 limitTemperature limitTemperature Lower limited 0 (0%) of cells limitTemperature limitTemperature Upper limited 0 (0%) of cells limitTemperature limitTemperature Unlimited Tmax 295 Unlimited Tmin 294.3 Min/max T:294.2 295 Solving for solid region pla DICPCG: Solving for h, Initial residual = 8.941e-06, Final residual = 2.439e-09, No Iterations 1 Min/max T:294 294.6 Solving for solid region fin DICPCG: Solving for h, Initial residual = 5.987e-06, Final residual = 1.301e-09, No Iterations 1 Min/max T:294 294.5 ExecutionTime = 320.6 s ClockTime = 320 s Region: air Courant Number mean: 0.02751 max: 1 Region: res Diffusion Number mean: 2.701e-05 max: 0.00201 Region: pla Diffusion Number mean: 0.0004759 max: 0.02046 Region: fin Diffusion Number mean: 0.000657 max: 0.08895 deltaT = 2.794e-05 Time = 5.18 I tried frozenFlow also but it has very less impact. I need to simulate every case for a realtime of 30mins, which I cannot do at this rate. So, I kindly request for some assistance here, so I can maybe do a work-around to make the simulation faster. I am not very particular on the accuracy. I just need to compare a few cases and I can do that with a fairly rough model as well. Thank you for reading and I highly appreciate any suggestion or advice to speed up my case. TL;DR: My chtMultiRegionFoam case is fairly fast with 0 inlet velocity but gets 75 times slower whin I give a 3.9 m/s inlet velocity. Is there a work-around to make the simulation faster? Thank you! |
|
November 14, 2024, 06:27 |
|
#2 |
Senior Member
Join Date: Dec 2021
Posts: 248
Rep Power: 5 |
Hey!
A few possible workarounds:
Last but not least, patience is key I remember spending several days trying to tweak my case so it would run faster, just to eventually bite the bullet and use my usual settings, and realize that I wasted days that could have been used for the computation. Are you sure you cannot let the simulation run for a few days? Instead of spending them scratching your head. |
|
November 14, 2024, 12:14 |
|
#3 | ||
New Member
anonymous
Join Date: Nov 2024
Location: Germany
Posts: 2
Rep Power: 0 |
Quote:
Thanks a lot for your response, Alczem. I agree with you. I was just trying to see if there is anything that I can do, that pros like yourself have tried before, that I can try to make my work more efficient. And it worked!! Quote:
I had tried frozenFlow and increasing MaxCo separately but when I put them together, it really speeds up the simulation. And the results are so good, that I'm a little skeptical about my procedure. So, I'd be even more grateful if you can comment on my procedure: 1. I run a normal simulation with the blower on (with the following fvSolution in 'air' region). In this simulation I give a MaxCo of 1.0 and a MaxDi of 100.0. Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: dev | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { rho { solver GAMG; //preconditioner DIC; tolerance 1e-7; relTol 0.1; smoother GaussSeidel; } rhoFinal { $rho; tolerance 1e-7; relTol 0; } p_rgh { solver GAMG; tolerance 1e-7; relTol 0.01; smoother GaussSeidel; } p_rghFinal { $p_rgh; tolerance 1e-7; relTol 0; } "(U|h|k|epsilon|R)" { solver PBiCGStab; preconditioner DILU; tolerance 1e-7; relTol 0.1; } "(U|h|k|epsilon|R)Final" { $U; tolerance 1e-7; relTol 0; } } PIMPLE { //momentumPredictor yes; momentumPredictor false; //frozenFlow yes; nOuterCorrectors 40; nCorrectors 3; consistent true; nCorrectors 2; nNonOrthogonalCorrectors 0; residualControl { p_rgh { tolerance 1e-3; relTol 0; } } pRefCell 0; pRefValue 0; } relaxationFactors { equations { "h.*" 1; "U.*" 1; } } 3. Now I take the p, T and p_rgh files from ./3/air/* (basically the air flow field values) and paste them in the ./0/air/* (the initial values) in a different case(my main simulation case). Please note that I'm only doing this for the air region and nothing else 4. In this main simulation case, I give frozenFlow = yes (in the fvSolution) and change MaxCo to 50. And I run the main simulation. Please correct me if I'm doing something wrong here or if it can be done in a more efficient way. But regardless, I really appreciate your support and suggestion, made my life easy. Thank You!! |
|||
November 15, 2024, 04:57 |
|
#4 |
Senior Member
Join Date: Dec 2021
Posts: 248
Rep Power: 5 |
Hey!
Glad you found a satisfactory way Regarding results quality, unfortunately, you will have to trust those if you don't have any experimental data to compare against. Just make sure every timestep is properly converged. For the setup, I mostly agree with what you did. A couple remarks:
|
|
Tags |
chtmulitregionfoam, speed up |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question on steady and unsteady simulation | Stargazer | Main CFD Forum | 33 | December 19, 2023 02:45 |
CFG file Set Up | Nicola_Fontana | SU2 | 5 | November 16, 2021 13:48 |
write bc data and read it for other simulation | jdp810 | SU2 | 1 | May 8, 2021 18:04 |
Transient simulation gives worse results than steady state simulation | jgross | CFX | 12 | January 21, 2021 13:21 |
Transient CHT Simulation slow variable increase | marcel_jay | CFX | 8 | May 2, 2016 18:11 |