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

This commit is contained in:
mattijs
2013-07-11 11:29:58 +01:00
5 changed files with 39 additions and 18 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -54,10 +54,21 @@ buoyantPressureFvPatchScalarField
: :
fixedGradientFvPatchScalarField(p, iF), fixedGradientFvPatchScalarField(p, iF),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")) rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
if (dict.found("value") && dict.found("gradient"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
gradient() = scalarField("gradient", dict, p.size());
}
else
{ {
fvPatchField<scalar>::operator=(patchInternalField()); fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0; gradient() = 0.0;
} }
}
Foam::buoyantPressureFvPatchScalarField:: Foam::buoyantPressureFvPatchScalarField::

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -77,11 +77,13 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
DpName_(dict.lookupOrDefault<word>("Dp", "Dp")), DpName_(dict.lookupOrDefault<word>("Dp", "Dp")),
adjoint_(dict.lookupOrDefault<Switch>("adjoint", false)) adjoint_(dict.lookupOrDefault<Switch>("adjoint", false))
{ {
if (dict.found("gradient")) if (dict.found("value") && dict.found("gradient"))
{ {
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
gradient() = scalarField("gradient", dict, p.size()); gradient() = scalarField("gradient", dict, p.size());
fixedGradientFvPatchScalarField::updateCoeffs();
fixedGradientFvPatchScalarField::evaluate();
} }
else else
{ {
@ -190,7 +192,7 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fixedGradientFvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "phiHbyA", "phiHbyA", phiHbyAName_); writeEntryIfDifferent<word>(os, "phiHbyA", "phiHbyA", phiHbyAName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
@ -199,7 +201,7 @@ void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
{ {
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl; os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
} }
gradient().writeEntry("gradient", os); writeEntry("value", os);
} }

View File

@ -481,7 +481,8 @@ Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::faceAreaWeightAMI
const scalarField& srcMagSf, const scalarField& srcMagSf,
const scalarField& tgtMagSf, const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode, const faceAreaIntersect::triangulationMode& triMode,
const bool reverseTarget const bool reverseTarget,
const bool restartUncoveredSourceFace
) )
: :
AMIMethod<SourcePatch, TargetPatch> AMIMethod<SourcePatch, TargetPatch>
@ -492,7 +493,8 @@ Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::faceAreaWeightAMI
tgtMagSf, tgtMagSf,
triMode, triMode,
reverseTarget reverseTarget
) ),
restartUncoveredSourceFace_(restartUncoveredSourceFace)
{} {}
@ -557,7 +559,7 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
// Check for badly covered faces // Check for badly covered faces
if (debug) if (restartUncoveredSourceFace_)
{ {
restartUncoveredSourceFace restartUncoveredSourceFace
( (

View File

@ -51,6 +51,13 @@ class faceAreaWeightAMI
: :
public AMIMethod<SourcePatch, TargetPatch> public AMIMethod<SourcePatch, TargetPatch>
{ {
private:
// Private data
//- Flag to restart uncovered source faces
const bool restartUncoveredSourceFace_;
protected: protected:
@ -136,7 +143,8 @@ public:
const scalarField& srcMagSf, const scalarField& srcMagSf,
const scalarField& tgtMagSf, const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode, const faceAreaIntersect::triangulationMode& triMode,
const bool reverseTarget = false const bool reverseTarget = false,
const bool restartUncoveredSourceFace = true
); );

View File

@ -48,12 +48,10 @@ Foam::pointIndexHit Foam::searchableSphere::findNearest
pointIndexHit info(false, sample, -1); pointIndexHit info(false, sample, -1);
const vector n(sample - centre_); const vector n(sample - centre_);
scalar magSqrN = magSqr(n); scalar magN = mag(n);
if (nearestDistSqr >= magSqrN) if (nearestDistSqr >= sqr(magN - radius_))
{ {
scalar magN = Foam::sqrt(magSqrN);
if (magN < ROOTVSMALL) if (magN < ROOTVSMALL)
{ {
info.rawPoint() = centre_ + vector(1,0,0)*radius_; info.rawPoint() = centre_ + vector(1,0,0)*radius_;