/*---------------------------------------------------------------------------*\
  ==  == ====== ====   ====    |
                    \\     ||  | Multiphase Code Repository by HZDR
  ======   //   ||  || ===//   | Website: https://doi.org/10.14278/rodare.767
  ||  ||  //    ||  // || \\   | License: GPL-3.0-or-later
  ==  == ====== ====   ==  ==  |
-------------------------------------------------------------------------------
License
    This file is part of the Multiphase Code Repository by HZDR.

    Copyright (C) 2025 by Helmholtz-Zentrum Dresden-Rossendorf e.V. (HZDR),
    Website: https://hzdr.de

    Multiphase Code Repository by HZDR is based on the free software for
    computational fluid dynamics (CFD) from the OpenFOAM Foundation.
    Copyright (C) 2025 by OpenFOAM Foundation, Website: https://openfoam.org

    If you are interested in which files are original OpenFOAM Foundation
    files, which OpenFOAM Foundation files were modified, and which files were
    newly created, see FILES.md.

    Multiphase Code Repository by HZDR 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.

    Multiphase Code Repository by HZDR 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 the Multiphase Code Repository by HZDR. If not, see
    <http://www.gnu.org/licenses/>.


Class
    Foam::functionObjects::filmThickness

Description
    Function object for calculating the thickness of a resolved film. The film
    thickness is computed via integration of the phase volume fraction in the
    wall normal direction. The thickness values are written to the wall boundary
    patch of the result field.

    Example of function object specification:
    \verbatim
    filmThickness1
    {
        type            filmThickness;
        libs            ("libaddonFieldFunctionObjects.so");
        field           alpha.liquid;
        patch           film;
        nLayers         10;
        yDiff           1e-8;
    }
    \endverbatim

Usage
    \table
        Property     | Description                  | Required   | Default value
        type         | Type name: filmThickness     | yes        |
        field        | Name of the alpha field      | yes        |
        patch        | Patch to report thickness at | yes        |
        nLayers      | Cell layers for integration  | no         | 10
        yDiff        | Minimum difference in wall distance | no  | minDeltaY
    \endtable

See also
    Foam::fvc::integrateWallNormal
    Foam::functionObject::fieldExpression
    Foam::functionObject

SourceFiles
    filmThickness.C

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

#ifndef filmThickness_H
#define filmThickness_H

#include "fieldExpression.H"

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

namespace Foam
{
namespace functionObjects
{

/*---------------------------------------------------------------------------*\
                        Class filmThickness Declaration
\*---------------------------------------------------------------------------*/

class filmThickness
:
    public fieldExpression
{
    // Private Data

        //- Name of patch to report the film thickness at
        word patchName_;

        //- Maximum number of cell layers required for integration
        label nLayers_;

        //- Minimum difference in wall distance between consecutive cells
        scalar yDiff_;


    // Private Member Functions

        //- Calculate the film thickness field and return true if successful
        virtual bool calc();


public:

    //- Runtime type information
    TypeName("filmThickness");
    // Constructors

        //- Construct from Time and dictionary
        filmThickness
        (
            const word& name,
            const Time& runTime,
            const dictionary& dict
        );


    //- Destructor
    virtual ~filmThickness();


    // Member Functions

        //- Read function to update parameters from dictionary
        virtual bool read(const dictionary&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace functionObjects
} // End namespace Foam

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

#endif

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