/*---------------------------------------------------------------------------*\
  ==  == ====== ====   ====    |
                    \\     ||  | 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::fv::constantAttachment

Description
    Model for testing the species mass transfer from one phase to another by
    means of attachment for flotation applications.

    Physically, attachment occurs only if the capacity of the surface allows.
    The maximum surface loading is controlled by the parameter "maxLoading".

    To prevent overshooting within the current timestep, the potential surface
    loading is determined within the timestep and is limited in case it exceeds
    the threshold.

    For numerical stability and accuracy, attachment occurs only when three
    conditions are fulfilled:

    1- if the volume fraction of the detached phase is larger than
    residualAlpha of the detached phase

    2- if mass of the detached phase is larger than or equals to
    the mass being transferred

    3- if the volume fraction of the aggregate phase is 10 times larger than
    its residualAlpha

    Note: the model can only be applied for the attachment of a single particle
    specie. Please note, that the following interface is required:
    <detachedPhase>_dispersedIn_<aggregatePhase> .

Usage
    \table
        Property       | Description                    | Required | Default
        species        | Name of species changing phase | yes      | -
        carrierSpecie | Name of carrier species        | yes      | -
        k              | Attachment rate                | yes      | -
        maxLoading     | The maximum surface loading    | no       | 1
        residualAlpha  | Residual for aggregate phase   | no      | 10*res.Alpha
    \endtable

SourceFiles
    constantAttachment.C

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

#ifndef constantAttachment_H
#define constantAttachment_H

#include "attachmentModel.H"

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

namespace Foam
{

namespace fv
{

/*---------------------------------------------------------------------------*\
                     Class constantAttachment Declaration
\*---------------------------------------------------------------------------*/

class constantAttachment
:
    public attachmentModel
{
private:

    // Private Data

        //- Constant attachment rate
        const dimensionedScalar k_;

        //- Attachment limiter
        mutable volScalarField attachmentLimiter_;


protected:

    // Protected Member Functions

        //- Limiter for attachment rate
        virtual tmp<volScalarField> attachmentLimiter() const;

        //- Attachment rate
        virtual tmp<volScalarField> rate() const;


public:

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


    // Constructors

        //- Construct from components
        constantAttachment
        (
            const dictionary& dict,
            const dispersedPhaseInterface& interface,
            const hashedWordList& species
        );


    //- Destructor
    virtual ~constantAttachment();
};


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

} // End namespace fv
} // End namespace Foam

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

#endif

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