From 09992c2b752555e2859a7d9276dc126ab73136a5 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 10 Feb 2017 14:19:52 +0000 Subject: [PATCH 1/2] UCM model stability improvement. M. Nobrega etal --- .../viscoelastic/viscoelasticLaws/UCM/UCM.C | 29 ++++++++++++++----- .../viscoelastic/viscoelasticLaws/UCM/UCM.H | 6 +++- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.C b/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.C index 34ce96b42..6c0491d70 100644 --- a/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.C +++ b/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.C @@ -60,7 +60,8 @@ Foam::UCM::UCM ), rho_(dict.lookup("rho")), etaP_(dict.lookup("etaP")), - lambda_(dict.lookup("lambda")) + lambda_(dict.lookup("lambda")), + etaStab_(dimensionedScalar::lookupOrDefault("etaStab", dict, 0.0, dimMass/(dimLength*dimTime))) {} @@ -68,14 +69,26 @@ Foam::UCM::UCM Foam::tmp Foam::UCM::divTau(volVectorField& U) const { - dimensionedScalar etaPEff = etaP_; + if(etaStab_.value() < SMALL) + { + dimensionedScalar etaPEff = etaP_; - return - ( - fvc::div(tau_/rho_, "div(tau)") - - fvc::laplacian(etaPEff/rho_, U, "laplacian(etaPEff,U)") - + fvm::laplacian( (etaPEff)/rho_, U, "laplacian(etaPEff+etaS,U)") - ); + return + ( + fvc::div(tau_/rho_, "div(tau)") + - fvc::laplacian(etaPEff/rho_, U, "laplacian(etaPEff,U)") + + fvm::laplacian( (etaPEff)/rho_, U, "laplacian(etaPEff+etaS,U)") + ); + } + else + { + return + ( + fvc::div(tau_/rho_, "div(tau)") + - fvc::div((etaStab_/rho_)*fvc::grad(U), "div(tau)") + + fvm::laplacian( (etaStab_)/rho_, U, "laplacian(etaPEff+etaS,U)") + ); + } } diff --git a/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.H b/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.H index 6c59d8c42..3cfa6d94f 100644 --- a/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.H +++ b/src/transportModels/viscoelastic/viscoelasticLaws/UCM/UCM.H @@ -28,7 +28,8 @@ Description UCM non linear viscoelastic fluid model (BIRD et al., 1987). Author - Jovani L. Favero. All rights reserved + Miguel Nóbrega, Silvino Araújo, Célio Fernandes, Luís Ferrás. + All rights reserved SourceFiles UCM.C @@ -70,6 +71,9 @@ class UCM //- Relaxation time dimensionedScalar lambda_; + //- Stabilization viscosity + dimensionedScalar etaStab_; + // Private Member Functions From 3e2b82b09942dece1de77cd43b71fc4e8323d645 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 10 Feb 2017 14:23:33 +0000 Subject: [PATCH 2/2] Tutorial: UCM model. Miguel Nobrega etal --- .../viscoelasticFluidFoam/UCM/0/U | 48 +++++++ .../viscoelasticFluidFoam/UCM/0/p | 47 +++++++ .../viscoelasticFluidFoam/UCM/0/tau | 45 ++++++ .../viscoelasticFluidFoam/UCM/Allclean | 6 + .../viscoelasticFluidFoam/UCM/Allrun | 10 ++ .../viscoelasticFluidFoam/UCM/README | 44 ++++++ .../UCM/constant/polyMesh/blockMeshDict | 129 ++++++++++++++++++ .../UCM/constant/viscoelasticProperties | 43 ++++++ .../UCM/system/controlDict | 60 ++++++++ .../UCM/system/fvSchemes | 64 +++++++++ .../UCM/system/fvSolution | 76 +++++++++++ 11 files changed, 572 insertions(+) create mode 100644 tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/U create mode 100644 tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/p create mode 100644 tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/tau create mode 100755 tutorials/viscoelastic/viscoelasticFluidFoam/UCM/Allclean create mode 100755 tutorials/viscoelastic/viscoelasticFluidFoam/UCM/Allrun create mode 100644 tutorials/viscoelastic/viscoelasticFluidFoam/UCM/README create mode 100644 tutorials/viscoelastic/viscoelasticFluidFoam/UCM/constant/polyMesh/blockMeshDict create mode 100644 tutorials/viscoelastic/viscoelasticFluidFoam/UCM/constant/viscoelasticProperties create mode 100644 tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/controlDict create mode 100644 tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/fvSchemes create mode 100644 tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/fvSolution diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/U b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/U new file mode 100644 index 000000000..1b8648caa --- /dev/null +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/U @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 4.0 | +| \\ / A nd | Web: http://www.foam-extend.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value uniform (0.00125 0 0); + } + fixedWalls + { + type fixedValue; + value uniform (0 0 0); + } + outlet + { + type zeroGradient; + } + simetry + { + type symmetryPlane; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/p b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/p new file mode 100644 index 000000000..7fef3cc1a --- /dev/null +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/p @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 4.0 | +| \\ / A nd | Web: http://www.foam-extend.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type zeroGradient; + } + fixedWalls + { + type zeroGradient; + } + outlet + { + type fixedValue; + value uniform 0; + } + simetry + { + type symmetryPlane; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/tau b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/tau new file mode 100644 index 000000000..4fc2583ce --- /dev/null +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/0/tau @@ -0,0 +1,45 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 4.0 | +| \\ / A nd | Web: http://www.foam-extend.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volSymmTensorField; + object tau; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform (0 0 0 0 0 0); + +boundaryField +{ + inlet + { + type zeroGradient; + } + fixedWalls + { + type zeroGradient; + } + outlet + { + type zeroGradient; + } + simetry + { + type symmetryPlane; + } + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/Allclean b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/Allclean new file mode 100755 index 000000000..6ec3cc203 --- /dev/null +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/Allclean @@ -0,0 +1,6 @@ +#!/bin/sh + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/Allrun b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/Allrun new file mode 100755 index 000000000..8d43561aa --- /dev/null +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/Allrun @@ -0,0 +1,10 @@ +#!/bin/sh + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Get application name +application=`getApplication` + +runApplication blockMesh +runApplication $application diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/README b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/README new file mode 100644 index 000000000..17437ed08 --- /dev/null +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/README @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 4.0 | +| \\ / A nd | Web: http://www.foam-extend.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +# +#+TITLE: UCM model stabilization +#+AUTHORS: Fernandes, C., De Araujo, M.S.B., Ferrás, L.L., Nóbrega, J.M. + + +This tutorial was prepared to illustrate the new stabilization approach for viscoelastic constitutive models proposed in: + +Fernandes, C., De Araujo, M.S.B., Ferras, L.L., Nobrega, J.M., +Improvements in the OpenFOAM numerical code for simulation of +steady-state differential viscoelastic flows, 11th OpenFOAM Workshop +Guimarães, Portugal, June 26 - 30, 2016 + +and + +De Araujo, M.S.B., Ferras, L.L.,Fernandes, C.,Nobrega, J.M., +Improvements ans assessment of the integral viscoelastic solver in OpenFOAM, 11th OpenFOAM Workshop +Guimarães, Portugal, June 26 - 30, 2016 + + +It comprises 2 case studies for the flow in a 4:1 abrupt contraction of an UCM viscoelastic fluid, for De=1 + +- UCM_Orig - employs the original formulation that diverges before reaching the endtime + +- UCM_Stab - employs the new stabilized formulation that allows to achieve convergence for all time steps + +###### +Notes +###### +(1) To use the new stabilized formulation the value of etaStab should be provided in "constant/viscoelasticProperties". If ommited the solver uses the original formulation + +(2) Based on several studies performed, the value of etaStab should be similar to etaP + + + + + + diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/constant/polyMesh/blockMeshDict b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/constant/polyMesh/blockMeshDict new file mode 100644 index 000000000..51738da68 --- /dev/null +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/constant/polyMesh/blockMeshDict @@ -0,0 +1,129 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 4.0 | +| \\ / A nd | Web: http://www.foam-extend.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.001; + +vertices +( + (0 0 0) + (100 0 0) + (0 5 0) + (100 5 0) + (0 15 0) + (100 15 0) + (0 20 0) + (100 20 0) + (150 0 0) + (150 5 0) + (350 0 0) + (350 5 0) + + (0 0 0.1) + (100 0 0.1) + (0 5 0.1) + (100 5 0.1) + (0 15 0.1) + (100 15 0.1) + (0 20 0.1) + (100 20 0.1) + (150 0 0.1) + (150 5 0.1) + (350 0 0.1) + (350 5 0.1) +); + +blocks +( + + hex (0 1 3 2 12 13 15 14) (24 10 1) simpleGrading (0.01116279506 0.2052504667 1) + hex (2 3 5 4 14 15 17 16) (24 13 1) simpleGrading (0.01116279506 9.315264895 1) + hex (4 5 7 6 16 17 19 18) (24 5 1) simpleGrading (0.01116279506 0.2171245102 1) + hex (1 8 9 3 13 20 21 15) (20 10 1) simpleGrading (46.57661513 0.2052504667 1) + hex (8 10 11 9 20 22 23 21) (7 10 1) simpleGrading (6.476978227 0.2052504667 1) + +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 12 14 2) + (2 14 16 4) + (4 16 18 6) + ); + } + fixedWalls + { + type wall; + faces + ( + (6 18 19 7) + (5 7 19 17) + (3 5 17 15) + (3 15 21 9) + (9 21 23 11) + ); + } + outlet + { + type patch; + faces + ( + (10 11 23 22) + ); + } + simetry + { + type symmetryPlane; + faces + ( + (0 1 13 12) + (1 8 20 13) + (8 10 22 20) + ); + } + frontAndBack + { + type empty; + faces + ( + (0 2 3 1) + (2 4 5 3) + (4 6 7 5) + (1 3 9 8) + (8 9 11 10) + (12 13 15 14) + (14 15 17 16) + (16 17 19 18) + (13 20 21 15) + (20 22 23 21) + ); + } +); + +mergePatchPairs +( +); + + +// ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/constant/viscoelasticProperties b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/constant/viscoelasticProperties new file mode 100644 index 000000000..2a2bc5de7 --- /dev/null +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/constant/viscoelasticProperties @@ -0,0 +1,43 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 4.0 | +| \\ / A nd | Web: http://www.foam-extend.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object viscoelasticProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +/* + +From: +Fernandes, C., De Araujo, M.S.B., Ferrás, L.L., Nóbrega, J.M., +Improvements in the OpenFOAM numerical code for simulation of +steady-state differential viscoelastic flows, 11th OpenFOAM Workshop +Guimarães, Portugal, June 26 - 30, 2016 + +and + +De Araujo, M.S.B., Ferras, L.L.,Fernandes, C.,Nobrega, J.M., +Improvements ans assessment of the integral viscoelastic solver in OpenFOAM, 11th OpenFOAM Workshop +Guimarães, Portugal, June 26 - 30, 2016 + +*/ + + +rheology +{ + type UCM; + rho rho [1 -3 0 0 0 0 0] 100; + etaP etaP [1 -1 -1 0 0 0 0] 0.25; + lambda lambda [0 0 1 0 0 0 0] 1; + etaStab 0.25; +} + +// ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/controlDict b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/controlDict new file mode 100644 index 000000000..08ecd98d4 --- /dev/null +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/controlDict @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 4.0 | +| \\ / A nd | Web: http://www.foam-extend.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +libs +( + "liblduSolvers.so" +) + +application viscoelasticFluidFoam; + +startFrom startTime; + +startTime 0.0; + +stopAt endTime; + +endTime 15; + +deltaT 1e-4; + +writeControl adjustableRunTime; + +writeInterval 1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +graphFormat raw; + +runTimeModifiable yes; + +adjustTimeStep no; + +maxCo 0.35; + +maxDeltaT 0.01; + +// ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/fvSchemes new file mode 100644 index 000000000..4073229e0 --- /dev/null +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/fvSchemes @@ -0,0 +1,64 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 4.0 | +| \\ / A nd | Web: http://www.foam-extend.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + grad(p) fourth; + grad(U) fourth; + +} + +divSchemes +{ + default none; + div(phi,U) Gauss Minmod; + div(phi,tau) Gauss Minmod; + div(tau) Gauss linear; +} + +laplacianSchemes +{ + default none; + laplacian(etaPEff,U) Gauss linear corrected; + laplacian(etaPEff+etaS,U) Gauss linear corrected; + laplacian((1|A(U)),p) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; + interpolate(HbyA) linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p; +} + + +// ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/fvSolution b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/fvSolution new file mode 100644 index 000000000..c3d41ba89 --- /dev/null +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/UCM/system/fvSolution @@ -0,0 +1,76 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 4.0 | +| \\ / A nd | Web: http://www.foam-extend.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + + p + { + solver CG; + preconditioner Cholesky; + + tolerance 1e-09; + relTol 0; + minIter 0; + maxIter 800; + } + + U + { + solver BiCGStab; + preconditioner ILU0; + + tolerance 1e-09; + relTol 0; + minIter 0; + maxIter 1000; + } + + tau + { + + solver BiCGStab; + preconditioner ILU0; + + tolerance 1e-09; + relTol 0; + minIter 0; + maxIter 1000; + + }; + +} + +PISO +{ + nCorrectors 4; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 0; +} + + + +relaxationFactors +{ + p 0.3; + U 0.7; + tau 0.3; +} + + + +// ************************************************************************* //