Skip to content
Snippets Groups Projects
Commit a5fb2fca authored by andy's avatar andy
Browse files

ENH: Cache kappa for directionalSolidThermo instead of creating field on each pass of face loop

parent 76da0462
Branches
Tags
No related merge requests found
...@@ -99,66 +99,58 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa ...@@ -99,66 +99,58 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
); );
return model.kappaEff(patch_.index()); return model.kappaEff(patch_.index());
break;
} }
break;
case SOLIDTHERMO: case SOLIDTHERMO:
{ {
const solidThermo& thermo = const solidThermo& thermo =
mesh.lookupObject<solidThermo> mesh.lookupObject<solidThermo>("thermophysicalProperties");
(
"thermophysicalProperties"
);
return thermo.kappa(patch_.index()); return thermo.kappa(patch_.index());
break;
} }
break;
case DIRECTIONALSOLIDTHERMO: case DIRECTIONALSOLIDTHERMO:
{ {
const solidThermo& thermo = const solidThermo& thermo =
mesh.lookupObject<solidThermo> mesh.lookupObject<solidThermo>("thermophysicalProperties");
(
"thermophysicalProperties" const vectorField kappa(thermo.Kappa(patch_.index()));
);
tmp<scalarField> tmeanKappa(Tp); tmp<scalarField> tmeanKappa(Tp);
scalarField& meanKappa = tmeanKappa(); scalarField& meanKappa = tmeanKappa();
forAll(meanKappa, i) forAll(meanKappa, i)
{ {
meanKappa[i] = meanKappa[i] = (kappa[i].x() + kappa[i].y() + kappa[i].z())/3.0;
(
thermo.Kappa(patch_.index())()[i].x()
+ thermo.Kappa(patch_.index())()[i].y()
+ thermo.Kappa(patch_.index())()[i].z()
)/3.0;
} }
return meanKappa; return meanKappa;
break;
} }
break;
case LOOKUP: case LOOKUP:
{ {
if (mesh.objectRegistry::foundObject<volScalarField>(kappaName_)) if (mesh.objectRegistry::foundObject<volScalarField>(kappaName_))
{ {
return patch_.lookupPatchField return patch_.lookupPatchField<volScalarField, scalar>
< (
volScalarField, scalar kappaName_
>(kappaName_); );
} }
else if else if
( (
mesh.objectRegistry::foundObject mesh.objectRegistry::foundObject<volSymmTensorField>
< (
volSymmTensorField kappaName_
>(kappaName_) )
) )
{ {
const symmTensorField& KWall = const symmTensorField& KWall =
patch_.lookupPatchField patch_.lookupPatchField<volSymmTensorField, scalar>
< (
volSymmTensorField, scalar kappaName_
>(kappaName_); );
const vectorField n(patch_.nf()); const vectorField n(patch_.nf());
...@@ -166,7 +158,10 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa ...@@ -166,7 +158,10 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
} }
else else
{ {
FatalErrorIn("temperatureCoupledBase::K() const") FatalErrorIn
(
"temperatureCoupledBase::kappa(const scalarField&) const"
)
<< "Did not find field " << kappaName_ << "Did not find field " << kappaName_
<< " on mesh " << mesh.name() << " patch " << patch_.name() << " on mesh " << mesh.name() << " patch " << patch_.name()
<< endl << endl
...@@ -178,12 +173,16 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa ...@@ -178,12 +173,16 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
return scalarField(0); return scalarField(0);
} }
break;
} }
default: default:
{ {
FatalErrorIn("temperatureCoupledBase::kappa() const") FatalErrorIn
<< "Unimplemented method " << method_ << endl (
"temperatureCoupledBase::kappa(const scalarField&) const"
)
<< "Unimplemented method " << method_ << nl
<< "Please set 'kappa' to one of " << KMethodTypeNames_.toc() << "Please set 'kappa' to one of " << KMethodTypeNames_.toc()
<< " and 'kappaName' to the name of the volScalar" << " and 'kappaName' to the name of the volScalar"
<< " or volSymmTensor field (if kappa=lookup)" << " or volSymmTensor field (if kappa=lookup)"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment