Commit 6d71a38e authored by mattijs's avatar mattijs
Browse files

ENH: Allow tensorial K

parent 2de3c0d2
......@@ -124,6 +124,41 @@ void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::rmap
}
Foam::tmp<Foam::scalarField>
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::K() const
{
const fvMesh& mesh = patch().boundaryMesh().mesh();
if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
{
return patch().lookupPatchField<volScalarField, scalar>(KName_);
}
else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_))
{
const symmTensorField& KWall =
patch().lookupPatchField<volSymmTensorField, scalar>(KName_);
vectorField n = patch().nf();
return n & KWall & n;
}
else
{
FatalErrorIn
(
"solidWallHeatFluxTemperatureFvPatchScalarField::K()"
" const"
) << "Did not find field " << KName_
<< " on mesh " << mesh.name() << " patch " << patch().name()
<< endl
<< "Please set 'K' to a valid volScalarField"
<< " or a valid volSymmTensorField." << exit(FatalError);
return scalarField(0);
}
}
void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
{
if (updated())
......@@ -131,12 +166,7 @@ void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
return;
}
const scalarField& Kw = patch().lookupPatchField<volScalarField, scalar>
(
KName_
);
gradient() = q_/Kw;
gradient() = q_/K();
fixedGradientFvPatchScalarField::updateCoeffs();
}
......
......@@ -31,9 +31,10 @@ Description
myWallPatch
{
type solidWallHeatFluxTemperature;
K K; // Name of K field
q uniform 1000; // Heat flux / [W/m2]
value 300.0; // Initial temperature / [K]
K K; // Name of K field
q uniform 1000; // Heat flux / [W/m2]
value uniform 300.0; // Initial temperature / [K]
gradient uniform 0.0; // Initial gradient / [K/m]
}
......@@ -140,6 +141,11 @@ public:
// Member functions
// Helper
//- Get K field on this patch
tmp<scalarField> K() const;
// Evaluation functions
//- Update the coefficients associated with the patch field
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment