diff --git a/applications/solvers/modules/multiphaseEuler/phaseSystems/phaseSystem/phaseSystem.C b/applications/solvers/modules/multiphaseEuler/phaseSystems/phaseSystem/phaseSystem.C index 344bdf1741..fce607a0a2 100644 --- a/applications/solvers/modules/multiphaseEuler/phaseSystems/phaseSystem/phaseSystem.C +++ b/applications/solvers/modules/multiphaseEuler/phaseSystems/phaseSystem/phaseSystem.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,6 @@ License #include "fvcSnGrad.H" #include "CorrectPhi.H" #include "fvcMeshPhi.H" -#include "alphaContactAngleFvPatchScalarField.H" #include "correctContactAngle.H" #include "dragModel.H" #include "movingWallVelocityFvPatchVectorField.H" diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C index f280635354..c7fc6abbab 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -140,7 +140,7 @@ void Foam::Function1::operator=(const Function1& f) // * * * * * * * * * * * * * * * IOstream Functions * * * * * * * * * * * * // template -void Foam::writeEntry(Ostream& os, const Function1& f1) +void Foam::writeEntry(Ostream& os, const Function1& f1) { writeKeyword(os, f1.name()) << nl << indent << token::BEGIN_BLOCK << nl << incrIndent; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C index 153036f586..ea5cf44a8c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,19 +39,6 @@ Foam::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField {} -template -Foam::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField -( - const fvPatch& p, - const DimensionedField& iF, - const Field& fld -) -: - fixedValueFvPatchField(p, iF, fld), - uniformValue_() -{} - - template Foam::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField ( diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H index 31663bfa07..ac9d9826b9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -96,14 +96,6 @@ public: const DimensionedField& ); - //- Construct from patch and internal field and patch field - uniformFixedValueFvPatchField - ( - const fvPatch&, - const DimensionedField&, - const Field& fld - ); - //- Construct from patch, internal field and dictionary uniformFixedValueFvPatchField ( diff --git a/src/finiteVolume/finiteVolume/divSchemes/gaussDivScheme/gaussDivScheme.H b/src/finiteVolume/finiteVolume/divSchemes/gaussDivScheme/gaussDivScheme.H index ddb70b4bc5..37dff29e7c 100644 --- a/src/finiteVolume/finiteVolume/divSchemes/gaussDivScheme/gaussDivScheme.H +++ b/src/finiteVolume/finiteVolume/divSchemes/gaussDivScheme/gaussDivScheme.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::fv::gaussDivScheme Description - Basic second-order div using face-gradients and Gauss' theorem. + Basic second-order div using face interpolated values and Gauss' theorem. SourceFiles gaussDivScheme.C diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C index 2e7a32c841..8836421696 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -77,14 +77,12 @@ Foam::fv::gaussGrad::gradf forAll(mesh.boundary(), patchi) { - const labelUList& pFaceCells = - mesh.boundary()[patchi].faceCells(); - + const fvPatch& p = mesh.boundary()[patchi]; + const labelUList& pFaceCells = p.faceCells(); const vectorField& pSf = mesh.Sf().boundaryField()[patchi]; - const fvsPatchField& pssf = ssf.boundaryField()[patchi]; - forAll(mesh.boundary()[patchi], facei) + forAll(p, facei) { igGrad[pFaceCells[facei]] += pSf[facei]*pssf[facei]; } diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H index 6ed2b5a404..6849d93129 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -59,7 +59,10 @@ class gaussGrad : public fv::gradScheme { - // Private Data + +protected: + + // Protected Data tmp> tinterpScheme_; diff --git a/src/twoPhaseModels/interfaceProperties/Make/files b/src/twoPhaseModels/interfaceProperties/Make/files index 0c450b1e67..ae0b11873a 100644 --- a/src/twoPhaseModels/interfaceProperties/Make/files +++ b/src/twoPhaseModels/interfaceProperties/Make/files @@ -5,4 +5,13 @@ surfaceTensionModels/surfaceTensionModel/surfaceTensionModelNew.C surfaceTensionModels/constant/constantSurfaceTension.C surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C +contactAngleModels/contactAngleModel/contactAngleModel.C +contactAngleModels/contactAngleModel/contactAngleModelNew.C +contactAngleModels/constant/constantContactAngle.C +contactAngleModels/temperatureDependent/temperatureDependentContactAngle.C +contactAngleModels/dynamic/dynamicContactAngle.C +contactAngleModels/gravitational/gravitationalContactAngle.C + +alphaContactAngle/alphaContactAngleFvPatchScalarField.C + LIB = $(FOAM_LIBBIN)/libinterfaceProperties diff --git a/src/twoPhaseModels/interfaceProperties/Make/options b/src/twoPhaseModels/interfaceProperties/Make/options index 30295c72da..71b7873964 100644 --- a/src/twoPhaseModels/interfaceProperties/Make/options +++ b/src/twoPhaseModels/interfaceProperties/Make/options @@ -1,7 +1,5 @@ EXE_INC = \ - -I$(LIB_SRC)/twoPhaseModels/twoPhaseProperties/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude LIB_LIBS = \ - -ltwoPhaseProperties \ -lfiniteVolume diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C b/src/twoPhaseModels/interfaceProperties/alphaContactAngle/alphaContactAngleFvPatchScalarField.C similarity index 86% rename from src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C rename to src/twoPhaseModels/interfaceProperties/alphaContactAngle/alphaContactAngleFvPatchScalarField.C index c019a79cad..b14b43201d 100644 --- a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C +++ b/src/twoPhaseModels/interfaceProperties/alphaContactAngle/alphaContactAngleFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,8 +32,6 @@ License namespace Foam { - defineTypeNameAndDebug(alphaContactAngleFvPatchScalarField, 0); - template<> const char* Foam::NamedEnum < @@ -65,6 +63,7 @@ Foam::alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField ) : fixedGradientFvPatchScalarField(p, iF), + contactAngle_(), limit_(lcZeroGradient) {} @@ -77,6 +76,7 @@ Foam::alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField ) : fixedGradientFvPatchScalarField(p, iF), + contactAngle_(contactAngleModel::New(dict)), limit_(limitControlNames_.read(dict.lookup("limit"))) { if (dict.found("gradient")) @@ -102,6 +102,7 @@ Foam::alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField ) : fixedGradientFvPatchScalarField(acpsf, p, iF, mapper), + contactAngle_(acpsf.contactAngle_, false), limit_(acpsf.limit_) {} @@ -113,12 +114,23 @@ Foam::alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField ) : fixedGradientFvPatchScalarField(acpsf, iF), + contactAngle_(acpsf.contactAngle_, false), limit_(acpsf.limit_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::tmp Foam::alphaContactAngleFvPatchScalarField::cosTheta +( + const fvPatchVectorField& Up, + const vectorField& nHat +) const +{ + return contactAngle_->cosTheta(Up, nHat); +} + + void Foam::alphaContactAngleFvPatchScalarField::evaluate ( const Pstream::commsTypes @@ -156,8 +168,21 @@ void Foam::alphaContactAngleFvPatchScalarField::write ) const { fixedGradientFvPatchScalarField::write(os); + writeEntry(os, contactAngle_()); writeEntry(os, "limit", limitControlNames_[limit_]); } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + alphaContactAngleFvPatchScalarField + ); +} + + // ************************************************************************* // diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H b/src/twoPhaseModels/interfaceProperties/alphaContactAngle/alphaContactAngleFvPatchScalarField.H similarity index 89% rename from src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H rename to src/twoPhaseModels/interfaceProperties/alphaContactAngle/alphaContactAngleFvPatchScalarField.H index 9f6132286a..1bf624874c 100644 --- a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H +++ b/src/twoPhaseModels/interfaceProperties/alphaContactAngle/alphaContactAngleFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,10 +25,7 @@ Class Foam::alphaContactAngleFvPatchScalarField Description - Abstract base class for alphaContactAngle boundary conditions. - - Derived classes must implement the theta() function which returns the - wall contact angle field. + General alpha contact angle boundary condition. The essential entry "limit" controls the gradient of alpha1 on the wall: - none - Calculate the gradient from the contact-angle without limiter @@ -47,9 +44,15 @@ Description { type alphaContactAngle; limit none; + theta0 70; } \endverbatim +See also + Foam::contactAngleModel + Foam::contactAngleModels::constant + Foam::contactAngleModels::dynamic + SourceFiles alphaContactAngleFvPatchScalarField.C @@ -59,7 +62,7 @@ SourceFiles #define alphaContactAngleFvPatchScalarField_H #include "fixedGradientFvPatchFields.H" -#include "fvsPatchFields.H" +#include "contactAngleModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -74,6 +77,11 @@ class alphaContactAngleFvPatchScalarField : public fixedGradientFvPatchScalarField { + // Private Data + + //- Equilibrium contact angle function + autoPtr contactAngle_; + public: @@ -135,12 +143,12 @@ public: // Member Functions - //- Return the contact angle - virtual tmp theta + //- Return the cosine of the contact angle + tmp cosTheta ( const fvPatchVectorField& Up, - const fvsPatchVectorField& nHat - ) const = 0; + const vectorField& nHat + ) const; //- Evaluate the patch field virtual void evaluate diff --git a/src/twoPhaseModels/interfaceProperties/contactAngleModels/constant/constantContactAngle.C b/src/twoPhaseModels/interfaceProperties/contactAngleModels/constant/constantContactAngle.C new file mode 100644 index 0000000000..508b364f57 --- /dev/null +++ b/src/twoPhaseModels/interfaceProperties/contactAngleModels/constant/constantContactAngle.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +\*---------------------------------------------------------------------------*/ + +#include "constantContactAngle.H" +#include "unitConversion.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace contactAngleModels +{ + defineTypeNameAndDebug(constant, 0); + addToRunTimeSelectionTable(contactAngleModel, constant, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::contactAngleModels::constant::constant(const dictionary& dict) +: + theta0_(dict.lookup("theta0")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::contactAngleModels::constant::~constant() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::contactAngleModels::constant::cosTheta +( + const fvPatchVectorField& Up, + const vectorField& nHat +) const +{ + return tmp + ( + new scalarField(Up.size(), cos(degToRad(theta0_))) + ); +} + + +void Foam::contactAngleModels::constant::write(Ostream& os) const +{ + writeEntry(os, "theta0", theta0_); +} + + +// ************************************************************************* // diff --git a/src/twoPhaseModels/interfaceProperties/contactAngleModels/constant/constantContactAngle.H b/src/twoPhaseModels/interfaceProperties/contactAngleModels/constant/constantContactAngle.H new file mode 100644 index 0000000000..86736494ed --- /dev/null +++ b/src/twoPhaseModels/interfaceProperties/contactAngleModels/constant/constantContactAngle.H @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +Class + Foam::contactAngleModels::constant + +Description + Uniform constant contact angle model. + +Usage + Example of the contact angle specification: + \verbatim + contactAngle + { + type constant; + theta0 70; + } + \endverbatim + +See also + Foam::contactAngleModel + +SourceFiles + constantContactAngle.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantContactAngle_H +#define constantContactAngle_H + +#include "contactAngleModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace contactAngleModels +{ + +/*---------------------------------------------------------------------------*\ + Class constant Declaration +\*---------------------------------------------------------------------------*/ + +class constant +: + public contactAngleModel +{ + // Private Data + + //- Equilibrium contact angle + scalar theta0_; + + +public: + + //- Runtime type information + TypeName("constant"); + + + // Constructors + + //- Construct from dictionary + constant(const dictionary& dict); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new constant(*this)); + } + + + //- Destructor + virtual ~constant(); + + + // Member Functions + + //- Cosine of the contact angle + virtual tmp cosTheta + ( + const fvPatchVectorField& Up, + const vectorField& nHat + ) const; + + //- Write data in dictionary format + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace contactAngleModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/twoPhaseModels/interfaceProperties/contactAngleModels/contactAngleModel/contactAngleModel.C b/src/twoPhaseModels/interfaceProperties/contactAngleModels/contactAngleModel/contactAngleModel.C new file mode 100644 index 0000000000..437c784e11 --- /dev/null +++ b/src/twoPhaseModels/interfaceProperties/contactAngleModels/contactAngleModel/contactAngleModel.C @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +\*---------------------------------------------------------------------------*/ + +#include "contactAngleModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(contactAngleModel, 0); + defineRunTimeSelectionTable(contactAngleModel, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::contactAngleModel::contactAngleModel() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::contactAngleModel::~contactAngleModel() +{} + + +// * * * * * * * * * * * * * * * IOstream Functions * * * * * * * * * * * * // + +void Foam::writeEntry(Ostream& os, const contactAngleModel& ca) +{ + writeKeyword(os, "contactAngle") + << nl << indent << token::BEGIN_BLOCK << nl << incrIndent; + + writeEntry(os, "type", ca.type()); + + ca.write(os); + + os << decrIndent << indent << token::END_BLOCK << endl; +} + + +// ************************************************************************* // diff --git a/src/twoPhaseModels/interfaceProperties/contactAngleModels/contactAngleModel/contactAngleModel.H b/src/twoPhaseModels/interfaceProperties/contactAngleModels/contactAngleModel/contactAngleModel.H new file mode 100644 index 0000000000..4b07f26263 --- /dev/null +++ b/src/twoPhaseModels/interfaceProperties/contactAngleModels/contactAngleModel/contactAngleModel.H @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +Class + Foam::contactAngleModel + +Description + Abstract base-class for contact-angle models + which return the cosine contact angle field. + +Usage + Example of the surface tension specification: + \verbatim + contactAngle + { + type ; + ; + . + . + . + } + \endverbatim + +SourceFiles + contactAngleModel.C + contactAngleModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef contactAngleModel_H +#define contactAngleModel_H + +#include "fvPatchFields.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class contactAngleModel Declaration +\*---------------------------------------------------------------------------*/ + +class contactAngleModel +{ +protected: + + // Protected member functions + + static const dictionary& contactAngleDict(const dictionary& dict) + { + return dict.subDict("contactAngle"); + } + + +public: + + //- Runtime type information + TypeName("contactAngleModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + contactAngleModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + // Construct + contactAngleModel(); + + //- Construct and return a clone + virtual autoPtr clone() const = 0; + + + //- Destructor + virtual ~contactAngleModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict + ); + + + // Member Functions + + //- Cosine of the contact angle + virtual tmp cosTheta + ( + const fvPatchVectorField& Up, + const vectorField& nHat + ) const = 0; + + //- Write data in dictionary format + virtual void write(Ostream& os) const = 0; +}; + + +void writeEntry(Ostream& os, const contactAngleModel& ca); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/twoPhaseModels/interfaceProperties/contactAngleModels/contactAngleModel/contactAngleModelNew.C b/src/twoPhaseModels/interfaceProperties/contactAngleModels/contactAngleModel/contactAngleModelNew.C new file mode 100644 index 0000000000..0de86c49c1 --- /dev/null +++ b/src/twoPhaseModels/interfaceProperties/contactAngleModels/contactAngleModel/contactAngleModelNew.C @@ -0,0 +1,68 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +\*---------------------------------------------------------------------------*/ + +#include "contactAngleModel.H" +#include "constantContactAngle.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::contactAngleModel::New +( + const dictionary& dict +) +{ + if (dict.isDict("contactAngle")) + { + const dictionary& contactAngleDict = + contactAngleModel::contactAngleDict(dict); + + word contactAngleModelType(contactAngleDict.lookup("type")); + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(contactAngleModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown contactAngleModelType type " + << contactAngleModelType << endl << endl + << "Valid contactAngleModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(contactAngleDict); + } + else + { + return autoPtr + ( + new contactAngleModels::constant(dict) + ); + } +} + + +// ************************************************************************* // diff --git a/src/twoPhaseModels/interfaceProperties/contactAngleModels/dynamic/dynamicContactAngle.C b/src/twoPhaseModels/interfaceProperties/contactAngleModels/dynamic/dynamicContactAngle.C new file mode 100644 index 0000000000..e11f0cdbba --- /dev/null +++ b/src/twoPhaseModels/interfaceProperties/contactAngleModels/dynamic/dynamicContactAngle.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +\*---------------------------------------------------------------------------*/ + +#include "dynamicContactAngle.H" +#include "unitConversion.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace contactAngleModels +{ + defineTypeNameAndDebug(dynamic, 0); + addToRunTimeSelectionTable(contactAngleModel, dynamic, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::contactAngleModels::dynamic::dynamic(const dictionary& dict) +: + theta0_(dict.lookup("theta0")), + uTheta_(dict.lookup("uTheta")), + thetaAdv_(dict.lookup("thetaAdv")), + thetaRec_(dict.lookup("thetaRec")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::contactAngleModels::dynamic::~dynamic() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::contactAngleModels::dynamic::cosTheta +( + const fvPatchVectorField& Up, + const vectorField& nHat +) const +{ + const vectorField nf(Up.patch().nf()); + + // Calculated the component of the velocity parallel to the wall + vectorField U(Up.patchInternalField() - Up); + U -= (nf & U)*nf; + + // Find the direction of the interface parallel to the wall and normalise + vectorField n(nHat - (nf & nHat)*nf); + n /= (mag(n) + small); + + // Calculate the velocity coefficient + // from the component of U normal to the interface + const scalarField uCoeff(tanh((n & U)/uTheta_)); + + return cos + ( + degToRad(theta0_) + + degToRad(thetaRec_ - theta0_)*max(uCoeff, 0.0) + - degToRad(thetaAdv_ - theta0_)*min(uCoeff, 0.0) + ); +} + + +void Foam::contactAngleModels::dynamic::write(Ostream& os) const +{ + writeEntry(os, "theta0", theta0_); + writeEntry(os, "uTheta", uTheta_); + writeEntry(os, "thetaAdv", thetaAdv_); + writeEntry(os, "thetaRec", thetaRec_); +} + + +// ************************************************************************* // diff --git a/src/twoPhaseModels/interfaceProperties/contactAngleModels/dynamic/dynamicContactAngle.H b/src/twoPhaseModels/interfaceProperties/contactAngleModels/dynamic/dynamicContactAngle.H new file mode 100644 index 0000000000..d554a2a265 --- /dev/null +++ b/src/twoPhaseModels/interfaceProperties/contactAngleModels/dynamic/dynamicContactAngle.H @@ -0,0 +1,140 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +Class + Foam::contactAngleModels::dynamic + +Description + Dynamic contact angle model. + +Usage: + \table + Property | Description | Required | Default value + theta0 | Equilibrium contact angle | yes | + uTheta | Velocity scale | yes | + thetaAdv | Limiting advancing contact angle | yes | + thetaRec | Limiting receding contact angle | yes | + \endtable + + Example: + \verbatim + contactAngle + { + type dynamic; + uTheta 1; + theta0 70; + thetaAdv 100; + thetaRec 50; + } + \endverbatim + +See also + Foam::contactAngleModel + +SourceFiles + dynamicContactAngle.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dynamicContactAngle_H +#define dynamicContactAngle_H + +#include "contactAngleModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace contactAngleModels +{ + +/*---------------------------------------------------------------------------*\ + Class dynamic Declaration +\*---------------------------------------------------------------------------*/ + +class dynamic +: + public contactAngleModel +{ + // Private Data + + //- Equilibrium contact angle + scalar theta0_; + + //- Dynamic contact angle velocity scale + scalar uTheta_; + + //- Limiting advancing contact angle + scalar thetaAdv_; + + //- Limiting receding contact angle + scalar thetaRec_; + + +public: + + //- Runtime type information + TypeName("dynamic"); + + + // Constructors + + //- Construct from dictionary + dynamic(const dictionary& dict); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new dynamic(*this)); + } + + + //- Destructor + virtual ~dynamic(); + + + // Member Functions + + //- Cosine of the contact angle + virtual tmp cosTheta + ( + const fvPatchVectorField& Up, + const vectorField& nHat + ) const; + + //- Write data in dictionary format + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace contactAngleModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/twoPhaseModels/interfaceProperties/contactAngleModels/gravitational/gravitationalContactAngle.C b/src/twoPhaseModels/interfaceProperties/contactAngleModels/gravitational/gravitationalContactAngle.C new file mode 100644 index 0000000000..619be2e9e8 --- /dev/null +++ b/src/twoPhaseModels/interfaceProperties/contactAngleModels/gravitational/gravitationalContactAngle.C @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +\*---------------------------------------------------------------------------*/ + +#include "gravitationalContactAngle.H" +#include "unitConversion.H" +#include "uniformDimensionedFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace contactAngleModels +{ + defineTypeNameAndDebug(gravitational, 0); + addToRunTimeSelectionTable(contactAngleModel, gravitational, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::contactAngleModels::gravitational::gravitational(const dictionary& dict) +: + theta0_(dict.lookup("theta0")), + gTheta_(dict.lookup("gTheta")), + thetaAdv_(dict.lookup("thetaAdv")), + thetaRec_(dict.lookup("thetaRec")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::contactAngleModels::gravitational::~gravitational() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::contactAngleModels::gravitational::cosTheta +( + const fvPatchVectorField& Up, + const vectorField& nHat +) const +{ + const uniformDimensionedVectorField& g = + Up.db().lookupObject("g"); + + const scalarField uCoeff(tanh((nHat & g.value())/gTheta_)); + + return cos + ( + degToRad(theta0_) + + degToRad(thetaRec_ - theta0_)*max(uCoeff, 0.0) + - degToRad(thetaAdv_ - theta0_)*min(uCoeff, 0.0) + ); +} + + +void Foam::contactAngleModels::gravitational::write(Ostream& os) const +{ + writeEntry(os, "theta0", theta0_); + writeEntry(os, "gTheta", gTheta_); + writeEntry(os, "thetaAdv", thetaAdv_); + writeEntry(os, "thetaRec", thetaRec_); +} + + +// ************************************************************************* // diff --git a/src/twoPhaseModels/interfaceProperties/contactAngleModels/gravitational/gravitationalContactAngle.H b/src/twoPhaseModels/interfaceProperties/contactAngleModels/gravitational/gravitationalContactAngle.H new file mode 100644 index 0000000000..4d61577607 --- /dev/null +++ b/src/twoPhaseModels/interfaceProperties/contactAngleModels/gravitational/gravitationalContactAngle.H @@ -0,0 +1,140 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +Class + Foam::contactAngleModels::gravitational + +Description + Gravitational acceleration based contact angle model. + +Usage: + \table + Property | Description | Required | Default value + theta0 | Equilibrium contact angle | yes | + gTheta | Gravitational acceleration scale | yes | + thetaAdv | Limiting advancing contact angle | yes | + thetaRec | Limiting receding contact angle | yes | + \endtable + + Example: + \verbatim + contactAngle + { + type gravitational; + gTheta 0.1; + theta0 70; + thetaAdv 100; + thetaRec 50; + } + \endverbatim + +See also + Foam::contactAngleModel + +SourceFiles + gravitationalContactAngle.C + +\*---------------------------------------------------------------------------*/ + +#ifndef gravitationalContactAngle_H +#define gravitationalContactAngle_H + +#include "contactAngleModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace contactAngleModels +{ + +/*---------------------------------------------------------------------------*\ + Class gravitational Declaration +\*---------------------------------------------------------------------------*/ + +class gravitational +: + public contactAngleModel +{ + // Private Data + + //- Equilibrium contact angle + scalar theta0_; + + //- Gavitational acceleration scale + scalar gTheta_; + + //- Limiting advancing contact angle + scalar thetaAdv_; + + //- Limiting receding contact angle + scalar thetaRec_; + + +public: + + //- Runtime type information + TypeName("gravitational"); + + + // Constructors + + //- Construct from dictionary + gravitational(const dictionary& dict); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new gravitational(*this)); + } + + + //- Destructor + virtual ~gravitational(); + + + // Member Functions + + //- Cosine of the contact angle + virtual tmp cosTheta + ( + const fvPatchVectorField& Up, + const vectorField& nHat + ) const; + + //- Write data in dictionary format + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace contactAngleModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/twoPhaseModels/interfaceProperties/contactAngleModels/temperatureDependent/temperatureDependentContactAngle.C b/src/twoPhaseModels/interfaceProperties/contactAngleModels/temperatureDependent/temperatureDependentContactAngle.C new file mode 100644 index 0000000000..a5f4b810d9 --- /dev/null +++ b/src/twoPhaseModels/interfaceProperties/contactAngleModels/temperatureDependent/temperatureDependentContactAngle.C @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +\*---------------------------------------------------------------------------*/ + +#include "temperatureDependentContactAngle.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace contactAngleModels +{ + defineTypeNameAndDebug(temperatureDependent, 0); + addToRunTimeSelectionTable + ( + contactAngleModel, + temperatureDependent, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::contactAngleModels::temperatureDependent::temperatureDependent +( + const dictionary& dict +) +: + TName_(dict.lookupOrDefault("T", "T")), + theta0_(Function1::New("theta0", dict)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::contactAngleModels::temperatureDependent::~temperatureDependent() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::contactAngleModels::temperatureDependent::cosTheta +( + const fvPatchVectorField& Up, + const vectorField& nHat +) const +{ + return cos + ( + degToRad + ( + theta0_->value + ( + Up.patch().lookupPatchField(TName_) + ) + ) + ); +} + + +void Foam::contactAngleModels::temperatureDependent::write +( + Ostream& os +) const +{ + writeEntry(os, theta0_()); +} + + +// ************************************************************************* // diff --git a/src/twoPhaseModels/interfaceProperties/contactAngleModels/temperatureDependent/temperatureDependentContactAngle.H b/src/twoPhaseModels/interfaceProperties/contactAngleModels/temperatureDependent/temperatureDependentContactAngle.H new file mode 100644 index 0000000000..7f278c5c28 --- /dev/null +++ b/src/twoPhaseModels/interfaceProperties/contactAngleModels/temperatureDependent/temperatureDependentContactAngle.H @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +Class + Foam::contactAngleModels::temperatureDependent + +Description + Temperature-dependent contact angle model. + + The contact angle is evaluated from the specified Foam::Function1 for the + temperature field looked-up from the mesh database the name of which + may optionally be provided. + +Usage + \table + Property | Description | Required | Default value + T | Temperature field name | no | T + contactAngle | contact angle function | yes | + \endtable + + Example of the contact angle specification: + \verbatim + contactAngle + { + type temperatureDependent; + contactAngle constant 0.07; + } + \endverbatim + +See also + Foam::contactAngleModel + Foam::Function1 + +SourceFiles + temperatureDependentContactAngle.C + +\*---------------------------------------------------------------------------*/ + +#ifndef temperatureDependentContactAngle_H +#define temperatureDependentContactAngle_H + +#include "contactAngleModel.H" +#include "Function1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace contactAngleModels +{ + +/*---------------------------------------------------------------------------*\ + Class temperatureDependent Declaration +\*---------------------------------------------------------------------------*/ + +class temperatureDependent +: + public contactAngleModel +{ + // Private Data + + //- Name of temperature field, default = "T" + word TName_; + + //- Equilibrium contact angle function + autoPtr> theta0_; + + +public: + + //- Runtime type information + TypeName("temperatureDependent"); + + + // Constructors + + //- Construct from dictionary + temperatureDependent(const dictionary& dict); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new temperatureDependent(*this)); + } + + + //- Destructor + virtual ~temperatureDependent(); + + + // Member Functions + + //- Cosine of the contact angle + virtual tmp cosTheta + ( + const fvPatchVectorField& Up, + const vectorField& nHat + ) const; + + //- Write data in dictionary format + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace contactAngleModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/twoPhaseModels/interfaceProperties/interfaceProperties.C b/src/twoPhaseModels/interfaceProperties/interfaceProperties.C index 3d33e052c3..5840d114fc 100644 --- a/src/twoPhaseModels/interfaceProperties/interfaceProperties.C +++ b/src/twoPhaseModels/interfaceProperties/interfaceProperties.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -62,9 +62,9 @@ void Foam::interfaceProperties::correctContactAngle ); fvsPatchVectorField& nHatp = nHatb[patchi]; - const scalarField theta + const scalarField cosTheta ( - degToRad(a1cap.theta(U_.boundaryField()[patchi], nHatp)) + a1cap.cosTheta(U_.boundaryField()[patchi], nHatp) ); const vectorField nf @@ -75,12 +75,12 @@ void Foam::interfaceProperties::correctContactAngle // Reset nHatp to correspond to the contact angle const scalarField a12(nHatp & nf); - const scalarField b1(cos(theta)); + const scalarField b1(cosTheta); scalarField b2(nHatp.size()); forAll(b2, facei) { - b2[facei] = cos(acos(a12[facei]) - theta[facei]); + b2[facei] = cos(acos(a12[facei]) - acos(cosTheta[facei])); } const scalarField det(1.0 - a12*a12); diff --git a/src/twoPhaseModels/twoPhaseProperties/Make/files b/src/twoPhaseModels/twoPhaseProperties/Make/files index 2e5b03ff0e..6187e4718b 100644 --- a/src/twoPhaseModels/twoPhaseProperties/Make/files +++ b/src/twoPhaseModels/twoPhaseProperties/Make/files @@ -1,8 +1,3 @@ -alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C -alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C -alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.C -alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C -alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C LIB = $(FOAM_LIBBIN)/libtwoPhaseProperties diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C b/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C deleted file mode 100644 index 78e7323374..0000000000 --- a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C +++ /dev/null @@ -1,121 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 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 . - -\*---------------------------------------------------------------------------*/ - -#include "constantAlphaContactAngleFvPatchScalarField.H" -#include "volMesh.H" -#include "fvPatchFieldMapper.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::constantAlphaContactAngleFvPatchScalarField:: -constantAlphaContactAngleFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - alphaContactAngleFvPatchScalarField(p, iF), - theta0_(0.0) -{} - - -Foam::constantAlphaContactAngleFvPatchScalarField:: -constantAlphaContactAngleFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - alphaContactAngleFvPatchScalarField(p, iF, dict), - theta0_(dict.lookup("theta0")) -{ - evaluate(); -} - - -Foam::constantAlphaContactAngleFvPatchScalarField:: -constantAlphaContactAngleFvPatchScalarField -( - const constantAlphaContactAngleFvPatchScalarField& gcpsf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - alphaContactAngleFvPatchScalarField(gcpsf, p, iF, mapper), - theta0_(gcpsf.theta0_) -{} - - -Foam::constantAlphaContactAngleFvPatchScalarField:: -constantAlphaContactAngleFvPatchScalarField -( - const constantAlphaContactAngleFvPatchScalarField& gcpsf, - const DimensionedField& iF -) -: - alphaContactAngleFvPatchScalarField(gcpsf, iF), - theta0_(gcpsf.theta0_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::tmp -Foam::constantAlphaContactAngleFvPatchScalarField::theta -( - const fvPatchVectorField&, - const fvsPatchVectorField& -) const -{ - return tmp(new scalarField(size(), theta0_)); -} - - -void Foam::constantAlphaContactAngleFvPatchScalarField::write -( - Ostream& os -) const -{ - alphaContactAngleFvPatchScalarField::write(os); - writeEntry(os, "theta0", theta0_); - writeEntry(os, "value", *this); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - makePatchTypeField - ( - fvPatchScalarField, - constantAlphaContactAngleFvPatchScalarField - ); -} - -// ************************************************************************* // diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.H b/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.H deleted file mode 100644 index 3806c86a0c..0000000000 --- a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.H +++ /dev/null @@ -1,145 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 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 . - -Class - Foam::constantAlphaContactAngleFvPatchScalarField - -Description - A constant alphaContactAngle scalar boundary condition. - -See also - Foam::alphaContactAngleFvPatchScalarField - Foam::temperatureDependentAlphaContactAngleFvPatchScalarField - -SourceFiles - constantAlphaContactAngleFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef constantAlphaContactAngleFvPatchScalarField_H -#define constantAlphaContactAngleFvPatchScalarField_H - -#include "alphaContactAngleFvPatchScalarField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class constantAlphaContactAngleFvPatch Declaration -\*---------------------------------------------------------------------------*/ - -class constantAlphaContactAngleFvPatchScalarField -: - public alphaContactAngleFvPatchScalarField -{ - // Private Data - - //- Equilibrium contact angle - scalar theta0_; - - -public: - - //- Runtime type information - TypeName("constantAlphaContactAngle"); - - - // Constructors - - //- Construct from patch and internal field - constantAlphaContactAngleFvPatchScalarField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - constantAlphaContactAngleFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // constantAlphaContactAngleFvPatchScalarField - // onto a new patch - constantAlphaContactAngleFvPatchScalarField - ( - const constantAlphaContactAngleFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Disallow copy without setting internal field reference - constantAlphaContactAngleFvPatchScalarField - ( - const constantAlphaContactAngleFvPatchScalarField& - ) = delete; - - //- Copy constructor setting internal field reference - constantAlphaContactAngleFvPatchScalarField - ( - const constantAlphaContactAngleFvPatchScalarField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new constantAlphaContactAngleFvPatchScalarField(*this, iF) - ); - } - - - // Member Functions - - //- Return the equilibrium contact-angle - virtual tmp theta - ( - const fvPatchVectorField& Up, - const fvsPatchVectorField& nHat - ) const; - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C b/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C deleted file mode 100644 index bde6e738d7..0000000000 --- a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C +++ /dev/null @@ -1,155 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 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 . - -\*---------------------------------------------------------------------------*/ - -#include "dynamicAlphaContactAngleFvPatchScalarField.H" -#include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" -#include "volMesh.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::dynamicAlphaContactAngleFvPatchScalarField:: -dynamicAlphaContactAngleFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - alphaContactAngleFvPatchScalarField(p, iF), - theta0_(0.0), - uTheta_(0.0), - thetaA_(0.0), - thetaR_(0.0) -{} - - -Foam::dynamicAlphaContactAngleFvPatchScalarField:: -dynamicAlphaContactAngleFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - alphaContactAngleFvPatchScalarField(p, iF, dict), - theta0_(dict.lookup("theta0")), - uTheta_(dict.lookup("uTheta")), - thetaA_(dict.lookupBackwardsCompatible({"thetaA", "thetaRec"})), - thetaR_(dict.lookupBackwardsCompatible({"thetaR", "thetaAdv"})) -{ - evaluate(); -} - - -Foam::dynamicAlphaContactAngleFvPatchScalarField:: -dynamicAlphaContactAngleFvPatchScalarField -( - const dynamicAlphaContactAngleFvPatchScalarField& gcpsf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - alphaContactAngleFvPatchScalarField(gcpsf, p, iF, mapper), - theta0_(gcpsf.theta0_), - uTheta_(gcpsf.uTheta_), - thetaA_(gcpsf.thetaA_), - thetaR_(gcpsf.thetaR_) -{} - - -Foam::dynamicAlphaContactAngleFvPatchScalarField:: -dynamicAlphaContactAngleFvPatchScalarField -( - const dynamicAlphaContactAngleFvPatchScalarField& gcpsf, - const DimensionedField& iF -) -: - alphaContactAngleFvPatchScalarField(gcpsf, iF), - theta0_(gcpsf.theta0_), - uTheta_(gcpsf.uTheta_), - thetaA_(gcpsf.thetaA_), - thetaR_(gcpsf.thetaR_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::tmp -Foam::dynamicAlphaContactAngleFvPatchScalarField::theta -( - const fvPatchVectorField& Up, - const fvsPatchVectorField& nHat -) const -{ - if (uTheta_ < small) - { - return tmp(new scalarField(size(), theta0_)); - } - - const vectorField nf(patch().nf()); - - // Calculated the component of the velocity parallel to the wall - vectorField Uwall(Up.patchInternalField() - Up); - Uwall -= (nf & Uwall)*nf; - - // Find the direction of the interface parallel to the wall - vectorField nWall(nHat - (nf & nHat)*nf); - - // Normalise nWall - nWall /= (mag(nWall) + small); - - // Calculate Uwall resolved normal to the interface parallel to - // the interface - scalarField uwall(nWall & Uwall); - - return theta0_ + (thetaA_ - thetaR_)*tanh(uwall/uTheta_); -} - - -void Foam::dynamicAlphaContactAngleFvPatchScalarField::write(Ostream& os) const -{ - alphaContactAngleFvPatchScalarField::write(os); - writeEntry(os, "theta0", theta0_); - writeEntry(os, "uTheta", uTheta_); - writeEntry(os, "thetaA", thetaA_); - writeEntry(os, "thetaR", thetaR_); - writeEntry(os, "value", *this); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - makePatchTypeField - ( - fvPatchScalarField, - dynamicAlphaContactAngleFvPatchScalarField - ); -} - - -// ************************************************************************* // diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.H b/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.H deleted file mode 100644 index 82d6090269..0000000000 --- a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.H +++ /dev/null @@ -1,207 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 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 . - -Class - Foam::dynamicAlphaContactAngleFvPatchScalarField - -Description - A dynamic alphaContactAngle scalar boundary condition - -Usage - Standard properties: - \table - Property | Description | Required | Default value - theta0 | Equilibrium contact angle | yes | - uTheta | Velocity scale | yes | - \endtable - - The advancing and receding contact angles can be either specified with - respect to the interface normal direction: - \table - Property | Description | Required | Default value - thetaA | Limiting advancing contact angle | yes | - thetaR | Limiting receding contact angle | yes | - \endtable - - or with respect to the phase outward direction: - \table - Property | Description | Required | Default value - thetaAdv | Limiting advancing contact angle | yes | - thetaRec | Limiting receding contact angle | yes | - \endtable - - Example of the boundary condition specification using the interface - normal direction convention: - \verbatim - - { - type dynamicAlphaContactAngle; - uTheta 1; - theta0 90; - thetaA 70; - thetaR 110; - limit gradient; - value uniform 0; - } - \endverbatim - - Example of the boundary condition specification using the phase outward - direction convention (opposite to the normal direction): - \verbatim - - { - type dynamicAlphaContactAngle; - uTheta 1; - theta0 90; - thetaAdv 110; - thetaRec 70; - limit gradient; - value uniform 0; - } - \endverbatim - -See also - Foam::alphaContactAngleFvPatchScalarField - Foam::constantAlphaContactAngleFvPatchScalarField - -SourceFiles - dynamicAlphaContactAngleFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef dynamicAlphaContactAngleFvPatchScalarField_H -#define dynamicAlphaContactAngleFvPatchScalarField_H - -#include "alphaContactAngleFvPatchScalarField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class dynamicAlphaContactAngleFvPatch Declaration -\*---------------------------------------------------------------------------*/ - -class dynamicAlphaContactAngleFvPatchScalarField -: - public alphaContactAngleFvPatchScalarField -{ - // Private Data - - //- Equilibrium contact angle - scalar theta0_; - - //- Dynamic contact angle velocity scale - scalar uTheta_; - - //- Limiting advancing contact angle - scalar thetaA_; - - //- Limiting receding contact angle - scalar thetaR_; - - -public: - - //- Runtime type information - TypeName("dynamicAlphaContactAngle"); - - - // Constructors - - //- Construct from patch and internal field - dynamicAlphaContactAngleFvPatchScalarField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - dynamicAlphaContactAngleFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // dynamicAlphaContactAngleFvPatchScalarField - // onto a new patch - dynamicAlphaContactAngleFvPatchScalarField - ( - const dynamicAlphaContactAngleFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Disallow copy without setting internal field reference - dynamicAlphaContactAngleFvPatchScalarField - ( - const dynamicAlphaContactAngleFvPatchScalarField& - ) = delete; - - //- Copy constructor setting internal field reference - dynamicAlphaContactAngleFvPatchScalarField - ( - const dynamicAlphaContactAngleFvPatchScalarField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new dynamicAlphaContactAngleFvPatchScalarField(*this, iF) - ); - } - - - // Member Functions - - //- Evaluate and return dynamic contact-angle - virtual tmp theta - ( - const fvPatchVectorField& Up, - const fvsPatchVectorField& nHat - ) const; - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.C b/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.C deleted file mode 100644 index dbbbeb8581..0000000000 --- a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.C +++ /dev/null @@ -1,129 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2020 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 . - -\*---------------------------------------------------------------------------*/ - -#include "temperatureDependentAlphaContactAngleFvPatchScalarField.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::temperatureDependentAlphaContactAngleFvPatchScalarField:: -temperatureDependentAlphaContactAngleFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - alphaContactAngleFvPatchScalarField(p, iF), - TName_("T"), - theta0_() -{} - - -Foam::temperatureDependentAlphaContactAngleFvPatchScalarField:: -temperatureDependentAlphaContactAngleFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - alphaContactAngleFvPatchScalarField(p, iF, dict), - TName_(dict.lookupOrDefault("T", "T")), - theta0_(Function1::New("theta0", dict)) -{ - evaluate(); -} - - -Foam::temperatureDependentAlphaContactAngleFvPatchScalarField:: -temperatureDependentAlphaContactAngleFvPatchScalarField -( - const temperatureDependentAlphaContactAngleFvPatchScalarField& psf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - alphaContactAngleFvPatchScalarField(psf, p, iF, mapper), - TName_(psf.TName_), - theta0_(psf.theta0_, false) -{} - - -Foam::temperatureDependentAlphaContactAngleFvPatchScalarField:: -temperatureDependentAlphaContactAngleFvPatchScalarField -( - const temperatureDependentAlphaContactAngleFvPatchScalarField& psf, - const DimensionedField& iF -) -: - alphaContactAngleFvPatchScalarField(psf, iF), - TName_(psf.TName_), - theta0_(psf.theta0_, false) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::tmp -Foam::temperatureDependentAlphaContactAngleFvPatchScalarField::theta -( - const fvPatchVectorField&, - const fvsPatchVectorField& -) const -{ - return theta0_->value - ( - patch().lookupPatchField(TName_) - ); -} - - -void Foam::temperatureDependentAlphaContactAngleFvPatchScalarField::write -( - Ostream& os -) const -{ - alphaContactAngleFvPatchScalarField::write(os); - writeEntryIfDifferent(os, "T", "T", TName_); - writeEntry(os, theta0_()); - writeEntry(os, "value", *this); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - makePatchTypeField - ( - fvPatchScalarField, - temperatureDependentAlphaContactAngleFvPatchScalarField - ); -} - -// ************************************************************************* // diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.H b/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.H deleted file mode 100644 index 42b96af265..0000000000 --- a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.H +++ /dev/null @@ -1,174 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2020 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 . - -Class - Foam::temperatureDependentAlphaContactAngleFvPatchScalarField - -Description - Temperature-dependent alphaContactAngle scalar boundary condition. - - The contact angle is evaluated from the specified Foam::Function1 for the - temperature field looked-up from the mesh database the name of which - may optionally be provided. - -Usage - \table - Property | Description | Required | Default value - T | Temperature field name | no | T - theta0 | Contact angle function | yes | - \endtable - - Example of the boundary condition specification: - \verbatim - - { - type temperatureDependentAlphaContactAngle; - theta0 constant 60; - } - \endverbatim - -See also - Foam::alphaContactAngleFvPatchScalarField - Foam::constantAlphaContactAngleFvPatchScalarField - Foam::Function1 - -SourceFiles - temperatureDependentAlphaContactAngleFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef temperatureDependentAlphaContactAngleFvPatchScalarField_H -#define temperatureDependentAlphaContactAngleFvPatchScalarField_H - -#include "alphaContactAngleFvPatchScalarField.H" -#include "Function1.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class temperatureDependentAlphaContactAngleFvPatch Declaration -\*---------------------------------------------------------------------------*/ - -class temperatureDependentAlphaContactAngleFvPatchScalarField -: - public alphaContactAngleFvPatchScalarField -{ - // Private Data - - //- Name of temperature field, default = "T" - word TName_; - - //- Equilibrium contact angle function - autoPtr> theta0_; - - -public: - - //- Runtime type information - TypeName("temperatureDependentAlphaContactAngle"); - - - // Constructors - - //- Construct from patch and internal field - temperatureDependentAlphaContactAngleFvPatchScalarField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - temperatureDependentAlphaContactAngleFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // temperatureDependentAlphaContactAngleFvPatchScalarField - // onto a new patch - temperatureDependentAlphaContactAngleFvPatchScalarField - ( - const temperatureDependentAlphaContactAngleFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Disallow copy without setting internal field reference - temperatureDependentAlphaContactAngleFvPatchScalarField - ( - const temperatureDependentAlphaContactAngleFvPatchScalarField& - ) = delete; - - //- Copy constructor setting internal field reference - temperatureDependentAlphaContactAngleFvPatchScalarField - ( - const temperatureDependentAlphaContactAngleFvPatchScalarField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new temperatureDependentAlphaContactAngleFvPatchScalarField - ( - *this, - iF - ) - ); - } - - - // Member Functions - - //- Return the equilibrium contact-angle - virtual tmp theta - ( - const fvPatchVectorField& Up, - const fvsPatchVectorField& nHat - ) const; - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C b/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C deleted file mode 100644 index 02e09a30a0..0000000000 --- a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C +++ /dev/null @@ -1,153 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 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 . - -\*---------------------------------------------------------------------------*/ - -#include "timeVaryingAlphaContactAngleFvPatchScalarField.H" -#include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" -#include "volMesh.H" -#include "Time.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::timeVaryingAlphaContactAngleFvPatchScalarField:: -timeVaryingAlphaContactAngleFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - alphaContactAngleFvPatchScalarField(p, iF), - t0_(0.0), - thetaT0_(0.0), - te_(0.0), - thetaTe_(0.0) -{} - - -Foam::timeVaryingAlphaContactAngleFvPatchScalarField:: -timeVaryingAlphaContactAngleFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - alphaContactAngleFvPatchScalarField(p, iF, dict), - t0_(dict.lookup("t0")), - thetaT0_(dict.lookup("thetaT0")), - te_(dict.lookup("te")), - thetaTe_(dict.lookup("thetaTe")) -{ - evaluate(); -} - - -Foam::timeVaryingAlphaContactAngleFvPatchScalarField:: -timeVaryingAlphaContactAngleFvPatchScalarField -( - const timeVaryingAlphaContactAngleFvPatchScalarField& gcpsf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - alphaContactAngleFvPatchScalarField(gcpsf, p, iF, mapper), - t0_(gcpsf.t0_), - thetaT0_(gcpsf.thetaT0_), - te_(gcpsf.te_), - thetaTe_(gcpsf.te_) -{} - - -Foam::timeVaryingAlphaContactAngleFvPatchScalarField:: -timeVaryingAlphaContactAngleFvPatchScalarField -( - const timeVaryingAlphaContactAngleFvPatchScalarField& gcpsf, - const DimensionedField& iF -) -: - alphaContactAngleFvPatchScalarField(gcpsf, iF), - t0_(gcpsf.t0_), - thetaT0_(gcpsf.thetaT0_), - te_(gcpsf.te_), - thetaTe_(gcpsf.thetaTe_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::tmp -Foam::timeVaryingAlphaContactAngleFvPatchScalarField::theta -( - const fvPatchVectorField&, - const fvsPatchVectorField& -) const -{ - scalar t = patch().boundaryMesh().mesh().time().userTimeValue(); - scalar theta0 = thetaT0_; - - if (t < t0_) - { - theta0 = thetaT0_; - } - else if (t > te_) - { - theta0 = thetaTe_; - } - else - { - theta0 = thetaT0_ + (t - t0_)*(thetaTe_ - thetaT0_)/(te_ - t0_); - } - - return tmp(new scalarField(size(), theta0)); -} - - -void Foam::timeVaryingAlphaContactAngleFvPatchScalarField::write -( - Ostream& os -) const -{ - alphaContactAngleFvPatchScalarField::write(os); - writeEntry(os, "t0", t0_); - writeEntry(os, "thetaT0", thetaT0_); - writeEntry(os, "te", te_); - writeEntry(os, "thetaTe", thetaTe_); - writeEntry(os, "value", *this); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - makePatchTypeField - ( - fvPatchScalarField, - timeVaryingAlphaContactAngleFvPatchScalarField - ); -} - -// ************************************************************************* // diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.H b/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.H deleted file mode 100644 index 99eebf4908..0000000000 --- a/src/twoPhaseModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.H +++ /dev/null @@ -1,138 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 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 . - -Class - Foam::timeVaryingAlphaContactAngleFvPatchScalarField - -Description - A time-varying alphaContactAngle scalar boundary condition - (alphaContactAngleFvPatchScalarField) - -SourceFiles - timeVaryingAlphaContactAngleFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef timeVaryingAlphaContactAngleFvPatchScalarField_H -#define timeVaryingAlphaContactAngleFvPatchScalarField_H - -#include "alphaContactAngleFvPatchScalarField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class timeVaryingAlphaContactAngleFvPatch Declaration -\*---------------------------------------------------------------------------*/ - -class timeVaryingAlphaContactAngleFvPatchScalarField -: - public alphaContactAngleFvPatchScalarField -{ - // Private Data - - // Equilibrium contact angle control parameters - scalar t0_; - scalar thetaT0_; - scalar te_; - scalar thetaTe_; - - -public: - - //- Runtime type information - TypeName("timeVaryingAlphaContactAngle"); - - - // Constructors - - //- Construct from patch and internal field - timeVaryingAlphaContactAngleFvPatchScalarField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - timeVaryingAlphaContactAngleFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // timeVaryingAlphaContactAngleFvPatchScalarField onto a new patch - timeVaryingAlphaContactAngleFvPatchScalarField - ( - const timeVaryingAlphaContactAngleFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Construct as copy setting internal field reference - timeVaryingAlphaContactAngleFvPatchScalarField - ( - const timeVaryingAlphaContactAngleFvPatchScalarField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new timeVaryingAlphaContactAngleFvPatchScalarField(*this, iF) - ); - } - - - // Member Functions - - //- Evaluate and return the time-varying equilibrium contact-angle - virtual tmp theta - ( - const fvPatchVectorField& Up, - const fvsPatchVectorField& nHat - ) const; - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* //