mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -0,0 +1,5 @@
|
||||
derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C
|
||||
chtMultiRegionSimpleFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/chtMultiRegionSimpleFoam
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
EXE_INC = \
|
||||
/* -DFULLDEBUG -O0 -g */ \
|
||||
-Ifluid \
|
||||
-Isolid \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-lcompressibleRASModels
|
||||
@ -0,0 +1,99 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
chtMultiRegionSimpleFoam
|
||||
|
||||
Description
|
||||
Steady-state version of chtMultiRegionFoam
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "basicPsiThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
#include "regionProperties.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
regionProperties rp(runTime);
|
||||
|
||||
#include "createFluidMeshes.H"
|
||||
#include "createSolidMeshes.H"
|
||||
|
||||
#include "createFluidFields.H"
|
||||
#include "createSolidFields.H"
|
||||
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
forAll(fluidRegions, i)
|
||||
{
|
||||
Info<< "\nSolving for fluid region "
|
||||
<< fluidRegions[i].name() << endl;
|
||||
#include "setRegionFluidFields.H"
|
||||
#include "readFluidMultiRegionSIMPLEControls.H"
|
||||
#include "initConvergenceCheck.H"
|
||||
#include "solveFluid.H"
|
||||
#include "convergenceCheck.H"
|
||||
}
|
||||
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
Info<< "\nSolving for solid region "
|
||||
<< solidRegions[i].name() << endl;
|
||||
#include "setRegionSolidFields.H"
|
||||
#include "readSolidMultiRegionSIMPLEControls.H"
|
||||
#include "initConvergenceCheck.H"
|
||||
#include "solveSolid.H"
|
||||
#include "convergenceCheck.H"
|
||||
}
|
||||
|
||||
runTime++;
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,168 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "solidWallHeatFluxTemperatureFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
q_(p.size(), 0.0),
|
||||
KName_("undefined-K")
|
||||
{}
|
||||
|
||||
|
||||
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const solidWallHeatFluxTemperatureFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
q_(ptf.q_, mapper),
|
||||
KName_(ptf.KName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
q_("q", dict, p.size()),
|
||||
KName_(dict.lookup("K"))
|
||||
{}
|
||||
|
||||
|
||||
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const solidWallHeatFluxTemperatureFvPatchScalarField& tppsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf),
|
||||
q_(tppsf.q_),
|
||||
KName_(tppsf.KName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const solidWallHeatFluxTemperatureFvPatchScalarField& tppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf, iF),
|
||||
q_(tppsf.q_),
|
||||
KName_(tppsf.KName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::autoMap(m);
|
||||
q_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::rmap
|
||||
(
|
||||
const fvPatchScalarField& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||
|
||||
const solidWallHeatFluxTemperatureFvPatchScalarField& hfptf =
|
||||
refCast<const solidWallHeatFluxTemperatureFvPatchScalarField>(ptf);
|
||||
|
||||
q_.rmap(hfptf.q_, addr);
|
||||
}
|
||||
|
||||
|
||||
void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const scalarField& Kw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(KName_);
|
||||
|
||||
const fvPatchScalarField& Tw = *this;
|
||||
|
||||
operator==(q_/(patch().deltaCoeffs()*Kw) + Tw.patchInternalField());
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fixedValueFvPatchScalarField::write(os);
|
||||
q_.writeEntry("q", os);
|
||||
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,181 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
|
||||
Description
|
||||
Heat flux boundary condition for temperature on solid region
|
||||
|
||||
Example usage:
|
||||
myWallPatch
|
||||
{
|
||||
type solidWallHeatFluxTemperature;
|
||||
K K; // Name of K field
|
||||
q uniform 1000; // Heat flux / [W/m2]
|
||||
value 300.0; // Initial temperature / [K]
|
||||
}
|
||||
|
||||
|
||||
SourceFiles
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef solidWallHeatFluxTemperatureFvPatchScalarField_H
|
||||
#define solidWallHeatFluxTemperatureFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class solidWallHeatFluxTemperatureFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Heat flux / [W/m2]
|
||||
scalarField q_;
|
||||
|
||||
//- Name of thermal conductivity field
|
||||
word KName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("solidWallHeatFluxTemperature");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
// onto a new patch
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const solidWallHeatFluxTemperatureFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const solidWallHeatFluxTemperatureFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new solidWallHeatFluxTemperatureFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
solidWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const solidWallHeatFluxTemperatureFvPatchScalarField&,
|
||||
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 solidWallHeatFluxTemperatureFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchScalarField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,22 @@
|
||||
// Solve the Momentum equation
|
||||
tmp<fvVectorMatrix> UEqn
|
||||
(
|
||||
fvm::div(phi, U)
|
||||
- fvm::Sp(fvc::div(phi), U)
|
||||
+ turb.divDevRhoReff(U)
|
||||
);
|
||||
|
||||
UEqn().relax();
|
||||
|
||||
eqnResidual = solve
|
||||
(
|
||||
UEqn()
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
||||
- fvc::snGrad(p)*mesh.magSf()
|
||||
)
|
||||
).initialResidual();
|
||||
|
||||
maxResidual = max(eqnResidual, maxResidual);
|
||||
@ -0,0 +1,21 @@
|
||||
{
|
||||
dimensionedScalar totalMass = fvc::domainIntegrate(rho);
|
||||
|
||||
scalar sumLocalContErr =
|
||||
(
|
||||
fvc::domainIntegrate(mag(rho - thermo.rho()))/totalMass
|
||||
).value();
|
||||
|
||||
scalar globalContErr =
|
||||
(
|
||||
fvc::domainIntegrate(rho - thermo.rho())/totalMass
|
||||
).value();
|
||||
|
||||
cumulativeContErr[i] += globalContErr;
|
||||
|
||||
Info<< "time step continuity errors (" << mesh.name() << ")"
|
||||
<< ": sum local = " << sumLocalContErr
|
||||
<< ", global = " << globalContErr
|
||||
<< ", cumulative = " << cumulativeContErr[i]
|
||||
<< endl;
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "fvc.H"
|
||||
|
||||
Foam::scalar Foam::compressibleCourantNo
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const Time& runTime,
|
||||
const volScalarField& rho,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
{
|
||||
scalar CoNum = 0.0;
|
||||
scalar meanCoNum = 0.0;
|
||||
|
||||
//- Can have fluid domains with 0 cells so do not test.
|
||||
//if (mesh.nInternalFaces())
|
||||
{
|
||||
surfaceScalarField SfUfbyDelta =
|
||||
mesh.surfaceInterpolation::deltaCoeffs()
|
||||
* mag(phi)
|
||||
/ fvc::interpolate(rho);
|
||||
|
||||
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||
.value()*runTime.deltaT().value();
|
||||
|
||||
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||
.value()*runTime.deltaT().value();
|
||||
}
|
||||
|
||||
Info<< "Region: " << mesh.name() << " Courant Number mean: " << meanCoNum
|
||||
<< " max: " << CoNum << endl;
|
||||
|
||||
return CoNum;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
Calculates and outputs the mean and maximum Courant Numbers for the fluid
|
||||
regions
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef compressibleCourantNo_H
|
||||
#define compressibleCourantNo_H
|
||||
|
||||
#include "fvMesh.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
scalar compressibleCourantNo
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const Time& runTime,
|
||||
const volScalarField& rho,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,15 @@
|
||||
scalar CoNum = -GREAT;
|
||||
forAll(fluidRegions, regionI)
|
||||
{
|
||||
CoNum = max
|
||||
(
|
||||
compressibleCourantNo
|
||||
(
|
||||
fluidRegions[regionI],
|
||||
runTime,
|
||||
rhoFluid[regionI],
|
||||
phiFluid[regionI]
|
||||
),
|
||||
CoNum
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
// check convergence
|
||||
Info<< "maxResidual: " << maxResidual
|
||||
<< " convergence criterion: " << convergenceCriterion
|
||||
<< endl;
|
||||
|
||||
if (maxResidual < convergenceCriterion)
|
||||
{
|
||||
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
|
||||
runTime.writeAndEnd();
|
||||
Info<< "latestTime = " << runTime.timeName() << endl;
|
||||
}
|
||||
|
||||
@ -0,0 +1,144 @@
|
||||
// Initialise fluid field pointer lists
|
||||
PtrList<basicPsiThermo> thermoFluid(fluidRegions.size());
|
||||
PtrList<volScalarField> rhoFluid(fluidRegions.size());
|
||||
PtrList<volScalarField> KFluid(fluidRegions.size());
|
||||
PtrList<volVectorField> UFluid(fluidRegions.size());
|
||||
PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
|
||||
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
|
||||
PtrList<compressible::turbulenceModel> turbulence(fluidRegions.size());
|
||||
PtrList<volScalarField> DpDtf(fluidRegions.size());
|
||||
|
||||
List<scalar> initialMassFluid(fluidRegions.size());
|
||||
List<label> pRefCellFluid(fluidRegions.size(),0);
|
||||
List<scalar> pRefValueFluid(fluidRegions.size(),0.0);
|
||||
|
||||
|
||||
// Populate fluid field pointer lists
|
||||
forAll(fluidRegions, i)
|
||||
{
|
||||
Info<< "*** Reading fluid mesh thermophysical properties for region "
|
||||
<< fluidRegions[i].name() << nl << endl;
|
||||
|
||||
Info<< " Adding to thermoFluid\n" << endl;
|
||||
|
||||
thermoFluid.set
|
||||
(
|
||||
i,
|
||||
basicPsiThermo::New(fluidRegions[i]).ptr()
|
||||
);
|
||||
|
||||
Info<< " Adding to rhoFluid\n" << endl;
|
||||
rhoFluid.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
fluidRegions[i],
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermoFluid[i].rho()
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to KFluid\n" << endl;
|
||||
KFluid.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"K",
|
||||
runTime.timeName(),
|
||||
fluidRegions[i],
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
thermoFluid[i].Cp()*thermoFluid[i].alpha()
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to UFluid\n" << endl;
|
||||
UFluid.set
|
||||
(
|
||||
i,
|
||||
new volVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
fluidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fluidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to phiFluid\n" << endl;
|
||||
phiFluid.set
|
||||
(
|
||||
i,
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
fluidRegions[i],
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(rhoFluid[i]*UFluid[i])
|
||||
& fluidRegions[i].Sf()
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to gFluid\n" << endl;
|
||||
gFluid.set
|
||||
(
|
||||
i,
|
||||
new uniformDimensionedVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"g",
|
||||
runTime.constant(),
|
||||
fluidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to turbulence\n" << endl;
|
||||
turbulence.set
|
||||
(
|
||||
i,
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rhoFluid[i],
|
||||
UFluid[i],
|
||||
phiFluid[i],
|
||||
thermoFluid[i]
|
||||
).ptr()
|
||||
);
|
||||
|
||||
initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
|
||||
|
||||
setRefCell
|
||||
(
|
||||
thermoFluid[i].p(),
|
||||
fluidRegions[i].solutionDict().subDict("SIMPLE"),
|
||||
pRefCellFluid[i],
|
||||
pRefValueFluid[i]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
PtrList<fvMesh> fluidRegions(rp.fluidRegionNames().size());
|
||||
|
||||
forAll(rp.fluidRegionNames(), i)
|
||||
{
|
||||
Info<< "Create fluid mesh for region " << rp.fluidRegionNames()[i]
|
||||
<< " for time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
fluidRegions.set
|
||||
(
|
||||
i,
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
rp.fluidRegionNames()[i],
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
{
|
||||
fvScalarMatrix hEqn
|
||||
(
|
||||
fvm::div(phi, h)
|
||||
- fvm::Sp(fvc::div(phi), h)
|
||||
- fvm::laplacian(turb.alphaEff(), h)
|
||||
==
|
||||
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p))
|
||||
- p*fvc::div(phi/fvc::interpolate(rho))
|
||||
);
|
||||
|
||||
hEqn.relax();
|
||||
|
||||
eqnResidual = hEqn.solve().initialResidual();
|
||||
maxResidual = max(eqnResidual, maxResidual);
|
||||
|
||||
thermo.correct();
|
||||
|
||||
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
|
||||
<< max(thermo.T()).value() << endl;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
// initialize values for convergence checks
|
||||
|
||||
scalar eqnResidual = 1, maxResidual = 0;
|
||||
scalar convergenceCriterion = 0;
|
||||
|
||||
simple.readIfPresent("convergence", convergenceCriterion);
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
{
|
||||
// From buoyantSimpleFoam
|
||||
|
||||
rho = thermo.rho();
|
||||
|
||||
volScalarField rUA = 1.0/UEqn().A();
|
||||
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
|
||||
|
||||
U = rUA*UEqn().H();
|
||||
UEqn.clear();
|
||||
|
||||
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
|
||||
bool closedVolume = adjustPhi(phi, U, p);
|
||||
|
||||
surfaceScalarField buoyancyPhi =
|
||||
rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
|
||||
phi += buoyancyPhi;
|
||||
|
||||
// Solve pressure
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rhorUAf, p) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
// retain the residual from the first iteration
|
||||
if (nonOrth == 0)
|
||||
{
|
||||
eqnResidual = pEqn.solve().initialResidual();
|
||||
maxResidual = max(eqnResidual, maxResidual);
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
// For closed-volume cases adjust the pressure and density levels
|
||||
// to obey overall mass continuity
|
||||
if (closedVolume)
|
||||
{
|
||||
p += (initialMass - fvc::domainIntegrate(psi*p))
|
||||
/fvc::domainIntegrate(psi);
|
||||
}
|
||||
|
||||
// Calculate the conservative fluxes
|
||||
phi -= pEqn.flux();
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
|
||||
// Correct the momentum source with the pressure gradient flux
|
||||
// calculated from the relaxed pressure
|
||||
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rhorUAf);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
rho = thermo.rho();
|
||||
rho.relax();
|
||||
|
||||
Info<< "Min/max rho:" << min(rho).value() << ' '
|
||||
<< max(rho).value() << endl;
|
||||
|
||||
// Update thermal conductivity
|
||||
K = thermo.Cp()*turb.alphaEff();
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
dictionary simple = fluidRegions[i].solutionDict().subDict("SIMPLE");
|
||||
|
||||
int nNonOrthCorr = 0;
|
||||
if (simple.found("nNonOrthogonalCorrectors"))
|
||||
{
|
||||
nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors"));
|
||||
}
|
||||
|
||||
bool momentumPredictor = true;
|
||||
if (simple.found("momentumPredictor"))
|
||||
{
|
||||
momentumPredictor = Switch(simple.lookup("momentumPredictor"));
|
||||
}
|
||||
|
||||
bool fluxGradp = false;
|
||||
if (simple.found("fluxGradp"))
|
||||
{
|
||||
fluxGradp = Switch(simple.lookup("fluxGradp"));
|
||||
}
|
||||
|
||||
bool transonic = false;
|
||||
if (simple.found("transonic"))
|
||||
{
|
||||
transonic = Switch(simple.lookup("transonic"));
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
const fvMesh& mesh = fluidRegions[i];
|
||||
|
||||
basicPsiThermo& thermo = thermoFluid[i];
|
||||
volScalarField& rho = rhoFluid[i];
|
||||
volScalarField& K = KFluid[i];
|
||||
volVectorField& U = UFluid[i];
|
||||
surfaceScalarField& phi = phiFluid[i];
|
||||
const dimensionedVector& g = gFluid[i];
|
||||
|
||||
compressible::turbulenceModel& turb = turbulence[i];
|
||||
|
||||
volScalarField& p = thermo.p();
|
||||
const volScalarField& psi = thermo.psi();
|
||||
volScalarField& h = thermo.h();
|
||||
|
||||
const dimensionedScalar initialMass
|
||||
(
|
||||
"initialMass",
|
||||
dimMass,
|
||||
initialMassFluid[i]
|
||||
);
|
||||
|
||||
const label pRefCell = pRefCellFluid[i];
|
||||
const scalar pRefValue = pRefValueFluid[i];
|
||||
@ -0,0 +1,11 @@
|
||||
// Pressure-velocity SIMPLE corrector
|
||||
|
||||
p.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
{
|
||||
#include "UEqn.H"
|
||||
#include "hEqn.H"
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
turb.correct();
|
||||
@ -0,0 +1,91 @@
|
||||
// Initialise solid field pointer lists
|
||||
PtrList<volScalarField> rhos(solidRegions.size());
|
||||
PtrList<volScalarField> cps(solidRegions.size());
|
||||
PtrList<volScalarField> rhosCps(solidRegions.size());
|
||||
PtrList<volScalarField> Ks(solidRegions.size());
|
||||
PtrList<volScalarField> Ts(solidRegions.size());
|
||||
|
||||
// Populate solid field pointer lists
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
Info<< "*** Reading solid mesh thermophysical properties for region "
|
||||
<< solidRegions[i].name() << nl << endl;
|
||||
|
||||
Info<< " Adding to rhos\n" << endl;
|
||||
rhos.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to cps\n" << endl;
|
||||
cps.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cp",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
rhosCps.set
|
||||
(
|
||||
i,
|
||||
new volScalarField("rhosCps", rhos[i]*cps[i])
|
||||
);
|
||||
|
||||
Info<< " Adding to Ks\n" << endl;
|
||||
Ks.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"K",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to Ts\n" << endl;
|
||||
Ts.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
solidRegions[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
PtrList<fvMesh> solidRegions(rp.solidRegionNames().size());
|
||||
|
||||
forAll(rp.solidRegionNames(), i)
|
||||
{
|
||||
Info<< "Create solid mesh for region " << rp.solidRegionNames()[i]
|
||||
<< " for time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
solidRegions.set
|
||||
(
|
||||
i,
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
rp.solidRegionNames()[i],
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Force calculation of geometric properties to prevent it being done
|
||||
// later in e.g. some boundary evaluation
|
||||
//(void)solidRegions[i].weights();
|
||||
//(void)solidRegions[i].deltaCoeffs();
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
dictionary simple = solidRegions[i].solutionDict().subDict("SIMPLE");
|
||||
|
||||
int nNonOrthCorr = 0;
|
||||
if (simple.found("nNonOrthogonalCorrectors"))
|
||||
{
|
||||
nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors"));
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
fvMesh& mesh = solidRegions[i];
|
||||
|
||||
volScalarField& rho = rhos[i];
|
||||
volScalarField& cp = cps[i];
|
||||
volScalarField& K = Ks[i];
|
||||
volScalarField& T = Ts[i];
|
||||
@ -0,0 +1,16 @@
|
||||
{
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix tEqn
|
||||
(
|
||||
-fvm::laplacian(K, T)
|
||||
);
|
||||
tEqn.relax();
|
||||
eqnResidual = tEqn.solve().initialResidual();
|
||||
maxResidual = max(eqnResidual, maxResidual);
|
||||
|
||||
}
|
||||
|
||||
Info<< "Min/max T:" << min(T).value() << ' '
|
||||
<< max(T).value() << endl;
|
||||
}
|
||||
@ -428,7 +428,43 @@ void Foam::ensightMesh::writePrimsBinary
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writePolys
|
||||
void Foam::ensightMesh::writePolysNFaces
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
OFstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
forAll(polys, i)
|
||||
{
|
||||
ensightGeometryFile
|
||||
<< setw(10) << cellFaces[polys[i]].size() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writePolysNPointsPerFace
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
const faceList& faces,
|
||||
OFstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
forAll(polys, i)
|
||||
{
|
||||
const labelList& cf = cellFaces[polys[i]];
|
||||
|
||||
forAll(cf, faceI)
|
||||
{
|
||||
ensightGeometryFile
|
||||
<< setw(10) << faces[cf[faceI]].size() << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writePolysPoints
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
@ -437,50 +473,190 @@ void Foam::ensightMesh::writePolys
|
||||
OFstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
if (polys.size())
|
||||
label po = pointOffset + 1;
|
||||
|
||||
forAll(polys, i)
|
||||
{
|
||||
ensightGeometryFile
|
||||
<< "nfaced" << nl << setw(10) << polys.size() << nl;
|
||||
const labelList& cf = cellFaces[polys[i]];
|
||||
|
||||
label po = pointOffset + 1;
|
||||
|
||||
forAll(polys, i)
|
||||
forAll(cf, faceI)
|
||||
{
|
||||
ensightGeometryFile
|
||||
<< setw(10) << cellFaces[polys[i]].size() << nl;
|
||||
}
|
||||
const face& f = faces[cf[faceI]];
|
||||
|
||||
forAll(polys, i)
|
||||
{
|
||||
const labelList& cf = cellFaces[polys[i]];
|
||||
|
||||
forAll(cf, faceI)
|
||||
forAll(f, pointI)
|
||||
{
|
||||
ensightGeometryFile
|
||||
<< setw(10) << faces[cf[faceI]].size() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
forAll(polys, i)
|
||||
{
|
||||
const labelList& cf = cellFaces[polys[i]];
|
||||
|
||||
forAll(cf, faceI)
|
||||
{
|
||||
const face& f = faces[cf[faceI]];
|
||||
|
||||
forAll(f, pointI)
|
||||
{
|
||||
ensightGeometryFile << setw(10) << f[pointI] + po;
|
||||
}
|
||||
ensightGeometryFile << nl;
|
||||
ensightGeometryFile << setw(10) << f[pointI] + po;
|
||||
}
|
||||
ensightGeometryFile << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writePolysBinary
|
||||
void Foam::ensightMesh::writeAllPolys
|
||||
(
|
||||
const labelList& pointOffsets,
|
||||
OFstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
if (meshCellSets_.nPolys)
|
||||
{
|
||||
const cellList& cellFaces = mesh_.cells();
|
||||
const faceList& faces = mesh_.faces();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightGeometryFile
|
||||
<< "nfaced" << nl << setw(10) << meshCellSets_.nPolys << nl;
|
||||
}
|
||||
|
||||
// Number of faces for each poly cell
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
writePolysNFaces
|
||||
(
|
||||
meshCellSets_.polys,
|
||||
cellFaces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
|
||||
writePolysNFaces
|
||||
(
|
||||
polys,
|
||||
cellFaces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces;
|
||||
}
|
||||
|
||||
// Number of points for each face of the above list
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
writePolysNPointsPerFace
|
||||
(
|
||||
meshCellSets_.polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
faceList faces(fromSlave);
|
||||
|
||||
writePolysNPointsPerFace
|
||||
(
|
||||
polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
|
||||
// List of points id for each face of the above list
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
writePolysPoints
|
||||
(
|
||||
meshCellSets_.polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
0,
|
||||
ensightGeometryFile
|
||||
);
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
faceList faces(fromSlave);
|
||||
|
||||
writePolysPoints
|
||||
(
|
||||
polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
pointOffsets[slave-1],
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writePolysNFacesBinary
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
forAll(polys, i)
|
||||
{
|
||||
writeEnsDataBinary
|
||||
(
|
||||
cellFaces[polys[i]].size(),
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writePolysNPointsPerFaceBinary
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
const faceList& faces,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
forAll(polys, i)
|
||||
{
|
||||
const labelList& cf = cellFaces[polys[i]];
|
||||
|
||||
forAll(cf, faceI)
|
||||
{
|
||||
writeEnsDataBinary
|
||||
(
|
||||
faces[cf[faceI]].size(),
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writePolysPointsBinary
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
@ -489,51 +665,142 @@ void Foam::ensightMesh::writePolysBinary
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
if (polys.size())
|
||||
label po = pointOffset + 1;
|
||||
|
||||
forAll(polys, i)
|
||||
{
|
||||
writeEnsDataBinary("nfaced",ensightGeometryFile);
|
||||
writeEnsDataBinary(polys.size(),ensightGeometryFile);
|
||||
const labelList& cf = cellFaces[polys[i]];
|
||||
|
||||
label po = pointOffset + 1;
|
||||
|
||||
//TODO No buffer at the moment. To be done for speed purposes!
|
||||
forAll(polys, i)
|
||||
forAll(cf, faceI)
|
||||
{
|
||||
writeEnsDataBinary
|
||||
(
|
||||
cellFaces[polys[i]].size(),
|
||||
ensightGeometryFile
|
||||
);
|
||||
const face& f = faces[cf[faceI]];
|
||||
|
||||
forAll(f, pointI)
|
||||
{
|
||||
writeEnsDataBinary(f[pointI] + po,ensightGeometryFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writeAllPolysBinary
|
||||
(
|
||||
const labelList& pointOffsets,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
if (meshCellSets_.nPolys)
|
||||
{
|
||||
const cellList& cellFaces = mesh_.cells();
|
||||
const faceList& faces = mesh_.faces();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeEnsDataBinary("nfaced",ensightGeometryFile);
|
||||
writeEnsDataBinary(meshCellSets_.nPolys,ensightGeometryFile);
|
||||
}
|
||||
|
||||
forAll(polys, i)
|
||||
// Number of faces for each poly cell
|
||||
if (Pstream::master())
|
||||
{
|
||||
const labelList& cf = cellFaces[polys[i]];
|
||||
|
||||
forAll(cf, faceI)
|
||||
// Master
|
||||
writePolysNFacesBinary
|
||||
(
|
||||
meshCellSets_.polys,
|
||||
cellFaces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
writeEnsDataBinary
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
|
||||
writePolysNFacesBinary
|
||||
(
|
||||
faces[cf[faceI]].size(),
|
||||
polys,
|
||||
cellFaces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
forAll(polys, i)
|
||||
else
|
||||
{
|
||||
const labelList& cf = cellFaces[polys[i]];
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces;
|
||||
}
|
||||
|
||||
forAll(cf, faceI)
|
||||
// Number of points for each face of the above list
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
writePolysNPointsPerFaceBinary
|
||||
(
|
||||
meshCellSets_.polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
const face& f = faces[cf[faceI]];
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
faceList faces(fromSlave);
|
||||
|
||||
forAll(f, pointI)
|
||||
{
|
||||
writeEnsDataBinary(f[pointI] + po,ensightGeometryFile);
|
||||
}
|
||||
writePolysNPointsPerFaceBinary
|
||||
(
|
||||
polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
|
||||
// List of points id for each face of the above list
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
writePolysPointsBinary
|
||||
(
|
||||
meshCellSets_.polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
0,
|
||||
ensightGeometryFile
|
||||
);
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
faceList faces(fromSlave);
|
||||
|
||||
writePolysPointsBinary
|
||||
(
|
||||
polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
pointOffsets[slave-1],
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -619,7 +886,6 @@ void Foam::ensightMesh::writeAllPrimsBinary
|
||||
|
||||
void Foam::ensightMesh::writeFacePrims
|
||||
(
|
||||
const char* key,
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
OFstream& ensightGeometryFile
|
||||
@ -627,18 +893,6 @@ void Foam::ensightMesh::writeFacePrims
|
||||
{
|
||||
if (patchFaces.size())
|
||||
{
|
||||
if (word(key) == "nsided")
|
||||
{
|
||||
ensightGeometryFile
|
||||
<< key << nl << setw(10) << patchFaces.size() << nl;
|
||||
|
||||
forAll(patchFaces, i)
|
||||
{
|
||||
ensightGeometryFile
|
||||
<< setw(10) << patchFaces[i].size() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
label po = pointOffset + 1;
|
||||
|
||||
forAll(patchFaces, i)
|
||||
@ -657,7 +911,6 @@ void Foam::ensightMesh::writeFacePrims
|
||||
|
||||
void Foam::ensightMesh::writeFacePrimsBinary
|
||||
(
|
||||
const char* key,
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
std::ofstream& ensightGeometryFile
|
||||
@ -665,22 +918,6 @@ void Foam::ensightMesh::writeFacePrimsBinary
|
||||
{
|
||||
if (patchFaces.size())
|
||||
{
|
||||
//TODO No buffer at the moment. To be done for speed purposes!
|
||||
if (word(key) == "nsided")
|
||||
{
|
||||
writeEnsDataBinary(key,ensightGeometryFile);
|
||||
writeEnsDataBinary(patchFaces.size(),ensightGeometryFile);
|
||||
|
||||
forAll(patchFaces, i)
|
||||
{
|
||||
writeEnsDataBinary
|
||||
(
|
||||
patchFaces[i].size(),
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
label po = pointOffset + 1;
|
||||
|
||||
forAll(patchFaces, i)
|
||||
@ -732,16 +969,12 @@ void Foam::ensightMesh::writeAllFacePrims
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (word(key) != "nsided")
|
||||
{
|
||||
ensightGeometryFile << key << nl << setw(10) << nPrims << nl;
|
||||
}
|
||||
ensightGeometryFile << key << nl << setw(10) << nPrims << nl;
|
||||
|
||||
if (&prims != NULL)
|
||||
{
|
||||
writeFacePrims
|
||||
(
|
||||
key,
|
||||
map(patchFaces, prims),
|
||||
0,
|
||||
ensightGeometryFile
|
||||
@ -758,7 +991,251 @@ void Foam::ensightMesh::writeAllFacePrims
|
||||
|
||||
writeFacePrims
|
||||
(
|
||||
key,
|
||||
patchFaces,
|
||||
pointOffsets[i],
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (&prims != NULL)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(patchFaces, prims);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writeNSidedNPointsPerFace
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
OFstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
forAll(patchFaces, i)
|
||||
{
|
||||
ensightGeometryFile
|
||||
<< setw(10) << patchFaces[i].size() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writeNSidedPoints
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
OFstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
writeFacePrims
|
||||
(
|
||||
patchFaces,
|
||||
pointOffset,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writeAllNSided
|
||||
(
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
const faceList& patchFaces,
|
||||
const labelList& pointOffsets,
|
||||
const labelList& patchProcessors,
|
||||
OFstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
if (nPrims)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightGeometryFile
|
||||
<< "nsided" << nl << setw(10) << nPrims << nl;
|
||||
}
|
||||
|
||||
// Number of points for each face
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (&prims != NULL)
|
||||
{
|
||||
writeNSidedNPointsPerFace
|
||||
(
|
||||
map(patchFaces, prims),
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
|
||||
forAll (patchProcessors, i)
|
||||
{
|
||||
if (patchProcessors[i] != 0)
|
||||
{
|
||||
label slave = patchProcessors[i];
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
faceList patchFaces(fromSlave);
|
||||
|
||||
writeNSidedNPointsPerFace
|
||||
(
|
||||
patchFaces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (&prims != NULL)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(patchFaces, prims);
|
||||
}
|
||||
|
||||
// List of points id for each face
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (&prims != NULL)
|
||||
{
|
||||
writeNSidedPoints
|
||||
(
|
||||
map(patchFaces, prims),
|
||||
0,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
|
||||
forAll (patchProcessors, i)
|
||||
{
|
||||
if (patchProcessors[i] != 0)
|
||||
{
|
||||
label slave = patchProcessors[i];
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
faceList patchFaces(fromSlave);
|
||||
|
||||
writeNSidedPoints
|
||||
(
|
||||
patchFaces,
|
||||
pointOffsets[i],
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (&prims != NULL)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(patchFaces, prims);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writeNSidedPointsBinary
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
writeFacePrimsBinary
|
||||
(
|
||||
patchFaces,
|
||||
pointOffset,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writeNSidedNPointsPerFaceBinary
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
forAll(patchFaces, i)
|
||||
{
|
||||
writeEnsDataBinary
|
||||
(
|
||||
patchFaces[i].size(),
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writeAllNSidedBinary
|
||||
(
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
const faceList& patchFaces,
|
||||
const labelList& pointOffsets,
|
||||
const labelList& patchProcessors,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
if (nPrims)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeEnsDataBinary("nsided",ensightGeometryFile);
|
||||
writeEnsDataBinary(nPrims,ensightGeometryFile);
|
||||
}
|
||||
|
||||
// Number of points for each face
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (&prims != NULL)
|
||||
{
|
||||
writeNSidedNPointsPerFaceBinary
|
||||
(
|
||||
map(patchFaces, prims),
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
|
||||
forAll (patchProcessors, i)
|
||||
{
|
||||
if (patchProcessors[i] != 0)
|
||||
{
|
||||
label slave = patchProcessors[i];
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
faceList patchFaces(fromSlave);
|
||||
|
||||
writeNSidedNPointsPerFaceBinary
|
||||
(
|
||||
patchFaces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (&prims != NULL)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(patchFaces, prims);
|
||||
}
|
||||
|
||||
// List of points id for each face
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (&prims != NULL)
|
||||
{
|
||||
writeNSidedPointsBinary
|
||||
(
|
||||
map(patchFaces, prims),
|
||||
0,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
|
||||
forAll (patchProcessors, i)
|
||||
{
|
||||
if (patchProcessors[i] != 0)
|
||||
{
|
||||
label slave = patchProcessors[i];
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
faceList patchFaces(fromSlave);
|
||||
|
||||
writeNSidedPointsBinary
|
||||
(
|
||||
patchFaces,
|
||||
pointOffsets[i],
|
||||
ensightGeometryFile
|
||||
@ -790,17 +1267,13 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (word(key) != "nsided")
|
||||
{
|
||||
writeEnsDataBinary(key,ensightGeometryFile);
|
||||
writeEnsDataBinary(nPrims,ensightGeometryFile);
|
||||
}
|
||||
writeEnsDataBinary(key,ensightGeometryFile);
|
||||
writeEnsDataBinary(nPrims,ensightGeometryFile);
|
||||
|
||||
if (&prims != NULL)
|
||||
{
|
||||
writeFacePrimsBinary
|
||||
(
|
||||
key,
|
||||
map(patchFaces, prims),
|
||||
0,
|
||||
ensightGeometryFile
|
||||
@ -817,7 +1290,6 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
|
||||
|
||||
writeFacePrimsBinary
|
||||
(
|
||||
key,
|
||||
patchFaces,
|
||||
pointOffsets[i],
|
||||
ensightGeometryFile
|
||||
@ -863,8 +1335,6 @@ void Foam::ensightMesh::writeAscii
|
||||
{
|
||||
const Time& runTime = mesh_.time();
|
||||
const pointField& points = mesh_.points();
|
||||
const cellList& cellFaces = mesh_.cells();
|
||||
const faceList& faces = mesh_.faces();
|
||||
const cellShapeList& cellShapes = mesh_.cellShapes();
|
||||
|
||||
word timeFile = prepend;
|
||||
@ -990,48 +1460,11 @@ void Foam::ensightMesh::writeAscii
|
||||
ensightGeometryFile
|
||||
);
|
||||
|
||||
|
||||
if (meshCellSets_.nPolys)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
/*
|
||||
ensightGeometryFile
|
||||
<< "nfaced" << nl
|
||||
<< setw(10) << meshCellSets_.nPolys << nl;
|
||||
*/
|
||||
writePolys
|
||||
(
|
||||
meshCellSets_.polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
0,
|
||||
ensightGeometryFile
|
||||
);
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
faceList faces(fromSlave);
|
||||
|
||||
writePolys
|
||||
(
|
||||
polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
pointOffsets[slave-1],
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
}
|
||||
writeAllPolys
|
||||
(
|
||||
pointOffsets,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -1166,9 +1599,8 @@ void Foam::ensightMesh::writeAscii
|
||||
ensightGeometryFile
|
||||
);
|
||||
|
||||
writeAllFacePrims
|
||||
writeAllNSided
|
||||
(
|
||||
"nsided",
|
||||
polys,
|
||||
nfp.nPolys,
|
||||
patchFaces,
|
||||
@ -1197,8 +1629,6 @@ void Foam::ensightMesh::writeBinary
|
||||
{
|
||||
//const Time& runTime = mesh.time();
|
||||
const pointField& points = mesh_.points();
|
||||
const cellList& cellFaces = mesh_.cells();
|
||||
const faceList& faces = mesh_.faces();
|
||||
const cellShapeList& cellShapes = mesh_.cellShapes();
|
||||
|
||||
word timeFile = prepend;
|
||||
@ -1316,47 +1746,11 @@ void Foam::ensightMesh::writeBinary
|
||||
ensightGeometryFile
|
||||
);
|
||||
|
||||
if (meshCellSets_.nPolys)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
/*
|
||||
ensightGeometryFile
|
||||
<< "nfaced" << nl
|
||||
<< setw(10) << meshCellSets_.nPolys << nl;
|
||||
*/
|
||||
writePolysBinary
|
||||
(
|
||||
meshCellSets_.polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
0,
|
||||
ensightGeometryFile
|
||||
);
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
faceList faces(fromSlave);
|
||||
|
||||
writePolysBinary
|
||||
(
|
||||
polys,
|
||||
cellFaces,
|
||||
faces,
|
||||
pointOffsets[slave-1],
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
}
|
||||
writeAllPolysBinary
|
||||
(
|
||||
pointOffsets,
|
||||
ensightGeometryFile
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@ -1495,9 +1889,8 @@ void Foam::ensightMesh::writeBinary
|
||||
ensightGeometryFile
|
||||
);
|
||||
|
||||
writeAllFacePrimsBinary
|
||||
writeAllNSidedBinary
|
||||
(
|
||||
"nsided",
|
||||
polys,
|
||||
nfp.nPolys,
|
||||
patchFaces,
|
||||
@ -1516,4 +1909,5 @@ void Foam::ensightMesh::writeBinary
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -134,7 +134,22 @@ class ensightMesh
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writePolys
|
||||
void writePolysNFaces
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writePolysNPointsPerFace
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
const faceList& faces,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writePolysPoints
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
@ -143,6 +158,12 @@ class ensightMesh
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeAllPolys
|
||||
(
|
||||
const labelList& pointOffsets,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeAllPrims
|
||||
(
|
||||
const char* key,
|
||||
@ -154,7 +175,6 @@ class ensightMesh
|
||||
|
||||
void writeFacePrims
|
||||
(
|
||||
const char* key,
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
OFstream& ensightGeometryFile
|
||||
@ -177,6 +197,29 @@ class ensightMesh
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeNSidedNPointsPerFace
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeNSidedPoints
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeAllNSided
|
||||
(
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
const faceList& patchFaces,
|
||||
const labelList& pointOffsets,
|
||||
const labelList& patchProcessors,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeAscii
|
||||
(
|
||||
const fileName& postProcPath,
|
||||
@ -209,7 +252,22 @@ class ensightMesh
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writePolysBinary
|
||||
void writePolysNFacesBinary
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writePolysNPointsPerFaceBinary
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
const faceList& faces,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writePolysPointsBinary
|
||||
(
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
@ -218,6 +276,12 @@ class ensightMesh
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeAllPolysBinary
|
||||
(
|
||||
const labelList& pointOffsets,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeAllFacePrimsBinary
|
||||
(
|
||||
const char* key,
|
||||
@ -231,12 +295,33 @@ class ensightMesh
|
||||
|
||||
void writeFacePrimsBinary
|
||||
(
|
||||
const char* key,
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeNSidedPointsBinary
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeNSidedNPointsPerFaceBinary
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeAllNSidedBinary
|
||||
(
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
const faceList& patchFaces,
|
||||
const labelList& pointOffsets,
|
||||
const labelList& patchProcessors,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -82,8 +82,8 @@ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
|
||||
: ${WM_OSTYPE:=POSIX}; export WM_OSTYPE
|
||||
|
||||
|
||||
# Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc)
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Compiler: set to Gcc, Gcc43, Gcc44, or Icc (for Intel's icc)
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
: ${WM_COMPILER:=Gcc}; export WM_COMPILER
|
||||
|
||||
export WM_COMPILER_ARCH=
|
||||
|
||||
@ -76,8 +76,8 @@ setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
|
||||
if ( ! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX
|
||||
|
||||
|
||||
# Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc)
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Compiler: set to Gcc, Gcc43, Gcc44 or Icc (for Intel's icc)
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if ( ! $?WM_COMPILER ) setenv WM_COMPILER Gcc
|
||||
|
||||
setenv WM_COMPILER_ARCH
|
||||
|
||||
@ -87,12 +87,12 @@ switch ("$compilerInstall")
|
||||
case OpenFOAM:
|
||||
switch ("$WM_COMPILER")
|
||||
case Gcc:
|
||||
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
||||
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
||||
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
|
||||
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
|
||||
breaksw
|
||||
case Gcc44:
|
||||
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
||||
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
||||
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
|
||||
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
|
||||
breaksw
|
||||
|
||||
@ -111,12 +111,12 @@ case "${compilerInstall:-OpenFOAM}" in
|
||||
OpenFOAM)
|
||||
case "$WM_COMPILER" in
|
||||
Gcc)
|
||||
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
||||
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
||||
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
|
||||
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
|
||||
;;
|
||||
Gcc44)
|
||||
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
||||
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
||||
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
|
||||
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
|
||||
;;
|
||||
|
||||
@ -38,8 +38,8 @@ derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFv
|
||||
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
|
||||
derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
|
||||
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C
|
||||
derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
|
||||
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C
|
||||
|
||||
backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libcompressibleRASModels
|
||||
|
||||
@ -33,16 +33,9 @@ License
|
||||
#include "basicThermo.H"
|
||||
#include "RASModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool turbulentTemperatureCoupledBaffleFvPatchScalarField::interfaceOwner
|
||||
bool Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::interfaceOwner
|
||||
(
|
||||
const polyMesh& nbrRegion,
|
||||
const polyPatch& nbrPatch
|
||||
@ -103,6 +96,7 @@ bool turbulentTemperatureCoupledBaffleFvPatchScalarField::interfaceOwner
|
||||
}
|
||||
nbrIndex = props.fluidRegionNames().size() + i;
|
||||
}
|
||||
|
||||
return myIndex < nbrIndex;
|
||||
}
|
||||
}
|
||||
@ -110,25 +104,20 @@ bool turbulentTemperatureCoupledBaffleFvPatchScalarField::interfaceOwner
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
||||
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
||||
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
neighbourFieldName_("undefined-neighbourFieldName"),
|
||||
KName_("undefined-K")
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 1.0;
|
||||
this->fixesValue_ = true;
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
||||
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
||||
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
(
|
||||
const turbulentTemperatureCoupledBaffleFvPatchScalarField& ptf,
|
||||
@ -137,14 +126,13 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
neighbourFieldName_(ptf.neighbourFieldName_),
|
||||
KName_(ptf.KName_),
|
||||
fixesValue_(ptf.fixesValue_)
|
||||
KName_(ptf.KName_)
|
||||
{}
|
||||
|
||||
|
||||
turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
||||
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
||||
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
@ -152,7 +140,7 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
neighbourFieldName_(dict.lookup("neighbourFieldName")),
|
||||
KName_(dict.lookup("K"))
|
||||
{
|
||||
@ -174,46 +162,26 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
<< " in file " << dimensionedInternalField().objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
|
||||
if (dict.found("refValue"))
|
||||
{
|
||||
// Full restart
|
||||
refValue() = scalarField("refValue", dict, p.size());
|
||||
refGrad() = scalarField("refGradient", dict, p.size());
|
||||
valueFraction() = scalarField("valueFraction", dict, p.size());
|
||||
fixesValue_ = readBool(dict.lookup("fixesValue"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start from user entered data. Assume fixedValue.
|
||||
refValue() = *this;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 1.0;
|
||||
fixesValue_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
||||
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
||||
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
(
|
||||
const turbulentTemperatureCoupledBaffleFvPatchScalarField& wtcsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(wtcsf, iF),
|
||||
fixedValueFvPatchScalarField(wtcsf, iF),
|
||||
neighbourFieldName_(wtcsf.neighbourFieldName_),
|
||||
KName_(wtcsf.KName_),
|
||||
fixesValue_(wtcsf.fixesValue_)
|
||||
KName_(wtcsf.KName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField>
|
||||
turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const
|
||||
{
|
||||
const fvMesh& mesh = patch().boundaryMesh().mesh();
|
||||
|
||||
@ -260,7 +228,7 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const
|
||||
}
|
||||
|
||||
|
||||
void turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
||||
void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
@ -353,18 +321,13 @@ void turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
||||
).fvPatchScalarField::operator=(Twall);
|
||||
}
|
||||
|
||||
|
||||
// Switch between fixed value (of harmonic avg) or gradient
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
label nFixed = 0;
|
||||
|
||||
// Like snGrad but bypass switching on refValue/refGrad.
|
||||
tmp<scalarField> normalGradient = (*this-intFld())*patch().deltaCoeffs();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
scalar Q = gSum(K()*patch().magSf()*normalGradient());
|
||||
//tmp<scalarField> normalGradient =
|
||||
// (*this-intFld())
|
||||
// * patch().deltaCoeffs();
|
||||
|
||||
scalar Q = gSum(K()*patch().magSf()*snGrad());
|
||||
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
@ -380,74 +343,33 @@ void turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
// if outgoing flux use fixed value.
|
||||
if (normalGradient()[i] < 0.0)
|
||||
{
|
||||
this->refValue()[i] = operator[](i);
|
||||
this->refGrad()[i] = 0.0; // not used
|
||||
this->valueFraction()[i] = 1.0;
|
||||
nFixed++;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->refValue()[i] = 0.0; // not used
|
||||
this->refGrad()[i] = normalGradient()[i];
|
||||
this->valueFraction()[i] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(nFixed, sumOp<label>());
|
||||
|
||||
fixesValue_ = (nFixed > 0);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
label nTotSize = returnReduce(this->size(), sumOp<label>());
|
||||
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " -> "
|
||||
<< nbrMesh.name() << ':'
|
||||
<< nbrPatch.name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :"
|
||||
<< " patch:" << patch().name()
|
||||
<< " out of:" << nTotSize
|
||||
<< " fixedBC:" << nFixed
|
||||
<< " gradient:" << nTotSize-nFixed << endl;
|
||||
}
|
||||
|
||||
mixedFvPatchScalarField::updateCoeffs();
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void turbulentTemperatureCoupledBaffleFvPatchScalarField::write
|
||||
void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
mixedFvPatchScalarField::write(os);
|
||||
fixedValueFvPatchScalarField::write(os);
|
||||
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("fixesValue") << fixesValue_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -23,16 +23,15 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::compressible::turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
|
||||
Description
|
||||
Mixed boundary condition for temperature, to be used for heat-transfer
|
||||
on back-to-back baffles.
|
||||
Harmonic fixed value boundary condition for temperature, to be used
|
||||
for heat-transfer on back-to-back baffles.
|
||||
|
||||
If my temperature is T1, neighbour is T2:
|
||||
If my temperature is T1, heat conductivity K1 and neighbour is T2,K2
|
||||
|
||||
T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient.
|
||||
|
||||
both sides get fixedValue (K1/dx1*T1 + K2/dx2*T2)/(K1/dx1+K2/dx2)
|
||||
|
||||
Example usage:
|
||||
myInterfacePatchName
|
||||
@ -65,16 +64,12 @@ SourceFiles
|
||||
#ifndef turbulentTemperatureCoupledBaffleFvPatchScalarField_H
|
||||
#define turbulentTemperatureCoupledBaffleFvPatchScalarField_H
|
||||
|
||||
//#include "fvPatchFields.H"
|
||||
#include "mixedFvPatchFields.H"
|
||||
//#include "fvPatch.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class turbulentTemperatureCoupledBaffleFvPatchScalarField Declaration
|
||||
@ -82,7 +77,7 @@ namespace compressible
|
||||
|
||||
class turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
:
|
||||
public mixedFvPatchScalarField
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -92,8 +87,6 @@ class turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
//- Name of thermal conductivity field
|
||||
const word KName_;
|
||||
|
||||
bool fixesValue_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -104,7 +97,7 @@ class turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("compressible::turbulentTemperatureCoupledBaffle");
|
||||
TypeName("turbulentTemperatureCoupledBaffle");
|
||||
|
||||
|
||||
// Constructors
|
||||
@ -172,14 +165,6 @@ public:
|
||||
//- Get corresponding K field
|
||||
tmp<scalarField> K() const;
|
||||
|
||||
//- Return true if this patch field fixes a value.
|
||||
// Needed to check if a level has to be specified while solving
|
||||
// Poissons equations.
|
||||
virtual bool fixesValue() const
|
||||
{
|
||||
return fixesValue_;
|
||||
}
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
@ -190,7 +175,6 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -0,0 +1,458 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "directMappedPatchBase.H"
|
||||
#include "regionProperties.H"
|
||||
#include "basicThermo.H"
|
||||
#include "RASModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::interfaceOwner
|
||||
(
|
||||
const polyMesh& nbrRegion,
|
||||
const polyPatch& nbrPatch
|
||||
) const
|
||||
{
|
||||
const fvMesh& myRegion = patch().boundaryMesh().mesh();
|
||||
|
||||
if (nbrRegion.name() == myRegion.name())
|
||||
{
|
||||
return patch().index() < nbrPatch.index();
|
||||
}
|
||||
else
|
||||
{
|
||||
const regionProperties& props =
|
||||
myRegion.objectRegistry::parent().lookupObject<regionProperties>
|
||||
(
|
||||
"regionProperties"
|
||||
);
|
||||
|
||||
label myIndex = findIndex(props.fluidRegionNames(), myRegion.name());
|
||||
if (myIndex == -1)
|
||||
{
|
||||
label i = findIndex(props.solidRegionNames(), myRegion.name());
|
||||
|
||||
if (i == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField"
|
||||
"::interfaceOwner(const polyMesh&"
|
||||
", const polyPatch&)const"
|
||||
) << "Cannot find region " << myRegion.name()
|
||||
<< " neither in fluids " << props.fluidRegionNames()
|
||||
<< " nor in solids " << props.solidRegionNames()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
myIndex = props.fluidRegionNames().size() + i;
|
||||
}
|
||||
label nbrIndex = findIndex
|
||||
(
|
||||
props.fluidRegionNames(),
|
||||
nbrRegion.name()
|
||||
);
|
||||
if (nbrIndex == -1)
|
||||
{
|
||||
label i = findIndex(props.solidRegionNames(), nbrRegion.name());
|
||||
|
||||
if (i == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"coupleManager::interfaceOwner"
|
||||
"(const polyMesh&, const polyPatch&) const"
|
||||
) << "Cannot find region " << nbrRegion.name()
|
||||
<< " neither in fluids " << props.fluidRegionNames()
|
||||
<< " nor in solids " << props.solidRegionNames()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
nbrIndex = props.fluidRegionNames().size() + i;
|
||||
}
|
||||
return myIndex < nbrIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
neighbourFieldName_("undefined-neighbourFieldName"),
|
||||
KName_("undefined-K")
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 1.0;
|
||||
this->fixesValue_ = true;
|
||||
}
|
||||
|
||||
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
(
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
||||
neighbourFieldName_(ptf.neighbourFieldName_),
|
||||
KName_(ptf.KName_),
|
||||
fixesValue_(ptf.fixesValue_)
|
||||
{}
|
||||
|
||||
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
neighbourFieldName_(dict.lookup("neighbourFieldName")),
|
||||
KName_(dict.lookup("K"))
|
||||
{
|
||||
if (!isA<directMappedPatchBase>(this->patch().patch()))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::"
|
||||
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField\n"
|
||||
"(\n"
|
||||
" const fvPatch& p,\n"
|
||||
" const DimensionedField<scalar, volMesh>& iF,\n"
|
||||
" const dictionary& dict\n"
|
||||
")\n"
|
||||
) << "\n patch type '" << p.type()
|
||||
<< "' not type '" << directMappedPatchBase::typeName << "'"
|
||||
<< "\n for patch " << p.name()
|
||||
<< " of field " << dimensionedInternalField().name()
|
||||
<< " in file " << dimensionedInternalField().objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
|
||||
if (dict.found("refValue"))
|
||||
{
|
||||
// Full restart
|
||||
refValue() = scalarField("refValue", dict, p.size());
|
||||
refGrad() = scalarField("refGradient", dict, p.size());
|
||||
valueFraction() = scalarField("valueFraction", dict, p.size());
|
||||
fixesValue_ = readBool(dict.lookup("fixesValue"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start from user entered data. Assume fixedValue.
|
||||
refValue() = *this;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 1.0;
|
||||
fixesValue_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
(
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField& wtcsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(wtcsf, iF),
|
||||
neighbourFieldName_(wtcsf.neighbourFieldName_),
|
||||
KName_(wtcsf.KName_),
|
||||
fixesValue_(wtcsf.fixesValue_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField>
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::K() const
|
||||
{
|
||||
const fvMesh& mesh = patch().boundaryMesh().mesh();
|
||||
|
||||
if (KName_ == "none")
|
||||
{
|
||||
const compressible::RASModel& model =
|
||||
db().lookupObject<compressible::RASModel>("RASProperties");
|
||||
|
||||
tmp<volScalarField> talpha = model.alphaEff();
|
||||
|
||||
const basicThermo& thermo =
|
||||
db().lookupObject<basicThermo>("thermophysicalProperties");
|
||||
|
||||
return
|
||||
talpha().boundaryField()[patch().index()]
|
||||
*thermo.Cp()().boundaryField()[patch().index()];
|
||||
}
|
||||
else if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
|
||||
{
|
||||
return patch().lookupPatchField<volScalarField, scalar>(KName_);
|
||||
}
|
||||
else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_))
|
||||
{
|
||||
const symmTensorField& KWall =
|
||||
patch().lookupPatchField<volSymmTensorField, scalar>(KName_);
|
||||
|
||||
vectorField n = patch().nf();
|
||||
|
||||
return n & KWall & n;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::K()"
|
||||
" const"
|
||||
) << "Did not find field " << KName_
|
||||
<< " on mesh " << mesh.name() << " patch " << patch().name()
|
||||
<< endl
|
||||
<< "Please set 'K' to 'none', a valid volScalarField"
|
||||
<< " or a valid volSymmTensorField." << exit(FatalError);
|
||||
|
||||
return scalarField(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the coupling information from the directMappedPatchBase
|
||||
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
|
||||
(
|
||||
patch().patch()
|
||||
);
|
||||
const polyMesh& nbrMesh = mpp.sampleMesh();
|
||||
const fvPatch& nbrPatch = refCast<const fvMesh>
|
||||
(
|
||||
nbrMesh
|
||||
).boundary()[mpp.samplePolyPatch().index()];
|
||||
|
||||
// Force recalculation of mapping and schedule
|
||||
const mapDistribute& distMap = mpp.map();
|
||||
(void)distMap.schedule();
|
||||
|
||||
tmp<scalarField> intFld = patchInternalField();
|
||||
|
||||
if (interfaceOwner(nbrMesh, nbrPatch.patch()))
|
||||
{
|
||||
// Note: other side information could be cached - it only needs
|
||||
// to be updated the first time round the iteration (i.e. when
|
||||
// switching regions) but unfortunately we don't have this information.
|
||||
|
||||
|
||||
// Calculate the temperature by harmonic averaging
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField&
|
||||
nbrField =
|
||||
refCast
|
||||
<
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
>
|
||||
(
|
||||
nbrPatch.lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
neighbourFieldName_
|
||||
)
|
||||
);
|
||||
|
||||
// Swap to obtain full local values of neighbour internal field
|
||||
scalarField nbrIntFld = nbrField.patchInternalField();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrIntFld
|
||||
);
|
||||
|
||||
// Swap to obtain full local values of neighbour K*delta
|
||||
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrKDelta
|
||||
);
|
||||
|
||||
tmp<scalarField> myKDelta = K()*patch().deltaCoeffs();
|
||||
|
||||
// Calculate common wall temperature. Reuse *this to store common value.
|
||||
scalarField Twall
|
||||
(
|
||||
(myKDelta()*intFld() + nbrKDelta*nbrIntFld)
|
||||
/ (myKDelta() + nbrKDelta)
|
||||
);
|
||||
// Assign to me
|
||||
fvPatchScalarField::operator=(Twall);
|
||||
// Distribute back and assign to neighbour
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
nbrField.size(),
|
||||
distMap.constructMap(), // reverse : what to send
|
||||
distMap.subMap(),
|
||||
Twall
|
||||
);
|
||||
const_cast<turbulentTemperatureCoupledBaffleMixedFvPatchScalarField&>
|
||||
(
|
||||
nbrField
|
||||
).fvPatchScalarField::operator=(Twall);
|
||||
}
|
||||
|
||||
|
||||
// Switch between fixed value (of harmonic avg) or gradient
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
label nFixed = 0;
|
||||
|
||||
// Like snGrad but bypass switching on refValue/refGrad.
|
||||
tmp<scalarField> normalGradient = (*this-intFld())*patch().deltaCoeffs();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
scalar Q = gSum(K()*patch().magSf()*normalGradient());
|
||||
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " -> "
|
||||
<< nbrMesh.name() << ':'
|
||||
<< nbrPatch.name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :"
|
||||
<< " heatFlux:" << Q
|
||||
<< " walltemperature "
|
||||
<< " min:" << gMin(*this)
|
||||
<< " max:" << gMax(*this)
|
||||
<< " avg:" << gAverage(*this)
|
||||
<< endl;
|
||||
}
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
// if outgoing flux use fixed value.
|
||||
if (normalGradient()[i] < 0.0)
|
||||
{
|
||||
this->refValue()[i] = operator[](i);
|
||||
this->refGrad()[i] = 0.0; // not used
|
||||
this->valueFraction()[i] = 1.0;
|
||||
nFixed++;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->refValue()[i] = 0.0; // not used
|
||||
this->refGrad()[i] = normalGradient()[i];
|
||||
this->valueFraction()[i] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(nFixed, sumOp<label>());
|
||||
|
||||
fixesValue_ = (nFixed > 0);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
label nTotSize = returnReduce(this->size(), sumOp<label>());
|
||||
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " -> "
|
||||
<< nbrMesh.name() << ':'
|
||||
<< nbrPatch.name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :"
|
||||
<< " patch:" << patch().name()
|
||||
<< " out of:" << nTotSize
|
||||
<< " fixedBC:" << nFixed
|
||||
<< " gradient:" << nTotSize-nFixed << endl;
|
||||
}
|
||||
|
||||
mixedFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
mixedFvPatchScalarField::write(os);
|
||||
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("fixesValue") << fixesValue_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,204 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::compressible::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
|
||||
Description
|
||||
Mixed boundary condition for temperature, to be used for heat-transfer
|
||||
on back-to-back baffles.
|
||||
|
||||
If my temperature is T1, neighbour is T2:
|
||||
|
||||
T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient.
|
||||
|
||||
|
||||
Example usage:
|
||||
myInterfacePatchName
|
||||
{
|
||||
type turbulentTemperatureCoupledBaffleMixed;
|
||||
neighbourFieldName T;
|
||||
K K; // or none
|
||||
value uniform 300;
|
||||
}
|
||||
|
||||
Needs to be on underlying directMapped(Wall)FvPatch.
|
||||
|
||||
Note: if K is "none" looks up RASModel and basicThermo, otherwise expects
|
||||
the solver to calculate a 'K' field.
|
||||
|
||||
Note: runs in parallel with arbitrary decomposition. Uses directMapped
|
||||
functionality to calculate exchange.
|
||||
|
||||
Note: lags interface data so both sides use same data.
|
||||
- problem: schedule to calculate average would interfere
|
||||
with standard processor swaps.
|
||||
- so: updateCoeffs sets both to same Twall. Only need to do
|
||||
this for last outer iteration but don't have access to this.
|
||||
|
||||
SourceFiles
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef turbulentTemperatureCoupledBaffleMixedFvPatchScalarField_H
|
||||
#define turbulentTemperatureCoupledBaffleMixedFvPatchScalarField_H
|
||||
|
||||
//#include "fvPatchFields.H"
|
||||
#include "mixedFvPatchFields.H"
|
||||
//#include "fvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
:
|
||||
public mixedFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of field on the neighbour region
|
||||
const word neighbourFieldName_;
|
||||
|
||||
//- Name of thermal conductivity field
|
||||
const word KName_;
|
||||
|
||||
bool fixesValue_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Am I or neighbour owner of interface
|
||||
bool interfaceOwner(const polyMesh&, const polyPatch&) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("compressible::turbulentTemperatureCoupledBaffleMixed");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a
|
||||
// new patch
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
(
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
(
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField&,
|
||||
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 turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Get corresponding K field
|
||||
tmp<scalarField> K() const;
|
||||
|
||||
//- Return true if this patch field fixes a value.
|
||||
// Needed to check if a level has to be specified while solving
|
||||
// Poissons equations.
|
||||
virtual bool fixesValue() const
|
||||
{
|
||||
return fixesValue_;
|
||||
}
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user