cavitation.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "cavitation.H"
27 #include "phaseSystem.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace phaseTransferModels
36 {
39  (
41  cavitation,
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
51 (
52  const dictionary& dict,
53  const phaseInterface& interface
54 )
55 :
56  phaseTransferModel(dict, interface),
57  interface_(interface),
58  cavitation_(compressible::cavitationModel::New(dict, interface_))
59 {}
60 
61 
62 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
63 
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
71 {
72  return true;
73 }
74 
75 
78 {
79  tmp<volScalarField> tResult =
81  (
82  IOobject::groupName(typedName("dmdtf"), interface_.name()),
83  interface_.mesh(),
86  );
87 
88  const Pair<tmp<volScalarField::Internal>> coeffs(cavitation_->mDot12P());
89 
90  const volScalarField::Internal& p = interface_.phase1().fluidThermo().p();
91  const volScalarField::Internal pSat1(cavitation_->pSat1());
92  const volScalarField::Internal pSat2(cavitation_->pSat2());
93 
94  tResult.ref().internalFieldRef() =
95  coeffs[0]*(p - pSat1) - coeffs[1]*(p - pSat2);
96  tResult.ref().correctBoundaryConditions();
97 
98  return tResult;
99 }
100 
101 
104 {
105  tmp<volScalarField> tResult =
107  (
108  IOobject::groupName(typedName("d2mdtdpf"), interface_.name()),
109  interface_.mesh(),
112  );
113 
114  const Pair<tmp<volScalarField::Internal>> coeffs(cavitation_->mDot12P());
115 
116  tResult.ref().internalFieldRef() = coeffs[0] - coeffs[1];
117  tResult.ref().correctBoundaryConditions();
118 
119  return tResult;
120 }
121 
122 
123 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, const Internal &, const PtrList< PatchField< Type >> &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
static word groupName(Name name, const word &group)
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:65
Abstract base class for cavitation models.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Class to represent an interface between phases. Derivations can further specify the configuration of ...
A phase transfer model which represents cavitation.
Definition: cavitation.H:81
virtual bool mixture() const
Whether or not there is a mass transfer rate for the mixture.
Definition: cavitation.C:70
virtual ~cavitation()
Destructor.
Definition: cavitation.C:64
virtual tmp< volScalarField > d2mdtdpf() const
The derivative of mass transfer w.r.t. pressure.
Definition: cavitation.C:103
virtual tmp< volScalarField > dmdtf() const
The mass transfer rate for the mixture.
Definition: cavitation.C:77
cavitation(const dictionary &dict, const phaseInterface &interface)
Construct from components.
Definition: cavitation.C:51
A class for managing temporary objects.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
This boundary condition applies a zero-gradient condition from the patch internal field onto the patc...
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
defineTypeNameAndDebug(cavitation, 0)
addToRunTimeSelectionTable(phaseTransferModel, cavitation, dictionary)
Namespace for OpenFOAM.
const dimensionSet dimPressure
const dimensionSet dimTime
const dimensionSet dimDensity
word typedName(Name name)
Return the name of the object within the given type.
Definition: typeInfo.H:176
dictionary dict
volScalarField & p