applyBoundaryLayer: Provide non-const access to nut, k and epsilon

This commit is contained in:
Henry Weller 2017-03-21 15:11:00 +00:00
parent 38af843e10
commit d7ffce4f5d

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -133,7 +133,7 @@ int main(int argc, char *argv[])
// Calculate nut - reference nut is calculated by the turbulence model // Calculate nut - reference nut is calculated by the turbulence model
// on its construction // on its construction
tmp<volScalarField> tnut = turbulence->nut(); tmp<volScalarField> tnut = turbulence->nut();
volScalarField& nut = tnut.ref(); volScalarField& nut = const_cast<volScalarField&>(tnut());
volScalarField S(mag(dev(symm(fvc::grad(U))))); volScalarField S(mag(dev(symm(fvc::grad(U)))));
nut = (1 - mask)*nut + mask*sqr(kappa*min(y, ybl))*::sqrt(2)*S; nut = (1 - mask)*nut + mask*sqr(kappa*min(y, ybl))*::sqrt(2)*S;
@ -151,7 +151,7 @@ int main(int argc, char *argv[])
// Turbulence k // Turbulence k
tmp<volScalarField> tk = turbulence->k(); tmp<volScalarField> tk = turbulence->k();
volScalarField& k = tk.ref(); volScalarField& k = const_cast<volScalarField&>(tk());
scalar ck0 = pow025(Cmu)*kappa; scalar ck0 = pow025(Cmu)*kappa;
k = (1 - mask)*k + mask*sqr(nut/(ck0*min(y, ybl))); k = (1 - mask)*k + mask*sqr(nut/(ck0*min(y, ybl)));
@ -165,7 +165,7 @@ int main(int argc, char *argv[])
// Turbulence epsilon // Turbulence epsilon
tmp<volScalarField> tepsilon = turbulence->epsilon(); tmp<volScalarField> tepsilon = turbulence->epsilon();
volScalarField& epsilon = tepsilon.ref(); volScalarField& epsilon = const_cast<volScalarField&>(tepsilon());
scalar ce0 = ::pow(Cmu, 0.75)/kappa; scalar ce0 = ::pow(Cmu, 0.75)/kappa;
epsilon = (1 - mask)*epsilon + mask*ce0*k*sqrt(k)/min(y, ybl); epsilon = (1 - mask)*epsilon + mask*ce0*k*sqrt(k)/min(y, ybl);