Added pUCoupledSolver with core library changes and tutorial case
This commit is contained in:
parent
84ca40de24
commit
8848498e5d
35 changed files with 2123 additions and 1 deletions
|
@ -7,4 +7,5 @@ wmake libso conjugateHeatTransfer
|
|||
wmake blockCoupledScalarTransportFoam
|
||||
wmake conjugateHeatFoam
|
||||
wmake conjugateHeatSimpleFoam
|
||||
wmake pUCoupledFoam
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
|
3
applications/solvers/coupled/pUCoupledFoam/Make/files
Normal file
3
applications/solvers/coupled/pUCoupledFoam/Make/files
Normal file
|
@ -0,0 +1,3 @@
|
|||
pUCoupledFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/pUCoupledFoam
|
15
applications/solvers/coupled/pUCoupledFoam/Make/options
Normal file
15
applications/solvers/coupled/pUCoupledFoam/Make/options
Normal file
|
@ -0,0 +1,15 @@
|
|||
EXE_INC = \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/VectorN/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleTransportModels \
|
||||
-lfiniteVolume \
|
||||
-llduSolvers \
|
||||
-lVectorN
|
||||
|
10
applications/solvers/coupled/pUCoupledFoam/UEqn.H
Normal file
10
applications/solvers/coupled/pUCoupledFoam/UEqn.H
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Momentum equation
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::div(phi, U)
|
||||
+ turbulence->divDevReff(U)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
blockMatrixTools::insertEquation(0, UEqn, A, x, b);
|
|
@ -0,0 +1,2 @@
|
|||
blockVectorMatrix pInU(fvm::grad(p));
|
||||
blockVectorMatrix UInp(fvm::div(U));
|
52
applications/solvers/coupled/pUCoupledFoam/createFields.H
Normal file
52
applications/solvers/coupled/pUCoupledFoam/createFields.H
Normal file
|
@ -0,0 +1,52 @@
|
|||
Info << "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info << "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
#include "createPhi.H"
|
||||
|
||||
singlePhaseTransportModel laminarTransport(U, phi);
|
||||
autoPtr<incompressible::RASModel> turbulence
|
||||
(
|
||||
incompressible::RASModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
// Block vector field for velocity (first entry) and pressure (second
|
||||
// entry).
|
||||
Info << "Creating field Up\n" << endl;
|
||||
volVector4Field Up
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Up",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector4("zero", dimless, vector4::zero)
|
||||
);
|
|
@ -0,0 +1,9 @@
|
|||
// Create block matrix
|
||||
BlockLduMatrix<vector4> A(mesh);
|
||||
|
||||
// Block matrix - create x and b
|
||||
vector4Field& x = Up.internalField();
|
||||
vector4Field b(x.size(), vector4::zero);
|
||||
|
||||
// Set block interfaces properly
|
||||
A.interfaces() = Up.boundaryField().blockInterfaces();
|
23
applications/solvers/coupled/pUCoupledFoam/pEqn.H
Normal file
23
applications/solvers/coupled/pUCoupledFoam/pEqn.H
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Pressure parts of the continuity equation
|
||||
surfaceScalarField rUAf
|
||||
(
|
||||
"rUAf",
|
||||
fvc::interpolate(1.0/UEqn.A())
|
||||
);
|
||||
|
||||
surfaceScalarField presSource
|
||||
(
|
||||
"presSource",
|
||||
rUAf*(fvc::interpolate(fvc::grad(p)) & mesh.Sf())
|
||||
);
|
||||
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
- fvm::laplacian(rUAf, p)
|
||||
==
|
||||
- fvc::div(presSource)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
blockMatrixTools::insertEquation(3, pEqn, A, x, b);
|
128
applications/solvers/coupled/pUCoupledFoam/pUCoupledFoam.C
Normal file
128
applications/solvers/coupled/pUCoupledFoam/pUCoupledFoam.C
Normal file
|
@ -0,0 +1,128 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
pUCoupledFoam
|
||||
|
||||
Description
|
||||
Steady-state solver for incompressible, turbulent flow, with implicit
|
||||
coupling between pressure and velocity achieved by BlockLduMatrix
|
||||
Turbulence is in this version solved using the existing turbulence
|
||||
structure.
|
||||
|
||||
Authors
|
||||
Klas Jareteg, Chalmers University of Technology,
|
||||
Vuko Vukcevic, FMENA Zagreb.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "singlePhaseTransportModel.H"
|
||||
#include "RASModel.H"
|
||||
|
||||
#include "VectorNFieldTypes.H"
|
||||
#include "volVectorNFields.H"
|
||||
#include "blockLduSolvers.H"
|
||||
#include "blockVectorNMatrices.H"
|
||||
|
||||
#include "blockMatrixTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
# include "readBlockSolverControls.H"
|
||||
|
||||
// Calculate coupling matrices only once since the mesh doesn't change and
|
||||
// implicit div and grad operators are only dependant on Sf. Actually
|
||||
// coupling terms (div(U) and grad(p)) in blockMatrix do not change, so they
|
||||
// could be inserted only once, resetting other parts of blockMatrix to zero
|
||||
// at the end of each time step. VV, 30/April/2014
|
||||
# include "calculateCouplingMatrices.H"
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
while (runTime.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
p.storePrevIter();
|
||||
|
||||
// Initialize block matrix
|
||||
# include "initializeBlockMatrix.H"
|
||||
|
||||
// Assemble and insert momentum equation
|
||||
# include "UEqn.H"
|
||||
|
||||
// Assemble and insert pressure equation
|
||||
# include "pEqn.H"
|
||||
|
||||
// Insert coupling, updating the boundary contributions
|
||||
// Last argument in insertBlockCoupling says if the first location
|
||||
// should be incremented. This is needed for arbitrary positioning
|
||||
// of U and p in the system. This could be better. VV, 30/April/2014
|
||||
blockMatrixTools::insertBlockCoupling(3, 0, UInp, U, A, b, false);
|
||||
blockMatrixTools::insertBlockCoupling(0, 3, pInU, p, A, b, true);
|
||||
|
||||
// Solve the block matrix
|
||||
BlockSolverPerformance<vector4> solverPerf =
|
||||
BlockLduSolver<vector4>::New
|
||||
(
|
||||
word("Up"),
|
||||
A,
|
||||
mesh.solutionDict().solver("Up")
|
||||
)->solve(Up, b);
|
||||
|
||||
solverPerf.print();
|
||||
|
||||
// Retrieve solution
|
||||
blockMatrixTools::retrieveSolution(0, U.internalField(), Up);
|
||||
blockMatrixTools::retrieveSolution(3, p.internalField(), Up);
|
||||
|
||||
U.correctBoundaryConditions();
|
||||
p.correctBoundaryConditions();
|
||||
|
||||
phi = (fvc::interpolate(U) & mesh.Sf()) + pEqn.flux() + presSource;
|
||||
|
||||
p.relax();
|
||||
|
||||
turbulence->correct();
|
||||
runTime.write();
|
||||
|
||||
# include "continuityErrs.H"
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
label pRefCell = 0;
|
||||
scalar pRefValue = 0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("blockSolver"), pRefCell, pRefValue);
|
|
@ -483,6 +483,838 @@ void updateSourceCoupling
|
|||
}
|
||||
}
|
||||
|
||||
template<class blockType, class fieldType>
|
||||
void insertSolutionVector
|
||||
(
|
||||
const label loc,
|
||||
const Field<fieldType>& xSingle,
|
||||
Field<blockType>& xBlock
|
||||
)
|
||||
{
|
||||
// Get number of field components and local copy of location, for
|
||||
// consistency with member functions where locations need to be reset.
|
||||
const label nCmpts = pTraits<fieldType>::nComponents;
|
||||
label localLoc = loc;
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
scalarField xSingleCurr(xSingle.component(cmptI));
|
||||
|
||||
forAll (xSingleCurr, cellI)
|
||||
{
|
||||
xBlock[cellI](localLoc) = xSingleCurr[cellI];
|
||||
}
|
||||
|
||||
localLoc++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class blockType, class fieldType>
|
||||
void retrieveSolution
|
||||
(
|
||||
const label loc,
|
||||
Field<fieldType>& xSingle,
|
||||
const Field<blockType>& xBlock
|
||||
)
|
||||
{
|
||||
const label nCmpts = pTraits<fieldType>::nComponents;
|
||||
label localLoc = loc;
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
scalarField xSingleCurr(xSingle.component(cmptI));
|
||||
|
||||
forAll (xSingleCurr, cellI)
|
||||
{
|
||||
xSingleCurr[cellI] = xBlock[cellI](localLoc);
|
||||
}
|
||||
|
||||
xSingle.replace(cmptI, xSingleCurr);
|
||||
|
||||
localLoc++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class blockType, class matrixType>
|
||||
void insertDiagSource
|
||||
(
|
||||
const label loc,
|
||||
fvMatrix<matrixType>& matrix,
|
||||
BlockLduMatrix<blockType>& A,
|
||||
Field<blockType>& b
|
||||
)
|
||||
{
|
||||
matrix.completeAssembly();
|
||||
|
||||
// Save a copy for different components
|
||||
scalarField& diag = matrix.diag();
|
||||
scalarField saveDiag(diag);
|
||||
|
||||
// Add source boundary contribution
|
||||
Field<matrixType>& source = matrix.source();
|
||||
matrix.addBoundarySource(source, false);
|
||||
|
||||
const label nCmpts = pTraits<matrixType>::nComponents;
|
||||
label localLoc = loc;
|
||||
|
||||
if
|
||||
(
|
||||
// This is needed if the matrixType is <vector>, then you need to grab
|
||||
// coeffs as linear. Consider doing a matrixType check also.
|
||||
// VV, 17/March/2014
|
||||
A.diag().activeType() != blockCoeffBase::SQUARE
|
||||
)
|
||||
{
|
||||
typename CoeffField<blockType>::linearTypeField& blockDiag =
|
||||
A.diag().asLinear();
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
matrix.addBoundaryDiag(diag, cmptI);
|
||||
scalarField sourceCmpt(source.component(cmptI));
|
||||
|
||||
// FieldField<Field, scalar> bouCoeffsCmpt
|
||||
// (
|
||||
// matrix.boundaryCoeffs().component(cmptI)
|
||||
// );
|
||||
|
||||
// Possible problem for coupled non-aligned boundaries.
|
||||
// VV, 14/May/2014.
|
||||
// matrix.correctImplicitBoundarySource
|
||||
// (
|
||||
// bouCoeffsCmpt,
|
||||
// sourceCmpt,
|
||||
// cmptI
|
||||
// );
|
||||
|
||||
forAll (diag, cellI)
|
||||
{
|
||||
blockDiag[cellI](localLoc) = diag[cellI];
|
||||
b[cellI](localLoc) += sourceCmpt[cellI];
|
||||
}
|
||||
|
||||
localLoc++;
|
||||
|
||||
// Reset diagonal
|
||||
diag = saveDiag;
|
||||
}
|
||||
}
|
||||
else if (A.diag().activeType() == blockCoeffBase::SQUARE)
|
||||
{
|
||||
typename CoeffField<blockType>::squareTypeField& blockDiag =
|
||||
A.diag().asSquare();
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
matrix.addBoundaryDiag(diag, cmptI);
|
||||
scalarField sourceCmpt(source.component(cmptI));
|
||||
|
||||
// FieldField<Field, scalar> bouCoeffsCmpt
|
||||
// (
|
||||
// matrix.boundaryCoeffs().component(cmptI)
|
||||
// );
|
||||
|
||||
// matrix.correctImplicitBoundarySource
|
||||
// (
|
||||
// bouCoeffsCmpt,
|
||||
// sourceCmpt,
|
||||
// cmptI
|
||||
// );
|
||||
|
||||
forAll (diag, cellI)
|
||||
{
|
||||
blockDiag[cellI](localLoc, localLoc) = diag[cellI];
|
||||
b[cellI](localLoc) += sourceCmpt[cellI];
|
||||
}
|
||||
|
||||
localLoc++;
|
||||
|
||||
// Reset diagonal
|
||||
diag = saveDiag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class blockType, class matrixType>
|
||||
void insertUpperLower
|
||||
(
|
||||
const label loc,
|
||||
const fvMatrix<matrixType>& matrix,
|
||||
BlockLduMatrix<blockType>& A
|
||||
)
|
||||
{
|
||||
if (matrix.diagonal())
|
||||
{
|
||||
// Matrix for insertion is diagonal-only: nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
const label nCmpts = pTraits<matrixType>::nComponents;
|
||||
label localLoc = loc;
|
||||
|
||||
if (matrix.hasUpper())
|
||||
{
|
||||
const scalarField& upper = matrix.upper();
|
||||
|
||||
if (A.upper().activeType() == blockCoeffBase::UNALLOCATED)
|
||||
{
|
||||
A.upper().asScalar() = upper;
|
||||
}
|
||||
else if
|
||||
(
|
||||
A.upper().activeType() == blockCoeffBase::SCALAR
|
||||
|| A.upper().activeType() == blockCoeffBase::LINEAR
|
||||
)
|
||||
{
|
||||
typename CoeffField<blockType>::linearTypeField& blockUpper =
|
||||
A.upper().asLinear();
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
forAll (upper, faceI)
|
||||
{
|
||||
blockUpper[faceI](localLoc) = upper[faceI];
|
||||
}
|
||||
|
||||
localLoc++;
|
||||
}
|
||||
}
|
||||
else if (A.upper().activeType() == blockCoeffBase::SQUARE)
|
||||
{
|
||||
typename CoeffField<blockType>::squareTypeField& blockUpper =
|
||||
A.upper().asSquare();
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
forAll (upper, faceI)
|
||||
{
|
||||
blockUpper[faceI](localLoc, localLoc) = upper[faceI];
|
||||
}
|
||||
|
||||
localLoc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void insertUpperLower\n"
|
||||
"(\n"
|
||||
" const location loc,\n"
|
||||
" const fvMatrix<matrixType>& matrix,\n"
|
||||
" BlockLduMatrix<blockType>& A\n"
|
||||
")"
|
||||
) << "Error in matrix insertion: problem with block structure."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (matrix.symmetric() && A.symmetric())
|
||||
{
|
||||
Info<< "Both matrices are symmetric: inserting only upper triangle"
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset localLoc
|
||||
localLoc = loc;
|
||||
|
||||
// Either scalar or block matrix is asymmetric: insert lower triangle
|
||||
const scalarField& lower = matrix.lower();
|
||||
|
||||
if (A.lower().activeType() == blockCoeffBase::UNALLOCATED)
|
||||
{
|
||||
A.lower().asScalar() = lower;
|
||||
}
|
||||
else if
|
||||
(
|
||||
A.lower().activeType() == blockCoeffBase::SCALAR
|
||||
|| A.lower().activeType() == blockCoeffBase::LINEAR
|
||||
)
|
||||
{
|
||||
typename CoeffField<blockType>::linearTypeField& blockLower =
|
||||
A.lower().asLinear();
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
forAll (lower, faceI)
|
||||
{
|
||||
blockLower[faceI](localLoc) = lower[faceI];
|
||||
}
|
||||
|
||||
localLoc++;
|
||||
}
|
||||
}
|
||||
else if (A.lower().activeType() == blockCoeffBase::SQUARE)
|
||||
{
|
||||
typename CoeffField<blockType>::squareTypeField& blockLower =
|
||||
A.lower().asSquare();
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
forAll (lower, faceI)
|
||||
{
|
||||
blockLower[faceI](localLoc, localLoc) = lower[faceI];
|
||||
}
|
||||
|
||||
localLoc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class blockType, class matrixType>
|
||||
void updateCouplingCoeffs
|
||||
(
|
||||
const label loc,
|
||||
const fvMatrix<matrixType>& matrix,
|
||||
BlockLduMatrix<blockType>& A
|
||||
)
|
||||
{
|
||||
const label nCmpts = pTraits<matrixType>::nComponents;
|
||||
label localLoc = loc;
|
||||
|
||||
const GeometricField<matrixType, fvPatchField, volMesh>& psi = matrix.psi();
|
||||
forAll(psi.boundaryField(), patchI)
|
||||
{
|
||||
const fvPatchField<matrixType>& pf = psi.boundaryField()[patchI];
|
||||
const fvPatch& patch = pf.patch();
|
||||
|
||||
if (patch.coupled())
|
||||
{
|
||||
const Field<matrixType>& icp = matrix.internalCoeffs()[patchI];
|
||||
const Field<matrixType>& bcp = matrix.boundaryCoeffs()[patchI];
|
||||
|
||||
if (A.coupleUpper()[patchI].activeType() != blockCoeffBase::SQUARE)
|
||||
{
|
||||
typename CoeffField<blockType>::linearTypeField& pcoupleUpper =
|
||||
A.coupleUpper()[patchI].asLinear();
|
||||
typename CoeffField<blockType>::linearTypeField& pcoupleLower =
|
||||
A.coupleLower()[patchI].asLinear();
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
scalarField icpCmpt = icp.component(cmptI);
|
||||
scalarField bcpCmpt = bcp.component(cmptI);
|
||||
|
||||
forAll(pf, faceI)
|
||||
{
|
||||
pcoupleUpper[faceI](localLoc) = bcpCmpt[faceI];
|
||||
pcoupleLower[faceI](localLoc) = icpCmpt[faceI];
|
||||
}
|
||||
|
||||
localLoc++;
|
||||
}
|
||||
|
||||
localLoc = loc;
|
||||
}
|
||||
else if
|
||||
(
|
||||
A.coupleUpper()[patchI].activeType() == blockCoeffBase::SQUARE
|
||||
)
|
||||
{
|
||||
typename CoeffField<blockType>::squareTypeField& pcoupleUpper =
|
||||
A.coupleUpper()[patchI].asSquare();
|
||||
typename CoeffField<blockType>::squareTypeField& pcoupleLower =
|
||||
A.coupleLower()[patchI].asSquare();
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
scalarField icpCmpt = icp.component(cmptI);
|
||||
scalarField bcpCmpt = bcp.component(cmptI);
|
||||
|
||||
forAll(pf, faceI)
|
||||
{
|
||||
pcoupleUpper[faceI](localLoc, localLoc) =
|
||||
bcpCmpt[faceI];
|
||||
pcoupleLower[faceI](localLoc, localLoc) =
|
||||
icpCmpt[faceI];
|
||||
}
|
||||
|
||||
localLoc++;
|
||||
}
|
||||
|
||||
localLoc = loc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class blockType, class matrixType>
|
||||
void insertEquation
|
||||
(
|
||||
const label loc,
|
||||
fvMatrix<matrixType>& matrix,
|
||||
BlockLduMatrix<blockType>& A,
|
||||
Field<blockType>& x,
|
||||
Field<blockType>& b
|
||||
)
|
||||
{
|
||||
insertDiagSource(loc, matrix, A, b);
|
||||
insertUpperLower(loc, matrix, A);
|
||||
updateCouplingCoeffs(loc, matrix, A);
|
||||
insertSolutionVector(loc, matrix.psi().internalField(), x);
|
||||
}
|
||||
|
||||
|
||||
template<class blockType1, class blockType2>
|
||||
void insertBlock
|
||||
(
|
||||
const label loc1,
|
||||
const label loc2,
|
||||
const BlockLduMatrix<blockType1>& blockMatrix,
|
||||
BlockLduMatrix<blockType2>& A,
|
||||
const bool incFirst
|
||||
)
|
||||
{
|
||||
// Sanity checks
|
||||
{
|
||||
const label blockMatrixSize = pTraits<blockType1>::nComponents;
|
||||
const label blockSystemSize = pTraits<blockType2>::nComponents;
|
||||
|
||||
if (blockMatrixSize > blockSystemSize)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void insertBlock\n"
|
||||
"(\n"
|
||||
" const label loc1,\n"
|
||||
" const label loc2,\n"
|
||||
" BlockLduMatrix<blockType1>& blockMatrix,\n"
|
||||
" BlockLduMatrix<blockType2>& A\n"
|
||||
")"
|
||||
) << "Trying to insert a block matrix into smaller one."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (loc1 == loc2)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void insertCoupling\n"
|
||||
"(\n"
|
||||
" const label loc1,\n"
|
||||
" const label loc2,\n"
|
||||
" BlockLduMatrix<blockType1>& blockMatrix,\n"
|
||||
" BlockLduMatrix<blockType2>& A\n"
|
||||
")"
|
||||
) << "Trying to insert coupling in the position where equation "
|
||||
<< "should be, since loc1 = loc2. Try using insertEquatiion "
|
||||
<< "member function."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const label nCmpts = pTraits<blockType1>::nComponents;
|
||||
label localLoc1 = loc1;
|
||||
label localLoc2 = loc2;
|
||||
|
||||
// Get references to ldu fields of blockMatrix always as linear
|
||||
const typename CoeffField<blockType1>::linearTypeField& bmd =
|
||||
blockMatrix.diag().asLinear();
|
||||
const typename CoeffField<blockType1>::linearTypeField& bmu =
|
||||
blockMatrix.upper().asLinear();
|
||||
const typename CoeffField<blockType1>::linearTypeField& bml =
|
||||
blockMatrix.lower().asLinear();
|
||||
|
||||
// Get references to ldu fields of A matrix always as square
|
||||
typename CoeffField<blockType2>::squareTypeField& blockDiag =
|
||||
A.diag().asSquare();
|
||||
typename CoeffField<blockType2>::squareTypeField& blockUpper =
|
||||
A.upper().asSquare();
|
||||
typename CoeffField<blockType2>::squareTypeField& blockLower =
|
||||
A.lower().asSquare();
|
||||
|
||||
// Insert blockMatrix that represents coupling into larger system matrix
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
forAll(bmd, cellI)
|
||||
{
|
||||
blockDiag[cellI](localLoc1, localLoc2) += bmd[cellI](cmptI);
|
||||
}
|
||||
|
||||
forAll(bmu, faceI)
|
||||
{
|
||||
blockUpper[faceI](localLoc1, localLoc2) += bmu[faceI](cmptI);
|
||||
blockLower[faceI](localLoc1, localLoc2) += bml[faceI](cmptI);
|
||||
}
|
||||
|
||||
if (incFirst)
|
||||
{
|
||||
localLoc1++;
|
||||
}
|
||||
else
|
||||
{
|
||||
localLoc2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class blockType1, class blockType2>
|
||||
void insertBoundaryContributions
|
||||
(
|
||||
const label loc1,
|
||||
const label loc2,
|
||||
const BlockLduMatrix<blockType1>& blockMatrix,
|
||||
GeometricField<scalar, fvPatchField, volMesh>& psi,
|
||||
BlockLduMatrix<blockType2>& A,
|
||||
Field<blockType2>& b,
|
||||
const bool incFirst
|
||||
)
|
||||
{
|
||||
// Interpolation scheme for pressure gradient
|
||||
tmp<surfaceInterpolationScheme<scalar> >
|
||||
tinterpScheme
|
||||
(
|
||||
surfaceInterpolationScheme<scalar>::New
|
||||
(
|
||||
psi.mesh(),
|
||||
psi.mesh().schemesDict().interpolationScheme
|
||||
(
|
||||
"grad(" + psi.name() + ')'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
surfaceScalarField weights(tinterpScheme().weights(psi));
|
||||
|
||||
const label nCmpts = pTraits<blockType1>::nComponents;
|
||||
label localLoc1 = loc1;
|
||||
label localLoc2 = loc2;
|
||||
|
||||
// Get references to ldu fields of A matrix always as square
|
||||
typename CoeffField<blockType2>::squareTypeField& blockDiag =
|
||||
A.diag().asSquare();
|
||||
|
||||
// Insert boundary contributions directly into the matrix, this assumes
|
||||
// that blockMatrix came from implicit grad or div operators!
|
||||
psi.boundaryField().updateCoeffs();
|
||||
forAll(psi.boundaryField(), patchI)
|
||||
{
|
||||
const fvPatchScalarField& pf = psi.boundaryField()[patchI];
|
||||
const fvPatch& patch = pf.patch();
|
||||
const vectorField& Sf = patch.Sf();
|
||||
const fvsPatchScalarField& pw = weights.boundaryField()[patchI];
|
||||
|
||||
scalarField internalCoeffs(pf.valueInternalCoeffs(pw));
|
||||
|
||||
if (patch.coupled())
|
||||
{
|
||||
typename CoeffField<blockType2>::squareTypeField& pcoupleUpper =
|
||||
A.coupleUpper()[patchI].asSquare();
|
||||
typename CoeffField<blockType2>::squareTypeField& pcoupleLower =
|
||||
A.coupleLower()[patchI].asSquare();
|
||||
|
||||
vectorField pcl = -pw*Sf;
|
||||
vectorField pcu = pcl + Sf;
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
forAll(pf, faceI)
|
||||
{
|
||||
label cellI = patch.faceCells()[faceI];
|
||||
|
||||
// Diag contribution
|
||||
blockDiag[cellI](localLoc1, localLoc2) +=
|
||||
internalCoeffs[faceI]*Sf[faceI].component(cmptI);
|
||||
|
||||
// Coupling contributions
|
||||
pcoupleUpper[faceI](localLoc1, localLoc2) -=
|
||||
pcu[faceI].component(cmptI);
|
||||
pcoupleLower[faceI](localLoc1, localLoc2) -=
|
||||
pcl[faceI].component(cmptI);
|
||||
}
|
||||
|
||||
if (incFirst)
|
||||
{
|
||||
localLoc1++;
|
||||
}
|
||||
else
|
||||
{
|
||||
localLoc2++;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset local locations for other patches
|
||||
localLoc1 = loc1;
|
||||
localLoc2 = loc2;
|
||||
}
|
||||
else
|
||||
{
|
||||
scalarField boundaryCoeffs(pf.valueBoundaryCoeffs(pw));
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
forAll(pf, faceI)
|
||||
{
|
||||
label cellI = patch.faceCells()[faceI];
|
||||
|
||||
// Diag contribution
|
||||
blockDiag[cellI](localLoc1, localLoc2) +=
|
||||
internalCoeffs[faceI]*Sf[faceI].component(cmptI);
|
||||
|
||||
// Source contribution
|
||||
b[cellI](localLoc1) -=
|
||||
boundaryCoeffs[faceI]*Sf[faceI].component(cmptI);
|
||||
}
|
||||
|
||||
if (incFirst)
|
||||
{
|
||||
localLoc1++;
|
||||
}
|
||||
else
|
||||
{
|
||||
localLoc2++;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset local locations for other patches
|
||||
localLoc1 = loc1;
|
||||
localLoc2 = loc2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class blockType1, class blockType2>
|
||||
void insertBoundaryContributions
|
||||
(
|
||||
const label loc1,
|
||||
const label loc2,
|
||||
const BlockLduMatrix<blockType1>& blockMatrix,
|
||||
GeometricField<vector, fvPatchField, volMesh>& psi,
|
||||
BlockLduMatrix<blockType2>& A,
|
||||
Field<blockType2>& b,
|
||||
const bool incFirst
|
||||
)
|
||||
{
|
||||
// Interpolation scheme for velocity divergence
|
||||
tmp<surfaceInterpolationScheme<scalar> >
|
||||
tinterpScheme
|
||||
(
|
||||
surfaceInterpolationScheme<scalar>::New
|
||||
(
|
||||
psi.mesh(),
|
||||
psi.mesh().schemesDict().interpolationScheme
|
||||
(
|
||||
"div(" + psi.name() + ')'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
surfaceScalarField weights(tinterpScheme().weights(mag(psi)));
|
||||
|
||||
const label nCmpts = pTraits<blockType1>::nComponents;
|
||||
label localLoc1 = loc1;
|
||||
label localLoc2 = loc2;
|
||||
|
||||
// Get references to ldu fields of A matrix always as square
|
||||
typename CoeffField<blockType2>::squareTypeField& blockDiag =
|
||||
A.diag().asSquare();
|
||||
|
||||
// Insert boundary contributions directly into the matrix, this assumes
|
||||
// that blockMatrix came from implicit grad or div operators!
|
||||
psi.boundaryField().updateCoeffs();
|
||||
forAll(psi.boundaryField(), patchI)
|
||||
{
|
||||
const fvPatchVectorField& pf = psi.boundaryField()[patchI];
|
||||
const fvPatch& patch = pf.patch();
|
||||
const vectorField& Sf = patch.Sf();
|
||||
const fvsPatchScalarField& pw = weights.boundaryField()[patchI];
|
||||
|
||||
vectorField internalCoeffs(pf.valueInternalCoeffs(pw));
|
||||
|
||||
if (patch.coupled())
|
||||
{
|
||||
typename CoeffField<blockType2>::squareTypeField& pcoupleUpper =
|
||||
A.coupleUpper()[patchI].asSquare();
|
||||
typename CoeffField<blockType2>::squareTypeField& pcoupleLower =
|
||||
A.coupleLower()[patchI].asSquare();
|
||||
|
||||
vectorField pcl = -pw*Sf;
|
||||
vectorField pcu = pcl + Sf;
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
forAll(pf, faceI)
|
||||
{
|
||||
label cellI = patch.faceCells()[faceI];
|
||||
|
||||
// Diag contribution
|
||||
blockDiag[cellI](localLoc1, localLoc2) += cmptMultiply
|
||||
(
|
||||
internalCoeffs[faceI], Sf[faceI]
|
||||
).component(cmptI);
|
||||
|
||||
// Coupling contributions
|
||||
pcoupleLower[faceI](localLoc1, localLoc2) -=
|
||||
pcl[faceI].component(cmptI);
|
||||
pcoupleUpper[faceI](localLoc1, localLoc2) -=
|
||||
pcu[faceI].component(cmptI);
|
||||
}
|
||||
|
||||
if (incFirst)
|
||||
{
|
||||
localLoc1++;
|
||||
}
|
||||
else
|
||||
{
|
||||
localLoc2++;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset local locations for other patches
|
||||
localLoc1 = loc1;
|
||||
localLoc2 = loc2;
|
||||
}
|
||||
else
|
||||
{
|
||||
vectorField boundaryCoeffs(pf.valueBoundaryCoeffs(pw));
|
||||
|
||||
for (label cmptI = 0; cmptI < nCmpts; cmptI++)
|
||||
{
|
||||
forAll(pf, faceI)
|
||||
{
|
||||
label cellI = patch.faceCells()[faceI];
|
||||
|
||||
// Diag contribution
|
||||
blockDiag[cellI](localLoc1, localLoc2) += cmptMultiply
|
||||
(
|
||||
internalCoeffs[faceI], Sf[faceI]
|
||||
).component(cmptI);
|
||||
|
||||
// Source contribution
|
||||
b[cellI](localLoc1) -= cmptMultiply
|
||||
(
|
||||
boundaryCoeffs[faceI], Sf[faceI]
|
||||
).component(cmptI);
|
||||
}
|
||||
|
||||
if (incFirst)
|
||||
{
|
||||
localLoc1++;
|
||||
}
|
||||
else
|
||||
{
|
||||
localLoc2++;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset local locations for other patches
|
||||
localLoc1 = loc1;
|
||||
localLoc2 = loc2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class blockType1, class blockType2, class fieldType>
|
||||
void insertBlockCoupling
|
||||
(
|
||||
const label loc1,
|
||||
const label loc2,
|
||||
const BlockLduMatrix<blockType1>& blockMatrix,
|
||||
GeometricField<fieldType, fvPatchField, volMesh>& psi,
|
||||
BlockLduMatrix<blockType2>& A,
|
||||
Field<blockType2>& b,
|
||||
const bool incFirst
|
||||
)
|
||||
{
|
||||
insertBlock(loc1, loc2, blockMatrix, A, incFirst);
|
||||
insertBoundaryContributions(loc1, loc2, blockMatrix, psi, A, b, incFirst);
|
||||
}
|
||||
|
||||
|
||||
template<class blockType>
|
||||
void insertEquationCoupling
|
||||
(
|
||||
const label loc1,
|
||||
const label loc2,
|
||||
fvScalarMatrix& matrix,
|
||||
BlockLduMatrix<blockType>& A,
|
||||
Field<blockType>& b
|
||||
)
|
||||
{
|
||||
// Sanity check
|
||||
if (loc1 == loc2)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void insertEquationCoupling\n"
|
||||
"(\n"
|
||||
" const label loc1,\n"
|
||||
" const label loc2,\n"
|
||||
" fvScalarMatrix& matrix\n"
|
||||
" BlockLduMatrix<blockType>& A\n"
|
||||
" Field<blockType>& b\n"
|
||||
")"
|
||||
) << "Trying to insert coupling in the position where equation "
|
||||
<< "should be since loc1 = loc2. Try using insertEquatiion "
|
||||
<< "member function."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Get references to fvScalarMatrix fields, updating boundary contributions
|
||||
scalarField& diag = matrix.D();
|
||||
scalarField& source = matrix.source();
|
||||
matrix.addBoundarySource(source, false);
|
||||
|
||||
const scalarField& upper = matrix.upper();
|
||||
const scalarField& lower = matrix.lower();
|
||||
|
||||
// Get references to ldu fields of A matrix always as square
|
||||
typename CoeffField<blockType>::squareTypeField& blockDiag =
|
||||
A.diag().asSquare();
|
||||
typename CoeffField<blockType>::squareTypeField& blockUpper =
|
||||
A.upper().asSquare();
|
||||
typename CoeffField<blockType>::squareTypeField& blockLower =
|
||||
A.lower().asSquare();
|
||||
|
||||
forAll(diag, cellI)
|
||||
{
|
||||
blockDiag[cellI](loc1, loc2) += diag[cellI];
|
||||
b[cellI](loc1) += source[cellI];
|
||||
}
|
||||
|
||||
forAll(upper, faceI)
|
||||
{
|
||||
blockUpper[faceI](loc1, loc2) += upper[faceI];
|
||||
blockLower[faceI](loc1, loc2) += lower[faceI];
|
||||
}
|
||||
|
||||
// Update coupling contributions
|
||||
const volScalarField& psi = matrix.psi();
|
||||
forAll(psi.boundaryField(), patchI)
|
||||
{
|
||||
const fvPatchScalarField& pf = psi.boundaryField()[patchI];
|
||||
const fvPatch& patch = pf.patch();
|
||||
|
||||
if (patch.coupled())
|
||||
{
|
||||
const scalarField& icp = matrix.internalCoeffs()[patchI];
|
||||
const scalarField& bcp = matrix.boundaryCoeffs()[patchI];
|
||||
|
||||
typename CoeffField<blockType>::squareTypeField& pcoupleUpper =
|
||||
A.coupleUpper()[patchI].asSquare();
|
||||
typename CoeffField<blockType>::squareTypeField& pcoupleLower =
|
||||
A.coupleLower()[patchI].asSquare();
|
||||
|
||||
forAll(pf, faceI)
|
||||
{
|
||||
pcoupleUpper[faceI](loc1, loc2) = bcp[faceI];
|
||||
pcoupleLower[faceI](loc1, loc2) = icp[faceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
@ -158,6 +158,135 @@ namespace blockMatrixTools
|
|||
Field<BlockType>& x,
|
||||
Field<BlockType>& b
|
||||
);
|
||||
|
||||
//- Tools specific to pU coupled block matrix
|
||||
|
||||
//- Insert field into block field to be solved for
|
||||
template<class blockType, class fieldType>
|
||||
void insertSolutionVector
|
||||
(
|
||||
const label loc,
|
||||
const Field<fieldType>& xSingle,
|
||||
Field<blockType>& xBlock
|
||||
);
|
||||
|
||||
//- Retrieve solved field from block field
|
||||
template<class blockType, class fieldType>
|
||||
void retrieveSolution
|
||||
(
|
||||
const label loc,
|
||||
Field<fieldType>& xSingle,
|
||||
const Field<blockType>& xBlock
|
||||
);
|
||||
|
||||
//- Insert matrix diagonal and source into the block system
|
||||
template<class blockType, class matrixType>
|
||||
void insertDiagSource
|
||||
(
|
||||
const label loc,
|
||||
fvMatrix<matrixType>& matrix,
|
||||
BlockLduMatrix<blockType>& A,
|
||||
Field<blockType>& b
|
||||
);
|
||||
|
||||
// Insert upper and lower part into the block system
|
||||
template<class blockType, class matrixType>
|
||||
void insertUpperLower
|
||||
(
|
||||
const label loc,
|
||||
const fvMatrix<matrixType>& matrix,
|
||||
BlockLduMatrix<blockType>& A
|
||||
);
|
||||
|
||||
// Update coupling coefficients in the block matrix
|
||||
template<class blockType, class matrixType>
|
||||
void updateCouplingCoeffs
|
||||
(
|
||||
const label loc,
|
||||
const fvMatrix<matrixType>& matrix,
|
||||
BlockLduMatrix<blockType>& A
|
||||
);
|
||||
|
||||
// Insert matrix into the block system
|
||||
template<class blockType, class matrixType>
|
||||
void insertEquation
|
||||
(
|
||||
const label loc,
|
||||
fvMatrix<matrixType>& matrix,
|
||||
BlockLduMatrix<blockType>& A,
|
||||
Field<blockType>& x,
|
||||
Field<blockType>& b
|
||||
);
|
||||
|
||||
// Insert block coupling
|
||||
template<class blockType1, class blockType2>
|
||||
void insertBlock
|
||||
(
|
||||
const label loc1,
|
||||
const label loc2,
|
||||
const BlockLduMatrix<blockType1>& blockMatrix,
|
||||
BlockLduMatrix<blockType2>& A,
|
||||
const bool incFirst
|
||||
);
|
||||
|
||||
// Insert boundary contributions. These functions update the matrix coeffs
|
||||
// according to boundary conditions. Two functions are needed for
|
||||
// specialization if the field is scalar or vector. If the field is scalar,
|
||||
// it is assumed that the grad(p) was used to obtain the matrix, and the
|
||||
// boundary contributions to the source are vectors. If the field is
|
||||
// vector, assumed is the div(U) and the source is scalar.
|
||||
// Note parameter GeometricField<scalar...>, this is grad specialization.
|
||||
template<class blockType1, class blockType2>
|
||||
void insertBoundaryContributions
|
||||
(
|
||||
const label loc1,
|
||||
const label loc2,
|
||||
const BlockLduMatrix<blockType1>& blockMatrix,
|
||||
GeometricField<scalar, fvPatchField, volMesh>& psi,
|
||||
BlockLduMatrix<blockType2>& A,
|
||||
Field<blockType2>& b,
|
||||
const bool incFirst
|
||||
);
|
||||
|
||||
// Note parameter GeometricField<vector...>, this is div specialization.
|
||||
template<class blockType1, class blockType2>
|
||||
void insertBoundaryContributions
|
||||
(
|
||||
const label loc1,
|
||||
const label loc2,
|
||||
const BlockLduMatrix<blockType1>& blockMatrix,
|
||||
GeometricField<vector, fvPatchField, volMesh>& psi,
|
||||
BlockLduMatrix<blockType2>& A,
|
||||
Field<blockType2>& b,
|
||||
const bool incFirst
|
||||
);
|
||||
|
||||
// Insert existing block matrix (obtained by implicit grad/div operator)
|
||||
// into block system, updating the matrix coefficients from boundaries.
|
||||
// To be used ONLY for pressure velocity coupling terms, other scenarios
|
||||
// are not considered at the moment.
|
||||
template<class blockType1, class blockType2, class fieldType>
|
||||
void insertBlockCoupling
|
||||
(
|
||||
const label loc1,
|
||||
const label loc2,
|
||||
const BlockLduMatrix<blockType1>& blockMatrix,
|
||||
GeometricField<fieldType, fvPatchField, volMesh>& psi,
|
||||
BlockLduMatrix<blockType2>& A,
|
||||
Field<blockType2>& b,
|
||||
const bool incFirst
|
||||
);
|
||||
|
||||
// Insert scalar equation coupling. Not tested: VV, 9/May/2014
|
||||
template<class blockType>
|
||||
void insertEquationCoupling
|
||||
(
|
||||
const label loc1,
|
||||
const label loc2,
|
||||
fvScalarMatrix& matrix,
|
||||
BlockLduMatrix<blockType>& A,
|
||||
Field<blockType> b
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ SourceFiles
|
|||
#include "linear.H"
|
||||
#include "typeInfo.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "blockLduMatrices.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -150,6 +151,13 @@ public:
|
|||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>&
|
||||
) = 0;
|
||||
|
||||
//- Return the blockLduMatrix<vector> corresponding to the implicit
|
||||
// div discretization. For block coupled system.
|
||||
virtual tmp<blockVectorMatrix> fvmDiv
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>&
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -68,6 +68,42 @@ gaussDivScheme<Type>::fvcDiv
|
|||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<blockVectorMatrix> gaussDivScheme<Type>::fvmDiv
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||
) const
|
||||
{
|
||||
tmp<surfaceScalarField> tweights = this->tinterpScheme_().weights(vf);
|
||||
const scalarField& wIn = tweights().internalField();
|
||||
|
||||
const fvMesh& mesh = vf.mesh();
|
||||
|
||||
tmp<blockVectorMatrix> tbm
|
||||
(
|
||||
new blockVectorMatrix
|
||||
(
|
||||
mesh
|
||||
)
|
||||
);
|
||||
blockVectorMatrix& bm = tbm();
|
||||
|
||||
// Grab ldu parts of block matrix as linear always
|
||||
typename CoeffField<vector>::linearTypeField& u = bm.upper().asLinear();
|
||||
typename CoeffField<vector>::linearTypeField& l = bm.lower().asLinear();
|
||||
|
||||
const vectorField& SfIn = mesh.Sf().internalField();
|
||||
|
||||
l = -wIn*SfIn;
|
||||
u = l + SfIn;
|
||||
bm.negSumDiag();
|
||||
|
||||
// Interpolation schemes with corrections not accounted for
|
||||
|
||||
return tbm;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fv
|
||||
|
|
|
@ -96,6 +96,13 @@ public:
|
|||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>&
|
||||
);
|
||||
|
||||
//- Return the blockLduMatrix<vector> corresponding to the implicit
|
||||
// div discretization. For block coupled system.
|
||||
tmp<blockVectorMatrix> fvmDiv
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>&
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ Description
|
|||
#include "fvmDdt.H"
|
||||
#include "fvmD2dt2.H"
|
||||
#include "fvmDiv.H"
|
||||
#include "fvmGrad.H"
|
||||
#include "fvmAdjDiv.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "fvmSup.H"
|
||||
|
|
|
@ -26,6 +26,7 @@ License
|
|||
#include "fvmDiv.H"
|
||||
#include "fvMesh.H"
|
||||
#include "convectionScheme.H"
|
||||
#include "divScheme.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -83,6 +84,7 @@ div
|
|||
return fvm::div(flux, vf, "div("+flux.name()+','+vf.name()+')');
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<fvMatrix<Type> >
|
||||
div
|
||||
|
@ -96,6 +98,34 @@ div
|
|||
return Div;
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
tmp<BlockLduMatrix<vector> > div
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||
const word& name
|
||||
)
|
||||
{
|
||||
return fv::divScheme<Type>::New
|
||||
(
|
||||
vf.mesh(),
|
||||
vf.mesh().schemesDict().divScheme(name)
|
||||
)().fvmDiv(vf);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<BlockLduMatrix<vector> > div
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>& vf
|
||||
)
|
||||
{
|
||||
return fvm::div
|
||||
(
|
||||
vf,
|
||||
"div(" + vf.name() + ')'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ SourceFiles
|
|||
#include "surfaceFieldsFwd.H"
|
||||
#include "surfaceInterpolationScheme.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "blockLduMatrices.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -81,6 +82,20 @@ namespace fvm
|
|||
const tmp<surfaceScalarField>&,
|
||||
GeometricField<Type, fvPatchField, volMesh>&
|
||||
);
|
||||
|
||||
// Implicit div operator for block systems
|
||||
template<class Type>
|
||||
tmp<blockVectorMatrix> div
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>&,
|
||||
const word&
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<blockVectorMatrix> div
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>&
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
79
src/finiteVolume/finiteVolume/fvm/fvmGrad.C
Normal file
79
src/finiteVolume/finiteVolume/fvm/fvmGrad.C
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvmGrad.H"
|
||||
#include "gradScheme.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace fvm
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
tmp<blockVectorMatrix> grad
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||
const word& name
|
||||
)
|
||||
{
|
||||
return fv::gradScheme<Type>::New
|
||||
(
|
||||
vf.mesh(),
|
||||
vf.mesh().schemesDict().gradScheme(name)
|
||||
)().fvmGrad(vf);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<blockVectorMatrix> grad
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>& vf
|
||||
)
|
||||
{
|
||||
return fvm::grad
|
||||
(
|
||||
vf,
|
||||
"grad(" + vf.name() + ')'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fvm
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
85
src/finiteVolume/finiteVolume/fvm/fvmGrad.H
Normal file
85
src/finiteVolume/finiteVolume/fvm/fvmGrad.H
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
InNamespace
|
||||
Foam::fvm
|
||||
|
||||
Description
|
||||
Calculate the blockLduMatrx for the gradient of the field.
|
||||
BlockLduMatrix will always be of type <vector>. Intended use: block
|
||||
coupled solvers. i.e. implicit grad(p) in momentum equation.
|
||||
|
||||
SourceFiles
|
||||
fvmGrad.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fvmGrad_H
|
||||
#define fvmGrad_H
|
||||
|
||||
#include "volFieldsFwd.H"
|
||||
#include "blockLduMatrices.H"
|
||||
#include "geometricOneField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Namespace fvm functions Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
namespace fvm
|
||||
{
|
||||
template<class Type>
|
||||
tmp<blockVectorMatrix> grad
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>&,
|
||||
const word&
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<blockVectorMatrix> grad
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>&
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "fvmGrad.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -145,6 +145,42 @@ gaussGrad<Type>::grad
|
|||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<blockVectorMatrix> gaussGrad<Type>::fvmGrad
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||
) const
|
||||
{
|
||||
tmp<surfaceScalarField> tweights = this->tinterpScheme_().weights(vf);
|
||||
const scalarField& wIn = tweights().internalField();
|
||||
|
||||
const fvMesh& mesh = vf.mesh();
|
||||
|
||||
tmp<blockVectorMatrix> tbm
|
||||
(
|
||||
new blockVectorMatrix
|
||||
(
|
||||
mesh
|
||||
)
|
||||
);
|
||||
blockVectorMatrix& bm = tbm();
|
||||
|
||||
// Grab ldu parts of block matrix as linear always
|
||||
typename CoeffField<vector>::linearTypeField& u = bm.upper().asLinear();
|
||||
typename CoeffField<vector>::linearTypeField& l = bm.lower().asLinear();
|
||||
|
||||
const vectorField& SfIn = mesh.Sf().internalField();
|
||||
|
||||
l = -wIn*SfIn;
|
||||
u = l + SfIn;
|
||||
bm.negSumDiag();
|
||||
|
||||
// Interpolation schemes with corrections not accounted for
|
||||
|
||||
return tbm;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fv
|
||||
|
|
|
@ -139,6 +139,14 @@ public:
|
|||
const GeometricField<Type, fvPatchField, volMesh>&
|
||||
) const;
|
||||
|
||||
//- Return the blockLduMatrix<vector> corresponding to the implicit
|
||||
// grad discretization. For block coupled systems.
|
||||
tmp<blockVectorMatrix> fvmGrad
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>&
|
||||
) const;
|
||||
|
||||
|
||||
// Correct boundary conditions moved to base class
|
||||
// HJ, 14/Jun/2013
|
||||
};
|
||||
|
|
|
@ -98,6 +98,33 @@ gradScheme<Type>::~gradScheme()
|
|||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
tmp<blockVectorMatrix> gradScheme<Type>::fvmGrad
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||
) const
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"tmp<blockVectorMatrix> fvmGrad\n",
|
||||
"(\n"
|
||||
" GeometricField<Type, fvPatchField, volMesh>&"
|
||||
")\n"
|
||||
) << "Implicit gradient operator currently defined only for Gauss grad."
|
||||
<< abort(FatalIOError);
|
||||
|
||||
tmp<blockVectorMatrix> tbm
|
||||
(
|
||||
new blockVectorMatrix
|
||||
(
|
||||
vf.mesh()
|
||||
)
|
||||
);
|
||||
|
||||
return tbm;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void gradScheme<Type>::correctBoundaryConditions
|
||||
(
|
||||
|
|
|
@ -40,6 +40,7 @@ SourceFiles
|
|||
#include "surfaceFieldsFwd.H"
|
||||
#include "typeInfo.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "blockLduMatrices.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -137,6 +138,14 @@ public:
|
|||
) const = 0;
|
||||
|
||||
|
||||
//- Return the blockLduMatrix<vector> corresponding to the implicit
|
||||
// grad discretization. For block coupled systems.
|
||||
virtual tmp<blockVectorMatrix> fvmGrad
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>&
|
||||
) const;
|
||||
|
||||
|
||||
// Moved from gaussGrad into base class. HJ, 14/Jun/2013
|
||||
//- Correct the boundary values of the gradient using the patchField
|
||||
// snGrad functions
|
||||
|
|
41
tutorials/incompressible/pUCoupledFoam/cavity/0/U
Normal file
41
tutorials/incompressible/pUCoupledFoam/cavity/0/U
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD |
|
||||
| \\ / O peration | Version: 1.6-ext |
|
||||
| \\ / A nd | Web: www.extend-project.de |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volVectorField;
|
||||
object U;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -1 0 0 0 0];
|
||||
|
||||
internalField uniform (0 0 0);
|
||||
|
||||
boundaryField
|
||||
{
|
||||
movingWall
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform (1 0 0);
|
||||
}
|
||||
|
||||
fixedWalls
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform (0 0 0);
|
||||
}
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
39
tutorials/incompressible/pUCoupledFoam/cavity/0/p
Normal file
39
tutorials/incompressible/pUCoupledFoam/cavity/0/p
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD |
|
||||
| \\ / O peration | Version: 1.6-ext |
|
||||
| \\ / A nd | Web: www.extend-project.de |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object p;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 2 -2 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
movingWall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
fixedWalls
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
11
tutorials/incompressible/pUCoupledFoam/cavity/Allclean
Executable file
11
tutorials/incompressible/pUCoupledFoam/cavity/Allclean
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Klas Jareteg, 2012-10-13
|
||||
# Description:
|
||||
# Script to run comparative case between coupled and segregated solvers.
|
||||
|
||||
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||
|
||||
cleanCase
|
15
tutorials/incompressible/pUCoupledFoam/cavity/Allrun
Executable file
15
tutorials/incompressible/pUCoupledFoam/cavity/Allrun
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Klas Jareteg, 2012-10-13
|
||||
# Description:
|
||||
# Script to run comparative case between coupled and segregated solvers.
|
||||
|
||||
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
application=pUCoupledFoam
|
||||
|
||||
runApplication blockMesh
|
||||
runApplication $application
|
||||
|
|
@ -0,0 +1,200 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD |
|
||||
| \\ / O peration | Version: 1.6-ext |
|
||||
| \\ / A nd | Web: www.extend-project.de |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object RASProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
RASModel laminar;
|
||||
|
||||
turbulence on;
|
||||
|
||||
printCoeffs on;
|
||||
|
||||
laminarCoeffs
|
||||
{
|
||||
}
|
||||
|
||||
kEpsilonCoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
alphaEps 0.76923;
|
||||
}
|
||||
|
||||
RNGkEpsilonCoeffs
|
||||
{
|
||||
Cmu 0.0845;
|
||||
C1 1.42;
|
||||
C2 1.68;
|
||||
alphak 1.39;
|
||||
alphaEps 1.39;
|
||||
eta0 4.38;
|
||||
beta 0.012;
|
||||
}
|
||||
|
||||
realizableKECoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
A0 4.0;
|
||||
C2 1.9;
|
||||
alphak 1;
|
||||
alphaEps 0.833333;
|
||||
}
|
||||
|
||||
kOmegaSSTCoeffs
|
||||
{
|
||||
alphaK1 0.85034;
|
||||
alphaK2 1.0;
|
||||
alphaOmega1 0.5;
|
||||
alphaOmega2 0.85616;
|
||||
gamma1 0.5532;
|
||||
gamma2 0.4403;
|
||||
beta1 0.0750;
|
||||
beta2 0.0828;
|
||||
betaStar 0.09;
|
||||
a1 0.31;
|
||||
c1 10;
|
||||
|
||||
Cmu 0.09;
|
||||
}
|
||||
|
||||
NonlinearKEShihCoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
alphak 1;
|
||||
alphaEps 0.76932;
|
||||
A1 1.25;
|
||||
A2 1000;
|
||||
Ctau1 -4;
|
||||
Ctau2 13;
|
||||
Ctau3 -2;
|
||||
alphaKsi 0.9;
|
||||
}
|
||||
|
||||
LienCubicKECoeffs
|
||||
{
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
alphak 1;
|
||||
alphaEps 0.76923;
|
||||
A1 1.25;
|
||||
A2 1000;
|
||||
Ctau1 -4;
|
||||
Ctau2 13;
|
||||
Ctau3 -2;
|
||||
alphaKsi 0.9;
|
||||
}
|
||||
|
||||
QZetaCoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
alphaZeta 0.76923;
|
||||
anisotropic no;
|
||||
}
|
||||
|
||||
LaunderSharmaKECoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
alphaEps 0.76923;
|
||||
}
|
||||
|
||||
LamBremhorstKECoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
alphaEps 0.76923;
|
||||
}
|
||||
|
||||
LienCubicKELowReCoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
alphak 1;
|
||||
alphaEps 0.76923;
|
||||
A1 1.25;
|
||||
A2 1000;
|
||||
Ctau1 -4;
|
||||
Ctau2 13;
|
||||
Ctau3 -2;
|
||||
alphaKsi 0.9;
|
||||
Am 0.016;
|
||||
Aepsilon 0.263;
|
||||
Amu 0.00222;
|
||||
}
|
||||
|
||||
LienLeschzinerLowReCoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
alphak 1;
|
||||
alphaEps 0.76923;
|
||||
Am 0.016;
|
||||
Aepsilon 0.263;
|
||||
Amu 0.00222;
|
||||
}
|
||||
|
||||
LRRCoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
Clrr1 1.8;
|
||||
Clrr2 0.6;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
Cs 0.25;
|
||||
Ceps 0.15;
|
||||
alphaEps 0.76923;
|
||||
}
|
||||
|
||||
LaunderGibsonRSTMCoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
Clg1 1.8;
|
||||
Clg2 0.6;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
C1Ref 0.5;
|
||||
C2Ref 0.3;
|
||||
Cs 0.25;
|
||||
Ceps 0.15;
|
||||
alphaEps 0.76923;
|
||||
alphaR 1.22;
|
||||
}
|
||||
|
||||
SpalartAllmarasCoeffs
|
||||
{
|
||||
alphaNut 1.5;
|
||||
Cb1 0.1355;
|
||||
Cb2 0.622;
|
||||
Cw2 0.3;
|
||||
Cw3 2;
|
||||
Cv1 7.1;
|
||||
Cv2 5.0;
|
||||
}
|
||||
|
||||
wallFunctionCoeffs
|
||||
{
|
||||
kappa 0.4187;
|
||||
E 9;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,63 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD |
|
||||
| \\ / O peration | Version: 1.6-ext |
|
||||
| \\ / A nd | Web: www.extend-project.de |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
convertToMeters 0.1;
|
||||
|
||||
vertices
|
||||
(
|
||||
(0 0 0)
|
||||
(1 0 0)
|
||||
(1 1 0)
|
||||
(0 1 0)
|
||||
(0 0 0.1)
|
||||
(1 0 0.1)
|
||||
(1 1 0.1)
|
||||
(0 1 0.1)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (50 50 1) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
patches
|
||||
(
|
||||
wall movingWall
|
||||
(
|
||||
(3 7 6 2)
|
||||
)
|
||||
wall fixedWalls
|
||||
(
|
||||
(0 4 7 3)
|
||||
(2 6 5 1)
|
||||
(1 5 4 0)
|
||||
)
|
||||
empty frontAndBack
|
||||
(
|
||||
(0 3 2 1)
|
||||
(4 5 6 7)
|
||||
)
|
||||
);
|
||||
|
||||
mergePatchPairs
|
||||
(
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,40 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | foam-extend: Open Source CFD |
|
||||
| \\ / O peration | Version: 3.0 |
|
||||
| \\ / A nd | Web: http://www.extend-project.de |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class polyBoundaryMesh;
|
||||
location "constant/polyMesh";
|
||||
object boundary;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
3
|
||||
(
|
||||
movingWall
|
||||
{
|
||||
type wall;
|
||||
nFaces 50;
|
||||
startFace 4900;
|
||||
}
|
||||
fixedWalls
|
||||
{
|
||||
type wall;
|
||||
nFaces 150;
|
||||
startFace 4950;
|
||||
}
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
nFaces 5000;
|
||||
startFace 5100;
|
||||
}
|
||||
)
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,21 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD |
|
||||
| \\ / O peration | Version: 1.6-ext |
|
||||
| \\ / A nd | Web: www.extend-project.de |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object transportProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
transportModel Newtonian;
|
||||
|
||||
nu nu [0 2 -1 0 0 0 0] 0.01;
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,47 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD |
|
||||
| \\ / O peration | Version: 1.6-ext |
|
||||
| \\ / A nd | Web: www.extend-project.de |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application pUCoupledFoam;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 0.5;
|
||||
|
||||
deltaT 0.005;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 20;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
writeCompression uncompressed;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,59 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD |
|
||||
| \\ / O peration | Version: 1.6-ext |
|
||||
| \\ / A nd | Web: www.extend-project.de |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default steadyState;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) Gauss linearUpwind Gauss linear;
|
||||
div((nuEff*dev(grad(U).T()))) Gauss linear;
|
||||
|
||||
div(U) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default none;
|
||||
laplacian(nuEff,U) Gauss linear corrected;
|
||||
laplacian(rUAf,p) Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
p;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,38 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD |
|
||||
| \\ / O peration | Version: 1.6-ext |
|
||||
| \\ / A nd | Web: www.extend-project.de |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
Up
|
||||
{
|
||||
solver BiCGStab;
|
||||
preconditioner Cholesky;
|
||||
|
||||
tolerance 1e-09;
|
||||
relTol 0.0;
|
||||
|
||||
minIter 1;
|
||||
maxIter 500;
|
||||
}
|
||||
}
|
||||
|
||||
blockSolver
|
||||
{
|
||||
pRefCell 0;
|
||||
pRefValue 0;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
Reference in a new issue