mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: control local boundary consistency checks from FieldBase settings
- avoids multiple definitions for various template specializations
This commit is contained in:
committed by
Mattijs Janssens
parent
4668d0e886
commit
a9b59ad27e
@ -250,8 +250,8 @@ OptimisationSwitches
|
||||
experimentalDdtCorr 0;
|
||||
|
||||
//- Enable enforced consistency of constraint bcs after 'local' operations.
|
||||
// Default is on. Set to 0/false to revert to <v2306 behaviour
|
||||
//localConsistency 0;
|
||||
// Default is on. Set to 0 (ie, false) to revert to <v2306 behaviour
|
||||
//localBoundaryConsistency 0;
|
||||
|
||||
//- Since v2412 wall distance is calculated on a combined patch, created
|
||||
// from all the individual wall patches. Set to 0/false to revert to
|
||||
|
||||
@ -35,6 +35,7 @@ License
|
||||
#include "IOdictionary.H"
|
||||
#include "fileOperation.H"
|
||||
#include "fstreamPointer.H"
|
||||
#include "Field.H" // Ugly handling of localBoundaryConsistency switches
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
@ -141,6 +142,9 @@ void Foam::Time::readDict()
|
||||
<< controlDict_.name() << nl;
|
||||
|
||||
debug::optimisationObjects().setValues(*localDict, true);
|
||||
|
||||
// Ugly handling of localBoundaryConsistency switches
|
||||
FieldBase::warnLocalBoundaryConsistencyCompat(*localDict);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -55,10 +55,7 @@ bool Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::checkConsistency
|
||||
<< endl;
|
||||
}
|
||||
|
||||
auto& bfld = const_cast<GeometricBoundaryField<Type, PatchField, GeoMesh>&>
|
||||
(
|
||||
*this
|
||||
);
|
||||
auto& bfld = this->constCast();
|
||||
|
||||
|
||||
// Store old value
|
||||
@ -719,7 +716,7 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::evaluateLocal
|
||||
{
|
||||
// DebugInFunction << nl;
|
||||
|
||||
if (!localConsistency)
|
||||
if (!FieldBase::localBoundaryConsistency())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -100,12 +100,6 @@ public:
|
||||
//- Enable debug
|
||||
static int debug;
|
||||
|
||||
//- User-defined tolerance (for consistency checks)
|
||||
static scalar tolerance;
|
||||
|
||||
//- Enable local consistency
|
||||
static int localConsistency;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
|
||||
@ -78,66 +78,6 @@ defineTemplateDebugSwitchWithName
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Local-ops consistency enforcing
|
||||
|
||||
template<> int pointScalarField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"localConsistency",
|
||||
int,
|
||||
Foam::pointScalarField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int pointVectorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"pointVectorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::pointVectorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int pointSphericalTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"pointSphericalTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::pointSphericalTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int pointSymmTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"pointSymmTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::pointSymmTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int pointTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"pointTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::pointTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
|
||||
@ -47,6 +47,7 @@ License
|
||||
#include "stringListOps.H"
|
||||
#include "fileOperation.H"
|
||||
#include "fileOperationInitialise.H"
|
||||
#include "Field.H" // Ugly handling of localBoundaryConsistency switches
|
||||
|
||||
#include <cctype>
|
||||
|
||||
@ -2231,6 +2232,12 @@ void Foam::argList::parse
|
||||
Info<< " user-supplied system call operations" << nl
|
||||
<< nl;
|
||||
IOobject::writeDivider(Info);
|
||||
|
||||
// Ugly handling of localBoundaryConsistency switches
|
||||
FieldBase::warnLocalBoundaryConsistencyCompat
|
||||
(
|
||||
debug::optimisationSwitches()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -79,127 +79,6 @@ defineTemplateDebugSwitchWithName
|
||||
0
|
||||
);
|
||||
|
||||
template<> scalar areaScalarField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("areaScalarField::Boundary::tolerance", 0)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"areaScalarField::Boundary::tolerance",
|
||||
scalar,
|
||||
Foam::areaScalarField::Boundary::tolerance
|
||||
);
|
||||
|
||||
template<> scalar areaVectorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("areaVectorField::Boundary::tolerance", 0)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"areaVectorField::Boundary::tolerance",
|
||||
scalar,
|
||||
Foam::areaVectorField::Boundary::tolerance
|
||||
);
|
||||
|
||||
template<> scalar areaSphericalTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch
|
||||
(
|
||||
"areaSphericalTensorField::Boundary::tolerance",
|
||||
0
|
||||
)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"areaSphericalTensorField::Boundary::tolerance",
|
||||
scalar,
|
||||
Foam::areaSphericalTensorField::Boundary::tolerance
|
||||
);
|
||||
|
||||
template<> scalar areaSymmTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch
|
||||
(
|
||||
"areaSymmTensorField::Boundary::tolerance",
|
||||
0
|
||||
)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"areaSymmTensorField::Boundary::tolerance",
|
||||
scalar,
|
||||
Foam::areaSymmTensorField::Boundary::tolerance
|
||||
);
|
||||
|
||||
template<> scalar areaTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("areaTensorField::Boundary::tolerance", 0)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"areaTensorField::Boundary::tolerance",
|
||||
scalar,
|
||||
Foam::areaTensorField::Boundary::tolerance
|
||||
);
|
||||
|
||||
|
||||
// Local-ops consistency enforcing
|
||||
|
||||
template<> int areaScalarField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"areaScalarField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::areaScalarField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int areaVectorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"areaVectorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::areaVectorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int areaSphericalTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"areaSphericalTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::areaSphericalTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int areaSymmTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"areaSymmTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::areaSymmTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int areaTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"areaTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::areaTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
@ -230,56 +109,26 @@ void GeometricField<scalar, faPatchField, areaMesh>::replace
|
||||
*this == gsf;
|
||||
}
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<scalar, faPatchField, areaMesh>::check() const
|
||||
{
|
||||
return checkConsistency<coupledFaPatchField<scalar>>
|
||||
(
|
||||
Foam::areaScalarField::Boundary::tolerance,
|
||||
!(debug&4) // make into warning if debug&4
|
||||
);
|
||||
|
||||
#undef fieldChecks
|
||||
#define fieldChecks(Type) \
|
||||
template<> \
|
||||
bool GeometricBoundaryField<Type, faPatchField, areaMesh>::check() const \
|
||||
{ \
|
||||
return checkConsistency<coupledFaPatchField<Type>> \
|
||||
( \
|
||||
FieldBase::localBoundaryTolerance_, \
|
||||
!(debug&4) /* make into warning if debug&4 */ \
|
||||
); \
|
||||
}
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<vector, faPatchField, areaMesh>::check() const
|
||||
{
|
||||
return checkConsistency<coupledFaPatchField<vector>>
|
||||
(
|
||||
Foam::areaScalarField::Boundary::tolerance,
|
||||
!(debug&4) // make into warning if debug&4
|
||||
);
|
||||
}
|
||||
fieldChecks(scalar);
|
||||
fieldChecks(vector);
|
||||
fieldChecks(sphericalTensor);
|
||||
fieldChecks(symmTensor);
|
||||
fieldChecks(tensor);
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<sphericalTensor, faPatchField, areaMesh>::check
|
||||
() const
|
||||
{
|
||||
return checkConsistency<coupledFaPatchField<sphericalTensor>>
|
||||
(
|
||||
Foam::areaScalarField::Boundary::tolerance,
|
||||
!(debug&4) // make into warning if debug&4
|
||||
);
|
||||
}
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<symmTensor, faPatchField, areaMesh>::check() const
|
||||
{
|
||||
return checkConsistency<coupledFaPatchField<symmTensor>>
|
||||
(
|
||||
Foam::areaScalarField::Boundary::tolerance,
|
||||
!(debug&4) // make into warning if debug&4
|
||||
);
|
||||
}
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<tensor, faPatchField, areaMesh>::check() const
|
||||
{
|
||||
return checkConsistency<coupledFaPatchField<tensor>>
|
||||
(
|
||||
Foam::areaScalarField::Boundary::tolerance,
|
||||
!(debug&4) // make into warning if debug&4
|
||||
);
|
||||
}
|
||||
#undef fieldChecks
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
@ -69,17 +69,39 @@ void GeometricField<scalar, faPatchField, areaMesh>::replace
|
||||
const GeometricField<scalar, faPatchField, areaMesh>& sf
|
||||
);
|
||||
|
||||
|
||||
// Local consistency checks
|
||||
//
|
||||
// template<class Type>
|
||||
// bool GeometricBoundaryField<Type, faPatchField, areaMesh>::check() const
|
||||
// {
|
||||
// return checkConsistency<coupledFaPatchField<Type>>
|
||||
// (
|
||||
// FieldBase::localBoundaryTolerance_,
|
||||
// !(debug&4) // make into warning if debug&4
|
||||
// );
|
||||
// }
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<scalar, faPatchField, areaMesh>::check() const;
|
||||
bool GeometricBoundaryField<scalar, faPatchField, areaMesh>::
|
||||
check() const;
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<vector, faPatchField, areaMesh>::check() const;
|
||||
bool GeometricBoundaryField<vector, faPatchField, areaMesh>::
|
||||
check() const;
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<sphericalTensor, faPatchField, areaMesh>::check
|
||||
() const;
|
||||
bool GeometricBoundaryField<sphericalTensor, faPatchField, areaMesh>::
|
||||
check() const;
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<symmTensor, faPatchField, areaMesh>::check() const;
|
||||
bool GeometricBoundaryField<symmTensor, faPatchField, areaMesh>::
|
||||
check() const;
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<tensor, faPatchField, areaMesh>::check() const;
|
||||
bool GeometricBoundaryField<tensor, faPatchField, areaMesh>::
|
||||
check() const;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -77,84 +77,6 @@ defineTemplateDebugSwitchWithName
|
||||
0
|
||||
);
|
||||
|
||||
template<> scalar edgeScalarField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("tolerance", 0)
|
||||
);
|
||||
template<> scalar edgeVectorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("tolerance", 0)
|
||||
);
|
||||
template<> scalar edgeSphericalTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("tolerance", 0)
|
||||
);
|
||||
template<> scalar edgeSymmTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("tolerance", 0)
|
||||
);
|
||||
template<> scalar edgeTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("tolerance", 0)
|
||||
);
|
||||
|
||||
// Local-ops consistency enforcing
|
||||
|
||||
template<> int edgeScalarField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"edgeScalarField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::edgeScalarField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int edgeVectorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"edgeVectorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::edgeVectorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int edgeSphericalTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"edgeSphericalTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::edgeSphericalTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int edgeSymmTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"edgeSymmTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::edgeSymmTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int edgeTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"edgeTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::edgeTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -169,8 +169,7 @@ Foam::vectorField Foam::SRF::SRFModel::velocity
|
||||
|
||||
Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::U() const
|
||||
{
|
||||
const int oldLocal = volVectorField::Boundary::localConsistency;
|
||||
volVectorField::Boundary::localConsistency = 0;
|
||||
const auto oldConsistency = FieldBase::localBoundaryConsistency(0);
|
||||
tmp<volVectorField> relPos(mesh_.C() - origin_);
|
||||
|
||||
auto tU = volVectorField::New
|
||||
@ -181,7 +180,7 @@ Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::U() const
|
||||
omega_ ^ (relPos() - axis_*(axis_ & relPos()))
|
||||
)
|
||||
);
|
||||
volVectorField::Boundary::localConsistency = oldLocal;
|
||||
FieldBase::localBoundaryConsistency(oldConsistency);
|
||||
|
||||
return tU;
|
||||
}
|
||||
|
||||
@ -5,10 +5,10 @@
|
||||
? g & (cmptMag(g.value())/mag(g.value()))*hRef
|
||||
: dimensionedScalar("ghRef", g.dimensions()*dimLength, 0)
|
||||
);
|
||||
const int oldLocal = volVectorField::Boundary::localConsistency;
|
||||
volVectorField::Boundary::localConsistency = 0;
|
||||
|
||||
const auto oldConsistency = FieldBase::localBoundaryConsistency(0);
|
||||
|
||||
volScalarField gh("gh", (g & mesh.C()) - ghRef);
|
||||
surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef);
|
||||
|
||||
volVectorField::Boundary::localConsistency = oldLocal;
|
||||
FieldBase::localBoundaryConsistency(oldConsistency);
|
||||
|
||||
@ -114,16 +114,11 @@ Foam::cyclicACMIFvPatchField<Type>::cyclicACMIFvPatchField
|
||||
// old logic (ultimately calls the fully self contained
|
||||
// patchNeighbourField)
|
||||
|
||||
int& consistency =
|
||||
GeometricField<Type, fvPatchField, volMesh>::
|
||||
Boundary::localConsistency;
|
||||
|
||||
const int oldConsistency = consistency;
|
||||
consistency = 0;
|
||||
const auto oldConsistency = FieldBase::localBoundaryConsistency(0);
|
||||
|
||||
this->evaluate(Pstream::commsTypes::buffered);
|
||||
|
||||
consistency = oldConsistency;
|
||||
FieldBase::localBoundaryConsistency(oldConsistency);
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,11 +326,7 @@ template<class Type>
|
||||
bool Foam::cyclicACMIFvPatchField<Type>::cacheNeighbourField()
|
||||
{
|
||||
/*
|
||||
return
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>::Boundary::localConsistency
|
||||
!= 0
|
||||
);
|
||||
return (FieldBase::localBoundaryConsistency() != 0);
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -97,16 +97,11 @@ Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
|
||||
// old logic (ultimately calls the fully self contained
|
||||
// patchNeighbourField)
|
||||
|
||||
int& consistency =
|
||||
GeometricField<Type, fvPatchField, volMesh>::
|
||||
Boundary::localConsistency;
|
||||
|
||||
const int oldConsistency = consistency;
|
||||
consistency = 0;
|
||||
const auto oldConsistency = FieldBase::localBoundaryConsistency(0);
|
||||
|
||||
this->evaluate(UPstream::commsTypes::nonBlocking);
|
||||
|
||||
consistency = oldConsistency;
|
||||
FieldBase::localBoundaryConsistency(oldConsistency);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -326,11 +321,7 @@ Foam::cyclicAMIFvPatchField<Type>::patchNeighbourField
|
||||
template<class Type>
|
||||
bool Foam::cyclicAMIFvPatchField<Type>::cacheNeighbourField()
|
||||
{
|
||||
return
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>::Boundary::localConsistency
|
||||
!= 0
|
||||
);
|
||||
return (FieldBase::localBoundaryConsistency() != 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -77,94 +77,6 @@ defineTemplateDebugSwitchWithName
|
||||
0
|
||||
);
|
||||
|
||||
template<> scalar surfaceScalarField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("surfaceScalarField::Boundary::tolerance", 0)
|
||||
);
|
||||
template<> scalar surfaceVectorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("surfaceVectorField::Boundary::tolerance", 0)
|
||||
);
|
||||
template<> scalar surfaceSphericalTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch
|
||||
(
|
||||
"surfaceSphericalTensorField::Boundary::tolerance",
|
||||
0
|
||||
)
|
||||
);
|
||||
template<> scalar surfaceSymmTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch
|
||||
(
|
||||
"surfaceSymmTensorField::Boundary::tolerance",
|
||||
0
|
||||
)
|
||||
);
|
||||
template<> scalar surfaceTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("surfaceTensorField::Boundary::tolerance", 0)
|
||||
);
|
||||
|
||||
|
||||
// Local-ops consistency enforcing
|
||||
|
||||
template<> int surfaceScalarField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"surfaceScalarField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::surfaceScalarField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int surfaceVectorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"surfaceVectorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::surfaceVectorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int surfaceSphericalTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"surfaceSphericalTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::surfaceSphericalTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int surfaceSymmTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"surfaceSymmTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::surfaceSymmTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int surfaceTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"surfaceTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::surfaceTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
|
||||
@ -78,131 +78,6 @@ defineTemplateDebugSwitchWithName
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
// Tolerance optimisation switch
|
||||
|
||||
template<> scalar volScalarField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("volScalarField::Boundary::tolerance", 0)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"volScalarField::Boundary::tolerance",
|
||||
scalar,
|
||||
Foam::volScalarField::Boundary::tolerance
|
||||
);
|
||||
|
||||
template<> scalar volVectorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("volScalarField::Boundary::tolerance", 0)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"volVectorField::Boundary::tolerance",
|
||||
scalar,
|
||||
Foam::volVectorField::Boundary::tolerance
|
||||
);
|
||||
|
||||
template<> scalar volSphericalTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch
|
||||
(
|
||||
"volSphericalTensorField::Boundary::tolerance",
|
||||
0
|
||||
)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"volSphericalTensorField::Boundary::tolerance",
|
||||
scalar,
|
||||
Foam::volSphericalTensorField::Boundary::tolerance
|
||||
);
|
||||
|
||||
template<> scalar volSymmTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch
|
||||
(
|
||||
"volSymmTensorField::Boundary::tolerance",
|
||||
0
|
||||
)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"volSymmTensorField::Boundary::tolerance",
|
||||
scalar,
|
||||
Foam::volSymmTensorField::Boundary::tolerance
|
||||
);
|
||||
|
||||
template<> scalar volTensorField::Boundary::tolerance
|
||||
(
|
||||
debug::floatOptimisationSwitch("volTensorField::Boundary::tolerance", 0)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"volTensorField::Boundary::tolerance",
|
||||
scalar,
|
||||
Foam::volTensorField::Boundary::tolerance
|
||||
);
|
||||
|
||||
|
||||
// Local-ops consistency enforcing
|
||||
|
||||
template<> int volScalarField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"volScalarField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::volScalarField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int volVectorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"volVectorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::volVectorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int volSphericalTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"volSphericalTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::volSphericalTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int volSymmTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"volSymmTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::volSymmTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
template<> int volTensorField::Boundary::localConsistency
|
||||
(
|
||||
debug::optimisationSwitch("localConsistency", 1)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
"volTensorField::Boundary::localConsistency",
|
||||
int,
|
||||
Foam::volTensorField::Boundary::localConsistency
|
||||
);
|
||||
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
@ -235,58 +110,25 @@ void GeometricField<scalar, fvPatchField, volMesh>::replace
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<scalar, fvPatchField, volMesh>::check() const
|
||||
{
|
||||
return checkConsistency<coupledFvPatchField<scalar>>
|
||||
(
|
||||
Foam::volScalarField::Boundary::tolerance,
|
||||
!(debug&4) // make into warning if debug&4
|
||||
);
|
||||
#undef fieldChecks
|
||||
#define fieldChecks(Type) \
|
||||
template<> \
|
||||
bool GeometricBoundaryField<Type, fvPatchField, volMesh>::check() const \
|
||||
{ \
|
||||
return checkConsistency<coupledFvPatchField<Type>> \
|
||||
( \
|
||||
FieldBase::localBoundaryTolerance_, \
|
||||
!(debug&4) /* make into warning if debug&4 */ \
|
||||
); \
|
||||
}
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<vector, fvPatchField, volMesh>::check() const
|
||||
{
|
||||
return checkConsistency<coupledFvPatchField<vector>>
|
||||
(
|
||||
Foam::volScalarField::Boundary::tolerance,
|
||||
!(debug&4) // make into warning if debug&4
|
||||
);
|
||||
}
|
||||
fieldChecks(scalar);
|
||||
fieldChecks(vector);
|
||||
fieldChecks(sphericalTensor);
|
||||
fieldChecks(symmTensor);
|
||||
fieldChecks(tensor);
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<sphericalTensor, fvPatchField, volMesh>::check
|
||||
() const
|
||||
{
|
||||
return checkConsistency<coupledFvPatchField<sphericalTensor>>
|
||||
(
|
||||
Foam::volScalarField::Boundary::tolerance,
|
||||
!(debug&4) // make into warning if debug&4
|
||||
);
|
||||
}
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<symmTensor, fvPatchField, volMesh>::check
|
||||
() const
|
||||
{
|
||||
return checkConsistency<coupledFvPatchField<symmTensor>>
|
||||
(
|
||||
Foam::volScalarField::Boundary::tolerance,
|
||||
!(debug&4) // make into warning if debug&4
|
||||
);
|
||||
}
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<tensor, fvPatchField, volMesh>::check
|
||||
() const
|
||||
{
|
||||
return checkConsistency<coupledFvPatchField<tensor>>
|
||||
(
|
||||
Foam::volScalarField::Boundary::tolerance,
|
||||
!(debug&4) // make into warning if debug&4
|
||||
);
|
||||
}
|
||||
#undef fieldChecks
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
@ -64,17 +64,39 @@ void GeometricField<scalar, fvPatchField, volMesh>::replace
|
||||
const GeometricField<scalar, fvPatchField, volMesh>& sf
|
||||
);
|
||||
|
||||
|
||||
// Local consistency checks
|
||||
//
|
||||
// template<class Type>
|
||||
// bool GeometricBoundaryField<Type, fvPatchField, volMesh>::check() const
|
||||
// {
|
||||
// return checkConsistency<coupledFvPatchField<Type>>
|
||||
// (
|
||||
// FieldBase::localBoundaryTolerance_,
|
||||
// !(debug&4) // make into warning if debug&4
|
||||
// );
|
||||
// }
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<scalar, fvPatchField, volMesh>::check() const;
|
||||
bool GeometricBoundaryField<scalar, fvPatchField, volMesh>::
|
||||
check() const;
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<vector, fvPatchField, volMesh>::check() const;
|
||||
bool GeometricBoundaryField<vector, fvPatchField, volMesh>::
|
||||
check() const;
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<sphericalTensor, fvPatchField, volMesh>::check
|
||||
() const;
|
||||
bool GeometricBoundaryField<sphericalTensor, fvPatchField, volMesh>::
|
||||
check() const;
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<symmTensor, fvPatchField, volMesh>::check() const;
|
||||
bool GeometricBoundaryField<symmTensor, fvPatchField, volMesh>::
|
||||
check() const;
|
||||
|
||||
template<>
|
||||
bool GeometricBoundaryField<tensor, fvPatchField, volMesh>::check() const;
|
||||
bool GeometricBoundaryField<tensor, fvPatchField, volMesh>::
|
||||
check() const;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -197,8 +197,7 @@ void Foam::functionObjects::pressure::addHydrostaticContribution
|
||||
(g_ & (cmptMag(g_.value())/mag(g_.value())))*hRef_
|
||||
);
|
||||
|
||||
const int oldLocal = volScalarField::Boundary::localConsistency;
|
||||
volScalarField::Boundary::localConsistency = 0;
|
||||
const auto oldConsistency = FieldBase::localBoundaryConsistency(0);
|
||||
|
||||
tmp<volScalarField> rgh = rhoScale(p, (g_ & mesh_.C()) - ghRef);
|
||||
|
||||
@ -218,7 +217,7 @@ void Foam::functionObjects::pressure::addHydrostaticContribution
|
||||
{}
|
||||
}
|
||||
|
||||
volScalarField::Boundary::localConsistency = oldLocal;
|
||||
FieldBase::localBoundaryConsistency(oldConsistency);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -234,8 +234,7 @@ bool Foam::functionObjects::setFlow::execute()
|
||||
}
|
||||
case modeType::ROTATION:
|
||||
{
|
||||
const int oldLocal = volVectorField::Boundary::localConsistency;
|
||||
volVectorField::Boundary::localConsistency = 0;
|
||||
const auto oldConsistency = FieldBase::localBoundaryConsistency(0);
|
||||
|
||||
const volVectorField& C = mesh_.C();
|
||||
const volVectorField d
|
||||
@ -269,7 +268,8 @@ bool Foam::functionObjects::setFlow::execute()
|
||||
}
|
||||
|
||||
U = U & R_;
|
||||
volVectorField::Boundary::localConsistency = oldLocal;
|
||||
|
||||
FieldBase::localBoundaryConsistency(oldConsistency);
|
||||
U.correctBoundaryConditions();
|
||||
setPhi(U);
|
||||
|
||||
@ -279,8 +279,7 @@ bool Foam::functionObjects::setFlow::execute()
|
||||
{
|
||||
const scalar pi = Foam::constant::mathematical::pi;
|
||||
|
||||
const int oldLocal = volVectorField::Boundary::localConsistency;
|
||||
volVectorField::Boundary::localConsistency = 0;
|
||||
const auto oldConsistency = FieldBase::localBoundaryConsistency(0);
|
||||
|
||||
const volVectorField& C = mesh_.C();
|
||||
|
||||
@ -298,7 +297,8 @@ bool Foam::functionObjects::setFlow::execute()
|
||||
Uc.replace(vector::Z, sin(2*pi*x)*sqr(sin(pi*z)));
|
||||
|
||||
U = U & R_;
|
||||
volVectorField::Boundary::localConsistency = oldLocal;
|
||||
|
||||
FieldBase::localBoundaryConsistency(oldConsistency);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
// Calculating phi
|
||||
@ -343,8 +343,7 @@ bool Foam::functionObjects::setFlow::execute()
|
||||
{
|
||||
const scalar pi = Foam::constant::mathematical::pi;
|
||||
|
||||
const int oldLocal = volVectorField::Boundary::localConsistency;
|
||||
volVectorField::Boundary::localConsistency = 0;
|
||||
const auto oldConsistency = FieldBase::localBoundaryConsistency(0);
|
||||
|
||||
const volVectorField& C = mesh_.C();
|
||||
|
||||
@ -363,7 +362,8 @@ bool Foam::functionObjects::setFlow::execute()
|
||||
Uc.replace(vector::Z, -sin(2*pi*x)*sin(2*pi*y)*sqr(sin(pi*z)));
|
||||
|
||||
U = U & R_;
|
||||
volVectorField::Boundary::localConsistency = oldLocal;
|
||||
|
||||
FieldBase::localBoundaryConsistency(oldConsistency);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
// Calculating phi
|
||||
|
||||
Reference in New Issue
Block a user