ENH: Deactivate face/cell sources if no faces/cells present

This commit is contained in:
andy 2011-02-02 10:26:53 +00:00
parent 8eb9dcd547
commit 3bf2984e35
2 changed files with 32 additions and 3 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -122,7 +122,22 @@ void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
{
setCellZoneCells();
Info<< type() << " " << name_ << ":" << nl
if (nCells_ == 0)
{
WarningIn
(
"Foam::fieldValues::cellSource::initialise(const dictionary&)"
)
<< type() << " " << name_ << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Source has no cells - deactivating" << endl;
active_ = false;
return;
}
Info<< type() << " " << name_ << ":"
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " total cells = " << nCells_ << nl
<< " total volume = " << gSum(filterField(mesh().V()))
<< nl << endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -249,6 +249,20 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
}
}
if (nFaces_ == 0)
{
WarningIn
(
"Foam::fieldValues::faceSource::initialise(const dictionary&)"
)
<< type() << " " << name_ << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Source has no faces - deactivating" << endl;
active_ = false;
return;
}
scalar totalArea;
if (surfacePtr_.valid())