temperatureCoupledBase: Added more user-friendly error messages for inconsistent input

Resolves bug-report https://bugs.openfoam.org/view.php?id=2748
This commit is contained in:
Henry Weller
2017-11-02 14:56:30 +00:00
parent 5f49a69300
commit ba26df7ed6

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -79,7 +79,43 @@ Foam::temperatureCoupledBase::temperatureCoupledBase
method_(KMethodTypeNames_.read(dict.lookup("kappaMethod"))),
kappaName_(dict.lookupOrDefault<word>("kappa", "none")),
alphaAniName_(dict.lookupOrDefault<word>("alphaAni","Anialpha"))
{}
{
switch (method_)
{
case mtDirectionalSolidThermo:
{
if (!dict.found("alphaAni"))
{
FatalIOErrorInFunction(dict)
<< "Did not find entry 'alphaAni'"
" required for 'kappaMethod' "
<< KMethodTypeNames_[method_]
<< exit(FatalIOError);
}
break;
}
case mtLookup:
{
if (!dict.found("kappa"))
{
FatalIOErrorInFunction(dict)
<< "Did not find entry 'kappa'"
" required for 'kappaMethod' "
<< KMethodTypeNames_[method_] << nl
<< " Please set 'kappa' to the name of a volScalarField"
" or volSymmTensorField"
<< exit(FatalIOError);
}
break;
}
default:
break;
}
}
Foam::temperatureCoupledBase::temperatureCoupledBase
@ -133,7 +169,8 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
else
{
FatalErrorInFunction
<< "Kappa defined to employ " << KMethodTypeNames_[method_]
<< "kappaMethod defined to employ "
<< KMethodTypeNames_[method_]
<< " method, but thermo package not available"
<< exit(FatalError);
}
@ -197,10 +234,8 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
<< "Did not find field " << kappaName_
<< " on mesh " << mesh.name() << " patch " << patch_.name()
<< nl
<< "Please set 'kappa' to one of "
<< KMethodTypeNames_.toc()
<< " and 'kappaName' to the name of the volScalar"
<< " or volSymmTensor field (if kappa=lookup)"
<< " Please set 'kappa' to the name of a volScalarField"
" or volSymmTensorField."
<< exit(FatalError);
}
@ -211,8 +246,9 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
{
FatalErrorInFunction
<< "Unimplemented method " << KMethodTypeNames_[method_] << nl
<< "Please set 'kappa' to one of " << KMethodTypeNames_.toc()
<< " and 'kappaName' to the name of the volScalar"
<< " Please set 'kappaMethod' to one of "
<< KMethodTypeNames_.toc()
<< " and 'kappa' to the name of the volScalar"
<< " or volSymmTensor field (if kappa=lookup)"
<< exit(FatalError);
}