mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' into cvm
This commit is contained in:
@ -1,162 +0,0 @@
|
|||||||
|
|
||||||
Info<< nl << "Reading field boundaryT" << endl;
|
|
||||||
volScalarField boundaryT
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"boundaryT",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field boundaryU" << endl;
|
|
||||||
volVectorField boundaryU
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"boundaryU",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field rhoN (number density)" << endl;
|
|
||||||
volScalarField rhoN
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rhoN",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field rhoM (mass density)" << endl;
|
|
||||||
volScalarField rhoM
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rhoM",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field rhoNdsmc (dsmc particle density)" << endl;
|
|
||||||
volScalarField dsmcRhoN
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"dsmcRhoN",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field momentum (momentum density)" << endl;
|
|
||||||
volVectorField momentum
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"momentum",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field linearKE (linear kinetic energy density)"
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
volScalarField linearKE
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"linearKE",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field internalE (internal energy density)" << endl;
|
|
||||||
volScalarField internalE
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"internalE",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field iDof (internal degree of freedom density)"
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
volScalarField iDof
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"iDof",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field q (surface heat transfer)" << endl;
|
|
||||||
volScalarField q
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"q",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field fD (surface force density)" << endl;
|
|
||||||
volVectorField fD
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"fD",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Constructing dsmcCloud " << endl;
|
|
||||||
|
|
||||||
dsmcCloud dsmc("dsmc", boundaryT, boundaryU);
|
|
||||||
@ -41,53 +41,21 @@ int main(int argc, char *argv[])
|
|||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createFields.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< nl << "Constructing dsmcCloud " << endl;
|
||||||
|
|
||||||
|
dsmcCloud dsmc("dsmc", mesh);
|
||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
while (runTime.run())
|
while (runTime.loop())
|
||||||
{
|
{
|
||||||
runTime++;
|
|
||||||
|
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
// Carry out dsmcCloud timestep
|
|
||||||
|
|
||||||
dsmc.evolve();
|
dsmc.evolve();
|
||||||
|
|
||||||
// Retrieve flow field data from dsmcCloud
|
|
||||||
|
|
||||||
rhoN = dsmc.rhoN();
|
|
||||||
rhoN.correctBoundaryConditions();
|
|
||||||
|
|
||||||
rhoM = dsmc.rhoM();
|
|
||||||
rhoM.correctBoundaryConditions();
|
|
||||||
|
|
||||||
dsmcRhoN = dsmc.dsmcRhoN();
|
|
||||||
dsmcRhoN.correctBoundaryConditions();
|
|
||||||
|
|
||||||
momentum = dsmc.momentum();
|
|
||||||
momentum.correctBoundaryConditions();
|
|
||||||
|
|
||||||
linearKE = dsmc.linearKE();
|
|
||||||
linearKE.correctBoundaryConditions();
|
|
||||||
|
|
||||||
internalE = dsmc.internalE();
|
|
||||||
internalE.correctBoundaryConditions();
|
|
||||||
|
|
||||||
iDof = dsmc.iDof();
|
|
||||||
iDof.correctBoundaryConditions();
|
|
||||||
|
|
||||||
// Retrieve surface field data from dsmcCloud
|
|
||||||
|
|
||||||
q = dsmc.q();
|
|
||||||
|
|
||||||
fD = dsmc.fD();
|
|
||||||
|
|
||||||
// Print status of dsmcCloud
|
|
||||||
|
|
||||||
dsmc.info();
|
dsmc.info();
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -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;
|
||||||
|
}
|
||||||
@ -22,39 +22,42 @@ License
|
|||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
InClass
|
|
||||||
Foam::vtkFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkFoamAddFields_H
|
#include "compressibleCourantNo.H"
|
||||||
#define vtkFoamAddFields_H
|
#include "fvc.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
Foam::scalar Foam::compressibleCourantNo
|
||||||
|
|
||||||
template<class GeoField>
|
|
||||||
void Foam::vtkFoam::addFields
|
|
||||||
(
|
(
|
||||||
vtkDataArraySelection *fieldSelection,
|
const fvMesh& mesh,
|
||||||
const IOobjectList& objects
|
const Time& runTime,
|
||||||
|
const volScalarField& rho,
|
||||||
|
const surfaceScalarField& phi
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
scalar CoNum = 0.0;
|
||||||
|
scalar meanCoNum = 0.0;
|
||||||
|
|
||||||
for
|
//- Can have fluid domains with 0 cells so do not test.
|
||||||
(
|
//if (mesh.nInternalFaces())
|
||||||
IOobjectList::iterator iter = fieldObjects.begin();
|
|
||||||
iter != fieldObjects.end();
|
|
||||||
++iter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
fieldSelection->AddArray(iter()->name().c_str());
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -23,27 +23,27 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Calculates and outputs the mean and maximum Courant Numbers for the fluid
|
||||||
|
regions
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#ifndef compressibleCourantNo_H
|
||||||
|
#define compressibleCourantNo_H
|
||||||
|
|
||||||
#include "vtkFoamData.h"
|
#include "fvMesh.H"
|
||||||
#include "vtkObjectFactory.h"
|
|
||||||
|
|
||||||
vtkCxxRevisionMacro(vtkFoamData, "$Revision: 1.20 $");
|
namespace Foam
|
||||||
vtkStandardNewMacro(vtkFoamData);
|
{
|
||||||
|
scalar compressibleCourantNo
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
vtkFoamData::vtkFoamData()
|
const Time& runTime,
|
||||||
{}
|
const volScalarField& rho,
|
||||||
|
const surfaceScalarField& phi
|
||||||
|
);
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
}
|
||||||
|
|
||||||
vtkFoamData::~vtkFoamData()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
@ -1,4 +1,26 @@
|
|||||||
{
|
{
|
||||||
|
if (mesh.changing())
|
||||||
|
{
|
||||||
|
forAll(U.boundaryField(), patchi)
|
||||||
|
{
|
||||||
|
if (U.boundaryField()[patchi].fixesValue())
|
||||||
|
{
|
||||||
|
U.boundaryField()[patchi].initEvaluate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(U.boundaryField(), patchi)
|
||||||
|
{
|
||||||
|
if (U.boundaryField()[patchi].fixesValue())
|
||||||
|
{
|
||||||
|
U.boundaryField()[patchi].evaluate();
|
||||||
|
|
||||||
|
phi.boundaryField()[patchi] =
|
||||||
|
U.boundaryField()[patchi] & mesh.Sf().boundaryField()[patchi];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wordList pcorrTypes
|
wordList pcorrTypes
|
||||||
(
|
(
|
||||||
p.boundaryField().size(),
|
p.boundaryField().size(),
|
||||||
|
|||||||
@ -1,4 +1,26 @@
|
|||||||
{
|
{
|
||||||
|
if (mesh.changing())
|
||||||
|
{
|
||||||
|
forAll(U.boundaryField(), patchi)
|
||||||
|
{
|
||||||
|
if (U.boundaryField()[patchi].fixesValue())
|
||||||
|
{
|
||||||
|
U.boundaryField()[patchi].initEvaluate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(U.boundaryField(), patchi)
|
||||||
|
{
|
||||||
|
if (U.boundaryField()[patchi].fixesValue())
|
||||||
|
{
|
||||||
|
U.boundaryField()[patchi].evaluate();
|
||||||
|
|
||||||
|
phi.boundaryField()[patchi] =
|
||||||
|
U.boundaryField()[patchi] & mesh.Sf().boundaryField()[patchi];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
volScalarField pcorr
|
volScalarField pcorr
|
||||||
|
|||||||
@ -1,4 +1,26 @@
|
|||||||
{
|
{
|
||||||
|
if (mesh.changing())
|
||||||
|
{
|
||||||
|
forAll(U.boundaryField(), patchi)
|
||||||
|
{
|
||||||
|
if (U.boundaryField()[patchi].fixesValue())
|
||||||
|
{
|
||||||
|
U.boundaryField()[patchi].initEvaluate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(U.boundaryField(), patchi)
|
||||||
|
{
|
||||||
|
if (U.boundaryField()[patchi].fixesValue())
|
||||||
|
{
|
||||||
|
U.boundaryField()[patchi].evaluate();
|
||||||
|
|
||||||
|
phi.boundaryField()[patchi] =
|
||||||
|
U.boundaryField()[patchi] & mesh.Sf().boundaryField()[patchi];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
volScalarField pcorr
|
volScalarField pcorr
|
||||||
|
|||||||
@ -1,133 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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 "argList.H"
|
|
||||||
#include "Time.H"
|
|
||||||
#include "DimensionedFields.H"
|
|
||||||
#include "DimensionedSphericalTensorField.H"
|
|
||||||
#include "vector.H"
|
|
||||||
#include "tensor.H"
|
|
||||||
#include "GeoMesh.H"
|
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
class vMesh
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
vMesh()
|
|
||||||
{}
|
|
||||||
|
|
||||||
label size() const
|
|
||||||
{
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
const word Foam::DimensionedField<scalar, GeoMesh<vMesh> >::typeName
|
|
||||||
(
|
|
||||||
"dimenionedScalarField"
|
|
||||||
);
|
|
||||||
|
|
||||||
template<>
|
|
||||||
const word Foam::DimensionedField<vector, GeoMesh<vMesh> >::typeName
|
|
||||||
(
|
|
||||||
"dimenionedVectorField"
|
|
||||||
);
|
|
||||||
|
|
||||||
template<>
|
|
||||||
const word Foam::DimensionedField<tensor, GeoMesh<vMesh> >::typeName
|
|
||||||
(
|
|
||||||
"dimenionedTensorField"
|
|
||||||
);
|
|
||||||
|
|
||||||
template<>
|
|
||||||
const word Foam::DimensionedField<sphericalTensor, GeoMesh<vMesh> >::typeName
|
|
||||||
(
|
|
||||||
"dimenionedSphericalTensorField"
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
// Main program:
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
|
|
||||||
# include "setRootCase.H"
|
|
||||||
# include "createTime.H"
|
|
||||||
|
|
||||||
vMesh vm;
|
|
||||||
|
|
||||||
DimensionedField<scalar, GeoMesh<vMesh> > dsf
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"dsf",
|
|
||||||
runTime.timeName(),
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
vm
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< dsf << endl;
|
|
||||||
dsf += dsf;
|
|
||||||
dsf -= dimensionedScalar("5", dsf.dimensions(), 5.0);
|
|
||||||
Info<< dsf << endl;
|
|
||||||
|
|
||||||
Info<< sqr(dsf + dsf) - sqr(dsf + dsf) << endl;
|
|
||||||
|
|
||||||
DimensionedField<vector, GeoMesh<vMesh> > dvf
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"dvf",
|
|
||||||
runTime.timeName(),
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
vm
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< (dvf ^ (dvf ^ dvf)) << endl;
|
|
||||||
|
|
||||||
Info << "End\n" << endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
DimensionedFieldTest.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/DimensionedFieldTest
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */
|
|
||||||
/* EXE_LIBS = -lfiniteVolume */
|
|
||||||
@ -33,7 +33,6 @@ Description
|
|||||||
#include "HashPtrTable.H"
|
#include "HashPtrTable.H"
|
||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
#include "StaticHashTable.H"
|
#include "StaticHashTable.H"
|
||||||
#include "HashTbl.H"
|
|
||||||
#include "cpuTime.H"
|
#include "cpuTime.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
@ -53,7 +52,7 @@ int main(int argc, char *argv[])
|
|||||||
// Map<label> map(2 * nSize);
|
// Map<label> map(2 * nSize);
|
||||||
// HashTable<label, label, Hash<label> > map(2 * nSize);
|
// HashTable<label, label, Hash<label> > map(2 * nSize);
|
||||||
// StaticHashTable<label, label, Hash<label> > map(2 * nSize);
|
// StaticHashTable<label, label, Hash<label> > map(2 * nSize);
|
||||||
HashTbl<label, label, Hash<label> > map(2 * nSize);
|
HashTable<label, label, Hash<label> > map(2 * nSize);
|
||||||
|
|
||||||
Info<< "Constructed map of size: " << nSize
|
Info<< "Constructed map of size: " << nSize
|
||||||
<< " (size " << map.size() << " capacity " << map.capacity() << ") "
|
<< " (size " << map.size() << " capacity " << map.capacity() << ") "
|
||||||
|
|||||||
@ -24,7 +24,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "Matrix.H"
|
#include "SquareMatrix.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
@ -34,7 +34,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Matrix<scalar> hmm(3, 3);
|
SquareMatrix<scalar> hmm(3);
|
||||||
|
|
||||||
hmm[0][0] = -3.0;
|
hmm[0][0] = -3.0;
|
||||||
hmm[0][1] = 10.0;
|
hmm[0][1] = 10.0;
|
||||||
@ -46,27 +46,27 @@ int main(int argc, char *argv[])
|
|||||||
hmm[2][1] = 6.0;
|
hmm[2][1] = 6.0;
|
||||||
hmm[2][2] = 1.0;
|
hmm[2][2] = 1.0;
|
||||||
|
|
||||||
Info<< hmm << endl << hmm - 2.0*(-hmm) << endl;
|
//Info<< hmm << endl << hmm - 2.0*(-hmm) << endl;
|
||||||
Info<< max(hmm) << endl;
|
Info<< max(hmm) << endl;
|
||||||
Info<< min(hmm) << endl;
|
Info<< min(hmm) << endl;
|
||||||
|
|
||||||
Matrix<scalar> hmm2(3, 3, 1.0);
|
SquareMatrix<scalar> hmm2(3, 1.0);
|
||||||
|
|
||||||
hmm = hmm2;
|
hmm = hmm2;
|
||||||
|
|
||||||
Info<< hmm << endl;
|
Info<< hmm << endl;
|
||||||
|
|
||||||
Matrix<scalar> hmm3(Sin);
|
SquareMatrix<scalar> hmm3(Sin);
|
||||||
|
|
||||||
Info<< hmm3 << endl;
|
Info<< hmm3 << endl;
|
||||||
|
|
||||||
Matrix<scalar> hmm4;
|
SquareMatrix<scalar> hmm4;
|
||||||
|
|
||||||
hmm4 = hmm2;
|
hmm4 = hmm2;
|
||||||
|
|
||||||
Info<< hmm4 << endl;
|
Info<< hmm4 << endl;
|
||||||
|
|
||||||
Matrix<scalar> hmm5;
|
SquareMatrix<scalar> hmm5;
|
||||||
|
|
||||||
hmm4 = hmm5;
|
hmm4 = hmm5;
|
||||||
Info<< hmm5 << endl;
|
Info<< hmm5 << endl;
|
||||||
|
|||||||
@ -69,7 +69,7 @@ public:
|
|||||||
const scalar x,
|
const scalar x,
|
||||||
const scalarField& y,
|
const scalarField& y,
|
||||||
scalarField& dfdx,
|
scalarField& dfdx,
|
||||||
Matrix<scalar>& dfdy
|
scalarSquareMatrix& dfdy
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
dfdx[0] = 0.0;
|
dfdx[0] = 0.0;
|
||||||
|
|||||||
@ -57,6 +57,8 @@ public:
|
|||||||
Info <<"delete Scalar: " << data_ << endl;
|
Info <<"delete Scalar: " << data_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
autoPtr<Scalar> clone() const;
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream& os, const Scalar& val)
|
friend Ostream& operator<<(Ostream& os, const Scalar& val)
|
||||||
{
|
{
|
||||||
os << val.data_;
|
os << val.data_;
|
||||||
|
|||||||
@ -84,11 +84,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// test List operations
|
// test List operations
|
||||||
|
|
||||||
List<double> flatList = UIndirectList<double>(completeList, addresses);
|
List<double> flatList(UIndirectList<double>(completeList, addresses));
|
||||||
Info<< "List assigned from UIndirectList: " << flatList << endl;
|
Info<< "List constructed from UIndirectList: " << flatList << endl;
|
||||||
|
|
||||||
List<double> flatList2(UIndirectList<double>(completeList, addresses));
|
flatList = UIndirectList<double>(completeList, addresses);
|
||||||
Info<< "List constructed from UIndirectList: " << flatList2 << endl;
|
Info<< "List assigned from UIndirectList: " << flatList << endl;
|
||||||
|
|
||||||
flatList.append(UIndirectList<double>(completeList, addresses));
|
flatList.append(UIndirectList<double>(completeList, addresses));
|
||||||
Info<< "List::append(UIndirectList): " << flatList << endl;
|
Info<< "List::append(UIndirectList): " << flatList << endl;
|
||||||
|
|||||||
@ -84,7 +84,7 @@ int main(int argc, char *argv[])
|
|||||||
// Sync how many to send
|
// Sync how many to send
|
||||||
labelListList allNTrans(Pstream::nProcs());
|
labelListList allNTrans(Pstream::nProcs());
|
||||||
allNTrans[Pstream::myProcNo()] = nSend;
|
allNTrans[Pstream::myProcNo()] = nSend;
|
||||||
combineReduce(allNTrans, mapDistribute::listEq());
|
combineReduce(allNTrans, UPstream::listEq());
|
||||||
|
|
||||||
// Collect items to be sent
|
// Collect items to be sent
|
||||||
labelListList sendMap(Pstream::nProcs());
|
labelListList sendMap(Pstream::nProcs());
|
||||||
@ -161,7 +161,7 @@ int main(int argc, char *argv[])
|
|||||||
toMaster << data;
|
toMaster << data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Perr<< "slave receiving from master "
|
Perr<< "slave receiving from master "
|
||||||
<< Pstream::masterNo() << endl;
|
<< Pstream::masterNo() << endl;
|
||||||
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
|
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
|
||||||
fromMaster >> data;
|
fromMaster >> data;
|
||||||
|
|||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Application
|
Application
|
||||||
volField
|
slicedFieldTest
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
@ -32,16 +32,16 @@ Description
|
|||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "SlicedGeometricField.H"
|
#include "SlicedGeometricField.H"
|
||||||
#include "slicedFvPatchFields.H"
|
#include "slicedFvPatchFields.H"
|
||||||
|
#include "slicedSurfaceFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
|
||||||
# include "setRootCase.H"
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
# include "createTime.H"
|
|
||||||
# include "createMesh.H"
|
|
||||||
|
|
||||||
Info<< "Reading field p\n" << endl;
|
Info<< "Reading field p\n" << endl;
|
||||||
volScalarField p
|
volScalarField p
|
||||||
@ -91,7 +91,7 @@ int main(int argc, char *argv[])
|
|||||||
Info<< C << endl;
|
Info<< C << endl;
|
||||||
Info<< (C & U) << endl;
|
Info<< (C & U) << endl;
|
||||||
|
|
||||||
SlicedGeometricField<vector, fvPatchField, slicedFvPatchField, surfaceMesh>
|
SlicedGeometricField<vector, fvsPatchField, slicedFvsPatchField, surfaceMesh>
|
||||||
Sf
|
Sf
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -105,7 +105,7 @@ int main(int argc, char *argv[])
|
|||||||
mesh.faceAreas()
|
mesh.faceAreas()
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< Sf << endl;
|
//Info<< Sf << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,8 +48,6 @@ int main(int argc, char *argv[])
|
|||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createPolyMesh.H"
|
# include "createPolyMesh.H"
|
||||||
|
|
||||||
pointMesh pMesh(mesh);
|
|
||||||
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
// Get name of patch
|
// Get name of patch
|
||||||
@ -99,7 +97,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
PointEdgeWave<pointEdgePoint> wallCalc
|
PointEdgeWave<pointEdgePoint> wallCalc
|
||||||
(
|
(
|
||||||
pMesh,
|
mesh,
|
||||||
wallPoints,
|
wallPoints,
|
||||||
wallInfo,
|
wallInfo,
|
||||||
|
|
||||||
@ -119,7 +117,7 @@ int main(int argc, char *argv[])
|
|||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::AUTO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
pMesh,
|
pointMesh::New(mesh),
|
||||||
dimensionedScalar("wallDist", dimLength, 0.0)
|
dimensionedScalar("wallDist", dimLength, 0.0)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -34,11 +34,10 @@ Application
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
|
||||||
# include "setRootCase.H"
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
# include "createTime.H"
|
|
||||||
# include "createMesh.H"
|
|
||||||
|
|
||||||
Info<< "Reading field p\n" << endl;
|
Info<< "Reading field p\n" << endl;
|
||||||
volScalarField p
|
volScalarField p
|
||||||
@ -70,12 +69,9 @@ int main(int argc, char *argv[])
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
# include "createPhi.H"
|
#include "createPhi.H"
|
||||||
|
|
||||||
//Info<< transform(dimensionedTensor("I", dimless, 0.1*I), U) << endl;
|
GeometricField<symmTensor, fvPatchField, volMesh> st
|
||||||
|
|
||||||
|
|
||||||
GeometricField<sphericalTensor, fvPatchField, volMesh> st
|
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
@ -86,8 +82,8 @@ int main(int argc, char *argv[])
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh,
|
||||||
dimensioned<sphericalTensor>("st", dimless, sphericalTensor::I),
|
dimensioned<symmTensor>("st", dimless, symmTensor::one),
|
||||||
zeroGradientFvPatchSphericalTensorField::typeName
|
zeroGradientFvPatchSymmTensorField::typeName
|
||||||
);
|
);
|
||||||
|
|
||||||
//Info<< fvc::div(st) << endl;
|
//Info<< fvc::div(st) << endl;
|
||||||
|
|||||||
@ -1,21 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
cd ${0%/*} || exit 1 # run from this directory
|
|
||||||
set -x
|
|
||||||
|
|
||||||
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
|
|
||||||
then
|
|
||||||
case "$ParaView_VERSION" in
|
|
||||||
2*)
|
|
||||||
wmake libso vtkFoam
|
|
||||||
(
|
|
||||||
cd PVFoamReader
|
|
||||||
mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1
|
|
||||||
cd Make/$WM_OPTIONS
|
|
||||||
cmake ../..
|
|
||||||
make
|
|
||||||
)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
|
||||||
@ -1,79 +0,0 @@
|
|||||||
# Set the project/library name here. Classes should be declared as
|
|
||||||
# "class VTK_FoamReader_EXPORT vtkFoo", where PVFoamReader is the name of the
|
|
||||||
# project set here.
|
|
||||||
PROJECT(PVFoamReader)
|
|
||||||
|
|
||||||
# Set your list of sources here. Do not change the name of the
|
|
||||||
# PVFoamReader_SRCS variable.
|
|
||||||
SET(PVFoamReader_SRCS
|
|
||||||
vtkFoamReader.cxx
|
|
||||||
vtkFoamData.cxx
|
|
||||||
)
|
|
||||||
|
|
||||||
# List the kits from VTK that are needed by this project. Do not
|
|
||||||
# change the name of the PVFoamReader_LIBS variable.
|
|
||||||
SET(PVFoamReader_LIBS
|
|
||||||
vtkGraphics
|
|
||||||
)
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
|
||||||
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
|
|
||||||
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
|
|
||||||
$ENV{ParaView_INST_DIR}/include
|
|
||||||
../vtkFoam/lnInclude
|
|
||||||
)
|
|
||||||
ADD_DEFINITIONS(-DWM_$ENV{WM_PRECISION_OPTION})
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
# Most users should not need to change anything below this line.
|
|
||||||
|
|
||||||
# Need to include class headers and the configuration header.
|
|
||||||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
|
|
||||||
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
|
|
||||||
|
|
||||||
# Import ParaView build settings.
|
|
||||||
FIND_PACKAGE(ParaView)
|
|
||||||
IF(NOT ParaView_FOUND)
|
|
||||||
MESSAGE(FATAL_ERROR "ParaView is required. Set ParaView_DIR.")
|
|
||||||
ENDIF(NOT ParaView_FOUND)
|
|
||||||
IF(NOT PARAVIEW_BUILD_SHARED_LIBS)
|
|
||||||
MESSAGE(FATAL_ERROR "ParaView must be built with BUILD_SHARED_LIBS ON.")
|
|
||||||
ENDIF(NOT PARAVIEW_BUILD_SHARED_LIBS)
|
|
||||||
INCLUDE(${PARAVIEW_USE_FILE})
|
|
||||||
|
|
||||||
# Configure output directories.
|
|
||||||
SET (LIBRARY_OUTPUT_PATH $ENV{FOAM_LIBBIN} CACHE INTERNAL
|
|
||||||
"Single output directory for building all libraries.")
|
|
||||||
SET (EXECUTABLE_OUTPUT_PATH $ENV{FOAM_APPBIN} CACHE INTERNAL
|
|
||||||
"Single output directory for building all executables.")
|
|
||||||
|
|
||||||
# Create the configuration header.
|
|
||||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PVFoamReaderConfigure.h.in
|
|
||||||
${PROJECT_BINARY_DIR}/vtk${PROJECT_NAME}Configure.h
|
|
||||||
@ONLY IMMEDIATE)
|
|
||||||
|
|
||||||
# Must be defined before ADD_LIBRARY for cmake version 2.3.4-20060317
|
|
||||||
LINK_DIRECTORIES($ENV{FOAM_LIBBIN})
|
|
||||||
LINK_DIRECTORIES($ENV{FOAM_USER_LIBBIN})
|
|
||||||
|
|
||||||
# Create vtk client/server wrappers for the classes.
|
|
||||||
VTK_WRAP_ClientServer(${PROJECT_NAME} PVFoamReaderCS_SRCS "${PVFoamReader_SRCS}")
|
|
||||||
|
|
||||||
# Build the package as a plugin for ParaView.
|
|
||||||
ADD_LIBRARY(${PROJECT_NAME} MODULE ${PVFoamReader_SRCS} ${PVFoamReaderCS_SRCS})
|
|
||||||
LINK_DIRECTORIES($ENV{ParaView_INST_DIR}/lib)
|
|
||||||
TARGET_LINK_LIBRARIES(${PROJECT_NAME} vtkClientServer)
|
|
||||||
FOREACH(c ${PVFoamReader_LIBS})
|
|
||||||
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${c}CS)
|
|
||||||
ENDFOREACH(c)
|
|
||||||
|
|
||||||
# Place the package configuration file into the build tree.
|
|
||||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PVFoamReader.xml.in
|
|
||||||
${PROJECT_BINARY_DIR}/../${PROJECT_NAME}.xml @ONLY IMMEDIATE)
|
|
||||||
|
|
||||||
# Place the package configuration file into the build tree.
|
|
||||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PVFoamReader.pvsm.in
|
|
||||||
${PROJECT_BINARY_DIR}/../${PROJECT_NAME}.pvsm @ONLY IMMEDIATE)
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(${PROJECT_NAME} OpenFOAM finiteVolume vtkFoam)
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
@ -1,154 +0,0 @@
|
|||||||
<ServerManagerConfiguration>
|
|
||||||
<ProxyGroup name="sources">
|
|
||||||
<SourceProxy
|
|
||||||
|
|
||||||
name="FoamReader"
|
|
||||||
class="vtkFoamReader">
|
|
||||||
|
|
||||||
<StringVectorProperty
|
|
||||||
name="FileName"
|
|
||||||
command="SetFileName"
|
|
||||||
number_of_elements="1">
|
|
||||||
<StringListDomain name="files"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UpdateGUI"
|
|
||||||
command="SetUpdateGUI"
|
|
||||||
number_of_elements="1"
|
|
||||||
default_values="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<IntVectorProperty
|
|
||||||
name="CacheMesh"
|
|
||||||
command="SetCacheMesh"
|
|
||||||
number_of_elements="1"
|
|
||||||
default_values="1">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<IntVectorProperty
|
|
||||||
name="TimeStepRangeInfo"
|
|
||||||
command="GetTimeStepRange"
|
|
||||||
information_only="1">
|
|
||||||
<SimpleIntInformationHelper/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
<IntVectorProperty
|
|
||||||
name="TimeStep"
|
|
||||||
command="SetTimeStep"
|
|
||||||
number_of_elements="1"
|
|
||||||
animateable="1"
|
|
||||||
default_values="0">
|
|
||||||
<IntRangeDomain name="range">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="TimeStepRangeInfo" function="Range"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</IntRangeDomain>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<IntVectorProperty
|
|
||||||
name="TimeStepLimitsInfo"
|
|
||||||
command="GetTimeStepLimits"
|
|
||||||
information_only="1">
|
|
||||||
<SimpleIntInformationHelper/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
<IntVectorProperty
|
|
||||||
name="TimeStepLimits"
|
|
||||||
command="SetTimeStepLimits"
|
|
||||||
number_of_elements="2"
|
|
||||||
default_values="2 5" >
|
|
||||||
<IntRangeDomain name="range">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="TimeStepLimitsInfo" function="Range"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</IntRangeDomain>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<StringVectorProperty
|
|
||||||
name="TimeArrayInfo"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="Time"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="TimeStatus"
|
|
||||||
command="SetTimeArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="TimeArrayInfo">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="TimeArrayInfo"
|
|
||||||
function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<StringVectorProperty
|
|
||||||
name="RegionArrayInfo"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="Region"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="RegionStatus"
|
|
||||||
command="SetRegionArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="RegionArrayInfo">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="RegionArrayInfo"
|
|
||||||
function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<StringVectorProperty
|
|
||||||
name="VolFieldArrayInfo"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="VolField"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="VolFieldStatus"
|
|
||||||
command="SetVolFieldArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="VolFieldArrayInfo">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="VolFieldArrayInfo"
|
|
||||||
function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<StringVectorProperty
|
|
||||||
name="PointFieldArrayInfo"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="PointField"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="PointFieldStatus"
|
|
||||||
command="SetPointFieldArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="PointFieldArrayInfo">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="PointFieldArrayInfo"
|
|
||||||
function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
</SourceProxy>
|
|
||||||
</ProxyGroup>
|
|
||||||
</ServerManagerConfiguration>
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
<ModuleInterfaces>
|
|
||||||
<Library name="PVFoamReader"/>
|
|
||||||
<ServerManagerFile name="PVFoamReader.pvsm"/>
|
|
||||||
|
|
||||||
<Module name="FoamReader"
|
|
||||||
class="vtkPVAdvancedReaderModule"
|
|
||||||
root_name="Foam"
|
|
||||||
output="vtkDataSet"
|
|
||||||
module_type="Reader"
|
|
||||||
extensions=".foam"
|
|
||||||
file_description="Foam case">
|
|
||||||
|
|
||||||
<Source class="vtkFoamReader"/>
|
|
||||||
|
|
||||||
<LabeledToggle
|
|
||||||
label="Update GUI"
|
|
||||||
trace_name="UpdateGUI"
|
|
||||||
property="UpdateGUI"
|
|
||||||
help="To update GUI without execution toggle this Accept and Reset."/>
|
|
||||||
|
|
||||||
<LabeledToggle
|
|
||||||
label="Cache Mesh"
|
|
||||||
trace_name="CacheMesh"
|
|
||||||
property="CacheMesh"
|
|
||||||
help="Cache the FOAM mesh between GUI selection changes."/>
|
|
||||||
|
|
||||||
<Scale
|
|
||||||
property="TimeStep"
|
|
||||||
trace_name="TimeStep"
|
|
||||||
label="Time step"
|
|
||||||
display_entry="0"
|
|
||||||
display_value="1"
|
|
||||||
entry_and_label_on_top="0"
|
|
||||||
help="Select a time step."
|
|
||||||
keeps_timesteps="1"
|
|
||||||
range_source="TimeStepRange"/>
|
|
||||||
|
|
||||||
<VectorEntry
|
|
||||||
property="TimeStepLimits"
|
|
||||||
type="int"
|
|
||||||
trace_name="TimeStepLimits"
|
|
||||||
length="2"
|
|
||||||
label="Lower and Upper Times"
|
|
||||||
help="Maximum lower and upper number of time steps displayed in the selection list."/>
|
|
||||||
|
|
||||||
<ArraySelection
|
|
||||||
label_text="Time"
|
|
||||||
property="TimeStatus"
|
|
||||||
trace_name="TimeArrays"/>
|
|
||||||
|
|
||||||
<ArraySelection
|
|
||||||
label_text="Region"
|
|
||||||
property="RegionStatus"
|
|
||||||
trace_name="RegionArrays"/>
|
|
||||||
|
|
||||||
<ArraySelection
|
|
||||||
label_text="Vol Field"
|
|
||||||
property="VolFieldStatus"
|
|
||||||
trace_name="CellArrays"/>
|
|
||||||
|
|
||||||
<ArraySelection
|
|
||||||
label_text="Point Field"
|
|
||||||
property="PointFieldStatus"
|
|
||||||
trace_name="PointArrays"/>
|
|
||||||
|
|
||||||
<Documentation>
|
|
||||||
ParaView Foam reader module
|
|
||||||
</Documentation>
|
|
||||||
</Module>
|
|
||||||
|
|
||||||
</ModuleInterfaces>
|
|
||||||
@ -1,154 +0,0 @@
|
|||||||
<ServerManagerConfiguration>
|
|
||||||
<ProxyGroup name="sources">
|
|
||||||
<SourceProxy
|
|
||||||
|
|
||||||
name="FoamReader"
|
|
||||||
class="vtkFoamReader">
|
|
||||||
|
|
||||||
<StringVectorProperty
|
|
||||||
name="FileName"
|
|
||||||
command="SetFileName"
|
|
||||||
number_of_elements="1">
|
|
||||||
<StringListDomain name="files"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UpdateGUI"
|
|
||||||
command="SetUpdateGUI"
|
|
||||||
number_of_elements="1"
|
|
||||||
default_values="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<IntVectorProperty
|
|
||||||
name="CacheMesh"
|
|
||||||
command="SetCacheMesh"
|
|
||||||
number_of_elements="1"
|
|
||||||
default_values="1">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<IntVectorProperty
|
|
||||||
name="TimeStepRangeInfo"
|
|
||||||
command="GetTimeStepRange"
|
|
||||||
information_only="1">
|
|
||||||
<SimpleIntInformationHelper/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
<IntVectorProperty
|
|
||||||
name="TimeStep"
|
|
||||||
command="SetTimeStep"
|
|
||||||
number_of_elements="1"
|
|
||||||
animateable="1"
|
|
||||||
default_values="0">
|
|
||||||
<IntRangeDomain name="range">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="TimeStepRangeInfo" function="Range"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</IntRangeDomain>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<IntVectorProperty
|
|
||||||
name="TimeStepLimitsInfo"
|
|
||||||
command="GetTimeStepLimits"
|
|
||||||
information_only="1">
|
|
||||||
<SimpleIntInformationHelper/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
<IntVectorProperty
|
|
||||||
name="TimeStepLimits"
|
|
||||||
command="SetTimeStepLimits"
|
|
||||||
number_of_elements="2"
|
|
||||||
default_values="2 5" >
|
|
||||||
<IntRangeDomain name="range">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="TimeStepLimitsInfo" function="Range"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</IntRangeDomain>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<StringVectorProperty
|
|
||||||
name="TimeArrayInfo"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="Time"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="TimeStatus"
|
|
||||||
command="SetTimeArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="TimeArrayInfo">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="TimeArrayInfo"
|
|
||||||
function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<StringVectorProperty
|
|
||||||
name="RegionArrayInfo"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="Region"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="RegionStatus"
|
|
||||||
command="SetRegionArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="RegionArrayInfo">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="RegionArrayInfo"
|
|
||||||
function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<StringVectorProperty
|
|
||||||
name="VolFieldArrayInfo"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="VolField"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="VolFieldStatus"
|
|
||||||
command="SetVolFieldArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="VolFieldArrayInfo">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="VolFieldArrayInfo"
|
|
||||||
function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<StringVectorProperty
|
|
||||||
name="PointFieldArrayInfo"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="PointField"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="PointFieldStatus"
|
|
||||||
command="SetPointFieldArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="PointFieldArrayInfo">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="PointFieldArrayInfo"
|
|
||||||
function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
</SourceProxy>
|
|
||||||
</ProxyGroup>
|
|
||||||
</ServerManagerConfiguration>
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
<ModuleInterfaces>
|
|
||||||
<Library name="@PROJECT_NAME@"/>
|
|
||||||
<ServerManagerFile name="@PROJECT_NAME@.pvsm"/>
|
|
||||||
|
|
||||||
<Module name="FoamReader"
|
|
||||||
class="vtkPVAdvancedReaderModule"
|
|
||||||
root_name="Foam"
|
|
||||||
output="vtkDataSet"
|
|
||||||
module_type="Reader"
|
|
||||||
extensions=".foam"
|
|
||||||
file_description="Foam case">
|
|
||||||
|
|
||||||
<Source class="vtkFoamReader"/>
|
|
||||||
|
|
||||||
<LabeledToggle
|
|
||||||
label="Update GUI"
|
|
||||||
trace_name="UpdateGUI"
|
|
||||||
property="UpdateGUI"
|
|
||||||
help="To update GUI without execution toggle this Accept and Reset."/>
|
|
||||||
|
|
||||||
<LabeledToggle
|
|
||||||
label="Cache Mesh"
|
|
||||||
trace_name="CacheMesh"
|
|
||||||
property="CacheMesh"
|
|
||||||
help="Cache the FOAM mesh between GUI selection changes."/>
|
|
||||||
|
|
||||||
<Scale
|
|
||||||
property="TimeStep"
|
|
||||||
trace_name="TimeStep"
|
|
||||||
label="Time step"
|
|
||||||
display_entry="0"
|
|
||||||
display_value="1"
|
|
||||||
entry_and_label_on_top="0"
|
|
||||||
help="Select a time step."
|
|
||||||
keeps_timesteps="1"
|
|
||||||
range_source="TimeStepRange"/>
|
|
||||||
|
|
||||||
<VectorEntry
|
|
||||||
property="TimeStepLimits"
|
|
||||||
type="int"
|
|
||||||
trace_name="TimeStepLimits"
|
|
||||||
length="2"
|
|
||||||
label="Lower and Upper Times"
|
|
||||||
help="Maximum lower and upper number of time steps displayed in the selection list."/>
|
|
||||||
|
|
||||||
<ArraySelection
|
|
||||||
label_text="Time"
|
|
||||||
property="TimeStatus"
|
|
||||||
trace_name="TimeArrays"/>
|
|
||||||
|
|
||||||
<ArraySelection
|
|
||||||
label_text="Region"
|
|
||||||
property="RegionStatus"
|
|
||||||
trace_name="RegionArrays"/>
|
|
||||||
|
|
||||||
<ArraySelection
|
|
||||||
label_text="Vol Field"
|
|
||||||
property="VolFieldStatus"
|
|
||||||
trace_name="CellArrays"/>
|
|
||||||
|
|
||||||
<ArraySelection
|
|
||||||
label_text="Point Field"
|
|
||||||
property="PointFieldStatus"
|
|
||||||
trace_name="PointArrays"/>
|
|
||||||
|
|
||||||
<Documentation>
|
|
||||||
ParaView Foam reader module
|
|
||||||
</Documentation>
|
|
||||||
</Module>
|
|
||||||
|
|
||||||
</ModuleInterfaces>
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
/*=========================================================================
|
|
||||||
This source has no copyright. It is intended to be copied by users
|
|
||||||
wishing to create their own ParaView plugin classes locally.
|
|
||||||
=========================================================================*/
|
|
||||||
#ifndef __vtk@PROJECT_NAME@_h
|
|
||||||
#define __vtk@PROJECT_NAME@_h
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
# if defined(@PROJECT_NAME@_EXPORTS)
|
|
||||||
# define VTK_@PROJECT_NAME@_EXPORT __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
# define VTK_@PROJECT_NAME@_EXPORT __declspec(dllimport)
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define VTK_@PROJECT_NAME@_EXPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,411 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#include "vtkFoamReader.h"
|
|
||||||
|
|
||||||
#include "vtkCallbackCommand.h"
|
|
||||||
#include "vtkDataArraySelection.h"
|
|
||||||
#include "vtkDataArrayCollection.h"
|
|
||||||
#include "vtkObjectFactory.h"
|
|
||||||
#include "vtkDataSet.h"
|
|
||||||
#include "vtkErrorCode.h"
|
|
||||||
#include "vtkUnstructuredGrid.h"
|
|
||||||
|
|
||||||
#include "vtkFoam.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
vtkCxxRevisionMacro(vtkFoamReader, "$Revision: 1.20 $");
|
|
||||||
vtkStandardNewMacro(vtkFoamReader);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
vtkFoamReader::vtkFoamReader()
|
|
||||||
{
|
|
||||||
StoredOutputs = NULL;
|
|
||||||
|
|
||||||
FileName = NULL;
|
|
||||||
foamData_ = NULL;
|
|
||||||
|
|
||||||
CacheMesh = 0;
|
|
||||||
|
|
||||||
UpdateGUI = 1;
|
|
||||||
UpdateGUIOld = 1;
|
|
||||||
TimeStep = 0;
|
|
||||||
TimeStepRange[0] = 0;
|
|
||||||
TimeStepRange[1] = 0;
|
|
||||||
|
|
||||||
TimeStepLimits[0] = 2;
|
|
||||||
TimeStepLimits[1] = 5;
|
|
||||||
|
|
||||||
TimeSelection = vtkDataArraySelection::New();
|
|
||||||
RegionSelection = vtkDataArraySelection::New();
|
|
||||||
VolFieldSelection = vtkDataArraySelection::New();
|
|
||||||
PointFieldSelection = vtkDataArraySelection::New();
|
|
||||||
|
|
||||||
// Setup the selection callback to modify this object when an array
|
|
||||||
// selection is changed.
|
|
||||||
SelectionObserver = vtkCallbackCommand::New();
|
|
||||||
SelectionObserver->SetCallback(&vtkFoamReader::SelectionModifiedCallback);
|
|
||||||
SelectionObserver->SetClientData(this);
|
|
||||||
|
|
||||||
TimeSelection->AddObserver
|
|
||||||
(
|
|
||||||
vtkCommand::ModifiedEvent,
|
|
||||||
this->SelectionObserver
|
|
||||||
);
|
|
||||||
RegionSelection->AddObserver
|
|
||||||
(
|
|
||||||
vtkCommand::ModifiedEvent,
|
|
||||||
this->SelectionObserver
|
|
||||||
);
|
|
||||||
VolFieldSelection->AddObserver
|
|
||||||
(
|
|
||||||
vtkCommand::ModifiedEvent,
|
|
||||||
this->SelectionObserver
|
|
||||||
);
|
|
||||||
PointFieldSelection->AddObserver
|
|
||||||
(
|
|
||||||
vtkCommand::ModifiedEvent,
|
|
||||||
this->SelectionObserver
|
|
||||||
);
|
|
||||||
|
|
||||||
// This is needed by ParaView 2.?.?
|
|
||||||
this->SetNumberOfOutputPorts(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
vtkFoamReader::~vtkFoamReader()
|
|
||||||
{
|
|
||||||
if (foamData_)
|
|
||||||
{
|
|
||||||
delete foamData_;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StoredOutputs)
|
|
||||||
{
|
|
||||||
StoredOutputs->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FileName)
|
|
||||||
{
|
|
||||||
delete [] FileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
TimeSelection->RemoveObserver(this->SelectionObserver);
|
|
||||||
RegionSelection->RemoveObserver(this->SelectionObserver);
|
|
||||||
VolFieldSelection->RemoveObserver(this->SelectionObserver);
|
|
||||||
PointFieldSelection->RemoveObserver(this->SelectionObserver);
|
|
||||||
SelectionObserver->Delete();
|
|
||||||
|
|
||||||
TimeSelection->Delete();
|
|
||||||
RegionSelection->Delete();
|
|
||||||
VolFieldSelection->Delete();
|
|
||||||
PointFieldSelection->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void vtkFoamReader::ExecuteInformation()
|
|
||||||
{
|
|
||||||
if (!foamData_)
|
|
||||||
{
|
|
||||||
vtkDebugMacro( << "Reading Foam case" << FileName);
|
|
||||||
foamData_ = new Foam::vtkFoam(FileName, this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foamData_->UpdateInformation();
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkDebugMacro( << "end of ExecuteInformation\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void vtkFoamReader::Execute()
|
|
||||||
{
|
|
||||||
if (!StoredOutputs)
|
|
||||||
{
|
|
||||||
foamData_->Update();
|
|
||||||
|
|
||||||
StoredOutputs = vtkFoamData::New();
|
|
||||||
|
|
||||||
for (int i = 0; i < GetNumberOfOutputs(); i++)
|
|
||||||
{
|
|
||||||
vtkDataObject* tmp = GetOutput(i);
|
|
||||||
vtkDataObject* output = tmp->NewInstance();
|
|
||||||
output->ShallowCopy(tmp);
|
|
||||||
StoredOutputs->SetNthOutput(i, output);
|
|
||||||
output->Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 0; i < GetNumberOfOutputs(); i++)
|
|
||||||
{
|
|
||||||
vtkDataObject* output = GetOutput(i);
|
|
||||||
int tempExtent[6];
|
|
||||||
output->GetUpdateExtent(tempExtent);
|
|
||||||
output->ShallowCopy(StoredOutputs->GetOutput(i));
|
|
||||||
output->SetUpdateExtent(tempExtent);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UpdateGUIOld == GetUpdateGUI())
|
|
||||||
{
|
|
||||||
foamData_->Update();
|
|
||||||
|
|
||||||
for (int i = 0; i < GetNumberOfOutputs(); i++)
|
|
||||||
{
|
|
||||||
vtkDataObject* tmp = GetOutput(i);
|
|
||||||
vtkDataObject* output = tmp->NewInstance();
|
|
||||||
output->ShallowCopy(tmp);
|
|
||||||
StoredOutputs->SetNthOutput(i, output);
|
|
||||||
output->Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateGUIOld = GetUpdateGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void vtkFoamReader::SetFileName(const char *name)
|
|
||||||
{
|
|
||||||
if (name && !FileName || (FileName && !strcmp(FileName,name)))
|
|
||||||
{
|
|
||||||
if (!FileName)
|
|
||||||
{
|
|
||||||
FileName = new char[strlen(name) + 1];
|
|
||||||
strcpy(FileName, name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vtkErrorMacro("Changing case is not currently supported.\nPlease delete reader and create a new one for the new case.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ( FileName && name && (!strcmp(FileName,name)))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name && !FileName)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FileName)
|
|
||||||
{
|
|
||||||
delete [] FileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileName = new char[strlen(name) + 1];
|
|
||||||
strcpy(FileName, name);
|
|
||||||
|
|
||||||
if (foamData_)
|
|
||||||
{
|
|
||||||
delete foamData_;
|
|
||||||
foamData_ = NULL;
|
|
||||||
|
|
||||||
if (StoredOutputs)
|
|
||||||
{
|
|
||||||
StoredOutputs->Delete();
|
|
||||||
StoredOutputs = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Modified();
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void vtkFoamReader::PrintSelf(ostream& os, vtkIndent indent)
|
|
||||||
{
|
|
||||||
Superclass::PrintSelf(os,indent);
|
|
||||||
|
|
||||||
os << indent << "File Name: "
|
|
||||||
<< (FileName ? FileName : "(none)") << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vtkDataArraySelection* vtkFoamReader::GetTimeSelection()
|
|
||||||
{
|
|
||||||
return TimeSelection;
|
|
||||||
}
|
|
||||||
|
|
||||||
int vtkFoamReader::GetNumberOfTimeArrays()
|
|
||||||
{
|
|
||||||
return TimeSelection->GetNumberOfArrays();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* vtkFoamReader::GetTimeArrayName(int index)
|
|
||||||
{
|
|
||||||
return TimeSelection->GetArrayName(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
int vtkFoamReader::GetTimeArrayStatus(const char* name)
|
|
||||||
{
|
|
||||||
return TimeSelection->ArrayIsEnabled(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void vtkFoamReader::SetTimeArrayStatus(const char* name, int status)
|
|
||||||
{
|
|
||||||
if(status)
|
|
||||||
{
|
|
||||||
TimeSelection->EnableArray(name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TimeSelection->DisableArray(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkDataArraySelection* vtkFoamReader::GetRegionSelection()
|
|
||||||
{
|
|
||||||
return RegionSelection;
|
|
||||||
}
|
|
||||||
|
|
||||||
int vtkFoamReader::GetNumberOfRegionArrays()
|
|
||||||
{
|
|
||||||
return RegionSelection->GetNumberOfArrays();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* vtkFoamReader::GetRegionArrayName(int index)
|
|
||||||
{
|
|
||||||
return RegionSelection->GetArrayName(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
int vtkFoamReader::GetRegionArrayStatus(const char* name)
|
|
||||||
{
|
|
||||||
return RegionSelection->ArrayIsEnabled(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void vtkFoamReader::SetRegionArrayStatus(const char* name, int status)
|
|
||||||
{
|
|
||||||
if(status)
|
|
||||||
{
|
|
||||||
RegionSelection->EnableArray(name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RegionSelection->DisableArray(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vtkDataArraySelection* vtkFoamReader::GetVolFieldSelection()
|
|
||||||
{
|
|
||||||
return VolFieldSelection;
|
|
||||||
}
|
|
||||||
|
|
||||||
int vtkFoamReader::GetNumberOfVolFieldArrays()
|
|
||||||
{
|
|
||||||
return VolFieldSelection->GetNumberOfArrays();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* vtkFoamReader::GetVolFieldArrayName(int index)
|
|
||||||
{
|
|
||||||
return VolFieldSelection->GetArrayName(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
int vtkFoamReader::GetVolFieldArrayStatus(const char* name)
|
|
||||||
{
|
|
||||||
return VolFieldSelection->ArrayIsEnabled(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void vtkFoamReader::SetVolFieldArrayStatus(const char* name, int status)
|
|
||||||
{
|
|
||||||
if(status)
|
|
||||||
{
|
|
||||||
VolFieldSelection->EnableArray(name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
VolFieldSelection->DisableArray(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vtkDataArraySelection* vtkFoamReader::GetPointFieldSelection()
|
|
||||||
{
|
|
||||||
return PointFieldSelection;
|
|
||||||
}
|
|
||||||
|
|
||||||
int vtkFoamReader::GetNumberOfPointFieldArrays()
|
|
||||||
{
|
|
||||||
return PointFieldSelection->GetNumberOfArrays();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* vtkFoamReader::GetPointFieldArrayName(int index)
|
|
||||||
{
|
|
||||||
return PointFieldSelection->GetArrayName(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
int vtkFoamReader::GetPointFieldArrayStatus(const char* name)
|
|
||||||
{
|
|
||||||
return PointFieldSelection->ArrayIsEnabled(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void vtkFoamReader::SetPointFieldArrayStatus(const char* name, int status)
|
|
||||||
{
|
|
||||||
if(status)
|
|
||||||
{
|
|
||||||
PointFieldSelection->EnableArray(name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PointFieldSelection->DisableArray(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void vtkFoamReader::SelectionModifiedCallback
|
|
||||||
(
|
|
||||||
vtkObject*,
|
|
||||||
unsigned long,
|
|
||||||
void* clientdata,
|
|
||||||
void*
|
|
||||||
)
|
|
||||||
{
|
|
||||||
static_cast<vtkFoamReader*>(clientdata)->SelectionModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
void vtkFoamReader::SelectionModified()
|
|
||||||
{
|
|
||||||
Modified();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,200 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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
|
|
||||||
vtkFoamReader
|
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
vtkFoamReader.cxx
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkFoamReader_h
|
|
||||||
#define vtkFoamReader_h
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#include "vtkDataSetSource.h"
|
|
||||||
#include "vtkFoamData.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
class vtkFoam;
|
|
||||||
}
|
|
||||||
|
|
||||||
class vtkPoints;
|
|
||||||
class vtkDataArraySelection;
|
|
||||||
class vtkDataArrayCollection;
|
|
||||||
class vtkCallbackCommand;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class vtkFoamReader Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class VTK_IO_EXPORT vtkFoamReader
|
|
||||||
:
|
|
||||||
public vtkDataSetSource
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Standard VTK class creation function
|
|
||||||
static vtkFoamReader *New();
|
|
||||||
|
|
||||||
//- Standard VTK class type and revision declaration macro
|
|
||||||
vtkTypeRevisionMacro(vtkFoamReader,vtkDataSetSource);
|
|
||||||
|
|
||||||
//- Standard VTK class print function
|
|
||||||
void PrintSelf(ostream& os, vtkIndent indent);
|
|
||||||
|
|
||||||
// File name of FOAM datafile to read
|
|
||||||
void SetFileName(const char *);
|
|
||||||
//vtkSetStringMacro(FileName);
|
|
||||||
vtkGetStringMacro(FileName);
|
|
||||||
|
|
||||||
// GUI update control
|
|
||||||
vtkSetMacro(UpdateGUI, int);
|
|
||||||
vtkGetMacro(UpdateGUI, int);
|
|
||||||
|
|
||||||
// FOAM mesh caching control
|
|
||||||
vtkSetMacro(CacheMesh, int);
|
|
||||||
vtkGetMacro(CacheMesh, int);
|
|
||||||
|
|
||||||
// Time-step slider control
|
|
||||||
vtkSetMacro(TimeStep, int);
|
|
||||||
vtkGetMacro(TimeStep, int);
|
|
||||||
vtkSetVector2Macro(TimeStepRange, int);
|
|
||||||
vtkGetVector2Macro(TimeStepRange, int);
|
|
||||||
|
|
||||||
// Control of the upper and lower limits on the number of times
|
|
||||||
// displayed in the selection list
|
|
||||||
vtkSetVector2Macro(TimeStepLimits, int);
|
|
||||||
vtkGetVector2Macro(TimeStepLimits, int);
|
|
||||||
|
|
||||||
// Time selection list control
|
|
||||||
vtkDataArraySelection* GetTimeSelection();
|
|
||||||
int GetNumberOfTimeArrays();
|
|
||||||
const char* GetTimeArrayName(int index);
|
|
||||||
int GetTimeArrayStatus(const char* name);
|
|
||||||
void SetTimeArrayStatus(const char* name, int status);
|
|
||||||
|
|
||||||
// Region selection list control
|
|
||||||
vtkDataArraySelection* GetRegionSelection();
|
|
||||||
int GetNumberOfRegionArrays();
|
|
||||||
const char* GetRegionArrayName(int index);
|
|
||||||
int GetRegionArrayStatus(const char* name);
|
|
||||||
void SetRegionArrayStatus(const char* name, int status);
|
|
||||||
|
|
||||||
// volField selection list control
|
|
||||||
vtkDataArraySelection* GetVolFieldSelection();
|
|
||||||
int GetNumberOfVolFieldArrays();
|
|
||||||
const char* GetVolFieldArrayName(int index);
|
|
||||||
int GetVolFieldArrayStatus(const char* name);
|
|
||||||
void SetVolFieldArrayStatus(const char* name, int status);
|
|
||||||
|
|
||||||
// pointField selection list control
|
|
||||||
vtkDataArraySelection* GetPointFieldSelection();
|
|
||||||
int GetNumberOfPointFieldArrays();
|
|
||||||
const char* GetPointFieldArrayName(int index);
|
|
||||||
int GetPointFieldArrayStatus(const char* name);
|
|
||||||
void SetPointFieldArrayStatus(const char* name, int status);
|
|
||||||
|
|
||||||
// SetNthOutput provided so that vtkFoam can access it
|
|
||||||
void SetNthOutput(int num, vtkDataObject *output)
|
|
||||||
{
|
|
||||||
vtkDataSetSource::SetNthOutput(num, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Standard VTK ExecuteInformation function overriding the base-class.
|
|
||||||
// Called by ParaView before GUI is displayed.
|
|
||||||
virtual void ExecuteInformation();
|
|
||||||
|
|
||||||
// Callback registered with the SelectionObserver
|
|
||||||
// for all the selection lists
|
|
||||||
static void SelectionModifiedCallback
|
|
||||||
(
|
|
||||||
vtkObject* caller,
|
|
||||||
unsigned long eid,
|
|
||||||
void* clientdata,
|
|
||||||
void* calldata
|
|
||||||
);
|
|
||||||
|
|
||||||
void SelectionModified();
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
vtkFoamReader();
|
|
||||||
~vtkFoamReader();
|
|
||||||
|
|
||||||
// Standard VTK execute function overriding the base-class.
|
|
||||||
// Called by ParaView when Accept is pressed.
|
|
||||||
void Execute();
|
|
||||||
|
|
||||||
// Cache for the outputs. These are stored before the end of Execute()
|
|
||||||
// and re-instated at the beginning because the Outputs would disappear
|
|
||||||
// otherwise.
|
|
||||||
vtkFoamData* StoredOutputs;
|
|
||||||
|
|
||||||
// FOAM file name (*.foam)
|
|
||||||
char *FileName;
|
|
||||||
|
|
||||||
//BTX
|
|
||||||
Foam::vtkFoam* foamData_;
|
|
||||||
//ETX
|
|
||||||
|
|
||||||
int CacheMesh;
|
|
||||||
|
|
||||||
int UpdateGUI;
|
|
||||||
int UpdateGUIOld;
|
|
||||||
int TimeStep;
|
|
||||||
int TimeStepRange[2];
|
|
||||||
|
|
||||||
int TimeStepLimits[2];
|
|
||||||
|
|
||||||
vtkDataArraySelection* TimeSelection;
|
|
||||||
vtkDataArraySelection* RegionSelection;
|
|
||||||
vtkDataArraySelection* VolFieldSelection;
|
|
||||||
vtkDataArraySelection* PointFieldSelection;
|
|
||||||
|
|
||||||
// The observer to modify this object when the array selections are modified
|
|
||||||
vtkCallbackCommand* SelectionObserver;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
vtkFoamReader(const vtkFoamReader&); // Not implemented.
|
|
||||||
void operator=(const vtkFoamReader&); // Not implemented.
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,531 +0,0 @@
|
|||||||
/*=========================================================================
|
|
||||||
|
|
||||||
Program: ParaView
|
|
||||||
Module: $RCSfile: vtkPVFoamSelectTimeSet.cxx,v $
|
|
||||||
|
|
||||||
Copyright (c) Kitware, Inc.
|
|
||||||
All rights reserved.
|
|
||||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
|
||||||
|
|
||||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
||||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. See the above copyright notice for more information.
|
|
||||||
|
|
||||||
=========================================================================*/
|
|
||||||
#include "vtkPVFoamSelectTimeSet.h"
|
|
||||||
|
|
||||||
#include "vtkDataArrayCollection.h"
|
|
||||||
#include "vtkFloatArray.h"
|
|
||||||
#include "vtkKWFrame.h"
|
|
||||||
#include "vtkKWLabel.h"
|
|
||||||
#include "vtkKWLabeledFrame.h"
|
|
||||||
#include "vtkKWMenu.h"
|
|
||||||
#include "vtkObjectFactory.h"
|
|
||||||
#include "vtkPVAnimationInterfaceEntry.h"
|
|
||||||
#include "vtkPVApplication.h"
|
|
||||||
#include "vtkPVProcessModule.h"
|
|
||||||
#include "vtkPVScalarListWidgetProperty.h"
|
|
||||||
#include "vtkPVSource.h"
|
|
||||||
#include "vtkPVXMLElement.h"
|
|
||||||
|
|
||||||
#include <vtkstd/string>
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
vtkStandardNewMacro(vtkPVFoamSelectTimeSet);
|
|
||||||
vtkCxxRevisionMacro(vtkPVFoamSelectTimeSet, "$Revision: 1.39 $");
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
int vtkDataArrayCollectionCommand(ClientData cd, Tcl_Interp *interp,
|
|
||||||
int argc, char *argv[]);
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
vtkPVFoamSelectTimeSet::vtkPVFoamSelectTimeSet()
|
|
||||||
{
|
|
||||||
this->LabeledFrame = vtkKWLabeledFrame::New();
|
|
||||||
this->LabeledFrame->SetParent(this);
|
|
||||||
|
|
||||||
this->TimeLabel = vtkKWLabel::New();
|
|
||||||
this->TimeLabel->SetParent(this->LabeledFrame->GetFrame());
|
|
||||||
|
|
||||||
this->TreeFrame = vtkKWWidget::New();
|
|
||||||
this->TreeFrame->SetParent(this->LabeledFrame->GetFrame());
|
|
||||||
|
|
||||||
this->Tree = vtkKWWidget::New();
|
|
||||||
this->Tree->SetParent(this->TreeFrame);
|
|
||||||
|
|
||||||
this->TimeValue = 0.0;
|
|
||||||
|
|
||||||
this->FrameLabel = 0;
|
|
||||||
|
|
||||||
this->TimeSets = vtkDataArrayCollection::New();
|
|
||||||
|
|
||||||
this->Property = 0;
|
|
||||||
|
|
||||||
this->SetCommand = 0;
|
|
||||||
this->ServerSideID.ID = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
vtkPVFoamSelectTimeSet::~vtkPVFoamSelectTimeSet()
|
|
||||||
{
|
|
||||||
this->LabeledFrame->Delete();
|
|
||||||
this->Tree->Delete();
|
|
||||||
this->TreeFrame->Delete();
|
|
||||||
this->TimeLabel->Delete();
|
|
||||||
this->SetFrameLabel(0);
|
|
||||||
this->TimeSets->Delete();
|
|
||||||
this->SetSetCommand(0);
|
|
||||||
if(this->ServerSideID.ID)
|
|
||||||
{
|
|
||||||
vtkPVProcessModule* pm = this->GetPVApplication()->GetProcessModule();
|
|
||||||
pm->DeleteStreamObject(this->ServerSideID);
|
|
||||||
pm->SendStream(vtkProcessModule::DATA_SERVER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::SetLabel(const char* label)
|
|
||||||
{
|
|
||||||
this->SetFrameLabel(label);
|
|
||||||
if (this->GetApplication())
|
|
||||||
{
|
|
||||||
this->LabeledFrame->SetLabel(label);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
const char* vtkPVFoamSelectTimeSet::GetLabel()
|
|
||||||
{
|
|
||||||
return this->GetFrameLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::Create(vtkKWApplication *pvApp)
|
|
||||||
{
|
|
||||||
// Call the superclass to create the widget and set the appropriate flags
|
|
||||||
|
|
||||||
if (!this->vtkKWWidget::Create(pvApp, "frame", "-bd 2 -relief flat"))
|
|
||||||
{
|
|
||||||
vtkErrorMacro("Failed creating widget " << this->GetClassName());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For getting the widget in a script.
|
|
||||||
if ((this->TraceNameState == vtkPVWidget::Uninitialized ||
|
|
||||||
this->TraceNameState == vtkPVWidget::Default) )
|
|
||||||
{
|
|
||||||
this->SetTraceName("FoamSelectTimeSet");
|
|
||||||
this->SetTraceNameState(vtkPVWidget::SelfInitialized);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->LabeledFrame->Create(this->GetApplication(), 0);
|
|
||||||
if (this->FrameLabel)
|
|
||||||
{
|
|
||||||
this->LabeledFrame->SetLabel(this->FrameLabel);
|
|
||||||
}
|
|
||||||
this->TimeLabel->Create(this->GetApplication(), "");
|
|
||||||
|
|
||||||
char label[32];
|
|
||||||
sprintf(label, "Time value: %12.5e", 0.0);
|
|
||||||
this->TimeLabel->SetLabel(label);
|
|
||||||
this->Script("pack %s", this->TimeLabel->GetWidgetName());
|
|
||||||
|
|
||||||
this->TreeFrame->Create(this->GetApplication(), "ScrolledWindow",
|
|
||||||
"-relief sunken -bd 2");
|
|
||||||
|
|
||||||
this->Tree->Create(this->GetApplication(), "Tree",
|
|
||||||
"-background white -bd 0 -width 15 -padx 2 "
|
|
||||||
"-redraw 1 -relief flat -selectbackground red");
|
|
||||||
this->Script("%s bindText <ButtonPress-1> {%s SetTimeValueCallback}",
|
|
||||||
this->Tree->GetWidgetName(), this->GetTclName());
|
|
||||||
this->Script("%s setwidget %s", this->TreeFrame->GetWidgetName(),
|
|
||||||
this->Tree->GetWidgetName());
|
|
||||||
|
|
||||||
this->Script("pack %s -expand t -fill x", this->TreeFrame->GetWidgetName());
|
|
||||||
|
|
||||||
this->Script("pack %s -side top -expand t -fill x",
|
|
||||||
this->LabeledFrame->GetWidgetName());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::SetTimeValue(float time)
|
|
||||||
{
|
|
||||||
if (this->TimeValue != time ||
|
|
||||||
!this->TimeLabel->GetLabel() ||
|
|
||||||
!strcmp(this->TimeLabel->GetLabel(), "No timesets available."))
|
|
||||||
{
|
|
||||||
this->TimeValue = time;
|
|
||||||
|
|
||||||
char label[32];
|
|
||||||
sprintf(label, "Time value: %12.5e", time);
|
|
||||||
this->TimeLabel->SetLabel(label);
|
|
||||||
this->Modified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::SetTimeValueCallback(const char* item)
|
|
||||||
{
|
|
||||||
if (this->TimeSets->GetNumberOfItems() == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( strncmp(item, "timeset", strlen("timeset")) == 0 )
|
|
||||||
{
|
|
||||||
this->Script("if [%s itemcget %s -open] "
|
|
||||||
"{%s closetree %s} else {%s opentree %s}",
|
|
||||||
this->Tree->GetWidgetName(), item,
|
|
||||||
this->Tree->GetWidgetName(), item,
|
|
||||||
this->Tree->GetWidgetName(), item);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->Script("%s selection set %s", this->Tree->GetWidgetName(),
|
|
||||||
item);
|
|
||||||
this->Script("%s itemcget %s -data", this->Tree->GetWidgetName(),
|
|
||||||
item);
|
|
||||||
const char* result = this->GetApplication()->GetMainInterp()->result;
|
|
||||||
if (result[0] == '\0')
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int index[2];
|
|
||||||
sscanf(result, "%d %d", &(index[0]), &(index[1]));
|
|
||||||
|
|
||||||
this->SetTimeSetsFromReader();
|
|
||||||
this->SetTimeValue(this->TimeSets->GetItem(index[0])->GetTuple1(index[1]));
|
|
||||||
this->ModifiedCallback();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::AddRootNode(const char* name, const char* text)
|
|
||||||
{
|
|
||||||
if (!this->GetApplication())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this->Script("%s insert end root %s -text {%s}", this->Tree->GetWidgetName(),
|
|
||||||
name, text);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::AddChildNode(const char* parent, const char* name,
|
|
||||||
const char* text, const char* data)
|
|
||||||
{
|
|
||||||
if (!this->GetApplication())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this->Script("%s insert end %s %s -text {%s} -data %s",
|
|
||||||
this->Tree->GetWidgetName(), parent, name, text, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::SaveInBatchScript(ofstream *file)
|
|
||||||
{
|
|
||||||
*file << " [$pvTemp" << this->PVSource->GetVTKSourceID(0)
|
|
||||||
<< " GetProperty " << this->SetCommand << "] SetElements1 "
|
|
||||||
<< this->Property->GetScalar(0) << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::AcceptInternal(vtkClientServerID sourceID)
|
|
||||||
{
|
|
||||||
if (this->ModifiedFlag)
|
|
||||||
{
|
|
||||||
this->Script("%s selection get", this->Tree->GetWidgetName());
|
|
||||||
this->AddTraceEntry("$kw(%s) SetTimeValueCallback {%s}",
|
|
||||||
this->GetTclName(),
|
|
||||||
this->GetApplication()->GetMainInterp()->result);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->Property->SetVTKSourceID(sourceID);
|
|
||||||
this->Property->SetScalars(1, &this->TimeValue);
|
|
||||||
this->Property->AcceptInternal();
|
|
||||||
|
|
||||||
this->ModifiedFlag = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::Trace(ofstream *file)
|
|
||||||
{
|
|
||||||
if ( ! this->InitializeTrace(file))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->Script("%s selection get", this->Tree->GetWidgetName());
|
|
||||||
*file << "$kw(" << this->GetTclName() << ") SetTimeValueCallback {"
|
|
||||||
<< this->GetApplication()->GetMainInterp()->result << "}" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::ResetInternal()
|
|
||||||
{
|
|
||||||
if ( ! this->ModifiedFlag)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Command to update the UI.
|
|
||||||
if (!this->Tree)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->Script("%s delete [%s nodes root]", this->Tree->GetWidgetName(),
|
|
||||||
this->Tree->GetWidgetName());
|
|
||||||
|
|
||||||
this->SetTimeSetsFromReader();
|
|
||||||
|
|
||||||
int timeSetId=0;
|
|
||||||
char timeSetName[32];
|
|
||||||
char timeSetText[32];
|
|
||||||
|
|
||||||
char timeValueName[32];
|
|
||||||
char timeValueText[32];
|
|
||||||
char indices[32];
|
|
||||||
|
|
||||||
float actualTimeValue = this->Property->GetScalar(0);
|
|
||||||
int matchFound = 0;
|
|
||||||
|
|
||||||
this->ModifiedFlag = 0;
|
|
||||||
|
|
||||||
if (this->TimeSets->GetNumberOfItems() == 0)
|
|
||||||
{
|
|
||||||
this->Script("pack forget %s", this->TreeFrame->GetWidgetName());
|
|
||||||
this->TimeLabel->SetLabel("No timesets available.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->SetTimeValue(actualTimeValue);
|
|
||||||
this->Script("pack %s -expand t -fill x", this->TreeFrame->GetWidgetName());
|
|
||||||
}
|
|
||||||
|
|
||||||
this->TimeSets->InitTraversal();
|
|
||||||
vtkDataArray* da;
|
|
||||||
while( (da=this->TimeSets->GetNextItem()) )
|
|
||||||
{
|
|
||||||
timeSetId++;
|
|
||||||
sprintf(timeSetName,"timeset%d", timeSetId);
|
|
||||||
sprintf(timeSetText,"Time Set %d", timeSetId);
|
|
||||||
this->AddRootNode(timeSetName, timeSetText);
|
|
||||||
|
|
||||||
vtkIdType tuple;
|
|
||||||
for(tuple=0; tuple<da->GetNumberOfTuples(); tuple++)
|
|
||||||
{
|
|
||||||
float timeValue = da->GetTuple1(tuple);
|
|
||||||
sprintf(timeValueName, "time%d_%-12.5e", timeSetId, timeValue);
|
|
||||||
sprintf(timeValueText, "%-12.5e", timeValue);
|
|
||||||
ostrstream str;
|
|
||||||
str << "{" << timeSetId-1 << " " << tuple << "}" << ends;
|
|
||||||
sprintf(indices, "%s", str.str());
|
|
||||||
str.rdbuf()->freeze(0);
|
|
||||||
this->AddChildNode(timeSetName, timeValueName, timeValueText, indices);
|
|
||||||
if (actualTimeValue == timeValue && !matchFound)
|
|
||||||
{
|
|
||||||
matchFound=1;
|
|
||||||
this->Script("%s selection set %s", this->Tree->GetWidgetName(),
|
|
||||||
timeValueName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (timeSetId == 1)
|
|
||||||
{
|
|
||||||
this->Script("%s opentree %s", this->Tree->GetWidgetName(),
|
|
||||||
timeSetName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this->SetTimeValue(actualTimeValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::AddAnimationScriptsToMenu(vtkKWMenu *menu,
|
|
||||||
vtkPVAnimationInterfaceEntry *ai)
|
|
||||||
{
|
|
||||||
char methodAndArgs[500];
|
|
||||||
|
|
||||||
sprintf(methodAndArgs, "AnimationMenuCallback %s", ai->GetTclName());
|
|
||||||
// I do not under stand why the trace name is used for the
|
|
||||||
// menu entry, but Berk must know.
|
|
||||||
menu->AddCommand(this->GetTraceName(), this, methodAndArgs, 0, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// What a pain. I need this method for tracing.
|
|
||||||
// Maybe the animation should call PVwidget methods and not vtk object methods.
|
|
||||||
void vtkPVFoamSelectTimeSet::AnimationMenuCallback(vtkPVAnimationInterfaceEntry *ai)
|
|
||||||
{
|
|
||||||
if (ai->InitializeTrace(NULL))
|
|
||||||
{
|
|
||||||
this->AddTraceEntry("$kw(%s) AnimationMenuCallback $kw(%s)",
|
|
||||||
this->GetTclName(), ai->GetTclName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// I do not under stand why the trace name is used for the
|
|
||||||
// menu entry, but Berk must know.
|
|
||||||
ai->SetLabelAndScript(this->GetTraceName(), NULL, this->GetTraceName());
|
|
||||||
ai->SetCurrentProperty(this->Property);
|
|
||||||
ai->Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
vtkPVFoamSelectTimeSet* vtkPVFoamSelectTimeSet::ClonePrototype(vtkPVSource* pvSource,
|
|
||||||
vtkArrayMap<vtkPVWidget*, vtkPVWidget*>* map)
|
|
||||||
{
|
|
||||||
vtkPVWidget* clone = this->ClonePrototypeInternal(pvSource, map);
|
|
||||||
return vtkPVFoamSelectTimeSet::SafeDownCast(clone);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::CopyProperties(vtkPVWidget* clone,
|
|
||||||
vtkPVSource* pvSource,
|
|
||||||
vtkArrayMap<vtkPVWidget*, vtkPVWidget*>* map)
|
|
||||||
{
|
|
||||||
this->Superclass::CopyProperties(clone, pvSource, map);
|
|
||||||
vtkPVFoamSelectTimeSet* pvts = vtkPVFoamSelectTimeSet::SafeDownCast(clone);
|
|
||||||
if (pvts)
|
|
||||||
{
|
|
||||||
pvts->SetLabel(this->FrameLabel);
|
|
||||||
pvts->SetSetCommand(this->SetCommand);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vtkErrorMacro(
|
|
||||||
"Internal error. Could not downcast clone to PVFoamSelectTimeSet.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
int vtkPVFoamSelectTimeSet::ReadXMLAttributes(vtkPVXMLElement* element,
|
|
||||||
vtkPVXMLPackageParser* parser)
|
|
||||||
{
|
|
||||||
if(!this->Superclass::ReadXMLAttributes(element, parser)) { return 0; }
|
|
||||||
|
|
||||||
// Setup the Label.
|
|
||||||
const char* label = element->GetAttribute("label");
|
|
||||||
if(label)
|
|
||||||
{
|
|
||||||
this->SetLabel(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->SetSetCommand(element->GetAttribute("set_command"));
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::SetTimeSetsFromReader()
|
|
||||||
{
|
|
||||||
vtkPVProcessModule* pm = this->GetPVApplication()->GetProcessModule();
|
|
||||||
this->TimeSets->RemoveAllItems();
|
|
||||||
|
|
||||||
// Create the server-side helper if necessary.
|
|
||||||
if(!this->ServerSideID.ID)
|
|
||||||
{
|
|
||||||
this->ServerSideID = pm->NewStreamObject("vtkPVFoamServerSelectTimeSet");
|
|
||||||
pm->SendStream(vtkProcessModule::DATA_SERVER);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the time sets from the reader on the server.
|
|
||||||
// Reader -> VTKSourceID (0). We assume that there is 1 VTKSource.
|
|
||||||
pm->GetStream() << vtkClientServerStream::Invoke
|
|
||||||
<< this->ServerSideID << "GetTimeSets"
|
|
||||||
<< this->PVSource->GetVTKSourceID(0)
|
|
||||||
<< vtkClientServerStream::End;
|
|
||||||
pm->SendStream(vtkProcessModule::DATA_SERVER_ROOT);
|
|
||||||
vtkClientServerStream timeSets;
|
|
||||||
if(!pm->GetLastServerResult().GetArgument(0, 0, &timeSets))
|
|
||||||
{
|
|
||||||
vtkErrorMacro("Error getting time sets from server.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// There is one time set per message.
|
|
||||||
for(int m=0; m < timeSets.GetNumberOfMessages(); ++m)
|
|
||||||
{
|
|
||||||
// Each argument in the message is a time set entry.
|
|
||||||
vtkFloatArray* timeSet = vtkFloatArray::New();
|
|
||||||
int n = timeSets.GetNumberOfArguments(m);
|
|
||||||
timeSet->SetNumberOfTuples(n);
|
|
||||||
for(int i=0; i < n; ++i)
|
|
||||||
{
|
|
||||||
float value;
|
|
||||||
if(!timeSets.GetArgument(m, i, &value))
|
|
||||||
{
|
|
||||||
vtkErrorMacro("Error reading time set value.");
|
|
||||||
timeSet->Delete();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
timeSet->SetTuple1(i, value);
|
|
||||||
}
|
|
||||||
this->TimeSets->AddItem(timeSet);
|
|
||||||
timeSet->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->Property->GetNumberOfScalars() == 0 &&
|
|
||||||
this->TimeSets->GetNumberOfItems() > 0)
|
|
||||||
{
|
|
||||||
vtkFloatArray *ts =
|
|
||||||
vtkFloatArray::SafeDownCast(this->TimeSets->GetItem(0));
|
|
||||||
this->Property->SetScalars(1, ts->GetPointer(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::SaveInBatchScriptForPart(ofstream *file,
|
|
||||||
vtkClientServerID sourceID)
|
|
||||||
{
|
|
||||||
if (sourceID.ID == 0)
|
|
||||||
{
|
|
||||||
vtkErrorMacro(<< this->GetClassName()
|
|
||||||
<< " must not have SaveInBatchScript method.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
*file << "\t" << "pvTemp" << sourceID
|
|
||||||
<< " SetTimeValue " << this->GetTimeValue()
|
|
||||||
<< endl;;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::SetProperty(vtkPVWidgetProperty *prop)
|
|
||||||
{
|
|
||||||
this->Property = vtkPVScalarListWidgetProperty::SafeDownCast(prop);
|
|
||||||
if (this->Property)
|
|
||||||
{
|
|
||||||
int numScalars = 1;
|
|
||||||
this->Property->SetVTKCommands(1, &this->SetCommand, &numScalars);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
vtkPVWidgetProperty* vtkPVFoamSelectTimeSet::GetProperty()
|
|
||||||
{
|
|
||||||
return this->Property;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
vtkPVWidgetProperty* vtkPVFoamSelectTimeSet::CreateAppropriateProperty()
|
|
||||||
{
|
|
||||||
return vtkPVScalarListWidgetProperty::New();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamSelectTimeSet::PrintSelf(ostream& os, vtkIndent indent)
|
|
||||||
{
|
|
||||||
this->Superclass::PrintSelf(os, indent);
|
|
||||||
os << indent << "TimeValue: " << this->TimeValue << endl;
|
|
||||||
os << indent << "LabeledFrame: " << this->LabeledFrame << endl;
|
|
||||||
os << indent << "SetCommand: "
|
|
||||||
<< (this->SetCommand ? this->SetCommand : "(none)") << endl;
|
|
||||||
}
|
|
||||||
@ -1,164 +0,0 @@
|
|||||||
/*=========================================================================
|
|
||||||
|
|
||||||
Program: ParaView
|
|
||||||
Module: $RCSfile: vtkPVFoamSelectTimeSet.h,v $
|
|
||||||
|
|
||||||
Copyright (c) Kitware, Inc.
|
|
||||||
All rights reserved.
|
|
||||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
|
||||||
|
|
||||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
||||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. See the above copyright notice for more information.
|
|
||||||
|
|
||||||
=========================================================================*/
|
|
||||||
// .NAME vtkPVFoamSelectTimeSet - Special time selection widget used by PVFoamReaderModule
|
|
||||||
// .SECTION Description
|
|
||||||
// This is a PVWidget specially designed to be used with PVFoamReaderModule.
|
|
||||||
// It provides support for multiple sets. The time value selected by
|
|
||||||
// the user is passed to the Foam reader with a SetTimeValue() call.
|
|
||||||
|
|
||||||
#ifndef __vtkPVFoamSelectTimeSet_h
|
|
||||||
#define __vtkPVFoamSelectTimeSet_h
|
|
||||||
|
|
||||||
#include "vtkPVWidget.h"
|
|
||||||
|
|
||||||
class vtkKWLabel;
|
|
||||||
class vtkKWMenu;
|
|
||||||
class vtkKWLabeledFrame;
|
|
||||||
class vtkDataArrayCollection;
|
|
||||||
class vtkPVScalarListWidgetProperty;
|
|
||||||
|
|
||||||
class VTK_EXPORT vtkPVFoamSelectTimeSet : public vtkPVWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static vtkPVFoamSelectTimeSet* New();
|
|
||||||
vtkTypeRevisionMacro(vtkPVFoamSelectTimeSet, vtkPVWidget);
|
|
||||||
void PrintSelf(ostream& os, vtkIndent indent);
|
|
||||||
|
|
||||||
virtual void Create(vtkKWApplication *pvApp);
|
|
||||||
|
|
||||||
//BTX
|
|
||||||
// Description:
|
|
||||||
// Called when accept button is pushed.
|
|
||||||
// Sets objects variable to the widgets value.
|
|
||||||
// Adds a trace entry. Side effect is to turn modified flag off.
|
|
||||||
virtual void AcceptInternal(vtkClientServerID);
|
|
||||||
//ETX
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// Called when the reset button is pushed.
|
|
||||||
// Sets widget's value to the object-variable's value.
|
|
||||||
// Side effect is to turn the modified flag off.
|
|
||||||
virtual void ResetInternal();
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// Adds a script to the menu of the animation interface.
|
|
||||||
virtual void AddAnimationScriptsToMenu(vtkKWMenu *menu,
|
|
||||||
vtkPVAnimationInterfaceEntry *ai);
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// Called whenthe animation method menu item is selected.
|
|
||||||
// Needed for proper tracing.
|
|
||||||
// It would be nice if the menu and cascade menus would trace
|
|
||||||
// invokation of items (?relying of enumeration of menu items or label?)
|
|
||||||
void AnimationMenuCallback(vtkPVAnimationInterfaceEntry *ai);
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// This is the labeled frame around the timeset tree.
|
|
||||||
vtkGetObjectMacro(LabeledFrame, vtkKWLabeledFrame);
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// Label displayed on the labeled frame.
|
|
||||||
void SetLabel(const char* label);
|
|
||||||
const char* GetLabel();
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// Updates the time value label and the time ivar.
|
|
||||||
void SetTimeValue(float time);
|
|
||||||
vtkGetMacro(TimeValue, float);
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// Calls this->SetTimeValue () and Reader->SetTimeValue()
|
|
||||||
// with currently selected time value.
|
|
||||||
void SetTimeValueCallback(const char* item);
|
|
||||||
|
|
||||||
//BTX
|
|
||||||
// Description:
|
|
||||||
// Creates and returns a copy of this widget. It will create
|
|
||||||
// a new instance of the same type as the current object
|
|
||||||
// using NewInstance() and then copy some necessary state
|
|
||||||
// parameters.
|
|
||||||
vtkPVFoamSelectTimeSet* ClonePrototype(vtkPVSource* pvSource,
|
|
||||||
vtkArrayMap<vtkPVWidget*, vtkPVWidget*>* map);
|
|
||||||
//ETX
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// This serves a dual purpose. For tracing and for saving state.
|
|
||||||
virtual void Trace(ofstream *file);
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// Set/get the property to use with this widget.
|
|
||||||
virtual void SetProperty(vtkPVWidgetProperty *prop);
|
|
||||||
virtual vtkPVWidgetProperty* GetProperty();
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// Create the right property for use with this widget.
|
|
||||||
virtual vtkPVWidgetProperty* CreateAppropriateProperty();
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// Set/get the command to pass the value to VTK.
|
|
||||||
vtkSetStringMacro(SetCommand);
|
|
||||||
vtkGetStringMacro(SetCommand);
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// Save this widget to a file.
|
|
||||||
virtual void SaveInBatchScript(ofstream *file);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
vtkPVFoamSelectTimeSet();
|
|
||||||
~vtkPVFoamSelectTimeSet();
|
|
||||||
|
|
||||||
vtkPVFoamSelectTimeSet(const vtkPVFoamSelectTimeSet&); // Not implemented
|
|
||||||
void operator=(const vtkPVFoamSelectTimeSet&); // Not implemented
|
|
||||||
|
|
||||||
vtkPVScalarListWidgetProperty *Property;
|
|
||||||
|
|
||||||
char *SetCommand;
|
|
||||||
|
|
||||||
vtkSetStringMacro(FrameLabel);
|
|
||||||
vtkGetStringMacro(FrameLabel);
|
|
||||||
|
|
||||||
vtkKWWidget* Tree;
|
|
||||||
vtkKWWidget* TreeFrame;
|
|
||||||
vtkKWLabel* TimeLabel;
|
|
||||||
vtkKWLabeledFrame* LabeledFrame;
|
|
||||||
|
|
||||||
void AddRootNode(const char* name, const char* text);
|
|
||||||
void AddChildNode(const char* parent, const char* name,
|
|
||||||
const char* text, const char* data);
|
|
||||||
|
|
||||||
float TimeValue;
|
|
||||||
char* FrameLabel;
|
|
||||||
|
|
||||||
vtkDataArrayCollection* TimeSets;
|
|
||||||
vtkClientServerID ServerSideID;
|
|
||||||
|
|
||||||
// Fill the TimeSets collection with that from the actual reader.
|
|
||||||
void SetTimeSetsFromReader();
|
|
||||||
|
|
||||||
//BTX
|
|
||||||
virtual void CopyProperties(vtkPVWidget* clone, vtkPVSource* pvSource,
|
|
||||||
vtkArrayMap<vtkPVWidget*, vtkPVWidget*>* map);
|
|
||||||
//ETX
|
|
||||||
|
|
||||||
int ReadXMLAttributes(vtkPVXMLElement* element,
|
|
||||||
vtkPVXMLPackageParser* parser);
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// An interface for saving a widget into a script.
|
|
||||||
virtual void SaveInBatchScriptForPart(ofstream *file, vtkClientServerID);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
/*=========================================================================
|
|
||||||
|
|
||||||
Program: ParaView
|
|
||||||
Module: $RCSfile: vtkPVFoamServerSelectTimeSet.cxx,v $
|
|
||||||
|
|
||||||
Copyright (c) Kitware, Inc.
|
|
||||||
All rights reserved.
|
|
||||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
|
||||||
|
|
||||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
||||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. See the above copyright notice for more information.
|
|
||||||
|
|
||||||
=========================================================================*/
|
|
||||||
#include "vtkPVFoamServerSelectTimeSet.h"
|
|
||||||
|
|
||||||
#include "vtkClientServerInterpreter.h"
|
|
||||||
#include "vtkObjectFactory.h"
|
|
||||||
#include "vtkPVProcessModule.h"
|
|
||||||
#include "vtkFoamReader.h"
|
|
||||||
#include "vtkDataArrayCollection.h"
|
|
||||||
#include "vtkDataArrayCollectionIterator.h"
|
|
||||||
#include "vtkClientServerStream.h"
|
|
||||||
|
|
||||||
#include <vtkstd/string>
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
vtkStandardNewMacro(vtkPVFoamServerSelectTimeSet);
|
|
||||||
vtkCxxRevisionMacro(vtkPVFoamServerSelectTimeSet, "$Revision: 1.4 $");
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
class vtkPVFoamServerSelectTimeSetInternals
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
vtkClientServerStream Result;
|
|
||||||
};
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
vtkPVFoamServerSelectTimeSet::vtkPVFoamServerSelectTimeSet()
|
|
||||||
{
|
|
||||||
this->Internal = new vtkPVFoamServerSelectTimeSetInternals;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
vtkPVFoamServerSelectTimeSet::~vtkPVFoamServerSelectTimeSet()
|
|
||||||
{
|
|
||||||
delete this->Internal;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void vtkPVFoamServerSelectTimeSet::PrintSelf(ostream& os, vtkIndent indent)
|
|
||||||
{
|
|
||||||
this->Superclass::PrintSelf(os,indent);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
const vtkClientServerStream&
|
|
||||||
vtkPVFoamServerSelectTimeSet::GetTimeSets(vtkFoamReader* reader)
|
|
||||||
{
|
|
||||||
// Reset the stream for a new list of time sets.
|
|
||||||
this->Internal->Result.Reset();
|
|
||||||
|
|
||||||
// Get the time sets from the reader.
|
|
||||||
vtkDataArrayCollection* timeSets = reader->GetTimeSets();
|
|
||||||
|
|
||||||
// Iterate through the time sets.
|
|
||||||
vtkDataArrayCollectionIterator* iter = vtkDataArrayCollectionIterator::New();
|
|
||||||
iter->SetCollection(timeSets);
|
|
||||||
for(iter->GoToFirstItem(); !iter->IsDoneWithTraversal();
|
|
||||||
iter->GoToNextItem())
|
|
||||||
{
|
|
||||||
// Each time set is stored in one message.
|
|
||||||
this->Internal->Result << vtkClientServerStream::Reply;
|
|
||||||
vtkDataArray* da = iter->GetDataArray();
|
|
||||||
for(int i=0; i < da->GetNumberOfTuples(); ++i)
|
|
||||||
{
|
|
||||||
this->Internal->Result << da->GetTuple1(i);
|
|
||||||
}
|
|
||||||
this->Internal->Result << vtkClientServerStream::End;
|
|
||||||
}
|
|
||||||
iter->Delete();
|
|
||||||
|
|
||||||
// Return the stream.
|
|
||||||
return this->Internal->Result;
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
/*=========================================================================
|
|
||||||
|
|
||||||
Program: ParaView
|
|
||||||
Module: $RCSfile: vtkPVFoamServerSelectTimeSet.h,v $
|
|
||||||
|
|
||||||
Copyright (c) Kitware, Inc.
|
|
||||||
All rights reserved.
|
|
||||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
|
||||||
|
|
||||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
||||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. See the above copyright notice for more information.
|
|
||||||
|
|
||||||
=========================================================================*/
|
|
||||||
// .NAME vtkPVFoamServerSelectTimeSet - Server-side helper for vtkPVFoamSelectTimeSet.
|
|
||||||
// .SECTION Description
|
|
||||||
|
|
||||||
#ifndef __vtkPVFoamServerSelectTimeSet_h
|
|
||||||
#define __vtkPVFoamServerSelectTimeSet_h
|
|
||||||
|
|
||||||
#include "vtkPVServerObject.h"
|
|
||||||
|
|
||||||
class vtkClientServerStream;
|
|
||||||
class vtkPVFoamServerSelectTimeSetInternals;
|
|
||||||
class vtkFoamReader;
|
|
||||||
|
|
||||||
class VTK_EXPORT vtkPVFoamServerSelectTimeSet : public vtkPVServerObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static vtkPVFoamServerSelectTimeSet* New();
|
|
||||||
vtkTypeRevisionMacro(vtkPVFoamServerSelectTimeSet, vtkPVServerObject);
|
|
||||||
void PrintSelf(ostream& os, vtkIndent indent);
|
|
||||||
|
|
||||||
// Description:
|
|
||||||
// Get a list the time sets provided by the given reader.
|
|
||||||
const vtkClientServerStream& GetTimeSets(vtkFoamReader*);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
vtkPVFoamServerSelectTimeSet();
|
|
||||||
~vtkPVFoamServerSelectTimeSet();
|
|
||||||
|
|
||||||
// Internal implementation details.
|
|
||||||
vtkPVFoamServerSelectTimeSetInternals* Internal;
|
|
||||||
private:
|
|
||||||
vtkPVFoamServerSelectTimeSet(const vtkPVFoamServerSelectTimeSet&); // Not implemented
|
|
||||||
void operator=(const vtkPVFoamServerSelectTimeSet&); // Not implemented
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
vtkFoam.C
|
|
||||||
vtkFoamAddInternalMesh.C
|
|
||||||
vtkFoamAddPatch.C
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libvtkFoam
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
EXE_INC = \
|
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
|
||||||
-I$(ParaView_INST_DIR)/include \
|
|
||||||
-I../PVFoamReader
|
|
||||||
|
|
||||||
LIB_LIBS = \
|
|
||||||
-lfiniteVolume \
|
|
||||||
-lgenericPatchFields \
|
|
||||||
$(GLIBS)
|
|
||||||
@ -1,665 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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 "vtkFoam.H"
|
|
||||||
|
|
||||||
#include "argList.H"
|
|
||||||
#include "Time.H"
|
|
||||||
#include "polyBoundaryMeshEntries.H"
|
|
||||||
#include "IOobjectList.H"
|
|
||||||
#include "wordList.H"
|
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "pointMesh.H"
|
|
||||||
#include "volPointInterpolation.H"
|
|
||||||
|
|
||||||
#include "vtkFoamReader.h"
|
|
||||||
#include "vtkDataArraySelection.h"
|
|
||||||
#include "vtkUnstructuredGrid.h"
|
|
||||||
#include "vtkPointData.h"
|
|
||||||
#include "vtkCellData.h"
|
|
||||||
#include "vtkFloatArray.h"
|
|
||||||
#include "vtkCharArray.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
defineTypeNameAndDebug(Foam::vtkFoam, 0);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#include "vtkFoamConvertFields.H"
|
|
||||||
|
|
||||||
void Foam::vtkFoam::SetName
|
|
||||||
(
|
|
||||||
vtkUnstructuredGrid* vtkMesh,
|
|
||||||
const char* name
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkCharArray* nmArray = vtkCharArray::New();
|
|
||||||
nmArray->SetName("Name");
|
|
||||||
size_t len = strlen(name);
|
|
||||||
nmArray->SetNumberOfTuples(static_cast<vtkIdType>(len)+1);
|
|
||||||
char* copy = nmArray->GetPointer(0);
|
|
||||||
memcpy(copy, name, len);
|
|
||||||
copy[len] = '\0';
|
|
||||||
vtkMesh->GetFieldData()->AddArray(nmArray);
|
|
||||||
nmArray->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::string Foam::vtkFoam::padTimeString(const string& ts)
|
|
||||||
{
|
|
||||||
return ts + string(" ", max(label(12 - ts.size()), 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Pad the patch name string in order to account for dynamic changes
|
|
||||||
// in patch names during topological changes
|
|
||||||
Foam::string Foam::vtkFoam::padPatchString(const string& ps)
|
|
||||||
{
|
|
||||||
label n = max(label(50 - ps.size()), 0);
|
|
||||||
return ps + string(" ", n);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkFoam::setSelectedTime
|
|
||||||
(
|
|
||||||
Time& runTime,
|
|
||||||
vtkFoamReader* reader
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Get times list
|
|
||||||
instantList Times = runTime.times();
|
|
||||||
int timeIndex = min(max(reader->GetTimeStep() + 1, 0), Times.size()-1);
|
|
||||||
|
|
||||||
// If this is the first call timeIndex will be 0 ("constant")
|
|
||||||
// so reset to the first time step if one exists and deselect every
|
|
||||||
// element of the selection array
|
|
||||||
if (timeIndex == 0)
|
|
||||||
{
|
|
||||||
timeIndex = min(1, Times.size()-1);
|
|
||||||
reader->GetTimeSelection()->DisableAllArrays();
|
|
||||||
}
|
|
||||||
|
|
||||||
label selectedTimeIndex = -1;
|
|
||||||
label nSelectedTimes = reader->GetTimeSelection()->GetNumberOfArrays();
|
|
||||||
|
|
||||||
for (label i=nSelectedTimes-1; i>=0; i--)
|
|
||||||
{
|
|
||||||
if(reader->GetTimeSelection()->GetArraySetting(i))
|
|
||||||
{
|
|
||||||
word timeName = string::validate<word>
|
|
||||||
(
|
|
||||||
reader->GetTimeSelection()->GetArrayName(i)
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(Times, j)
|
|
||||||
{
|
|
||||||
if (Times[j].name() == timeName)
|
|
||||||
{
|
|
||||||
selectedTimeIndex = j;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedTimeIndex != -1)
|
|
||||||
{
|
|
||||||
timeIndex = min(selectedTimeIndex, Times.size()-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Selecting time " << Times[timeIndex].name() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
runTime.setTime(Times[timeIndex], timeIndex);
|
|
||||||
|
|
||||||
Times = runTime.times();
|
|
||||||
|
|
||||||
reader->SetTimeStepRange(0, max(Times.size()-2, 0));
|
|
||||||
|
|
||||||
// reset the time steps ...
|
|
||||||
reader->GetTimeSelection()->RemoveAllArrays();
|
|
||||||
|
|
||||||
int* TimeStepLimits = reader->GetTimeStepLimits();
|
|
||||||
label maxStartTimes = min(Times.size(), TimeStepLimits[0]);
|
|
||||||
label maxNTimes = min(Times.size() - maxStartTimes, TimeStepLimits[1]);
|
|
||||||
|
|
||||||
for (label i=0; i<maxStartTimes; i++)
|
|
||||||
{
|
|
||||||
reader->GetTimeSelection()
|
|
||||||
->AddArray(padTimeString(Times[i].name()).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Times.size() > TimeStepLimits[0] + TimeStepLimits[1])
|
|
||||||
{
|
|
||||||
reader->GetTimeSelection()->AddArray(padTimeString("...").c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (label i=Times.size() - maxNTimes; i<Times.size(); i++)
|
|
||||||
{
|
|
||||||
reader->GetTimeSelection()
|
|
||||||
->AddArray(padTimeString(Times[i].name()).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable all the time selections (which are all selected by default) ...
|
|
||||||
reader->GetTimeSelection()->DisableAllArrays();
|
|
||||||
|
|
||||||
// But maintain the selections made previously
|
|
||||||
if (selectedTimeIndex != -1 && selectedTimeIndex < Times.size())
|
|
||||||
{
|
|
||||||
reader->GetTimeSelection()->EnableArray
|
|
||||||
(padTimeString(Times[selectedTimeIndex].name()).c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkFoam::updateSelectedRegions()
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Foam::vtkFoam::updateSelectedRegions()" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
label nRegions = reader_->GetRegionSelection()->GetNumberOfArrays();
|
|
||||||
|
|
||||||
selectedRegions_.setSize(nRegions);
|
|
||||||
|
|
||||||
// Read the selected patches and add to the region list
|
|
||||||
for (int i=0; i<nRegions; i++)
|
|
||||||
{
|
|
||||||
selectedRegions_[i] =
|
|
||||||
reader_->GetRegionSelection()->GetArraySetting(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkFoam::convertMesh()
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Foam::vtkFoam::convertMesh()" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
// Read the internal mesh as region 0 if selected
|
|
||||||
if (reader_->GetRegionSelection()->GetArraySetting(0))
|
|
||||||
{
|
|
||||||
selectedRegions_[0] = true;
|
|
||||||
addInternalMesh
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
selectedRegions_[0] = false;
|
|
||||||
|
|
||||||
vtkUnstructuredGrid *vtkMesh =
|
|
||||||
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0));
|
|
||||||
|
|
||||||
vtkMesh->Initialize();
|
|
||||||
SetName(vtkMesh, "(Internal Mesh)");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Read the selected patches and add to the region list
|
|
||||||
|
|
||||||
polyBoundaryMeshEntries patchEntries
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"boundary",
|
|
||||||
dbPtr_().findInstance(polyMesh::meshSubDir, "boundary"),
|
|
||||||
polyMesh::meshSubDir,
|
|
||||||
dbPtr_(),
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label regioni = 0;
|
|
||||||
label regioniLast = 0;
|
|
||||||
|
|
||||||
// Read in the number Outputs (patch regions) currently being used
|
|
||||||
label currNOutputs = reader_->GetNumberOfOutputs();
|
|
||||||
|
|
||||||
// Cycle through all the patches in the boundary file for the relevant
|
|
||||||
// time step
|
|
||||||
forAll(patchEntries, entryi)
|
|
||||||
{
|
|
||||||
// Number of faces in the current patch (Used to detect dummy patches
|
|
||||||
// of size zero)
|
|
||||||
label nFaces(readLabel(patchEntries[entryi].dict().lookup("nFaces")));
|
|
||||||
|
|
||||||
// Check to see if the patch is currently a part of the displayed list
|
|
||||||
if
|
|
||||||
(
|
|
||||||
reader_->GetRegionSelection()->ArrayExists
|
|
||||||
(
|
|
||||||
padPatchString(patchEntries[entryi].keyword()).c_str()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!nFaces)
|
|
||||||
{
|
|
||||||
// Remove patch if it is only a dummy patch in the current
|
|
||||||
// time step with zero faces
|
|
||||||
reader_->GetRegionSelection()->RemoveArrayByName
|
|
||||||
(
|
|
||||||
padPatchString(patchEntries[entryi].keyword()).c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// A patch already existent in the list and which
|
|
||||||
// continues to exist found
|
|
||||||
regioni++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// A new patch so far not yet included into the list has been found
|
|
||||||
if (nFaces)
|
|
||||||
{
|
|
||||||
regioni++;
|
|
||||||
|
|
||||||
// Add a new entry to the list of regions
|
|
||||||
reader_->GetRegionSelection()->AddArray
|
|
||||||
(
|
|
||||||
padPatchString(patchEntries[entryi].keyword()).c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
// AddArray automatically enables a new array... disable
|
|
||||||
// it manually
|
|
||||||
reader_->GetRegionSelection()->DisableArray
|
|
||||||
(
|
|
||||||
padPatchString(patchEntries[entryi].keyword()).c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Avoid Initialization of the same Output twice
|
|
||||||
if (regioni != regioniLast)
|
|
||||||
{
|
|
||||||
// Only setup an Output if it has not been setup before
|
|
||||||
if(regioni >= currNOutputs)
|
|
||||||
{
|
|
||||||
vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::New();
|
|
||||||
reader_->SetNthOutput(regioni,ugrid);
|
|
||||||
ugrid->Delete();
|
|
||||||
}
|
|
||||||
// Initialize -> Delete memory used, and reset to zero state
|
|
||||||
reader_->GetOutput(regioni)->Initialize();
|
|
||||||
regioniLast = regioni;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize (reset to zero and free) any outputs which are not used
|
|
||||||
// anymore
|
|
||||||
if (regioni < currNOutputs)
|
|
||||||
{
|
|
||||||
for(label i = (regioni+1); i < currNOutputs;i++)
|
|
||||||
{
|
|
||||||
reader_->GetOutput(i)->Initialize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
selectedRegions_.setSize(regioni + 1);
|
|
||||||
|
|
||||||
regioni = 0;
|
|
||||||
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
|
||||||
|
|
||||||
forAll (patches, patchi)
|
|
||||||
{
|
|
||||||
if (patches[patchi].size())
|
|
||||||
{
|
|
||||||
regioni++;
|
|
||||||
|
|
||||||
if (reader_->GetRegionSelection()->GetArraySetting(regioni))
|
|
||||||
{
|
|
||||||
selectedRegions_[regioni] = true;
|
|
||||||
addPatch
|
|
||||||
(
|
|
||||||
patches[patchi],
|
|
||||||
vtkUnstructuredGrid::SafeDownCast
|
|
||||||
(
|
|
||||||
reader_->GetOutput(regioni)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
selectedRegions_[regioni] = false;
|
|
||||||
|
|
||||||
vtkUnstructuredGrid *vtkMesh =
|
|
||||||
vtkUnstructuredGrid::SafeDownCast
|
|
||||||
(
|
|
||||||
reader_->GetOutput(regioni)
|
|
||||||
);
|
|
||||||
|
|
||||||
vtkMesh->Initialize();
|
|
||||||
SetName
|
|
||||||
(
|
|
||||||
vtkMesh,
|
|
||||||
('(' + padPatchString(patches[patchi].name()) + ')').c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::vtkFoam::vtkFoam(const char* const FileName, vtkFoamReader* reader)
|
|
||||||
:
|
|
||||||
reader_(reader),
|
|
||||||
argsPtr_(NULL),
|
|
||||||
dbPtr_(NULL),
|
|
||||||
meshPtr_(NULL)
|
|
||||||
{
|
|
||||||
fileName fullCasePath(fileName(FileName).path());
|
|
||||||
|
|
||||||
if (!isDir(fullCasePath))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* argvStrings[3];
|
|
||||||
argvStrings[0] = new char[9];
|
|
||||||
strcpy(argvStrings[0], "/vtkFoam");
|
|
||||||
argvStrings[1] = new char[6];
|
|
||||||
strcpy(argvStrings[1], "-case");
|
|
||||||
argvStrings[2] = new char[fullCasePath.size()+1];
|
|
||||||
strcpy(argvStrings[2], fullCasePath.c_str());
|
|
||||||
|
|
||||||
int argc = 3;
|
|
||||||
char** argv = &argvStrings[0];
|
|
||||||
argsPtr_.reset(new argList(argc, argv));
|
|
||||||
|
|
||||||
for(int i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
delete[] argvStrings[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
dbPtr_.reset
|
|
||||||
(
|
|
||||||
new Time
|
|
||||||
(
|
|
||||||
Time::controlDictName,
|
|
||||||
argsPtr_().rootPath(),
|
|
||||||
argsPtr_().caseName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
dbPtr_().functionObjects().off();
|
|
||||||
setSelectedTime(dbPtr_(), reader_);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "vtkFoam::ExecuteInformation: Initialising outputs" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
reader_->GetRegionSelection()->AddArray("Internal Mesh");
|
|
||||||
|
|
||||||
vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::New();
|
|
||||||
reader_->SetNthOutput(0, ugrid);
|
|
||||||
ugrid->Delete();
|
|
||||||
reader_->GetOutput(0)->Initialize();
|
|
||||||
|
|
||||||
polyBoundaryMeshEntries patchEntries
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"boundary",
|
|
||||||
dbPtr_().findInstance(polyMesh::meshSubDir, "boundary"),
|
|
||||||
polyMesh::meshSubDir,
|
|
||||||
dbPtr_(),
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label regioni = 0;
|
|
||||||
forAll(patchEntries, entryi)
|
|
||||||
{
|
|
||||||
label nFaces(readLabel(patchEntries[entryi].dict().lookup("nFaces")));
|
|
||||||
|
|
||||||
if (nFaces)
|
|
||||||
{
|
|
||||||
regioni++;
|
|
||||||
|
|
||||||
reader_->GetRegionSelection()->AddArray
|
|
||||||
(
|
|
||||||
padPatchString(patchEntries[entryi].keyword()).c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::New();
|
|
||||||
reader_->SetNthOutput(regioni, ugrid);
|
|
||||||
ugrid->Delete();
|
|
||||||
reader_->GetOutput(regioni)->Initialize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
selectedRegions_.setSize(regioni + 1);
|
|
||||||
selectedRegions_ = true;
|
|
||||||
|
|
||||||
UpdateInformation();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::vtkFoam::~vtkFoam()
|
|
||||||
{
|
|
||||||
// Do NOT delete meshPtr_ since still referenced somehow.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#include "vtkFoamAddFields.H"
|
|
||||||
|
|
||||||
void Foam::vtkFoam::UpdateInformation()
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "TimeStep = " << reader_->GetTimeStep() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
setSelectedTime(dbPtr_(), reader_);
|
|
||||||
|
|
||||||
// Search for list of objects for this time
|
|
||||||
IOobjectList objects(dbPtr_(), dbPtr_().timeName());
|
|
||||||
|
|
||||||
addFields<volScalarField>(reader_->GetVolFieldSelection(), objects);
|
|
||||||
addFields<volVectorField>(reader_->GetVolFieldSelection(), objects);
|
|
||||||
addFields<volSphericalTensorField>(reader_->GetVolFieldSelection(), objects);
|
|
||||||
addFields<volSymmTensorField>(reader_->GetVolFieldSelection(), objects);
|
|
||||||
addFields<volTensorField>(reader_->GetVolFieldSelection(), objects);
|
|
||||||
|
|
||||||
addFields<pointScalarField>(reader_->GetPointFieldSelection(), objects);
|
|
||||||
addFields<pointVectorField>(reader_->GetPointFieldSelection(), objects);
|
|
||||||
addFields<pointSphericalTensorField>(reader_->GetPointFieldSelection(), objects);
|
|
||||||
addFields<pointSymmTensorField>(reader_->GetPointFieldSelection(), objects);
|
|
||||||
addFields<pointTensorField>(reader_->GetPointFieldSelection(), objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkFoam::Update()
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!reader_->GetCacheMesh()
|
|
||||||
|| reader_->GetTimeSelection()->GetArraySetting(0)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
meshPtr_= NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the current set of selected fields
|
|
||||||
|
|
||||||
for (label i=0; i<reader_->GetNumberOfOutputs(); i++)
|
|
||||||
{
|
|
||||||
vtkUnstructuredGrid *vtkMesh =
|
|
||||||
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(i));
|
|
||||||
|
|
||||||
vtkCellData* cellData = vtkMesh->GetCellData();
|
|
||||||
int numberOfCellArrays = cellData->GetNumberOfArrays();
|
|
||||||
|
|
||||||
wordList cellFieldNames(numberOfCellArrays);
|
|
||||||
for (int j=0; j<numberOfCellArrays; j++)
|
|
||||||
{
|
|
||||||
cellFieldNames[j] = cellData->GetArrayName(j);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int j=0; j<numberOfCellArrays; j++)
|
|
||||||
{
|
|
||||||
cellData->RemoveArray(cellFieldNames[j].c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkPointData* pointData = vtkMesh->GetPointData();
|
|
||||||
int numberOfPointArrays = pointData->GetNumberOfArrays();
|
|
||||||
|
|
||||||
wordList pointFieldNames(numberOfPointArrays);
|
|
||||||
for (int j=0; j<numberOfPointArrays; j++)
|
|
||||||
{
|
|
||||||
pointFieldNames[j] = pointData->GetArrayName(j);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int j=0; j<numberOfPointArrays; j++)
|
|
||||||
{
|
|
||||||
pointData->RemoveArray(pointFieldNames[j].c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check to see if the mesh has been created
|
|
||||||
|
|
||||||
if (!meshPtr_)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Reading Mesh" << endl;
|
|
||||||
}
|
|
||||||
meshPtr_ =
|
|
||||||
new fvMesh
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
fvMesh::defaultRegion,
|
|
||||||
dbPtr_().timeName(),
|
|
||||||
dbPtr_()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
convertMesh();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boolList oldSelectedRegions = selectedRegions_;
|
|
||||||
updateSelectedRegions();
|
|
||||||
if
|
|
||||||
(
|
|
||||||
meshPtr_->readUpdate() != fvMesh::UNCHANGED
|
|
||||||
|| oldSelectedRegions != selectedRegions_
|
|
||||||
)
|
|
||||||
{
|
|
||||||
convertMesh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "converting fields" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
// Construct interpolation on the raw mesh
|
|
||||||
Foam::pointMesh pMesh(mesh);
|
|
||||||
|
|
||||||
Foam::volPointInterpolation pInterp(mesh, pMesh);
|
|
||||||
|
|
||||||
// Search for list of objects for this time
|
|
||||||
Foam::IOobjectList objects(mesh, dbPtr_().timeName());
|
|
||||||
|
|
||||||
convertVolFields<Foam::scalar>
|
|
||||||
(
|
|
||||||
mesh, pInterp, objects, reader_->GetVolFieldSelection()
|
|
||||||
);
|
|
||||||
convertVolFields<Foam::vector>
|
|
||||||
(
|
|
||||||
mesh, pInterp, objects, reader_->GetVolFieldSelection()
|
|
||||||
);
|
|
||||||
convertVolFields<Foam::sphericalTensor>
|
|
||||||
(
|
|
||||||
mesh, pInterp, objects, reader_->GetVolFieldSelection()
|
|
||||||
);
|
|
||||||
convertVolFields<Foam::symmTensor>
|
|
||||||
(
|
|
||||||
mesh, pInterp, objects, reader_->GetVolFieldSelection()
|
|
||||||
);
|
|
||||||
convertVolFields<Foam::tensor>
|
|
||||||
(
|
|
||||||
mesh, pInterp, objects, reader_->GetVolFieldSelection()
|
|
||||||
);
|
|
||||||
|
|
||||||
convertPointFields<Foam::scalar>
|
|
||||||
(
|
|
||||||
mesh, objects, reader_->GetPointFieldSelection()
|
|
||||||
);
|
|
||||||
convertPointFields<Foam::vector>
|
|
||||||
(
|
|
||||||
mesh, objects, reader_->GetPointFieldSelection()
|
|
||||||
);
|
|
||||||
convertPointFields<Foam::sphericalTensor>
|
|
||||||
(
|
|
||||||
mesh, objects, reader_->GetPointFieldSelection()
|
|
||||||
);
|
|
||||||
convertPointFields<Foam::symmTensor>
|
|
||||||
(
|
|
||||||
mesh, objects, reader_->GetPointFieldSelection()
|
|
||||||
);
|
|
||||||
convertPointFields<Foam::tensor>
|
|
||||||
(
|
|
||||||
mesh, objects, reader_->GetPointFieldSelection()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "done" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,256 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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::vtkFoam
|
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
vtkFoam.C
|
|
||||||
vtkFoamInsertNextPoint.H
|
|
||||||
vtkFoamAddFields.H
|
|
||||||
vtkFoamAddInternalMesh.H
|
|
||||||
vtkFoamConvertFields.H
|
|
||||||
vtkFoamConvertVolField.H
|
|
||||||
vtkFoamConvertPatchFaceField.H
|
|
||||||
vtkFoamConvertPointField.H
|
|
||||||
vtkFoamConvertPatchPointField.H
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkFoam_H
|
|
||||||
#define vtkFoam_H
|
|
||||||
|
|
||||||
#include "className.H"
|
|
||||||
#include "fileName.H"
|
|
||||||
#include "volPointInterpolation.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// VTK class forward declarations
|
|
||||||
class vtkFoamReader;
|
|
||||||
class vtkUnstructuredGrid;
|
|
||||||
class vtkPoints;
|
|
||||||
class vtkDataArraySelection;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// Foam class forward declarations
|
|
||||||
class argList;
|
|
||||||
class Time;
|
|
||||||
class fvMesh;
|
|
||||||
class IOobjectList;
|
|
||||||
class polyPatch;
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class vtkFoam Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class vtkFoam
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Access to the controlling vtkFoamReader
|
|
||||||
vtkFoamReader *reader_;
|
|
||||||
|
|
||||||
autoPtr<argList> argsPtr_;
|
|
||||||
autoPtr<Time> dbPtr_;
|
|
||||||
fvMesh* meshPtr_;
|
|
||||||
|
|
||||||
//- Selected regions, [0] = internal mesh, [1-nPatches] = patches
|
|
||||||
boolList selectedRegions_;
|
|
||||||
|
|
||||||
//- Lables of cell-centres used as additional points when decomposing
|
|
||||||
// polyhedra
|
|
||||||
labelList addPointCellLabels_;
|
|
||||||
|
|
||||||
//- Label of original cell the decomposed cells are split from
|
|
||||||
labelList superCells_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Pad-out the time name to avoid bug in the GUI redraw
|
|
||||||
static string padTimeString(const string&);
|
|
||||||
|
|
||||||
//- Pad-out the patch name
|
|
||||||
static string padPatchString(const string&);
|
|
||||||
|
|
||||||
//- Find and set the selected time from all the methods of selection
|
|
||||||
static void setSelectedTime
|
|
||||||
(
|
|
||||||
Time& runTime,
|
|
||||||
vtkFoamReader* reader
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Update the selected regions
|
|
||||||
void updateSelectedRegions();
|
|
||||||
|
|
||||||
//- Convert the mesh according to the list of selected regions
|
|
||||||
void convertMesh();
|
|
||||||
|
|
||||||
//- Add the internal mesh to the set of Outputs if selected
|
|
||||||
void addInternalMesh(const fvMesh&, vtkUnstructuredGrid*);
|
|
||||||
|
|
||||||
//- Add the internal patch to the set of Outputs if selected
|
|
||||||
void addPatch(const polyPatch&, vtkUnstructuredGrid*);
|
|
||||||
|
|
||||||
//- Add the fields in th selested time directory to the selection lists
|
|
||||||
template<class GeoField>
|
|
||||||
void addFields
|
|
||||||
(
|
|
||||||
vtkDataArraySelection *fieldSelection,
|
|
||||||
const IOobjectList& objects
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Convert the selected volFields
|
|
||||||
template<class Type>
|
|
||||||
void convertVolFields
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const volPointInterpolation& pInterp,
|
|
||||||
const IOobjectList& objects,
|
|
||||||
vtkDataArraySelection *fieldSelection
|
|
||||||
);
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void convertVolField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf
|
|
||||||
);
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void convertPatchFaceField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<Type>& tf,
|
|
||||||
const label regioni
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Convert the selected pointFields
|
|
||||||
template<class Type>
|
|
||||||
void convertPointFields
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const IOobjectList& objects,
|
|
||||||
vtkDataArraySelection *fieldSelection
|
|
||||||
);
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void convertPointField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf
|
|
||||||
);
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void convertPatchPointField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<Type>& tf,
|
|
||||||
const label regioni
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Set the name of the Output vtkUnstructuredGrid
|
|
||||||
void SetName(vtkUnstructuredGrid *vtkMesh, const char* name);
|
|
||||||
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
vtkFoam(const vtkFoam&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const vtkFoam&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Static data members
|
|
||||||
|
|
||||||
ClassName("vtkFoam");
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
vtkFoam(const char* const FileName, vtkFoamReader* reader);
|
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
|
||||||
|
|
||||||
~vtkFoam();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
void UpdateInformation();
|
|
||||||
void Update();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Template Specialisations * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void vtkFoam::convertVolField
|
|
||||||
(
|
|
||||||
const GeometricField<scalar, fvPatchField, volMesh>& sf
|
|
||||||
);
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void vtkFoam::convertPatchFaceField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<scalar>& sf,
|
|
||||||
const label regioni
|
|
||||||
);
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void vtkFoam::convertPointField
|
|
||||||
(
|
|
||||||
const GeometricField<scalar, pointPatchField, pointMesh>& psf,
|
|
||||||
const GeometricField<scalar, fvPatchField, volMesh>& sf
|
|
||||||
);
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void vtkFoam::convertPatchPointField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<scalar>& sf,
|
|
||||||
const label regioni
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,299 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "vtkFoam.H"
|
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "cellModeller.H"
|
|
||||||
|
|
||||||
#include "vtkUnstructuredGrid.h"
|
|
||||||
#include "vtkCellArray.h"
|
|
||||||
|
|
||||||
#include "vtkFoamInsertNextPoint.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::vtkFoam::addInternalMesh
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
vtkUnstructuredGrid* vtkMesh
|
|
||||||
)
|
|
||||||
{
|
|
||||||
SetName(vtkMesh, "Internal Mesh");
|
|
||||||
|
|
||||||
// Number of additional points needed by the decomposition of polyhedra
|
|
||||||
label nAddPoints = 0;
|
|
||||||
|
|
||||||
// Number of additional cells generated by the decomposition of polyhedra
|
|
||||||
label nAddCells = 0;
|
|
||||||
|
|
||||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
|
||||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
|
||||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
|
||||||
const cellModel& wedge = *(cellModeller::lookup("wedge"));
|
|
||||||
const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
|
|
||||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
|
||||||
|
|
||||||
// Scan for cells which need to be decomposed and count additional points
|
|
||||||
// and cells
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "building cell-shapes" << endl;
|
|
||||||
}
|
|
||||||
const cellShapeList& cellShapes = mesh.cellShapes();
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "scanning" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(cellShapes, cellI)
|
|
||||||
{
|
|
||||||
const cellModel& model = cellShapes[cellI].model();
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
model != hex
|
|
||||||
&& model != wedge
|
|
||||||
&& model != prism
|
|
||||||
&& model != pyr
|
|
||||||
&& model != tet
|
|
||||||
&& model != tetWedge
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const cell& cFaces = mesh.cells()[cellI];
|
|
||||||
|
|
||||||
forAll(cFaces, cFaceI)
|
|
||||||
{
|
|
||||||
const face& f = mesh.faces()[cFaces[cFaceI]];
|
|
||||||
|
|
||||||
label nFacePoints = f.size();
|
|
||||||
|
|
||||||
label nQuads = (nFacePoints - 2)/2;
|
|
||||||
label nTris = (nFacePoints - 2)%2;
|
|
||||||
nAddCells += nQuads + nTris;
|
|
||||||
}
|
|
||||||
|
|
||||||
nAddCells--;
|
|
||||||
nAddPoints++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set size of additional point addressing array
|
|
||||||
// (from added point to original cell)
|
|
||||||
addPointCellLabels_.setSize(nAddPoints);
|
|
||||||
|
|
||||||
// Set size of additional cells mapping array
|
|
||||||
// (from added cell to original cell)
|
|
||||||
superCells_.setSize(mesh.nCells() + nAddCells);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "converting points" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
|
||||||
vtkpoints->Allocate(mesh.nPoints() + nAddPoints);
|
|
||||||
|
|
||||||
const Foam::pointField& points = mesh.points();
|
|
||||||
|
|
||||||
forAll(points, i)
|
|
||||||
{
|
|
||||||
vtkFoamInsertNextPoint(vtkpoints, points[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "converting cells" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkMesh->Allocate(mesh.nCells() + nAddCells);
|
|
||||||
|
|
||||||
// Set counters for additional points and additional cells
|
|
||||||
label api = 0, aci = 0;
|
|
||||||
|
|
||||||
forAll(cellShapes, celli)
|
|
||||||
{
|
|
||||||
const cellShape& cellShape = cellShapes[celli];
|
|
||||||
const cellModel& cellModel = cellShape.model();
|
|
||||||
|
|
||||||
superCells_[aci++] = celli;
|
|
||||||
|
|
||||||
if (cellModel == tet)
|
|
||||||
{
|
|
||||||
vtkMesh->InsertNextCell
|
|
||||||
(
|
|
||||||
VTK_TETRA,
|
|
||||||
4,
|
|
||||||
const_cast<int*>(cellShape.begin())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (cellModel == pyr)
|
|
||||||
{
|
|
||||||
vtkMesh->InsertNextCell
|
|
||||||
(
|
|
||||||
VTK_PYRAMID,
|
|
||||||
5,
|
|
||||||
const_cast<int*>(cellShape.begin())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (cellModel == prism)
|
|
||||||
{
|
|
||||||
vtkMesh->InsertNextCell
|
|
||||||
(
|
|
||||||
VTK_WEDGE,
|
|
||||||
6,
|
|
||||||
const_cast<int*>(cellShape.begin())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (cellModel == tetWedge)
|
|
||||||
{
|
|
||||||
// Treat as squeezed prism
|
|
||||||
|
|
||||||
int vtkVerts[6];
|
|
||||||
vtkVerts[0] = cellShape[0];
|
|
||||||
vtkVerts[1] = cellShape[2];
|
|
||||||
vtkVerts[2] = cellShape[1];
|
|
||||||
vtkVerts[3] = cellShape[3];
|
|
||||||
vtkVerts[4] = cellShape[4];
|
|
||||||
vtkVerts[5] = cellShape[4];
|
|
||||||
|
|
||||||
vtkMesh->InsertNextCell(VTK_WEDGE, 6, vtkVerts);
|
|
||||||
}
|
|
||||||
else if (cellModel == wedge)
|
|
||||||
{
|
|
||||||
// Treat as squeezed hex
|
|
||||||
|
|
||||||
int vtkVerts[8];
|
|
||||||
vtkVerts[0] = cellShape[0];
|
|
||||||
vtkVerts[1] = cellShape[1];
|
|
||||||
vtkVerts[2] = cellShape[2];
|
|
||||||
vtkVerts[3] = cellShape[2];
|
|
||||||
vtkVerts[4] = cellShape[3];
|
|
||||||
vtkVerts[5] = cellShape[4];
|
|
||||||
vtkVerts[6] = cellShape[5];
|
|
||||||
vtkVerts[7] = cellShape[6];
|
|
||||||
|
|
||||||
vtkMesh->InsertNextCell(VTK_HEXAHEDRON, 8, vtkVerts);
|
|
||||||
}
|
|
||||||
else if (cellModel == hex)
|
|
||||||
{
|
|
||||||
vtkMesh->InsertNextCell
|
|
||||||
(
|
|
||||||
VTK_HEXAHEDRON,
|
|
||||||
8,
|
|
||||||
const_cast<int*>(cellShape.begin())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Polyhedral cell. Decompose into tets + prisms.
|
|
||||||
|
|
||||||
// Mapping from additional point to cell
|
|
||||||
addPointCellLabels_[api] = celli;
|
|
||||||
|
|
||||||
// Insert the new vertex from the cell-centre
|
|
||||||
label newVertexLabel = mesh.nPoints() + api;
|
|
||||||
vtkFoamInsertNextPoint(vtkpoints, mesh.C()[celli]);
|
|
||||||
|
|
||||||
// Whether to insert cell in place of original or not.
|
|
||||||
bool substituteCell = true;
|
|
||||||
|
|
||||||
const labelList& cFaces = mesh.cells()[celli];
|
|
||||||
|
|
||||||
forAll(cFaces, cFaceI)
|
|
||||||
{
|
|
||||||
const face& f = mesh.faces()[cFaces[cFaceI]];
|
|
||||||
|
|
||||||
label nFacePoints = f.size();
|
|
||||||
|
|
||||||
label nQuads = (nFacePoints - 2)/2;
|
|
||||||
label nTris = (nFacePoints - 2)%2;
|
|
||||||
|
|
||||||
label qpi = 0;
|
|
||||||
|
|
||||||
for (label quadi=0; quadi<nQuads; quadi++)
|
|
||||||
{
|
|
||||||
label thisCellI = -1;
|
|
||||||
|
|
||||||
if (substituteCell)
|
|
||||||
{
|
|
||||||
thisCellI = celli;
|
|
||||||
substituteCell = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
thisCellI = mesh.nCells() + aci;
|
|
||||||
superCells_[aci++] = celli;
|
|
||||||
}
|
|
||||||
|
|
||||||
int addVtkVerts[5];
|
|
||||||
addVtkVerts[0] = f[0];
|
|
||||||
addVtkVerts[1] = f[qpi + 1];
|
|
||||||
addVtkVerts[2] = f[qpi + 2];
|
|
||||||
addVtkVerts[3] = f[qpi + 3];
|
|
||||||
addVtkVerts[4] = newVertexLabel;
|
|
||||||
vtkMesh->InsertNextCell(VTK_PYRAMID, 5, addVtkVerts);
|
|
||||||
|
|
||||||
qpi += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nTris)
|
|
||||||
{
|
|
||||||
label thisCellI = -1;
|
|
||||||
|
|
||||||
if (substituteCell)
|
|
||||||
{
|
|
||||||
thisCellI = celli;
|
|
||||||
substituteCell = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
thisCellI = mesh.nCells() + aci;
|
|
||||||
superCells_[aci++] = celli;
|
|
||||||
}
|
|
||||||
|
|
||||||
int addVtkVerts[4];
|
|
||||||
addVtkVerts[0] = f[0];
|
|
||||||
addVtkVerts[1] = f[qpi + 1];
|
|
||||||
addVtkVerts[2] = f[qpi + 2];
|
|
||||||
addVtkVerts[3] = newVertexLabel;
|
|
||||||
vtkMesh->InsertNextCell(VTK_TETRA, 4, addVtkVerts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
api++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkMesh->SetPoints(vtkpoints);
|
|
||||||
vtkpoints->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,115 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "vtkFoam.H"
|
|
||||||
#include "polyPatch.H"
|
|
||||||
|
|
||||||
#include "vtkUnstructuredGrid.h"
|
|
||||||
#include "vtkCellArray.h"
|
|
||||||
|
|
||||||
#include "vtkFoamInsertNextPoint.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::vtkFoam::addPatch
|
|
||||||
(
|
|
||||||
const polyPatch& p,
|
|
||||||
vtkUnstructuredGrid *vtkPatch
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Adding patch " << p.name() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetName(vtkPatch, p.name().c_str());
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "converting points" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Foam::pointField& points = p.localPoints();
|
|
||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
|
||||||
vtkpoints->Allocate(points.size());
|
|
||||||
|
|
||||||
forAll(points, i)
|
|
||||||
{
|
|
||||||
vtkFoamInsertNextPoint(vtkpoints, points[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "converting faces" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const faceList& faces = p.localFaces();
|
|
||||||
|
|
||||||
vtkPatch->Allocate(faces.size());
|
|
||||||
|
|
||||||
forAll(faces, facei)
|
|
||||||
{
|
|
||||||
const face& f = faces[facei];
|
|
||||||
|
|
||||||
if (f.size() == 3)
|
|
||||||
{
|
|
||||||
vtkPatch->InsertNextCell
|
|
||||||
(
|
|
||||||
VTK_TRIANGLE,
|
|
||||||
3,
|
|
||||||
const_cast<int*>(f.begin())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (f.size() == 4)
|
|
||||||
{
|
|
||||||
vtkPatch->InsertNextCell
|
|
||||||
(
|
|
||||||
VTK_QUAD,
|
|
||||||
4,
|
|
||||||
const_cast<int*>(f.begin())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vtkPatch->InsertNextCell
|
|
||||||
(
|
|
||||||
VTK_POLYGON,
|
|
||||||
f.size(),
|
|
||||||
const_cast<int*>(f.begin())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkPatch->SetPoints(vtkpoints);
|
|
||||||
vtkpoints->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,235 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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
|
|
||||||
|
|
||||||
InClass
|
|
||||||
Foam::vtkFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkFoamConvertFields_H
|
|
||||||
#define vtkFoamConvertFields_H
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#include "vtkFoamConvertVolField.H"
|
|
||||||
#include "vtkFoamConvertPointField.H"
|
|
||||||
|
|
||||||
#include "vtkFoamConvertPatchFaceField.H"
|
|
||||||
#include "vtkFoamConvertPatchPointField.H"
|
|
||||||
|
|
||||||
#include "emptyFvPatchField.H"
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkFoam::convertVolFields
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const volPointInterpolation& pInterp,
|
|
||||||
const IOobjectList& objects,
|
|
||||||
vtkDataArraySelection *fieldSelection
|
|
||||||
)
|
|
||||||
{
|
|
||||||
IOobjectList fieldObjects
|
|
||||||
(
|
|
||||||
objects.lookupClass
|
|
||||||
(
|
|
||||||
GeometricField<Type, fvPatchField, volMesh>::typeName
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label nSelectedFields = fieldSelection->GetNumberOfArrays();
|
|
||||||
|
|
||||||
for (label i=0; i<nSelectedFields; i++)
|
|
||||||
{
|
|
||||||
if(fieldSelection->GetArraySetting(i))
|
|
||||||
{
|
|
||||||
word fieldName = fieldSelection->GetArrayName(i);
|
|
||||||
|
|
||||||
if (fieldObjects.found(fieldName))
|
|
||||||
{
|
|
||||||
GeometricField<Type, fvPatchField, volMesh> tf
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
tmp<GeometricField<Type, pointPatchField, pointMesh> > tptf
|
|
||||||
(
|
|
||||||
pInterp.interpolate(tf)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (selectedRegions_[0])
|
|
||||||
{
|
|
||||||
convertVolField(tf);
|
|
||||||
convertPointField(tptf(), tf);
|
|
||||||
}
|
|
||||||
|
|
||||||
label regioni = 0;
|
|
||||||
forAll (mesh.boundaryMesh(), patchi)
|
|
||||||
{
|
|
||||||
if (mesh.boundaryMesh()[patchi].size())
|
|
||||||
{
|
|
||||||
regioni++;
|
|
||||||
|
|
||||||
if (selectedRegions_[regioni])
|
|
||||||
{
|
|
||||||
const fvPatchField<Type>& ptf
|
|
||||||
(
|
|
||||||
tf.boundaryField()[patchi]
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!isType<emptyFvPatchField<Type> >(ptf))
|
|
||||||
{
|
|
||||||
convertPatchFaceField
|
|
||||||
(
|
|
||||||
tf.name(),
|
|
||||||
ptf,
|
|
||||||
regioni
|
|
||||||
);
|
|
||||||
|
|
||||||
convertPatchPointField
|
|
||||||
(
|
|
||||||
tptf().name(),
|
|
||||||
tptf().boundaryField()[patchi]
|
|
||||||
.patchInternalField()(),
|
|
||||||
regioni
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fvPatch p
|
|
||||||
(
|
|
||||||
ptf.patch().patch(),
|
|
||||||
tf.mesh().boundary()
|
|
||||||
);
|
|
||||||
|
|
||||||
convertPatchFaceField
|
|
||||||
(
|
|
||||||
tf.name(),
|
|
||||||
fvPatchField<Type>(p, tf)
|
|
||||||
.patchInternalField()(),
|
|
||||||
regioni
|
|
||||||
);
|
|
||||||
|
|
||||||
convertPatchPointField
|
|
||||||
(
|
|
||||||
tptf().name(),
|
|
||||||
tptf().boundaryField()[patchi]
|
|
||||||
.patchInternalField()(),
|
|
||||||
regioni
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkFoam::convertPointFields
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const IOobjectList& objects,
|
|
||||||
vtkDataArraySelection *fieldSelection
|
|
||||||
)
|
|
||||||
{
|
|
||||||
IOobjectList fieldObjects
|
|
||||||
(
|
|
||||||
objects.lookupClass
|
|
||||||
(
|
|
||||||
GeometricField<Type, pointPatchField, pointMesh>::typeName
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label nSelectedFields = fieldSelection->GetNumberOfArrays();
|
|
||||||
|
|
||||||
for (label i=0; i<nSelectedFields; i++)
|
|
||||||
{
|
|
||||||
if(fieldSelection->GetArraySetting(i))
|
|
||||||
{
|
|
||||||
word fieldName = fieldSelection->GetArrayName(i);
|
|
||||||
|
|
||||||
if (fieldObjects.found(fieldName))
|
|
||||||
{
|
|
||||||
pointMesh pMesh(mesh);
|
|
||||||
|
|
||||||
GeometricField<Type, pointPatchField, pointMesh> ptf
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
),
|
|
||||||
pMesh
|
|
||||||
);
|
|
||||||
|
|
||||||
if (selectedRegions_[0])
|
|
||||||
{
|
|
||||||
convertPointField
|
|
||||||
(
|
|
||||||
ptf,
|
|
||||||
GeometricField<Type, fvPatchField, volMesh>::null()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
label regioni = 0;
|
|
||||||
forAll (mesh.boundaryMesh(), patchi)
|
|
||||||
{
|
|
||||||
if (mesh.boundaryMesh()[patchi].size())
|
|
||||||
{
|
|
||||||
regioni++;
|
|
||||||
|
|
||||||
if (selectedRegions_[regioni])
|
|
||||||
{
|
|
||||||
convertPatchPointField
|
|
||||||
(
|
|
||||||
ptf.name(),
|
|
||||||
ptf.boundaryField()[patchi]
|
|
||||||
.patchInternalField()(),
|
|
||||||
regioni
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,106 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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
|
|
||||||
|
|
||||||
InClass
|
|
||||||
Foam::vtkFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkFoamConvertPatchFaceField_H
|
|
||||||
#define vtkFoamConvertPatchFaceField_H
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkFoam::convertPatchFaceField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<Type>& ptf,
|
|
||||||
const label regioni
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkUnstructuredGrid *vtkMesh =
|
|
||||||
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(regioni));
|
|
||||||
|
|
||||||
vtkFloatArray *cellTypes = vtkFloatArray::New();
|
|
||||||
cellTypes->SetNumberOfTuples(ptf.size());
|
|
||||||
cellTypes->SetNumberOfComponents(Type::nComponents);
|
|
||||||
cellTypes->Allocate(Type::nComponents*ptf.size());
|
|
||||||
cellTypes->SetName(name.c_str());
|
|
||||||
|
|
||||||
float vec[Type::nComponents];
|
|
||||||
|
|
||||||
forAll(ptf, i)
|
|
||||||
{
|
|
||||||
const Type& t = ptf[i];
|
|
||||||
for (direction d=0; d<Type::nComponents; d++)
|
|
||||||
{
|
|
||||||
vec[d] = t[d];
|
|
||||||
}
|
|
||||||
|
|
||||||
cellTypes->InsertTuple(i, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkMesh->GetCellData()->AddArray(cellTypes);
|
|
||||||
cellTypes->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void Foam::vtkFoam::convertPatchFaceField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<scalar>& psf,
|
|
||||||
const label regioni
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkUnstructuredGrid *vtkMesh =
|
|
||||||
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(regioni));
|
|
||||||
|
|
||||||
vtkFloatArray *cellScalars = vtkFloatArray::New();
|
|
||||||
cellScalars->SetNumberOfTuples(psf.size());
|
|
||||||
cellScalars->SetNumberOfComponents(1);
|
|
||||||
cellScalars->Allocate(psf.size());
|
|
||||||
cellScalars->SetName(name.c_str());
|
|
||||||
|
|
||||||
forAll(psf, i)
|
|
||||||
{
|
|
||||||
cellScalars->InsertComponent(i, 0, psf[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkMesh->GetCellData()->AddArray(cellScalars);
|
|
||||||
if (!vtkMesh->GetCellData()->GetScalars())
|
|
||||||
{
|
|
||||||
vtkMesh->GetCellData()->SetScalars(cellScalars);
|
|
||||||
}
|
|
||||||
|
|
||||||
cellScalars->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,105 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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
|
|
||||||
|
|
||||||
InClass
|
|
||||||
Foam::vtkFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkFoamConvertPatchPointField_H
|
|
||||||
#define vtkFoamConvertPatchPointField_H
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkFoam::convertPatchPointField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<Type>& pptf,
|
|
||||||
const label regioni
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkUnstructuredGrid *vtkMesh =
|
|
||||||
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(regioni));
|
|
||||||
|
|
||||||
vtkFloatArray *pointTypes = vtkFloatArray::New();
|
|
||||||
pointTypes->SetNumberOfTuples(pptf.size());
|
|
||||||
pointTypes->SetNumberOfComponents(Type::nComponents);
|
|
||||||
pointTypes->Allocate(Type::nComponents*pptf.size());
|
|
||||||
pointTypes->SetName(name.c_str());
|
|
||||||
|
|
||||||
float vec[Type::nComponents];
|
|
||||||
|
|
||||||
forAll(pptf, i)
|
|
||||||
{
|
|
||||||
for (direction d=0; d<Type::nComponents; d++)
|
|
||||||
{
|
|
||||||
vec[d] = pptf[i][d];
|
|
||||||
}
|
|
||||||
|
|
||||||
pointTypes->InsertTuple(i, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkMesh->GetPointData()->AddArray(pointTypes);
|
|
||||||
pointTypes->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void Foam::vtkFoam::convertPatchPointField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<scalar>& ppsf,
|
|
||||||
const label regioni
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkUnstructuredGrid *vtkMesh =
|
|
||||||
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(regioni));
|
|
||||||
|
|
||||||
vtkFloatArray *pointScalars = vtkFloatArray::New();
|
|
||||||
pointScalars->SetNumberOfTuples(ppsf.size());
|
|
||||||
pointScalars->SetNumberOfComponents(1);
|
|
||||||
pointScalars->Allocate(ppsf.size());
|
|
||||||
pointScalars->SetName(name.c_str());
|
|
||||||
|
|
||||||
for (int i=0; i<ppsf.size(); i++)
|
|
||||||
{
|
|
||||||
pointScalars->InsertComponent(i, 0, ppsf[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkMesh->GetPointData()->AddArray(pointScalars);
|
|
||||||
if (!vtkMesh->GetPointData()->GetScalars())
|
|
||||||
{
|
|
||||||
vtkMesh->GetPointData()->SetScalars(pointScalars);
|
|
||||||
}
|
|
||||||
|
|
||||||
pointScalars->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,163 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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
|
|
||||||
|
|
||||||
InClass
|
|
||||||
Foam::vtkFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkFoamConvertPointField_H
|
|
||||||
#define vtkFoamConvertPointField_H
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#include "interpolatePointToCell.H"
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkFoam::convertPointField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkUnstructuredGrid *vtkMesh =
|
|
||||||
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0));
|
|
||||||
|
|
||||||
vtkFloatArray *pointTypes = vtkFloatArray::New();
|
|
||||||
pointTypes->SetNumberOfTuples(ptf.size() + addPointCellLabels_.size());
|
|
||||||
pointTypes->SetNumberOfComponents(Type::nComponents);
|
|
||||||
pointTypes->Allocate(Type::nComponents*ptf.size());
|
|
||||||
pointTypes->SetName(ptf.name().c_str());
|
|
||||||
|
|
||||||
float vec[Type::nComponents];
|
|
||||||
|
|
||||||
forAll(ptf, i)
|
|
||||||
{
|
|
||||||
for (direction d=0; d<Type::nComponents; d++)
|
|
||||||
{
|
|
||||||
vec[d] = ptf[i][d];
|
|
||||||
}
|
|
||||||
|
|
||||||
pointTypes->InsertTuple(i, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
label i = ptf.size();
|
|
||||||
|
|
||||||
if (&tf != &GeometricField<Type, fvPatchField, volMesh>::null())
|
|
||||||
{
|
|
||||||
forAll(addPointCellLabels_, api)
|
|
||||||
{
|
|
||||||
Type t = tf[addPointCellLabels_[api]];
|
|
||||||
|
|
||||||
for (direction d=0; d<Type::nComponents; d++)
|
|
||||||
{
|
|
||||||
vec[d] = t[d];
|
|
||||||
}
|
|
||||||
|
|
||||||
pointTypes->InsertTuple(i++, vec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(addPointCellLabels_, api)
|
|
||||||
{
|
|
||||||
Type t = interpolatePointToCell(ptf, addPointCellLabels_[api]);
|
|
||||||
|
|
||||||
for (direction d=0; d<Type::nComponents; d++)
|
|
||||||
{
|
|
||||||
vec[d] = t[d];
|
|
||||||
}
|
|
||||||
|
|
||||||
pointTypes->InsertTuple(i++, vec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkMesh->GetPointData()->AddArray(pointTypes);
|
|
||||||
pointTypes->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void Foam::vtkFoam::convertPointField
|
|
||||||
(
|
|
||||||
const GeometricField<scalar, pointPatchField, pointMesh>& psf,
|
|
||||||
const GeometricField<scalar, fvPatchField, volMesh>& sf
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkUnstructuredGrid *vtkMesh =
|
|
||||||
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0));
|
|
||||||
|
|
||||||
vtkFloatArray *pointScalars = vtkFloatArray::New();
|
|
||||||
pointScalars->SetNumberOfTuples(psf.size() + addPointCellLabels_.size());
|
|
||||||
pointScalars->SetNumberOfComponents(1);
|
|
||||||
pointScalars->Allocate(psf.size());
|
|
||||||
pointScalars->SetName(psf.name().c_str());
|
|
||||||
|
|
||||||
for (int i=0; i<psf.size(); i++)
|
|
||||||
{
|
|
||||||
pointScalars->InsertComponent(i, 0, psf[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
label i = psf.size();
|
|
||||||
|
|
||||||
if (&sf != &GeometricField<scalar, fvPatchField, volMesh>::null())
|
|
||||||
{
|
|
||||||
forAll(addPointCellLabels_, api)
|
|
||||||
{
|
|
||||||
pointScalars->InsertComponent
|
|
||||||
(
|
|
||||||
i++,
|
|
||||||
0,
|
|
||||||
sf[addPointCellLabels_[api]]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(addPointCellLabels_, api)
|
|
||||||
{
|
|
||||||
pointScalars->InsertComponent
|
|
||||||
(
|
|
||||||
i++,
|
|
||||||
0,
|
|
||||||
interpolatePointToCell(psf, addPointCellLabels_[api])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkMesh->GetPointData()->AddArray(pointScalars);
|
|
||||||
if (!vtkMesh->GetPointData()->GetScalars())
|
|
||||||
{
|
|
||||||
vtkMesh->GetPointData()->SetScalars(pointScalars);
|
|
||||||
}
|
|
||||||
|
|
||||||
pointScalars->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,102 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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
|
|
||||||
|
|
||||||
InClass
|
|
||||||
Foam::vtkFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkFoamConvertVolField_H
|
|
||||||
#define vtkFoamConvertVolField_H
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkFoam::convertVolField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkUnstructuredGrid *vtkMesh =
|
|
||||||
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0));
|
|
||||||
|
|
||||||
vtkFloatArray *cellTypes = vtkFloatArray::New();
|
|
||||||
cellTypes->SetNumberOfTuples(superCells_.size());
|
|
||||||
cellTypes->SetNumberOfComponents(Type::nComponents);
|
|
||||||
cellTypes->Allocate(Type::nComponents*tf.size());
|
|
||||||
cellTypes->SetName(tf.name().c_str());
|
|
||||||
|
|
||||||
float vec[Type::nComponents];
|
|
||||||
|
|
||||||
forAll(superCells_, sci)
|
|
||||||
{
|
|
||||||
const Type& t = tf[superCells_[sci]];
|
|
||||||
for (direction d=0; d<Type::nComponents; d++)
|
|
||||||
{
|
|
||||||
vec[d] = t[d];
|
|
||||||
}
|
|
||||||
|
|
||||||
cellTypes->InsertTuple(sci, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkMesh->GetCellData()->AddArray(cellTypes);
|
|
||||||
cellTypes->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void Foam::vtkFoam::convertVolField
|
|
||||||
(
|
|
||||||
const GeometricField<scalar, fvPatchField, volMesh>& sf
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkUnstructuredGrid *vtkMesh =
|
|
||||||
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0));
|
|
||||||
|
|
||||||
vtkFloatArray *cellScalars = vtkFloatArray::New();
|
|
||||||
cellScalars->SetNumberOfTuples(superCells_.size());
|
|
||||||
cellScalars->SetNumberOfComponents(1);
|
|
||||||
cellScalars->Allocate(sf.size());
|
|
||||||
cellScalars->SetName(sf.name().c_str());
|
|
||||||
|
|
||||||
forAll(superCells_, sci)
|
|
||||||
{
|
|
||||||
cellScalars->InsertComponent(sci, 0, sf[superCells_[sci]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkMesh->GetCellData()->AddArray(cellScalars);
|
|
||||||
if (!vtkMesh->GetCellData()->GetScalars())
|
|
||||||
{
|
|
||||||
vtkMesh->GetCellData()->SetScalars(cellScalars);
|
|
||||||
}
|
|
||||||
|
|
||||||
cellScalars->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / 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
|
|
||||||
|
|
||||||
InClass
|
|
||||||
Foam::vtkFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkFoamInsertNextPoint_H
|
|
||||||
#define vtkFoamInsertNextPoint_H
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
inline void vtkFoamInsertNextPoint
|
|
||||||
(
|
|
||||||
vtkPoints *points,
|
|
||||||
const Foam::point& p
|
|
||||||
)
|
|
||||||
{
|
|
||||||
points->InsertNextPoint(p.x(), p.y(), p.z());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -113,7 +113,16 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wordList extensiveVVFNames(IStringStream ("(momentumMean)")());
|
wordList extensiveVVFNames
|
||||||
|
(
|
||||||
|
IStringStream
|
||||||
|
(
|
||||||
|
"( \
|
||||||
|
momentumMean \
|
||||||
|
fDMean \
|
||||||
|
)"
|
||||||
|
)()
|
||||||
|
);
|
||||||
|
|
||||||
PtrList<volVectorField> extensiveVVFs(extensiveVVFNames.size());
|
PtrList<volVectorField> extensiveVVFs(extensiveVVFNames.size());
|
||||||
|
|
||||||
|
|||||||
@ -44,9 +44,21 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
IOdictionary dsmcInitialiseDict
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"dsmcInitialiseDict",
|
||||||
|
mesh.time().system(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
Info<< "Initialising dsmc for Time = " << runTime.timeName() << nl << endl;
|
Info<< "Initialising dsmc for Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
dsmcCloud dsmc("dsmc", mesh);
|
dsmcCloud dsmc("dsmc", mesh, dsmcInitialiseDict);
|
||||||
|
|
||||||
label totalMolecules = dsmc.size();
|
label totalMolecules = dsmc.size();
|
||||||
|
|
||||||
|
|||||||
@ -377,6 +377,7 @@ DebugSwitches
|
|||||||
displacementLaplacian 0;
|
displacementLaplacian 0;
|
||||||
displacementSBRStress 0;
|
displacementSBRStress 0;
|
||||||
distanceSurface 0;
|
distanceSurface 0;
|
||||||
|
distribution 0;
|
||||||
downwind 0;
|
downwind 0;
|
||||||
dragModel 0;
|
dragModel 0;
|
||||||
duplicatePoints 0;
|
duplicatePoints 0;
|
||||||
|
|||||||
@ -105,7 +105,7 @@ template<class Key, class Hash>
|
|||||||
void Foam::HashSet<Key, Hash>::operator&=(const HashSet<Key, Hash>& rhs)
|
void Foam::HashSet<Key, Hash>::operator&=(const HashSet<Key, Hash>& rhs)
|
||||||
{
|
{
|
||||||
// Remove elements not also found in rhs
|
// Remove elements not also found in rhs
|
||||||
for (iterator iter = this->cbegin(); iter != this->cend(); ++iter)
|
for (iterator iter = this->begin(); iter != this->end(); ++iter)
|
||||||
{
|
{
|
||||||
if (!rhs.found(iter.key()))
|
if (!rhs.found(iter.key()))
|
||||||
{
|
{
|
||||||
@ -145,8 +145,6 @@ void Foam::HashSet<Key, Hash>::operator-=(const HashSet<Key, Hash>& rhs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
|
||||||
|
|
||||||
template<class Key, class Hash>
|
template<class Key, class Hash>
|
||||||
|
|||||||
@ -235,12 +235,12 @@ void Foam::Matrix<Form, Type>::operator=(const Matrix<Form, Type>& a)
|
|||||||
template<class Form, class Type>
|
template<class Form, class Type>
|
||||||
const Type& Foam::max(const Matrix<Form, Type>& a)
|
const Type& Foam::max(const Matrix<Form, Type>& a)
|
||||||
{
|
{
|
||||||
label nm = a.n_*a.m_;
|
label nm = a.n()*a.m();
|
||||||
|
|
||||||
if (nm)
|
if (nm)
|
||||||
{
|
{
|
||||||
label curMaxI = 0;
|
label curMaxI = 0;
|
||||||
const Type* v = a.v_[0];
|
const Type* v = a[0];
|
||||||
|
|
||||||
for (register label i=1; i<nm; i++)
|
for (register label i=1; i<nm; i++)
|
||||||
{
|
{
|
||||||
@ -267,12 +267,12 @@ const Type& Foam::max(const Matrix<Form, Type>& a)
|
|||||||
template<class Form, class Type>
|
template<class Form, class Type>
|
||||||
const Type& Foam::min(const Matrix<Form, Type>& a)
|
const Type& Foam::min(const Matrix<Form, Type>& a)
|
||||||
{
|
{
|
||||||
label nm = a.n_*a.m_;
|
label nm = a.n()*a.m();
|
||||||
|
|
||||||
if (nm)
|
if (nm)
|
||||||
{
|
{
|
||||||
label curMinI = 0;
|
label curMinI = 0;
|
||||||
const Type* v = a.v_[0];
|
const Type* v = a[0];
|
||||||
|
|
||||||
for (register label i=1; i<nm; i++)
|
for (register label i=1; i<nm; i++)
|
||||||
{
|
{
|
||||||
@ -301,14 +301,14 @@ const Type& Foam::min(const Matrix<Form, Type>& a)
|
|||||||
template<class Form, class Type>
|
template<class Form, class Type>
|
||||||
Form Foam::operator-(const Matrix<Form, Type>& a)
|
Form Foam::operator-(const Matrix<Form, Type>& a)
|
||||||
{
|
{
|
||||||
Form na(a.n_, a.m_);
|
Form na(a.n(), a.m());
|
||||||
|
|
||||||
if (a.n_ && a.m_)
|
if (a.n() && a.m())
|
||||||
{
|
{
|
||||||
Type* nav = na.v_[0];
|
Type* nav = na[0];
|
||||||
const Type* av = a.v_[0];
|
const Type* av = a[0];
|
||||||
|
|
||||||
label nm = a.n_*a.m_;
|
label nm = a.n()*a.m();
|
||||||
for (register label i=0; i<nm; i++)
|
for (register label i=0; i<nm; i++)
|
||||||
{
|
{
|
||||||
nav[i] = -av[i];
|
nav[i] = -av[i];
|
||||||
@ -322,33 +322,33 @@ Form Foam::operator-(const Matrix<Form, Type>& a)
|
|||||||
template<class Form, class Type>
|
template<class Form, class Type>
|
||||||
Form Foam::operator+(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
|
Form Foam::operator+(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
|
||||||
{
|
{
|
||||||
if (a.n_ != b.n_)
|
if (a.n() != b.n())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Matrix<Form, Type>::operator+(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
|
"Matrix<Form, Type>::operator+(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
|
||||||
) << "attempted add matrices with different number of rows: "
|
) << "attempted add matrices with different number of rows: "
|
||||||
<< a.n_ << ", " << b.n_
|
<< a.n() << ", " << b.n()
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.m_ != b.m_)
|
if (a.m() != b.m())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Matrix<Form, Type>::operator+(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
|
"Matrix<Form, Type>::operator+(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
|
||||||
) << "attempted add matrices with different number of columns: "
|
) << "attempted add matrices with different number of columns: "
|
||||||
<< a.m_ << ", " << b.m_
|
<< a.m() << ", " << b.m()
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
Form ab(a.n_, a.m_);
|
Form ab(a.n(), a.m());
|
||||||
|
|
||||||
Type* abv = ab.v_[0];
|
Type* abv = ab[0];
|
||||||
const Type* av = a.v_[0];
|
const Type* av = a[0];
|
||||||
const Type* bv = b.v_[0];
|
const Type* bv = b[0];
|
||||||
|
|
||||||
label nm = a.n_*a.m_;
|
label nm = a.n()*a.m();
|
||||||
for (register label i=0; i<nm; i++)
|
for (register label i=0; i<nm; i++)
|
||||||
{
|
{
|
||||||
abv[i] = av[i] + bv[i];
|
abv[i] = av[i] + bv[i];
|
||||||
@ -361,33 +361,33 @@ Form Foam::operator+(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
|
|||||||
template<class Form, class Type>
|
template<class Form, class Type>
|
||||||
Form Foam::operator-(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
|
Form Foam::operator-(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
|
||||||
{
|
{
|
||||||
if (a.n_ != b.n_)
|
if (a.n() != b.n())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Matrix<Form, Type>::operator-(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
|
"Matrix<Form, Type>::operator-(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
|
||||||
) << "attempted add matrices with different number of rows: "
|
) << "attempted add matrices with different number of rows: "
|
||||||
<< a.n_ << ", " << b.n_
|
<< a.n() << ", " << b.n()
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.m_ != b.m_)
|
if (a.m() != b.m())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Matrix<Form, Type>::operator-(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
|
"Matrix<Form, Type>::operator-(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
|
||||||
) << "attempted add matrices with different number of columns: "
|
) << "attempted add matrices with different number of columns: "
|
||||||
<< a.m_ << ", " << b.m_
|
<< a.m() << ", " << b.m()
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
Form ab(a.n_, a.m_);
|
Form ab(a.n(), a.m());
|
||||||
|
|
||||||
Type* abv = ab.v_[0];
|
Type* abv = ab[0];
|
||||||
const Type* av = a.v_[0];
|
const Type* av = a[0];
|
||||||
const Type* bv = b.v_[0];
|
const Type* bv = b[0];
|
||||||
|
|
||||||
label nm = a.n_*a.m_;
|
label nm = a.n()*a.m();
|
||||||
for (register label i=0; i<nm; i++)
|
for (register label i=0; i<nm; i++)
|
||||||
{
|
{
|
||||||
abv[i] = av[i] - bv[i];
|
abv[i] = av[i] - bv[i];
|
||||||
@ -400,14 +400,14 @@ Form Foam::operator-(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
|
|||||||
template<class Form, class Type>
|
template<class Form, class Type>
|
||||||
Form Foam::operator*(const scalar s, const Matrix<Form, Type>& a)
|
Form Foam::operator*(const scalar s, const Matrix<Form, Type>& a)
|
||||||
{
|
{
|
||||||
Form sa(a.n_, a.m_);
|
Form sa(a.n(), a.m());
|
||||||
|
|
||||||
if (a.n_ && a.m_)
|
if (a.n() && a.m())
|
||||||
{
|
{
|
||||||
Type* sav = sa.v_[0];
|
Type* sav = sa[0];
|
||||||
const Type* av = a.v_[0];
|
const Type* av = a[0];
|
||||||
|
|
||||||
label nm = a.n_*a.m_;
|
label nm = a.n()*a.m();
|
||||||
for (register label i=0; i<nm; i++)
|
for (register label i=0; i<nm; i++)
|
||||||
{
|
{
|
||||||
sav[i] = s*av[i];
|
sav[i] = s*av[i];
|
||||||
|
|||||||
@ -161,10 +161,10 @@ public:
|
|||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
//- Return subscript-checked element of Matrix.
|
//- Return subscript-checked row of Matrix.
|
||||||
inline Type* operator[](const label);
|
inline Type* operator[](const label);
|
||||||
|
|
||||||
//- Return subscript-checked element of constant Matrix.
|
//- Return subscript-checked row of constant Matrix.
|
||||||
inline const Type* operator[](const label) const;
|
inline const Type* operator[](const label) const;
|
||||||
|
|
||||||
//- Assignment operator. Takes linear time.
|
//- Assignment operator. Takes linear time.
|
||||||
|
|||||||
@ -177,7 +177,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
|||||||
{
|
{
|
||||||
if (Pstream::debug)
|
if (Pstream::debug)
|
||||||
{
|
{
|
||||||
Pout<< "UPstream::reduce : value:" << Value << endl;
|
Pout<< "Foam::reduce : value:" << Value << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UPstream::parRun())
|
if (!UPstream::parRun())
|
||||||
@ -452,7 +452,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
|||||||
|
|
||||||
if (Pstream::debug)
|
if (Pstream::debug)
|
||||||
{
|
{
|
||||||
Pout<< "UPstream::reduce : reduced value:" << Value << endl;
|
Pout<< "Foam::reduce : reduced value:" << Value << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -122,6 +122,7 @@ $(derivedFvPatchFields)/inletOutletTotalTemperature/inletOutletTotalTemperatureF
|
|||||||
$(derivedFvPatchFields)/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C
|
$(derivedFvPatchFields)/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/movingWallVelocity/movingWallVelocityFvPatchVectorField.C
|
$(derivedFvPatchFields)/movingWallVelocity/movingWallVelocityFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C
|
$(derivedFvPatchFields)/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C
|
||||||
|
$(derivedFvPatchFields)/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/oscillatingFixedValue/oscillatingFixedValueFvPatchFields.C
|
$(derivedFvPatchFields)/oscillatingFixedValue/oscillatingFixedValueFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/outletInlet/outletInletFvPatchFields.C
|
$(derivedFvPatchFields)/outletInlet/outletInletFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/partialSlip/partialSlipFvPatchFields.C
|
$(derivedFvPatchFields)/partialSlip/partialSlipFvPatchFields.C
|
||||||
|
|||||||
@ -4,9 +4,6 @@ parcels/derived/dsmcParcel/dsmcParcel.C
|
|||||||
/* Cloud base classes */
|
/* Cloud base classes */
|
||||||
clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.C
|
clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.C
|
||||||
|
|
||||||
/* Clouds */
|
|
||||||
clouds/derived/dsmcCloud/dsmcCloud.C
|
|
||||||
|
|
||||||
/* submodels */
|
/* submodels */
|
||||||
parcels/derived/dsmcParcel/defineDsmcParcel.C
|
parcels/derived/dsmcParcel/defineDsmcParcel.C
|
||||||
parcels/derived/dsmcParcel/makeDsmcParcelBinaryCollisionModels.C
|
parcels/derived/dsmcParcel/makeDsmcParcelBinaryCollisionModels.C
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-lfiniteVolume
|
-lfiniteVolume \
|
||||||
|
-lmeshTools
|
||||||
|
|||||||
@ -297,7 +297,7 @@ void Foam::DsmcCloud<ParcelType>::collisions()
|
|||||||
// Temporary storage for subCells
|
// Temporary storage for subCells
|
||||||
List<DynamicList<label> > subCells(8);
|
List<DynamicList<label> > subCells(8);
|
||||||
|
|
||||||
scalar deltaT = cachedDeltaT();
|
scalar deltaT = mesh().time().deltaTValue();
|
||||||
|
|
||||||
label collisionCandidates = 0;
|
label collisionCandidates = 0;
|
||||||
|
|
||||||
@ -473,21 +473,92 @@ void Foam::DsmcCloud<ParcelType>::collisions()
|
|||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
void Foam::DsmcCloud<ParcelType>::resetSurfaceDataFields()
|
void Foam::DsmcCloud<ParcelType>::resetFields()
|
||||||
{
|
{
|
||||||
volScalarField::GeometricBoundaryField& qBF(q_.boundaryField());
|
q_ = dimensionedScalar("zero", dimensionSet(1, 0, -3, 0, 0), 0.0);
|
||||||
|
|
||||||
forAll(qBF, p)
|
fD_ = dimensionedVector
|
||||||
|
(
|
||||||
|
"zero",
|
||||||
|
dimensionSet(1, -1, -2, 0, 0),
|
||||||
|
vector::zero
|
||||||
|
);
|
||||||
|
|
||||||
|
rhoN_ = dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL);
|
||||||
|
|
||||||
|
rhoM_ = dimensionedScalar("zero", dimensionSet(1, -3, 0, 0, 0), VSMALL);
|
||||||
|
|
||||||
|
dsmcRhoN_ = dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), 0.0);
|
||||||
|
|
||||||
|
linearKE_ = dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0);
|
||||||
|
|
||||||
|
internalE_ = dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0);
|
||||||
|
|
||||||
|
iDof_ = dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL);
|
||||||
|
|
||||||
|
momentum_ = dimensionedVector
|
||||||
|
(
|
||||||
|
"zero",
|
||||||
|
dimensionSet(1, -2, -1, 0, 0),
|
||||||
|
vector::zero
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
void Foam::DsmcCloud<ParcelType>::calculateFields()
|
||||||
|
{
|
||||||
|
scalarField& rhoN = rhoN_.internalField();
|
||||||
|
|
||||||
|
scalarField& rhoM = rhoM_.internalField();
|
||||||
|
|
||||||
|
scalarField& dsmcRhoN = dsmcRhoN_.internalField();
|
||||||
|
|
||||||
|
scalarField& linearKE = linearKE_.internalField();
|
||||||
|
|
||||||
|
scalarField& internalE = internalE_.internalField();
|
||||||
|
|
||||||
|
scalarField& iDof = iDof_.internalField();
|
||||||
|
|
||||||
|
vectorField& momentum = momentum_.internalField();
|
||||||
|
|
||||||
|
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
||||||
{
|
{
|
||||||
qBF[p] = 0.0;
|
const ParcelType& p = iter();
|
||||||
|
const label cellI = p.cell();
|
||||||
|
|
||||||
|
rhoN[cellI]++;
|
||||||
|
|
||||||
|
rhoM[cellI] += constProps(p.typeId()).mass();
|
||||||
|
|
||||||
|
dsmcRhoN[cellI]++;
|
||||||
|
|
||||||
|
linearKE[cellI] += 0.5*constProps(p.typeId()).mass()*(p.U() & p.U());
|
||||||
|
|
||||||
|
internalE[cellI] += p.Ei();
|
||||||
|
|
||||||
|
iDof[cellI] += constProps(p.typeId()).internalDegreesOfFreedom();
|
||||||
|
|
||||||
|
momentum[cellI] += constProps(p.typeId()).mass()*p.U();
|
||||||
}
|
}
|
||||||
|
|
||||||
volVectorField::GeometricBoundaryField& fDBF(fD_.boundaryField());
|
rhoN *= nParticle_/mesh().cellVolumes();
|
||||||
|
rhoN_.correctBoundaryConditions();
|
||||||
|
|
||||||
forAll(fDBF, p)
|
rhoM *= nParticle_/mesh().cellVolumes();
|
||||||
{
|
rhoM_.correctBoundaryConditions();
|
||||||
fDBF[p] = vector::zero;
|
|
||||||
}
|
linearKE *= nParticle_/mesh().cellVolumes();
|
||||||
|
linearKE_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
internalE *= nParticle_/mesh().cellVolumes();
|
||||||
|
internalE_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
iDof *= nParticle_/mesh().cellVolumes();
|
||||||
|
iDof_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
momentum *= nParticle_/mesh().cellVolumes();
|
||||||
|
momentum_.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -523,15 +594,14 @@ template<class ParcelType>
|
|||||||
Foam::DsmcCloud<ParcelType>::DsmcCloud
|
Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||||
(
|
(
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const volScalarField& T,
|
const fvMesh& mesh,
|
||||||
const volVectorField& U,
|
|
||||||
bool readFields
|
bool readFields
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Cloud<ParcelType>(T.mesh(), cloudName, false),
|
Cloud<ParcelType>(mesh, cloudName, false),
|
||||||
DsmcBaseCloud(),
|
DsmcBaseCloud(),
|
||||||
cloudName_(cloudName),
|
cloudName_(cloudName),
|
||||||
mesh_(T.mesh()),
|
mesh_(mesh),
|
||||||
particleProperties_
|
particleProperties_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -563,37 +633,142 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
this->name() + "q_",
|
"q",
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
mesh_,
|
mesh_
|
||||||
dimensionedScalar("zero", dimensionSet(1, 0, -3, 0, 0), 0.0)
|
|
||||||
),
|
),
|
||||||
fD_
|
fD_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
this->name() + "fD_",
|
"fD",
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
mesh_,
|
mesh_
|
||||||
dimensionedVector
|
),
|
||||||
|
rhoN_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
(
|
(
|
||||||
"zero",
|
"rhoN",
|
||||||
dimensionSet(1, -1, -2, 0, 0),
|
mesh_.time().timeName(),
|
||||||
vector::zero
|
mesh_,
|
||||||
)
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
rhoM_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhoM",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
dsmcRhoN_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"dsmcRhoN",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
linearKE_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"linearKE",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
internalE_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"internalE",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
iDof_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"iDof",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
momentum_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"momentum",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
),
|
),
|
||||||
constProps_(),
|
constProps_(),
|
||||||
rndGen_(label(149382906) + 7183*Pstream::myProcNo()),
|
rndGen_(label(149382906) + 7183*Pstream::myProcNo()),
|
||||||
T_(T),
|
boundaryT_
|
||||||
U_(U),
|
(
|
||||||
|
volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"boundaryT",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
|
),
|
||||||
|
boundaryU_
|
||||||
|
(
|
||||||
|
volVectorField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"boundaryU",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
|
),
|
||||||
binaryCollisionModel_
|
binaryCollisionModel_
|
||||||
(
|
(
|
||||||
BinaryCollisionModel<DsmcCloud<ParcelType> >::New
|
BinaryCollisionModel<DsmcCloud<ParcelType> >::New
|
||||||
@ -641,7 +816,8 @@ template<class ParcelType>
|
|||||||
Foam::DsmcCloud<ParcelType>::DsmcCloud
|
Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||||
(
|
(
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const fvMesh& mesh
|
const fvMesh& mesh,
|
||||||
|
const IOdictionary& dsmcInitialiseDict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Cloud<ParcelType>(mesh, cloudName, false),
|
Cloud<ParcelType>(mesh, cloudName, false),
|
||||||
@ -707,15 +883,111 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
|||||||
vector::zero
|
vector::zero
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
rhoN_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "rhoN_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL)
|
||||||
|
),
|
||||||
|
rhoM_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "rhoM_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(1, -3, 0, 0, 0), VSMALL)
|
||||||
|
),
|
||||||
|
dsmcRhoN_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "dsmcRhoN_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), 0.0)
|
||||||
|
),
|
||||||
|
linearKE_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "linearKE_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
|
||||||
|
),
|
||||||
|
internalE_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "internalE_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
|
||||||
|
),
|
||||||
|
iDof_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "iDof_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL)
|
||||||
|
),
|
||||||
|
momentum_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "momentum_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedVector
|
||||||
|
(
|
||||||
|
"zero",
|
||||||
|
dimensionSet(1, -2, -1, 0, 0),
|
||||||
|
vector::zero
|
||||||
|
)
|
||||||
|
),
|
||||||
constProps_(),
|
constProps_(),
|
||||||
rndGen_(label(971501) + 1526*Pstream::myProcNo()),
|
rndGen_(label(971501) + 1526*Pstream::myProcNo()),
|
||||||
T_
|
boundaryT_
|
||||||
(
|
(
|
||||||
volScalarField
|
volScalarField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"T",
|
"boundaryT",
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -725,13 +997,13 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
|||||||
dimensionedScalar("zero", dimensionSet(0, 0, 0, 1, 0), 0.0)
|
dimensionedScalar("zero", dimensionSet(0, 0, 0, 1, 0), 0.0)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
U_
|
boundaryU_
|
||||||
(
|
(
|
||||||
volVectorField
|
volVectorField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"U",
|
"boundaryU",
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -754,18 +1026,6 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
|||||||
|
|
||||||
buildConstProps();
|
buildConstProps();
|
||||||
|
|
||||||
IOdictionary dsmcInitialiseDict
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"dsmcInitialiseDict",
|
|
||||||
mesh_.time().system(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
initialise(dsmcInitialiseDict);
|
initialise(dsmcInitialiseDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,13 +1042,10 @@ Foam::DsmcCloud<ParcelType>::~DsmcCloud()
|
|||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
void Foam::DsmcCloud<ParcelType>::evolve()
|
void Foam::DsmcCloud<ParcelType>::evolve()
|
||||||
{
|
{
|
||||||
// cache the value of deltaT for this timestep
|
|
||||||
storeDeltaT();
|
|
||||||
|
|
||||||
typename ParcelType::trackData td(*this);
|
typename ParcelType::trackData td(*this);
|
||||||
|
|
||||||
// Reset the surface data collection fields
|
// Reset the data collection fields
|
||||||
resetSurfaceDataFields();
|
resetFields();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -803,6 +1060,9 @@ void Foam::DsmcCloud<ParcelType>::evolve()
|
|||||||
|
|
||||||
// Calculate new velocities via stochastic collisions
|
// Calculate new velocities via stochastic collisions
|
||||||
collisions();
|
collisions();
|
||||||
|
|
||||||
|
// Calculate the volume field data
|
||||||
|
calculateFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -110,24 +110,41 @@ class DsmcCloud
|
|||||||
//- Force density at surface field
|
//- Force density at surface field
|
||||||
volVectorField fD_;
|
volVectorField fD_;
|
||||||
|
|
||||||
|
//- number density field
|
||||||
|
volScalarField rhoN_;
|
||||||
|
|
||||||
|
//- Mass density field
|
||||||
|
volScalarField rhoM_;
|
||||||
|
|
||||||
|
//- dsmc particle density field
|
||||||
|
volScalarField dsmcRhoN_;
|
||||||
|
|
||||||
|
//- linear kinetic energy density field
|
||||||
|
volScalarField linearKE_;
|
||||||
|
|
||||||
|
//- Internal energy density field
|
||||||
|
volScalarField internalE_;
|
||||||
|
|
||||||
|
// Internal degree of freedom density field
|
||||||
|
volScalarField iDof_;
|
||||||
|
|
||||||
|
//- Momentum density field
|
||||||
|
volVectorField momentum_;
|
||||||
|
|
||||||
//- Parcel constant properties - one for each type
|
//- Parcel constant properties - one for each type
|
||||||
List<typename ParcelType::constantProperties> constProps_;
|
List<typename ParcelType::constantProperties> constProps_;
|
||||||
|
|
||||||
//- Random number generator
|
//- Random number generator
|
||||||
Random rndGen_;
|
Random rndGen_;
|
||||||
|
|
||||||
//- In-cloud cache of deltaT, lookup in submodels and parcel is
|
|
||||||
// expensive
|
|
||||||
scalar cachedDeltaT_;
|
|
||||||
|
|
||||||
|
// boundary value fields
|
||||||
|
|
||||||
// References to the macroscopic fields
|
//- boundary temperature
|
||||||
|
volScalarField boundaryT_;
|
||||||
|
|
||||||
//- Temperature
|
//- boundary velocity
|
||||||
const volScalarField& T_;
|
volVectorField boundaryU_;
|
||||||
|
|
||||||
//- Velocity
|
|
||||||
const volVectorField& U_;
|
|
||||||
|
|
||||||
|
|
||||||
// References to the cloud sub-models
|
// References to the cloud sub-models
|
||||||
@ -159,8 +176,11 @@ class DsmcCloud
|
|||||||
//- Calculate collisions between molecules
|
//- Calculate collisions between molecules
|
||||||
void collisions();
|
void collisions();
|
||||||
|
|
||||||
//- Reset the surface data accumulation field values
|
//- Reset the data accumulation field values to zero
|
||||||
void resetSurfaceDataFields();
|
void resetFields();
|
||||||
|
|
||||||
|
//- Calculate the volume field data
|
||||||
|
void calculateFields();
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
DsmcCloud(const DsmcCloud&);
|
DsmcCloud(const DsmcCloud&);
|
||||||
@ -173,20 +193,21 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct given name and mesh, will read Parcels from file
|
//- Construct given name and mesh, will read Parcels and fields from
|
||||||
|
// file
|
||||||
DsmcCloud
|
DsmcCloud
|
||||||
(
|
(
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const volScalarField& T,
|
const fvMesh& mesh,
|
||||||
const volVectorField& U,
|
|
||||||
bool readFields = true
|
bool readFields = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct given name and mesh. Used to initialise.
|
//- Construct given name, mesh and initialisation dictionary.
|
||||||
DsmcCloud
|
DsmcCloud
|
||||||
(
|
(
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const fvMesh& mesh
|
const fvMesh& mesh,
|
||||||
|
const IOdictionary& dsmcInitialiseDict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -242,35 +263,72 @@ public:
|
|||||||
//- Return refernce to the random object
|
//- Return refernce to the random object
|
||||||
inline Random& rndGen();
|
inline Random& rndGen();
|
||||||
|
|
||||||
//- Store (cache) the current value of deltaT
|
|
||||||
inline void storeDeltaT();
|
|
||||||
|
|
||||||
//- Return the cached value of deltaT
|
// References to the boundary fields for surface data collection
|
||||||
inline scalar cachedDeltaT() const;
|
|
||||||
|
|
||||||
|
//- Return non-const heat flux boundary field reference
|
||||||
|
inline volScalarField::GeometricBoundaryField& qBF();
|
||||||
|
|
||||||
// References to the surface data collection fields
|
//- Return non-const force density at boundary field reference
|
||||||
|
inline volVectorField::GeometricBoundaryField& fDBF();
|
||||||
|
|
||||||
//- Return heat flux at surface field
|
//- Return non-const number density boundary field reference
|
||||||
inline const volScalarField& q() const;
|
inline volScalarField::GeometricBoundaryField& rhoNBF();
|
||||||
|
|
||||||
//- Return non-const heat flux at surface field
|
//- Return non-const mass density boundary field reference
|
||||||
inline volScalarField& q();
|
inline volScalarField::GeometricBoundaryField& rhoMBF();
|
||||||
|
|
||||||
//- Return force density at surface field
|
//- Return non-const linear kinetic energy density boundary
|
||||||
inline const volVectorField& fD() const;
|
// field reference
|
||||||
|
inline volScalarField::GeometricBoundaryField& linearKEBF();
|
||||||
|
|
||||||
//- Return non-const force density at surface field
|
//- Return non-const internal energy density boundary field
|
||||||
inline volVectorField& fD();
|
// reference
|
||||||
|
inline volScalarField::GeometricBoundaryField& internalEBF();
|
||||||
|
|
||||||
|
//- Return non-const internal degree of freedom density boundary
|
||||||
|
// field reference
|
||||||
|
inline volScalarField::GeometricBoundaryField& iDofBF();
|
||||||
|
|
||||||
|
//- Return non-const momentum density boundary field reference
|
||||||
|
inline volVectorField::GeometricBoundaryField& momentumBF();
|
||||||
|
|
||||||
|
|
||||||
// References to the macroscopic fields
|
// References to the macroscopic fields
|
||||||
|
|
||||||
//- Return macroscopic temperature
|
//- Return macroscopic temperature
|
||||||
inline const volScalarField& T() const;
|
inline const volScalarField& boundaryT() const;
|
||||||
|
|
||||||
//- Return macroscopic velocity
|
//- Return macroscopic velocity
|
||||||
inline const volVectorField& U() const;
|
inline const volVectorField& boundaryU() const;
|
||||||
|
|
||||||
|
//- Return heat flux at surface field
|
||||||
|
inline const volScalarField& q() const;
|
||||||
|
|
||||||
|
//- Return force density at surface field
|
||||||
|
inline const volVectorField& fD() const;
|
||||||
|
|
||||||
|
//- Return the real particle number density field
|
||||||
|
inline const volScalarField& rhoN() const;
|
||||||
|
|
||||||
|
//- Return the particle mass density field
|
||||||
|
inline const volScalarField& rhoM() const;
|
||||||
|
|
||||||
|
//- Return the field of number of DSMC particles
|
||||||
|
inline const volScalarField& dsmcRhoN() const;
|
||||||
|
|
||||||
|
//- Return the total linear kinetic energy (translational and
|
||||||
|
// thermal density field
|
||||||
|
inline const volScalarField& linearKE() const;
|
||||||
|
|
||||||
|
//- Return the internal energy density field
|
||||||
|
inline const volScalarField& internalE() const;
|
||||||
|
|
||||||
|
//- Return the average internal degrees of freedom field
|
||||||
|
inline const volScalarField& iDof() const;
|
||||||
|
|
||||||
|
//- Return the momentum density field
|
||||||
|
inline const volVectorField& momentum() const;
|
||||||
|
|
||||||
|
|
||||||
// Kinetic theory helper functions
|
// Kinetic theory helper functions
|
||||||
@ -385,29 +443,6 @@ public:
|
|||||||
void dumpParticlePositions() const;
|
void dumpParticlePositions() const;
|
||||||
|
|
||||||
|
|
||||||
// Fields
|
|
||||||
|
|
||||||
//- Return the real particle number density field
|
|
||||||
inline const tmp<volScalarField> rhoN() const;
|
|
||||||
|
|
||||||
//- Return the particle mass density field
|
|
||||||
inline const tmp<volScalarField> rhoM() const;
|
|
||||||
|
|
||||||
//- Return the field of number of DSMC particles
|
|
||||||
inline const tmp<volScalarField> dsmcRhoN() const;
|
|
||||||
|
|
||||||
//- Return the momentum density field
|
|
||||||
inline const tmp<volVectorField> momentum() const;
|
|
||||||
|
|
||||||
//- Return the total linear kinetic energy (translational and
|
|
||||||
// thermal density field
|
|
||||||
inline const tmp<volScalarField> linearKE() const;
|
|
||||||
|
|
||||||
//- Return the internal energy density field
|
|
||||||
inline const tmp<volScalarField> internalE() const;
|
|
||||||
|
|
||||||
//- Return the average internal degrees of freedom field
|
|
||||||
inline const tmp<volScalarField> iDof() const;
|
|
||||||
|
|
||||||
|
|
||||||
// Cloud evolution functions
|
// Cloud evolution functions
|
||||||
|
|||||||
@ -126,58 +126,82 @@ inline Foam::Random& Foam::DsmcCloud<ParcelType>::rndGen()
|
|||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline void Foam::DsmcCloud<ParcelType>::storeDeltaT()
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::qBF()
|
||||||
{
|
{
|
||||||
cachedDeltaT_ = mesh().time().deltaTValue();
|
return q_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline Foam::scalar Foam::DsmcCloud<ParcelType>::cachedDeltaT() const
|
inline Foam::volVectorField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::fDBF()
|
||||||
{
|
{
|
||||||
return cachedDeltaT_;
|
return fD_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::q() const
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::rhoNBF()
|
||||||
{
|
{
|
||||||
return q_;
|
return rhoN_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline Foam::volScalarField& Foam::DsmcCloud<ParcelType>::q()
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::rhoMBF()
|
||||||
{
|
{
|
||||||
return q_;
|
return rhoM_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::fD() const
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::linearKEBF()
|
||||||
{
|
{
|
||||||
return fD_;
|
return linearKE_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline Foam::volVectorField& Foam::DsmcCloud<ParcelType>::fD()
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::internalEBF()
|
||||||
{
|
{
|
||||||
return fD_;
|
return internalE_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::T() const
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::iDofBF()
|
||||||
{
|
{
|
||||||
return T_;
|
return iDof_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::U() const
|
inline Foam::volVectorField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::momentumBF()
|
||||||
{
|
{
|
||||||
return U_;
|
return momentum_.boundaryField();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
inline const Foam::volScalarField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::boundaryT() const
|
||||||
|
{
|
||||||
|
return boundaryT_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
inline const Foam::volVectorField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::boundaryU() const
|
||||||
|
{
|
||||||
|
return boundaryU_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -381,265 +405,70 @@ Foam::DsmcCloud<ParcelType>::maxwellianMostProbableSpeed
|
|||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::q() const
|
||||||
|
{
|
||||||
|
return q_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::fD() const
|
||||||
|
{
|
||||||
|
return fD_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
inline const Foam::volScalarField&
|
||||||
Foam::DsmcCloud<ParcelType>::rhoN() const
|
Foam::DsmcCloud<ParcelType>::rhoN() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> trhoN
|
return rhoN_;
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "rhoN",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& rhoN = trhoN().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
rhoN[cellI]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
rhoN *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return trhoN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::rhoM() const
|
||||||
Foam::DsmcCloud<ParcelType>::rhoM() const
|
|
||||||
{
|
{
|
||||||
tmp<volScalarField> trhoM
|
return rhoM_;
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "rhoM",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(1, -3, 0, 0, 0), VSMALL)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& rhoM = trhoM().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
rhoM[cellI] += constProps(p.typeId()).mass();
|
|
||||||
}
|
|
||||||
|
|
||||||
rhoM *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return trhoM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
inline const Foam::volScalarField&
|
||||||
Foam::DsmcCloud<ParcelType>::dsmcRhoN() const
|
Foam::DsmcCloud<ParcelType>::dsmcRhoN() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tdsmcRhoN
|
return dsmcRhoN_;
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "dsmcRhoN",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), 0.0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& dsmcRhoN = tdsmcRhoN().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
dsmcRhoN[cellI]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tdsmcRhoN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volVectorField>
|
inline const Foam::volScalarField&
|
||||||
Foam::DsmcCloud<ParcelType>::momentum() const
|
|
||||||
{
|
|
||||||
tmp<volVectorField> tmomentum
|
|
||||||
(
|
|
||||||
new volVectorField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "momentum",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedVector
|
|
||||||
(
|
|
||||||
"zero",
|
|
||||||
dimensionSet(1, -2, -1, 0, 0),
|
|
||||||
vector::zero
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
vectorField& momentum = tmomentum().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
momentum[cellI] += constProps(p.typeId()).mass()*p.U();
|
|
||||||
}
|
|
||||||
|
|
||||||
momentum *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return tmomentum;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
|
||||||
Foam::DsmcCloud<ParcelType>::linearKE() const
|
Foam::DsmcCloud<ParcelType>::linearKE() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tlinearKE
|
return linearKE_;
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "linearKE",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& linearKE = tlinearKE().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
linearKE[cellI] += 0.5*constProps(p.typeId()).mass()*(p.U() & p.U());
|
|
||||||
}
|
|
||||||
|
|
||||||
linearKE *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return tlinearKE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
inline const Foam::volScalarField&
|
||||||
Foam::DsmcCloud<ParcelType>::internalE() const
|
Foam::DsmcCloud<ParcelType>::internalE() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tinternalE
|
return internalE_;
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "internalE",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& internalE = tinternalE().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
internalE[cellI] += p.Ei();
|
|
||||||
}
|
|
||||||
|
|
||||||
internalE *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return tinternalE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
inline const Foam::volScalarField&
|
||||||
Foam::DsmcCloud<ParcelType>::iDof() const
|
Foam::DsmcCloud<ParcelType>::iDof() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tiDof
|
return iDof_;
|
||||||
(
|
}
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "iDof",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& iDof = tiDof().internalField();
|
|
||||||
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
template<class ParcelType>
|
||||||
{
|
inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::momentum() const
|
||||||
const ParcelType& p = iter();
|
{
|
||||||
const label cellI = p.cell();
|
return momentum_;
|
||||||
|
|
||||||
iDof[cellI] += constProps(p.typeId()).internalDegreesOfFreedom();
|
|
||||||
}
|
|
||||||
|
|
||||||
iDof *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return tiDof;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,66 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2009-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 "dsmcCloud.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
defineTypeNameAndDebug(dsmcCloud, 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::dsmcCloud::dsmcCloud
|
|
||||||
(
|
|
||||||
const word& cloudName,
|
|
||||||
const volScalarField& T,
|
|
||||||
const volVectorField& U
|
|
||||||
)
|
|
||||||
:
|
|
||||||
DsmcCloud<dsmcParcel>(cloudName, T, U)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::dsmcCloud::dsmcCloud
|
|
||||||
(
|
|
||||||
const word& cloudName,
|
|
||||||
const fvMesh& mesh
|
|
||||||
)
|
|
||||||
:
|
|
||||||
DsmcCloud<dsmcParcel>(cloudName, mesh)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::dsmcCloud::~dsmcCloud()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -43,54 +43,8 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
typedef DsmcCloud<dsmcParcel> dsmcCloud;
|
||||||
/*---------------------------------------------------------------------------*\
|
}
|
||||||
Class dsmcCloud Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class dsmcCloud
|
|
||||||
:
|
|
||||||
public DsmcCloud<dsmcParcel>
|
|
||||||
{
|
|
||||||
// Private member functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
dsmcCloud(const dsmcCloud&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const dsmcCloud&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("dsmcCloud");
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
dsmcCloud
|
|
||||||
(
|
|
||||||
const word& cloudName,
|
|
||||||
const volScalarField& T,
|
|
||||||
const volVectorField& U
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from name and mesh, used to initialise.
|
|
||||||
dsmcCloud
|
|
||||||
(
|
|
||||||
const word& cloudName,
|
|
||||||
const fvMesh& mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
~dsmcCloud();
|
|
||||||
};
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "DsmcParcel.H"
|
#include "DsmcParcel.H"
|
||||||
|
#include "meshTools.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -43,16 +44,31 @@ bool Foam::DsmcParcel<ParcelType>::move
|
|||||||
const polyMesh& mesh = td.cloud().pMesh();
|
const polyMesh& mesh = td.cloud().pMesh();
|
||||||
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
|
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
|
||||||
|
|
||||||
const scalar deltaT = td.cloud().cachedDeltaT();
|
const scalar deltaT = mesh.time().deltaTValue();
|
||||||
scalar tEnd = (1.0 - p.stepFraction())*deltaT;
|
scalar tEnd = (1.0 - p.stepFraction())*deltaT;
|
||||||
const scalar dtMax = tEnd;
|
const scalar dtMax = tEnd;
|
||||||
|
|
||||||
|
// For reduced-D cases, the velocity used to track needs to be
|
||||||
|
// constrained, but the actual U_ of the parcel must not be
|
||||||
|
// altered or used, as it is altered by patch interactions an
|
||||||
|
// needs to retain its 3D value for collision purposes.
|
||||||
|
vector Utracking = U_;
|
||||||
|
|
||||||
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
|
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
|
||||||
{
|
{
|
||||||
|
// Apply correction to position for reduced-D cases
|
||||||
|
meshTools::constrainToMeshCentre(mesh, p.position());
|
||||||
|
|
||||||
|
Utracking = U_;
|
||||||
|
|
||||||
|
// Apply correction to velocity to constrain tracking for
|
||||||
|
// reduced-D cases
|
||||||
|
meshTools::constrainDirection(mesh, mesh.solutionD(), Utracking);
|
||||||
|
|
||||||
// Set the Lagrangian time-step
|
// Set the Lagrangian time-step
|
||||||
scalar dt = min(dtMax, tEnd);
|
scalar dt = min(dtMax, tEnd);
|
||||||
|
|
||||||
dt *= p.trackToFace(p.position() + dt*U_, td);
|
dt *= p.trackToFace(p.position() + dt*Utracking, td);
|
||||||
|
|
||||||
tEnd -= dt;
|
tEnd -= dt;
|
||||||
|
|
||||||
@ -113,10 +129,41 @@ void Foam::DsmcParcel<ParcelType>::hitWallPatch
|
|||||||
TrackData& td
|
TrackData& td
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
label wppIndex = wpp.index();
|
||||||
|
|
||||||
|
label wppLocalFace = wpp.whichFace(this->face());
|
||||||
|
|
||||||
|
const scalar fA = mag(wpp.faceAreas()[wppLocalFace]);
|
||||||
|
|
||||||
|
const scalar deltaT = td.cloud().pMesh().time().deltaTValue();
|
||||||
|
|
||||||
const constantProperties& constProps(td.cloud().constProps(typeId_));
|
const constantProperties& constProps(td.cloud().constProps(typeId_));
|
||||||
|
|
||||||
scalar m = constProps.mass();
|
scalar m = constProps.mass();
|
||||||
|
|
||||||
|
vector nw = wpp.faceAreas()[wppLocalFace];
|
||||||
|
nw /= mag(nw);
|
||||||
|
|
||||||
|
scalar U_dot_nw = U_ & nw;
|
||||||
|
|
||||||
|
vector Ut = U_ - U_dot_nw*nw;
|
||||||
|
|
||||||
|
scalar invMagUnfA = 1/max(mag(U_dot_nw)*fA, VSMALL);
|
||||||
|
|
||||||
|
td.cloud().rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().linearKEBF()[wppIndex][wppLocalFace] +=
|
||||||
|
0.5*m*(U_ & U_)*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().iDofBF()[wppIndex][wppLocalFace] +=
|
||||||
|
constProps.internalDegreesOfFreedom()*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA;
|
||||||
|
|
||||||
// pre-interaction energy
|
// pre-interaction energy
|
||||||
scalar preIE = 0.5*m*(U_ & U_) + Ei_;
|
scalar preIE = 0.5*m*(U_ & U_) + Ei_;
|
||||||
|
|
||||||
@ -132,27 +179,40 @@ void Foam::DsmcParcel<ParcelType>::hitWallPatch
|
|||||||
typeId_
|
typeId_
|
||||||
);
|
);
|
||||||
|
|
||||||
|
U_dot_nw = U_ & nw;
|
||||||
|
|
||||||
|
Ut = U_ - U_dot_nw*nw;
|
||||||
|
|
||||||
|
invMagUnfA = 1/max(mag(U_dot_nw)*fA, VSMALL);
|
||||||
|
|
||||||
|
td.cloud().rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().linearKEBF()[wppIndex][wppLocalFace] +=
|
||||||
|
0.5*m*(U_ & U_)*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().iDofBF()[wppIndex][wppLocalFace] +=
|
||||||
|
constProps.internalDegreesOfFreedom()*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA;
|
||||||
|
|
||||||
// post-interaction energy
|
// post-interaction energy
|
||||||
scalar postIE = 0.5*m*(U_ & U_) + Ei_;
|
scalar postIE = 0.5*m*(U_ & U_) + Ei_;
|
||||||
|
|
||||||
// post-interaction momentum
|
// post-interaction momentum
|
||||||
vector postIMom = m*U_;
|
vector postIMom = m*U_;
|
||||||
|
|
||||||
label wppIndex = wpp.index();
|
|
||||||
|
|
||||||
label wppLocalFace = wpp.whichFace(this->face());
|
|
||||||
|
|
||||||
const scalar fA = mag(wpp.faceAreas()[wppLocalFace]);
|
|
||||||
|
|
||||||
const scalar deltaT = td.cloud().cachedDeltaT();
|
|
||||||
|
|
||||||
scalar deltaQ = td.cloud().nParticle()*(preIE - postIE)/(deltaT*fA);
|
scalar deltaQ = td.cloud().nParticle()*(preIE - postIE)/(deltaT*fA);
|
||||||
|
|
||||||
vector deltaFD = td.cloud().nParticle()*(preIMom - postIMom)/(deltaT*fA);
|
vector deltaFD = td.cloud().nParticle()*(preIMom - postIMom)/(deltaT*fA);
|
||||||
|
|
||||||
td.cloud().q().boundaryField()[wppIndex][wppLocalFace] += deltaQ;
|
td.cloud().qBF()[wppIndex][wppLocalFace] += deltaQ;
|
||||||
|
|
||||||
|
td.cloud().fDBF()[wppIndex][wppLocalFace] += deltaFD;
|
||||||
|
|
||||||
td.cloud().fD().boundaryField()[wppIndex][wppLocalFace] += deltaFD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -212,4 +272,3 @@ void Foam::DsmcParcel<ParcelType>::transformProperties
|
|||||||
#include "DsmcParcelIO.C"
|
#include "DsmcParcelIO.C"
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "DsmcCloud.H"
|
#include "DsmcCloud.H"
|
||||||
#include "MaxwellianThermal.H"
|
#include "MaxwellianThermal.H"
|
||||||
#include "SpecularReflection.H"
|
#include "SpecularReflection.H"
|
||||||
|
#include "MixedDiffuseSpecular.H"
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
@ -46,6 +47,12 @@ namespace Foam
|
|||||||
DsmcCloud,
|
DsmcCloud,
|
||||||
dsmcParcel
|
dsmcParcel
|
||||||
);
|
);
|
||||||
|
makeWallInteractionModelType
|
||||||
|
(
|
||||||
|
MixedDiffuseSpecular,
|
||||||
|
DsmcCloud,
|
||||||
|
dsmcParcel
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -129,7 +129,7 @@ void Foam::FreeStream<CloudType>::inflow()
|
|||||||
|
|
||||||
const polyMesh& mesh(cloud.mesh());
|
const polyMesh& mesh(cloud.mesh());
|
||||||
|
|
||||||
const scalar deltaT = cloud.cachedDeltaT();
|
const scalar deltaT = mesh.time().deltaTValue();
|
||||||
|
|
||||||
Random& rndGen(cloud.rndGen());
|
Random& rndGen(cloud.rndGen());
|
||||||
|
|
||||||
@ -139,12 +139,12 @@ void Foam::FreeStream<CloudType>::inflow()
|
|||||||
|
|
||||||
const volScalarField::GeometricBoundaryField& boundaryT
|
const volScalarField::GeometricBoundaryField& boundaryT
|
||||||
(
|
(
|
||||||
cloud.T().boundaryField()
|
cloud.boundaryT().boundaryField()
|
||||||
);
|
);
|
||||||
|
|
||||||
const volVectorField::GeometricBoundaryField& boundaryU
|
const volVectorField::GeometricBoundaryField& boundaryU
|
||||||
(
|
(
|
||||||
cloud.U().boundaryField()
|
cloud.boundaryU().boundaryField()
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(patches_, p)
|
forAll(patches_, p)
|
||||||
@ -168,7 +168,8 @@ void Foam::FreeStream<CloudType>::inflow()
|
|||||||
if (min(boundaryT[patchI]) < SMALL)
|
if (min(boundaryT[patchI]) < SMALL)
|
||||||
{
|
{
|
||||||
FatalErrorIn ("Foam::FreeStream<CloudType>::inflow()")
|
FatalErrorIn ("Foam::FreeStream<CloudType>::inflow()")
|
||||||
<< "Zero boundary temperature detected, check boundaryT condition." << nl
|
<< "Zero boundary temperature detected, check boundaryT "
|
||||||
|
<< "condition." << nl
|
||||||
<< nl << abort(FatalError);
|
<< nl << abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,10 +71,10 @@ void Foam::MaxwellianThermal<CloudType>::correct
|
|||||||
nw /= mag(nw);
|
nw /= mag(nw);
|
||||||
|
|
||||||
// Normal velocity magnitude
|
// Normal velocity magnitude
|
||||||
scalar magUn = U & nw;
|
scalar U_dot_nw = U & nw;
|
||||||
|
|
||||||
// Wall tangential velocity (flow direction)
|
// Wall tangential velocity (flow direction)
|
||||||
vector Ut = U - magUn*nw;
|
vector Ut = U - U_dot_nw*nw;
|
||||||
|
|
||||||
CloudType& cloud(this->owner());
|
CloudType& cloud(this->owner());
|
||||||
|
|
||||||
@ -93,9 +93,9 @@ void Foam::MaxwellianThermal<CloudType>::correct
|
|||||||
U.z()*(0.8 + 0.2*rndGen.scalar01())
|
U.z()*(0.8 + 0.2*rndGen.scalar01())
|
||||||
);
|
);
|
||||||
|
|
||||||
magUn = U & nw;
|
U_dot_nw = U & nw;
|
||||||
|
|
||||||
Ut = U - magUn*nw;
|
Ut = U - U_dot_nw*nw;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wall tangential unit vector
|
// Wall tangential unit vector
|
||||||
@ -104,7 +104,7 @@ void Foam::MaxwellianThermal<CloudType>::correct
|
|||||||
// Other tangential unit vector
|
// Other tangential unit vector
|
||||||
vector tw2 = nw^tw1;
|
vector tw2 = nw^tw1;
|
||||||
|
|
||||||
scalar T = cloud.T().boundaryField()[wppIndex][wppLocalFace];
|
scalar T = cloud.boundaryT().boundaryField()[wppIndex][wppLocalFace];
|
||||||
|
|
||||||
scalar mass = cloud.constProps(typeId).mass();
|
scalar mass = cloud.constProps(typeId).mass();
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ void Foam::MaxwellianThermal<CloudType>::correct
|
|||||||
- sqrt(-2.0*log(max(1 - rndGen.scalar01(), VSMALL)))*nw
|
- sqrt(-2.0*log(max(1 - rndGen.scalar01(), VSMALL)))*nw
|
||||||
);
|
);
|
||||||
|
|
||||||
U += cloud.U().boundaryField()[wppIndex][wppLocalFace];
|
U += cloud.boundaryU().boundaryField()[wppIndex][wppLocalFace];
|
||||||
|
|
||||||
Ei = cloud.equipartitionInternalEnergy(T, iDof);
|
Ei = cloud.equipartitionInternalEnergy(T, iDof);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,140 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-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 "MixedDiffuseSpecular.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template <class CloudType>
|
||||||
|
Foam::MixedDiffuseSpecular<CloudType>::MixedDiffuseSpecular
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
CloudType& cloud
|
||||||
|
)
|
||||||
|
:
|
||||||
|
WallInteractionModel<CloudType>(dict, cloud, typeName),
|
||||||
|
diffuseFraction_(readScalar(this->coeffDict().lookup("diffuseFraction")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template <class CloudType>
|
||||||
|
Foam::MixedDiffuseSpecular<CloudType>::~MixedDiffuseSpecular()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template <class CloudType>
|
||||||
|
void Foam::MixedDiffuseSpecular<CloudType>::correct
|
||||||
|
(
|
||||||
|
const wallPolyPatch& wpp,
|
||||||
|
const label faceId,
|
||||||
|
vector& U,
|
||||||
|
scalar& Ei,
|
||||||
|
label typeId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
label wppIndex = wpp.index();
|
||||||
|
|
||||||
|
label wppLocalFace = wpp.whichFace(faceId);
|
||||||
|
|
||||||
|
vector nw = wpp.faceAreas()[wppLocalFace];
|
||||||
|
|
||||||
|
// Normal unit vector
|
||||||
|
nw /= mag(nw);
|
||||||
|
|
||||||
|
// Normal velocity magnitude
|
||||||
|
scalar U_dot_nw = U & nw;
|
||||||
|
|
||||||
|
CloudType& cloud(this->owner());
|
||||||
|
|
||||||
|
Random& rndGen(cloud.rndGen());
|
||||||
|
|
||||||
|
if (diffuseFraction_ > rndGen.scalar01())
|
||||||
|
{
|
||||||
|
// Diffuse reflection
|
||||||
|
|
||||||
|
// Wall tangential velocity (flow direction)
|
||||||
|
vector Ut = U - U_dot_nw*nw;
|
||||||
|
|
||||||
|
while (mag(Ut) < SMALL)
|
||||||
|
{
|
||||||
|
// If the incident velocity is parallel to the face normal, no
|
||||||
|
// tangential direction can be chosen. Add a perturbation to the
|
||||||
|
// incoming velocity and recalculate.
|
||||||
|
|
||||||
|
U = vector
|
||||||
|
(
|
||||||
|
U.x()*(0.8 + 0.2*rndGen.scalar01()),
|
||||||
|
U.y()*(0.8 + 0.2*rndGen.scalar01()),
|
||||||
|
U.z()*(0.8 + 0.2*rndGen.scalar01())
|
||||||
|
);
|
||||||
|
|
||||||
|
U_dot_nw = U & nw;
|
||||||
|
|
||||||
|
Ut = U - U_dot_nw*nw;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wall tangential unit vector
|
||||||
|
vector tw1 = Ut/mag(Ut);
|
||||||
|
|
||||||
|
// Other tangential unit vector
|
||||||
|
vector tw2 = nw^tw1;
|
||||||
|
|
||||||
|
scalar T = cloud.boundaryT().boundaryField()[wppIndex][wppLocalFace];
|
||||||
|
|
||||||
|
scalar mass = cloud.constProps(typeId).mass();
|
||||||
|
|
||||||
|
scalar iDof = cloud.constProps(typeId).internalDegreesOfFreedom();
|
||||||
|
|
||||||
|
U =
|
||||||
|
sqrt(physicoChemical::k.value()*T/mass)
|
||||||
|
*(
|
||||||
|
rndGen.GaussNormal()*tw1
|
||||||
|
+ rndGen.GaussNormal()*tw2
|
||||||
|
- sqrt(-2.0*log(max(1 - rndGen.scalar01(), VSMALL)))*nw
|
||||||
|
);
|
||||||
|
|
||||||
|
U += cloud.boundaryU().boundaryField()[wppIndex][wppLocalFace];
|
||||||
|
|
||||||
|
Ei = cloud.equipartitionInternalEnergy(T, iDof);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Specular reflection
|
||||||
|
|
||||||
|
if (U_dot_nw > 0.0)
|
||||||
|
{
|
||||||
|
U -= 2.0*U_dot_nw*nw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,46 +23,82 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Class
|
Class
|
||||||
vtkFoamData
|
Foam::MixedDiffuseSpecular
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Wall interaction setting microscopic velocity to a random one drawn from a
|
||||||
SourceFiles
|
Maxwellian distribution corresponding to a specified temperature
|
||||||
vtkFoamData.cxx
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkFoamData_h
|
#ifndef MixedDiffuseSpecular_H
|
||||||
#define vtkFoamData_h
|
#define MixedDiffuseSpecular_H
|
||||||
|
|
||||||
|
#include "WallInteractionModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "vtkDataSetSource.h"
|
namespace Foam
|
||||||
|
{
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class vtkFoamData Declaration
|
Class MixedDiffuseSpecular Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class VTK_IO_EXPORT vtkFoamData
|
template<class CloudType>
|
||||||
:
|
class MixedDiffuseSpecular
|
||||||
public vtkDataSetSource
|
:
|
||||||
|
public WallInteractionModel<CloudType>
|
||||||
{
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Fraction of wall interactions that are diffuse
|
||||||
|
scalar diffuseFraction_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static vtkFoamData *New();
|
//- Runtime type information
|
||||||
vtkTypeRevisionMacro(vtkFoamData,vtkDataSetSource);
|
TypeName("MixedDiffuseSpecular");
|
||||||
|
|
||||||
vtkFoamData();
|
|
||||||
~vtkFoamData();
|
|
||||||
|
|
||||||
void SetNthOutput(int num, vtkDataObject *output)
|
// Constructors
|
||||||
{
|
|
||||||
vtkDataSetSource::SetNthOutput(num, output);
|
//- Construct from dictionary
|
||||||
}
|
MixedDiffuseSpecular
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
CloudType& cloud
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
virtual ~MixedDiffuseSpecular();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Apply wall correction
|
||||||
|
virtual void correct
|
||||||
|
(
|
||||||
|
const wallPolyPatch& wpp,
|
||||||
|
const label faceId,
|
||||||
|
vector& U,
|
||||||
|
scalar& Ei,
|
||||||
|
label typeId
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "MixedDiffuseSpecular.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -63,11 +63,11 @@ void Foam::SpecularReflection<CloudType>::correct
|
|||||||
vector nw = wpp.faceAreas()[wpp.whichFace(faceId)];
|
vector nw = wpp.faceAreas()[wpp.whichFace(faceId)];
|
||||||
nw /= mag(nw);
|
nw /= mag(nw);
|
||||||
|
|
||||||
scalar magUn = U & nw;
|
scalar U_dot_nw = U & nw;
|
||||||
|
|
||||||
if (magUn > 0.0)
|
if (U_dot_nw > 0.0)
|
||||||
{
|
{
|
||||||
U -= 2.0*magUn*nw;
|
U -= 2.0*U_dot_nw*nw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,27 +25,49 @@ License
|
|||||||
\*----------------------------------------------------------------------------*/
|
\*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "distribution.H"
|
#include "distribution.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
defineTypeNameAndDebug(distribution, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::distribution::write
|
||||||
|
(
|
||||||
|
const fileName& file,
|
||||||
|
const List<Pair<scalar> >& pairs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OFstream os(file);
|
||||||
|
|
||||||
|
forAll(pairs, i)
|
||||||
|
{
|
||||||
|
os << pairs[i].first() << ' ' << pairs[i].second() << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
distribution::distribution()
|
Foam::distribution::distribution()
|
||||||
:
|
:
|
||||||
Map<label>(),
|
Map<label>(),
|
||||||
binWidth_(1)
|
binWidth_(1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
distribution::distribution(const scalar binWidth)
|
Foam::distribution::distribution(const scalar binWidth)
|
||||||
:
|
:
|
||||||
Map<label>(),
|
Map<label>(),
|
||||||
binWidth_(binWidth)
|
binWidth_(binWidth)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
distribution::distribution(const distribution& d)
|
Foam::distribution::distribution(const distribution& d)
|
||||||
:
|
:
|
||||||
Map<label>(static_cast< Map<label> >(d)),
|
Map<label>(static_cast< Map<label> >(d)),
|
||||||
binWidth_(d.binWidth())
|
binWidth_(d.binWidth())
|
||||||
@ -54,13 +76,13 @@ distribution::distribution(const distribution& d)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
distribution::~distribution()
|
Foam::distribution::~distribution()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
label distribution::totalEntries() const
|
Foam::label Foam::distribution::totalEntries() const
|
||||||
{
|
{
|
||||||
label sumOfEntries = 0;
|
label sumOfEntries = 0;
|
||||||
|
|
||||||
@ -88,7 +110,7 @@ label distribution::totalEntries() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scalar distribution::approxTotalEntries() const
|
Foam::scalar Foam::distribution::approxTotalEntries() const
|
||||||
{
|
{
|
||||||
scalar sumOfEntries = 0;
|
scalar sumOfEntries = 0;
|
||||||
|
|
||||||
@ -101,7 +123,7 @@ scalar distribution::approxTotalEntries() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scalar distribution::mean() const
|
Foam::scalar Foam::distribution::mean() const
|
||||||
{
|
{
|
||||||
scalar runningSum = 0;
|
scalar runningSum = 0;
|
||||||
|
|
||||||
@ -124,7 +146,7 @@ scalar distribution::mean() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scalar distribution::median()
|
Foam::scalar Foam::distribution::median()
|
||||||
{
|
{
|
||||||
// From:
|
// From:
|
||||||
// http://mathworld.wolfram.com/StatisticalMedian.html
|
// http://mathworld.wolfram.com/StatisticalMedian.html
|
||||||
@ -188,7 +210,7 @@ scalar distribution::median()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void distribution::add(const scalar valueToAdd)
|
void Foam::distribution::add(const scalar valueToAdd)
|
||||||
{
|
{
|
||||||
iterator iter(this->begin());
|
iterator iter(this->begin());
|
||||||
|
|
||||||
@ -218,13 +240,13 @@ void distribution::add(const scalar valueToAdd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void distribution::add(const label valueToAdd)
|
void Foam::distribution::add(const label valueToAdd)
|
||||||
{
|
{
|
||||||
add(scalar(valueToAdd));
|
add(scalar(valueToAdd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void distribution::insertMissingKeys()
|
void Foam::distribution::insertMissingKeys()
|
||||||
{
|
{
|
||||||
iterator iter(this->begin());
|
iterator iter(this->begin());
|
||||||
|
|
||||||
@ -247,7 +269,7 @@ void distribution::insertMissingKeys()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List< Pair<scalar> > distribution::normalised()
|
Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::normalised()
|
||||||
{
|
{
|
||||||
scalar totEnt = approxTotalEntries();
|
scalar totEnt = approxTotalEntries();
|
||||||
|
|
||||||
@ -268,17 +290,25 @@ List< Pair<scalar> > distribution::normalised()
|
|||||||
normDist[k].second() = scalar((*this)[key])/totEnt/binWidth_;
|
normDist[k].second() = scalar((*this)[key])/totEnt/binWidth_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "totEnt: " << totEnt << endl;
|
||||||
|
}
|
||||||
|
|
||||||
return normDist;
|
return normDist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List< Pair<scalar> > distribution::normalisedMinusMean()
|
Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::normalisedMinusMean()
|
||||||
{
|
{
|
||||||
return normalisedShifted(mean());
|
return normalisedShifted(mean());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List< Pair<scalar> > distribution::normalisedShifted(const scalar shiftValue)
|
Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::normalisedShifted
|
||||||
|
(
|
||||||
|
scalar shiftValue
|
||||||
|
)
|
||||||
{
|
{
|
||||||
List<Pair<scalar> > oldDist(normalised());
|
List<Pair<scalar> > oldDist(normalised());
|
||||||
|
|
||||||
@ -301,20 +331,23 @@ List< Pair<scalar> > distribution::normalisedShifted(const scalar shiftValue)
|
|||||||
|
|
||||||
label newKey = lowestNewKey;
|
label newKey = lowestNewKey;
|
||||||
|
|
||||||
// Info << shiftValue
|
if (debug)
|
||||||
// << nl << lowestOldBin
|
{
|
||||||
// << nl << lowestNewKey
|
Info<< shiftValue
|
||||||
// << nl << interpolationStartDirection
|
<< nl << lowestOldBin
|
||||||
// << endl;
|
<< nl << lowestNewKey
|
||||||
|
<< nl << interpolationStartDirection
|
||||||
|
<< endl;
|
||||||
|
|
||||||
// scalar checkNormalisation = 0;
|
scalar checkNormalisation = 0;
|
||||||
|
|
||||||
// forAll (oldDist, oD)
|
forAll (oldDist, oD)
|
||||||
// {
|
{
|
||||||
// checkNormalisation += oldDist[oD].second()*binWidth_;
|
checkNormalisation += oldDist[oD].second()*binWidth_;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Info << "Initial normalisation = " << checkNormalisation << endl;
|
Info<< "Initial normalisation = " << checkNormalisation << endl;
|
||||||
|
}
|
||||||
|
|
||||||
forAll(oldDist,u)
|
forAll(oldDist,u)
|
||||||
{
|
{
|
||||||
@ -368,20 +401,23 @@ List< Pair<scalar> > distribution::normalisedShifted(const scalar shiftValue)
|
|||||||
newKey++;
|
newKey++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkNormalisation = 0;
|
if (debug)
|
||||||
|
{
|
||||||
|
scalar checkNormalisation = 0;
|
||||||
|
|
||||||
// forAll (newDist, nD)
|
forAll (newDist, nD)
|
||||||
// {
|
{
|
||||||
// checkNormalisation += newDist[nD].second()*binWidth_;
|
checkNormalisation += newDist[nD].second()*binWidth_;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Info << "Shifted normalisation = " << checkNormalisation << endl;
|
Info<< "Shifted normalisation = " << checkNormalisation << endl;
|
||||||
|
}
|
||||||
|
|
||||||
return newDist;
|
return newDist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<Pair<scalar> > distribution::raw()
|
Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::raw()
|
||||||
{
|
{
|
||||||
insertMissingKeys();
|
insertMissingKeys();
|
||||||
|
|
||||||
@ -406,7 +442,7 @@ List<Pair<scalar> > distribution::raw()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void distribution::operator=(const distribution& rhs)
|
void Foam::distribution::operator=(const distribution& rhs)
|
||||||
{
|
{
|
||||||
// Check for assignment to self
|
// Check for assignment to self
|
||||||
if (this == &rhs)
|
if (this == &rhs)
|
||||||
@ -424,7 +460,7 @@ void distribution::operator=(const distribution& rhs)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Ostream& operator<<(Ostream& os, const distribution& d)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const distribution& d)
|
||||||
{
|
{
|
||||||
os << d.binWidth_
|
os << d.binWidth_
|
||||||
<< static_cast<const Map<label>&>(d);
|
<< static_cast<const Map<label>&>(d);
|
||||||
@ -440,8 +476,4 @@ Ostream& operator<<(Ostream& os, const distribution& d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -26,6 +26,8 @@ Class
|
|||||||
Foam::distribution
|
Foam::distribution
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Accumulating histogram of values. Specified bin resolution
|
||||||
|
automatic generation of bins.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
distributionI.H
|
distributionI.H
|
||||||
@ -59,6 +61,21 @@ class distribution
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
|
||||||
|
TypeName("distribution");
|
||||||
|
|
||||||
|
// Static functions
|
||||||
|
|
||||||
|
//- write to file
|
||||||
|
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName& file,
|
||||||
|
const List<Pair<scalar> >& pairs
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
@ -73,7 +90,7 @@ public:
|
|||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
|
||||||
~distribution();
|
virtual ~distribution();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -97,7 +114,7 @@ public:
|
|||||||
|
|
||||||
List<Pair<scalar> > normalisedMinusMean();
|
List<Pair<scalar> > normalisedMinusMean();
|
||||||
|
|
||||||
List<Pair<scalar> > normalisedShifted(const scalar shiftValue);
|
List<Pair<scalar> > normalisedShifted(scalar shiftValue);
|
||||||
|
|
||||||
List<Pair<scalar> > raw();
|
List<Pair<scalar> > raw();
|
||||||
|
|
||||||
|
|||||||
@ -110,6 +110,7 @@ void Foam::dsmcFields::write()
|
|||||||
word linearKEMeanName = "linearKEMean";
|
word linearKEMeanName = "linearKEMean";
|
||||||
word internalEMeanName = "internalEMean";
|
word internalEMeanName = "internalEMean";
|
||||||
word iDofMeanName = "iDofMean";
|
word iDofMeanName = "iDofMean";
|
||||||
|
word fDMeanName = "fDMean";
|
||||||
|
|
||||||
const volScalarField& rhoNMean = obr_.lookupObject<volScalarField>
|
const volScalarField& rhoNMean = obr_.lookupObject<volScalarField>
|
||||||
(
|
(
|
||||||
@ -141,6 +142,11 @@ void Foam::dsmcFields::write()
|
|||||||
iDofMeanName
|
iDofMeanName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
volVectorField fDMean = obr_.lookupObject<volVectorField>
|
||||||
|
(
|
||||||
|
fDMeanName
|
||||||
|
);
|
||||||
|
|
||||||
if (min(mag(rhoNMean)).value() > VSMALL)
|
if (min(mag(rhoNMean)).value() > VSMALL)
|
||||||
{
|
{
|
||||||
Info<< "Calculating dsmcFields." << endl;
|
Info<< "Calculating dsmcFields." << endl;
|
||||||
@ -168,8 +174,9 @@ void Foam::dsmcFields::write()
|
|||||||
obr_,
|
obr_,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
),
|
),
|
||||||
|
|
||||||
2.0/(3.0*physicoChemical::k.value()*rhoNMean)
|
2.0/(3.0*physicoChemical::k.value()*rhoNMean)
|
||||||
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean))
|
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean))
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Calculating internalT field." << endl;
|
Info<< " Calculating internalT field." << endl;
|
||||||
@ -182,7 +189,7 @@ void Foam::dsmcFields::write()
|
|||||||
obr_,
|
obr_,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
),
|
),
|
||||||
2.0/(physicoChemical::k.value()*iDofMean)*internalEMean
|
(2.0/physicoChemical::k.value())*(internalEMean/iDofMean)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Calculating overallT field." << endl;
|
Info<< " Calculating overallT field." << endl;
|
||||||
@ -196,9 +203,36 @@ void Foam::dsmcFields::write()
|
|||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
),
|
),
|
||||||
2.0/(physicoChemical::k.value()*(3.0*rhoNMean + iDofMean))
|
2.0/(physicoChemical::k.value()*(3.0*rhoNMean + iDofMean))
|
||||||
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean) + internalEMean)
|
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean) + internalEMean)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Info<< " Calculating pressure field." << endl;
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
obr_.time().timeName(),
|
||||||
|
obr_,
|
||||||
|
IOobject::NO_READ
|
||||||
|
),
|
||||||
|
physicoChemical::k.value()*rhoNMean*translationalT
|
||||||
|
);
|
||||||
|
|
||||||
|
const fvMesh& mesh = fDMean.mesh();
|
||||||
|
|
||||||
|
forAll(mesh.boundaryMesh(), i)
|
||||||
|
{
|
||||||
|
const polyPatch& patch = mesh.boundaryMesh()[i];
|
||||||
|
|
||||||
|
if (isA<wallPolyPatch>(patch))
|
||||||
|
{
|
||||||
|
p.boundaryField()[i] =
|
||||||
|
fDMean.boundaryField()[i]
|
||||||
|
& (patch.faceAreas()/mag(patch.faceAreas()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Info<< " mag(UMean) max/min : "
|
Info<< " mag(UMean) max/min : "
|
||||||
<< max(mag(UMean)).value() << " "
|
<< max(mag(UMean)).value() << " "
|
||||||
<< min(mag(UMean)).value() << endl;
|
<< min(mag(UMean)).value() << endl;
|
||||||
@ -215,6 +249,10 @@ void Foam::dsmcFields::write()
|
|||||||
<< max(overallT).value() << " "
|
<< max(overallT).value() << " "
|
||||||
<< min(overallT).value() << endl;
|
<< min(overallT).value() << endl;
|
||||||
|
|
||||||
|
Info<< " p max/min : "
|
||||||
|
<< max(p).value() << " "
|
||||||
|
<< min(p).value() << endl;
|
||||||
|
|
||||||
UMean.write();
|
UMean.write();
|
||||||
|
|
||||||
translationalT.write();
|
translationalT.write();
|
||||||
@ -223,6 +261,8 @@ void Foam::dsmcFields::write()
|
|||||||
|
|
||||||
overallT.write();
|
overallT.write();
|
||||||
|
|
||||||
|
p.write();
|
||||||
|
|
||||||
Info<< "dsmcFields written." << nl << endl;
|
Info<< "dsmcFields written." << nl << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -38,8 +38,8 @@ derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFv
|
|||||||
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
|
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
|
||||||
derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
|
derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
|
||||||
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C
|
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C
|
||||||
|
derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
|
||||||
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C
|
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C
|
||||||
|
|
||||||
backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C
|
backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libcompressibleRASModels
|
LIB = $(FOAM_LIBBIN)/libcompressibleRASModels
|
||||||
|
|||||||
@ -33,16 +33,9 @@ License
|
|||||||
#include "basicThermo.H"
|
#include "basicThermo.H"
|
||||||
#include "RASModel.H"
|
#include "RASModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
namespace compressible
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
bool turbulentTemperatureCoupledBaffleFvPatchScalarField::interfaceOwner
|
bool Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::interfaceOwner
|
||||||
(
|
(
|
||||||
const polyMesh& nbrRegion,
|
const polyMesh& nbrRegion,
|
||||||
const polyPatch& nbrPatch
|
const polyPatch& nbrPatch
|
||||||
@ -103,6 +96,7 @@ bool turbulentTemperatureCoupledBaffleFvPatchScalarField::interfaceOwner
|
|||||||
}
|
}
|
||||||
nbrIndex = props.fluidRegionNames().size() + i;
|
nbrIndex = props.fluidRegionNames().size() + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return myIndex < nbrIndex;
|
return myIndex < nbrIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,25 +104,20 @@ bool turbulentTemperatureCoupledBaffleFvPatchScalarField::interfaceOwner
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
||||||
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mixedFvPatchScalarField(p, iF),
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
neighbourFieldName_("undefined-neighbourFieldName"),
|
neighbourFieldName_("undefined-neighbourFieldName"),
|
||||||
KName_("undefined-K")
|
KName_("undefined-K")
|
||||||
{
|
{}
|
||||||
this->refValue() = 0.0;
|
|
||||||
this->refGrad() = 0.0;
|
|
||||||
this->valueFraction() = 1.0;
|
|
||||||
this->fixesValue_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
||||||
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||||
(
|
(
|
||||||
const turbulentTemperatureCoupledBaffleFvPatchScalarField& ptf,
|
const turbulentTemperatureCoupledBaffleFvPatchScalarField& ptf,
|
||||||
@ -137,14 +126,13 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
|
|||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
neighbourFieldName_(ptf.neighbourFieldName_),
|
neighbourFieldName_(ptf.neighbourFieldName_),
|
||||||
KName_(ptf.KName_),
|
KName_(ptf.KName_)
|
||||||
fixesValue_(ptf.fixesValue_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::
|
||||||
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
@ -152,7 +140,7 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mixedFvPatchScalarField(p, iF),
|
fixedValueFvPatchScalarField(p, iF, dict),
|
||||||
neighbourFieldName_(dict.lookup("neighbourFieldName")),
|
neighbourFieldName_(dict.lookup("neighbourFieldName")),
|
||||||
KName_(dict.lookup("K"))
|
KName_(dict.lookup("K"))
|
||||||
{
|
{
|
||||||
@ -174,46 +162,26 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
|
|||||||
<< " in file " << dimensionedInternalField().objectPath()
|
<< " in file " << dimensionedInternalField().objectPath()
|
||||||
<< exit(FatalError);
|
<< 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
|
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||||
(
|
(
|
||||||
const turbulentTemperatureCoupledBaffleFvPatchScalarField& wtcsf,
|
const turbulentTemperatureCoupledBaffleFvPatchScalarField& wtcsf,
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mixedFvPatchScalarField(wtcsf, iF),
|
fixedValueFvPatchScalarField(wtcsf, iF),
|
||||||
neighbourFieldName_(wtcsf.neighbourFieldName_),
|
neighbourFieldName_(wtcsf.neighbourFieldName_),
|
||||||
KName_(wtcsf.KName_),
|
KName_(wtcsf.KName_)
|
||||||
fixesValue_(wtcsf.fixesValue_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
tmp<scalarField>
|
Foam::tmp<Foam::scalarField>
|
||||||
turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const
|
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = patch().boundaryMesh().mesh();
|
const fvMesh& mesh = patch().boundaryMesh().mesh();
|
||||||
|
|
||||||
@ -260,7 +228,7 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
||||||
{
|
{
|
||||||
if (updated())
|
if (updated())
|
||||||
{
|
{
|
||||||
@ -353,18 +321,13 @@ void turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
|||||||
).fvPatchScalarField::operator=(Twall);
|
).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)
|
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() << ':'
|
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||||
<< patch().name() << ':'
|
<< patch().name() << ':'
|
||||||
@ -380,74 +343,33 @@ void turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(*this, i)
|
fixedValueFvPatchScalarField::updateCoeffs();
|
||||||
{
|
|
||||||
// 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 turbulentTemperatureCoupledBaffleFvPatchScalarField::write
|
void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::write
|
||||||
(
|
(
|
||||||
Ostream& os
|
Ostream& os
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
mixedFvPatchScalarField::write(os);
|
fixedValueFvPatchScalarField::write(os);
|
||||||
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
|
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
|
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("fixesValue") << fixesValue_ << token::END_STATEMENT << nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
makePatchTypeField
|
makePatchTypeField
|
||||||
(
|
(
|
||||||
fvPatchScalarField,
|
fvPatchScalarField,
|
||||||
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace compressible
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -23,16 +23,15 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::compressible::turbulentTemperatureCoupledBaffleFvPatchScalarField
|
turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Mixed boundary condition for temperature, to be used for heat-transfer
|
Harmonic fixed value boundary condition for temperature, to be used
|
||||||
on back-to-back baffles.
|
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:
|
Example usage:
|
||||||
myInterfacePatchName
|
myInterfacePatchName
|
||||||
@ -65,16 +64,12 @@ SourceFiles
|
|||||||
#ifndef turbulentTemperatureCoupledBaffleFvPatchScalarField_H
|
#ifndef turbulentTemperatureCoupledBaffleFvPatchScalarField_H
|
||||||
#define turbulentTemperatureCoupledBaffleFvPatchScalarField_H
|
#define turbulentTemperatureCoupledBaffleFvPatchScalarField_H
|
||||||
|
|
||||||
//#include "fvPatchFields.H"
|
#include "fixedValueFvPatchFields.H"
|
||||||
#include "mixedFvPatchFields.H"
|
|
||||||
//#include "fvPatch.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace compressible
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class turbulentTemperatureCoupledBaffleFvPatchScalarField Declaration
|
Class turbulentTemperatureCoupledBaffleFvPatchScalarField Declaration
|
||||||
@ -82,7 +77,7 @@ namespace compressible
|
|||||||
|
|
||||||
class turbulentTemperatureCoupledBaffleFvPatchScalarField
|
class turbulentTemperatureCoupledBaffleFvPatchScalarField
|
||||||
:
|
:
|
||||||
public mixedFvPatchScalarField
|
public fixedValueFvPatchScalarField
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
@ -92,8 +87,6 @@ class turbulentTemperatureCoupledBaffleFvPatchScalarField
|
|||||||
//- Name of thermal conductivity field
|
//- Name of thermal conductivity field
|
||||||
const word KName_;
|
const word KName_;
|
||||||
|
|
||||||
bool fixesValue_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -104,7 +97,7 @@ class turbulentTemperatureCoupledBaffleFvPatchScalarField
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("compressible::turbulentTemperatureCoupledBaffle");
|
TypeName("turbulentTemperatureCoupledBaffle");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -172,14 +165,6 @@ public:
|
|||||||
//- Get corresponding K field
|
//- Get corresponding K field
|
||||||
tmp<scalarField> K() const;
|
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
|
//- Update the coefficients associated with the patch field
|
||||||
virtual void updateCoeffs();
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
@ -190,7 +175,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace compressible
|
|
||||||
} // End namespace Foam
|
} // 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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -32,7 +32,8 @@ boundaryField
|
|||||||
|
|
||||||
walls
|
walls
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,8 @@ boundaryField
|
|||||||
|
|
||||||
walls
|
walls
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,8 @@ boundaryField
|
|||||||
|
|
||||||
walls
|
walls
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user