View Issue Details

IDProjectCategoryView StatusLast Update
0000030OpenFOAMBugpublic2010-09-13 17:37
Reporteruser36Assigned Tohenry  
PrioritylowSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSUbuntuOS Version10.04
Summary0000030: OF1.6.x:localBlended schemes missing correction funtions
DescriptionHello everyone,

when comparing fixedBlended.H and localBlended.H then localBlended is missing the member functions "correction" and "corrected". These should be necessary when using e.g. linearUpwind as one of the two blending schemes.
I attached a suggested fix, where I copied the two member functions with a little adjustment because the blending factor in localBlended.H is a field.

Best Regards
Dominik Christ
Steps To ReproduceTo "reproduce" compare fixedBlended.H with localBlended.H
TagsModelling, Solver

Activities

user36

2010-09-08 15:56

 

localBlended.H (6,809 bytes)   
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
     \\/     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 2 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, write to the Free Software Foundation,
    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Class
    Foam::localBlended

Description
    Two-scheme localBlended differencing scheme.

SourceFiles
    localBlended.C

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

#ifndef localBlended_H
#define localBlended_H

#include "surfaceInterpolationScheme.H"

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

namespace Foam
{

/*---------------------------------------------------------------------------*\
                           Class localBlended Declaration
\*---------------------------------------------------------------------------*/

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

        //- Scheme 1
        tmp<surfaceInterpolationScheme<Type> > tScheme1_;

        //- Scheme 2
        tmp<surfaceInterpolationScheme<Type> > tScheme2_;


        //- Disallow default bitwise copy construct
        localBlended(const localBlended&);

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


public:

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


    // Constructors

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

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


    // Member Functions

        //- Return the interpolation weighting factors
        tmp<surfaceScalarField> weights
        (
            const GeometricField<Type, fvPatchField, volMesh>& vf
        ) const
        {
            const surfaceScalarField& blendingFactor =
                this->mesh().objectRegistry::
                lookupObject<const surfaceScalarField>
                (
                    word(vf.name() + "BlendingFactor")
                );

            return
                blendingFactor*tScheme1_().weights(vf)
              + (scalar(1) - blendingFactor)*tScheme2_().weights(vf);
        }

        //- Return the face-interpolate of the given cell field
        //  with explicit correction
        tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
        interpolate(const GeometricField<Type, fvPatchField, volMesh>& vf) const
        {
            const surfaceScalarField& blendingFactor = 
            (
                this->mesh().objectRegistry::
                lookupObject<const surfaceScalarField> 
                (
                    word(vf.name() + "BlendingFactor")
                )
            );

            return
                blendingFactor*tScheme1_().interpolate(vf)
              + (scalar(1) - blendingFactor)*tScheme2_().interpolate(vf);
        }

        //- Return true if this scheme uses an explicit correction
        virtual bool corrected() const
        {
            return tScheme1_().corrected() || tScheme2_().corrected();
        }

        //- Return the explicit correction to the face-interpolate
        //  for the given field
        virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
        correction
        (
            const GeometricField<Type, fvPatchField, volMesh>& vf
        ) const
        {
            const surfaceScalarField& blendingFactor =
                this->mesh().objectRegistry::
                lookupObject<const surfaceScalarField>
                (
                    word(vf.name() + "BlendingFactor")
                );
            if (tScheme1_().corrected())
            {
                if (tScheme2_().corrected())
                {
                    return
                    (
                        blendingFactor
                      * tScheme1_().correction(vf)
                      + (scalar(1.0) - blendingFactor)
                      * tScheme2_().correction(vf)
                    );
                }
                else
                {
                    return
                    (
                        blendingFactor
                      * tScheme1_().correction(vf)
                    );
                }
            }
            else if (tScheme2_().corrected())
            {
                return
                (
                    (scalar(1.0) - blendingFactor)
                  * tScheme2_().correction(vf)
                );
            }
            else
            {
                return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
                (
                    NULL
                );
            }
        }

};


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

} // End namespace Foam

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

#endif

// ************************************************************************* //
localBlended.H (6,809 bytes)   

henry

2010-09-09 13:48

manager   ~0000031

localBlended: Added support for "corrected" schemes

See commit 0e234913650b9819e3d96173b027c7ddb57223ce in OpenFOAM-1.7.x git repository.

Issue History

Date Modified Username Field Change
2010-09-08 15:56 user36 New Issue
2010-09-08 15:56 user36 File Added: localBlended.H
2010-09-08 16:48 user2 Assigned To => henry
2010-09-08 16:48 user2 Status new => assigned
2010-09-09 13:48 henry Note Added: 0000031
2010-09-09 13:48 henry Status assigned => resolved
2010-09-09 13:48 henry Fixed in Version => 1.7.x
2010-09-09 13:48 henry Resolution open => fixed
2010-09-13 17:37 user2 Tag Attached: Modelling
2010-09-13 17:37 user2 Tag Attached: Solver