mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -9,4 +9,6 @@
|
||||
|
||||
UrelEqn().relax();
|
||||
|
||||
solve(UrelEqn() == -fvc::grad(p));
|
||||
sources.constrain(UrelEqn());
|
||||
|
||||
solve(UrelEqn() == -fvc::grad(p) + sources(Urel));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
volScalarField rAUrel(1.0/UrelEqn().A());
|
||||
Urel = rAUrel*UrelEqn().H();
|
||||
Urel = rAUrel*(UrelEqn() == sources(Urel))().H();
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
{
|
||||
@ -37,3 +37,4 @@ p.relax();
|
||||
// Momentum corrector
|
||||
Urel -= rAUrel*fvc::grad(p);
|
||||
Urel.correctBoundaryConditions();
|
||||
sources.correct(Urel);
|
||||
|
||||
@ -5,8 +5,6 @@ tmp<fvVectorMatrix> UEqn
|
||||
fvm::ddt(U)
|
||||
+ fvm::div(phi, U)
|
||||
+ turbulence->divDevReff(U)
|
||||
==
|
||||
sources(U)
|
||||
);
|
||||
|
||||
UEqn().relax();
|
||||
@ -17,5 +15,5 @@ volScalarField rAU(1.0/UEqn().A());
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn() == -fvc::grad(p));
|
||||
solve(UEqn() == -fvc::grad(p) + sources(U));
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
U = rAU*UEqn().H();
|
||||
U = rAU*(UEqn() == sources(U))().H();
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
{
|
||||
@ -36,3 +36,4 @@ p.relax();
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
sources.correct(U);
|
||||
|
||||
@ -9,9 +9,11 @@ tmp<fvVectorMatrix> UEqn
|
||||
|
||||
UEqn().relax();
|
||||
|
||||
sources.constrain(UEqn());
|
||||
|
||||
rAU = 1.0/UEqn().A();
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn() == -fvc::grad(p));
|
||||
solve(UEqn() == -fvc::grad(p) + sources(U));
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
U = rAU*UEqn().H();
|
||||
U = rAU*(UEqn() == sources(U))().H();
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
{
|
||||
@ -46,3 +46,4 @@ fvc::makeRelative(phi, U);
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
sources.correct(U);
|
||||
|
||||
@ -3,8 +3,6 @@ tmp<fvVectorMatrix> UEqn
|
||||
fvm::ddt(U)
|
||||
+ fvm::div(phi, U)
|
||||
+ turbulence->divDevReff(U)
|
||||
==
|
||||
sources(U)
|
||||
);
|
||||
|
||||
|
||||
@ -14,5 +12,5 @@ sources.constrain(UEqn());
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn() == -fvc::grad(p_gh));
|
||||
solve(UEqn() == -fvc::grad(p_gh) + sources(U));
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
volScalarField rAU(1.0/UEqn().A());
|
||||
surfaceScalarField rAUf(rAU.name() + 'f', fvc::interpolate(rAU));
|
||||
|
||||
U = rAU*UEqn().H();
|
||||
U = rAU*(UEqn() == sources(U))().H();
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
{
|
||||
@ -41,3 +41,4 @@ p = p_gh + (g & (mesh.C() + zeta - refLevel));
|
||||
|
||||
U -= rAU*fvc::grad(p_gh);
|
||||
U.correctBoundaryConditions();
|
||||
sources.correct(U);
|
||||
|
||||
@ -34,4 +34,5 @@
|
||||
// Momentum corrector
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
sources.correct(U);
|
||||
}
|
||||
|
||||
@ -34,4 +34,5 @@
|
||||
// Momentum corrector
|
||||
Urel -= rAUrel*fvc::grad(p);
|
||||
Urel.correctBoundaryConditions();
|
||||
sources.correct(Urel);
|
||||
}
|
||||
|
||||
@ -34,4 +34,5 @@
|
||||
// Momentum corrector
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
sources.correct(U);
|
||||
}
|
||||
|
||||
@ -5,11 +5,16 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/fieldSources/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-lincompressibleTurbulenceModel \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleTransportModels \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
-lmeshTools \
|
||||
-lfieldSources \
|
||||
-lsampling
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
==
|
||||
rho.dimensionedInternalField()*g
|
||||
+ parcels.SU(U)
|
||||
+ sources(rho, U)
|
||||
);
|
||||
|
||||
sources.constrain(UEqn);
|
||||
@ -16,5 +15,5 @@
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
solve(UEqn == -fvc::grad(p) + sources(rho, U));
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
thermo.rho() -= psi*p;
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
U = rAU*UEqn.H();
|
||||
U = rAU*(UEqn == sources(rho, U))().H();
|
||||
|
||||
if (pZones.size() > 0)
|
||||
{
|
||||
@ -60,6 +60,7 @@
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
sources.correct(U);
|
||||
|
||||
rho = thermo.rho();
|
||||
rho = max(rho, rhoMin);
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
rho.dimensionedInternalField()*g
|
||||
+ coalParcels.SU(U)
|
||||
+ limestoneParcels.SU(U)
|
||||
+ sources(rho, U)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
@ -16,6 +15,6 @@
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
solve(UEqn == -fvc::grad(p) + sources(rho, U));
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
rho = thermo.rho();
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
U = rAU*UEqn.H();
|
||||
U = rAU*(UEqn == sources(rho, U))().H();
|
||||
|
||||
if (pimple.transonic())
|
||||
{
|
||||
@ -74,6 +74,8 @@ else
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
sources.correct(U);
|
||||
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
dpdt = fvc::ddt(p);
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
==
|
||||
rho.dimensionedInternalField()*g
|
||||
+ parcels.SU(U)
|
||||
+ sources(rho, U)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
@ -18,7 +17,7 @@
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
solve(UEqn == -fvc::grad(p) + sources(rho, U));
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
thermo.rho() -= psi*p;
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
U = rAU*UEqn.H();
|
||||
U = rAU*(UEqn == sources(rho, U))().H();
|
||||
|
||||
if (pZones.size() > 0)
|
||||
{
|
||||
@ -59,6 +59,8 @@
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
sources.correct(U);
|
||||
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
dpdt = fvc::ddt(p);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I${LIB_SRC}/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||
@ -20,8 +21,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/ODE/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||
-I$(LIB_SRC)/combustionModels/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam
|
||||
-I$(LIB_SRC)/combustionModels/lnInclude
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
rho = thermo.rho();
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
U = rAU*UEqn.H();
|
||||
|
||||
if (pimple.transonic())
|
||||
{
|
||||
surfaceScalarField phid
|
||||
(
|
||||
"phid",
|
||||
fvc::interpolate(psi)
|
||||
*(
|
||||
((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U))
|
||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||
)
|
||||
);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvm::div(phid, p)
|
||||
- fvm::laplacian(rho*rAU, p)
|
||||
==
|
||||
parcels.Srho()
|
||||
);
|
||||
|
||||
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi == pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
phi =
|
||||
fvc::interpolate(rho)
|
||||
*(
|
||||
((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U))
|
||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||
);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvc::div(phi)
|
||||
- fvm::laplacian(rho*rAU, p)
|
||||
==
|
||||
parcels.Srho()
|
||||
);
|
||||
|
||||
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi += pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
#include "compressibleContinuityErrs.H"
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
dpdt = fvc::ddt(p);
|
||||
@ -74,6 +74,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl;
|
||||
|
||||
mesh.move();
|
||||
|
||||
parcels.evolve();
|
||||
|
||||
#include "rhoEqn.H"
|
||||
@ -114,11 +114,11 @@ public:
|
||||
//- the dragfunction K used in the momentum eq.
|
||||
// ddt(alpha*rhoa*Ua) + ... = ... alpha*beta*K*(Ua-Ub)
|
||||
// ddt(beta*rhob*Ub) + ... = ... alpha*beta*K*(Ub-Ua)
|
||||
// **********************************<EFBFBD>NB ! *****************************
|
||||
// ********************************** NB! *****************************
|
||||
// for numerical reasons alpha and beta has been
|
||||
// extracted from the dragFunction K,
|
||||
// so you MUST divide K by alpha*beta when implemnting the drag function
|
||||
// **********************************<EFBFBD>NB ! *****************************
|
||||
// ********************************** NB! *****************************
|
||||
virtual tmp<volScalarField> K(const volScalarField& Ur) const = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -114,12 +114,12 @@ public:
|
||||
//- the heat-transfer function K used in the enthalpy eq.
|
||||
// ddt(alpha*rhoa*ha) + ... = ... alpha*beta*K*(Ta - Tb)
|
||||
// ddt(beta*rhob*hb) + ... = ... alpha*beta*K*(Tb - Ta)
|
||||
// **********************************<EFBFBD>NB ! *****************************
|
||||
// ********************************** NB!*****************************
|
||||
// for numerical reasons alpha and beta has been
|
||||
// extracted from the heat-transfer function K,
|
||||
// so you MUST divide K by alpha*beta when implementing the
|
||||
// heat-transfer function
|
||||
// **********************************<EFBFBD>NB ! *****************************
|
||||
// ********************************** NB!*****************************
|
||||
virtual tmp<volScalarField> K(const volScalarField& Ur) const = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
Info<< "Liquid phase volume fraction = "
|
||||
<< alpha1.weightedAverage(mesh.V()).value()
|
||||
<< alpha1.weightedAverage(mesh.Vsc()).value()
|
||||
<< " Min(alpha1) = " << min(alpha1).value()
|
||||
<< " Max(alpha1) = " << max(alpha1).value()
|
||||
<< endl;
|
||||
|
||||
@ -35,8 +35,8 @@ Description
|
||||
\verbatim
|
||||
Kunz, R.F., Boger, D.A., Stinebring, D.R., Chyczewski, Lindau. J.W.,
|
||||
Gibeling, H.J., Venkateswaran, S., Govindan, T.R.,
|
||||
“A Preconditioned Implicit Method for Two-Phase Flows with Application
|
||||
to Cavitation Prediction,”
|
||||
"A Preconditioned Implicit Method for Two-Phase Flows with Application
|
||||
to Cavitation Prediction,"
|
||||
Computers and Fluids,
|
||||
29(8):849-875, 2000.
|
||||
\endverbatim
|
||||
|
||||
@ -131,11 +131,11 @@ public:
|
||||
//- the dragfunction K used in the momentum eq.
|
||||
// ddt(alpha*rhoa*Ua) + ... = ... alpha*beta*K*(Ua-Ub)
|
||||
// ddt(beta*rhob*Ub) + ... = ... alpha*beta*K*(Ub-Ua)
|
||||
// **********************************<EFBFBD>NB ! *****************************
|
||||
// ********************************** NB! *****************************
|
||||
// for numerical reasons alpha and beta has been
|
||||
// extracted from the dragFunction K,
|
||||
// so you MUST divide K by alpha*beta when implemnting the drag function
|
||||
// **********************************<EFBFBD>NB ! *****************************
|
||||
// ********************************** NB! *****************************
|
||||
virtual tmp<volScalarField> K(const volScalarField& Ur) const = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -114,12 +114,12 @@ public:
|
||||
//- the heat-transfer function K used in the enthalpy eq.
|
||||
// ddt(alpha*rhoa*ha) + ... = ... alpha*beta*K*(Ta - Tb)
|
||||
// ddt(beta*rhob*hb) + ... = ... alpha*beta*K*(Tb - Ta)
|
||||
// **********************************<EFBFBD>NB ! *****************************
|
||||
// ********************************** NB! *****************************
|
||||
// for numerical reasons alpha and beta has been
|
||||
// extracted from the heat-transfer function K,
|
||||
// so you MUST divide K by alpha*beta when implementing the
|
||||
// heat-transfer function
|
||||
// **********************************<EFBFBD>NB ! *****************************
|
||||
// ********************************** NB! *****************************
|
||||
virtual tmp<volScalarField> K(const volScalarField& Ur) const = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -155,7 +155,6 @@
|
||||
phasei++;
|
||||
}
|
||||
Dp = mag(Dp);
|
||||
adjustPhi(phi0, U, p);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
|
||||
@ -114,11 +114,11 @@ public:
|
||||
//- the dragfunction K used in the momentum eq.
|
||||
// ddt(alpha*rhoa*Ua) + ... = ... alpha*beta*K*(Ua-Ub)
|
||||
// ddt(beta*rhob*Ub) + ... = ... alpha*beta*K*(Ub-Ua)
|
||||
// **********************************<EFBFBD>NB ! *****************************
|
||||
// ********************************** NB ! *****************************
|
||||
// for numerical reasons alpha and beta has been
|
||||
// extracted from the dragFunction K,
|
||||
// so you MUST divide K by alpha*beta when implemnting the drag function
|
||||
// **********************************<EFBFBD>NB ! *****************************
|
||||
// ********************************** NB ! *****************************
|
||||
virtual tmp<volScalarField> K(const volScalarField& Ur) const = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -65,30 +65,36 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
myList.append(500.3);
|
||||
myList.append(200.3);
|
||||
myList.append(100.3);
|
||||
|
||||
|
||||
Info<< nl << "And again using STL const_iterator: " << nl << endl;
|
||||
|
||||
const DLList<scalar>& const_myList = myList;
|
||||
|
||||
forAllConstIter(DLList<scalar>, const_myList, iter)
|
||||
forAllConstIter(DLList<scalar>, myList, iter)
|
||||
{
|
||||
Info<< "element:" << *iter << endl;
|
||||
}
|
||||
|
||||
Info<< nl << "Testing swapUp and swapDown: " << endl;
|
||||
|
||||
Info<< nl << "swapUp" << endl;
|
||||
|
||||
myList.swapUp(myList.DLListBase::first());
|
||||
myList.swapUp(myList.DLListBase::last());
|
||||
|
||||
forAllConstIter(DLList<scalar>, const_myList, iter)
|
||||
forAllIter(DLList<scalar>, myList, iter)
|
||||
{
|
||||
Info<< "element:" << *iter << endl;
|
||||
}
|
||||
|
||||
Info<< nl << "swapDown" << endl;
|
||||
|
||||
myList.swapDown(myList.DLListBase::first());
|
||||
myList.swapDown(myList.DLListBase::last());
|
||||
|
||||
forAllConstIter(DLList<scalar>, const_myList, iter)
|
||||
forAllIter(DLList<scalar>, myList, iter)
|
||||
{
|
||||
Info<< "element:" << *iter << endl;
|
||||
}
|
||||
@ -103,8 +109,8 @@ int main(int argc, char *argv[])
|
||||
Info<< nl << "source: " << myList << nl
|
||||
<< nl << "target: " << newList << endl;
|
||||
|
||||
|
||||
Info<< nl << "Done." << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
Test-findSphereFeatureEdges-octree.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-findSphereFeatureEdges-octree
|
||||
@ -0,0 +1,9 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/edgeMesh/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-ledgeMesh
|
||||
@ -0,0 +1,134 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "fvMesh.H"
|
||||
#include "IStringStream.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataEdge.H"
|
||||
#include "OFstream.H"
|
||||
#include "extendedFeatureEdgeMesh.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
|
||||
fileName sFeatFileName("unit_cube_rotated.extendedFeatureEdgeMesh");
|
||||
|
||||
extendedFeatureEdgeMesh efem
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
sFeatFileName,
|
||||
runTime.time().constant(),
|
||||
"extendedFeatureEdgeMesh",
|
||||
runTime.time(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are less face/edge aligned items.
|
||||
treeBoundBox bb
|
||||
(
|
||||
efem.points()
|
||||
);
|
||||
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
labelList allEdges(identity(efem.edges().size()));
|
||||
|
||||
indexedOctree<treeDataEdge> edgeTree
|
||||
(
|
||||
treeDataEdge
|
||||
(
|
||||
false, // cachebb
|
||||
efem.edges(), // edges
|
||||
efem.points(), // points
|
||||
allEdges // selected edges
|
||||
),
|
||||
bb, // bb
|
||||
8, // maxLevel
|
||||
10, // leafsize
|
||||
3.0 // duplicity
|
||||
);
|
||||
|
||||
Info<< "Points: " << efem.points() << nl << endl;
|
||||
Info<< "Edges: " << efem.edges() << nl << endl;
|
||||
|
||||
Info<< "Find edge labels within sphere from point (0, 0, 0):" << endl;
|
||||
|
||||
Info<< " Radius = 0 : "
|
||||
<< edgeTree.findSphere(point(0, 0, 0), 0) << endl;
|
||||
|
||||
Info<< " Radius = 1 : "
|
||||
<< edgeTree.findSphere(point(0, 0, 0), 1) << endl;
|
||||
|
||||
Info<< " Radius = root(1.5) : "
|
||||
<< edgeTree.findSphere(point(0, 0, 0), 1.5) << endl;
|
||||
|
||||
Info<< " Radius = root(2) : "
|
||||
<< edgeTree.findSphere(point(0, 0, 0), 2) << endl;
|
||||
|
||||
Info<< " Radius = root(0.5) : "
|
||||
<< edgeTree.findSphere(point(1, 0, 0), 0.5) << endl;
|
||||
|
||||
Info<< " Radius = root(0.25) : "
|
||||
<< edgeTree.findSphere(point(0, 0, 0.5), 0.25) << endl;
|
||||
|
||||
treeBoundBox tbb(point(0,0,0), point(0.1,0.1,0.1));
|
||||
Info<< " Box = " << tbb << " : "
|
||||
<< edgeTree.findBox(tbb) << endl;
|
||||
|
||||
treeBoundBox tbb1(point(0,0,0), point(1,1,0.1));
|
||||
Info<< " Box = " << tbb1 << " : "
|
||||
<< edgeTree.findBox(tbb1) << endl;
|
||||
|
||||
treeBoundBox tbb2(point(0.3,0,0), point(1,0.3,1));
|
||||
Info<< " Box = " << tbb2 << " : "
|
||||
<< edgeTree.findBox(tbb2) << endl;
|
||||
|
||||
treeBoundBox tbb3(point(-0.2,0.5,0), point(0.3,0.9,1));
|
||||
Info<< " Box = " << tbb3 << " : "
|
||||
<< edgeTree.findBox(tbb3) << endl;
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,7 +35,7 @@ Description
|
||||
#include "polyMesh.H"
|
||||
#include "ListOps.H"
|
||||
#include "face.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "tetrahedron.H"
|
||||
#include "triFaceList.H"
|
||||
#include "OFstream.H"
|
||||
#include "meshTools.H"
|
||||
|
||||
@ -1637,6 +1637,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "addRegionOption.H"
|
||||
#include "addOverwriteOption.H"
|
||||
argList::addOption("dict", "name", "specify alternative dictionary");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -290,18 +290,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Whether first use of face (modify) or consecutive (add)
|
||||
PackedBoolList modifiedFace(mesh.nFaces());
|
||||
// Never modify coupled faces
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
if (pp.coupled())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
modifiedFace[pp.start()+i] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
label nModified = 0;
|
||||
|
||||
forAll(newMasterPatches, i)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -492,6 +492,12 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addRegionOption.H"
|
||||
argList::addOption
|
||||
(
|
||||
"dict",
|
||||
"word",
|
||||
"name of dictionary to provide patch information"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
@ -502,13 +508,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
|
||||
Info<< "Reading createPatchDict." << nl << endl;
|
||||
word dictName
|
||||
(
|
||||
args.optionLookupOrDefault<word>("dict", "createPatchDict")
|
||||
);
|
||||
|
||||
Info<< "Reading " << dictName << nl << endl;
|
||||
|
||||
IOdictionary dict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"createPatchDict",
|
||||
dictName,
|
||||
runTime.system(),
|
||||
(
|
||||
meshRegionName != polyMesh::defaultRegion
|
||||
@ -607,6 +618,11 @@ int main(int argc, char *argv[])
|
||||
).ptr()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Patch '" << patchName << "' already exists. Only "
|
||||
<< "moving patch faces - type will remain the same" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy old patches.
|
||||
|
||||
@ -61,6 +61,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
#include "addOverwriteOption.H"
|
||||
|
||||
argList::validArgs.append("masterCase");
|
||||
argList::addOption
|
||||
(
|
||||
@ -83,6 +85,8 @@ int main(int argc, char *argv[])
|
||||
FatalError.exit();
|
||||
}
|
||||
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
|
||||
fileName masterCase = args[1];
|
||||
word masterRegion = polyMesh::defaultRegion;
|
||||
args.optionReadIfPresent("masterRegion", masterRegion);
|
||||
@ -126,7 +130,10 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
if (!overwrite)
|
||||
{
|
||||
runTimeMaster++;
|
||||
}
|
||||
|
||||
Info<< "Writing combined mesh to " << runTimeMaster.timeName() << endl;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/renumberMethods/lnInclude \
|
||||
-I$(LIB_SRC)/renumber/renumberMethods/lnInclude \
|
||||
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,6 +35,9 @@ Usage
|
||||
\param -ascii \n
|
||||
Write Ensight data in ASCII format instead of "C Binary"
|
||||
|
||||
\parm -name \<subdir\>\n
|
||||
define sub-directory name to use for Ensight data (default: "Ensight")
|
||||
|
||||
\param -noZero \n
|
||||
Exclude the often incomplete initial conditions.
|
||||
|
||||
@ -46,6 +49,9 @@ Usage
|
||||
Suppress writing the geometry. Can be useful for converting partial
|
||||
results for a static geometry.
|
||||
|
||||
\param -width \<n\>\n
|
||||
width of Ensight data subdir
|
||||
|
||||
Note
|
||||
- no parallel data.
|
||||
- writes to \a Ensight directory to avoid collisions with foamToEnsight.
|
||||
@ -96,6 +102,19 @@ int main(int argc, char *argv[])
|
||||
"suppress writing the geometry. "
|
||||
"Can be useful for converting partial results for a static geometry"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"name",
|
||||
"subdir",
|
||||
"define sub-directory name to use for Ensight data "
|
||||
"(default: \"Ensight\")"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"width",
|
||||
"n",
|
||||
"width of Ensight data subdir"
|
||||
);
|
||||
|
||||
// the volume field types that we handle
|
||||
wordHashSet volFieldTypes;
|
||||
@ -133,7 +152,21 @@ int main(int argc, char *argv[])
|
||||
// always write the geometry, unless the -noMesh option is specified
|
||||
bool optNoMesh = args.optionFound("noMesh");
|
||||
|
||||
fileName ensightDir = args.rootPath()/args.globalCaseName()/"Ensight";
|
||||
// adjust output width
|
||||
if (args.optionFound("width"))
|
||||
{
|
||||
ensightFile::subDirWidth(args.optionRead<label>("width"));
|
||||
}
|
||||
|
||||
// define sub-directory name to use for Ensight data
|
||||
fileName ensightDir = "Ensight";
|
||||
args.optionReadIfPresent("name", ensightDir);
|
||||
|
||||
if (!ensightDir.isAbsolute())
|
||||
{
|
||||
ensightDir = args.rootPath()/args.globalCaseName()/ensightDir;
|
||||
}
|
||||
|
||||
fileName dataDir = ensightDir/"data";
|
||||
fileName caseFileName = "Ensight.case";
|
||||
fileName dataMask = fileName("data")/ensightFile::mask();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,7 +47,7 @@ Description
|
||||
#include "incompressible/RAS/RASModel/RASModel.H"
|
||||
#include "incompressible/LES/LESModel/LESModel.H"
|
||||
|
||||
#include "basicPsiThermo.H"
|
||||
#include "basicThermo.H"
|
||||
#include "compressible/RAS/RASModel/RASModel.H"
|
||||
#include "compressible/LES/LESModel/LESModel.H"
|
||||
|
||||
@ -265,7 +265,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
}
|
||||
else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
|
||||
{
|
||||
autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
|
||||
autoPtr<basicThermo> thermo(basicThermo::New(mesh));
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,54 +32,26 @@ Description
|
||||
#include "fvCFD.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
argList::validArgs.append("fieldName");
|
||||
argList::validArgs.append("patchName");
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
# include "createMesh.H"
|
||||
|
||||
const word fieldName = args[1];
|
||||
const word patchName = args[2];
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
IOobject fieldHeader
|
||||
template<class FieldType>
|
||||
void printAverage
|
||||
(
|
||||
fieldName,
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
// Check field exists
|
||||
if (fieldHeader.headerOk())
|
||||
const fvMesh& mesh,
|
||||
const IOobject& fieldHeader,
|
||||
const scalar area,
|
||||
const label patchI,
|
||||
bool& done
|
||||
)
|
||||
{
|
||||
mesh.readUpdate();
|
||||
|
||||
const label patchI = mesh.boundaryMesh().findPatchID(patchName);
|
||||
if (patchI < 0)
|
||||
if (!done && fieldHeader.headerClassName() == FieldType::typeName)
|
||||
{
|
||||
FatalError
|
||||
<< "Unable to find patch " << patchName << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
Info<< " Reading " << fieldHeader.headerClassName() << " "
|
||||
<< fieldHeader.name() << endl;
|
||||
|
||||
if (fieldHeader.headerClassName() == "volScalarField")
|
||||
{
|
||||
Info<< " Reading volScalarField " << fieldName << endl;
|
||||
volScalarField field(fieldHeader, mesh);
|
||||
FieldType field(fieldHeader, mesh);
|
||||
|
||||
scalar area = gSum(mesh.magSf().boundaryField()[patchI]);
|
||||
scalar sumField = 0;
|
||||
typename FieldType::value_type sumField =
|
||||
pTraits<typename FieldType::value_type>::zero;
|
||||
|
||||
if (area > 0)
|
||||
{
|
||||
@ -90,14 +62,73 @@ int main(int argc, char *argv[])
|
||||
) / area;
|
||||
}
|
||||
|
||||
Info<< " Average of " << fieldName << " over patch "
|
||||
<< patchName << '[' << patchI << ']' << " = "
|
||||
Info<< " Average of " << fieldHeader.headerClassName()
|
||||
<< " over patch "
|
||||
<< mesh.boundary()[patchI].name()
|
||||
<< '[' << patchI << ']' << " = "
|
||||
<< sumField << endl;
|
||||
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
#include "addRegionOption.H"
|
||||
argList::validArgs.append("fieldName");
|
||||
argList::validArgs.append("patchName");
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
# include "createNamedMesh.H"
|
||||
|
||||
const word fieldName = args[1];
|
||||
const word patchName = args[2];
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
IOobject io
|
||||
(
|
||||
fieldName,
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
// Check field exists
|
||||
if (io.headerOk())
|
||||
{
|
||||
mesh.readUpdate();
|
||||
|
||||
const label patchI = mesh.boundaryMesh().findPatchID(patchName);
|
||||
if (patchI < 0)
|
||||
{
|
||||
FatalError
|
||||
<< "Only possible to average volScalarFields "
|
||||
<< "Unable to find patch " << patchName << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
scalar area = gSum(mesh.magSf().boundaryField()[patchI]);
|
||||
|
||||
bool done = false;
|
||||
printAverage<volScalarField>(mesh, io, area, patchI, done);
|
||||
printAverage<volVectorField>(mesh, io, area, patchI, done);
|
||||
printAverage<volSphericalTensorField>(mesh, io, area, patchI, done);
|
||||
printAverage<volSymmTensorField>(mesh, io, area, patchI, done);
|
||||
printAverage<volTensorField>(mesh, io, area, patchI, done);
|
||||
|
||||
if (!done)
|
||||
{
|
||||
FatalError
|
||||
<< "Only possible to average volFields."
|
||||
<< " Field " << fieldName << " is of type "
|
||||
<< io.headerClassName()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,12 +32,83 @@ Description
|
||||
#include "fvCFD.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class FieldType>
|
||||
void printIntegrate
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const IOobject& fieldHeader,
|
||||
const label patchI,
|
||||
bool& done
|
||||
)
|
||||
{
|
||||
if (!done && fieldHeader.headerClassName() == FieldType::typeName)
|
||||
{
|
||||
Info<< " Reading " << fieldHeader.headerClassName() << " "
|
||||
<< fieldHeader.name() << endl;
|
||||
|
||||
FieldType field(fieldHeader, mesh);
|
||||
|
||||
Info<< " Integral of " << fieldHeader.name()
|
||||
<< " over vector area of patch "
|
||||
<< mesh.boundary()[patchI].name() << '[' << patchI << ']' << " = "
|
||||
<< gSum
|
||||
(
|
||||
mesh.Sf().boundaryField()[patchI]
|
||||
*field.boundaryField()[patchI]
|
||||
)
|
||||
<< nl;
|
||||
|
||||
Info<< " Integral of " << fieldHeader.name()
|
||||
<< " over area magnitude of patch "
|
||||
<< mesh.boundary()[patchI].name() << '[' << patchI << ']' << " = "
|
||||
<< gSum
|
||||
(
|
||||
mesh.magSf().boundaryField()[patchI]
|
||||
*field.boundaryField()[patchI]
|
||||
)
|
||||
<< nl;
|
||||
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class FieldType>
|
||||
void printSum
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const IOobject& fieldHeader,
|
||||
const label patchI,
|
||||
bool& done
|
||||
)
|
||||
{
|
||||
if (!done && fieldHeader.headerClassName() == FieldType::typeName)
|
||||
{
|
||||
Info<< " Reading " << FieldType::typeName << " "
|
||||
<< fieldHeader.name() << endl;
|
||||
|
||||
FieldType field(fieldHeader, mesh);
|
||||
typename FieldType::value_type sumField = gSum
|
||||
(
|
||||
field.boundaryField()[patchI]
|
||||
);
|
||||
|
||||
Info<< " Integral of " << fieldHeader.name() << " over patch "
|
||||
<< mesh.boundary()[patchI].name() << '[' << patchI << ']' << " = "
|
||||
<< sumField << nl;
|
||||
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
# include "addRegionOption.H"
|
||||
timeSelector::addOptions();
|
||||
# include "addRegionOption.H"
|
||||
argList::validArgs.append("fieldName");
|
||||
argList::validArgs.append("patchName");
|
||||
# include "setRootCase.H"
|
||||
@ -83,54 +154,88 @@ int main(int argc, char *argv[])
|
||||
<< gSum(mesh.magSf().boundaryField()[patchI]) << endl;
|
||||
|
||||
// Read field and calc integral
|
||||
if (fieldHeader.headerClassName() == volScalarField::typeName)
|
||||
{
|
||||
Info<< " Reading " << volScalarField::typeName << " "
|
||||
<< fieldName << endl;
|
||||
|
||||
volScalarField field(fieldHeader, mesh);
|
||||
|
||||
Info<< " Integral of " << fieldName
|
||||
<< " over vector area of patch "
|
||||
<< patchName << '[' << patchI << ']' << " = "
|
||||
<< gSum
|
||||
bool done = false;
|
||||
printIntegrate<volScalarField>
|
||||
(
|
||||
mesh.Sf().boundaryField()[patchI]
|
||||
*field.boundaryField()[patchI]
|
||||
)
|
||||
<< nl;
|
||||
|
||||
Info<< " Integral of " << fieldName
|
||||
<< " over area magnitude of patch "
|
||||
<< patchName << '[' << patchI << ']' << " = "
|
||||
<< gSum
|
||||
mesh,
|
||||
fieldHeader,
|
||||
patchI,
|
||||
done
|
||||
);
|
||||
printIntegrate<volVectorField>
|
||||
(
|
||||
mesh.magSf().boundaryField()[patchI]
|
||||
*field.boundaryField()[patchI]
|
||||
)
|
||||
<< nl;
|
||||
}
|
||||
else if
|
||||
mesh,
|
||||
fieldHeader,
|
||||
patchI,
|
||||
done
|
||||
);
|
||||
|
||||
//- No tensor integrations
|
||||
//printIntegrate<volSphericalTensorField>
|
||||
//(
|
||||
// mesh,
|
||||
// fieldHeader,
|
||||
// patchI,
|
||||
// done
|
||||
//);
|
||||
//printIntegrate<volSymmTensorField>
|
||||
//(
|
||||
// mesh,
|
||||
// fieldHeader,
|
||||
// patchI,
|
||||
// done
|
||||
//);
|
||||
//printIntegrate<volTensorField>
|
||||
//(
|
||||
// mesh,
|
||||
// fieldHeader,
|
||||
// patchI,
|
||||
// done
|
||||
//);
|
||||
|
||||
printSum<surfaceScalarField>
|
||||
(
|
||||
fieldHeader.headerClassName() == surfaceScalarField::typeName
|
||||
)
|
||||
{
|
||||
Info<< " Reading " << surfaceScalarField::typeName << " "
|
||||
<< fieldName << endl;
|
||||
mesh,
|
||||
fieldHeader,
|
||||
patchI,
|
||||
done
|
||||
);
|
||||
printSum<surfaceVectorField>
|
||||
(
|
||||
mesh,
|
||||
fieldHeader,
|
||||
patchI,
|
||||
done
|
||||
);
|
||||
printSum<volSphericalTensorField>
|
||||
(
|
||||
mesh,
|
||||
fieldHeader,
|
||||
patchI,
|
||||
done
|
||||
);
|
||||
printSum<volSymmTensorField>
|
||||
(
|
||||
mesh,
|
||||
fieldHeader,
|
||||
patchI,
|
||||
done
|
||||
);
|
||||
printSum<volTensorField>
|
||||
(
|
||||
mesh,
|
||||
fieldHeader,
|
||||
patchI,
|
||||
done
|
||||
);
|
||||
|
||||
surfaceScalarField field(fieldHeader, mesh);
|
||||
scalar sumField = gSum(field.boundaryField()[patchI]);
|
||||
|
||||
Info<< " Integral of " << fieldName << " over patch "
|
||||
<< patchName << '[' << patchI << ']' << " = "
|
||||
<< sumField << nl;
|
||||
}
|
||||
else
|
||||
if (!done)
|
||||
{
|
||||
FatalError
|
||||
<< "Only possible to integrate "
|
||||
<< volScalarField::typeName << "s "
|
||||
<< "and " << surfaceScalarField::typeName << "s"
|
||||
<< "volFields and surfaceFields."
|
||||
<< " Field " << fieldName << " is of type "
|
||||
<< fieldHeader.headerClassName()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,9 +33,10 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "calc.H"
|
||||
#include "basicPsiThermo.H"
|
||||
#include "basicThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
{
|
||||
bool writeResults = !args.optionFound("noWrite");
|
||||
@ -74,9 +75,9 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
)
|
||||
{
|
||||
// thermophysical Mach
|
||||
autoPtr<basicPsiThermo> thermo
|
||||
autoPtr<basicThermo> thermo
|
||||
(
|
||||
basicPsiThermo::New(mesh)
|
||||
basicThermo::New(mesh)
|
||||
);
|
||||
|
||||
volScalarField Cp(thermo->Cp());
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
{
|
||||
volVectorField U(Uheader, mesh);
|
||||
|
||||
autoPtr<basicPsiThermo> thermo
|
||||
autoPtr<basicThermo> thermo
|
||||
(
|
||||
basicPsiThermo::New(mesh)
|
||||
basicThermo::New(mesh)
|
||||
);
|
||||
|
||||
volScalarField Cp = thermo->Cp();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,7 +39,7 @@ Description
|
||||
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
|
||||
#include "incompressible/RAS/RASModel/RASModel.H"
|
||||
#include "incompressible/LES/LESModel/LESModel.H"
|
||||
#include "basicPsiThermo.H"
|
||||
#include "basicThermo.H"
|
||||
#include "compressible/RAS/RASModel/RASModel.H"
|
||||
#include "compressible/LES/LESModel/LESModel.H"
|
||||
|
||||
@ -204,7 +204,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
{
|
||||
IOdictionary RASProperties(RASPropertiesHeader);
|
||||
|
||||
autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
|
||||
autoPtr<basicThermo> thermo(basicThermo::New(mesh));
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
@ -252,7 +252,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
{
|
||||
IOdictionary LESProperties(LESPropertiesHeader);
|
||||
|
||||
autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
|
||||
autoPtr<basicThermo> thermo(basicThermo::New(mesh));
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
solidWallHeatFlux.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/solidWallHeatFlux
|
||||
@ -0,0 +1,12 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lbasicThermophysicalModels \
|
||||
-lbasicSolidThermo \
|
||||
-lspecie \
|
||||
-lfiniteVolume \
|
||||
-lgenericPatchFields
|
||||
@ -0,0 +1,6 @@
|
||||
autoPtr<basicSolidThermo> thermo
|
||||
(
|
||||
basicSolidThermo::New(mesh)
|
||||
);
|
||||
|
||||
volScalarField& T = thermo->T();
|
||||
@ -0,0 +1,102 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
solidWallHeatFlux
|
||||
|
||||
Description
|
||||
Calculates and writes the heat flux for all patches as the boundary field
|
||||
of a volScalarField and also prints the integrated flux for all wall
|
||||
patches.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "wallFvPatch.H"
|
||||
#include "basicSolidThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
# include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
mesh.readUpdate();
|
||||
|
||||
// Read temperature
|
||||
#include "createFields.H"
|
||||
|
||||
// Create heat flux as volScalarField with as boundary values
|
||||
// the heat flux
|
||||
volScalarField wallHeatFlux
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"solidWallHeatFlux",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("solidWallHeatFlux", dimPower/dimArea, 0.0)
|
||||
);
|
||||
|
||||
Info<< "\nWall heat fluxes [W]" << endl;
|
||||
forAll(wallHeatFlux.boundaryField(), patchi)
|
||||
{
|
||||
wallHeatFlux.boundaryField()[patchi] =
|
||||
thermo().K(patchi)
|
||||
*T.boundaryField()[patchi].snGrad();
|
||||
|
||||
if (isA<wallFvPatch>(mesh.boundary()[patchi]))
|
||||
{
|
||||
Info<< mesh.boundary()[patchi].name()
|
||||
<< " "
|
||||
<< gSum
|
||||
(
|
||||
mesh.magSf().boundaryField()[patchi]
|
||||
*wallHeatFlux.boundaryField()[patchi]
|
||||
)
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
wallHeatFlux.write();
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
Info<< "End" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,6 +1,6 @@
|
||||
autoPtr<basicPsiThermo> thermo
|
||||
autoPtr<basicThermo> thermo
|
||||
(
|
||||
basicPsiThermo::New(mesh)
|
||||
basicThermo::New(mesh)
|
||||
);
|
||||
|
||||
const volScalarField& h = thermo->h();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,10 +41,11 @@ Description
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
# include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createMesh.H"
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
@ -69,7 +70,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Info<< mesh.boundary()[patchi].name()
|
||||
<< " "
|
||||
<< sum
|
||||
<< gSum
|
||||
(
|
||||
mesh.magSf().boundaryField()[patchi]
|
||||
*patchHeatFlux[patchi]
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,7 +38,7 @@ Description
|
||||
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
|
||||
#include "incompressible/RAS/RASModel/RASModel.H"
|
||||
|
||||
#include "basicPsiThermo.H"
|
||||
#include "basicThermo.H"
|
||||
#include "compressible/RAS/RASModel/RASModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -101,11 +101,8 @@ void calcCompressible
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
autoPtr<basicPsiThermo> pThermo
|
||||
(
|
||||
basicPsiThermo::New(mesh)
|
||||
);
|
||||
basicPsiThermo& thermo = pThermo();
|
||||
autoPtr<basicThermo> pThermo(basicThermo::New(mesh));
|
||||
basicThermo& thermo = pThermo();
|
||||
|
||||
autoPtr<compressible::RASModel> model
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,7 +39,7 @@ Description
|
||||
#include "incompressible/RAS/RASModel/RASModel.H"
|
||||
#include "nutkWallFunction/nutkWallFunctionFvPatchScalarField.H"
|
||||
|
||||
#include "basicPsiThermo.H"
|
||||
#include "basicThermo.H"
|
||||
#include "compressible/RAS/RASModel/RASModel.H"
|
||||
#include "mutkWallFunction/mutkWallFunctionFvPatchScalarField.H"
|
||||
|
||||
@ -130,11 +130,11 @@ void calcCompressibleYPlus
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
autoPtr<basicPsiThermo> pThermo
|
||||
autoPtr<basicThermo> pThermo
|
||||
(
|
||||
basicPsiThermo::New(mesh)
|
||||
basicThermo::New(mesh)
|
||||
);
|
||||
basicPsiThermo& thermo = pThermo();
|
||||
basicThermo& thermo = pThermo();
|
||||
|
||||
autoPtr<compressible::RASModel> RASModel
|
||||
(
|
||||
|
||||
@ -372,7 +372,7 @@ unsetenv MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN
|
||||
|
||||
switch ("$WM_MPLIB")
|
||||
case OPENMPI:
|
||||
setenv FOAM_MPI openmpi-1.5.3
|
||||
setenv FOAM_MPI openmpi-1.5.4
|
||||
# optional configuration tweaks:
|
||||
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/openmpi.csh`
|
||||
|
||||
|
||||
@ -114,6 +114,16 @@ Linux)
|
||||
export WM_LDFLAGS='-mabi=64 -G0'
|
||||
;;
|
||||
|
||||
armv7l)
|
||||
WM_ARCH=linuxARM7
|
||||
export WM_COMPILER_LIB_ARCH=32
|
||||
export WM_CC='gcc'
|
||||
export WM_CXX='g++'
|
||||
export WM_CFLAGS='-fPIC'
|
||||
export WM_CXXFLAGS='-fPIC'
|
||||
export WM_LDFLAGS=
|
||||
;;
|
||||
|
||||
ppc64)
|
||||
WM_ARCH=linuxPPC64
|
||||
export WM_COMPILER_LIB_ARCH=64
|
||||
@ -393,7 +403,7 @@ unset MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN
|
||||
|
||||
case "$WM_MPLIB" in
|
||||
OPENMPI)
|
||||
export FOAM_MPI=openmpi-1.5.3
|
||||
export FOAM_MPI=openmpi-1.5.4
|
||||
# optional configuration tweaks:
|
||||
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/openmpi.sh`
|
||||
|
||||
|
||||
@ -45,7 +45,9 @@ primitives/Tensor/lists/symmTensorList.C
|
||||
primitives/Tensor/lists/tensorList.C
|
||||
|
||||
primitives/Vector/complexVector/complexVector.C
|
||||
#if !defined(WM_SP)
|
||||
primitives/Vector/floatVector/floatVector.C
|
||||
#endif
|
||||
primitives/Vector/labelVector/labelVector.C
|
||||
primitives/Vector/vector/vector.C
|
||||
primitives/Vector/lists/vectorList.C
|
||||
|
||||
@ -94,23 +94,23 @@ bool Foam::DLListBase::swapUp(DLListBase::link* a)
|
||||
if (ap == first_)
|
||||
{
|
||||
first_ = a;
|
||||
ap->prev_ = a;
|
||||
}
|
||||
else
|
||||
{
|
||||
ap->prev_->next_ = a;
|
||||
}
|
||||
|
||||
if (a == last_)
|
||||
{
|
||||
last_ = ap;
|
||||
a->next_ = ap;
|
||||
}
|
||||
|
||||
if (a->next_)
|
||||
else
|
||||
{
|
||||
a->next_->prev_ = ap;
|
||||
}
|
||||
|
||||
if (ap->prev_)
|
||||
{
|
||||
ap->prev_->next_ = a;
|
||||
}
|
||||
|
||||
a->prev_ = ap->prev_;
|
||||
ap->prev_ = a;
|
||||
|
||||
@ -135,19 +135,19 @@ bool Foam::DLListBase::swapDown(DLListBase::link* a)
|
||||
if (a == first_)
|
||||
{
|
||||
first_ = an;
|
||||
a->prev_ = an;
|
||||
}
|
||||
else
|
||||
{
|
||||
a->prev_->next_ = an;
|
||||
}
|
||||
|
||||
if (an == last_)
|
||||
{
|
||||
last_ = a;
|
||||
an->next_ = a;
|
||||
}
|
||||
|
||||
if (a->prev_)
|
||||
{
|
||||
a->prev_->next_ = an;
|
||||
}
|
||||
|
||||
if (an->next_)
|
||||
else
|
||||
{
|
||||
an->next_->prev_ = a;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -254,5 +254,11 @@ Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType
|
||||
commsTypeNames.read(debug::optimisationSwitches().lookup("commsType"))
|
||||
);
|
||||
|
||||
// Number of polling cycles in processor updates
|
||||
int Foam::UPstream::nPollProcInterfaces
|
||||
(
|
||||
debug::optimisationSwitch("nPollProcInterfaces", 0)
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -242,6 +242,8 @@ public:
|
||||
//- Default commsType
|
||||
static commsTypes defaultCommsType;
|
||||
|
||||
//- Number of polling cycles in processor updates
|
||||
static int nPollProcInterfaces;
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -273,6 +275,9 @@ public:
|
||||
//- Wait until all requests (from start onwards) have finished.
|
||||
static void waitRequests(const label start = 0);
|
||||
|
||||
//- Wait until request i has finished.
|
||||
static void waitRequest(const label i);
|
||||
|
||||
//- Non-blocking comms: has request i finished?
|
||||
static bool finishedRequest(const label i);
|
||||
|
||||
|
||||
@ -203,11 +203,16 @@ void Foam::Time::setControls()
|
||||
)
|
||||
);
|
||||
|
||||
// Read and set the deltaT only if time-step adjustment is active
|
||||
// otherwise use the deltaT from the controlDict
|
||||
if (controlDict_.lookupOrDefault<Switch>("adjustTimeStep", false))
|
||||
{
|
||||
if (timeDict.readIfPresent("deltaT", deltaT_))
|
||||
{
|
||||
deltaTSave_ = deltaT_;
|
||||
deltaT0_ = deltaT_;
|
||||
}
|
||||
}
|
||||
|
||||
timeDict.readIfPresent("deltaT0", deltaT0_);
|
||||
|
||||
@ -984,6 +989,17 @@ Foam::Time& Foam::Time::operator++()
|
||||
<< " to " << precision_
|
||||
<< " to distinguish between timeNames at time " << value()
|
||||
<< endl;
|
||||
|
||||
if (precision_ == 100 && precision_ != oldPrecision)
|
||||
{
|
||||
// Reached limit.
|
||||
WarningIn("Time::operator++()")
|
||||
<< "Current time name " << dimensionedScalar::name()
|
||||
<< " is the old as the previous one " << oldTimeName
|
||||
<< endl
|
||||
<< " This might result in overwriting old results."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -775,7 +775,8 @@ Foam::argList::argList
|
||||
<< " floatTransfer : " << Pstream::floatTransfer << nl
|
||||
<< " nProcsSimpleSum : " << Pstream::nProcsSimpleSum << nl
|
||||
<< " commsType : "
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType] << nl
|
||||
<< " polling iterations : " << Pstream::nPollProcInterfaces
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -60,6 +60,10 @@ class lduInterfaceField
|
||||
//- Reference to the coupled patch this field is defined for
|
||||
const lduInterface& interface_;
|
||||
|
||||
//- Update index used so that updateInterfaceMatrix is called only once
|
||||
// during the construction of the matrix
|
||||
bool updatedMatrix_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -69,7 +73,6 @@ class lduInterfaceField
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const lduInterfaceField&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -81,7 +84,8 @@ public:
|
||||
//- Construct given coupled patch
|
||||
lduInterfaceField(const lduInterface& patch)
|
||||
:
|
||||
interface_(patch)
|
||||
interface_(patch),
|
||||
updatedMatrix_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -120,6 +124,24 @@ public:
|
||||
) const
|
||||
{}
|
||||
|
||||
//- Whether matrix has been updated
|
||||
bool updatedMatrix() const
|
||||
{
|
||||
return updatedMatrix_;
|
||||
}
|
||||
|
||||
//- Whether matrix has been updated
|
||||
bool& updatedMatrix()
|
||||
{
|
||||
return updatedMatrix_;
|
||||
}
|
||||
|
||||
//- Is all data available
|
||||
virtual bool ready() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Update result field based on interface functionality
|
||||
virtual void updateInterfaceMatrix
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -205,7 +205,15 @@ void Foam::lduMatrix::operator+=(const lduMatrix& A)
|
||||
if (debug > 1)
|
||||
{
|
||||
WarningIn("lduMatrix::operator+=(const lduMatrix& A)")
|
||||
<< "Unknown matrix type combination"
|
||||
<< "Unknown matrix type combination" << nl
|
||||
<< " this :"
|
||||
<< " diagonal:" << diagonal()
|
||||
<< " symmetric:" << symmetric()
|
||||
<< " asymmetric:" << asymmetric() << nl
|
||||
<< " A :"
|
||||
<< " diagonal:" << A.diagonal()
|
||||
<< " symmetric:" << A.symmetric()
|
||||
<< " asymmetric:" << A.asymmetric()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -276,7 +284,15 @@ void Foam::lduMatrix::operator-=(const lduMatrix& A)
|
||||
if (debug > 1)
|
||||
{
|
||||
WarningIn("lduMatrix::operator-=(const lduMatrix& A)")
|
||||
<< "Unknown matrix type combination"
|
||||
<< "Unknown matrix type combination" << nl
|
||||
<< " this :"
|
||||
<< " diagonal:" << diagonal()
|
||||
<< " symmetric:" << symmetric()
|
||||
<< " asymmetric:" << asymmetric() << nl
|
||||
<< " A :"
|
||||
<< " diagonal:" << A.diagonal()
|
||||
<< " symmetric:" << A.symmetric()
|
||||
<< " asymmetric:" << A.asymmetric()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -87,7 +87,7 @@ void Foam::lduMatrix::initMatrixInterfaces
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("lduMatrix::initMatrixInterfaces")
|
||||
FatalErrorIn("lduMatrix::initMatrixInterfaces(..)")
|
||||
<< "Unsuported communications type "
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
|
||||
<< exit(FatalError);
|
||||
@ -104,25 +104,92 @@ void Foam::lduMatrix::updateMatrixInterfaces
|
||||
const direction cmpt
|
||||
) const
|
||||
{
|
||||
if
|
||||
(
|
||||
Pstream::defaultCommsType == Pstream::blocking
|
||||
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
||||
)
|
||||
if (Pstream::defaultCommsType == Pstream::blocking)
|
||||
{
|
||||
// Block until all sends/receives have been finished
|
||||
if
|
||||
(
|
||||
Pstream::parRun()
|
||||
&& Pstream::defaultCommsType == Pstream::nonBlocking
|
||||
)
|
||||
forAll(interfaces, interfaceI)
|
||||
{
|
||||
UPstream::waitRequests();
|
||||
if (interfaces.set(interfaceI))
|
||||
{
|
||||
interfaces[interfaceI].updateInterfaceMatrix
|
||||
(
|
||||
psiif,
|
||||
result,
|
||||
*this,
|
||||
coupleCoeffs[interfaceI],
|
||||
cmpt,
|
||||
Pstream::defaultCommsType
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
// Try and consume interfaces as they become available
|
||||
bool allUpdated = false;
|
||||
|
||||
for (label i = 0; i < UPstream::nPollProcInterfaces; i++)
|
||||
{
|
||||
allUpdated = true;
|
||||
|
||||
forAll(interfaces, interfaceI)
|
||||
{
|
||||
if (interfaces.set(interfaceI))
|
||||
{
|
||||
if (!interfaces[interfaceI].updatedMatrix())
|
||||
{
|
||||
if (interfaces[interfaceI].ready())
|
||||
{
|
||||
interfaces[interfaceI].updateInterfaceMatrix
|
||||
(
|
||||
psiif,
|
||||
result,
|
||||
*this,
|
||||
coupleCoeffs[interfaceI],
|
||||
cmpt,
|
||||
Pstream::defaultCommsType
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
allUpdated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allUpdated)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Block for everything
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (allUpdated)
|
||||
{
|
||||
// All received. Just remove all storage of requests
|
||||
// Note that we don't know what starting number of requests
|
||||
// was before start of sends and receives (since set from
|
||||
// initMatrixInterfaces) so set to 0 and loose any in-flight
|
||||
// requests.
|
||||
UPstream::resetRequests(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Block for all requests and remove storage
|
||||
UPstream::waitRequests();
|
||||
}
|
||||
}
|
||||
|
||||
// Consume
|
||||
forAll(interfaces, interfaceI)
|
||||
{
|
||||
if
|
||||
(
|
||||
interfaces.set(interfaceI)
|
||||
&& !interfaces[interfaceI].updatedMatrix()
|
||||
)
|
||||
{
|
||||
interfaces[interfaceI].updateInterfaceMatrix
|
||||
(
|
||||
@ -199,7 +266,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("lduMatrix::updateMatrixInterfaces")
|
||||
FatalErrorIn("lduMatrix::updateMatrixInterfaces(..)")
|
||||
<< "Unsuported communications type "
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
|
||||
<< exit(FatalError);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -80,11 +80,38 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
|
||||
const Pstream::commsTypes commsType
|
||||
) const
|
||||
{
|
||||
procInterface_.compressedSend
|
||||
procInterface_.interfaceInternalField(psiInternal, scalarSendBuf_);
|
||||
|
||||
if (commsType == Pstream::nonBlocking && !Pstream::floatTransfer)
|
||||
{
|
||||
// Fast path.
|
||||
scalarReceiveBuf_.setSize(scalarSendBuf_.size());
|
||||
outstandingRecvRequest_ = UPstream::nRequests();
|
||||
IPstream::read
|
||||
(
|
||||
commsType,
|
||||
procInterface_.interfaceInternalField(psiInternal)()
|
||||
Pstream::nonBlocking,
|
||||
procInterface_.neighbProcNo(),
|
||||
reinterpret_cast<char*>(scalarReceiveBuf_.begin()),
|
||||
scalarReceiveBuf_.byteSize(),
|
||||
procInterface_.tag()
|
||||
);
|
||||
|
||||
outstandingSendRequest_ = UPstream::nRequests();
|
||||
OPstream::write
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
procInterface_.neighbProcNo(),
|
||||
reinterpret_cast<const char*>(scalarSendBuf_.begin()),
|
||||
scalarSendBuf_.byteSize(),
|
||||
procInterface_.tag()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
procInterface_.compressedSend(commsType, scalarSendBuf_);
|
||||
}
|
||||
|
||||
const_cast<processorGAMGInterfaceField&>(*this).updatedMatrix() = false;
|
||||
}
|
||||
|
||||
|
||||
@ -97,6 +124,41 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
|
||||
const direction cmpt,
|
||||
const Pstream::commsTypes commsType
|
||||
) const
|
||||
{
|
||||
if (updatedMatrix())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const labelUList& faceCells = procInterface_.faceCells();
|
||||
|
||||
if (commsType == Pstream::nonBlocking && !Pstream::floatTransfer)
|
||||
{
|
||||
// Fast path.
|
||||
if
|
||||
(
|
||||
outstandingRecvRequest_ >= 0
|
||||
&& outstandingRecvRequest_ < Pstream::nRequests()
|
||||
)
|
||||
{
|
||||
UPstream::waitRequest(outstandingRecvRequest_);
|
||||
}
|
||||
// Recv finished so assume sending finished as well.
|
||||
outstandingSendRequest_ = -1;
|
||||
outstandingRecvRequest_ = -1;
|
||||
|
||||
// Consume straight from scalarReceiveBuf_
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
transformCoupleField(scalarReceiveBuf_, cmpt);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] -= coeffs[elemI]*scalarReceiveBuf_[elemI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
scalarField pnf
|
||||
(
|
||||
@ -104,13 +166,14 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
|
||||
);
|
||||
transformCoupleField(pnf, cmpt);
|
||||
|
||||
const labelUList& faceCells = procInterface_.faceCells();
|
||||
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
|
||||
}
|
||||
}
|
||||
|
||||
const_cast<processorGAMGInterfaceField&>(*this).updatedMatrix() = true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -65,6 +65,22 @@ class processorGAMGInterfaceField
|
||||
int rank_;
|
||||
|
||||
|
||||
// Sending and receiving
|
||||
|
||||
//- Outstanding request
|
||||
mutable label outstandingSendRequest_;
|
||||
|
||||
//- Outstanding request
|
||||
mutable label outstandingRecvRequest_;
|
||||
|
||||
//- Scalar send buffer
|
||||
mutable Field<scalar> scalarSendBuf_;
|
||||
|
||||
//- Scalar receive buffer
|
||||
mutable Field<scalar> scalarReceiveBuf_;
|
||||
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -188,6 +188,14 @@ public:
|
||||
const UList<Type>& internalData
|
||||
) const;
|
||||
|
||||
//- Get the interface internal field of the given field
|
||||
template<class Type>
|
||||
void interfaceInternalField
|
||||
(
|
||||
const UList<Type>& internalData,
|
||||
List<Type>&
|
||||
) const;
|
||||
|
||||
//- Return the values of the given internal data adjacent to
|
||||
// the interface as a field
|
||||
virtual tmp<labelField> interfaceInternalField
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,14 +34,24 @@ Foam::tmp<Foam::Field<Type> > Foam::GAMGInterface::interfaceInternalField
|
||||
) const
|
||||
{
|
||||
tmp<Field<Type> > tresult(new Field<Type>(size()));
|
||||
Field<Type>& result = tresult();
|
||||
interfaceInternalField(iF, tresult());
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::GAMGInterface::interfaceInternalField
|
||||
(
|
||||
const UList<Type>& iF,
|
||||
List<Type>& result
|
||||
) const
|
||||
{
|
||||
result.setSize(size());
|
||||
|
||||
forAll(result, elemI)
|
||||
{
|
||||
result[elemI] = iF[faceCells_[elemI]];
|
||||
}
|
||||
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
#include "triFace.H"
|
||||
#include "edge.H"
|
||||
#include "pointField.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "tetrahedron.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,7 +42,7 @@ SourceFiles
|
||||
#include "polyMesh.H"
|
||||
#include "coupledPolyPatch.H"
|
||||
#include "syncTools.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "tetrahedron.H"
|
||||
#include "tetIndices.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,7 +38,7 @@ SourceFiles
|
||||
#define tetIndices_H
|
||||
|
||||
#include "label.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "tetrahedron.H"
|
||||
#include "triPointRef.H"
|
||||
#include "polyMesh.H"
|
||||
#include "triFace.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -419,6 +419,8 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
|
||||
<< gAverage(half1Ctrs) << endl;
|
||||
}
|
||||
|
||||
if (half0Ctrs.size())
|
||||
{
|
||||
switch (transform_)
|
||||
{
|
||||
case ROTATIONAL:
|
||||
@ -557,7 +559,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Calculate typical distance per face
|
||||
tols = matchTolerance()*calcFaceTol(pp1, pp1.points(), half1Ctrs);
|
||||
@ -1270,7 +1272,7 @@ bool Foam::cyclicPolyPatch::order
|
||||
rotation.setSize(pp.size());
|
||||
rotation = 0;
|
||||
|
||||
if (pp.empty() || transform_ == NOORDERING)
|
||||
if (transform_ == NOORDERING)
|
||||
{
|
||||
// No faces, nothing to change.
|
||||
return false;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,7 @@ License
|
||||
|
||||
#include "primitiveMesh.H"
|
||||
#include "pyramidPointFaceRef.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "tetrahedron.H"
|
||||
#include "ListOps.H"
|
||||
#include "unitConversion.H"
|
||||
#include "SortableList.H"
|
||||
|
||||
@ -35,9 +35,9 @@ SourceFiles
|
||||
#ifndef tetPoints_H
|
||||
#define tetPoints_H
|
||||
|
||||
#include "tetrahedron.H"
|
||||
#include "FixedList.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "tetPointRef.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -54,6 +54,8 @@ namespace Foam
|
||||
|
||||
class Istream;
|
||||
class Ostream;
|
||||
class tetPoints;
|
||||
class plane;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
@ -73,6 +75,7 @@ inline Ostream& operator<<
|
||||
const tetrahedron<Point, PointRef>&
|
||||
);
|
||||
|
||||
typedef tetrahedron<point, const point&> tetPointRef;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
class tetrahedron Declaration
|
||||
@ -81,10 +84,71 @@ inline Ostream& operator<<
|
||||
template<class Point, class PointRef>
|
||||
class tetrahedron
|
||||
{
|
||||
public:
|
||||
|
||||
// Classes for use in sliceWithPlane. What to do with decomposition
|
||||
// of tet.
|
||||
|
||||
//- Dummy
|
||||
class dummyOp
|
||||
{
|
||||
public:
|
||||
inline void operator()(const tetPoints&);
|
||||
};
|
||||
|
||||
//- Sum resulting volumes
|
||||
class sumVolOp
|
||||
{
|
||||
public:
|
||||
scalar vol_;
|
||||
|
||||
inline sumVolOp();
|
||||
|
||||
inline void operator()(const tetPoints&);
|
||||
};
|
||||
|
||||
//- Store resulting tets
|
||||
class storeOp
|
||||
{
|
||||
FixedList<tetPoints, 200>& tets_;
|
||||
label& nTets_;
|
||||
|
||||
public:
|
||||
inline storeOp(FixedList<tetPoints, 200>&, label&);
|
||||
|
||||
inline void operator()(const tetPoints&);
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
PointRef a_, b_, c_, d_;
|
||||
|
||||
inline static point planeIntersection
|
||||
(
|
||||
const FixedList<scalar, 4>&,
|
||||
const tetPoints&,
|
||||
const label,
|
||||
const label
|
||||
);
|
||||
|
||||
template<class TetOp>
|
||||
inline static void decomposePrism
|
||||
(
|
||||
const FixedList<point, 6>& points,
|
||||
TetOp& op
|
||||
);
|
||||
|
||||
template<class AboveTetOp, class BelowTetOp>
|
||||
inline static void tetSliceWithPlane
|
||||
(
|
||||
const plane& pl,
|
||||
const tetPoints& tet,
|
||||
AboveTetOp& aboveOp,
|
||||
BelowTetOp& belowOp
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -184,6 +248,16 @@ public:
|
||||
//- Return true if point is inside tetrahedron
|
||||
inline bool inside(const point& pt) const;
|
||||
|
||||
//- Decompose tet into tets above and below plane
|
||||
template<class AboveTetOp, class BelowTetOp>
|
||||
inline void sliceWithPlane
|
||||
(
|
||||
const plane& pl,
|
||||
AboveTetOp& aboveOp,
|
||||
BelowTetOp& belowOp
|
||||
) const;
|
||||
|
||||
|
||||
//- Return (min)containment sphere, i.e. the smallest sphere with
|
||||
// all points inside. Returns pointHit with:
|
||||
// - hit : if sphere is equal to circumsphere
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,8 @@ License
|
||||
|
||||
#include "triangle.H"
|
||||
#include "IOstreams.H"
|
||||
#include "triPointRef.H"
|
||||
#include "tetPoints.H"
|
||||
#include "plane.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -492,6 +493,483 @@ bool Foam::tetrahedron<Point, PointRef>::inside(const point& pt) const
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline void Foam::tetrahedron<Point, PointRef>::dummyOp::operator()
|
||||
(
|
||||
const tetPoints&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::tetrahedron<Point, PointRef>::sumVolOp::sumVolOp()
|
||||
:
|
||||
vol_(0.0)
|
||||
{}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline void Foam::tetrahedron<Point, PointRef>::sumVolOp::operator()
|
||||
(
|
||||
const tetPoints& tet
|
||||
)
|
||||
{
|
||||
vol_ += tet.tet().mag();
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::tetrahedron<Point, PointRef>::storeOp::storeOp
|
||||
(
|
||||
FixedList<tetPoints, 200>& tets,
|
||||
label& nTets
|
||||
)
|
||||
:
|
||||
tets_(tets),
|
||||
nTets_(nTets)
|
||||
{}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline void Foam::tetrahedron<Point, PointRef>::storeOp::operator()
|
||||
(
|
||||
const tetPoints& tet
|
||||
)
|
||||
{
|
||||
tets_[nTets_++] = tet;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::point Foam::tetrahedron<Point, PointRef>::planeIntersection
|
||||
(
|
||||
const FixedList<scalar, 4>& d,
|
||||
const tetPoints& t,
|
||||
const label negI,
|
||||
const label posI
|
||||
)
|
||||
{
|
||||
return
|
||||
(d[posI]*t[negI] - d[negI]*t[posI])
|
||||
/ (-d[negI]+d[posI]);
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
template<class TetOp>
|
||||
inline void Foam::tetrahedron<Point, PointRef>::decomposePrism
|
||||
(
|
||||
const FixedList<point, 6>& points,
|
||||
TetOp& op
|
||||
)
|
||||
{
|
||||
op(tetPoints(points[1], points[3], points[2], points[0]));
|
||||
op(tetPoints(points[1], points[2], points[3], points[4]));
|
||||
op(tetPoints(points[4], points[2], points[3], points[5]));
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
template<class AboveTetOp, class BelowTetOp>
|
||||
inline void Foam::tetrahedron<Point, PointRef>::
|
||||
tetSliceWithPlane
|
||||
(
|
||||
const plane& pl,
|
||||
const tetPoints& tet,
|
||||
AboveTetOp& aboveOp,
|
||||
BelowTetOp& belowOp
|
||||
)
|
||||
{
|
||||
// Distance to plane
|
||||
FixedList<scalar, 4> d;
|
||||
label nPos = 0;
|
||||
forAll(tet, i)
|
||||
{
|
||||
d[i] = ((tet[i]-pl.refPoint()) & pl.normal());
|
||||
if (d[i] > 0)
|
||||
{
|
||||
nPos++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nPos == 4)
|
||||
{
|
||||
aboveOp(tet);
|
||||
}
|
||||
else if (nPos == 3)
|
||||
{
|
||||
// Sliced into below tet and above prism. Prism gets split into
|
||||
// two tets.
|
||||
|
||||
// Find the below tet
|
||||
label i0 = -1;
|
||||
forAll(d, i)
|
||||
{
|
||||
if (d[i] <= 0)
|
||||
{
|
||||
i0 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
label i1 = d.fcIndex(i0);
|
||||
label i2 = d.fcIndex(i1);
|
||||
label i3 = d.fcIndex(i2);
|
||||
|
||||
point p01 = planeIntersection(d, tet, i0, i1);
|
||||
point p02 = planeIntersection(d, tet, i0, i2);
|
||||
point p03 = planeIntersection(d, tet, i0, i3);
|
||||
|
||||
// i0 = tetCell vertex 0: p01,p02,p03 outwards pointing triad
|
||||
// ,, 1 : ,, inwards pointing triad
|
||||
// ,, 2 : ,, outwards pointing triad
|
||||
// ,, 3 : ,, inwards pointing triad
|
||||
|
||||
//Pout<< "Split 3pos tet " << tet << " d:" << d << " into" << nl;
|
||||
|
||||
if (i0 == 0 || i0 == 2)
|
||||
{
|
||||
tetPoints t(tet[i0], p01, p02, p03);
|
||||
//Pout<< " belowtet:" << t << " around i0:" << i0 << endl;
|
||||
//checkTet(t, "nPos 3, belowTet i0==0 or 2");
|
||||
belowOp(t);
|
||||
|
||||
// Prism
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[i1];
|
||||
p[1] = tet[i3];
|
||||
p[2] = tet[i2];
|
||||
p[3] = p01;
|
||||
p[4] = p03;
|
||||
p[5] = p02;
|
||||
//Pout<< " aboveprism:" << p << endl;
|
||||
decomposePrism(p, aboveOp);
|
||||
}
|
||||
else
|
||||
{
|
||||
tetPoints t(p01, p02, p03, tet[i0]);
|
||||
//Pout<< " belowtet:" << t << " around i0:" << i0 << endl;
|
||||
//checkTet(t, "nPos 3, belowTet i0==1 or 3");
|
||||
belowOp(t);
|
||||
|
||||
// Prism
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[i3];
|
||||
p[1] = tet[i1];
|
||||
p[2] = tet[i2];
|
||||
p[3] = p03;
|
||||
p[4] = p01;
|
||||
p[5] = p02;
|
||||
//Pout<< " aboveprism:" << p << endl;
|
||||
decomposePrism(p, aboveOp);
|
||||
}
|
||||
}
|
||||
else if (nPos == 2)
|
||||
{
|
||||
// Tet cut into two prisms. Determine the positive one.
|
||||
label pos0 = -1;
|
||||
label pos1 = -1;
|
||||
label neg0 = -1;
|
||||
label neg1 = -1;
|
||||
forAll(d, i)
|
||||
{
|
||||
if (d[i] > 0)
|
||||
{
|
||||
if (pos0 == -1)
|
||||
{
|
||||
pos0 = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos1 = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (neg0 == -1)
|
||||
{
|
||||
neg0 = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
neg1 = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Pout<< "Split 2pos tet " << tet << " d:" << d
|
||||
// << " around pos0:" << pos0 << " pos1:" << pos1
|
||||
// << " neg0:" << neg0 << " neg1:" << neg1 << " into" << nl;
|
||||
|
||||
const edge posEdge(pos0, pos1);
|
||||
|
||||
if (posEdge == edge(0, 1))
|
||||
{
|
||||
point p02 = planeIntersection(d, tet, 0, 2);
|
||||
point p03 = planeIntersection(d, tet, 0, 3);
|
||||
point p12 = planeIntersection(d, tet, 1, 2);
|
||||
point p13 = planeIntersection(d, tet, 1, 3);
|
||||
// Split the resulting prism
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[0];
|
||||
p[1] = p02;
|
||||
p[2] = p03;
|
||||
p[3] = tet[1];
|
||||
p[4] = p12;
|
||||
p[5] = p13;
|
||||
//Pout<< " 01 aboveprism:" << p << endl;
|
||||
decomposePrism(p, aboveOp);
|
||||
}
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[2];
|
||||
p[1] = p02;
|
||||
p[2] = p12;
|
||||
p[3] = tet[3];
|
||||
p[4] = p03;
|
||||
p[5] = p13;
|
||||
//Pout<< " 01 belowprism:" << p << endl;
|
||||
decomposePrism(p, belowOp);
|
||||
}
|
||||
}
|
||||
else if (posEdge == edge(1, 2))
|
||||
{
|
||||
point p01 = planeIntersection(d, tet, 0, 1);
|
||||
point p13 = planeIntersection(d, tet, 1, 3);
|
||||
point p02 = planeIntersection(d, tet, 0, 2);
|
||||
point p23 = planeIntersection(d, tet, 2, 3);
|
||||
// Split the resulting prism
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[1];
|
||||
p[1] = p01;
|
||||
p[2] = p13;
|
||||
p[3] = tet[2];
|
||||
p[4] = p02;
|
||||
p[5] = p23;
|
||||
//Pout<< " 12 aboveprism:" << p << endl;
|
||||
decomposePrism(p, aboveOp);
|
||||
}
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[3];
|
||||
p[1] = p23;
|
||||
p[2] = p13;
|
||||
p[3] = tet[0];
|
||||
p[4] = p02;
|
||||
p[5] = p01;
|
||||
//Pout<< " 12 belowprism:" << p << endl;
|
||||
decomposePrism(p, belowOp);
|
||||
}
|
||||
}
|
||||
else if (posEdge == edge(2, 0))
|
||||
{
|
||||
point p01 = planeIntersection(d, tet, 0, 1);
|
||||
point p03 = planeIntersection(d, tet, 0, 3);
|
||||
point p12 = planeIntersection(d, tet, 1, 2);
|
||||
point p23 = planeIntersection(d, tet, 2, 3);
|
||||
// Split the resulting prism
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[2];
|
||||
p[1] = p12;
|
||||
p[2] = p23;
|
||||
p[3] = tet[0];
|
||||
p[4] = p01;
|
||||
p[5] = p03;
|
||||
//Pout<< " 20 aboveprism:" << p << endl;
|
||||
decomposePrism(p, aboveOp);
|
||||
}
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[1];
|
||||
p[1] = p12;
|
||||
p[2] = p01;
|
||||
p[3] = tet[3];
|
||||
p[4] = p23;
|
||||
p[5] = p03;
|
||||
//Pout<< " 20 belowprism:" << p << endl;
|
||||
decomposePrism(p, belowOp);
|
||||
}
|
||||
}
|
||||
else if (posEdge == edge(0, 3))
|
||||
{
|
||||
point p01 = planeIntersection(d, tet, 0, 1);
|
||||
point p02 = planeIntersection(d, tet, 0, 2);
|
||||
point p13 = planeIntersection(d, tet, 1, 3);
|
||||
point p23 = planeIntersection(d, tet, 2, 3);
|
||||
// Split the resulting prism
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[3];
|
||||
p[1] = p23;
|
||||
p[2] = p13;
|
||||
p[3] = tet[0];
|
||||
p[4] = p02;
|
||||
p[5] = p01;
|
||||
//Pout<< " 03 aboveprism:" << p << endl;
|
||||
decomposePrism(p, aboveOp);
|
||||
}
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[2];
|
||||
p[1] = p23;
|
||||
p[2] = p02;
|
||||
p[3] = tet[1];
|
||||
p[4] = p13;
|
||||
p[5] = p01;
|
||||
//Pout<< " 03 belowprism:" << p << endl;
|
||||
decomposePrism(p, belowOp);
|
||||
}
|
||||
}
|
||||
else if (posEdge == edge(1, 3))
|
||||
{
|
||||
point p01 = planeIntersection(d, tet, 0, 1);
|
||||
point p12 = planeIntersection(d, tet, 1, 2);
|
||||
point p03 = planeIntersection(d, tet, 0, 3);
|
||||
point p23 = planeIntersection(d, tet, 2, 3);
|
||||
// Split the resulting prism
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[1];
|
||||
p[1] = p12;
|
||||
p[2] = p01;
|
||||
p[3] = tet[3];
|
||||
p[4] = p23;
|
||||
p[5] = p03;
|
||||
//Pout<< " 13 aboveprism:" << p << endl;
|
||||
decomposePrism(p, aboveOp);
|
||||
}
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[2];
|
||||
p[1] = p12;
|
||||
p[2] = p23;
|
||||
p[3] = tet[0];
|
||||
p[4] = p01;
|
||||
p[5] = p03;
|
||||
//Pout<< " 13 belowprism:" << p << endl;
|
||||
decomposePrism(p, belowOp);
|
||||
}
|
||||
}
|
||||
else if (posEdge == edge(2, 3))
|
||||
{
|
||||
point p02 = planeIntersection(d, tet, 0, 2);
|
||||
point p12 = planeIntersection(d, tet, 1, 2);
|
||||
point p03 = planeIntersection(d, tet, 0, 3);
|
||||
point p13 = planeIntersection(d, tet, 1, 3);
|
||||
// Split the resulting prism
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[2];
|
||||
p[1] = p02;
|
||||
p[2] = p12;
|
||||
p[3] = tet[3];
|
||||
p[4] = p03;
|
||||
p[5] = p13;
|
||||
//Pout<< " 23 aboveprism:" << p << endl;
|
||||
decomposePrism(p, aboveOp);
|
||||
}
|
||||
{
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[0];
|
||||
p[1] = p02;
|
||||
p[2] = p03;
|
||||
p[3] = tet[1];
|
||||
p[4] = p12;
|
||||
p[5] = p13;
|
||||
//Pout<< " 23 belowprism:" << p << endl;
|
||||
decomposePrism(p, belowOp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("tetSliceWithPlane(..)")
|
||||
<< "Missed edge:" << posEdge
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
else if (nPos == 1)
|
||||
{
|
||||
// Find the positive tet
|
||||
label i0 = -1;
|
||||
forAll(d, i)
|
||||
{
|
||||
if (d[i] > 0)
|
||||
{
|
||||
i0 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
label i1 = d.fcIndex(i0);
|
||||
label i2 = d.fcIndex(i1);
|
||||
label i3 = d.fcIndex(i2);
|
||||
|
||||
point p01 = planeIntersection(d, tet, i0, i1);
|
||||
point p02 = planeIntersection(d, tet, i0, i2);
|
||||
point p03 = planeIntersection(d, tet, i0, i3);
|
||||
|
||||
//Pout<< "Split 1pos tet " << tet << " d:" << d << " into" << nl;
|
||||
|
||||
if (i0 == 0 || i0 == 2)
|
||||
{
|
||||
tetPoints t(tet[i0], p01, p02, p03);
|
||||
//Pout<< " abovetet:" << t << " around i0:" << i0 << endl;
|
||||
//checkTet(t, "nPos 1, aboveTets i0==0 or 2");
|
||||
aboveOp(t);
|
||||
|
||||
// Prism
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[i1];
|
||||
p[1] = tet[i3];
|
||||
p[2] = tet[i2];
|
||||
p[3] = p01;
|
||||
p[4] = p03;
|
||||
p[5] = p02;
|
||||
//Pout<< " belowprism:" << p << endl;
|
||||
decomposePrism(p, belowOp);
|
||||
}
|
||||
else
|
||||
{
|
||||
tetPoints t(p01, p02, p03, tet[i0]);
|
||||
//Pout<< " abovetet:" << t << " around i0:" << i0 << endl;
|
||||
//checkTet(t, "nPos 1, aboveTets i0==1 or 3");
|
||||
aboveOp(t);
|
||||
|
||||
// Prism
|
||||
FixedList<point, 6> p;
|
||||
p[0] = tet[i3];
|
||||
p[1] = tet[i1];
|
||||
p[2] = tet[i2];
|
||||
p[3] = p03;
|
||||
p[4] = p01;
|
||||
p[5] = p02;
|
||||
//Pout<< " belowprism:" << p << endl;
|
||||
decomposePrism(p, belowOp);
|
||||
}
|
||||
}
|
||||
else // nPos == 0
|
||||
{
|
||||
belowOp(tet);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
template<class AboveTetOp, class BelowTetOp>
|
||||
inline void Foam::tetrahedron<Point, PointRef>::sliceWithPlane
|
||||
(
|
||||
const plane& pl,
|
||||
AboveTetOp& aboveOp,
|
||||
BelowTetOp& belowOp
|
||||
) const
|
||||
{
|
||||
tetSliceWithPlane(pl, tetPoints(a_, b_, c_, d_), aboveOp, belowOp);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class Point, class PointRef>
|
||||
|
||||
@ -47,11 +47,11 @@ namespace Foam
|
||||
|
||||
typedef Vector<float> floatVector;
|
||||
|
||||
|
||||
//- Data associated with floatVector type are contiguous
|
||||
#if !defined(WM_SP)
|
||||
template<>
|
||||
inline bool contiguous<floatVector>() {return true;}
|
||||
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -74,6 +74,10 @@ void Foam::UPstream::waitRequests(const label start)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::UPstream::waitRequest(const label i)
|
||||
{}
|
||||
|
||||
|
||||
bool Foam::UPstream::finishedRequest(const label i)
|
||||
{
|
||||
notImplemented("UPstream::finishedRequest()");
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -516,11 +516,55 @@ void Foam::UPstream::waitRequests(const label start)
|
||||
}
|
||||
|
||||
|
||||
void Foam::UPstream::waitRequest(const label i)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "UPstream::waitRequest : starting wait for request:" << i
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (i >= PstreamGlobals::outstandingRequests_.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"UPstream::waitRequest(const label)"
|
||||
) << "There are " << PstreamGlobals::outstandingRequests_.size()
|
||||
<< " outstanding send requests and you are asking for i=" << i
|
||||
<< nl
|
||||
<< "Maybe you are mixing blocking/non-blocking comms?"
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
int flag;
|
||||
if
|
||||
(
|
||||
MPI_Wait
|
||||
(
|
||||
&PstreamGlobals::outstandingRequests_[i],
|
||||
MPI_STATUS_IGNORE
|
||||
)
|
||||
)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"UPstream::waitRequest()"
|
||||
) << "MPI_Wait returned with error" << Foam::endl;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "UPstream::waitRequest : finished wait for request:" << i
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::UPstream::finishedRequest(const label i)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "UPstream::waitRequests : starting wait for request:" << i
|
||||
Pout<< "UPstream::waitRequests : checking finishedRequest:" << i
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -546,7 +590,7 @@ bool Foam::UPstream::finishedRequest(const label i)
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "UPstream::waitRequests : finished wait for request:" << i
|
||||
Pout<< "UPstream::waitRequests : finished finishedRequest:" << i
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -554,6 +598,4 @@ bool Foam::UPstream::finishedRequest(const label i)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,6 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightFile.H"
|
||||
#include <sstream>
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -31,6 +32,53 @@ bool Foam::ensightFile::allowUndef_ = false;
|
||||
|
||||
Foam::scalar Foam::ensightFile::undefValue_ = Foam::floatScalarVGREAT;
|
||||
|
||||
// default is width 8
|
||||
Foam::string Foam::ensightFile::mask_ = "********";
|
||||
|
||||
Foam::string Foam::ensightFile::dirFmt_ = "%08d";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::string Foam::ensightFile::mask()
|
||||
{
|
||||
return mask_;
|
||||
}
|
||||
|
||||
|
||||
Foam::string Foam::ensightFile::subDir(const label n)
|
||||
{
|
||||
char buf[32];
|
||||
|
||||
sprintf(buf, dirFmt_.c_str(), n);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightFile::subDirWidth(const label n)
|
||||
{
|
||||
// enforce max limit to avoid buffer overflow in subDir()
|
||||
if (n < 1 || n > 31)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// appropriate printf format
|
||||
std::ostringstream oss;
|
||||
oss << "%0" << n << "d";
|
||||
dirFmt_ = oss.str();
|
||||
|
||||
// set mask accordingly
|
||||
mask_.resize(n, '*');
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::ensightFile::subDirWidth()
|
||||
{
|
||||
return mask_.size();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ensightFile::ensightFile
|
||||
@ -247,22 +295,4 @@ Foam::Ostream& Foam::ensightFile::writeBinaryHeader()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::string Foam::ensightFile::mask()
|
||||
{
|
||||
char buf[16] = "********";
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
Foam::string Foam::ensightFile::subDir(const label n)
|
||||
{
|
||||
char buf[16];
|
||||
|
||||
sprintf(buf, "%08d", n);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,6 +57,12 @@ class ensightFile
|
||||
//- value to represent undef in results
|
||||
static scalar undefValue_;
|
||||
|
||||
//- The '*' mask appropriate for subDir
|
||||
static string mask_;
|
||||
|
||||
//- The printf format for zero-padded subdirectory numbers
|
||||
static string dirFmt_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -88,12 +94,19 @@ public:
|
||||
//- Return setting for whether 'undef' values are allowed in results
|
||||
static bool allowUndef();
|
||||
|
||||
//- '*' mask appropriate for subDir
|
||||
//- The '*' mask appropriate for subDir
|
||||
static string mask();
|
||||
|
||||
//- consistent zero-padded numbers for subdirectories
|
||||
//- Consistent zero-padded numbers for subdirectories
|
||||
static string subDir(const label);
|
||||
|
||||
//- Set width of subDir and mask. Default width is 8 digits.
|
||||
// Max width is 31 digits.
|
||||
static void subDirWidth(const label);
|
||||
|
||||
//- Return current width of subDir and mask.
|
||||
static label subDirWidth();
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,7 +26,7 @@ License
|
||||
#include "polyMeshGeometry.H"
|
||||
#include "polyMeshTetDecomposition.H"
|
||||
#include "pyramidPointFaceRef.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "tetrahedron.H"
|
||||
#include "syncTools.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
|
||||
@ -176,7 +176,7 @@ void Foam::fileFormats::EMESHedgeFormat::write
|
||||
<< " version " << os.version() << ";\n"
|
||||
<< " format " << os.format() << ";\n"
|
||||
<< " class " << "featureEdgeMesh" << ";\n"
|
||||
<< " note " << "written " + clock::dateTime() << nl
|
||||
<< " note " << "written " + clock::dateTime() << ";\n"
|
||||
<< " object " << filename.name() << ";\n"
|
||||
<< "}" << nl;
|
||||
|
||||
|
||||
@ -756,6 +756,66 @@ void Foam::extendedFeatureEdgeMesh::nearestFeatureEdgeByType
|
||||
}
|
||||
|
||||
|
||||
void Foam::extendedFeatureEdgeMesh::allNearestFeatureEdges
|
||||
(
|
||||
const point& sample,
|
||||
const scalar searchRadiusSqr,
|
||||
List<pointIndexHit>& info
|
||||
) const
|
||||
{
|
||||
const PtrList<indexedOctree<treeDataEdge> >& edgeTrees = edgeTreesByType();
|
||||
|
||||
info.setSize(edgeTrees.size());
|
||||
|
||||
labelList sliceStarts(edgeTrees.size());
|
||||
|
||||
sliceStarts[0] = externalStart_;
|
||||
sliceStarts[1] = internalStart_;
|
||||
sliceStarts[2] = flatStart_;
|
||||
sliceStarts[3] = openStart_;
|
||||
sliceStarts[4] = multipleStart_;
|
||||
|
||||
DynamicList<pointIndexHit> dynEdgeHit;
|
||||
|
||||
// Loop over all the feature edge types
|
||||
forAll(edgeTrees, i)
|
||||
{
|
||||
// Pick up all the edges that intersect the search sphere
|
||||
labelList elems = edgeTrees[i].findSphere
|
||||
(
|
||||
sample,
|
||||
searchRadiusSqr
|
||||
);
|
||||
|
||||
forAll(elems, elemI)
|
||||
{
|
||||
label index = elems[elemI];
|
||||
label edgeI = edgeTrees[i].shapes().edgeLabels()[index];
|
||||
const edge& e = edges()[edgeI];
|
||||
|
||||
pointHit hitPoint = e.line(points()).nearestDist(sample);
|
||||
|
||||
label hitIndex = index + sliceStarts[i];
|
||||
|
||||
pointIndexHit nearHit;
|
||||
|
||||
if (!hitPoint.hit())
|
||||
{
|
||||
nearHit = pointIndexHit(true, hitPoint.missPoint(), hitIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
nearHit = pointIndexHit(true, hitPoint.hitPoint(), hitIndex);
|
||||
}
|
||||
|
||||
dynEdgeHit.append(nearHit);
|
||||
}
|
||||
}
|
||||
|
||||
info.transfer(dynEdgeHit);
|
||||
}
|
||||
|
||||
|
||||
const Foam::indexedOctree<Foam::treeDataEdge>&
|
||||
Foam::extendedFeatureEdgeMesh::edgeTree() const
|
||||
{
|
||||
|
||||
@ -271,6 +271,14 @@ public:
|
||||
List<pointIndexHit>& info
|
||||
) const;
|
||||
|
||||
//- Find all the feature edges within searchDistSqr of sample
|
||||
void allNearestFeatureEdges
|
||||
(
|
||||
const point& sample,
|
||||
const scalar searchRadiusSqr,
|
||||
List<pointIndexHit>& info
|
||||
) const;
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the index of the start of the convex feature points
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -80,6 +80,8 @@ public:
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "basicSource.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -170,7 +171,6 @@ void Foam::basicSource::setCellSet()
|
||||
const boundBox secondaryBB = secondaryMesh.bounds();
|
||||
if (secondaryBB.overlaps(primaryBB))
|
||||
{
|
||||
|
||||
// Dummy patches
|
||||
wordList cuttingPatches;
|
||||
HashTable<word> patchMap;
|
||||
@ -303,6 +303,7 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
|
||||
return autoPtr<basicSource>(cstrIter()(name, modelType, coeffs, mesh));
|
||||
}
|
||||
|
||||
|
||||
Foam::basicSource::~basicSource()
|
||||
{
|
||||
if (!secondaryToPrimaryInterpPtr_.empty())
|
||||
@ -364,6 +365,36 @@ void Foam::basicSource::checkApplied() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::correct(volScalarField& fld)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::correct(volVectorField& fld)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::correct(volSphericalTensorField& fld)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::correct(volSymmTensorField& fld)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::correct(volTensorField& fld)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::addSup(fvMatrix<scalar>& eqn, const label fieldI)
|
||||
{
|
||||
// do nothing
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,6 +47,7 @@ SourceFiles
|
||||
#define basicSource_H
|
||||
|
||||
#include "fvMatricesFwd.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "cellSet.H"
|
||||
#include "autoPtr.H"
|
||||
#include "meshToMesh.H"
|
||||
@ -60,7 +61,6 @@ namespace Foam
|
||||
|
||||
class fvMesh;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class basicSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -330,6 +330,24 @@ public:
|
||||
|
||||
// Evaluation
|
||||
|
||||
// Correct
|
||||
|
||||
//- Scalar
|
||||
virtual void correct(volScalarField& fld);
|
||||
|
||||
//- Vector
|
||||
virtual void correct(volVectorField& fld);
|
||||
|
||||
//- Spherical tensor
|
||||
virtual void correct(volSphericalTensorField& fld);
|
||||
|
||||
//- Symmetric tensor
|
||||
virtual void correct(volSymmTensorField& fld);
|
||||
|
||||
//- Tensor
|
||||
virtual void correct(volTensorField& fld);
|
||||
|
||||
|
||||
// Add explicit and implicit contributions
|
||||
|
||||
//- Scalar
|
||||
|
||||
@ -135,4 +135,5 @@ inline const Foam::word Foam::basicSource::mapRegionName() const
|
||||
return mapRegionName_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -95,6 +95,11 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct
|
||||
template<class Type>
|
||||
void correct(GeometricField<Type, fvPatchField, volMesh>& fld);
|
||||
|
||||
|
||||
// Sources
|
||||
|
||||
//- Return source for equation
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,6 +25,39 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::basicSourceList::correct
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>& fld
|
||||
)
|
||||
{
|
||||
const word& fieldName = fld.name();
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
basicSource& source = this->operator[](i);
|
||||
|
||||
label fieldI = source.applyToField(fieldName);
|
||||
|
||||
if (fieldI != -1)
|
||||
{
|
||||
source.setApplied(fieldI);
|
||||
|
||||
if (source.isActive())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Correcting source " << source.name()
|
||||
<< " for field " << fieldName << endl;
|
||||
}
|
||||
|
||||
source.correct(fld);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::fvMatrix<Type> > Foam::basicSourceList::operator()
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -69,53 +69,6 @@ void Foam::pressureGradientExplicitSource::writeGradP() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::pressureGradientExplicitSource::update(fvMatrix<vector>& eqn)
|
||||
{
|
||||
volVectorField& U = const_cast<volVectorField&>(eqn.psi());
|
||||
|
||||
const volScalarField& rAU =
|
||||
mesh_.lookupObject<volScalarField>("(1|A(" + U.name() + "))");
|
||||
|
||||
// Integrate flow variables over cell set
|
||||
scalar magUbarAve = 0.0;
|
||||
scalar rAUave = 0.0;
|
||||
const scalarField& cv = mesh_.V();
|
||||
forAll(cells_, i)
|
||||
{
|
||||
label cellI = cells_[i];
|
||||
scalar volCell = cv[cellI];
|
||||
magUbarAve += (flowDir_ & U[cellI])*volCell;
|
||||
rAUave += rAU[cellI]*volCell;
|
||||
}
|
||||
|
||||
// Collect across all processors
|
||||
reduce(magUbarAve, sumOp<scalar>());
|
||||
|
||||
// Volume averages
|
||||
magUbarAve /= V_;
|
||||
rAUave /= V_;
|
||||
|
||||
// Calculate the pressure gradient increment needed to adjust the average
|
||||
// flow-rate to the desired value
|
||||
scalar gradPplus = (mag(Ubar_) - magUbarAve)/rAUave;
|
||||
|
||||
// Apply correction to velocity field
|
||||
forAll(cells_, i)
|
||||
{
|
||||
label cellI = cells_[i];
|
||||
U[cellI] += flowDir_*rAU[cellI]*gradPplus;
|
||||
}
|
||||
|
||||
// Update pressure gradient
|
||||
gradP_.value() += gradPplus;
|
||||
|
||||
Info<< "Uncorrected Ubar = " << magUbarAve << tab
|
||||
<< "Pressure gradient = " << gradP_.value() << endl;
|
||||
|
||||
writeGradP();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pressureGradientExplicitSource::pressureGradientExplicitSource
|
||||
@ -133,6 +86,23 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource
|
||||
flowDir_(Ubar_/mag(Ubar_))
|
||||
{
|
||||
coeffs_.lookup("fieldNames") >> fieldNames_;
|
||||
|
||||
if (fieldNames_.size() != 1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::pressureGradientExplicitSource::"
|
||||
"pressureGradientExplicitSource"
|
||||
"("
|
||||
"onst word&, "
|
||||
"const word&, "
|
||||
"const dictionary&, "
|
||||
"const fvMesh&"
|
||||
")"
|
||||
) << "Source can only be applied to a single field. Current "
|
||||
<< "settings are:" << fieldNames_ << exit(FatalError);
|
||||
}
|
||||
|
||||
applied_.setSize(fieldNames_.size(), false);
|
||||
|
||||
// Read the initial pressure gradient from file if it exists
|
||||
@ -160,8 +130,6 @@ void Foam::pressureGradientExplicitSource::addSup
|
||||
const label fieldI
|
||||
)
|
||||
{
|
||||
update(eqn);
|
||||
|
||||
DimensionedField<vector, volMesh> Su
|
||||
(
|
||||
IOobject
|
||||
@ -178,7 +146,53 @@ void Foam::pressureGradientExplicitSource::addSup
|
||||
|
||||
UIndirectList<vector>(Su, cells_) = flowDir_*gradP_.value();
|
||||
|
||||
eqn -= Su;
|
||||
eqn += Su;
|
||||
}
|
||||
|
||||
|
||||
void Foam::pressureGradientExplicitSource::correct(volVectorField& U)
|
||||
{
|
||||
const volScalarField& rAU =
|
||||
mesh_.lookupObject<volScalarField>("(1|A(" + U.name() + "))");
|
||||
|
||||
// Integrate flow variables over cell set
|
||||
scalar magUbarAve = 0.0;
|
||||
scalar rAUave = 0.0;
|
||||
const scalarField& cv = mesh_.V();
|
||||
forAll(cells_, i)
|
||||
{
|
||||
label cellI = cells_[i];
|
||||
scalar volCell = cv[cellI];
|
||||
magUbarAve += (flowDir_ & U[cellI])*volCell;
|
||||
rAUave += rAU[cellI]*volCell;
|
||||
}
|
||||
|
||||
// Collect across all processors
|
||||
reduce(magUbarAve, sumOp<scalar>());
|
||||
reduce(rAUave, sumOp<scalar>());
|
||||
|
||||
// Volume averages
|
||||
magUbarAve /= V_;
|
||||
rAUave /= V_;
|
||||
|
||||
// Calculate the pressure gradient increment needed to adjust the average
|
||||
// flow-rate to the desired value
|
||||
scalar gradPplus = (mag(Ubar_) - magUbarAve)/rAUave;
|
||||
|
||||
// Apply correction to velocity field
|
||||
forAll(cells_, i)
|
||||
{
|
||||
label cellI = cells_[i];
|
||||
U[cellI] += flowDir_*rAU[cellI]*gradPplus;
|
||||
}
|
||||
|
||||
// Update pressure gradient
|
||||
gradP_.value() += gradPplus;
|
||||
|
||||
Info<< "Pressure gradient source: uncorrected Ubar = " << magUbarAve
|
||||
<< ", pressure gradient = " << gradP_.value() << endl;
|
||||
|
||||
writeGradP();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user