ENH: Adding eddyDissipationDiffusionModel, thermocouple probe and thermocoupleTestCase

This commit is contained in:
sergio
2016-10-07 10:17:43 -07:00
parent 3c790e2316
commit b9b2ac694a
32 changed files with 1720 additions and 71 deletions

View File

@ -15,6 +15,8 @@ infinitelyFastChemistry/infinitelyFastChemistrys.C
PaSR/PaSRs.C
eddyDissipationDiffusionModel/eddyDissipationDiffusionModels.C
laminar/laminars.C
/*

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ M anipulation |
-------------------------------------------------------------------------------
License
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "eddyDissipationDiffusionModel.H"
namespace Foam
{
namespace combustionModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType>
eddyDissipationDiffusionModel<CombThermoType, ThermoType>::
eddyDissipationDiffusionModel
(
const word& modelType, const fvMesh& mesh, const word& phaseName
)
:
eddyDissipationModelBase<CombThermoType, ThermoType>
(
modelType,
mesh,
phaseName
),
Cd_(readScalar(this->coeffs().lookup("Cd")))
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType>
eddyDissipationDiffusionModel<CombThermoType, ThermoType>::
~eddyDissipationDiffusionModel()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType>
Foam::tmp<Foam::volScalarField>
eddyDissipationDiffusionModel<CombThermoType, ThermoType>::timeScale()
{
return (max(this->rtTurb(), this->rtDiff()));
}
template<class CombThermoType, class ThermoType>
Foam::tmp<Foam::volScalarField>
eddyDissipationDiffusionModel<CombThermoType, ThermoType>::rtDiff() const
{
tmp<volScalarField> tdelta
(
new volScalarField
(
IOobject
(
"tdelta",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar("delta", dimLength, 0),
zeroGradientFvPatchScalarField::typeName
)
);
volScalarField& delta = tdelta.ref();
delta.ref() = pow(this->mesh().V(), 1.0/3.0);
delta.correctBoundaryConditions();
// NOTE: Assume Prt = 1
return Cd_*this->turbulence().nuEff()/sqr(delta);
}
template<class CombThermoType, class ThermoType>
bool eddyDissipationDiffusionModel<CombThermoType, ThermoType>::read()
{
if (eddyDissipationModelBase<CombThermoType, ThermoType>::read())
{
this->coeffs().lookup("Cd") >> Cd_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,124 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ M anipulation |
-------------------------------------------------------------------------------
License
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::combustionModels::eddyDissipationDiffusionModel
Description
Eddy dissipation model based on the principle of mixed is burnt.
SourceFiles
eddyDissipationDiffusionModel.C
\*---------------------------------------------------------------------------*/
#ifndef eddyDissipationDiffusionModel_H
#define eddyDissipationDiffusionModel_H
#include "eddyDissipationModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace combustionModels
{
/*---------------------------------------------------------------------------*\
Class eddyDissipationDiffusionModel Declaration
\*---------------------------------------------------------------------------*/
template<class CombThermoType, class ThermoType>
class eddyDissipationDiffusionModel
:
public eddyDissipationModelBase<CombThermoType, ThermoType>
{
// Private data
//- Diffussivity constant
scalar Cd_;
// Private memeber functions
//- Disallow copy construct
eddyDissipationDiffusionModel(const eddyDissipationDiffusionModel&);
//- Disallow default bitwise assignment
void operator=(const eddyDissipationDiffusionModel&);
public:
//- Runtime type information
TypeName("EDC");
// Constructors
//- Construct from components
eddyDissipationDiffusionModel
(
const word& modelType,
const fvMesh& mesh,
const word& phaseName
);
//- Destructor
virtual ~eddyDissipationDiffusionModel();
// Member Functions
//- Calculate time scale
virtual tmp<volScalarField> timeScale();
//- Return the reciprocal of the diffusion time scale
tmp<volScalarField> rtDiff() const;
// I-O
//- Update properties
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "eddyDissipationDiffusionModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,71 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "makeCombustionTypes.H"
#include "thermoPhysicsTypes.H"
#include "psiThermoCombustion.H"
#include "rhoThermoCombustion.H"
#include "eddyDissipationDiffusionModel.H"
#include "eddyDissipationModelBase.H"
#include "singleStepCombustion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeCombustionTypesThermo
(
eddyDissipationDiffusionModel,
psiThermoCombustion,
gasHThermoPhysics,
psiCombustionModel
);
makeCombustionTypesThermo
(
eddyDissipationDiffusionModel,
psiThermoCombustion,
constGasHThermoPhysics,
psiCombustionModel
);
makeCombustionTypesThermo
(
eddyDissipationDiffusionModel,
rhoThermoCombustion,
gasHThermoPhysics,
rhoCombustionModel
);
makeCombustionTypesThermo
(
eddyDissipationDiffusionModel,
rhoThermoCombustion,
constGasHThermoPhysics,
rhoCombustionModel
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,133 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ M anipulation |
-------------------------------------------------------------------------------
License
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "eddyDissipationModelBase.H"
#include "zeroGradientFvPatchFields.H"
namespace Foam
{
namespace combustionModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType>
eddyDissipationModelBase<CombThermoType, ThermoType>::eddyDissipationModelBase
(
const word& modelType, const fvMesh& mesh, const word& phaseName
)
:
singleStepCombustion<CombThermoType, ThermoType>
(
modelType,
mesh,
phaseName
),
CEDC_(readScalar(this->coeffs().lookup("CEDC")))
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType>
eddyDissipationModelBase<CombThermoType, ThermoType>::
~eddyDissipationModelBase()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType>
Foam::tmp<Foam::volScalarField>
eddyDissipationModelBase<CombThermoType, ThermoType>::rtTurb() const
{
return
CEDC_*this->turbulence().epsilon()
/ max
(
this->turbulence().k(),
dimensionedScalar("SMALL",sqr(dimVelocity), SMALL)
);
}
template<class CombThermoType, class ThermoType>
void eddyDissipationModelBase<CombThermoType, ThermoType>::correct()
{
this->wFuel_ ==
dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0);
if (this->active())
{
this->singleMixturePtr_->fresCorrect();
const label fuelI = this->singleMixturePtr_->fuelIndex();
const volScalarField& YFuel =
this->thermoPtr_->composition().Y()[fuelI];
const dimensionedScalar s = this->singleMixturePtr_->s();
if (this->thermoPtr_->composition().contains("O2"))
{
const volScalarField& YO2 =
this->thermoPtr_->composition().Y("O2");
this->wFuel_ ==
this->rho()
* min(YFuel, YO2/s.value())
* timeScale();
}
else
{
FatalErrorInFunction
<< "You selected a combustion model which requieres O2 mass"
<< " to be present in the mixture"
<< exit(FatalError);
}
}
}
template<class CombThermoType, class ThermoType>
bool eddyDissipationModelBase<CombThermoType, ThermoType>::read()
{
if (singleStepCombustion<CombThermoType, ThermoType>::read())
{
this->coeffs().lookup("CEDC") >> CEDC_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ M anipulation |
-------------------------------------------------------------------------------
License
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::combustionModels::eddyDissipationModelBase
Description
SourceFiles
eddyDissipationModelBase.C
\*---------------------------------------------------------------------------*/
#ifndef eddyDissipationModelBase_H
#define eddyDissipationModelBase_H
#include "singleStepCombustion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace combustionModels
{
/*---------------------------------------------------------------------------*\
Class eddyDissipationModelBase Declaration
\*---------------------------------------------------------------------------*/
template<class CombThermoType, class ThermoType>
class eddyDissipationModelBase
:
public singleStepCombustion<CombThermoType, ThermoType>
{
// Private data
//- EDC model constant
scalar CEDC_;
// Private Member Functions
//- Disallow copy construct
eddyDissipationModelBase(const eddyDissipationModelBase&);
//- Disallow default bitwise assignment
void operator=(const eddyDissipationModelBase&);
public:
//- Runtime type information
//TypeName("eddyDissipationModelBase");
// Constructors
//- Construct from components
eddyDissipationModelBase
(
const word& modelType,
const fvMesh& mesh,
const word& phaseName
);
//- Destructor
virtual ~eddyDissipationModelBase();
// Member Functions
//- Return the reciprocal of the turbulent mixing time scale
tmp<volScalarField> rtTurb() const;
//- Correct combustion rate
void correct();
//- Calculate time scale
virtual tmp<volScalarField> timeScale() = 0;
// I-O
//- Update properties
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "eddyDissipationModelBase.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,4 +25,6 @@ writeDictionary/writeDictionary.C
writeObjects/writeObjects.C
thermoCoupleProbes/thermoCoupleProbes.C
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects

View File

@ -1,5 +1,12 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude
LIB_LIBS = \
-lfiniteVolume
-lfiniteVolume \
-lfluidThermophysicalModels \
-lcompressibleTransportModels \
-lODE

View File

@ -0,0 +1,219 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "thermoCoupleProbes.H"
#include "mathematicalConstants.H"
#include "constants.H"
#include "addToRunTimeSelectionTable.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(thermoCoupleProbes, 0);
addToRunTimeSelectionTable(functionObject, thermoCoupleProbes, dictionary);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::thermoCoupleProbes::readDict(const dictionary& dict)
{
rho_ = readScalar(dict.lookup("rho"));
Cp_ = readScalar(dict.lookup("Cp"));
d_ = readScalar(dict.lookup("d"));
epsilon_ = readScalar(dict.lookup("epsilon"));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::thermoCoupleProbes::thermoCoupleProbes
(
const word& name,
const Time& runTime,
const dictionary& dict,
const bool loadFromFiles,
const bool doFindElements
)
:
probes(name, runTime, dict, loadFromFiles, doFindElements),
ODESystem(),
radName_(dict.lookup("radName")),
thermo_
(
mesh_.lookupObject<fluidThermo>(basicThermo::dictName)
),
odeSolver_(ODESolver::New(*this, dict)),
Ttc_(this->size(), 0.0)
{
readDict(dict);
// Check if the property exist (resume old calculation)
// or of it is new.
if (foundProperty(typeName))
{
const dictionary& dict =
this->stateDict().subDict(this->name()).subDict(typeName);
dict.lookup("Tc") >> Ttc_;
}
else
{
Ttc_ = probes::sample(thermo_.T());
}
// Initialize thermocouple at initial T (room temperature)
if (doFindElements)
{
// Find the elements
findElements(mesh_);
// Open the probe streams
prepare();
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::thermoCoupleProbes::~thermoCoupleProbes()
{}
Foam::label Foam::thermoCoupleProbes::nEqns() const
{
return this->size();
}
void Foam::thermoCoupleProbes::derivatives
(
const scalar x,
const scalarField& y,
scalarField& dydx
) const
{
scalarField G(y.size(), 0.0);
scalarField Tc(y.size(), 0.0);
scalarField Uc(y.size(), 0.0);
scalarField rhoc(y.size(), 0.0);
scalarField muc(y.size(), 0.0);
scalarField Cpc(y.size(), 0.0);
scalarField kappac(y.size(), 0.0);
if (radName_ != "none")
{
G = sample(mesh_.lookupObject<volScalarField>(radName_));
}
Tc = probes::sample(thermo_.T());
Uc = mag(this->sample(mesh_.lookupObject<volVectorField>("U")));
rhoc = this->sample(thermo_.rho()());
kappac = this->sample(thermo_.kappa()());
muc = this->sample(thermo_.mu()());
Cpc = this->sample(thermo_.Cp()());
scalarField Re(rhoc*Uc*d_/(muc + ROOTVSMALL));
scalarField Pr(Cpc*muc/(kappac + ROOTVSMALL));
//scalarField Nu(2.0 + 0.6*sqrt(Re)*cbrt(Pr));
scalarField Nu(2.0 + (0.4*sqrt(Re) + 0.06*pow(Re, 2/3))*pow(Pr, 0.4));
scalarField htc(Nu*kappac/d_);
const scalar sigma = physicoChemical::sigma.value();
scalar area = 4*constant::mathematical::pi*sqr(d_/2);
scalar volume = (4/3)*constant::mathematical::pi*pow(d_/2, 3);
dydx =
(epsilon_*(G/4 - sigma*pow(y, 4.0))*area + htc*(Tc - y)*area)
/ (rho_*Cp_*volume);
}
void Foam::thermoCoupleProbes::jacobian
(
const scalar x,
const scalarField& y,
scalarField& dfdt,
scalarSquareMatrix& dfdy
) const
{
derivatives(x, y, dfdt);
for (label i=0; i<nEqns(); i++)
{
for (label j=0; j<nEqns(); j++)
{
dfdy(i, j) = 0.0;
}
}
}
bool Foam::thermoCoupleProbes::write()
{
if (this->size())
{
sampleAndWrite<scalar>(thermo_.T());
dictionary probeDict;
probeDict.add("Tc", Ttc_);
setProperty(typeName, probeDict);
return true;
}
return false;
}
bool Foam::thermoCoupleProbes::execute()
{
if (this->size())
{
scalar dt = mesh_.time().deltaTValue();
scalar t = mesh_.time().value();
odeSolver_->solve(t, t+dt, Ttc_, dt);
return true;
}
return false;
}
bool Foam::thermoCoupleProbes::read(const dictionary& dict)
{
readDict(dict);
probes::read(dict);
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,217 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::thermoCoupleProbes
Description
Sample probe for temperature using a thermocouple. Uses the correlation:
Nu = 2.0 + (0.4*sqrt(Re) + 0.06*pow(Re, 2/3))*pow(Pr, 0.4)
Example of function object specification:
\verbatim
probes
{
type thermoCoupleProbes;
solver rodas23;
absTol 1e-12;
relTol 1e-8;
interpolationScheme cellPoint;
// thermocouple properties
rho 8908;
Cp 440;
d 1e-3;
epsilon 0.85;
radName G;
functionObjectLibs ("libsampling.so");
outputControl timeStep;
outputInterval 1;
probeLocations
(
( 0.5 0.5 0.5 )
);
fields
(
T
);
}
\endverbatim
SourceFiles
thermoCoupleProbes.C
\*---------------------------------------------------------------------------*/
#ifndef thermoCoupleProbes_H
#define thermoCoupleProbes_H
#include "probes.H"
#include "ODESystem.H"
#include "ODESolver.H"
#include "basicThermo.H"
#include "fluidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class thermoCoupleProbes Declaration
\*---------------------------------------------------------------------------*/
class thermoCoupleProbes
:
public probes,
public ODESystem
{
protected:
// Protected data
//- Thermocouple density
scalar rho_;
//- Thermocouple heat capacity
scalar Cp_;
//- Thermocouple diameter
scalar d_;
//- Thermocouple emissivity
scalar epsilon_;
//- Name for the incident radiation field
word radName_;
//- Fluid thermo reference
const fluidThermo& thermo_;
//- ODESolver
autoPtr<ODESolver> odeSolver_;
//- Cached thermocouple temperature
scalarField Ttc_;
// Protected Member Functions
//- Sample and write a particular volume field
template<class Type>
void sampleAndWrite
(
const GeometricField<Type, fvPatchField, volMesh>&
);
//- Read dictionary settings
void readDict(const dictionary& dict);
private:
//- Disallow default bitwise copy construct
thermoCoupleProbes(const thermoCoupleProbes&);
//- Disallow default bitwise assignment
void operator=(const thermoCoupleProbes&);
public:
//- Runtime type information
TypeName("thermoCoupleProbes");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
thermoCoupleProbes
(
const word& name,
const Time& runTime,
const dictionary& dict,
const bool loadFromFiles = false,
const bool findElements = true
);
//- Destructor
virtual ~thermoCoupleProbes();
// ODE functions (overriding abstract functions in ODE.H)
//- Number of ODE's to solve
virtual label nEqns() const;
virtual void derivatives
(
const scalar t,
const scalarField& c,
scalarField& dcdt
) const;
virtual void jacobian
(
const scalar t,
const scalarField& c,
scalarField& dcdt,
scalarSquareMatrix& dfdc
) const;
//- Public members
//- Sample and write
virtual bool write();
//- Execute, currently does nothing
virtual bool execute();
//- Read
virtual bool read(const dictionary&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "thermoCoupleProbesTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "thermoCoupleProbes.H"
#include "volFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::thermoCoupleProbes::sampleAndWrite
(
const GeometricField<Type, fvPatchField, volMesh>& vField
)
{
if (Pstream::master())
{
unsigned int w = IOstream::defaultPrecision() + 7;
OFstream& probeStream = *probeFilePtrs_[vField.name()];
probeStream
<< setw(w)
<< vField.time().timeToUserTime(vField.time().value());
forAll(*this, probeI)
{
probeStream << ' ' << setw(w) << Ttc_[probeI];
}
probeStream << endl;
}
}
// ************************************************************************* //

View File

@ -8,6 +8,7 @@ EXE_INC = \
-I$(LIB_SRC)/conversion/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \

View File

@ -232,24 +232,6 @@ Foam::patchProbes::patchProbes
}
Foam::patchProbes::patchProbes
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles,
const bool readFields
)
:
probes(name, obr, dict, loadFromFiles, false)
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::patchProbes::~patchProbes()

View File

@ -172,18 +172,6 @@ public:
const bool readFields = true
);
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
patchProbes
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false,
const bool readFields = true
);
//- Destructor
virtual ~patchProbes();

View File

@ -273,7 +273,7 @@ Foam::probes::probes
const bool readFields
)
:
functionObject(name),
stateFunctionObject(name, runTime),
pointField(0),
mesh_
(
@ -296,31 +296,6 @@ Foam::probes::probes
}
}
Foam::probes::probes
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles,
const bool readFields
)
:
functionObject(name),
pointField(0),
mesh_(refCast<const fvMesh>(obr)),
loadFromFiles_(loadFromFiles),
fieldSelection_(),
fixedLocations_(true),
interpolationScheme_("cell")
{
if (readFields)
{
read(dict);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::probes::~probes()

View File

@ -73,7 +73,7 @@ SourceFiles
#ifndef probes_H
#define probes_H
#include "functionObject.H"
#include "stateFunctionObject.H"
#include "HashPtrTable.H"
#include "OFstream.H"
#include "polyMesh.H"
@ -83,6 +83,8 @@ SourceFiles
#include "surfaceMesh.H"
#include "wordReList.H"
using namespace Foam::functionObjects;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -101,7 +103,7 @@ class mapPolyMesh;
class probes
:
public functionObject,
public stateFunctionObject,
public pointField
{
protected:
@ -241,17 +243,6 @@ public:
const bool readFields = true
);
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
probes
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles = false,
const bool readFields = true
);
//- Destructor
virtual ~probes();

View File

@ -0,0 +1,32 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object IDefault;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 1 0 -3 0 0 0 0 ];
internalField uniform 0;
boundaryField
{
walls
{
type greyDiffusiveRadiation;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 298.15;
boundaryField
{
walls
{
type fixedValue;
value uniform 873.15;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
walls
{
type fixedValue;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 1e5;
boundaryField
{
walls
{
type calculated;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 1e5;
boundaryField
{
walls
{
type fixedFluxPressure;
value uniform 1e5;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
#------------------------------------------------------------------------------

View File

@ -0,0 +1,13 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Get application name
application=$(getApplication)
runApplication blockMesh
runApplication $application
#------------------------------------------------------------------------------

View File

@ -0,0 +1,26 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object boundaryRadiationProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
".*"
{
mode lookup;
emissivity 1.0;
absorptivity 1.0;
}
// ************************************************************************* //

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 0 0);
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object radiationProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
radiation on;
radiationModel fvDOM;
fvDOMCoeffs
{
nPhi 3;
nTheta 5;
convergence 1e-3;
maxIter 10;
}
// Number of flow iterations per radiation iteration
solverFreq 10;
absorptionEmissionModel constantAbsorptionEmission;
constantAbsorptionEmissionCoeffs
{
absorptivity absorptivity [ m^-1 ] 0.01;
emissivity emissivity [ m^-1 ] 0.01;
E E [ kg m^-1 s^-3 ] 0;
}
scatterModel none;
sootModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType
{
type heRhoThermo;
mixture pureMixture;
transport const;
thermo hConst;
equationOfState perfectGas;
specie specie;
energy sensibleEnthalpy;
}
//pRef 100000;
mixture
{
specie
{
nMoles 1;
molWeight 28.9;
}
thermodynamics
{
Cp 1000;
Hf 0;
}
transport
{
mu 1.8e-05;
Pr 0.7;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,61 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 1)
(1 0 1)
(1 1 1)
(0 1 1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 20) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
walls
{
type wall;
faces
(
(1 5 4 0)
(3 7 6 2)
(0 4 7 3)
(2 6 5 1)
(0 3 2 1)
(4 5 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,90 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application buoyantPimpleFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 90;
deltaT 0.1;
writeControl adjustableRunTime;
writeInterval 10;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
adjustTimeStep no;
maxCo 0.5;
functions
{
probes
{
type thermoCoupleProbes;
solver rodas23;
absTol 1e-12;
relTol 1e-8;
interpolationScheme cellPoint;
// thermocouple properties
rho 8908;
Cp 440;
d 1e-3;
epsilon 0.85;
radName G;
functionObjectLibs
(
"libutilityFunctionObjects.so"
);
writeControl timeStep;
writeInterval 1;
probeLocations
(
( 0.5 0.5 0.5 )
);
fields
(
T
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss upwind;
div(phi,h) Gauss upwind;
div(phi,e) Gauss upwind;
div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind;
div(phi,R) Gauss upwind;
div(phi,K) Gauss linear;
div(phi,Ekp) Gauss linear;
div(R) Gauss linear;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
div(Ji,Ii_h) Gauss linearUpwind grad(Ii_h);
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,85 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"rho.*"
{
solver PCG;
preconditioner DIC;
tolerance 0;
relTol 0;
}
p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-8;
relTol 0.01;
}
p_rghFinal
{
$p_rgh;
relTol 0;
}
"(U|h|e|k|epsilon|R)"
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-6;
relTol 0.1;
maxIter 0;
}
"(U|h|e|k|epsilon|R)Final"
{
$U;
relTol 0;
maxIter 0;
}
Ii
{
solver GAMG;
tolerance 1e-4;
relTol 0;
smoother symGaussSeidel;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
maxIter 5;
nPreSweeps 0;
nPostSweeps 1;
}
}
PIMPLE
{
momentumPredictor no;
nOuterCorrectors 1;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 1e5;
}
// ************************************************************************* //