Merge branch 'master' into cvm

This commit is contained in:
graham
2010-09-16 15:13:45 +01:00
483 changed files with 34133 additions and 4638 deletions

View File

@ -14,6 +14,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/surfaceFilmModels/lnInclude \
@ -36,6 +37,7 @@ EXE_LIBS = \
-lsolidMixture \ -lsolidMixture \
-lthermophysicalFunctions \ -lthermophysicalFunctions \
-lreactionThermophysicalModels \ -lreactionThermophysicalModels \
-lSLGThermo \
-lchemistryModel \ -lchemistryModel \
-lradiation \ -lradiation \
-lsurfaceFilmModels \ -lsurfaceFilmModels \

View File

@ -39,11 +39,12 @@ Description
#include "hCombustionThermo.H" #include "hCombustionThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicThermoCloud.H" #include "basicThermoCloud.H"
#include "CoalCloud.H" #include "coalCloud.H"
#include "psiChemistryModel.H" #include "psiChemistryModel.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "timeActivatedExplicitSource.H" #include "timeActivatedExplicitSource.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,11 +1,11 @@
Info<< "\nConstructing coal cloud" << endl; Info<< "\nConstructing coal cloud" << endl;
thermoCoalCloud coalParcels coalCloud coalParcels
( (
"coalCloud1", "coalCloud1",
rho, rho,
U, U,
g, g,
thermo slgThermo
); );
Info<< "\nConstructing limestone cloud" << endl; Info<< "\nConstructing limestone cloud" << endl;
@ -15,5 +15,5 @@ basicThermoCloud limestoneParcels
rho, rho,
U, U,
g, g,
thermo slgThermo
); );

View File

@ -8,6 +8,8 @@
hsCombustionThermo& thermo = chemistry.thermo(); hsCombustionThermo& thermo = chemistry.thermo();
SLGThermo slgThermo(mesh, thermo);
basicMultiComponentMixture& composition = thermo.composition(); basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y(); PtrList<volScalarField>& Y = composition.Y();

View File

@ -14,6 +14,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \
@ -35,6 +36,7 @@ EXE_LIBS = \
-lsolidMixture \ -lsolidMixture \
-lthermophysicalFunctions \ -lthermophysicalFunctions \
-lreactionThermophysicalModels \ -lreactionThermophysicalModels \
-lSLGThermo \
-lchemistryModel \ -lchemistryModel \
-lradiation \ -lradiation \
-lODE \ -lODE \

View File

@ -1,9 +1,9 @@
Info<< "\nConstructing reacting cloud" << endl; Info<< "\nConstructing reacting cloud" << endl;
icoPoly8ThermoReactingMultiphaseCloud parcels basicReactingMultiphaseCloud parcels
( (
"reactingCloud1", "reactingCloud1",
rho, rho,
U, U,
g, g,
thermo slgThermo
); );

View File

@ -8,6 +8,8 @@
hsReactionThermo& thermo = chemistry.thermo(); hsReactionThermo& thermo = chemistry.thermo();
SLGThermo slgThermo(mesh, thermo);
basicMultiComponentMixture& composition = thermo.composition(); basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y(); PtrList<volScalarField>& Y = composition.Y();

View File

@ -33,7 +33,6 @@ Description
- reacting multiphase parcel cloud - reacting multiphase parcel cloud
- porous media - porous media
- mass, momentum and energy sources - mass, momentum and energy sources
- polynomial based, incompressible thermodynamics (f(T))
Note: ddtPhiCorr not used here when porous zones are active Note: ddtPhiCorr not used here when porous zones are active
- not well defined for porous calculations - not well defined for porous calculations
@ -43,12 +42,13 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "hReactionThermo.H" #include "hReactionThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "BasicReactingMultiphaseCloud.H" #include "basicReactingMultiphaseCloud.H"
#include "rhoChemistryModel.H" #include "rhoChemistryModel.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "porousZones.H" #include "porousZones.H"
#include "timeActivatedExplicitSource.H" #include "timeActivatedExplicitSource.H"
#include "SLGThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,5 +1,3 @@
DEV_PATH=./../..
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \
@ -13,6 +11,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/surfaceFilmModels/lnInclude \
@ -31,6 +30,7 @@ EXE_LIBS = \
-lsolidMixture \ -lsolidMixture \
-lthermophysicalFunctions \ -lthermophysicalFunctions \
-lreactionThermophysicalModels \ -lreactionThermophysicalModels \
-lSLGThermo \
-lchemistryModel \ -lchemistryModel \
-lradiation \ -lradiation \
-lsurfaceFilmModels \ -lsurfaceFilmModels \

View File

@ -1,9 +1,9 @@
Info<< "\nConstructing reacting cloud" << endl; Info<< "\nConstructing reacting cloud" << endl;
thermoReactingCloud parcels basicReactingCloud parcels
( (
"reactingCloud1", "reactingCloud1",
rho, rho,
U, U,
g, g,
thermo slgThermo
); );

View File

@ -8,6 +8,8 @@
hsCombustionThermo& thermo = chemistry.thermo(); hsCombustionThermo& thermo = chemistry.thermo();
SLGThermo slgThermo(mesh, thermo);
basicMultiComponentMixture& composition = thermo.composition(); basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y(); PtrList<volScalarField>& Y = composition.Y();

View File

@ -33,11 +33,12 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "hCombustionThermo.H" #include "hCombustionThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "BasicReactingCloud.H" #include "basicReactingCloud.H"
#include "surfaceFilmModel.H" #include "surfaceFilmModel.H"
#include "psiChemistryModel.H" #include "psiChemistryModel.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -13,6 +13,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \
@ -34,6 +35,7 @@ EXE_LIBS = \
-lsolidMixture \ -lsolidMixture \
-lthermophysicalFunctions \ -lthermophysicalFunctions \
-lreactionThermophysicalModels \ -lreactionThermophysicalModels \
-lSLGThermo \
-lchemistryModel \ -lchemistryModel \
-lradiation \ -lradiation \
-lODE \ -lODE \

View File

@ -1,9 +1,9 @@
Info<< "\nConstructing reacting cloud" << endl; Info<< "\nConstructing reacting cloud" << endl;
thermoReactingCloud parcels basicReactingCloud parcels
( (
"reactingCloud1", "reactingCloud1",
rho, rho,
U, U,
g, g,
thermo slgThermo
); );

View File

@ -8,6 +8,8 @@
hsCombustionThermo& thermo = chemistry.thermo(); hsCombustionThermo& thermo = chemistry.thermo();
SLGThermo slgThermo(mesh, thermo);
basicMultiComponentMixture& composition = thermo.composition(); basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y(); PtrList<volScalarField>& Y = composition.Y();

View File

@ -33,10 +33,11 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "hCombustionThermo.H" #include "hCombustionThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "BasicReactingCloud.H" #include "basicReactingCloud.H"
#include "psiChemistryModel.H" #include "psiChemistryModel.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -4,12 +4,24 @@ fvVectorMatrix UbEqn(Ub, Ub.dimensions()*dimVol/dimTime);
{ {
{ {
volTensorField gradUaT = fvc::grad(Ua)().T(); volTensorField gradUaT = fvc::grad(Ua)().T();
if (kineticTheory.on())
{
kineticTheory.solve(gradUaT);
nuEffa = kineticTheory.mua()/rhoa;
}
else // If not using kinetic theory is using Ct model
{
nuEffa = sqr(Ct)*nutb + nua;
}
volTensorField Rca volTensorField Rca
( (
"Rca", "Rca",
((2.0/3.0)*I)*(sqr(Ct)*k + nuEffa*tr(gradUaT)) - nuEffa*gradUaT ((2.0/3.0)*I)*(sqr(Ct)*k + nuEffa*tr(gradUaT)) - nuEffa*gradUaT
); );
if (kineticTheory.on()) if (kineticTheory.on())
{ {
Rca -= ((kineticTheory.lambda()/rhoa)*tr(gradUaT))*tensor(I); Rca -= ((kineticTheory.lambda()/rhoa)*tr(gradUaT))*tensor(I);

View File

@ -0,0 +1,62 @@
if(turbulence)
{
if (mesh.changing())
{
y.correct();
}
tmp<volTensorField> tgradUb = fvc::grad(Ub);
volScalarField G = 2*nutb*(tgradUb() && dev(symm(tgradUb())));
tgradUb.clear();
#include "wallFunctions.H"
// Dissipation equation
fvScalarMatrix epsEqn
(
fvm::ddt(beta, epsilon)
+ fvm::div(phib, epsilon)
- fvm::laplacian
(
alphaEps*nuEffb, epsilon,
"laplacian(DepsilonEff,epsilon)"
)
==
C1*beta*G*epsilon/k
- fvm::Sp(C2*beta*epsilon/k, epsilon)
);
#include "wallDissipation.H"
epsEqn.relax();
epsEqn.solve();
epsilon.max(dimensionedScalar("zero", epsilon.dimensions(), 1.0e-15));
// Turbulent kinetic energy equation
fvScalarMatrix kEqn
(
fvm::ddt(beta, k)
+ fvm::div(phib, k)
- fvm::laplacian
(
alphak*nuEffb, k,
"laplacian(DkEff,k)"
)
==
beta*G
- fvm::Sp(beta*epsilon/k, k)
);
kEqn.relax();
kEqn.solve();
k.max(dimensionedScalar("zero", k.dimensions(), 1.0e-8));
//- Re-calculate turbulence viscosity
nutb = Cmu*sqr(k)/epsilon;
#include "wallViscosity.H"
}
nuEffb = nutb + nub;

View File

@ -102,7 +102,7 @@ Foam::tmp<Foam::volScalarField> Foam::JohnsonJacksonFrictionalStress::muf
const volScalarField& alpha, const volScalarField& alpha,
const dimensionedScalar& alphaMax, const dimensionedScalar& alphaMax,
const volScalarField& pf, const volScalarField& pf,
const volTensorField& D, const volSymmTensorField& D,
const dimensionedScalar& phi const dimensionedScalar& phi
) const ) const
{ {

View File

@ -93,7 +93,7 @@ public:
const volScalarField& alpha, const volScalarField& alpha,
const dimensionedScalar& alphaMax, const dimensionedScalar& alphaMax,
const volScalarField& pf, const volScalarField& pf,
const volTensorField& D, const volSymmTensorField& D,
const dimensionedScalar& phi const dimensionedScalar& phi
) const; ) const;
}; };

View File

@ -99,7 +99,7 @@ Foam::tmp<Foam::volScalarField> Foam::SchaefferFrictionalStress::muf
const volScalarField& alpha, const volScalarField& alpha,
const dimensionedScalar& alphaMax, const dimensionedScalar& alphaMax,
const volScalarField& pf, const volScalarField& pf,
const volTensorField& D, const volSymmTensorField& D,
const dimensionedScalar& phi const dimensionedScalar& phi
) const ) const
{ {
@ -124,9 +124,9 @@ Foam::tmp<Foam::volScalarField> Foam::SchaefferFrictionalStress::muf
volScalarField& muff = tmuf(); volScalarField& muff = tmuf();
forAll(D, celli) forAll (D, celli)
{ {
if (alpha[celli] > alphaMax.value()-5e-2) if (alpha[celli] > alphaMax.value() - 5e-2)
{ {
muff[celli] = muff[celli] =
0.5*pf[celli]*sin(phi.value()) 0.5*pf[celli]*sin(phi.value())

View File

@ -93,7 +93,7 @@ public:
const volScalarField& alpha, const volScalarField& alpha,
const dimensionedScalar& alphaMax, const dimensionedScalar& alphaMax,
const volScalarField& pf, const volScalarField& pf,
const volTensorField& D, const volSymmTensorField& D,
const dimensionedScalar& phi const dimensionedScalar& phi
) const; ) const;
}; };

View File

@ -48,7 +48,7 @@ namespace Foam
class frictionalStressModel class frictionalStressModel
{ {
// Private Member Functions // Private member functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
frictionalStressModel(const frictionalStressModel&); frictionalStressModel(const frictionalStressModel&);
@ -127,7 +127,7 @@ public:
const volScalarField& alpha, const volScalarField& alpha,
const dimensionedScalar& alphaMax, const dimensionedScalar& alphaMax,
const volScalarField& pf, const volScalarField& pf,
const volTensorField& D, const volSymmTensorField& D,
const dimensionedScalar& phi const dimensionedScalar& phi
) const = 0; ) const = 0;
}; };

View File

@ -56,12 +56,13 @@ Foam::kineticTheoryModel::kineticTheoryModel
"kineticTheoryProperties", "kineticTheoryProperties",
Ua_.time().constant(), Ua_.time().constant(),
Ua_.mesh(), Ua_.mesh(),
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
) )
), ),
kineticTheory_(kineticTheoryProperties_.lookup("kineticTheory")), kineticTheory_(kineticTheoryProperties_.lookup("kineticTheory")),
equilibrium_(kineticTheoryProperties_.lookup("equilibrium")), equilibrium_(kineticTheoryProperties_.lookup("equilibrium")),
viscosityModel_ viscosityModel_
( (
kineticTheoryModels::viscosityModel::New kineticTheoryModels::viscosityModel::New
@ -192,24 +193,19 @@ Foam::kineticTheoryModel::~kineticTheoryModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::kineticTheoryModel::solve() void Foam::kineticTheoryModel::solve(const volTensorField& gradUat)
{ {
if (!kineticTheory_) if (!kineticTheory_)
{ {
return; return;
} }
word scheme("div(phi,Theta)");
volScalarField alpha = alpha_;
alpha.max(1.0e-6);
const scalar sqrtPi = sqrt(constant::mathematical::pi); const scalar sqrtPi = sqrt(constant::mathematical::pi);
surfaceScalarField phi = 1.5*rhoa_*phia_*fvc::interpolate(alpha_); surfaceScalarField phi = 1.5*rhoa_*phia_*fvc::interpolate(alpha_);
volTensorField dU = fvc::grad(Ua_); volTensorField dU = gradUat.T();//fvc::grad(Ua_);
volTensorField dUT = dU.T(); volSymmTensorField D = symm(dU);
volTensorField D = 0.5*(dU + dUT);
// NB, drag = K*alpha*beta, // NB, drag = K*alpha*beta,
// (the alpha and beta has been extracted from the drag function for // (the alpha and beta has been extracted from the drag function for
@ -220,45 +216,52 @@ void Foam::kineticTheoryModel::solve()
// Calculating the radial distribution function (solid volume fraction is // Calculating the radial distribution function (solid volume fraction is
// limited close to the packing limit, but this needs improvements) // limited close to the packing limit, but this needs improvements)
// The solution is higly unstable close to the packing limit. // The solution is higly unstable close to the packing limit.
gs0_ = radialModel_->g0(min(alpha, alphaMax_-1.0e-2), alphaMax_); gs0_ = radialModel_->g0
(
min(max(alpha_, 1e-6), alphaMax_ - 0.01),
alphaMax_
);
// particle pressure - coefficient in front of Theta (Eq. 3.22, p. 45) // particle pressure - coefficient in front of Theta (Eq. 3.22, p. 45)
volScalarField PsCoeff = volScalarField PsCoeff = granularPressureModel_->granularPressureCoeff
granularPressureModel_->granularPressureCoeff(alpha_,gs0_,rhoa_,e_ ); (
alpha_,
gs0_,
rhoa_,
e_
);
// 'thermal' conductivity (Table 3.3, p. 49)
kappa_ = conductivityModel_->kappa(alpha_, Theta_, gs0_, rhoa_, da_, e_);
// particle viscosity (Table 3.2, p.47)
mua_ = viscosityModel_->mua(alpha_, Theta_, gs0_, rhoa_, da_, e_);
dimensionedScalar Tsmall dimensionedScalar Tsmall
( (
"small", "small",
dimensionSet(0,2,-2,0,0,0,0), dimensionSet(0 , 2 ,-2 ,0 , 0, 0, 0),
1.0e-6 1.0e-6
); );
dimensionedScalar TsmallSqrt = sqrt(Tsmall); dimensionedScalar TsmallSqrt = sqrt(Tsmall);
volScalarField ThetaSqrt = sqrt(Theta_); volScalarField ThetaSqrt = sqrt(Theta_);
// 'thermal' conductivity (Table 3.3, p. 49)
kappa_ = conductivityModel_->kappa(alpha, Theta_, gs0_, rhoa_, da_, e_);
// particle viscosity (Table 3.2, p.47)
mua_ = viscosityModel_->mua(alpha, Theta_, gs0_, rhoa_, da_, e_);
// dissipation (Eq. 3.24, p.50) // dissipation (Eq. 3.24, p.50)
volScalarField gammaCoeff = volScalarField gammaCoeff =
12.0*(1.0 - e_*e_)*sqr(alpha)*rhoa_*gs0_*(1.0/da_) 12.0*(1.0 - sqr(e_))*sqr(alpha_)*rhoa_*gs0_*(1.0/da_)*ThetaSqrt/sqrtPi;
*ThetaSqrt/sqrtPi;
// Eq. 3.25, p. 50 Js = J1 - J2 // Eq. 3.25, p. 50 Js = J1 - J2
volScalarField J1 = 3.0*betaPrim; volScalarField J1 = 3.0*betaPrim;
volScalarField J2 = volScalarField J2 =
0.25*sqr(betaPrim)*da_*sqr(Ur) 0.25*sqr(betaPrim)*da_*sqr(Ur)
/(alpha*rhoa_*sqrtPi*(ThetaSqrt + TsmallSqrt)); /(max(alpha_, 1e-6)*rhoa_*sqrtPi*(ThetaSqrt + TsmallSqrt));
// bulk viscosity p. 45 (Lun et al. 1984). // bulk viscosity p. 45 (Lun et al. 1984).
lambda_ = (4.0/3.0)*sqr(alpha_)*rhoa_*da_*gs0_*(1.0+e_)*ThetaSqrt/sqrtPi; lambda_ = (4.0/3.0)*sqr(alpha_)*rhoa_*da_*gs0_*(1.0+e_)*ThetaSqrt/sqrtPi;
// stress tensor, Definitions, Table 3.1, p. 43 // stress tensor, Definitions, Table 3.1, p. 43
volTensorField tau = 2.0*mua_*D + (lambda_ - (2.0/3.0)*mua_)*tr(D)*I; volSymmTensorField tau = 2.0*mua_*D + (lambda_ - (2.0/3.0)*mua_)*tr(D)*I;
if (!equilibrium_) if (!equilibrium_)
{ {
@ -268,8 +271,8 @@ void Foam::kineticTheoryModel::solve()
// wrong sign infront of laplacian // wrong sign infront of laplacian
fvScalarMatrix ThetaEqn fvScalarMatrix ThetaEqn
( (
fvm::ddt(1.5*alpha*rhoa_, Theta_) fvm::ddt(1.5*alpha_*rhoa_, Theta_)
+ fvm::div(phi, Theta_, scheme) + fvm::div(phi, Theta_, "div(phi,Theta)")
== ==
fvm::SuSp(-((PsCoeff*I) && dU), Theta_) fvm::SuSp(-((PsCoeff*I) && dU), Theta_)
+ (tau && dU) + (tau && dU)
@ -290,33 +293,31 @@ void Foam::kineticTheoryModel::solve()
volScalarField K3 = 0.5*da_*rhoa_* volScalarField K3 = 0.5*da_*rhoa_*
( (
(sqrtPi/(3.0*(3.0-e_))) (sqrtPi/(3.0*(3.0-e_)))
*(1.0 + 0.4*(1.0 + e_)*(3.0*e_ - 1.0)*alpha*gs0_) *(1.0 + 0.4*(1.0 + e_)*(3.0*e_ - 1.0)*alpha_*gs0_)
+ 1.6*alpha*gs0_*(1.0 + e_)/sqrtPi +1.6*alpha_*gs0_*(1.0 + e_)/sqrtPi
); );
volScalarField K2 = volScalarField K2 =
4.0*da_*rhoa_*(1.0 + e_)*alpha*gs0_/(3.0*sqrtPi) - 2.0*K3/3.0; 4.0*da_*rhoa_*(1.0 + e_)*alpha_*gs0_/(3.0*sqrtPi) - 2.0*K3/3.0;
volScalarField K4 = 12.0*(1.0 - e_*e_)*rhoa_*gs0_/(da_*sqrtPi); volScalarField K4 = 12.0*(1.0 - sqr(e_))*rhoa_*gs0_/(da_*sqrtPi);
volScalarField trD = tr(D); volScalarField trD = tr(D);
volTensorField D2 = D & D; volScalarField tr2D = sqr(trD);
volScalarField tr2D = trD*trD; volScalarField trD2 = tr(D & D);
volScalarField trD2 = tr(D2);
volScalarField t1 = K1*alpha + rhoa_; volScalarField t1 = K1*alpha_ + rhoa_;
volScalarField l1 = -t1*trD; volScalarField l1 = -t1*trD;
volScalarField l2 = sqr(t1)*tr2D; volScalarField l2 = sqr(t1)*tr2D;
volScalarField l3 = 4.0*K4*alpha*(2.0*K3*trD2 + K2*tr2D); volScalarField l3 = 4.0*K4*max(alpha_, 1e-6)*(2.0*K3*trD2 + K2*tr2D);
Theta_ = sqr((l1 + sqrt(l2 + l3))/(2.0*(alpha + 1.0e-4)*K4)); Theta_ = sqr((l1 + sqrt(l2 + l3))/(2.0*(alpha_ + 1.0e-4)*K4));
} }
Theta_.max(1.0e-15); Theta_.max(1.0e-15);
Theta_.min(1.0e+3); Theta_.min(1.0e+3);
volScalarField pf = volScalarField pf = frictionalStressModel_->frictionalPressure
frictionalStressModel_->frictionalPressure
( (
alpha_, alpha_,
alphaMinFriction_, alphaMinFriction_,
@ -344,13 +345,11 @@ void Foam::kineticTheoryModel::solve()
phi_ phi_
); );
// add frictional stress for alpha > alphaMinFriction // add frictional stress
mua_ = viscosityModel_->mua(alpha, Theta_, gs0_, rhoa_, da_, e_) + muf; mua_ += muf;
mua_.min(1.0e+2); mua_.min(1.0e+2);
mua_.max(0.0); mua_.max(0.0);
lambda_ = (4.0/3.0)*sqr(alpha_)*rhoa_*da_*gs0_*(1.0 + e_)*ThetaSqrt/sqrtPi;
Info<< "kinTheory: max(Theta) = " << max(Theta_).value() << endl; Info<< "kinTheory: max(Theta) = " << max(Theta_).value() << endl;
volScalarField ktn = mua_/rhoa_; volScalarField ktn = mua_/rhoa_;

View File

@ -156,7 +156,7 @@ public:
// Member Functions // Member Functions
void solve(); void solve(const volTensorField& gradUat);
bool on() const bool on() const
{ {

View File

@ -5,6 +5,9 @@
volScalarField rUaA = 1.0/UaEqn.A(); volScalarField rUaA = 1.0/UaEqn.A();
volScalarField rUbA = 1.0/UbEqn.A(); volScalarField rUbA = 1.0/UbEqn.A();
phia == (fvc::interpolate(Ua) & mesh.Sf());
phib == (fvc::interpolate(Ub) & mesh.Sf());
rUaAf = fvc::interpolate(rUaA); rUaAf = fvc::interpolate(rUaA);
surfaceScalarField rUbAf = fvc::interpolate(rUbA); surfaceScalarField rUbAf = fvc::interpolate(rUbA);
@ -47,11 +50,10 @@
surfaceScalarField Dp surfaceScalarField Dp
( (
"(rho*(1|A(U)))", "(rho*(1|A(U)))", alphaf*rUaAf/rhoa + betaf*rUbAf/rhob
alphaf*rUaAf/rhoa + betaf*rUbAf/rhob
); );
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (

View File

@ -92,11 +92,6 @@ int main(int argc, char *argv[])
#include "kEpsilon.H" #include "kEpsilon.H"
if (kineticTheory.on())
{
kineticTheory.solve();
nuEffa += kineticTheory.mua()/rhoa;
}
#include "write.H" #include "write.H"
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -321,7 +321,7 @@ endOfSection {space}")"{space}
pointGroupEndIndex.append(strtol(endPtr, &endPtr, 16) - 1); pointGroupEndIndex.append(strtol(endPtr, &endPtr, 16) - 1);
// point group type skipped // point group type skipped
strtol(endPtr, &endPtr, 16); (void)strtol(endPtr, &endPtr, 16);
pointi = pointGroupStartIndex.last(); pointi = pointGroupStartIndex.last();
@ -435,7 +435,7 @@ endOfSection {space}")"{space}
faceGroupEndIndex.append(strtol(endPtr, &endPtr, 16) - 1); faceGroupEndIndex.append(strtol(endPtr, &endPtr, 16) - 1);
// face group type // face group type
strtol(endPtr, &endPtr, 16); (void)strtol(endPtr, &endPtr, 16);
faceGroupElementType = strtol(endPtr, &endPtr, 16); faceGroupElementType = strtol(endPtr, &endPtr, 16);
@ -583,7 +583,7 @@ endOfSection {space}")"{space}
cellGroupType.append(strtol(endPtr, &endPtr, 16)); cellGroupType.append(strtol(endPtr, &endPtr, 16));
// Note. Potentially skip cell set if type is zero. // Note. Potentially skip cell set if type is zero.
strtol(endPtr, &endPtr, 16); (void)strtol(endPtr, &endPtr, 16);
Info<< "CellGroup: " Info<< "CellGroup: "
<< cellGroupZoneID.last() << cellGroupZoneID.last()

View File

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-InonuniformTransformCyclic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude -I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lnonuniformTransformCyclic \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-ldynamicMesh -ldynamicMesh

View File

@ -955,6 +955,12 @@ int main(int argc, char *argv[])
argList::validArgs.append("faceZones"); argList::validArgs.append("faceZones");
argList::validArgs.append("thickness"); argList::validArgs.append("thickness");
Foam::argList::addBoolOption
(
"oneD",
"generate columns of 1D cells"
);
#include "addRegionOption.H" #include "addRegionOption.H"
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
#include "setRootCase.H" #include "setRootCase.H"
@ -966,6 +972,7 @@ int main(int argc, char *argv[])
const wordList zoneNames(IStringStream(args.additionalArgs()[1])()); const wordList zoneNames(IStringStream(args.additionalArgs()[1])());
scalar thickness = readScalar(IStringStream(args.additionalArgs()[2])()); scalar thickness = readScalar(IStringStream(args.additionalArgs()[2])());
bool overwrite = args.optionFound("overwrite"); bool overwrite = args.optionFound("overwrite");
bool oneD = args.optionFound("oneD");
Info<< "Extruding zones " << zoneNames Info<< "Extruding zones " << zoneNames
@ -1225,9 +1232,25 @@ int main(int argc, char *argv[])
label nSide = 0; label nSide = 0;
forAll(zoneSidePatch, zoneI) forAll(zoneSidePatch, zoneI)
{ {
if (zoneSidePatch[zoneI] > 0) if (oneD)
{
// Always add empty patches, one per zone.
word patchName = faceZones[zoneI].name() + "_" + "side";
zoneSidePatch[zoneI] = addPatch<emptyPolyPatch>
(
mesh,
patchName
);
Info<< zoneSidePatch[zoneI] << '\t' << patchName << nl;
nSide++;
}
else if (zoneSidePatch[zoneI] > 0)
{ {
word patchName = faceZones[zoneI].name() + "_" + "side"; word patchName = faceZones[zoneI].name() + "_" + "side";
zoneSidePatch[zoneI] = addPatch<polyPatch> zoneSidePatch[zoneI] = addPatch<polyPatch>
( (
mesh, mesh,
@ -1257,47 +1280,53 @@ int main(int argc, char *argv[])
); );
label nInter = 0; label nInter = 0;
forAll(zoneZonePatch_min, minZone) if (!oneD)
{ {
for (label maxZone = minZone; maxZone < faceZones.size(); maxZone++) forAll(zoneZonePatch_min, minZone)
{ {
label index = minZone*faceZones.size()+maxZone; for (label maxZone = minZone; maxZone < faceZones.size(); maxZone++)
if (zoneZonePatch_min[index] > 0)
{ {
word minToMax = label index = minZone*faceZones.size()+maxZone;
faceZones[minZone].name()
+ "_to_"
+ faceZones[maxZone].name();
word maxToMin =
faceZones[maxZone].name()
+ "_to_"
+ faceZones[minZone].name();
{
transformDict.set("neighbourPatch", maxToMin);
zoneZonePatch_min[index] =
addPatch<nonuniformTransformCyclicPolyPatch>
(
mesh,
minToMax,
transformDict
);
Info<< zoneZonePatch_min[index] << '\t' << minToMax << nl;
nInter++;
}
{
transformDict.set("neighbourPatch", minToMax);
zoneZonePatch_max[index] =
addPatch<nonuniformTransformCyclicPolyPatch>
(
mesh,
maxToMin,
transformDict
);
Info<< zoneZonePatch_max[index] << '\t' << maxToMin << nl;
nInter++;
}
if (zoneZonePatch_min[index] > 0)
{
word minToMax =
faceZones[minZone].name()
+ "_to_"
+ faceZones[maxZone].name();
word maxToMin =
faceZones[maxZone].name()
+ "_to_"
+ faceZones[minZone].name();
{
transformDict.set("neighbourPatch", maxToMin);
zoneZonePatch_min[index] =
addPatch<nonuniformTransformCyclicPolyPatch>
(
mesh,
minToMax,
transformDict
);
Info<< zoneZonePatch_min[index] << '\t' << minToMax
<< nl;
nInter++;
}
{
transformDict.set("neighbourPatch", minToMax);
zoneZonePatch_max[index] =
addPatch<nonuniformTransformCyclicPolyPatch>
(
mesh,
maxToMin,
transformDict
);
Info<< zoneZonePatch_max[index] << '\t' << maxToMin
<< nl;
nInter++;
}
}
} }
} }
} }
@ -1323,7 +1352,16 @@ int main(int argc, char *argv[])
labelList& ePatches = extrudeEdgePatches[edgeI]; labelList& ePatches = extrudeEdgePatches[edgeI];
if (eFaces.size() == 2) if (oneD)
{
nonManifoldEdge[edgeI] = 1;
ePatches.setSize(eFaces.size());
forAll(eFaces, i)
{
ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
}
}
else if (eFaces.size() == 2)
{ {
label zone0 = zoneID[eFaces[0]]; label zone0 = zoneID[eFaces[0]];
label zone1 = zoneID[eFaces[1]]; label zone1 = zoneID[eFaces[1]];

View File

@ -1,8 +0,0 @@
fvPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicFvPatch.C
pointPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPointPatch.C
polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.C
pointPatchFields/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPointPatchFields.C
fvsPatchFields/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicFvsPatchFields.C
fvPatchFields/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicFvPatchFields.C
LIB = $(FOAM_LIBBIN)/libnonuniformTransformCyclic

View File

@ -1,5 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lfiniteVolume

View File

@ -381,6 +381,7 @@ int main(int argc, char *argv[])
"write cellMap, faceMap, pointMap in polyMesh/" "write cellMap, faceMap, pointMap in polyMesh/"
); );
# include "addRegionOption.H"
# include "addOverwriteOption.H" # include "addOverwriteOption.H"
# include "addTimeOptions.H" # include "addTimeOptions.H"
@ -396,7 +397,7 @@ int main(int argc, char *argv[])
runTime.setTime(Times[startTime], startTime); runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
const bool blockOrder = args.optionFound("blockOrder"); const bool blockOrder = args.optionFound("blockOrder");

View File

@ -1,9 +1,10 @@
surfaceMeshWriter.C
foamToVTK.C foamToVTK.C
internalWriter.C internalWriter.C
lagrangianWriter.C lagrangianWriter.C
patchWriter.C patchWriter.C
writeFuns.C writeFuns.C
writePatchGeom.C
writeFaceSet.C writeFaceSet.C
writePointSet.C writePointSet.C
writeSurfFields.C writeSurfFields.C

View File

@ -157,7 +157,7 @@ Note
#include "writeFaceSet.H" #include "writeFaceSet.H"
#include "writePointSet.H" #include "writePointSet.H"
#include "writePatchGeom.H" #include "surfaceMeshWriter.H"
#include "writeSurfFields.H" #include "writeSurfFields.H"
@ -963,20 +963,42 @@ int main(int argc, char *argv[])
if (doFaceZones) if (doFaceZones)
{ {
PtrList<surfaceScalarField> ssf;
readFields
(
vMesh,
vMesh.baseMesh(),
objects,
selectedFields,
ssf
);
print(" surfScalarFields :", Info, ssf);
PtrList<surfaceVectorField> svf;
readFields
(
vMesh,
vMesh.baseMesh(),
objects,
selectedFields,
svf
);
print(" surfVectorFields :", Info, svf);
const faceZoneMesh& zones = mesh.faceZones(); const faceZoneMesh& zones = mesh.faceZones();
forAll(zones, zoneI) forAll(zones, zoneI)
{ {
const faceZone& pp = zones[zoneI]; const faceZone& fz = zones[zoneI];
mkDir(fvPath/pp.name()); mkDir(fvPath/fz.name());
fileName patchFileName; fileName patchFileName;
if (vMesh.useSubMesh()) if (vMesh.useSubMesh())
{ {
patchFileName = patchFileName =
fvPath/pp.name()/cellSetName fvPath/fz.name()/cellSetName
+ "_" + "_"
+ timeDesc + timeDesc
+ ".vtk"; + ".vtk";
@ -984,7 +1006,7 @@ int main(int argc, char *argv[])
else else
{ {
patchFileName = patchFileName =
fvPath/pp.name()/pp.name() fvPath/fz.name()/fz.name()
+ "_" + "_"
+ timeDesc + timeDesc
+ ".vtk"; + ".vtk";
@ -992,18 +1014,31 @@ int main(int argc, char *argv[])
Info<< " FaceZone : " << patchFileName << endl; Info<< " FaceZone : " << patchFileName << endl;
std::ofstream ostr(patchFileName.c_str()); indirectPrimitivePatch pp
writeFuns::writeHeader(ostr, binary, pp.name());
ostr<< "DATASET POLYDATA" << std::endl;
writePatchGeom
( (
binary, IndirectList<face>(mesh.faces(), fz),
pp().localFaces(), mesh.points()
pp().localPoints(),
ostr
); );
surfaceMeshWriter writer
(
vMesh,
binary,
pp,
fz.name(),
patchFileName
);
// Number of fields
writeFuns::writeCellDataHeader
(
writer.os(),
pp.size(),
ssf.size()+svf.size()
);
writer.write(ssf);
writer.write(svf);
} }
} }
@ -1171,7 +1206,11 @@ int main(int argc, char *argv[])
+ "_" + "_"
+ procFile.name() + procFile.name()
); );
system(cmd.c_str()); if (system(cmd.c_str()) == -1)
{
WarningIn(args.executable())
<< "Could not execute command " << cmd << endl;
}
} }
} }
} }

View File

@ -23,60 +23,63 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "writePatchGeom.H" #include "surfaceMeshWriter.H"
#include "OFstream.H"
#include "floatScalar.H"
#include "writeFuns.H" #include "writeFuns.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
namespace Foam Foam::surfaceMeshWriter::surfaceMeshWriter
{
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
void writePatchGeom
( (
const vtkMesh& vMesh,
const bool binary, const bool binary,
const faceList& faces, const indirectPrimitivePatch& pp,
const pointField& points, const word& name,
std::ofstream& ostr const fileName& fName
) )
:
vMesh_(vMesh),
binary_(binary),
pp_(pp),
fName_(fName),
os_(fName.c_str())
{ {
ostr<< "POINTS " << points.size() << " float" << std::endl; // Write header
writeFuns::writeHeader(os_, binary_, name);
DynamicList<floatScalar> ptField(3*points.size());
writeFuns::insert(points, ptField);
writeFuns::write(ostr, binary, ptField);
os_ << "DATASET POLYDATA" << std::endl;
// Write topology
label nFaceVerts = 0; label nFaceVerts = 0;
forAll(faces, faceI) forAll(pp, faceI)
{ {
nFaceVerts += faces[faceI].size() + 1; nFaceVerts += pp[faceI].size() + 1;
} }
ostr<< "POLYGONS " << faces.size() << ' ' << nFaceVerts << std::endl;
os_ << "POINTS " << pp.nPoints() << " float" << std::endl;
DynamicList<floatScalar> ptField(3*pp.nPoints());
writeFuns::insert(pp.localPoints(), ptField);
writeFuns::write(os_, binary, ptField);
os_ << "POLYGONS " << pp.size() << ' ' << nFaceVerts << std::endl;
DynamicList<label> vertLabels(nFaceVerts); DynamicList<label> vertLabels(nFaceVerts);
forAll(faces, faceI) forAll(pp, faceI)
{ {
const face& f = faces[faceI]; const face& f = pp.localFaces()[faceI];
vertLabels.append(f.size()); vertLabels.append(f.size());
writeFuns::insert(f, vertLabels); writeFuns::insert(f, vertLabels);
} }
writeFuns::write(ostr, binary, vertLabels); writeFuns::write(os_, binary_, vertLabels);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,141 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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::surfaceMeshWriter
Description
Write faces with fields
SourceFiles
surfaceMeshWriter.C
surfaceMeshWriterTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef surfaceMeshWriter_H
#define surfaceMeshWriter_H
#include "pointMesh.H"
#include "OFstream.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "vtkMesh.H"
#include "indirectPrimitivePatch.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class volPointInterpolation;
/*---------------------------------------------------------------------------*\
Class surfaceMeshWriter Declaration
\*---------------------------------------------------------------------------*/
class surfaceMeshWriter
{
const vtkMesh& vMesh_;
const bool binary_;
const indirectPrimitivePatch& pp_;
const fileName fName_;
std::ofstream os_;
// label nPoints_;
//
// label nFaces_;
public:
// Constructors
//- Construct from components
surfaceMeshWriter
(
const vtkMesh&,
const bool binary,
const indirectPrimitivePatch& pp,
const word& name,
const fileName&
);
// Member Functions
std::ofstream& os()
{
return os_;
}
// label nPoints() const
// {
// return nPoints_;
// }
//
// label nFaces() const
// {
// return nFaces_;
// }
//
// //- Write cellIDs
// void writePatchIDs();
//- Extract face data
template<class Type>
tmp<Field<Type> > getFaceField
(
const GeometricField<Type, fvsPatchField, surfaceMesh>&
) const;
//- Write surfaceFields
template<class Type>
void write
(
const PtrList<GeometricField<Type, fvsPatchField, surfaceMesh> >&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "surfaceMeshWriterTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,84 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 "surfaceMeshWriter.H"
#include "writeFuns.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Field<Type> > Foam::surfaceMeshWriter::getFaceField
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& sfld
) const
{
const polyBoundaryMesh& patches = sfld.mesh().boundaryMesh();
tmp<Field<Type> > tfld(new Field<Type>(pp_.size()));
Field<Type>& fld = tfld();
forAll(pp_.addressing(), i)
{
label faceI = pp_.addressing()[i];
label patchI = patches.whichPatch(faceI);
if (patchI == -1)
{
fld[i] = sfld[faceI];
}
else
{
label localFaceI = faceI - patches[patchI].start();
fld[i] = sfld.boundaryField()[patchI][localFaceI];
}
}
return tfld;
}
template<class Type>
void Foam::surfaceMeshWriter::write
(
const PtrList<GeometricField<Type, fvsPatchField, surfaceMesh> >& sflds
)
{
forAll(sflds, fieldI)
{
const GeometricField<Type, fvsPatchField, surfaceMesh>& fld =
sflds[fieldI];
os_ << fld.name() << ' ' << pTraits<Type>::nComponents << ' '
<< pp_.size() << " float" << std::endl;
DynamicList<floatScalar> fField(pTraits<Type>::nComponents*pp_.size());
writeFuns::insert(getFaceField(fld)(), fField);
writeFuns::write(os_, binary_, fField);
}
}
// ************************************************************************* //

View File

@ -6,6 +6,13 @@ if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then then
case "$ParaView_VERSION" in case "$ParaView_VERSION" in
3* | git) 3* | git)
if [ ! -n "${PV_PLUGIN_PATH}" ]
then
echo "$0 : PV_PLUGIN_PATH not a valid."
exit 1
fi
wmake libso vtkPV3Readers wmake libso vtkPV3Readers
PV3blockMeshReader/Allwmake PV3blockMeshReader/Allwmake
PV3FoamReader/Allwmake PV3FoamReader/Allwmake

View File

@ -620,6 +620,11 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps)
void Foam::vtkPV3Foam::renderPatchNames(vtkRenderer* renderer, const bool show) void Foam::vtkPV3Foam::renderPatchNames(vtkRenderer* renderer, const bool show)
{ {
if (!meshPtr_)
{
return;
}
// always remove old actors first // always remove old actors first
forAll(patchTextActorsPtrs_, patchI) forAll(patchTextActorsPtrs_, patchI)

View File

@ -96,17 +96,26 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions(); timeSelector::addOptions();
# include "addRegionOption.H" #include "addRegionOption.H"
# include "setRootCase.H" argList::addOption
# include "createTime.H" (
"dict",
"word",
"name of dictionary to provide sample information"
);
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);
# include "createNamedMesh.H" #include "createNamedMesh.H"
word sampleDict(args.optionLookupOrDefault<word>("dict", "sampleDict"));
IOsampledSets sSets IOsampledSets sSets
( (
sampledSets::typeName, sampledSets::typeName,
mesh, mesh,
"sampleDict", sampleDict,
IOobject::MUST_READ, IOobject::MUST_READ,
true true
); );
@ -115,7 +124,7 @@ int main(int argc, char *argv[])
( (
sampledSurfaces::typeName, sampledSurfaces::typeName,
mesh, mesh,
"sampleDict", sampleDict,
IOobject::MUST_READ, IOobject::MUST_READ,
true true
); );

View File

@ -398,7 +398,12 @@ int main(int argc, char *argv[])
) )
{ {
// Make the eigenvectors a right handed orthogonal triplet // Make the eigenvectors a right handed orthogonal triplet
eVec.z() *= sign((eVec.x() ^ eVec.y()) & eVec.z()); eVec = tensor
(
eVec.x(),
eVec.y(),
eVec.z() * sign((eVec.x() ^ eVec.y()) & eVec.z())
);
// Finding the most natural transformation. Using Lists // Finding the most natural transformation. Using Lists
// rather than tensors to allow indexed permutation. // rather than tensors to allow indexed permutation.
@ -557,9 +562,7 @@ int main(int argc, char *argv[])
eVal = tEVal; eVal = tEVal;
} }
eVec.x() = principal[0]; eVec = tensor(principal[0], principal[1], principal[2]);
eVec.y() = principal[1];
eVec.z() = principal[2];
// { // {
// tensor R = rotationTensor(vector(1, 0, 0), eVec.x()); // tensor R = rotationTensor(vector(1, 0, 0), eVec.x());

View File

@ -1,7 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/parallel/distributed/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ldistributed \
-lmeshTools \ -lmeshTools \
-ltriSurface -ltriSurface

View File

@ -239,6 +239,11 @@ MPICH)
cmd="${cmd} -n 1 ${procXtermCmdFile}" cmd="${cmd} -n 1 ${procXtermCmdFile}"
done < $PWD/mpirun.schema done < $PWD/mpirun.schema
;; ;;
*)
echo
echo "Unsupported WM_MPLIB setting : $WM_MPLIB"
printUsage
exit 1
esac esac
echo "Constructed $PWD/mpirun.schema file." echo "Constructed $PWD/mpirun.schema file."

8
bin/tools/scanpackages Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
#
# Generate Packages file on debian repositories.
for D in `find . -mindepth 4 -type d`
do
dpkg-scanpackages $D | gzip -9c > ${D}/Packages.gz
done

View File

@ -32,14 +32,12 @@ parallel/decompose/AllwmakeLnInclude
# dummyThirdParty (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools # dummyThirdParty (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools
dummyThirdParty/Allwmake dummyThirdParty/Allwmake
# Build the proper scotchDecomp, metisDecomp etc.
parallel/decompose/Allwmake
wmake libso meshTools wmake libso meshTools
wmake libso finiteVolume wmake libso finiteVolume
wmake libso genericPatchFields wmake libso genericPatchFields
parallel/reconstruct/Allwmake # Build the proper scotchDecomp, metisDecomp etc.
parallel/Allwmake
wmake libso sampling wmake libso sampling

View File

@ -31,6 +31,7 @@ Class
#include "Pstream.H" #include "Pstream.H"
#include "PackedList.H" #include "PackedList.H"
#include "PstreamReduceOps.H" #include "PstreamReduceOps.H"
#include "OSspecific.H"
#ifdef FOAM_USE_STAT #ifdef FOAM_USE_STAT
# include "OSspecific.H" # include "OSspecific.H"
@ -38,6 +39,10 @@ Class
#else #else
# include <sys/inotify.h> # include <sys/inotify.h>
# include <sys/ioctl.h> # include <sys/ioctl.h>
# define EVENT_SIZE ( sizeof (struct inotify_event) )
# define EVENT_LEN (EVENT_SIZE + 16)
# define EVENT_BUF_LEN ( 1024 * EVENT_LEN )
#endif #endif
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -108,69 +113,104 @@ namespace Foam
#ifdef FOAM_USE_STAT #ifdef FOAM_USE_STAT
//- From watch descriptor to modified time //- From watch descriptor to modified time
HashTable<label, time_t> lastMod; DynamicList<time_t> lastMod_;
//- initialize HashTable size //- initialize HashTable size
inline fileMonitorWatcher(const label sz = 20) inline fileMonitorWatcher(const label sz = 20)
: :
lastMod(sz) lastMod_(sz)
{} {}
inline label addWatch(const fileName& fName) inline bool addWatch(const label watchFd, const fileName& fName)
{ {
const label watchFd = lastMod.size(); if (watchFd < lastMod_.size() && lastMod_[watchFd] != 0)
lastMod.insert(watchFd, lastModified(fName)); {
return watchFd; // Reuse of watchFd : should have lastMod set to 0.
FatalErrorIn("addWatch(const label, const fileName&)")
<< "Problem adding watch " << watchFd
<< " to file " << fName
<< abort(FatalError);
}
lastMod_(watchFd) = lastModified(fName);
return true;
} }
inline bool removeWatch(const label watchFd) inline bool removeWatch(const label watchFd)
{ {
return lastMod.erase(watchFd); lastMod_[watchFd] = 0;
return true;
} }
#else #else
//- File descriptor for the inotify instance //- File descriptor for the inotify instance
int fd; int fd;
//- Pre-allocated structure containing file descriptors //- Current watchIDs and corresponding directory id
fd_set fdSet; DynamicList<label> dirWatches_;
DynamicList<fileName> dirFiles_;
//- initialize inotify //- initialise inotify
inline fileMonitorWatcher(const label dummy = 0) inline fileMonitorWatcher(const label sz = 20)
: :
fd(inotify_init()) fd(inotify_init()),
dirWatches_(sz),
dirFiles_(sz)
{}
//- remove all watches
inline ~fileMonitorWatcher()
{ {
// Add notify descriptor to select fd_set forAll(dirWatches_, i)
FD_ZERO(&fdSet); {
FD_SET(fd, &fdSet); if (dirWatches_[i] >= 0)
{
if (inotify_rm_watch(fd, int(dirWatches_[i])))
{
WarningIn("fileMonitor::~fileMonitor()")
<< "Failed deleting directory watch "
<< dirWatches_[i] << endl;
}
}
}
} }
//- test if file descriptor is set inline bool addWatch(const label watchFd, const fileName& fName)
inline bool isSet() const
{ {
return FD_ISSET(fd, &fdSet); // Add/retrieve watch on directory containing file
} label dirWatchID = inotify_add_watch
//- reset file descriptor
inline void reset()
{
FD_SET(fd, &fdSet);
}
inline label addWatch(const fileName& fName)
{
return inotify_add_watch
( (
fd, fd,
fName.c_str(), fName.path().c_str(),
// IN_ALL_EVENTS IN_CLOSE_WRITE
IN_CLOSE_WRITE | IN_DELETE_SELF | IN_MODIFY
); );
if (dirWatchID < 0)
{
FatalErrorIn("addWatch(const label, const fileName&)")
<< "Failed adding watch " << watchFd
<< " to directory " << fName
<< exit(FatalError);
}
if (watchFd < dirWatches_.size() && dirWatches_[watchFd] != -1)
{
// Reuse of watchFd : should have dir watchID set to -1.
FatalErrorIn("addWatch(const label, const fileName&)")
<< "Problem adding watch " << watchFd
<< " to file " << fName
<< abort(FatalError);
}
dirWatches_(watchFd) = dirWatchID;
dirFiles_(watchFd) = fName.name();
return true;
} }
inline bool removeWatch(const label watchFd) inline bool removeWatch(const label watchFd)
{ {
return inotify_rm_watch(fd, int(watchFd)) == 0; dirWatches_[watchFd] = -1;
return true;
} }
#endif #endif
@ -184,47 +224,54 @@ namespace Foam
void Foam::fileMonitor::checkFiles() const void Foam::fileMonitor::checkFiles() const
{ {
#ifdef FOAM_USE_STAT #ifdef FOAM_USE_STAT
for forAll(watcher_->lastMod_, watchFd)
(
HashTable<label, time_t>::iterator iter = watcher_->lastMod.begin();
iter != watcher_->lastMod.end();
++iter
)
{ {
const label watchFd = iter.key(); time_t oldTime = watcher_->lastMod_[watchFd];
const fileName& fName = watchFile_[watchFd];
time_t newTime = lastModified(fName);
if (newTime == 0) if (oldTime != 0)
{ {
state_.set(watchFd, DELETED); const fileName& fName = watchFile_[watchFd];
} time_t newTime = lastModified(fName);
else
{ if (newTime == 0)
time_t oldTime = iter();
if (newTime > (oldTime + regIOobject::fileModificationSkew))
{ {
iter() = newTime; state_[watchFd] = DELETED;
state_.set(watchFd, MODIFIED);
} }
else else
{ {
state_.set(watchFd, UNMODIFIED); if (newTime > (oldTime + regIOobject::fileModificationSkew))
{
watcher_->lastMod_[watchFd] = newTime;
state_[watchFd] = MODIFIED;
}
else
{
state_[watchFd] = UNMODIFIED;
}
} }
} }
} }
#else #else
// Large buffer for lots of events
char buffer[EVENT_BUF_LEN];
while (true) while (true)
{ {
struct timeval zeroTimeout = {0, 0}; struct timeval zeroTimeout = {0, 0};
//- Pre-allocated structure containing file descriptors
fd_set fdSet;
// Add notify descriptor to select fd_set
FD_ZERO(&fdSet);
FD_SET(watcher_->fd, &fdSet);
int ready = select int ready = select
( (
watcher_->fd+1, // num filedescriptors in fdSet watcher_->fd+1, // num filedescriptors in fdSet
&(watcher_->fdSet), // fdSet with only inotifyFd &fdSet, // fdSet with only inotifyFd
NULL, // No writefds NULL, // No writefds
NULL, // No errorfds NULL, // No errorfds
&zeroTimeout // eNo timeout &zeroTimeout // eNo timeout
); );
if (ready < 0) if (ready < 0)
@ -233,51 +280,59 @@ void Foam::fileMonitor::checkFiles() const
<< "Problem in issuing select." << "Problem in issuing select."
<< abort(FatalError); << abort(FatalError);
} }
else if (watcher_->isSet()) else if (FD_ISSET(watcher_->fd, &fdSet))
{ {
struct inotify_event inotifyEvent; // Read events
ssize_t nBytes = read(watcher_->fd, buffer, EVENT_BUF_LEN);
// Read first event if (nBytes < 0)
ssize_t nBytes = read
(
watcher_->fd,
&inotifyEvent,
sizeof(inotifyEvent)
);
if (nBytes != sizeof(inotifyEvent))
{ {
FatalErrorIn("fileMonitor::updateStates(const fileName&)") FatalErrorIn("fileMonitor::updateStates(const fileName&)")
<< "Read " << label(nBytes) << " ; expected " << "read of " << watcher_->fd
<< label(sizeof(inotifyEvent)) << " failed with " << label(nBytes)
<< abort(FatalError); << abort(FatalError);
} }
// Pout<< "mask:" << inotifyEvent.mask << nl // Go through buffer, consuming events
// << "watchFd:" << inotifyEvent.wd << nl int i = 0;
// << "watchName:" << watchFile_[inotifyEvent.wd] << endl; while (i < nBytes)
{
const struct inotify_event* inotifyEvent =
reinterpret_cast<const struct inotify_event*>
(
&buffer[i]
);
if (inotifyEvent.mask % IN_DELETE_SELF) //Pout<< "watchFd:" << inotifyEvent->wd << nl
{ // << "mask:" << inotifyEvent->mask << nl
Map<fileState>::iterator iter = // << endl;
state_.find(label(inotifyEvent.wd)); //Pout<< "file:" << fileName(inotifyEvent->name) << endl;
iter() = DELETED; //Pout<< "len:" << inotifyEvent->len << endl;
}
else if if ((inotifyEvent->mask & IN_CLOSE_WRITE) && inotifyEvent->len)
( {
(inotifyEvent.mask % IN_MODIFY) // Search for file
|| (inotifyEvent.mask % IN_CLOSE_WRITE) forAll(watcher_->dirWatches_, i)
) {
{ label id = watcher_->dirWatches_[i];
Map<fileState>::iterator iter = if
state_.find(label(inotifyEvent.wd)); (
iter() = MODIFIED; id == inotifyEvent->wd
&& inotifyEvent->name == watcher_->dirFiles_[i]
)
{
// Correct directory and name
state_[i] = MODIFIED;
}
}
}
i += EVENT_SIZE + inotifyEvent->len;
} }
} }
else else
{ {
// No data - reset // No data
watcher_->reset();
return; return;
} }
} }
@ -291,6 +346,7 @@ Foam::fileMonitor::fileMonitor()
: :
state_(20), state_(20),
watchFile_(20), watchFile_(20),
freeWatchFds_(2),
watcher_(new fileMonitorWatcher(20)) watcher_(new fileMonitorWatcher(20))
{} {}
@ -298,24 +354,27 @@ Foam::fileMonitor::fileMonitor()
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fileMonitor::~fileMonitor() Foam::fileMonitor::~fileMonitor()
{ {}
// Remove watch on any remaining files
List<label> watchFds(state_.toc());
forAll(watchFds, i)
{
removeWatch(watchFds[i]);
}
delete watcher_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::fileMonitor::addWatch(const fileName& fName) Foam::label Foam::fileMonitor::addWatch(const fileName& fName)
{ {
const label watchFd = watcher_->addWatch(fName); label watchFd;
label sz = freeWatchFds_.size();
if (sz)
{
watchFd = freeWatchFds_[sz-1];
freeWatchFds_.setSize(sz-1);
}
else
{
watchFd = state_.size();
}
watcher_->addWatch(watchFd, fName);
if (debug) if (debug)
{ {
@ -330,8 +389,8 @@ Foam::label Foam::fileMonitor::addWatch(const fileName& fName)
} }
else else
{ {
state_.insert(watchFd, UNMODIFIED); state_(watchFd) = UNMODIFIED;
watchFile_.insert(watchFd, fName); watchFile_(watchFd) = fName;
} }
return watchFd; return watchFd;
} }
@ -345,8 +404,7 @@ bool Foam::fileMonitor::removeWatch(const label watchFd)
<< watchFile_[watchFd] << endl; << watchFile_[watchFd] << endl;
} }
state_.erase(watchFd); freeWatchFds_.append(watchFd);
watchFile_.erase(watchFd);
return watcher_->removeWatch(watchFd); return watcher_->removeWatch(watchFd);
} }
@ -371,10 +429,9 @@ void Foam::fileMonitor::updateStates(const bool syncPar) const
if (syncPar) if (syncPar)
{ {
PackedList<2> stats(state_.size()); PackedList<2> stats(state_.size());
label i = 0; forAll(state_, watchFd)
forAllConstIter(Map<fileState>, state_, iter)
{ {
stats[i++] = static_cast<unsigned int>(iter()); stats[watchFd] = static_cast<unsigned int>(state_[watchFd]);
} }
// Save local state for warning message below // Save local state for warning message below
PackedList<2> thisProcStats(stats); PackedList<2> thisProcStats(stats);
@ -393,26 +450,24 @@ void Foam::fileMonitor::updateStates(const bool syncPar) const
); );
} }
i = 0; forAll(state_, watchFd)
forAllIter(Map<fileState>, state_, iter)
{ {
if (thisProcStats[i] != UNMODIFIED) if (thisProcStats[watchFd] != UNMODIFIED)
{ {
if (stats[i] == UNMODIFIED) if (stats[watchFd] == UNMODIFIED)
{ {
WarningIn("fileMonitor::updateStates(const bool) const") WarningIn("fileMonitor::updateStates(const bool) const")
<< "Delaying reading " << watchFile_[iter.key()] << "Delaying reading " << watchFile_[watchFd]
<< " due to inconsistent " << " due to inconsistent "
"file time-stamps between processors" "file time-stamps between processors"
<< endl; << endl;
} }
else else
{ {
unsigned int stat = stats[i]; unsigned int stat = stats[watchFd];
iter() = fileState(stat); state_[watchFd] = fileState(stat);
} }
} }
i++;
} }
} }
} }
@ -421,19 +476,9 @@ void Foam::fileMonitor::updateStates(const bool syncPar) const
void Foam::fileMonitor::setUnmodified(const label watchFd) void Foam::fileMonitor::setUnmodified(const label watchFd)
{ {
#ifdef FOAM_USE_STAT #ifdef FOAM_USE_STAT
watcher_->lastMod[watchFd] = lastModified(watchFile_[watchFd]); watcher_->lastMod_[watchFd] = lastModified(watchFile_[watchFd]);
#endif #endif
state_[watchFd] = UNMODIFIED;
Map<fileState>::iterator iter = state_.find(watchFd);
if (iter == state_.end())
{
FatalErrorIn("fileMonitor::setUnmodified(const label)")
<< "Illegal watchFd " << watchFd
<< abort(FatalError);
}
iter() = UNMODIFIED;
} }

View File

@ -33,10 +33,6 @@ Note
Compiling with FOAM_USE_STAT (or if /usr/include/sys/inotify.h Compiling with FOAM_USE_STAT (or if /usr/include/sys/inotify.h
does not exist) uses the stat function call. does not exist) uses the stat function call.
- works fine except when a file is deleted and recreated:
it stops monitoring the file!
(does work though if the file gets moved)
SourceFiles SourceFiles
fileMonitor.C fileMonitor.C
@ -46,9 +42,9 @@ SourceFiles
#define fileMonitor_H #define fileMonitor_H
#include <sys/types.h> #include <sys/types.h>
#include "Map.H"
#include "NamedEnum.H" #include "NamedEnum.H"
#include "className.H" #include "className.H"
#include "DynamicList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -83,13 +79,16 @@ private:
// Private data // Private data
//- State for all watchFds //- State for all watchFds
mutable Map<fileState> state_; mutable DynamicList<fileState> state_;
//- From watch descriptor to filename //- Filename for all watchFds
HashTable<fileName, label> watchFile_; DynamicList<fileName> watchFile_;
//- Free watchFds
DynamicList<label> freeWatchFds_;
//- Watch mechanism (stat or inotify) //- Watch mechanism (stat or inotify)
mutable fileMonitorWatcher *watcher_; mutable autoPtr<fileMonitorWatcher> watcher_;
// Private Member Functions // Private Member Functions

View File

@ -341,13 +341,14 @@ $(basicPolyPatches)/coupled/coupledPolyPatch.C
$(basicPolyPatches)/generic/genericPolyPatch.C $(basicPolyPatches)/generic/genericPolyPatch.C
constraintPolyPatches = $(polyPatches)/constraint constraintPolyPatches = $(polyPatches)/constraint
$(constraintPolyPatches)/empty/emptyPolyPatch.C
$(constraintPolyPatches)/symmetry/symmetryPolyPatch.C
$(constraintPolyPatches)/wedge/wedgePolyPatch.C
$(constraintPolyPatches)/cyclic/cyclicPolyPatch.C $(constraintPolyPatches)/cyclic/cyclicPolyPatch.C
$(constraintPolyPatches)/cyclicSlip/cyclicSlipPolyPatch.C $(constraintPolyPatches)/cyclicSlip/cyclicSlipPolyPatch.C
$(constraintPolyPatches)/empty/emptyPolyPatch.C
$(constraintPolyPatches)/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.C
$(constraintPolyPatches)/processorCyclic/processorCyclicPolyPatch.C $(constraintPolyPatches)/processorCyclic/processorCyclicPolyPatch.C
$(constraintPolyPatches)/processor/processorPolyPatch.C $(constraintPolyPatches)/processor/processorPolyPatch.C
$(constraintPolyPatches)/symmetry/symmetryPolyPatch.C
$(constraintPolyPatches)/wedge/wedgePolyPatch.C
derivedPolyPatches = $(polyPatches)/derived derivedPolyPatches = $(polyPatches)/derived
$(derivedPolyPatches)/wall/wallPolyPatch.C $(derivedPolyPatches)/wall/wallPolyPatch.C
@ -453,13 +454,14 @@ $(basicPointPatches)/coupled/coupledPointPatch.C
$(basicPointPatches)/generic/genericPointPatch.C $(basicPointPatches)/generic/genericPointPatch.C
constraintPointPatches = $(pointPatches)/constraint constraintPointPatches = $(pointPatches)/constraint
$(constraintPointPatches)/empty/emptyPointPatch.C
$(constraintPointPatches)/symmetry/symmetryPointPatch.C
$(constraintPointPatches)/wedge/wedgePointPatch.C
$(constraintPointPatches)/cyclic/cyclicPointPatch.C $(constraintPointPatches)/cyclic/cyclicPointPatch.C
$(constraintPointPatches)/cyclicSlip/cyclicSlipPointPatch.C $(constraintPointPatches)/cyclicSlip/cyclicSlipPointPatch.C
$(constraintPointPatches)/empty/emptyPointPatch.C
$(constraintPointPatches)/nonuniformTransformCyclic/nonuniformTransformCyclicPointPatch.C
$(constraintPointPatches)/processor/processorPointPatch.C $(constraintPointPatches)/processor/processorPointPatch.C
$(constraintPointPatches)/processorCyclic/processorCyclicPointPatch.C $(constraintPointPatches)/processorCyclic/processorCyclicPointPatch.C
$(constraintPointPatches)/symmetry/symmetryPointPatch.C
$(constraintPointPatches)/wedge/wedgePointPatch.C
derivedPointPatches = $(pointPatches)/derived derivedPointPatches = $(pointPatches)/derived
$(derivedPointPatches)/coupled/coupledFacePointPatch.C $(derivedPointPatches)/coupled/coupledFacePointPatch.C
@ -520,16 +522,18 @@ $(basicPointPatchFields)/zeroGradient/zeroGradientPointPatchFields.C
$(basicPointPatchFields)/mixed/mixedPointPatchFields.C $(basicPointPatchFields)/mixed/mixedPointPatchFields.C
constraintPointPatchFields = $(pointPatchFields)/constraint constraintPointPatchFields = $(pointPatchFields)/constraint
$(constraintPointPatchFields)/empty/emptyPointPatchFields.C
$(constraintPointPatchFields)/symmetry/symmetryPointPatchFields.C
$(constraintPointPatchFields)/wedge/wedgePointPatchFields.C
$(constraintPointPatchFields)/cyclic/cyclicPointPatchFields.C $(constraintPointPatchFields)/cyclic/cyclicPointPatchFields.C
$(constraintPointPatchFields)/cyclicSlip/cyclicSlipPointPatchFields.C $(constraintPointPatchFields)/cyclicSlip/cyclicSlipPointPatchFields.C
$(constraintPointPatchFields)/empty/emptyPointPatchFields.C
$(constraintPointPatchFields)/nonuniformTransformCyclic/nonuniformTransformCyclicPointPatchFields.C
$(constraintPointPatchFields)/processor/processorPointPatchFields.C $(constraintPointPatchFields)/processor/processorPointPatchFields.C
$(constraintPointPatchFields)/processorCyclic/processorCyclicPointPatchFields.C $(constraintPointPatchFields)/processorCyclic/processorCyclicPointPatchFields.C
$(constraintPointPatchFields)/symmetry/symmetryPointPatchFields.C
$(constraintPointPatchFields)/wedge/wedgePointPatchFields.C
derivedPointPatchFields = $(pointPatchFields)/derived derivedPointPatchFields = $(pointPatchFields)/derived
$(derivedPointPatchFields)/slip/slipPointPatchFields.C $(derivedPointPatchFields)/slip/slipPointPatchFields.C
$(derivedPointPatchFields)/fixedNormalSlip/fixedNormalSlipPointPatchFields.C
/* /*
$(derivedPointPatchFields)/global/globalPointPatchFields.C $(derivedPointPatchFields)/global/globalPointPatchFields.C
*/ */

View File

@ -113,7 +113,7 @@ Foam::label Foam::UList<T>::byteSize() const
<< abort(FatalError); << abort(FatalError);
} }
return this->size_*sizeof(T); return this->size_*label(sizeof(T));
} }

View File

@ -371,6 +371,11 @@ Foam::Time::Time
Foam::Time::~Time() Foam::Time::~Time()
{ {
if (controlDict_.watchIndex() != -1)
{
removeWatch(controlDict_.watchIndex());
}
// destroy function objects first // destroy function objects first
functionObjects_.clear(); functionObjects_.clear();
} }
@ -799,7 +804,11 @@ Foam::Time& Foam::Time::operator++()
case wcCpuTime: case wcCpuTime:
{ {
label outputIndex = label(elapsedCpuTime()/writeInterval_); label outputIndex = label
(
returnReduce(elapsedCpuTime(), maxOp<double>())
/ writeInterval_
);
if (outputIndex > outputTimeIndex_) if (outputIndex > outputTimeIndex_)
{ {
outputTime_ = true; outputTime_ = true;
@ -814,7 +823,11 @@ Foam::Time& Foam::Time::operator++()
case wcClockTime: case wcClockTime:
{ {
label outputIndex = label(elapsedClockTime()/writeInterval_); label outputIndex = label
(
returnReduce(label(elapsedClockTime()), maxOp<label>())
/ writeInterval_
);
if (outputIndex > outputTimeIndex_) if (outputIndex > outputTimeIndex_)
{ {
outputTime_ = true; outputTime_ = true;

View File

@ -184,6 +184,7 @@ void Foam::Time::readDict()
if (!runTimeModifiable_ && controlDict_.watchIndex() != -1) if (!runTimeModifiable_ && controlDict_.watchIndex() != -1)
{ {
removeWatch(controlDict_.watchIndex()); removeWatch(controlDict_.watchIndex());
controlDict_.watchIndex() = -1;
} }
} }

View File

@ -38,8 +38,7 @@ Description
dictionaries since, unlike the IOdictionary class, it does not use an dictionaries since, unlike the IOdictionary class, it does not use an
objectRegistry itself to work. objectRegistry itself to work.
ToDo To add - a merge() member function with a non-const dictionary parameter?
A merge() member function with a non-const dictionary parameter.
This would avoid unnecessary cloning in the add(entry*, bool) method. This would avoid unnecessary cloning in the add(entry*, bool) method.
SourceFiles SourceFiles

View File

@ -66,7 +66,7 @@ template<class Type>
Field<Type>::Field Field<Type>::Field
( (
const UList<Type>& mapF, const UList<Type>& mapF,
const labelList& mapAddressing const UList<label>& mapAddressing
) )
: :
List<Type>(mapAddressing.size()) List<Type>(mapAddressing.size())
@ -78,7 +78,7 @@ template<class Type>
Field<Type>::Field Field<Type>::Field
( (
const tmp<Field<Type> >& tmapF, const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing const UList<label>& mapAddressing
) )
: :
List<Type>(mapAddressing.size()) List<Type>(mapAddressing.size())
@ -297,7 +297,7 @@ template<class Type>
void Field<Type>::map void Field<Type>::map
( (
const UList<Type>& mapF, const UList<Type>& mapF,
const labelList& mapAddressing const UList<label>& mapAddressing
) )
{ {
Field<Type>& f = *this; Field<Type>& f = *this;
@ -326,7 +326,7 @@ template<class Type>
void Field<Type>::map void Field<Type>::map
( (
const tmp<Field<Type> >& tmapF, const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing const UList<label>& mapAddressing
) )
{ {
map(tmapF(), mapAddressing); map(tmapF(), mapAddressing);
@ -455,7 +455,7 @@ template<class Type>
void Field<Type>::rmap void Field<Type>::rmap
( (
const UList<Type>& mapF, const UList<Type>& mapF,
const labelList& mapAddressing const UList<label>& mapAddressing
) )
{ {
Field<Type>& f = *this; Field<Type>& f = *this;
@ -475,7 +475,7 @@ template<class Type>
void Field<Type>::rmap void Field<Type>::rmap
( (
const tmp<Field<Type> >& tmapF, const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing const UList<label>& mapAddressing
) )
{ {
rmap(tmapF(), mapAddressing); rmap(tmapF(), mapAddressing);
@ -487,8 +487,8 @@ template<class Type>
void Field<Type>::rmap void Field<Type>::rmap
( (
const UList<Type>& mapF, const UList<Type>& mapF,
const labelList& mapAddressing, const UList<label>& mapAddressing,
const scalarList& mapWeights const UList<scalar>& mapWeights
) )
{ {
Field<Type>& f = *this; Field<Type>& f = *this;
@ -505,8 +505,8 @@ template<class Type>
void Field<Type>::rmap void Field<Type>::rmap
( (
const tmp<Field<Type> >& tmapF, const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing, const UList<label>& mapAddressing,
const scalarList& mapWeights const UList<scalar>& mapWeights
) )
{ {
rmap(tmapF(), mapAddressing, mapWeights); rmap(tmapF(), mapAddressing, mapWeights);

View File

@ -127,14 +127,14 @@ public:
Field Field
( (
const UList<Type>& mapF, const UList<Type>& mapF,
const labelList& mapAddressing const UList<label>& mapAddressing
); );
//- Construct by 1 to 1 mapping from the given tmp field //- Construct by 1 to 1 mapping from the given tmp field
Field Field
( (
const tmp<Field<Type> >& tmapF, const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing const UList<label>& mapAddressing
); );
//- Construct by interpolative mapping from the given field //- Construct by interpolative mapping from the given field
@ -208,14 +208,14 @@ public:
void map void map
( (
const UList<Type>& mapF, const UList<Type>& mapF,
const labelList& mapAddressing const UList<label>& mapAddressing
); );
//- 1 to 1 map from the given tmp field //- 1 to 1 map from the given tmp field
void map void map
( (
const tmp<Field<Type> >& tmapF, const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing const UList<label>& mapAddressing
); );
//- Interpolative map from the given field //- Interpolative map from the given field
@ -258,30 +258,30 @@ public:
void rmap void rmap
( (
const UList<Type>& mapF, const UList<Type>& mapF,
const labelList& mapAddressing const UList<label>& mapAddressing
); );
//- 1 to 1 reverse-map from the given tmp field //- 1 to 1 reverse-map from the given tmp field
void rmap void rmap
( (
const tmp<Field<Type> >& tmapF, const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing const UList<label>& mapAddressing
); );
//- Interpolative reverse map from the given field //- Interpolative reverse map from the given field
void rmap void rmap
( (
const UList<Type>& mapF, const UList<Type>& mapF,
const labelList& mapAddressing, const UList<label>& mapAddressing,
const scalarList& weights const UList<scalar>& weights
); );
//- Interpolative reverse map from the given tmp field //- Interpolative reverse map from the given tmp field
void rmap void rmap
( (
const tmp<Field<Type> >& tmapF, const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing, const UList<label>& mapAddressing,
const scalarList& weights const UList<scalar>& weights
); );
//- Negate this field //- Negate this field

View File

@ -0,0 +1,114 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 "fixedNormalSlipPointPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
)
:
slipPointPatchField<Type>(p, iF),
n_(vector::max)
{}
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict
)
:
slipPointPatchField<Type>(p, iF, dict),
n_(dict.lookup("n"))
{}
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const fixedNormalSlipPointPatchField<Type>& ptf,
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const pointPatchFieldMapper& mapper
)
:
slipPointPatchField<Type>(ptf, p, iF, mapper),
n_(ptf.n_)
{}
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const fixedNormalSlipPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
)
:
slipPointPatchField<Type>(ptf, iF),
n_(ptf.n_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void fixedNormalSlipPointPatchField<Type>::evaluate(const Pstream::commsTypes)
{
tmp<Field<Type> > tvalues =
transform(I - n_*n_, this->patchInternalField());
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
setInInternalField(iF, tvalues());
}
template<class Type>
void fixedNormalSlipPointPatchField<Type>::write(Ostream& os) const
{
slipPointPatchField<Type>::write(os);
os.writeKeyword("n")
<< n_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,170 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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::fixedNormalSlipPointPatchField
Description
slip with user-specified normal
SourceFiles
fixedNormalSlipPointPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef fixedNormalSlipPointPatchField_H
#define fixedNormalSlipPointPatchField_H
#include "slipPointPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
template<class Type>
class fixedNormalSlipPointPatchField;
template<class Type>
Ostream& operator<<
(
Ostream&,
const fixedNormalSlipPointPatchField<Type>&
);
/*---------------------------------------------------------------------------*\
Class fixedNormalSlipPointPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class fixedNormalSlipPointPatchField
:
public slipPointPatchField<Type>
{
// Private data
//- User specified normal
vector n_;
public:
//- Runtime type information
TypeName("fixedNormalSlip");
// Constructors
//- Construct from patch and internal field
fixedNormalSlipPointPatchField
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&
);
//- Construct from patch, internal field and dictionary
fixedNormalSlipPointPatchField
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
fixedNormalSlipPointPatchField
(
const fixedNormalSlipPointPatchField<Type>&,
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const pointPatchFieldMapper&
);
//- Construct and return a clone
virtual autoPtr<pointPatchField<Type> > clone() const
{
return autoPtr<pointPatchField<Type> >
(
new fixedNormalSlipPointPatchField<Type>
(
*this
)
);
}
//- Construct as copy setting internal field reference
fixedNormalSlipPointPatchField
(
const fixedNormalSlipPointPatchField<Type>&,
const DimensionedField<Type, pointMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<pointPatchField<Type> > clone
(
const DimensionedField<Type, pointMesh>& iF
) const
{
return autoPtr<pointPatchField<Type> >
(
new fixedNormalSlipPointPatchField<Type>
(
*this,
iF
)
);
}
// Member functions
// Evaluation functions
//- Update the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "fixedNormalSlipPointPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 "fixedNormalSlipPointPatchFields.H"
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(fixedNormalSlip);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -21,40 +21,27 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::writePatchGeom
Description
Write patch geometry to stream
SourceFiles
writePatchGeom.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef writePatchGeom_H #ifndef fixedNormalSlipPointPatchFields_H
#define writePatchGeom_H #define fixedNormalSlipPointPatchFields_H
#include "faceList.H" #include "fixedNormalSlipPointPatchField.H"
#include "pointField.H" #include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// Write patch geometry // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void writePatchGeom
( makePointPatchFieldTypedefs(fixedNormalSlip);
const bool binary,
const faceList& faces, // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const pointField& points,
std::ofstream&
);
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif

View File

@ -126,8 +126,6 @@ BINARY_FUNCTION(min)
BINARY_FUNCTION(cmptMultiply) BINARY_FUNCTION(cmptMultiply)
BINARY_FUNCTION(cmptDivide) BINARY_FUNCTION(cmptDivide)
#undef BINARY_FUNCTION
/* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
@ -143,10 +141,7 @@ inline void opFunc \
UNARY_OPERATOR(-, negate) UNARY_OPERATOR(-, negate)
#undef UNARY_OPERATOR #define BINARY_OPERATOR(Type1, Type2, op, opFunc) \
#define BINARY_OPERATOR_FF(Type1, Type2, op, opFunc) \
\ \
template<class Type> \ template<class Type> \
inline void opFunc \ inline void opFunc \
@ -157,25 +152,11 @@ inline void opFunc \
) \ ) \
{} {}
#define BINARY_OPERATOR_R(Type1, Type2, op, opFunc) \ BINARY_OPERATOR(scalar, Type, *, multiply)
BINARY_OPERATOR_FF(Type1, Type2, op, opFunc) BINARY_OPERATOR(Type, scalar, *, multiply)
BINARY_OPERATOR(Type, scalar, /, divide)
BINARY_OPERATOR_R(Type, Type, +, add) #define BINARY_TYPE_OPERATOR_SF(TYPE, op, opFunc) \
BINARY_OPERATOR_R(Type, Type, -, subtract)
BINARY_OPERATOR_FF(scalar, Type, *, multiply)
BINARY_OPERATOR_FF(Type, scalar, /, divide)
#undef BINARY_OPERATOR_R
#undef BINARY_OPERATOR_FF
#undef BINARY_OPERATOR_FTR
#undef BINARY_OPERATOR_TF
#undef BINARY_OPERATOR_TTR
#undef BINARY_OPERATOR_FT
#undef BINARY_OPERATOR_TRF
#undef BINARY_OPERATOR_TRT
#define BINARY_TYPE_OPERATOR_TF(TYPE, op, opFunc) \
\ \
template<class Type> \ template<class Type> \
inline void opFunc \ inline void opFunc \
@ -187,7 +168,7 @@ inline void opFunc \
{} {}
#define BINARY_TYPE_OPERATOR_FT(TYPE, op, opFunc) \ #define BINARY_TYPE_OPERATOR_FS(TYPE, op, opFunc) \
\ \
template<class Type> \ template<class Type> \
inline void opFunc \ inline void opFunc \
@ -199,19 +180,9 @@ inline void opFunc \
{} {}
#define BINARY_TYPE_OPERATOR(TYPE, op, opFunc) \ BINARY_TYPE_OPERATOR_SF(scalar, *, multiply)
BINARY_TYPE_OPERATOR_TF(TYPE, op, opFunc) \ BINARY_TYPE_OPERATOR_FS(scalar, *, multiply)
BINARY_TYPE_OPERATOR_FT(TYPE, op, opFunc) BINARY_TYPE_OPERATOR_FS(scalar, /, divide)
BINARY_TYPE_OPERATOR(Type, +, add)
BINARY_TYPE_OPERATOR(Type, -, subtract)
BINARY_TYPE_OPERATOR(scalar, *, multiply)
BINARY_TYPE_OPERATOR_FT(scalar, /, divide)
#undef BINARY_TYPE_OPERATOR
#undef BINARY_TYPE_OPERATOR_TF
#undef BINARY_TYPE_OPERATOR_FT
#define PRODUCT_OPERATOR(product, op, opFunc) \ #define PRODUCT_OPERATOR(product, op, opFunc) \
@ -262,6 +233,9 @@ inline void opFunc \
) \ ) \
{} {}
PRODUCT_OPERATOR(typeOfSum, +, add)
PRODUCT_OPERATOR(typeOfSum, -, subtract)
PRODUCT_OPERATOR(outerProduct, *, outer) PRODUCT_OPERATOR(outerProduct, *, outer)
PRODUCT_OPERATOR(crossProduct, ^, cross) PRODUCT_OPERATOR(crossProduct, ^, cross)
PRODUCT_OPERATOR(innerProduct, &, dot) PRODUCT_OPERATOR(innerProduct, &, dot)
@ -367,3 +341,7 @@ inline void eigenVectors
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "undefFieldFunctionsM.H"
// ************************************************************************* //

View File

@ -65,6 +65,16 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
// Map the list // Map the list
newMotionPoints.map(oldMotionPoints, mpm.pointMap()); newMotionPoints.map(oldMotionPoints, mpm.pointMap());
// Any points created out-of-nothing get set to the current coordinate
// for lack of anything better.
forAll(mpm.pointMap(), newPointI)
{
if (mpm.pointMap()[newPointI] == -1)
{
newMotionPoints[newPointI] = points_[newPointI];
}
}
} }
// Reset valid directions (could change by faces put into empty patches) // Reset valid directions (could change by faces put into empty patches)

View File

@ -624,7 +624,18 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
} }
else if (separated()) else if (separated())
{ {
l -= separation(); const vectorField& s = separation();
if (s.size() == 1)
{
forAll(l, i)
{
l[i] -= s[0];
}
}
else
{
l -= s;
}
} }
} }

View File

@ -156,6 +156,29 @@ public:
); );
} }
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new nonuniformTransformCyclicPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
// Destructor // Destructor

View File

@ -100,6 +100,14 @@ public:
//- Construct given SymmTensor //- Construct given SymmTensor
inline Tensor(const SymmTensor<Cmpt>&); inline Tensor(const SymmTensor<Cmpt>&);
//- Construct given the three vector components
inline Tensor
(
const Vector<Cmpt>& x,
const Vector<Cmpt>& y,
const Vector<Cmpt>& z
);
//- Construct given the nine components //- Construct given the nine components
inline Tensor inline Tensor
( (
@ -116,14 +124,6 @@ public:
// Access // Access
inline const Vector<Cmpt>& x() const;
inline const Vector<Cmpt>& y() const;
inline const Vector<Cmpt>& z() const;
inline Vector<Cmpt>& x();
inline Vector<Cmpt>& y();
inline Vector<Cmpt>& z();
inline const Cmpt& xx() const; inline const Cmpt& xx() const;
inline const Cmpt& xy() const; inline const Cmpt& xy() const;
inline const Cmpt& xz() const; inline const Cmpt& xz() const;
@ -144,6 +144,13 @@ public:
inline Cmpt& zy(); inline Cmpt& zy();
inline Cmpt& zz(); inline Cmpt& zz();
// Access vector components.
// Note: returning const only to find out lhs usage
inline const Vector<Cmpt> x() const;
inline const Vector<Cmpt> y() const;
inline const Vector<Cmpt> z() const;
//- Transpose //- Transpose
inline Tensor<Cmpt> T() const; inline Tensor<Cmpt> T() const;

View File

@ -64,6 +64,21 @@ inline Tensor<Cmpt>::Tensor(const SymmTensor<Cmpt>& st)
} }
//- Construct given the three vector components
template <class Cmpt>
inline Tensor<Cmpt>::Tensor
(
const Vector<Cmpt>& x,
const Vector<Cmpt>& y,
const Vector<Cmpt>& z
)
{
this->v_[XX] = x.x(); this->v_[XY] = x.y(); this->v_[XZ] = x.z();
this->v_[YX] = y.x(); this->v_[YY] = y.y(); this->v_[YZ] = y.z();
this->v_[ZX] = z.x(); this->v_[ZY] = z.y(); this->v_[ZZ] = z.z();
}
//- Construct from components //- Construct from components
template <class Cmpt> template <class Cmpt>
inline Tensor<Cmpt>::Tensor inline Tensor<Cmpt>::Tensor
@ -90,40 +105,21 @@ inline Tensor<Cmpt>::Tensor(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <class Cmpt> template <class Cmpt>
inline const Vector<Cmpt>& Tensor<Cmpt>::x() const inline const Vector<Cmpt> Tensor<Cmpt>::x() const
{ {
return reinterpret_cast<const Vector<Cmpt>&>(this->v_[XX]); return Vector<Cmpt>(this->v_[XX], this->v_[XY], this->v_[XZ]);
} }
template <class Cmpt> template <class Cmpt>
inline const Vector<Cmpt>& Tensor<Cmpt>::y() const inline const Vector<Cmpt> Tensor<Cmpt>::y() const
{ {
return reinterpret_cast<const Vector<Cmpt>&>(this->v_[YX]); return Vector<Cmpt>(this->v_[YX], this->v_[YY], this->v_[YZ]);
} }
template <class Cmpt> template <class Cmpt>
inline const Vector<Cmpt>& Tensor<Cmpt>::z() const inline const Vector<Cmpt> Tensor<Cmpt>::z() const
{ {
return reinterpret_cast<const Vector<Cmpt>&>(this->v_[ZX]); return Vector<Cmpt>(this->v_[ZX], this->v_[ZY], this->v_[ZZ]);
}
template <class Cmpt>
inline Vector<Cmpt>& Tensor<Cmpt>::x()
{
return reinterpret_cast<Vector<Cmpt>&>(this->v_[XX]);
}
template <class Cmpt>
inline Vector<Cmpt>& Tensor<Cmpt>::y()
{
return reinterpret_cast<Vector<Cmpt>&>(this->v_[YX]);
}
template <class Cmpt>
inline Vector<Cmpt>& Tensor<Cmpt>::z()
{
return reinterpret_cast<Vector<Cmpt>&>(this->v_[ZX]);
} }

View File

@ -269,10 +269,12 @@ tensor eigenVectors(const tensor& t)
{ {
vector evals(eigenValues(t)); vector evals(eigenValues(t));
tensor evs; tensor evs
evs.x() = eigenVector(t, evals.x()); (
evs.y() = eigenVector(t, evals.y()); eigenVector(t, evals.x()),
evs.z() = eigenVector(t, evals.z()); eigenVector(t, evals.y()),
eigenVector(t, evals.z())
);
return evs; return evs;
} }
@ -468,10 +470,12 @@ tensor eigenVectors(const symmTensor& t)
{ {
vector evals(eigenValues(t)); vector evals(eigenValues(t));
tensor evs; tensor evs
evs.x() = eigenVector(t, evals.x()); (
evs.y() = eigenVector(t, evals.y()); eigenVector(t, evals.x()),
evs.z() = eigenVector(t, evals.z()); eigenVector(t, evals.y()),
eigenVector(t, evals.z())
);
return evs; return evs;
} }

View File

@ -92,7 +92,14 @@ public:
//- Construct given SphericalTensor2D //- Construct given SphericalTensor2D
inline Tensor2D(const SphericalTensor2D<Cmpt>&); inline Tensor2D(const SphericalTensor2D<Cmpt>&);
//- Construct given the nine components //- Construct given the two vectors
inline Tensor2D
(
const Vector2D<Cmpt>& x,
const Vector2D<Cmpt>& y
);
//- Construct given the four components
inline Tensor2D inline Tensor2D
( (
const Cmpt txx, const Cmpt txy, const Cmpt txx, const Cmpt txy,
@ -107,12 +114,6 @@ public:
// Access // Access
inline const Vector2D<Cmpt>& x() const;
inline const Vector2D<Cmpt>& y() const;
inline Vector2D<Cmpt>& x();
inline Vector2D<Cmpt>& y();
inline const Cmpt& xx() const; inline const Cmpt& xx() const;
inline const Cmpt& xy() const; inline const Cmpt& xy() const;
inline const Cmpt& yx() const; inline const Cmpt& yx() const;
@ -123,6 +124,11 @@ public:
inline Cmpt& yx(); inline Cmpt& yx();
inline Cmpt& yy(); inline Cmpt& yy();
// Access vector components.
inline Vector2D<Cmpt> x() const;
inline Vector2D<Cmpt> y() const;
//- Transpose //- Transpose
inline Tensor2D<Cmpt> T() const; inline Tensor2D<Cmpt> T() const;

View File

@ -50,6 +50,18 @@ inline Tensor2D<Cmpt>::Tensor2D(const SphericalTensor2D<Cmpt>& st)
} }
template <class Cmpt>
inline Tensor2D<Cmpt>::Tensor2D
(
const Vector2D<Cmpt>& x,
const Vector2D<Cmpt>& y
)
{
this->v_[XX] = x.x(); this->v_[XY] = x.y();
this->v_[YX] = y.x(); this->v_[YY] = y.y();
}
template <class Cmpt> template <class Cmpt>
inline Tensor2D<Cmpt>::Tensor2D inline Tensor2D<Cmpt>::Tensor2D
( (
@ -72,51 +84,38 @@ inline Tensor2D<Cmpt>::Tensor2D(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <class Cmpt> template <class Cmpt>
inline const Vector2D<Cmpt>& Tensor2D<Cmpt>::x() const inline Vector2D<Cmpt> Tensor2D<Cmpt>::x() const
{ {
return reinterpret_cast<const Vector2D<Cmpt>&>(this->v_[XX]); return Vector2D<Cmpt>(this->v_[XX], this->v_[XY]);
} }
template <class Cmpt> template <class Cmpt>
inline const Vector2D<Cmpt>& Tensor2D<Cmpt>::y() const inline Vector2D<Cmpt> Tensor2D<Cmpt>::y() const
{ {
return reinterpret_cast<const Vector2D<Cmpt>&>(this->v_[YX]); return Vector2D<Cmpt>(this->v_[YX], this->v_[YY]);
} }
template <class Cmpt> template <class Cmpt>
inline Vector2D<Cmpt>& Tensor2D<Cmpt>::x() inline const Cmpt& Tensor2D<Cmpt>::xx() const
{
return reinterpret_cast<Vector2D<Cmpt>&>(this->v_[XX]);
}
template <class Cmpt>
inline Vector2D<Cmpt>& Tensor2D<Cmpt>::y()
{
return reinterpret_cast<Vector2D<Cmpt>&>(this->v_[YX]);
}
template <class Cmpt>
inline const Cmpt& Tensor2D<Cmpt>::xx() const
{ {
return this->v_[XX]; return this->v_[XX];
} }
template <class Cmpt> template <class Cmpt>
inline const Cmpt& Tensor2D<Cmpt>::xy() const inline const Cmpt& Tensor2D<Cmpt>::xy() const
{ {
return this->v_[XY]; return this->v_[XY];
} }
template <class Cmpt> template <class Cmpt>
inline const Cmpt& Tensor2D<Cmpt>::yx() const inline const Cmpt& Tensor2D<Cmpt>::yx() const
{ {
return this->v_[YX]; return this->v_[YX];
} }
template <class Cmpt> template <class Cmpt>
inline const Cmpt& Tensor2D<Cmpt>::yy() const inline const Cmpt& Tensor2D<Cmpt>::yy() const
{ {
return this->v_[YY]; return this->v_[YY];
} }

View File

@ -158,9 +158,11 @@ tensor2D eigenVectors(const tensor2D& t)
{ {
vector2D evals(eigenValues(t)); vector2D evals(eigenValues(t));
tensor2D evs; tensor2D evs
evs.x() = eigenVector(t, evals.x()); (
evs.y() = eigenVector(t, evals.y()); eigenVector(t, evals.x()),
eigenVector(t, evals.y())
);
return evs; return evs;
} }

View File

@ -127,7 +127,10 @@ bool Foam::solidBodyMotionFunctions::tabulated6DoFMotion::read
// If the timeDataFileName has changed read the file // If the timeDataFileName has changed read the file
fileName newTimeDataFileName(SBMFCoeffs_.lookup("timeDataFileName")); fileName newTimeDataFileName
(
fileName(SBMFCoeffs_.lookup("timeDataFileName")).expand()
);
if (newTimeDataFileName != timeDataFileName_) if (newTimeDataFileName != timeDataFileName_)
{ {

View File

@ -715,12 +715,12 @@ void Foam::slidingInterface::setTolerances(const dictionary&dict, bool report)
"edgeMergeTol", "edgeMergeTol",
edgeMergeTol_ edgeMergeTol_
); );
nFacesPerSlaveEdge_ = dict.lookupOrDefault<scalar> nFacesPerSlaveEdge_ = dict.lookupOrDefault<label>
( (
"nFacesPerSlaveEdge", "nFacesPerSlaveEdge",
nFacesPerSlaveEdge_ nFacesPerSlaveEdge_
); );
edgeFaceEscapeLimit_ = dict.lookupOrDefault<scalar> edgeFaceEscapeLimit_ = dict.lookupOrDefault<label>
( (
"edgeFaceEscapeLimit", "edgeFaceEscapeLimit",
edgeFaceEscapeLimit_ edgeFaceEscapeLimit_

View File

@ -16,13 +16,14 @@ $(basicFvPatches)/coupled/coupledFvPatch.C
$(basicFvPatches)/generic/genericFvPatch.C $(basicFvPatches)/generic/genericFvPatch.C
constraintFvPatches = $(fvPatches)/constraint constraintFvPatches = $(fvPatches)/constraint
$(constraintFvPatches)/empty/emptyFvPatch.C
$(constraintFvPatches)/symmetry/symmetryFvPatch.C
$(constraintFvPatches)/wedge/wedgeFvPatch.C
$(constraintFvPatches)/cyclic/cyclicFvPatch.C $(constraintFvPatches)/cyclic/cyclicFvPatch.C
$(constraintFvPatches)/cyclicSlip/cyclicSlipFvPatch.C $(constraintFvPatches)/cyclicSlip/cyclicSlipFvPatch.C
$(constraintFvPatches)/empty/emptyFvPatch.C
$(constraintFvPatches)/nonuniformTransformCyclic/nonuniformTransformCyclicFvPatch.C
$(constraintFvPatches)/processor/processorFvPatch.C $(constraintFvPatches)/processor/processorFvPatch.C
$(constraintFvPatches)/processorCyclic/processorCyclicFvPatch.C $(constraintFvPatches)/processorCyclic/processorCyclicFvPatch.C
$(constraintFvPatches)/symmetry/symmetryFvPatch.C
$(constraintFvPatches)/wedge/wedgeFvPatch.C
derivedFvPatches = $(fvPatches)/derived derivedFvPatches = $(fvPatches)/derived
$(derivedFvPatches)/wall/wallFvPatch.C $(derivedFvPatches)/wall/wallFvPatch.C
@ -100,6 +101,7 @@ $(constraintFvPatchFields)/cyclic/cyclicFvPatchFields.C
$(constraintFvPatchFields)/cyclicSlip/cyclicSlipFvPatchFields.C $(constraintFvPatchFields)/cyclicSlip/cyclicSlipFvPatchFields.C
$(constraintFvPatchFields)/empty/emptyFvPatchFields.C $(constraintFvPatchFields)/empty/emptyFvPatchFields.C
$(constraintFvPatchFields)/jumpCyclic/jumpCyclicFvPatchFields.C $(constraintFvPatchFields)/jumpCyclic/jumpCyclicFvPatchFields.C
$(constraintFvPatchFields)/nonuniformTransformCyclic/nonuniformTransformCyclicFvPatchFields.C
$(constraintFvPatchFields)/processor/processorFvPatchFields.C $(constraintFvPatchFields)/processor/processorFvPatchFields.C
$(constraintFvPatchFields)/processor/processorFvPatchScalarField.C $(constraintFvPatchFields)/processor/processorFvPatchScalarField.C
$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchFields.C $(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchFields.C
@ -158,6 +160,7 @@ $(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C $(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/outletMappedUniformInlet/outletMappedUniformInletFvPatchFields.C
fvsPatchFields = fields/fvsPatchFields fvsPatchFields = fields/fvsPatchFields
@ -173,12 +176,12 @@ constraintFvsPatchFields = $(fvsPatchFields)/constraint
$(constraintFvsPatchFields)/cyclic/cyclicFvsPatchFields.C $(constraintFvsPatchFields)/cyclic/cyclicFvsPatchFields.C
$(constraintFvsPatchFields)/cyclicSlip/cyclicSlipFvsPatchFields.C $(constraintFvsPatchFields)/cyclicSlip/cyclicSlipFvsPatchFields.C
$(constraintFvsPatchFields)/empty/emptyFvsPatchFields.C $(constraintFvsPatchFields)/empty/emptyFvsPatchFields.C
$(constraintFvsPatchFields)/nonuniformTransformCyclic/nonuniformTransformCyclicFvsPatchFields.C
$(constraintFvsPatchFields)/processor/processorFvsPatchFields.C $(constraintFvsPatchFields)/processor/processorFvsPatchFields.C
$(constraintFvsPatchFields)/processorCyclic/processorCyclicFvsPatchFields.C $(constraintFvsPatchFields)/processorCyclic/processorCyclicFvsPatchFields.C
$(constraintFvsPatchFields)/symmetry/symmetryFvsPatchFields.C $(constraintFvsPatchFields)/symmetry/symmetryFvsPatchFields.C
$(constraintFvsPatchFields)/wedge/wedgeFvsPatchFields.C $(constraintFvsPatchFields)/wedge/wedgeFvsPatchFields.C
fields/volFields/volFields.C fields/volFields/volFields.C
fields/surfaceFields/surfaceFields.C fields/surfaceFields/surfaceFields.C
@ -196,6 +199,8 @@ $(interpolation)/interpolationCellPoint/makeInterpolationCellPoint.C
$(interpolation)/interpolationCellPointFace/makeInterpolationCellPointFace.C $(interpolation)/interpolationCellPointFace/makeInterpolationCellPointFace.C
$(interpolation)/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.C $(interpolation)/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.C
$(interpolation)/interpolationCellPointWallModified/makeInterpolationCellPointWallModified.C $(interpolation)/interpolationCellPointWallModified/makeInterpolationCellPointWallModified.C
$(interpolation)/interpolationPoint/pointMVCWeight.C
$(interpolation)/interpolationPoint/makeInterpolationPoint.C
volPointInterpolation = interpolation/volPointInterpolation volPointInterpolation = interpolation/volPointInterpolation
/* /*

View File

@ -71,7 +71,7 @@ void Foam::MRFZone::relativeRhoFlux
phi.boundaryField()[patchi][patchFacei] -= phi.boundaryField()[patchi][patchFacei] -=
rho.boundaryField()[patchi][patchFacei] rho.boundaryField()[patchi][patchFacei]
*(Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) * (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin))
& Sf.boundaryField()[patchi][patchFacei]; & Sf.boundaryField()[patchi][patchFacei];
} }
} }
@ -95,7 +95,7 @@ void Foam::MRFZone::absoluteRhoFlux
forAll(internalFaces_, i) forAll(internalFaces_, i)
{ {
label facei = internalFaces_[i]; label facei = internalFaces_[i];
phi[facei] += (Omega ^ (Cf[facei] - origin)) & Sf[facei]; phi[facei] += rho[facei]*(Omega ^ (Cf[facei] - origin)) & Sf[facei];
} }
// Included patches // Included patches
@ -106,7 +106,8 @@ void Foam::MRFZone::absoluteRhoFlux
label patchFacei = includedFaces_[patchi][i]; label patchFacei = includedFaces_[patchi][i];
phi.boundaryField()[patchi][patchFacei] += phi.boundaryField()[patchi][patchFacei] +=
(Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) rho.boundaryField()[patchi][patchFacei]
* (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin))
& Sf.boundaryField()[patchi][patchFacei]; & Sf.boundaryField()[patchi][patchFacei];
} }
} }
@ -119,7 +120,8 @@ void Foam::MRFZone::absoluteRhoFlux
label patchFacei = excludedFaces_[patchi][i]; label patchFacei = excludedFaces_[patchi][i];
phi.boundaryField()[patchi][patchFacei] += phi.boundaryField()[patchi][patchFacei] +=
(Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) rho.boundaryField()[patchi][patchFacei]
* (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin))
& Sf.boundaryField()[patchi][patchFacei]; & Sf.boundaryField()[patchi][patchFacei];
} }
} }

View File

@ -287,7 +287,7 @@ public:
} }
//- Return axis //- Return axis
const vector& axis() const vector axis() const
{ {
return coordSys_.axis(); return coordSys_.axis();
} }

View File

@ -57,18 +57,18 @@ cyclicFvPatchField<Type>::cyclicFvPatchField
coupledFvPatchField<Type>(ptf, p, iF, mapper), coupledFvPatchField<Type>(ptf, p, iF, mapper),
cyclicPatch_(refCast<const cyclicFvPatch>(p)) cyclicPatch_(refCast<const cyclicFvPatch>(p))
{ {
if (!isType<cyclicFvPatch>(this->patch())) if (!isA<cyclicFvPatch>(this->patch()))
{ {
FatalErrorIn FatalErrorIn
( (
"cyclicFvPatchField<Type>::cyclicFvPatchField\n" "cyclicFvPatchField<Type>::cyclicFvPatchField"
"(\n" "("
" const cyclicFvPatchField<Type>& ptf,\n" "const cyclicFvPatchField<Type>& ,"
" const fvPatch& p,\n" "const fvPatch&, "
" const DimensionedField<Type, volMesh>& iF,\n" "const DimensionedField<Type, volMesh>&, "
" const fvPatchFieldMapper& mapper\n" "const fvPatchFieldMapper&"
")\n" ")"
) << "\n patch type '" << p.type() ) << " patch type '" << p.type()
<< "' not constraint type '" << typeName << "'" << "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->dimensionedInternalField().name()
@ -89,18 +89,18 @@ cyclicFvPatchField<Type>::cyclicFvPatchField
coupledFvPatchField<Type>(p, iF, dict), coupledFvPatchField<Type>(p, iF, dict),
cyclicPatch_(refCast<const cyclicFvPatch>(p)) cyclicPatch_(refCast<const cyclicFvPatch>(p))
{ {
if (!isType<cyclicFvPatch>(p)) if (!isA<cyclicFvPatch>(p))
{ {
FatalIOErrorIn FatalIOErrorIn
( (
"cyclicFvPatchField<Type>::cyclicFvPatchField\n" "cyclicFvPatchField<Type>::cyclicFvPatchField"
"(\n" "("
" const fvPatch& p,\n" "const fvPatch&, "
" const Field<Type>& field,\n" "const Field<Type>&, "
" const dictionary& dict\n" "const dictionary&"
")\n", ")",
dict dict
) << "\n patch type '" << p.type() ) << " patch type '" << p.type()
<< "' not constraint type '" << typeName << "'" << "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->dimensionedInternalField().name()

View File

@ -168,9 +168,11 @@ void wedgeFvPatchField<Type>::evaluate(const Pstream::commsTypes)
template<class Type> template<class Type>
tmp<Field<Type> > wedgeFvPatchField<Type>::snGradTransformDiag() const tmp<Field<Type> > wedgeFvPatchField<Type>::snGradTransformDiag() const
{ {
diagTensor diagT = const diagTensor diagT =
0.5*diag(I - refCast<const wedgeFvPatch>(this->patch()).cellT()); 0.5*diag(I - refCast<const wedgeFvPatch>(this->patch()).cellT());
const vector diagV(diagT.xx(), diagT.yy(), diagT.zz());
return tmp<Field<Type> > return tmp<Field<Type> >
( (
new Field<Type> new Field<Type>
@ -180,7 +182,7 @@ tmp<Field<Type> > wedgeFvPatchField<Type>::snGradTransformDiag() const
( (
pow pow
( (
reinterpret_cast<const vector&>(diagT), diagV,
pTraits<typename powProduct<vector, pTraits<Type>::rank> pTraits<typename powProduct<vector, pTraits<Type>::rank>
::type>::zero ::type>::zero
) )

View File

@ -0,0 +1,190 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 "outletMappedUniformInletFvPatchField.H"
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
outletMappedUniformInletFvPatchField<Type>::
outletMappedUniformInletFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(p, iF),
outletPatchName_(),
phiName_("phi")
{}
template<class Type>
outletMappedUniformInletFvPatchField<Type>::
outletMappedUniformInletFvPatchField
(
const outletMappedUniformInletFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
outletPatchName_(ptf.outletPatchName_),
phiName_(ptf.phiName_)
{}
template<class Type>
outletMappedUniformInletFvPatchField<Type>::
outletMappedUniformInletFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF, dict),
outletPatchName_(dict.lookup("outletPatchName")),
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{}
template<class Type>
outletMappedUniformInletFvPatchField<Type>::
outletMappedUniformInletFvPatchField
(
const outletMappedUniformInletFvPatchField<Type>& ptf
)
:
fixedValueFvPatchField<Type>(ptf),
outletPatchName_(ptf.outletPatchName_),
phiName_(ptf.phiName_)
{}
template<class Type>
outletMappedUniformInletFvPatchField<Type>::
outletMappedUniformInletFvPatchField
(
const outletMappedUniformInletFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(ptf, iF),
outletPatchName_(ptf.outletPatchName_),
phiName_(ptf.phiName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void outletMappedUniformInletFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
const GeometricField<Type, fvPatchField, volMesh>& f
(
dynamic_cast<const GeometricField<Type, fvPatchField, volMesh>&>
(
this->dimensionedInternalField()
)
);
const fvPatch& p = this->patch();
label outletPatchID =
p.patch().boundaryMesh().findPatchID(outletPatchName_);
if (outletPatchID < 0)
{
FatalErrorIn
(
"void outletMappedUniformInletFvPatchField<Type>::updateCoeffs()"
) << "Unable to find outlet patch " << outletPatchName_
<< abort(FatalError);
}
const fvPatch& outletPatch = p.boundaryMesh()[outletPatchID];
const fvPatchField<Type>& outletPatchField =
f.boundaryField()[outletPatchID];
const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_);
const scalarField& outletPatchPhi = phi.boundaryField()[outletPatchID];
scalar sumOutletPatchPhi = gSum(outletPatchPhi);
if (sumOutletPatchPhi > SMALL)
{
Type averageOutletField =
gSum(outletPatchPhi*outletPatchField)
/sumOutletPatchPhi;
this->operator==(averageOutletField);
}
else
{
Type averageOutletField =
gSum(outletPatch.magSf()*outletPatchField)
/gSum(outletPatch.magSf());
this->operator==(averageOutletField);
}
fixedValueFvPatchField<Type>::updateCoeffs();
}
template<class Type>
void outletMappedUniformInletFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
os.writeKeyword("outletPatchName")
<< outletPatchName_ << token::END_STATEMENT << nl;
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,169 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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::outletMappedUniformInletFvPatchField
Description
Averages the field over the "outlet" patch specified by name
"outletPatchName" and applies this as the uniform value of the field
over this patch.
SourceFiles
outletMappedUniformInletFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef outletMappedUniformInletFvPatchField_H
#define outletMappedUniformInletFvPatchField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class outletMappedUniformInletFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class outletMappedUniformInletFvPatchField
:
public fixedValueFvPatchField<Type>
{
// Private data
//- Name of the outlet patch to be mapped
word outletPatchName_;
//- Name of the flux transporting the field
word phiName_;
public:
//- Runtime type information
TypeName("outletMappedUniformInlet");
// Constructors
//- Construct from patch and internal field
outletMappedUniformInletFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
outletMappedUniformInletFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given outletMappedUniformInletFvPatchField
// onto a new patch
outletMappedUniformInletFvPatchField
(
const outletMappedUniformInletFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
outletMappedUniformInletFvPatchField
(
const outletMappedUniformInletFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new outletMappedUniformInletFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
outletMappedUniformInletFvPatchField
(
const outletMappedUniformInletFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new outletMappedUniformInletFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Access
//- Name of the outlet patch to be mapped
const word& outletPatchName() const
{
return outletPatchName_;
}
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "outletMappedUniformInletFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 "outletMappedUniformInletFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(outletMappedUniformInlet);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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/>.
\*---------------------------------------------------------------------------*/
#ifndef outletMappedUniformInletFvPatchFields_H
#define outletMappedUniformInletFvPatchFields_H
#include "outletMappedUniformInletFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(outletMappedUniformInlet)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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/>.
\*---------------------------------------------------------------------------*/
#ifndef outletMappedUniformInletFvPatchFieldsFwd_H
#define outletMappedUniformInletFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class outletMappedUniformInletFvPatchField;
makePatchTypeFieldTypedefs(outletMappedUniformInlet)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -56,7 +56,7 @@ cyclicFvsPatchField<Type>::cyclicFvsPatchField
coupledFvsPatchField<Type>(ptf, p, iF, mapper), coupledFvsPatchField<Type>(ptf, p, iF, mapper),
cyclicPatch_(refCast<const cyclicFvPatch>(p)) cyclicPatch_(refCast<const cyclicFvPatch>(p))
{ {
if (!isType<cyclicFvPatch>(this->patch())) if (!isA<cyclicFvPatch>(this->patch()))
{ {
FatalErrorIn FatalErrorIn
( (
@ -87,7 +87,7 @@ cyclicFvsPatchField<Type>::cyclicFvsPatchField
coupledFvsPatchField<Type>(p, iF, dict), coupledFvsPatchField<Type>(p, iF, dict),
cyclicPatch_(refCast<const cyclicFvPatch>(p)) cyclicPatch_(refCast<const cyclicFvPatch>(p))
{ {
if (!isType<cyclicFvPatch>(p)) if (!isA<cyclicFvPatch>(p))
{ {
FatalIOErrorIn FatalIOErrorIn
( (

View File

@ -346,9 +346,12 @@ Foam::fv::cellLimitedGrad<Foam::vector>::calcGrad
forAll(gIf, celli) forAll(gIf, celli)
{ {
gIf[celli].x() = cmptMultiply(limiter[celli], gIf[celli].x()); gIf[celli] = tensor
gIf[celli].y() = cmptMultiply(limiter[celli], gIf[celli].y()); (
gIf[celli].z() = cmptMultiply(limiter[celli], gIf[celli].z()); cmptMultiply(limiter[celli], gIf[celli].x()),
cmptMultiply(limiter[celli], gIf[celli].y()),
cmptMultiply(limiter[celli], gIf[celli].z())
);
} }
g.correctBoundaryConditions(); g.correctBoundaryConditions();

Some files were not shown because too many files have changed in this diff Show More