From 40ddc7204530d7724d31e04edf660707965e4c0e Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 17 Jul 2017 16:48:27 +0100 Subject: [PATCH] buoyantPimpleFoam: Added support for incompressible closed-volume simulations Resolves bug-report https://bugs.openfoam.org/view.php?id=2617 --- .../heatTransfer/buoyantPimpleFoam/createFields.H | 15 +++++++++++++++ .../solvers/heatTransfer/buoyantPimpleFoam/pEqn.H | 5 +++++ .../solvers/heatTransfer/buoyantSimpleFoam/pEqn.H | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H index ff835c8a7..afbee0bbc 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H @@ -71,6 +71,21 @@ volScalarField p_rgh // Force p_rgh to be consistent with p p_rgh = p - rho*gh; +label pRefCell = 0; +scalar pRefValue = 0.0; + +if (thermo.incompressible()) +{ + setRefCell + ( + p, + p_rgh, + pimple.dict(), + pRefCell, + pRefValue + ); +} + mesh.setFluxRequired(p_rgh.name()); Info<< "Creating field dpdt\n" << endl; diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H index c09711875..ee36dcade 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H @@ -41,6 +41,11 @@ while (pimple.correctNonOrthogonal()) - fvm::laplacian(rhorAUf, p_rgh) ); + if (thermo.incompressible()) + { + p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); + } + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index 6c1ae382f..93dc2d7b0 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -56,7 +56,7 @@ // For closed-volume cases adjust the pressure level // to obey overall mass continuity - if (closedVolume) + if (!thermo.incompressible() && closedVolume) { p += (initialMass - fvc::domainIntegrate(psi*p)) /fvc::domainIntegrate(psi);