STYLE: remove spurious coordinate system validity check

This commit is contained in:
Mark Olesen
2020-04-22 17:25:55 +02:00
parent c3571b7357
commit bfa20286f2
3 changed files with 21 additions and 31 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2018 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -55,19 +55,6 @@ const Foam::word Foam::fv::jouleHeatingSource::sigmaName(typeName + ":sigma");
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::coordinateSystem& Foam::fv::jouleHeatingSource::csys() const
{
if (!csysPtr_ || !csysPtr_.valid())
{
FatalErrorInFunction
<< "Coordinate system invalid"
<< abort(FatalError);
}
return *csysPtr_;
}
Foam::tmp<Foam::volSymmTensorField>
Foam::fv::jouleHeatingSource::transformSigma
(
@ -91,15 +78,25 @@ Foam::fv::jouleHeatingSource::transformSigma
);
auto& sigma = tsigma.ref();
if (csys().uniform())
// This check should be unnecessary
if (!csysPtr_)
{
FatalErrorInFunction
<< "Coordinate system undefined"
<< abort(FatalError);
}
const auto& csys = *csysPtr_;
if (csys.uniform())
{
sigma.primitiveFieldRef() =
csys().transformPrincipal(sigmaLocal);
csys.transformPrincipal(sigmaLocal);
}
else
{
sigma.primitiveFieldRef() =
csys().transformPrincipal(mesh_.cellCentres(), sigmaLocal);
csys.transformPrincipal(mesh_.cellCentres(), sigmaLocal);
}
sigma.correctBoundaryConditions();
@ -152,12 +149,6 @@ Foam::fv::jouleHeatingSource::jouleHeatingSource
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fv::jouleHeatingSource::~jouleHeatingSource()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
void Foam::fv::jouleHeatingSource::addSup
@ -247,6 +238,8 @@ bool Foam::fv::jouleHeatingSource::read(const dictionary& dict)
Info<< " Using scalar electrical conductivity" << endl;
initialiseSigma(coeffs_, scalarSigmaVsTPtr_);
csysPtr_.clear(); // Do not need coordinate system
}
return true;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -155,7 +155,7 @@ class jouleHeatingSource
:
public option
{
// Private data
// Private Data
//- Name of electrical conductivity field
static const word sigmaName;
@ -190,9 +190,6 @@ class jouleHeatingSource
//- No copy assignment
void operator=(const jouleHeatingSource&) = delete;
//- The coordinate system for anisotropic electrical conductivity
const coordinateSystem& csys() const;
//- Transform the anisotropic electrical conductivity into global system
tmp<volSymmTensorField> transformSigma
(
@ -232,7 +229,7 @@ public:
//- Destructor
virtual ~jouleHeatingSource();
virtual ~jouleHeatingSource() = default;
// Member Functions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -429,7 +429,7 @@ public:
//- Considered valid if it has a specification
virtual bool valid() const
{
return spec_.valid();
return spec_;
}
//- True if the rotation tensor is uniform for all locations