mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/repositories/OpenFOAM-dev
This commit is contained in:
@ -91,10 +91,7 @@ K = 0.5*magSqr(U);
|
||||
{
|
||||
rhoUf = fvc::interpolate(rho*U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
rhoUf +=
|
||||
mesh.Sf()
|
||||
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
|
||||
/sqr(mesh.magSf());
|
||||
rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf));
|
||||
}
|
||||
|
||||
if (thermo.dpdt())
|
||||
|
||||
@ -107,10 +107,7 @@ K = 0.5*magSqr(U);
|
||||
{
|
||||
rhoUf = fvc::interpolate(rho*U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
rhoUf +=
|
||||
mesh.Sf()
|
||||
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
|
||||
/sqr(mesh.magSf());
|
||||
rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf));
|
||||
}
|
||||
|
||||
if (thermo.dpdt())
|
||||
|
||||
@ -42,8 +42,5 @@ U.correctBoundaryConditions();
|
||||
{
|
||||
rhoUf = fvc::interpolate(rho*U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
rhoUf +=
|
||||
mesh.Sf()
|
||||
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
|
||||
/sqr(mesh.magSf());
|
||||
rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf));
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ fvOptions.correct(U);
|
||||
{
|
||||
Uf = fvc::interpolate(U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
Uf += mesh.Sf()*(phi - (mesh.Sf() & Uf))/sqr(mesh.magSf());
|
||||
Uf += n*(phi/mesh.magSf() - (n & Uf));
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
|
||||
@ -93,10 +93,7 @@ K = 0.5*magSqr(U);
|
||||
{
|
||||
rhoUf = fvc::interpolate(rho*U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
rhoUf +=
|
||||
mesh.Sf()
|
||||
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
|
||||
/sqr(mesh.magSf());
|
||||
rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf));
|
||||
}
|
||||
|
||||
if (thermo.dpdt())
|
||||
|
||||
@ -85,6 +85,6 @@
|
||||
{
|
||||
Uf = fvc::interpolate(U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
Uf += mesh.Sf()*(phiv - (mesh.Sf() & Uf))/sqr(mesh.magSf());
|
||||
Uf += n*(phiv/mesh.magSf() - (n & Uf));
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@
|
||||
{
|
||||
Uf = fvc::interpolate(U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
Uf += mesh.Sf()*(phi - (mesh.Sf() & Uf))/sqr(mesh.magSf());
|
||||
Uf += n*(phi/mesh.magSf() - (n & Uf));
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
|
||||
@ -55,10 +55,10 @@ int main(int argc, char *argv[])
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createFields.H"
|
||||
#include "createUf.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "createPrghCorrTypes.H"
|
||||
#include "correctPhi.H"
|
||||
#include "createUf.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
{
|
||||
Uf = fvc::interpolate(U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
Uf += mesh.Sf()*(phi - (mesh.Sf() & Uf))/sqr(mesh.magSf());
|
||||
Uf += n*(phi/mesh.magSf() - (n & Uf));
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
|
||||
@ -65,10 +65,10 @@ int main(int argc, char *argv[])
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createFields.H"
|
||||
#include "createUf.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "createPcorrTypes.H"
|
||||
#include "../interFoam/interDyMFoam/correctPhi.H"
|
||||
#include "createUf.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
{
|
||||
Uf = fvc::interpolate(U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
Uf += mesh.Sf()*(phi - (mesh.Sf() & Uf))/sqr(mesh.magSf());
|
||||
Uf += n*(phi/mesh.magSf() - (n & Uf));
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -125,6 +125,9 @@ public:
|
||||
//- Maximum number of iterations in the solver
|
||||
label maxIter_;
|
||||
|
||||
//- Minimum number of iterations in the solver
|
||||
label minIter_;
|
||||
|
||||
//- Final convergence tolerance
|
||||
Type tolerance_;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -135,6 +135,7 @@ Foam::LduMatrix<Type, DType, LUType>::solver::solver
|
||||
controlDict_(solverDict),
|
||||
|
||||
maxIter_(1000),
|
||||
minIter_(0),
|
||||
tolerance_(1e-6*pTraits<Type>::one),
|
||||
relTol_(pTraits<Type>::zero)
|
||||
{
|
||||
@ -148,6 +149,7 @@ template<class Type, class DType, class LUType>
|
||||
void Foam::LduMatrix<Type, DType, LUType>::solver::readControls()
|
||||
{
|
||||
readControl(controlDict_, maxIter_, "maxIter");
|
||||
readControl(controlDict_, minIter_, "minIter");
|
||||
readControl(controlDict_, tolerance_, "tolerance");
|
||||
readControl(controlDict_, relTol_, "relTol");
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -104,7 +104,11 @@ Foam::PBiCCCG<Type, DType, LUType>::solve
|
||||
solverPerf.finalResidual() = solverPerf.initialResidual();
|
||||
|
||||
// --- Check convergence, solve if not converged
|
||||
if (!solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
if
|
||||
(
|
||||
this->minIter_ > 0
|
||||
|| !solverPerf.checkConvergence(this->tolerance_, this->relTol_)
|
||||
)
|
||||
{
|
||||
// --- Select and construct the preconditioner
|
||||
autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner>
|
||||
@ -181,9 +185,12 @@ Foam::PBiCCCG<Type, DType, LUType>::solve
|
||||
cmptDivide(gSumCmptMag(rA), normFactor);
|
||||
|
||||
} while
|
||||
(
|
||||
(
|
||||
solverPerf.nIterations()++ < this->maxIter_
|
||||
&& !(solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
&& !solverPerf.checkConvergence(this->tolerance_, this->relTol_)
|
||||
)
|
||||
|| solverPerf.nIterations() < this->minIter_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -92,7 +92,11 @@ Foam::PCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
solverPerf.finalResidual() = solverPerf.initialResidual();
|
||||
|
||||
// --- Check convergence, solve if not converged
|
||||
if (!solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
if
|
||||
(
|
||||
this->minIter_ > 0
|
||||
|| !solverPerf.checkConvergence(this->tolerance_, this->relTol_)
|
||||
)
|
||||
{
|
||||
// --- Select and construct the preconditioner
|
||||
autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner>
|
||||
@ -173,9 +177,12 @@ Foam::PCICG<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
cmptDivide(gSumCmptMag(rA), normFactor);
|
||||
|
||||
} while
|
||||
(
|
||||
(
|
||||
solverPerf.nIterations()++ < this->maxIter_
|
||||
&& !(solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
&& !solverPerf.checkConvergence(this->tolerance_, this->relTol_)
|
||||
)
|
||||
|| solverPerf.nIterations() < this->minIter_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -113,7 +113,11 @@ Foam::SmoothSolver<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
|
||||
|
||||
// Check convergence, solve if not converged
|
||||
if (!solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
if
|
||||
(
|
||||
this->minIter_ > 0
|
||||
|| !solverPerf.checkConvergence(this->tolerance_, this->relTol_)
|
||||
)
|
||||
{
|
||||
autoPtr<typename LduMatrix<Type, DType, LUType>::smoother>
|
||||
smootherPtr = LduMatrix<Type, DType, LUType>::smoother::New
|
||||
@ -139,9 +143,12 @@ Foam::SmoothSolver<Type, DType, LUType>::solve(Field<Type>& psi) const
|
||||
normFactor
|
||||
);
|
||||
} while
|
||||
(
|
||||
(
|
||||
(solverPerf.nIterations() += nSweeps_) < this->maxIter_
|
||||
&& !(solverPerf.checkConvergence(this->tolerance_, this->relTol_))
|
||||
&& !solverPerf.checkConvergence(this->tolerance_, this->relTol_)
|
||||
)
|
||||
|| solverPerf.nIterations() < this->minIter_
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(lduMatrix, 1);
|
||||
defineTypeNameAndDebug(lduMatrix, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -107,6 +107,9 @@ public:
|
||||
//- Maximum number of iterations in the solver
|
||||
label maxIter_;
|
||||
|
||||
//- Minimum number of iterations in the solver
|
||||
label minIter_;
|
||||
|
||||
//- Final convergence tolerance
|
||||
scalar tolerance_;
|
||||
|
||||
|
||||
@ -164,6 +164,7 @@ Foam::lduMatrix::solver::solver
|
||||
void Foam::lduMatrix::solver::readControls()
|
||||
{
|
||||
maxIter_ = controlDict_.lookupOrDefault<label>("maxIter", 1000);
|
||||
minIter_ = controlDict_.lookupOrDefault<label>("minIter", 0);
|
||||
tolerance_ = controlDict_.lookupOrDefault<scalar>("tolerance", 1e-6);
|
||||
relTol_ = controlDict_.lookupOrDefault<scalar>("relTol", 0);
|
||||
}
|
||||
|
||||
@ -69,7 +69,11 @@ Foam::solverPerformance Foam::GAMGSolver::solve
|
||||
|
||||
|
||||
// Check convergence, solve if not converged
|
||||
if (!solverPerf.checkConvergence(tolerance_, relTol_))
|
||||
if
|
||||
(
|
||||
minIter_ > 0
|
||||
|| !solverPerf.checkConvergence(tolerance_, relTol_)
|
||||
)
|
||||
{
|
||||
// Create coarse grid correction fields
|
||||
PtrList<scalarField> coarseCorrFields;
|
||||
@ -130,9 +134,12 @@ Foam::solverPerformance Foam::GAMGSolver::solve
|
||||
solverPerf.print(Info(matrix().mesh().comm()));
|
||||
}
|
||||
} while
|
||||
(
|
||||
(
|
||||
++solverPerf.nIterations() < maxIter_
|
||||
&& !(solverPerf.checkConvergence(tolerance_, relTol_))
|
||||
&& !solverPerf.checkConvergence(tolerance_, relTol_)
|
||||
)
|
||||
|| solverPerf.nIterations() < minIter_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -120,7 +120,11 @@ Foam::solverPerformance Foam::PBiCG::solve
|
||||
solverPerf.finalResidual() = solverPerf.initialResidual();
|
||||
|
||||
// --- Check convergence, solve if not converged
|
||||
if (!solverPerf.checkConvergence(tolerance_, relTol_))
|
||||
if
|
||||
(
|
||||
minIter_ > 0
|
||||
|| !solverPerf.checkConvergence(tolerance_, relTol_)
|
||||
)
|
||||
{
|
||||
// --- Select and construct the preconditioner
|
||||
autoPtr<lduMatrix::preconditioner> preconPtr =
|
||||
@ -191,9 +195,12 @@ Foam::solverPerformance Foam::PBiCG::solve
|
||||
gSumMag(rA, matrix().mesh().comm())
|
||||
/normFactor;
|
||||
} while
|
||||
(
|
||||
(
|
||||
solverPerf.nIterations()++ < maxIter_
|
||||
&& !(solverPerf.checkConvergence(tolerance_, relTol_))
|
||||
&& !solverPerf.checkConvergence(tolerance_, relTol_)
|
||||
)
|
||||
|| solverPerf.nIterations() < minIter_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -111,7 +111,11 @@ Foam::solverPerformance Foam::PCG::solve
|
||||
solverPerf.finalResidual() = solverPerf.initialResidual();
|
||||
|
||||
// --- Check convergence, solve if not converged
|
||||
if (!solverPerf.checkConvergence(tolerance_, relTol_))
|
||||
if
|
||||
(
|
||||
minIter_ > 0
|
||||
|| !solverPerf.checkConvergence(tolerance_, relTol_)
|
||||
)
|
||||
{
|
||||
// --- Select and construct the preconditioner
|
||||
autoPtr<lduMatrix::preconditioner> preconPtr =
|
||||
@ -176,9 +180,12 @@ Foam::solverPerformance Foam::PCG::solve
|
||||
/normFactor;
|
||||
|
||||
} while
|
||||
(
|
||||
(
|
||||
solverPerf.nIterations()++ < maxIter_
|
||||
&& !(solverPerf.checkConvergence(tolerance_, relTol_))
|
||||
&& !solverPerf.checkConvergence(tolerance_, relTol_)
|
||||
)
|
||||
|| solverPerf.nIterations() < minIter_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -138,7 +138,11 @@ Foam::solverPerformance Foam::smoothSolver::solve
|
||||
|
||||
|
||||
// Check convergence, solve if not converged
|
||||
if (!solverPerf.checkConvergence(tolerance_, relTol_))
|
||||
if
|
||||
(
|
||||
minIter_ > 0
|
||||
|| !solverPerf.checkConvergence(tolerance_, relTol_)
|
||||
)
|
||||
{
|
||||
autoPtr<lduMatrix::smoother> smootherPtr = lduMatrix::smoother::New
|
||||
(
|
||||
@ -175,9 +179,12 @@ Foam::solverPerformance Foam::smoothSolver::solve
|
||||
matrix().mesh().comm()
|
||||
)/normFactor;
|
||||
} while
|
||||
(
|
||||
(
|
||||
(solverPerf.nIterations() += nSweeps_) < maxIter_
|
||||
&& !(solverPerf.checkConvergence(tolerance_, relTol_))
|
||||
&& !solverPerf.checkConvergence(tolerance_, relTol_)
|
||||
)
|
||||
|| solverPerf.nIterations() < minIter_
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,9 +46,14 @@ surfaceVectorField rhoUf
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(rho*U)
|
||||
fvc::interpolate(rho*U)
|
||||
);
|
||||
|
||||
{
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
rhoUf += n*(phi/mesh.magSf() - (n & rhoUf));
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
@ -46,9 +46,15 @@ surfaceVectorField Uf
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(U)
|
||||
fvc::interpolate(U)
|
||||
);
|
||||
|
||||
{
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
Uf += n*(phi/mesh.magSf() - (n & Uf));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user