diff --git a/src/lagrangian/parcel/submodels/MPPIC/AveragingMethods/Moment/Moment.C b/src/lagrangian/parcel/submodels/MPPIC/AveragingMethods/Moment/Moment.C deleted file mode 100644 index be3096d6fc..0000000000 --- a/src/lagrangian/parcel/submodels/MPPIC/AveragingMethods/Moment/Moment.C +++ /dev/null @@ -1,213 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "Moment.H" - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::AveragingMethods::Moment::Moment -( - const IOobject& io, - const dictionary& dict, - const fvMesh& mesh -) -: - AveragingMethod(io, dict, mesh, labelList(4, mesh.nCells())), - data_(FieldField::operator[](0)), - dataX_(FieldField::operator[](1)), - dataY_(FieldField::operator[](2)), - dataZ_(FieldField::operator[](3)), - transform_(mesh.nCells(), Zero), - scale_(0.5*pow(mesh.V(), 1.0/3.0)) -{ - scalar a = 1.0/24.0; - scalar b = 0.5854101966249685; - scalar c = 0.1381966011250105; - - scalarField wQ(4); - wQ[0] = a; - wQ[1] = a; - wQ[2] = a; - wQ[3] = a; - - vectorField xQ(4); - xQ[0] = vector(b, c, c); - xQ[1] = vector(c, b, c); - xQ[2] = vector(c, c, b); - xQ[3] = vector(c, c, c); - - forAll(mesh.C(), celli) - { - const List cellTets = - polyMeshTetDecomposition::cellTetIndices(mesh, celli); - - symmTensor A(Zero); - - forAll(cellTets, tetI) - { - const tetIndices& tetIs = cellTets[tetI]; - const triFace triIs = tetIs.faceTriIs(mesh); - - const tensor T - ( - tensor - ( - mesh.points()[triIs[0]] - mesh.C()[celli], - mesh.points()[triIs[1]] - mesh.C()[celli], - mesh.points()[triIs[2]] - mesh.C()[celli] - ).T() - ); - - const vectorField d((T & xQ)/scale_[celli]); - - const scalar v(6.0*tetIs.tet(mesh).mag()/mesh.V()[celli]); - - A += v*sum(wQ*sqr(d)); - } - - transform_[celli] = inv(A); - } -} - - -template -Foam::AveragingMethods::Moment::Moment -( - const Moment& am -) -: - AveragingMethod(am), - data_(FieldField::operator[](0)), - dataX_(FieldField::operator[](1)), - dataY_(FieldField::operator[](2)), - dataZ_(FieldField::operator[](3)), - transform_(am.transform_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::AveragingMethods::Moment::~Moment() -{} - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -void Foam::AveragingMethods::Moment::updateGrad() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::AveragingMethods::Moment::add -( - const barycentric& coordinates, - const tetIndices& tetIs, - const Type& value -) -{ - const label celli = tetIs.cell(); - const triFace triIs = tetIs.faceTriIs(this->mesh_); - - const point delta = - (coordinates[0] - 1)*this->mesh_.C()[celli] - + coordinates[1]*this->mesh_.points()[triIs[0]] - + coordinates[2]*this->mesh_.points()[triIs[1]] - + coordinates[3]*this->mesh_.points()[triIs[2]]; - - const Type v = value/this->mesh_.V()[celli]; - const GradType dv = transform_[celli] & (v*delta/scale_[celli]); - - data_[celli] += v; - dataX_[celli] += v + dv.x(); - dataY_[celli] += v + dv.y(); - dataZ_[celli] += v + dv.z(); -} - - -template -Type Foam::AveragingMethods::Moment::interpolate -( - const barycentric& coordinates, - const tetIndices& tetIs -) const -{ - const label celli = tetIs.cell(); - const triFace triIs = tetIs.faceTriIs(this->mesh_); - - const point delta = - (coordinates[0] - 1)*this->mesh_.C()[celli] - + coordinates[1]*this->mesh_.points()[triIs[0]] - + coordinates[2]*this->mesh_.points()[triIs[1]] - + coordinates[3]*this->mesh_.points()[triIs[2]]; - - return - data_[celli] - + ( - GradType - ( - dataX_[celli] - data_[celli], - dataY_[celli] - data_[celli], - dataZ_[celli] - data_[celli] - ) - & delta/scale_[celli] - ); -} - - -template -typename Foam::AveragingMethods::Moment::GradType -Foam::AveragingMethods::Moment::interpolateGrad -( - const barycentric& coordinates, - const tetIndices& tetIs -) const -{ - const label celli(tetIs.cell()); - - return - GradType - ( - dataX_[celli] - data_[celli], - dataY_[celli] - data_[celli], - dataZ_[celli] - data_[celli] - )/scale_[celli]; -} - - -template -Foam::tmp> -Foam::AveragingMethods::Moment::primitiveField() const -{ - return tmp>(data_); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/parcel/submodels/MPPIC/AveragingMethods/Moment/Moment.H b/src/lagrangian/parcel/submodels/MPPIC/AveragingMethods/Moment/Moment.H deleted file mode 100644 index 454ae708f8..0000000000 --- a/src/lagrangian/parcel/submodels/MPPIC/AveragingMethods/Moment/Moment.H +++ /dev/null @@ -1,183 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::AveragingMethods::Moment - -Description - Moment lagrangian averaging procedure. - - Point values and moments from the cell centroid are summed over - computational cells. A linear function is generated which has the same - integrated moment as that of the point data. - - The computed linear function is used to interpolate values within a cell. - The gradient is calculated from the coefficients of the function, and is - assumed constant over the cell. - -SourceFiles - Moment.C - -\*---------------------------------------------------------------------------*/ - -#ifndef Moment_H -#define Moment_H - -#include "AveragingMethod.H" -#include "pointMesh.H" -#include "tetIndices.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace AveragingMethods -{ - -/*---------------------------------------------------------------------------*\ - Class Moment Declaration -\*---------------------------------------------------------------------------*/ - -template -class Moment -: - public AveragingMethod -{ -public: - - // Public Typedefs - - //- Gradient type - typedef typename AveragingMethod::GradType GradType; - - -private: - - // Private data - - //- Data mean - Field& data_; - - //- X-data moment - Field& dataX_; - - //- Y-data moment - Field& dataY_; - - //- Z-data moment - Field& dataZ_; - - //- Transform tensor from moment to gradient - Field transform_; - - //- Length scale for moment values - Field scale_; - - - // Private Member Functions - - //- Re-calculate gradient - virtual void updateGrad(); - - -public: - - //- Runtime type information - TypeName("moment"); - - - //- Constructors - - //- Construct from components - Moment - ( - const IOobject& io, - const dictionary& dict, - const fvMesh &mesh - ); - - //- Construct a copy - Moment(const Moment& am); - - //- Construct and return a clone - virtual autoPtr> clone() const - { - return autoPtr> - ( - new Moment(*this) - ); - } - - - //- Destructor - virtual ~Moment(); - - - //- Member Functions - - //- Add point value to interpolation - void add - ( - const barycentric& coordinates, - const tetIndices& tetIs, - const Type& value - ); - - //- Interpolate - Type interpolate - ( - const barycentric& coordinates, - const tetIndices& tetIs - ) const; - - //- Interpolate gradient - GradType interpolateGrad - ( - const barycentric& coordinates, - const tetIndices& tetIs - ) const; - - //- Return an internal field of the average - tmp> primitiveField() const; - - //- Return an internal field of the gradient - tmp> internalFieldGrad() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace AveragingMethods -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository - #include "Moment.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/parcel/submodels/MPPIC/AveragingMethods/makeAveragingMethods.C b/src/lagrangian/parcel/submodels/MPPIC/AveragingMethods/makeAveragingMethods.C index 8583e7c211..23d071b761 100644 --- a/src/lagrangian/parcel/submodels/MPPIC/AveragingMethods/makeAveragingMethods.C +++ b/src/lagrangian/parcel/submodels/MPPIC/AveragingMethods/makeAveragingMethods.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,7 +29,6 @@ License #include "Basic.H" #include "Dual.H" -#include "Moment.H" // Scalar interpolation defineNamedTemplateTypeNameAndDebug(Foam::AveragingMethod, 0); @@ -94,24 +93,4 @@ adddictionaryConstructorToTable> addDualvectorConstructorToTable_; -// Moment interpolation -defineNamedTemplateTypeNameAndDebug -( - Foam::AveragingMethods::Moment, - 0 -); -Foam::AveragingMethod:: -adddictionaryConstructorToTable> - addMomentscalarConstructorToTable_; - -defineNamedTemplateTypeNameAndDebug -( - Foam::AveragingMethods::Moment, - 0 -); -Foam::AveragingMethod:: -adddictionaryConstructorToTable> - addMomentvectorConstructorToTable_; - - // ************************************************************************* //