Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2012-12-17 13:51:35 +00:00
100 changed files with 918 additions and 157 deletions

View File

@ -255,8 +255,10 @@ $(lduMatrix)/solvers/ICCG/ICCG.C
$(lduMatrix)/solvers/BICCG/BICCG.C
$(lduMatrix)/smoothers/GaussSeidel/GaussSeidelSmoother.C
$(lduMatrix)/smoothers/symGaussSeidel/symGaussSeidelSmoother.C
$(lduMatrix)/smoothers/nonBlockingGaussSeidel/nonBlockingGaussSeidelSmoother.C
$(lduMatrix)/smoothers/DIC/DICSmoother.C
$(lduMatrix)/smoothers/FDIC/FDICSmoother.C
$(lduMatrix)/smoothers/DICGaussSeidel/DICGaussSeidelSmoother.C
$(lduMatrix)/smoothers/DILU/DILUSmoother.C
$(lduMatrix)/smoothers/DILUGaussSeidel/DILUGaussSeidelSmoother.C

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
@ -98,17 +98,17 @@ void Foam::DICSmoother::smooth
rA *= rD_;
register label nFaces = matrix_.upper().size();
for (register label face=0; face<nFaces; face++)
for (register label facei=0; facei<nFaces; facei++)
{
register label u = uPtr[face];
rAPtr[u] -= rDPtr[u]*upperPtr[face]*rAPtr[lPtr[face]];
register label u = uPtr[facei];
rAPtr[u] -= rDPtr[u]*upperPtr[facei]*rAPtr[lPtr[facei]];
}
register label nFacesM1 = nFaces - 1;
for (register label face=nFacesM1; face>=0; face--)
for (register label facei=nFacesM1; facei>=0; facei--)
{
register label l = lPtr[face];
rAPtr[l] -= rDPtr[l]*upperPtr[face]*rAPtr[uPtr[face]];
register label l = lPtr[facei];
rAPtr[l] -= rDPtr[l]*upperPtr[facei]*rAPtr[uPtr[facei]];
}
psi += rA;

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
\*---------------------------------------------------------------------------*/
#include "FDICSmoother.H"
#include "FDICPreconditioner.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(FDICSmoother, 0);
lduMatrix::smoother::addsymMatrixConstructorToTable<FDICSmoother>
addFDICSmootherSymMatrixConstructorToTable_;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::FDICSmoother::FDICSmoother
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces
)
:
lduMatrix::smoother
(
fieldName,
matrix,
interfaceBouCoeffs,
interfaceIntCoeffs,
interfaces
),
rD_(matrix_.diag()),
rDuUpper_(matrix_.upper().size()),
rDlUpper_(matrix_.upper().size())
{
scalar* __restrict__ rDPtr = rD_.begin();
scalar* __restrict__ rDuUpperPtr = rDuUpper_.begin();
scalar* __restrict__ rDlUpperPtr = rDlUpper_.begin();
const label* const __restrict__ uPtr =
matrix_.lduAddr().upperAddr().begin();
const label* const __restrict__ lPtr =
matrix_.lduAddr().lowerAddr().begin();
const scalar* const __restrict__ upperPtr =
matrix_.upper().begin();
register label nCells = rD_.size();
register label nFaces = matrix_.upper().size();
for (register label face=0; face<nFaces; face++)
{
rDPtr[uPtr[face]] -= sqr(upperPtr[face])/rDPtr[lPtr[face]];
}
// Generate reciprocal FDIC
for (register label cell=0; cell<nCells; cell++)
{
rDPtr[cell] = 1.0/rDPtr[cell];
}
for (register label face=0; face<nFaces; face++)
{
rDuUpperPtr[face] = rDPtr[uPtr[face]]*upperPtr[face];
rDlUpperPtr[face] = rDPtr[lPtr[face]]*upperPtr[face];
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::FDICSmoother::smooth
(
scalarField& psi,
const scalarField& source,
const direction cmpt,
const label nSweeps
) const
{
const scalar* const __restrict__ rDuUpperPtr = rDuUpper_.begin();
const scalar* const __restrict__ rDlUpperPtr = rDlUpper_.begin();
const label* const __restrict__ uPtr =
matrix_.lduAddr().upperAddr().begin();
const label* const __restrict__ lPtr =
matrix_.lduAddr().lowerAddr().begin();
// Temporary storage for the residual
scalarField rA(rD_.size());
scalar* __restrict__ rAPtr = rA.begin();
for (label sweep=0; sweep<nSweeps; sweep++)
{
matrix_.residual
(
rA,
psi,
source,
interfaceBouCoeffs_,
interfaces_,
cmpt
);
rA *= rD_;
register label nFaces = matrix_.upper().size();
for (register label face=0; face<nFaces; face++)
{
rAPtr[uPtr[face]] -= rDuUpperPtr[face]*rAPtr[lPtr[face]];
}
register label nFacesM1 = nFaces - 1;
for (register label face=nFacesM1; face>=0; face--)
{
rAPtr[lPtr[face]] -= rDlUpperPtr[face]*rAPtr[uPtr[face]];
}
psi += rA;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
Class
Foam::FDICSmoother
Description
Simplified diagonal-based incomplete Cholesky smoother for symmetric
matrices.
To improve efficiency, the residual is evaluated after every nSweeps
sweeps.
SourceFiles
FDICSmoother.C
\*---------------------------------------------------------------------------*/
#ifndef FDICSmoother_H
#define FDICSmoother_H
#include "lduMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class FDICSmoother Declaration
\*---------------------------------------------------------------------------*/
class FDICSmoother
:
public lduMatrix::smoother
{
// Private data
//- The reciprocal preconditioned diagonal
scalarField rD_;
scalarField rDuUpper_;
scalarField rDlUpper_;
public:
//- Runtime type information
TypeName("FDIC");
// Constructors
//- Construct from matrix components
FDICSmoother
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces
);
// Member Functions
//- Smooth the solution for a given number of sweeps
void smooth
(
scalarField& psi,
const scalarField& source,
const direction cmpt,
const label nSweeps
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -107,20 +107,12 @@ void Foam::GaussSeidelSmoother::smooth
// To compensate for this, it is necessary to turn the
// sign of the contribution.
//FieldField<Field, scalar> mBouCoeffs(interfaceBouCoeffs_.size());
//
//forAll(mBouCoeffs, patchi)
//{
// if (interfaces_.set(patchi))
// {
// mBouCoeffs.set(patchi, -interfaceBouCoeffs_[patchi]);
// }
//}
FieldField<Field, scalar>& mBouCoeffs =
const_cast<FieldField<Field, scalar>&>
(
interfaceBouCoeffs_
);
forAll(mBouCoeffs, patchi)
{
if (interfaces_.set(patchi))
@ -152,35 +144,35 @@ void Foam::GaussSeidelSmoother::smooth
cmpt
);
register scalar curPsi;
register scalar psii;
register label fStart;
register label fEnd = ownStartPtr[0];
for (register label cellI=0; cellI<nCells; cellI++)
for (register label celli=0; celli<nCells; celli++)
{
// Start and end of this row
fStart = fEnd;
fEnd = ownStartPtr[cellI + 1];
fEnd = ownStartPtr[celli + 1];
// Get the accumulated neighbour side
curPsi = bPrimePtr[cellI];
psii = bPrimePtr[celli];
// Accumulate the owner product side
for (register label curFace=fStart; curFace<fEnd; curFace++)
for (register label facei=fStart; facei<fEnd; facei++)
{
curPsi -= upperPtr[curFace]*psiPtr[uPtr[curFace]];
psii -= upperPtr[facei]*psiPtr[uPtr[facei]];
}
// Finish current psi
curPsi /= diagPtr[cellI];
// Finish psi for this cell
psii /= diagPtr[celli];
// Distribute the neighbour side using current psi
for (register label curFace=fStart; curFace<fEnd; curFace++)
// Distribute the neighbour side using psi for this cell
for (register label facei=fStart; facei<fEnd; facei++)
{
bPrimePtr[uPtr[curFace]] -= lowerPtr[curFace]*curPsi;
bPrimePtr[uPtr[facei]] -= lowerPtr[facei]*psii;
}
psiPtr[cellI] = curPsi;
psiPtr[celli] = psii;
}
}

View File

@ -0,0 +1,241 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
\*---------------------------------------------------------------------------*/
#include "symGaussSeidelSmoother.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(symGaussSeidelSmoother, 0);
lduMatrix::smoother::addsymMatrixConstructorToTable<symGaussSeidelSmoother>
addsymGaussSeidelSmootherSymMatrixConstructorToTable_;
lduMatrix::smoother::addasymMatrixConstructorToTable<symGaussSeidelSmoother>
addsymGaussSeidelSmootherAsymMatrixConstructorToTable_;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::symGaussSeidelSmoother::symGaussSeidelSmoother
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces
)
:
lduMatrix::smoother
(
fieldName,
matrix,
interfaceBouCoeffs,
interfaceIntCoeffs,
interfaces
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::symGaussSeidelSmoother::smooth
(
const word& fieldName_,
scalarField& psi,
const lduMatrix& matrix_,
const scalarField& source,
const FieldField<Field, scalar>& interfaceBouCoeffs_,
const lduInterfaceFieldPtrsList& interfaces_,
const direction cmpt,
const label nSweeps
)
{
register scalar* __restrict__ psiPtr = psi.begin();
register const label nCells = psi.size();
scalarField bPrime(nCells);
register scalar* __restrict__ bPrimePtr = bPrime.begin();
register const scalar* const __restrict__ diagPtr = matrix_.diag().begin();
register const scalar* const __restrict__ upperPtr =
matrix_.upper().begin();
register const scalar* const __restrict__ lowerPtr =
matrix_.lower().begin();
register const label* const __restrict__ uPtr =
matrix_.lduAddr().upperAddr().begin();
register const label* const __restrict__ ownStartPtr =
matrix_.lduAddr().ownerStartAddr().begin();
// Parallel boundary initialisation. The parallel boundary is treated
// as an effective jacobi interface in the boundary.
// Note: there is a change of sign in the coupled
// interface update. The reason for this is that the
// internal coefficients are all located at the l.h.s. of
// the matrix whereas the "implicit" coefficients on the
// coupled boundaries are all created as if the
// coefficient contribution is of a source-kind (i.e. they
// have a sign as if they are on the r.h.s. of the matrix.
// To compensate for this, it is necessary to turn the
// sign of the contribution.
FieldField<Field, scalar>& mBouCoeffs =
const_cast<FieldField<Field, scalar>&>
(
interfaceBouCoeffs_
);
forAll(mBouCoeffs, patchi)
{
if (interfaces_.set(patchi))
{
mBouCoeffs[patchi].negate();
}
}
for (label sweep=0; sweep<nSweeps; sweep++)
{
bPrime = source;
matrix_.initMatrixInterfaces
(
mBouCoeffs,
interfaces_,
psi,
bPrime,
cmpt
);
matrix_.updateMatrixInterfaces
(
mBouCoeffs,
interfaces_,
psi,
bPrime,
cmpt
);
register scalar psii;
register label fStart;
register label fEnd = ownStartPtr[0];
for (register label celli=0; celli<nCells; celli++)
{
// Start and end of this row
fStart = fEnd;
fEnd = ownStartPtr[celli + 1];
// Get the accumulated neighbour side
psii = bPrimePtr[celli];
// Accumulate the owner product side
for (register label facei=fStart; facei<fEnd; facei++)
{
psii -= upperPtr[facei]*psiPtr[uPtr[facei]];
}
// Finish current psi
psii /= diagPtr[celli];
// Distribute the neighbour side using current psi
for (register label facei=fStart; facei<fEnd; facei++)
{
bPrimePtr[uPtr[facei]] -= lowerPtr[facei]*psii;
}
psiPtr[celli] = psii;
}
fStart = ownStartPtr[nCells];
for (register label celli=nCells-1; celli>=0; celli--)
{
// Start and end of this row
fEnd = fStart;
fStart = ownStartPtr[celli];
// Get the accumulated neighbour side
psii = bPrimePtr[celli];
// Accumulate the owner product side
for (register label facei=fStart; facei<fEnd; facei++)
{
psii -= upperPtr[facei]*psiPtr[uPtr[facei]];
}
// Finish psi for this cell
psii /= diagPtr[celli];
// Distribute the neighbour side using psi for this cell
for (register label facei=fStart; facei<fEnd; facei++)
{
bPrimePtr[uPtr[facei]] -= lowerPtr[facei]*psii;
}
psiPtr[celli] = psii;
}
}
// Restore interfaceBouCoeffs_
forAll(mBouCoeffs, patchi)
{
if (interfaces_.set(patchi))
{
mBouCoeffs[patchi].negate();
}
}
}
void Foam::symGaussSeidelSmoother::smooth
(
scalarField& psi,
const scalarField& source,
const direction cmpt,
const label nSweeps
) const
{
smooth
(
fieldName_,
psi,
matrix_,
source,
interfaceBouCoeffs_,
interfaces_,
cmpt,
nSweeps
);
}
// ************************************************************************* //

View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
Class
Foam::symGaussSeidelSmoother
Description
A lduMatrix::smoother for symmetric Gauss-Seidel
SourceFiles
symGaussSeidelSmoother.C
\*---------------------------------------------------------------------------*/
#ifndef symGaussSeidelSmoother_H
#define symGaussSeidelSmoother_H
#include "lduMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class symGaussSeidelSmoother Declaration
\*---------------------------------------------------------------------------*/
class symGaussSeidelSmoother
:
public lduMatrix::smoother
{
public:
//- Runtime type information
TypeName("symGaussSeidel");
// Constructors
//- Construct from components
symGaussSeidelSmoother
(
const word& fieldName,
const lduMatrix& matrix,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const FieldField<Field, scalar>& interfaceIntCoeffs,
const lduInterfaceFieldPtrsList& interfaces
);
// Member Functions
//- Smooth for the given number of sweeps
static void smooth
(
const word& fieldName,
scalarField& psi,
const lduMatrix& matrix,
const scalarField& source,
const FieldField<Field, scalar>& interfaceBouCoeffs,
const lduInterfaceFieldPtrsList& interfaces,
const direction cmpt,
const label nSweeps
);
//- Smooth the solution for a given number of sweeps
virtual void smooth
(
scalarField& psi,
const scalarField& Source,
const direction cmpt,
const label nSweeps
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
@ -46,13 +46,10 @@ tmp<fvMatrix<Type> >
gaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected
(
const surfaceScalarField& gammaMagSf,
const surfaceScalarField& deltaCoeffs,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<surfaceScalarField> tdeltaCoeffs =
this->tsnGradScheme_().deltaCoeffs(vf);
const surfaceScalarField& deltaCoeffs = tdeltaCoeffs();
tmp<fvMatrix<Type> > tfvm
(
new fvMatrix<Type>
@ -66,14 +63,14 @@ gaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected
fvm.upper() = deltaCoeffs.internalField()*gammaMagSf.internalField();
fvm.negSumDiag();
forAll(vf.boundaryField(), patchI)
forAll(vf.boundaryField(), patchi)
{
const fvPatchField<Type>& psf = vf.boundaryField()[patchI];
const fvPatchField<Type>& psf = vf.boundaryField()[patchi];
const fvsPatchScalarField& patchGamma =
gammaMagSf.boundaryField()[patchI];
gammaMagSf.boundaryField()[patchi];
fvm.internalCoeffs()[patchI] = patchGamma*psf.gradientInternalCoeffs();
fvm.boundaryCoeffs()[patchI] = -patchGamma*psf.gradientBoundaryCoeffs();
fvm.internalCoeffs()[patchi] = patchGamma*psf.gradientInternalCoeffs();
fvm.boundaryCoeffs()[patchi] = -patchGamma*psf.gradientBoundaryCoeffs();
}
return tfvm;
@ -162,7 +159,12 @@ gaussLaplacianScheme<Type, GType>::fvmLaplacian
);
const surfaceVectorField SfGammaCorr(SfGamma - SfGammaSn*Sn);
tmp<fvMatrix<Type> > tfvm = fvmLaplacianUncorrected(SfGammaSn, vf);
tmp<fvMatrix<Type> > tfvm = fvmLaplacianUncorrected
(
SfGammaSn,
this->tsnGradScheme_().deltaCoeffs(vf),
vf
);
fvMatrix<Type>& fvm = tfvm();
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tfaceFluxCorrection

View File

@ -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
@ -58,12 +58,6 @@ class gaussLaplacianScheme
{
// Private Member Functions
tmp<fvMatrix<Type> > fvmLaplacianUncorrected
(
const surfaceScalarField& gammaMagSf,
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > gammaSnGradCorr
(
const surfaceVectorField& SfGammaCorr,
@ -116,6 +110,13 @@ public:
// Member Functions
static tmp<fvMatrix<Type> > fvmLaplacianUncorrected
(
const surfaceScalarField& gammaMagSf,
const surfaceScalarField& deltaCoeffs,
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcLaplacian
(
const GeometricField<Type, fvPatchField, volMesh>&

View File

@ -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
@ -53,7 +53,12 @@ Foam::fv::gaussLaplacianScheme<Foam::Type, Foam::scalar>::fvmLaplacian \
gamma*mesh.magSf() \
); \
\
tmp<fvMatrix<Type> > tfvm = fvmLaplacianUncorrected(gammaMagSf, vf); \
tmp<fvMatrix<Type> > tfvm = fvmLaplacianUncorrected \
( \
gammaMagSf, \
this->tsnGradScheme_().deltaCoeffs(vf), \
vf \
); \
fvMatrix<Type>& fvm = tfvm(); \
\
if (this->tsnGradScheme_().corrected()) \

View File

@ -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
@ -111,7 +111,7 @@ snGradScheme<Type>::snGrad
const fvMesh& mesh = vf.mesh();
// construct GeometricField<Type, fvsPatchField, surfaceMesh>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tssf
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf
(
new GeometricField<Type, fvsPatchField, surfaceMesh>
(
@ -127,7 +127,7 @@ snGradScheme<Type>::snGrad
vf.dimensions()*tdeltaCoeffs().dimensions()
)
);
GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tssf();
GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tsf();
// set reference to difference factors array
const scalarField& deltaCoeffs = tdeltaCoeffs().internalField();
@ -136,18 +136,30 @@ snGradScheme<Type>::snGrad
const labelUList& owner = mesh.owner();
const labelUList& neighbour = mesh.neighbour();
forAll(owner, faceI)
forAll(owner, facei)
{
ssf[faceI] =
deltaCoeffs[faceI]*(vf[neighbour[faceI]] - vf[owner[faceI]]);
ssf[facei] =
deltaCoeffs[facei]*(vf[neighbour[facei]] - vf[owner[facei]]);
}
forAll(vf.boundaryField(), patchI)
forAll(vf.boundaryField(), patchi)
{
ssf.boundaryField()[patchI] = vf.boundaryField()[patchI].snGrad();
ssf.boundaryField()[patchi] = vf.boundaryField()[patchi].snGrad();
}
return tssf;
return tsf;
}
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
snGradScheme<Type>::sndGrad
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& sndGradName
)
{
return snGrad(vf, vf.mesh().nonOrthDeltaCoeffs(), sndGradName);
}
@ -161,7 +173,9 @@ snGradScheme<Type>::snGrad
) const
{
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf
= snGrad(vf, deltaCoeffs(vf));
(
snGrad(vf, deltaCoeffs(vf))
);
if (corrected())
{
@ -181,10 +195,13 @@ snGradScheme<Type>::snGrad
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
) const
{
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tinterpVf
= snGrad(tvf());
tvf.clear();
return tinterpVf;
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf
(
snGrad(tvf())
);
tsf.clear();
return tsf;
}

View File

@ -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
@ -133,6 +133,14 @@ public:
const word& snGradName = "snGrad"
);
//- Return the sndGrad of the given cell field
static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
sndGrad
(
const GeometricField<Type, fvPatchField, volMesh>&,
const word& snGradName = "sndGrad"
);
//- Return the interpolation weighting factors for the given field
virtual tmp<surfaceScalarField> deltaCoeffs
(

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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