alphatPhaseChangeWallFunctions: Clean up

The fixedDmdt phase change boundary condition has been removed as this
is not a physical model and was only ever needed for testing.

The phase change wall function interface has been simplified and made a
mix-in, rather than a derivation from a fixed value patch field. This
reduces forwarding and mapping code and permits wall functions to derive
from patch fields other than fixed value.

Minor style and consisteny improvements have been made to the wall
boiling wall function.
This commit is contained in:
Will Bainbridge
2023-01-13 12:13:38 +00:00
parent f6342ac8dd
commit ec7afd8386
10 changed files with 745 additions and 1202 deletions

View File

@ -20,8 +20,7 @@ derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFreq
derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.C
derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/KocamustafaogullariIshiiDepartureFrequency/KocamustafaogullariIshiiDepartureFrequency.C
derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C
derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C
derivedFvPatchFields/alphatPhaseChangeWallFunctionBase/alphatPhaseChangeWallFunctionBase.C
derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C
derivedFvPatchFields/fixedMultiphaseHeatFlux/fixedMultiphaseHeatFluxFvPatchScalarField.C
derivedFvPatchFields/coupledMultiphaseTemperature/coupledMultiphaseTemperatureFvPatchScalarField.C

View File

@ -1,145 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H"
#include "alphatJayatillekeWallFunctionFvPatchScalarField.H"
#include "fluidThermophysicalTransportModel.H"
#include "fvPatchFieldMapper.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF),
fixedDmdtf_(0)
{}
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF, dict),
fixedDmdtf_(dict.lookupOrDefault<scalar>("fixedDmdtf", 0))
{}
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
(
const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& psf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
alphatPhaseChangeWallFunctionFvPatchScalarField(psf, p, iF, mapper),
fixedDmdtf_(psf.fixedDmdtf_)
{}
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
(
const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& psf,
const DimensionedField<scalar, volMesh>& iF
)
:
alphatPhaseChangeWallFunctionFvPatchScalarField(psf, iF),
fixedDmdtf_(psf.fixedDmdtf_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
dmdtf_ = (1 - relax_)*dmdtf_ + relax_*fixedDmdtf_;
operator==
(
alphatJayatillekeWallFunctionFvPatchScalarField::alphat
(
db().lookupType<fluidThermophysicalTransportModel>
(
internalField().group()
),
0.85,
patch().index()
)
);
fixedValueFvPatchScalarField::updateCoeffs();
}
void alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
alphatPhaseChangeWallFunctionFvPatchScalarField::write(os);
writeEntry(os, "fixedDmdtf", fixedDmdtf_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,154 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-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 <http://www.gnu.org/licenses/>.
Class
Foam::compressible::
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
Description
A simple alphatPhaseChangeWallFunctionFvPatchScalarField with
a fixed volumetric phase-change mass flux.
See also
Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField
SourceFiles
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField_H
#define alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField_H
#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
/*---------------------------------------------------------------------------*\
Class alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
:
public alphatPhaseChangeWallFunctionFvPatchScalarField
{
// Private Data
//- Volumetric phase-change mass flux in near wall cells
scalar fixedDmdtf_;
public:
//- Runtime type information
TypeName("compressible::alphatFixedDmdtfWallBoilingWallFunction");
// Constructors
//- Construct from patch and internal field
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
// onto a new patch
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
(
const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Disallow copy without setting internal field reference
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
(
const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField&
) = delete;
//- Copy constructor setting internal field reference
alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
(
const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField
(
*this,
iF
)
);
}
// Member Functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,216 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "phaseInterface.H"
#include "phaseSystem.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(alphatPhaseChangeWallFunctionFvPatchScalarField, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphatPhaseChangeWallFunctionFvPatchScalarField::
alphatPhaseChangeWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
otherPhaseName_(word::null),
relax_(1),
dmdtf_(p.size(), 0)
{}
alphatPhaseChangeWallFunctionFvPatchScalarField::
alphatPhaseChangeWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
otherPhaseName_(dict.lookup("otherPhase")),
relax_(dict.lookupOrDefault<scalar>("relax", 1)),
dmdtf_(p.size(), 0)
{
// Check that otherPhaseName != this phase
if (internalField().group() == otherPhaseName_)
{
FatalErrorInFunction
<< "otherPhase should be the name of the vapor phase that "
<< "corresponds to the liquid base or vice versa" << nl
<< "This phase: " << internalField().group() << nl
<< "otherPhase: " << otherPhaseName_
<< abort(FatalError);
}
if (dict.found("dmdtf"))
{
dmdtf_ = scalarField("dmdtf", dict, p.size());
}
}
alphatPhaseChangeWallFunctionFvPatchScalarField::
alphatPhaseChangeWallFunctionFvPatchScalarField
(
const alphatPhaseChangeWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
otherPhaseName_(ptf.otherPhaseName_),
relax_(ptf.relax_),
dmdtf_(mapper(ptf.dmdtf_))
{}
alphatPhaseChangeWallFunctionFvPatchScalarField::
alphatPhaseChangeWallFunctionFvPatchScalarField
(
const alphatPhaseChangeWallFunctionFvPatchScalarField& awfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(awfpsf, iF),
otherPhaseName_(awfpsf.otherPhaseName_),
relax_(awfpsf.relax_),
dmdtf_(awfpsf.dmdtf_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool alphatPhaseChangeWallFunctionFvPatchScalarField::activeInterface
(
const phaseInterface& interface
) const
{
const phaseSystem& fluid = interface.fluid();
return
interface.contains(fluid.phases()[internalField().group()])
&& interface.contains(fluid.phases()[otherPhaseName_]);
}
const scalarField&
alphatPhaseChangeWallFunctionFvPatchScalarField::dmdtf() const
{
return dmdtf_;
}
const scalarField& alphatPhaseChangeWallFunctionFvPatchScalarField::dmdtf
(
const phaseInterface& interface
) const
{
if (!activeInterface(interface))
{
FatalErrorInFunction
<< "Phase change mass transfer rate requested for interface on "
<< "which there is no phase change "
<< abort(FatalError);
}
return dmdtf_;
}
void alphatPhaseChangeWallFunctionFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
fixedValueFvPatchScalarField::autoMap(m);
m(dmdtf_, dmdtf_);
}
void alphatPhaseChangeWallFunctionFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
)
{
fixedValueFvPatchScalarField::rmap(ptf, addr);
const alphatPhaseChangeWallFunctionFvPatchScalarField& tiptf =
refCast<const alphatPhaseChangeWallFunctionFvPatchScalarField>(ptf);
dmdtf_.rmap(tiptf.dmdtf_, addr);
}
void alphatPhaseChangeWallFunctionFvPatchScalarField::reset
(
const fvPatchScalarField& ptf
)
{
fixedValueFvPatchScalarField::reset(ptf);
const alphatPhaseChangeWallFunctionFvPatchScalarField& tiptf =
refCast<const alphatPhaseChangeWallFunctionFvPatchScalarField>(ptf);
dmdtf_.reset(tiptf.dmdtf_);
}
void alphatPhaseChangeWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fixedValueFvPatchScalarField::write(os);
writeEntry(os, "otherPhase", otherPhaseName_);
writeEntry(os, "relax", relax_);
writeEntry(os, "dmdtf", dmdtf_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,169 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-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 <http://www.gnu.org/licenses/>.
Class
Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField
Description
Abstract base-class for all alphatWallFunctions supporting phase-change.
SourceFiles
alphatPhaseChangeWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef alphatPhaseChangeWallFunctionFvPatchScalarField_H
#define alphatPhaseChangeWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class phaseInterface;
namespace compressible
{
/*---------------------------------------------------------------------------*\
Class alphatPhaseChangeWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class alphatPhaseChangeWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
protected:
// Protected data
//- Name of the other phase
const word otherPhaseName_;
//- Relaxation factor
const scalar relax_;
//- Rate of phase-change
scalarField dmdtf_;
public:
//- Runtime type information
TypeName("compressible::alphatPhaseChangeWallFunction");
// Constructors
//- Construct from patch and internal field
alphatPhaseChangeWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
alphatPhaseChangeWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// alphatPhaseChangeWallFunctionFvPatchScalarField
// onto a new patch
alphatPhaseChangeWallFunctionFvPatchScalarField
(
const alphatPhaseChangeWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Disallow copy without setting internal field reference
alphatPhaseChangeWallFunctionFvPatchScalarField
(
const alphatPhaseChangeWallFunctionFvPatchScalarField&
) = delete;
//- Copy constructor setting internal field reference
alphatPhaseChangeWallFunctionFvPatchScalarField
(
const alphatPhaseChangeWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
// Member Functions
//- Is there phase change mass transfer for this interface?
bool activeInterface(const phaseInterface&) const;
//- Return the rate of phase-change
const scalarField& dmdtf() const;
//- Return the rate of phase-change for an interface
const scalarField& dmdtf(const phaseInterface&) const;
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
// Used to update fields following mesh topology change
virtual void autoMap(const fvPatchFieldMapper&);
//- Reverse map the given fvPatchField onto this fvPatchField
// Used to reconstruct fields
virtual void rmap(const fvPatchScalarField&, const labelList&);
//- Reset the fvPatchField to the given fvPatchField
// Used for mesh to mesh mapping
virtual void reset(const fvPatchScalarField&);
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs() = 0;
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "alphatPhaseChangeWallFunctionBase.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "phaseInterface.H"
#include "phaseSystem.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(alphatPhaseChangeWallFunctionBase, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphatPhaseChangeWallFunctionBase::alphatPhaseChangeWallFunctionBase()
:
phaseName_(word::null),
otherPhaseName_(word::null)
{}
alphatPhaseChangeWallFunctionBase::alphatPhaseChangeWallFunctionBase
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
phaseName_(iF.group()),
otherPhaseName_(dict.lookup("otherPhase"))
{
if (phaseName_== otherPhaseName_)
{
FatalErrorInFunction
<< "otherPhase should be the name of the vapor phase that "
<< "corresponds to the liquid base or vice versa" << nl
<< "This phase: " << phaseName_ << nl
<< "otherPhase: " << otherPhaseName_
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
alphatPhaseChangeWallFunctionBase::~alphatPhaseChangeWallFunctionBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool alphatPhaseChangeWallFunctionBase::activeInterface
(
const phaseInterface& interface
) const
{
const phaseSystem& fluid = interface.fluid();
return
interface.contains(fluid.phases()[phaseName_])
&& interface.contains(fluid.phases()[otherPhaseName_]);
}
const scalarField& alphatPhaseChangeWallFunctionBase::dmdtf
(
const phaseInterface& interface
) const
{
if (!activeInterface(interface))
{
FatalErrorInFunction
<< "Phase change mass transfer rate requested for interface on "
<< "which there is no phase change "
<< abort(FatalError);
}
return dmdtf();
}
void alphatPhaseChangeWallFunctionBase::write(Ostream& os) const
{
writeEntry(os, "otherPhase", otherPhaseName_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-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 <http://www.gnu.org/licenses/>.
Class
Foam::compressible::alphatPhaseChangeWallFunctionBase
Description
Abstract base-class for all alphatWallFunctions supporting phase-change.
SourceFiles
alphatPhaseChangeWallFunctionBase.C
\*---------------------------------------------------------------------------*/
#ifndef alphatPhaseChangeWallFunctionBase_H
#define alphatPhaseChangeWallFunctionBase_H
#include "fvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class phaseInterface;
namespace compressible
{
/*---------------------------------------------------------------------------*\
Class alphatPhaseChangeWallFunctionBase Declaration
\*---------------------------------------------------------------------------*/
class alphatPhaseChangeWallFunctionBase
{
protected:
// Protected data
//- Name of the phase
const word phaseName_;
//- Name of the other phase
const word otherPhaseName_;
public:
//- Runtime type information
TypeName("compressible::alphatPhaseChangeWallFunctionBase");
// Constructors
//- Construct null
alphatPhaseChangeWallFunctionBase();
//- Construct from a patch, an internal field and a dictionary
alphatPhaseChangeWallFunctionBase
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary&
);
// Destructor
virtual ~alphatPhaseChangeWallFunctionBase();
// Member Functions
//- Is there phase change mass transfer for this interface?
bool activeInterface(const phaseInterface&) const;
//- Return the rate of phase-change
virtual const scalarField& dmdtf() const = 0;
//- Return the rate of phase-change for the given interface
const scalarField& dmdtf(const phaseInterface&) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -128,7 +128,8 @@ SourceFiles
#ifndef compressible_alphatWallBoilingWallFunctionFvPatchScalarField_H
#define compressible_alphatWallBoilingWallFunctionFvPatchScalarField_H
#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H"
#include "alphatPhaseChangeWallFunctionBase.H"
#include "fixedValueFvPatchFields.H"
#include "partitioningModel.H"
#include "nucleationSiteModel.H"
#include "departureDiameterModel.H"
@ -147,7 +148,8 @@ namespace compressible
class alphatWallBoilingWallFunctionFvPatchScalarField
:
public alphatPhaseChangeWallFunctionFvPatchScalarField
public fixedValueFvPatchScalarField,
public alphatPhaseChangeWallFunctionBase
{
public:
@ -168,57 +170,65 @@ private:
// Private Data
//- Heat source type
phaseType phaseType_;
// Controls
//- Estimate liquid temperature using logarithmic wall function?
Switch useLiquidTemperatureWallFunction_;
//- Heat source type
phaseType phaseType_;
//- Turbulent Prandtl number
scalar Prt_;
//- Estimate liquid temperature using logarithmic wall function?
Switch useLiquidTemperatureWallFunction_;
//- Patch face area by cell volume
scalarField AbyV_;
//- Relaxation factor
scalar relax_;
//- Convective turbulent thermal diffusivity
scalarField alphatConv_;
//- Turbulent Prandtl number
scalar Prt_;
//- Departure diameter
scalarField dDep_;
//- Bubble waiting time ratio
scalar tau_;
//- Departure frequency
scalarField fDep_;
//- Nucleation site density
scalarField N_;
// Sub-Models
//- Wall liquid fraction
scalarField fLiquid_;
//- Heat flux partitioning model
autoPtr<wallBoilingModels::partitioningModel>
partitioningModel_;
//- Quenching surface heat flux
scalarField qq_;
//- Nucleation site density model
autoPtr<wallBoilingModels::nucleationSiteModel>
nucleationSiteModel_;
//- Evaporative surface heat flux
scalarField qe_;
//- Bubble departure diameter model
autoPtr<wallBoilingModels::departureDiameterModel>
departureDiameterModel_;
//- Bubble waiting time ratio
scalar tau_;
//- Bubble departure frequency model
autoPtr<wallBoilingModels::departureFrequencyModel>
departureFrequencyModel_;
//- Run-time selected heat flux partitioning model
autoPtr<wallBoilingModels::partitioningModel>
partitioningModel_;
//- Run-time selected nucleation site density model
autoPtr<wallBoilingModels::nucleationSiteModel>
nucleationSiteModel_;
// State
//- Run-time selected bubble departure diameter model
autoPtr<wallBoilingModels::departureDiameterModel>
departureDiamModel_;
//- Wall liquid fraction
scalarField fLiquid_;
//- Run-time selected bubble departure frequency model
autoPtr<wallBoilingModels::departureFrequencyModel>
departureFreqModel_;
//- Departure diameter
scalarField dDep_;
//- Departure frequency
scalarField fDep_;
//- Nucleation site density
scalarField N_;
//- Quenching surface heat flux
scalarField qq_;
//- Evaporative surface heat flux
scalarField qe_;
//- Mass transfer rate
scalarField dmdtf_;
public:
@ -283,6 +293,12 @@ public:
// Member Functions
//- Return the wall liquid fraction field [-]
const scalarField& wetFraction() const
{
return fLiquid_;
}
//- Return the departure diameter field [m]
const scalarField& dDeparture() const
{
@ -301,12 +317,6 @@ public:
return N_;
}
//- Return the wall liquid fraction field [-]
const scalarField& wetFraction() const
{
return fLiquid_;
}
//- Return the quenching surface heat flux field [W/m^2]
const scalarField& qQuenching() const
{
@ -319,6 +329,12 @@ public:
return qe_;
}
//- Return the rate of phase change
virtual const scalarField& dmdtf() const
{
return dmdtf_;
}
// Mapping functions

View File

@ -25,7 +25,7 @@ License
#include "ThermalPhaseChangePhaseSystem.H"
#include "heatTransferModel.H"
#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H"
#include "alphatPhaseChangeWallFunctionBase.H"
#include "fvcVolumeIntegrate.H"
#include "fvmSup.H"
#include "rhoMulticomponentThermo.H"
@ -513,9 +513,6 @@ template<class BasePhaseSystem>
void
Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctInterfaceThermo()
{
typedef compressible::alphatPhaseChangeWallFunctionFvPatchScalarField
alphatPhaseChangeWallFunction;
forAllConstIter
(
saturationModelTable,
@ -627,8 +624,9 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctInterfaceThermo()
// Nucleation mass transfer update
{
volScalarField& nDmdtf(*this->nDmdtfs_[interface]);
typedef compressible::alphatPhaseChangeWallFunctionBase alphatwType;
volScalarField& nDmdtf(*this->nDmdtfs_[interface]);
nDmdtf = Zero;
bool wallBoilingActive = false;
@ -640,43 +638,36 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctInterfaceThermo()
const word alphatName =
IOobject::groupName("alphat", phase.name());
if (phase.mesh().foundObject<volScalarField>(alphatName))
if (!phase.mesh().foundObject<volScalarField>(alphatName))
continue;
const volScalarField& alphat =
phase.mesh().lookupObject<volScalarField>(alphatName);
forAll(alphat.boundaryField(), patchi)
{
const volScalarField& alphat =
phase.mesh().lookupObject<volScalarField>(alphatName);
const fvPatchScalarField& alphatp =
alphat.boundaryField()[patchi];
forAll(alphat.boundaryField(), patchi)
{
const fvPatchScalarField& alphatp =
alphat.boundaryField()[patchi];
if (!isA<alphatwType>(alphatp)) continue;
if (isA<alphatPhaseChangeWallFunction>(alphatp))
{
const alphatPhaseChangeWallFunction& alphatw =
refCast<const alphatPhaseChangeWallFunction>
(
alphatp
);
const alphatwType& alphatw =
refCast<const alphatwType>(alphatp);
if (alphatw.activeInterface(interface))
{
wallBoilingActive = true;
if (!alphatw.activeInterface(interface)) continue;
const scalarField& patchDmdtf =
alphatw.dmdtf(interface);
wallBoilingActive = true;
const scalar sign =
interfaceIter.index() == 0 ? +1 : -1;
UIndirectList<scalar> nDmdtfp
(
nDmdtf.primitiveFieldRef(),
alphatp.patch().faceCells()
);
forAll(patchDmdtf, facei)
{
const label celli =
alphatw.patch().faceCells()[facei];
nDmdtf[celli] -= sign*patchDmdtf[facei];
}
}
}
}
nDmdtfp =
scalarField(nDmdtfp)
- (interfaceIter.index() == 0 ? +1 : -1)
*alphatw.dmdtf(interface);
}
}