/*---------------------------------------------------------------------------*\
  ==  == ====== ====   ====    |
                    \\     ||  | 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::wallBoilingModels::partitioningModels::cosine

Description
    Cosine wall heat flux partitioning model.

    Proposed threshold liquid fractions:
      - alphaLiquid1 0.1
      - alphaLiquid0 0.05

    \verbatim
        Tentner, A., Lo, S., & Kozlov, V. (2006).
        Advances in computational fluid dynamics modeling
        of two-phase flow in boiling water reactor fuel assemblies.
        In International Conference of Nuclear Engineering,
        Miami, Florida, USA.
    \endverbatim

SourceFiles
    cosine.C

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

#ifndef cosine_H
#define cosine_H

#include "partitioningModel.H"

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

namespace Foam
{
namespace wallBoilingModels
{
namespace partitioningModels
{

/*---------------------------------------------------------------------------*\
                           Class cosine Declaration
\*---------------------------------------------------------------------------*/

class cosine
:
    public partitioningModel
{
    // Private Data

        //- Lower threshold liquid phase fraction
        const scalar alphaLiquid0_;

        //- Upper threshold liquid phase fraction
        const scalar alphaLiquid1_;


    // Private Member Functions

        //- Calculate and return the wet fraction
        template<class ScalarFieldType>
        tmp<ScalarFieldType> calculate
        (
            const ScalarFieldType& alphaLiquid
        ) const;


public:

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


    // Constructors

        //- Construct from a dictionary
        cosine(const dictionary& dict);

        //- Copy construct
        cosine(const cosine& model);

        //- Construct and return a clone
        virtual autoPtr<partitioningModel> clone() const
        {
            return autoPtr<partitioningModel>(new cosine(*this));
        }


    //- Destructor
    virtual ~cosine();


    // Member Functions

        //- Return the wet fraction
        virtual tmp<scalarField> wetFraction
        (
            const scalarField& alphaLiquid
        ) const;

        //- Return the wet fraction
        virtual tmp<volScalarField::Internal> wetFraction
        (
            const volScalarField::Internal& alphaLiquid
        ) const;

        //- Return the wet fraction
        virtual tmp<volScalarField> wetFraction
        (
            const volScalarField& alphaLiquid
        ) const;

        //- Write to stream
        virtual void write(Ostream& os) const;
};


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

} // End namespace partitioningModels
} // End namespace wallBoilingModels
} // End namespace Foam

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

#endif

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