View Issue Details

IDProjectCategoryView StatusLast Update
0002100OpenFOAMPatchpublic2016-05-26 15:00
ReporterMattijsJ Assigned Tohenry  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSOpenSuSEOS Version13.2
Product Versiondev 
Fixed in Versiondev 
Summary0002100: localMin, localMax not parallel consistent
DescriptionlocalMin and localMax interpolation schemes are not parallel consistent. Attached an updated localMin.H (could be done better if there was a Field operator for minMod). A similar fix can be done for localMax.
TagsNo tags attached.

Activities

MattijsJ

2016-05-26 13:58

reporter  

localMin.H (5,547 bytes)   
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2011-2016 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 <http://www.gnu.org/licenses/>.

Class
    Foam::localMin

Description
    LocalMin-mean differencing scheme class.

    This scheme interpolates 1/field using a scheme specified at run-time
    and return the reciprocal of the interpolate.

SourceFiles
    localMin.C

\*---------------------------------------------------------------------------*/

#ifndef localMin_H
#define localMin_H

#include "surfaceInterpolationScheme.H"
#include "volFields.H"
#include "surfaceFields.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

/*---------------------------------------------------------------------------*\
                           Class localMin Declaration
\*---------------------------------------------------------------------------*/

template<class Type>
class localMin
:
    public surfaceInterpolationScheme<Type>
{
    // Private Member Functions

        //- Disallow default bitwise assignment
        void operator=(const localMin&);


public:

    //- Runtime type information
    TypeName("localMin");


    // Constructors

        //- Construct from mesh
        localMin(const fvMesh& mesh)
        :
            surfaceInterpolationScheme<Type>(mesh)
        {}

        //- Construct from Istream.
        //  The name of the flux field is read from the Istream and looked-up
        //  from the mesh objectRegistry
        localMin
        (
            const fvMesh& mesh,
            Istream& is
        )
        :
            surfaceInterpolationScheme<Type>(mesh)
        {}

        //- Construct from faceFlux and Istream
        localMin
        (
            const fvMesh& mesh,
            const surfaceScalarField& faceFlux,
            Istream& is
        )
        :
            surfaceInterpolationScheme<Type>(mesh)
        {}


    // Member Functions

        //- Return the interpolation weighting factors
        virtual tmp<surfaceScalarField> weights
        (
            const GeometricField<Type, fvPatchField, volMesh>&
        ) const
        {
            NotImplemented;

            return tmp<surfaceScalarField>(NULL);
        }

        //- Return the face-interpolate of the given cell field
        virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
        interpolate
        (
            const GeometricField<Type, fvPatchField, volMesh>& vf
        ) const
        {
            const fvMesh& mesh = vf.mesh();

            tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tvff
            (
                new GeometricField<Type, fvsPatchField, surfaceMesh>
                (
                    IOobject
                    (
                        "localMin::interpolate(" + vf.name() + ')',
                        mesh.time().timeName(),
                        mesh
                    ),
                    mesh,
                    vf.dimensions()
                )
            );
            GeometricField<Type, fvsPatchField, surfaceMesh>& vff = tvff.ref();

            typename GeometricField<Type, fvsPatchField, surfaceMesh>::
                Boundary& vffbf = vff.boundaryFieldRef();

            forAll(vffbf, patchi)
            {
                const fvPatchField<Type>& pfld = vf.boundaryField()[patchi];

                if (pfld.coupled())
                {
                    tmp<Field<Type>> tiFld(pfld.patchInternalField());
                    const Field<Type>& iFld = tiFld();

                    tmp<Field<Type>> tnFld(pfld.patchNeighbourField());
                    const Field<Type>& nFld = tnFld();

                    Field<Type> minFld(vffbf[patchi].size());
                    forAll(minFld, i)
                    {
                        minFld[i] = minMod(iFld[i], nFld[i]);
                    }

                    vffbf[patchi] = minFld;
                }
                else
                {
                    vffbf[patchi] = pfld;
                }
            }

            const labelUList& own = mesh.owner();
            const labelUList& nei = mesh.neighbour();

            forAll(vff, facei)
            {
                vff[facei] = minMod(vf[own[facei]], vf[nei[facei]]);
            }

            return tvff;
        }
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //
localMin.H (5,547 bytes)   

henry

2016-05-26 14:59

manager   ~0006328

Resolved by commit 5976e79cebc57e283771de0ef9c01370490594c8

Issue History

Date Modified Username Field Change
2016-05-26 13:58 MattijsJ New Issue
2016-05-26 13:58 MattijsJ File Added: localMin.H
2016-05-26 14:59 henry Note Added: 0006328
2016-05-26 14:59 henry Status new => resolved
2016-05-26 14:59 henry Fixed in Version => dev
2016-05-26 14:59 henry Resolution open => fixed
2016-05-26 14:59 henry Assigned To => henry