|
[Sponsors] |
Modified pimpleFoam solver to MRFPimpleFoam solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 8, 2015, 08:18 |
Modified pimpleFoam solver to MRFPimpleFoam solver
|
#1 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
Hi everyone,
I know MRFSimpleFoam solver is steady incompressible. But now I would like to simulation MRF zone with unsteady incompressible. Hence, I modified the pimpleFoam solver becoming MRFPimpleFoam. Here code: MRFPimpleFoam.C Code:
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Application MRFSimpleFoam Description Steady-state solver for incompressible, turbulent flow of non-Newtonian fluids with MRF regions. \*---------------------------------------------------------------------------*/ #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" #include "MRFZones.H" #include "simpleControl.H" #include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" #include "initContinuityErrs.H" MRFZones mrfZones(mesh); mrfZones.correctBoundaryVelocity(U); simpleControl simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity SIMPLE corrector { #include "UEqn.H" #include "pEqn.H" } turbulence->correct(); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; } // ************************************************************************* // Code:
{ p.boundaryField().updateCoeffs(); volScalarField rAU(1.0/UEqn().A()); U = rAU*UEqn().H(); UEqn.clear(); phi = fvc::interpolate(U, "interpolate(HbyA)") & mesh.Sf(); mrfZones.relativeFlux(phi); adjustPhi(phi, U, p); // Non-orthogonal pressure corrector loop while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( fvm::laplacian(rAU, p) == fvc::div(phi) ); pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); if (simple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } } #include "continuityErrs.H" // Explicitly relax pressure for momentum corrector p.relax(); // Momentum corrector U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); sources.correct(U); } Code:
// Momentum predictor tmp<fvVectorMatrix> UEqn ( fvm::div(phi, U) + turbulence->divDevReff(U) == sources(U) ); mrfZones.addCoriolis(UEqn()); sources.constrain(UEqn()); UEqn().relax(); solve(UEqn() == -fvc::grad(p)); https://onedrive.live.com/redir?resi...hint=folder%2c When I simulated with 3D model as turbine. I think it is inaccurate. I do not see the vortex after tubine. https://onedrive.live.com/redir?resi...nt=photo%2cpng I don't know velocity not change. Could anybody show me my mistake, please? Thank you so much |
|
June 8, 2015, 11:41 |
|
#2 |
Member
Bruno Blais
Join Date: Sep 2013
Location: Canada
Posts: 64
Rep Power: 13 |
If you look at the original article proposing the MRF method, by
J. Luo, R. Issa, A. Gosman, Prediction of impeller induced flows in mixing vessels using multiple frames of reference, in: Institution of Chemical Engineers Symposium Series, Vol. 136. They mention that this method is not valid for unsteady state. Actually, there are some underlying hypotheses to the MRF method, which make it inappropriate for unsteady simulations. So it might work in 2D because you converge to a steady state and your unsteady solver becomes a relaxed steady solver. However, it will not be an appropriate approach in 3D. Why not use sliding mesh (AMI) instead? I know it is slightly more expensive, but still... |
|
June 8, 2015, 13:28 |
|
#3 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
Hi Bruno,
Thanks your reply. The turbine model has AMI sliding mesh. I have already run with MRFSimpleFoam and it's convergence. I would like to run with unsteady because I change the inlet velocity to oscilatingValued instead of fixValued. Here is formula: u = 2.7 + 1.6(sěn2(pi)t/16). MRFSimpleFoam only run steady state with simple interpolation that is reason I modified pimpleFoam. How can run MRF simulation with inlet velocity above? P/s: I do not want to use pimpleDymFoam. |
|
June 8, 2015, 13:50 |
|
#4 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 849
Rep Power: 18 |
Hello!
I dont think MRF can not be applied into unsteady state situations. In OpenFOAM, multi-phase solvers such as interFoam and twoPhaseEulerFoam can use MRF to simulate stirred tanks. Which version r u using? pimpleFoam2.3.x can handle MRF by itself. Best,
__________________
My OpenFOAM algorithm website: http://dyfluid.com By far the largest Chinese CFD-based forum: http://www.cfd-china.com/category/6/openfoam We provide lots of clusters to Chinese customers, and we are considering to do business overseas: http://dyfluid.com/DMCmodel.html |
|
June 8, 2015, 22:07 |
|
#5 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
Hi Dongyue,
I am using OF 2.1.1. I can not upgrade 2.3.x because I am running on server. By the way, can pimpleFoam in 2.3.x version solve MRF? Which can MRF solver run with "oscillatingFixedValue" inlet BCs? Last edited by hiuluom; June 9, 2015 at 01:44. |
|
June 10, 2015, 02:35 |
|
#6 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
Dear all,
I show the velocity result MRFSimpleFoam sovler OF 2.1.1 and pimpleFoam solver OF 2.3.0. The MRFSimple give very good result, but in pimpleFoam does not see the rear vortex of turbine. In pimpleFoam OF 2.3.0, I only added fvoption Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // MRF1 { type MRFSource; active true; selectionMode cellZone; cellZone fluid_MRF; MRFSourceCoeffs { origin (0 0 0); axis (1 0 0); omega 2; } } // ************************************************************************* // Thank you so much. Thanh |
|
June 10, 2015, 03:29 |
|
#7 | |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 849
Rep Power: 18 |
Quote:
I just check the code, in two-phase solver, MRF is embeded into pimple algorithm not by fvOptions but by mrfZone class, so maybe even fvOptions can deal with MRF(for steady-state), but it can not be used for pimpleFoam(transient). I guess. Also, I checked with u original code MRFpimpleFoam, u make ur Ueqn() to be cleared in time step. This is not rite, u need UEqn to upgrade to solve pEqn 2 or 3 times. This is piso algorithm. Maybe u can merge pimpleFoam+mrfZone class instead of doing modifications on simpleFoam. I make a MRFPimpleFoam solver based on pimpleFoam and tried on the mixer2D case, looks its rite. If u can upload a case to make a test that will be better.
__________________
My OpenFOAM algorithm website: http://dyfluid.com By far the largest Chinese CFD-based forum: http://www.cfd-china.com/category/6/openfoam We provide lots of clusters to Chinese customers, and we are considering to do business overseas: http://dyfluid.com/DMCmodel.html |
||
June 10, 2015, 03:53 |
|
#8 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
Hi sharonyue,
Here is my BCs: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ /* Windows port by Symscape (www.symscape.com) *\ \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object epsilon; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -3 0 0 0 0]; internalField uniform 0.598; boundaryField { stator { type epsilonWallFunction; value uniform 1; } rotor { type epsilonWallFunction; value uniform 1; } symmetry { type epsilonWallFunction; value uniform 10.935; } inlet { type fixedValue; value uniform 0.598; } outlet { type zeroGradient; } wing1 { type epsilonWallFunction; value uniform 1; } wing2 { type epsilonWallFunction; value uniform 1; } wing3 { type epsilonWallFunction; value uniform 1; } wing4 { type epsilonWallFunction; value uniform 1; } wing5 { type epsilonWallFunction; value uniform 1; } wing6 { type epsilonWallFunction; value uniform 1; } AMI1_fluid_MRF { type cyclicAMI; value $internalField; } AMI2_fluid_MRF { type cyclicAMI; value $internalField; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ /* Windows port by Symscape (www.symscape.com) *\ \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object k; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 0.0055; boundaryField { stator { type kqRWallFunction; value uniform 1; } rotor { type kqRWallFunction; value uniform 1; } symmetry { type kqRWallFunction; value uniform 0.135; } inlet { type fixedValue; value uniform 0.0055; } outlet { type zeroGradient; } wing1 { type kqRWallFunction; value uniform 1; } wing2 { type kqRWallFunction; value uniform 1; } wing3 { type kqRWallFunction; value uniform 1; } wing4 { type kqRWallFunction; value uniform 1; } wing5 { type kqRWallFunction; value uniform 1; } wing6 { type kqRWallFunction; value uniform 1; } AMI1_fluid_MRF { type cyclicAMI; value $internalField; } AMI2_fluid_MRF { type cyclicAMI; value $internalField; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ /* Windows port by Symscape (www.symscape.com) *\ \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 0; boundaryField { stator { type zeroGradient; } rotor { type zeroGradient; } symmetry { type zeroGradient; } inlet { type zeroGradient; } outlet { type fixedValue; value uniform 0; } wing1 { type zeroGradient; } wing2 { type zeroGradient; } wing3 { type zeroGradient; } wing4 { type zeroGradient; } wing5 { type zeroGradient; } wing6 { type zeroGradient; } AMI1_fluid_MRF { type cyclicAMI; value $internalField; } AMI2_fluid_MRF { type cyclicAMI; value $internalField; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ /* Windows port by Symscape (www.symscape.com) *\ \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; location "0"; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (-6.2 0 0); boundaryField { stator { type fixedValue; value uniform (0 0 0); } rotor { type fixedValue; value uniform (0 0 0); } symmetry { type fixedValue; value uniform (0 0 0); } inlet { type fixedValue; value uniform (-6.2 0 0); } outlet { type zeroGradient; } wing1 { type fixedValue; value uniform (0 0 0); } wing2 { type fixedValue; value uniform (0 0 0); } wing3 { type fixedValue; value uniform (0 0 0); } wing4 { type fixedValue; value uniform (0 0 0); } wing5 { type fixedValue; value uniform (0 0 0); } wing6 { type fixedValue; value uniform (0 0 0); } AMI1_fluid_MRF { type cyclicAMI; value $internalField; } AMI2_fluid_MRF { type cyclicAMI; value $internalField; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ /* Windows port by Symscape (www.symscape.com) *\ \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class polyBoundaryMesh; location "constant/polyMesh"; object boundary; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 13 ( stator { type wall; nFaces 4352; startFace 9025787; } rotor { type wall; nFaces 5288; startFace 9030139; } symmetry { type wall; nFaces 3676; startFace 9035427; } inlet { type patch; //Velocity-inlet nFaces 514; startFace 9039103; } outlet { type patch; //Pressure-outlet nFaces 516; startFace 9039617; } wing1 { type wall; nFaces 28424; startFace 9040133; } wing2 { type wall; nFaces 28424; startFace 9068557; } wing3 { type wall; nFaces 28424; startFace 9096981; } wing4 { type wall; nFaces 28424; startFace 9125405; } wing5 { type wall; nFaces 28424; startFace 9153829; } wing6 { type wall; nFaces 28424; startFace 9182253; } AMI1_fluid_MRF { type cyclicAMI; nFaces 7712; startFace 9210677; matchTolerance 0.0001; neighbourPatch AMI2_fluid_MRF; transform noOrdering; } AMI2_fluid_MRF { type cyclicAMI; nFaces 7712; startFace 9218389; matchTolerance 0.0001; neighbourPatch AMI1_fluid_MRF; transform noOrdering; } ) // ************************************************************************* // |
|
June 10, 2015, 04:12 |
|
#9 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 849
Rep Power: 18 |
Hi,
I updated my post, this solver should be the same with yours, but its based on pimpleFoam. Maybe u can upload your 3D case and make a simple test. About ur boundaries, its right
__________________
My OpenFOAM algorithm website: http://dyfluid.com By far the largest Chinese CFD-based forum: http://www.cfd-china.com/category/6/openfoam We provide lots of clusters to Chinese customers, and we are considering to do business overseas: http://dyfluid.com/DMCmodel.html |
|
June 10, 2015, 04:53 |
|
#10 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
Everthing I post above. resultThe result ran with MRFSimpleFoam solver OF 2.1.1 very good. I would like to run oscilating velocity inlet. Hence, I must modified pimpleFoam OF 2.1.1 can run unsteady but it was not successful. The comparison MRFSimpleFoam and pimpleFoam result I posted at the first.
And now I am trying to simulate with pimpleFoam OF2.3.0. I only add fvoption. The result is not the same MRFSimpleFoam of2.1.1 I show test with mixerVessel pimpleFoam OF2.3.0, the result is good. But big model is not good. Do you have any idea? If you need more file, you can tell me. |
|
June 10, 2015, 05:59 |
|
#11 | |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 849
Rep Power: 18 |
Quote:
I test pimpleFoam 2.3.x with fvOptions, looks it can deal with MRF. Also I test my solver(quite simple one), looks there is no difference. Attached is the comparison. I got this mesh from the propeller, but I make the mesh quite coarse. I did not see any wrong on your boundary, maybe the impeller is rotating way too slow? or some setup is wrong I did not notice? How big is your mesh? U can upload your case.
__________________
My OpenFOAM algorithm website: http://dyfluid.com By far the largest Chinese CFD-based forum: http://www.cfd-china.com/category/6/openfoam We provide lots of clusters to Chinese customers, and we are considering to do business overseas: http://dyfluid.com/DMCmodel.html |
||
June 10, 2015, 06:31 |
|
#12 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
Hello,
Because the mesh is big I can not upload the file. My model is turbine as the same propeller. I show the checkMesh that you can imagine: Code:
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.3.0-f5222ca19ce6 Exec : checkMesh Date : Jun 10 2015 Time : 16:25:14 Host : "linuxserver" PID : 4211 Case : /home/dfm/Working/phong-thanh/Case02_MSH-MRFPimpleFoam-of230 nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create polyMesh for time = 0 Time = 0 Mesh stats points: 1236316 faces: 9226101 internal faces: 9025787 cells: 4202604 faces per cell: 4.34299 boundary patches: 13 point zones: 0 face zones: 3 cell zones: 2 Overall number of cells of each type: hexahedra: 0 prisms: 1441472 wedges: 0 pyramids: 0 tet wedges: 0 tetrahedra: 2761132 polyhedra: 0 Checking topology... Boundary definition OK. Cell to face addressing OK. Point usage OK. Upper triangular ordering OK. Face vertices OK. *Number of regions: 2 The mesh has multiple regions which are not connected by any face. <<Writing region information to "0/cellToRegion" <<Writing region 0 with 3941656 cells to cellSet region0 <<Writing region 1 with 260948 cells to cellSet region1 Checking patch topology for multiply connected surfaces... Patch Faces Points Surface topology stator 4352 2297 ok (non-closed singly connected) rotor 5288 2813 ok (non-closed singly connected) symmetry 3676 1888 ok (non-closed singly connected) inlet 514 283 ok (non-closed singly connected) outlet 516 284 ok (non-closed singly connected) wing1 28424 14232 ok (non-closed singly connected) wing2 28424 14232 ok (non-closed singly connected) wing3 28424 14232 ok (non-closed singly connected) wing4 28424 14232 ok (non-closed singly connected) wing5 28424 14232 ok (non-closed singly connected) wing6 28424 14232 ok (non-closed singly connected) AMI1_fluid_MRF 7712 4127 ok (non-closed singly connected) AMI2_fluid_MRF 7712 4127 ok (non-closed singly connected) Checking geometry... Overall domain bounding box (-100 -39.9951 -40) (60 39.971 40) Mesh (non-empty, non-wedge) directions (1 1 1) Mesh (non-empty) directions (1 1 1) Boundary openness (-5.85408e-17 -4.19816e-18 6.51828e-16) OK. Max cell openness = 4.89647e-16 OK. Max aspect ratio = 14.5859 OK. Minimum face area = 1.07566e-06. Maximum face area = 59.4783. Face area magnitudes OK. Min volume = 5.69289e-10. Max volume = 138.892. Total volume = 802492. Cell volumes OK. Mesh non-orthogonality Max: 64.5182 average: 19.8814 Non-orthogonality check OK. Face pyramids OK. Max skewness = 2.53318 OK. Coupled point location match (average 0) OK. Mesh OK. End Code:
zone1 { cellZone fluid_MRF; active yes; // Fixed patches (by default they 'move' with the MRF zone) nonRotatingPatches (AMI1_fluid_MRF AMI2_fluid_MRF stator symmetry inlet outlet); origin (0 0 0); axis (1 0 0); omega constant 2; } I would like to see the vortex sam MRFSimpleFoam 2.1.1 |
|
June 14, 2015, 22:22 |
|
#13 |
Senior Member
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13 |
After waiting for a long time, the vortex appeared at the rear with MRFPimpleFoam 2.1.1 and pimpleFoam OF2.3.0. But in the wing MRF zone, I saw cell.
Last edited by hiuluom; June 15, 2015 at 22:08. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] Problem using swak4Foam in a modiefied solver | bastil | OpenFOAM Community Contributions | 13 | April 18, 2020 16:17 |
error while running modified pimple solver | R_21 | OpenFOAM Programming & Development | 0 | May 28, 2015 07:59 |
compiling error(s) in a modified twoPhaseEulerFoam solver | foamer | OpenFOAM | 14 | June 20, 2014 09:51 |
CFX 5.5 | Roued | CFX | 1 | October 2, 2001 17:49 |
Setting a B.C using UserFortran in 4.3 | tokai | CFX | 10 | July 17, 2001 17:25 |