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

Conflicts:
	src/parallel/decompose/scotchDecomp/scotchDecomp.C
This commit is contained in:
mattijs
2010-06-04 16:09:16 +01:00
1046 changed files with 4231 additions and 1807 deletions

View File

@ -497,10 +497,15 @@ $(Fields)/scalarField/scalarFieldIOField.C
$(Fields)/vectorField/vectorIOField.C
$(Fields)/vectorField/vectorFieldIOField.C
$(Fields)/vector2DField/vector2DIOField.C
$(Fields)/vector2DField/vector2DFieldIOField.C
$(Fields)/sphericalTensorField/sphericalTensorIOField.C
$(Fields)/sphericalTensorField/sphericalTensorFieldIOField.C
$(Fields)/diagTensorField/diagTensorIOField.C
$(Fields)/diagTensorField/diagTensorFieldIOField.C
$(Fields)/symmTensorField/symmTensorIOField.C
$(Fields)/symmTensorField/symmTensorFieldIOField.C
$(Fields)/tensorField/tensorIOField.C
$(Fields)/tensorField/tensorFieldIOField.C
$(Fields)/transformField/transformField.C
pointPatchFields = fields/pointPatchFields

View File

@ -33,25 +33,25 @@ Foam::NamedEnum<Enum, nEnum>::NamedEnum()
:
HashTable<int>(2*nEnum)
{
for (int i=0; i<nEnum; i++)
for (int enumI = 0; enumI < nEnum; ++enumI)
{
if (!names[i] || names[i][0] == '\0')
if (!names[enumI] || names[enumI][0] == '\0')
{
stringList goodNames(i);
stringList goodNames(enumI);
for (int j = 0; j < i; j++)
for (int i = 0; i < enumI; ++i)
{
goodNames[j] = names[j];
goodNames[i] = names[i];
}
FatalErrorIn("NamedEnum<Enum, nEnum>::NamedEnum()")
<< "Illegal enumeration name at position " << i << endl
<< "Illegal enumeration name at position " << enumI << endl
<< "after entries " << goodNames << ".\n"
<< "Possibly your NamedEnum<Enum, nEnum>::names array"
<< " is not of size " << nEnum << endl
<< abort(FatalError);
}
insert(names[i], i);
insert(names[enumI], enumI);
}
}
@ -61,7 +61,7 @@ Foam::NamedEnum<Enum, nEnum>::NamedEnum()
template<class Enum, int nEnum>
Enum Foam::NamedEnum<Enum, nEnum>::read(Istream& is) const
{
word name(is);
const word name(is);
HashTable<int>::const_iterator iter = find(name);
@ -71,7 +71,7 @@ Enum Foam::NamedEnum<Enum, nEnum>::read(Istream& is) const
(
"NamedEnum<Enum, nEnum>::read(Istream&) const", is
) << name << " is not in enumeration: "
<< toc() << exit(FatalIOError);
<< sortedToc() << exit(FatalIOError);
}
return Enum(iter());

View File

@ -597,8 +597,9 @@ bool Foam::Time::end() const
}
void Foam::Time::stopAt(const stopAtControls sa) const
bool Foam::Time::stopAt(const stopAtControls sa) const
{
const bool changed = (stopAt_ != sa);
stopAt_ = sa;
// adjust endTime
@ -610,6 +611,7 @@ void Foam::Time::stopAt(const stopAtControls sa) const
{
endTime_ = GREAT;
}
return changed;
}

View File

@ -434,7 +434,8 @@ public:
//- Adjust the current stopAtControl. Note that this value
// only persists until the next time the dictionary is read.
virtual void stopAt(const stopAtControls) const;
// Return true if the stopAtControl changed.
virtual bool stopAt(const stopAtControls) const;
//- Reset the time and time-index to those of the given time
virtual void setTime(const Time&);

View File

@ -191,10 +191,14 @@ public:
Istream&
);
//- Construct top-level dictionary from Istream, reading entries
// until EOF
//- Construct top-level dictionary from Istream,
// reading entries until EOF
dictionary(Istream&);
//- Construct top-level dictionary from Istream,
// reading entries until EOF, optionally keeping the header
dictionary(Istream&, const bool keepHeader);
//- Construct as copy given the parent dictionary
dictionary(const dictionary& parentDict, const dictionary&);
@ -441,6 +445,9 @@ public:
//- Read dictionary from Istream
bool read(Istream&);
//- Read dictionary from Istream, optionally keeping the header
bool read(Istream&, const bool keepHeader);
// Write

View File

@ -28,68 +28,6 @@ License
#include "inputModeEntry.H"
#include "regExp.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::dictionary::read(Istream& is)
{
if (!is.good())
{
FatalIOErrorIn("dictionary::read(Istream&, const word&)", is)
<< "Istream not OK for reading dictionary "
<< exit(FatalIOError);
return false;
}
token currToken(is);
if (currToken != token::BEGIN_BLOCK)
{
is.putBack(currToken);
}
while (!is.eof() && entry::New(*this, is))
{}
// Remove the FoamFile header entry if it exists
remove("FoamFile");
if (is.bad())
{
Info<< "dictionary::read(Istream&, const word&) : "
<< "Istream not OK after reading dictionary " << name()
<< endl;
return false;
}
return true;
}
bool Foam::dictionary::substituteKeyword(const word& keyword)
{
word varName = keyword(1, keyword.size()-1);
// lookup the variable name in the given dictionary
const entry* ePtr = lookupEntryPtr(varName, true, true);
// if defined insert its entries into this dictionary
if (ePtr != NULL)
{
const dictionary& addDict = ePtr->dict();
forAllConstIter(IDLList<entry>, addDict, iter)
{
add(iter());
}
return true;
}
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dictionary::dictionary
@ -118,12 +56,97 @@ Foam::dictionary::dictionary(Istream& is)
}
Foam::dictionary::dictionary(Istream& is, const bool keepHeader)
:
dictionaryName(is.name()),
parent_(dictionary::null)
{
// Reset input mode as this is a "top-level" dictionary
functionEntries::inputModeEntry::clear();
read(is, keepHeader);
}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::dictionary> Foam::dictionary::New(Istream& is)
{
return autoPtr<dictionary>(new dictionary(is));
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::dictionary::read(Istream& is, const bool keepHeader)
{
if (!is.good())
{
FatalIOErrorIn("dictionary::read(Istream&, bool)", is)
<< "Istream not OK for reading dictionary "
<< exit(FatalIOError);
return false;
}
token currToken(is);
if (currToken != token::BEGIN_BLOCK)
{
is.putBack(currToken);
}
while (!is.eof() && entry::New(*this, is))
{}
// normally remove the FoamFile header entry if it exists
if (!keepHeader)
{
remove("FoamFile");
}
if (is.bad())
{
Info<< "dictionary::read(Istream&, bool) : "
<< "Istream not OK after reading dictionary " << name()
<< endl;
return false;
}
return true;
}
bool Foam::dictionary::read(Istream& is)
{
return this->read(is, false);
}
bool Foam::dictionary::substituteKeyword(const word& keyword)
{
word varName = keyword(1, keyword.size()-1);
// lookup the variable name in the given dictionary
const entry* ePtr = lookupEntryPtr(varName, true, true);
// if defined insert its entries into this dictionary
if (ePtr != NULL)
{
const dictionary& addDict = ePtr->dict();
forAllConstIter(IDLList<entry>, addDict, iter)
{
add(iter());
}
return true;
}
return false;
}
// * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, dictionary& dict)
@ -145,7 +168,7 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const
{
if (subDict)
{
os << nl << indent << token::BEGIN_BLOCK << incrIndent << nl;
os << nl << indent << token::BEGIN_BLOCK << incrIndent << nl;
}
forAllConstIter(IDLList<entry>, *this, iter)
@ -153,12 +176,12 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const
const entry& e = *iter;
// Write entry
os << e;
os << e;
// Add extra new line between entries for "top-level" dictionaries
if (!subDict && parent() == dictionary::null && e != *last())
{
os << nl;
os << nl;
}
// Check stream before going to next entry.
@ -173,7 +196,7 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const
if (subDict)
{
os << decrIndent << indent << token::END_BLOCK << endl;
os << decrIndent << indent << token::END_BLOCK << endl;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -68,17 +68,27 @@ Foam::outputFilterOutputControl::~outputFilterOutputControl()
void Foam::outputFilterOutputControl::read(const dictionary& dict)
{
outputControl_ = outputControlNames_.read(dict.lookup("outputControl"));
if (dict.found("outputControl"))
{
outputControl_ = outputControlNames_.read(dict.lookup("outputControl"));
}
else
{
outputControl_ = ocTimeStep;
}
switch (outputControl_)
{
case ocTimeStep:
{
dict.lookup("outputInterval") >> outputInterval_;
outputInterval_ = dict.lookupOrDefault<label>("outputInterval", 0);
break;
}
default:
{
// do nothing
break;
}
}
}
@ -97,17 +107,21 @@ bool Foam::outputFilterOutputControl::output() const
);
break;
}
case ocOutputTime:
{
return time_.outputTime();
break;
}
default:
{
// this error should not actually be possible
FatalErrorIn("bool Foam::outputFilterOutputControl::output()")
<< "Unknown output control: "
<< "Undefined output control: "
<< outputControlNames_[outputControl_] << nl
<< abort(FatalError);
break;
}
}

View File

@ -25,6 +25,8 @@ Class
Foam::outputFilterOutputControl
Description
An output control for function objects.
The default is time-step execution at every interval.
SourceFiles
outputFilterOutputControl.C
@ -51,10 +53,11 @@ class outputFilterOutputControl
{
public:
//- The output control options
enum outputControls
{
ocTimeStep,
ocOutputTime
ocTimeStep, /*!< execution is coupled to the time-step */
ocOutputTime /*!< execution is coupled to the output-time */
};
@ -71,7 +74,7 @@ private:
//- Type of output
outputControls outputControl_;
//- The execution interval (in time steps) when using TIMESTEP mode
//- The execution interval (in time steps) when using @c timeStep mode,
// a value <= 1 means execute at every time step
label outputInterval_;

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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/>.
Description
diagTensorField with IO.
\*---------------------------------------------------------------------------*/
#include "diagTensorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
diagTensorFieldIOField,
"diagTensorFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
diagTensorIOFieldField,
"diagTensorCompactFieldField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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/>.
Typedef
Foam::diagTensorFieldIOField
Description
diagTensorFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef diagTensorFieldIOField_H
#define diagTensorFieldIOField_H
#include "diagTensorField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<diagTensorField> diagTensorFieldIOField;
typedef IOFieldField<diagTensorField, diagTensor> diagTensorIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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/>.
Description
sphericalTensorField with IO.
\*---------------------------------------------------------------------------*/
#include "sphericalTensorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
sphericalTensorFieldIOField,
"sphericalTensorFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
sphericalTensorIOFieldField,
"sphericalTensorCompactFieldField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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/>.
Typedef
Foam::sphericalTensorFieldIOField
Description
sphericalTensorFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef sphericalTensorFieldIOField_H
#define sphericalTensorFieldIOField_H
#include "sphericalTensorField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<sphericalTensorField> sphericalTensorFieldIOField;
typedef IOFieldField<sphericalTensorField, sphericalTensor>
sphericalTensorIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -32,7 +32,12 @@ Description
namespace Foam
{
defineTemplateTypeNameAndDebugWithName(sphericalTensorIOField, "sphericalTensorField", 0);
defineTemplateTypeNameAndDebugWithName
(
sphericalTensorIOField,
"sphericalTensorField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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/>.
Description
symmTensorField with IO.
\*---------------------------------------------------------------------------*/
#include "symmTensorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
symmTensorFieldIOField,
"symmTensorFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
symmTensorIOFieldField,
"symmTensorCompactFieldField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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/>.
Typedef
Foam::symmTensorFieldIOField
Description
symmTensorFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef symmTensorFieldIOField_H
#define symmTensorFieldIOField_H
#include "symmTensorField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<symmTensorField> symmTensorFieldIOField;
typedef IOFieldField<symmTensorField, symmTensor> symmTensorIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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/>.
Description
tensorField with IO.
\*---------------------------------------------------------------------------*/
#include "tensorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
tensorFieldIOField,
"tensorFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
tensorIOFieldField,
"tensorCompactFieldField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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/>.
Typedef
Foam::tensorFieldIOField
Description
tensorFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef tensorFieldIOField_H
#define tensorFieldIOField_H
#include "tensorField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<tensorField> tensorFieldIOField;
typedef IOFieldField<tensorField, tensor> tensorIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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/>.
Description
vector2DField with IO.
\*---------------------------------------------------------------------------*/
#include "vector2DFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
vector2DFieldIOField,
"vector2DFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
vector2DIOFieldField,
"vector2DCompactFieldField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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/>.
Typedef
Foam::vector2DFieldIOField
Description
vector2DFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef vector2DFieldIOField_H
#define vector2DFieldIOField_H
#include "vector2DField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<vector2DField> vector2DFieldIOField;
typedef IOFieldField<vector2DField, vector2D> vector2DIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -32,7 +32,12 @@ Description
namespace Foam
{
defineTemplateTypeNameAndDebugWithName(vector2DIOField, "vector2DField", 0);
defineTemplateTypeNameAndDebugWithName
(
vector2DIOField,
"vector2DField",
0
);
}
// ************************************************************************* //

View File

@ -28,7 +28,6 @@ License
#include "clock.H"
#include "IFstream.H"
#include "dictionary.H"
#include "Switch.H"
#include "IOobject.H"
#include "JobInfo.H"
#include "labelList.H"
@ -564,7 +563,7 @@ Foam::argList::argList
}
// distributed data
if (decompDict.lookupOrDefault<Switch>("distributed", false))
if (decompDict.lookupOrDefault("distributed", false))
{
fileNameList roots;
decompDict.lookup("roots") >> roots;

View File

@ -145,6 +145,20 @@ public:
return solverName_;
}
//- Return solver name
word& solverName()
{
return solverName_;
}
//- Return field name
const word& fieldName() const
{
return fieldName_;
}
//- Return initial residual
scalar initialResidual() const
{
@ -209,6 +223,10 @@ public:
//- Print summary of solver performance
void print() const;
// Member Operators
bool operator!=(const solverPerformance&) const;
// Friend functions
@ -222,6 +240,7 @@ public:
// Ostream Operator
friend Istream& operator>>(Istream&, solverPerformance&);
friend Ostream& operator<<(Ostream&, const solverPerformance&);
};

View File

@ -32,15 +32,7 @@ Description
Foam::lduMatrix::solverPerformance::solverPerformance(Istream& is)
{
is.readBeginList("lduMatrix::solverPerformance");
is >> solverName_
>> fieldName_
>> initialResidual_
>> finalResidual_
>> noIterations_
>> converged_
>> singular_;
is.readEndList("lduMatrix::solverPerformance");
is >> *this;
}
@ -118,6 +110,24 @@ void Foam::lduMatrix::solverPerformance::print() const
}
bool Foam::lduMatrix::solverPerformance::operator!=
(
const lduMatrix::solverPerformance& sp
) const
{
return
(
solverName() != sp.solverName()
|| fieldName() != sp.fieldName()
|| initialResidual() != sp.initialResidual()
|| finalResidual() != sp.finalResidual()
|| nIterations() != sp.nIterations()
|| converged() != sp.converged()
|| singular() != sp.singular()
);
}
Foam::lduMatrix::solverPerformance Foam::max
(
const lduMatrix::solverPerformance& sp1,
@ -137,6 +147,26 @@ Foam::lduMatrix::solverPerformance Foam::max
}
Foam::Istream& Foam::operator>>
(
Istream& is,
Foam::lduMatrix::solverPerformance& sp
)
{
is.readBeginList("lduMatrix::solverPerformance");
is >> sp.solverName_
>> sp.fieldName_
>> sp.initialResidual_
>> sp.finalResidual_
>> sp.noIterations_
>> sp.converged_
>> sp.singular_;
is.readEndList("lduMatrix::solverPerformance");
return is;
}
Foam::Ostream& Foam::operator<<
(
Ostream& os,

View File

@ -58,7 +58,6 @@ SourceFiles
#include "labelField.H"
#include "primitiveFields.H"
#include "LUscalarMatrix.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -75,7 +74,7 @@ class GAMGSolver
{
// Private data
Switch cacheAgglomeration_;
bool cacheAgglomeration_;
//- Number of pre-smoothing sweeps
label nPreSweeps_;

View File

@ -76,7 +76,7 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
label nCoarseFaces = 0;
forAll (localRestrictAddressing, ffi)
forAll(localRestrictAddressing, ffi)
{
label curMaster = -1;
label curSlave = -1;
@ -164,7 +164,7 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
if (owner())
{
// On master side, the owner addressing is stored in table of contents
forAll (contents, masterI)
forAll(contents, masterI)
{
SLList<label>& curNbrs = neighboursTable.find(contents[masterI])();
@ -200,7 +200,7 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
else
{
// On slave side, the owner addressing is stored in linked lists
forAll (contents, masterI)
forAll(contents, masterI)
{
SLList<label>& curNbrs = neighboursTable.find(contents[masterI])();

View File

@ -255,7 +255,7 @@ bool Foam::solution::read()
if (dict.found("cache"))
{
cache_ = dict.subDict("cache");
caching_ = cache_.lookupOrDefault<Switch>("active", true);
caching_ = cache_.lookupOrDefault("active", true);
}
if (dict.found("relaxationFactors"))

View File

@ -36,7 +36,6 @@ SourceFiles
#define solution_H
#include "IOdictionary.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +56,7 @@ class solution
dictionary cache_;
//- Switch for the caching mechanism
Switch caching_;
bool caching_;
//- Dictionary of relaxation factors for all the fields
dictionary relaxationFactors_;

View File

@ -27,6 +27,7 @@ License
#include "ListOps.H"
#include "Pstream.H"
#include "commSchedule.H"
#include "boolList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -42,6 +43,8 @@ Foam::labelList Foam::ProcessorTopology<Patch, ProcPatch>::procNeighbours
label maxNb = 0;
boolList isNeighbourProc(Pstream::nProcs(), false);
forAll(patches, patchi)
{
const Patch& patch = patches[patchi];
@ -51,19 +54,34 @@ Foam::labelList Foam::ProcessorTopology<Patch, ProcPatch>::procNeighbours
const ProcPatch& procPatch =
refCast<const ProcPatch>(patch);
nNeighbours++;
label pNeighbProcNo = procPatch.neighbProcNo();
maxNb = max(maxNb, procPatch.neighbProcNo());
if (!isNeighbourProc[pNeighbProcNo])
{
nNeighbours++;
maxNb = max(maxNb, procPatch.neighbProcNo());
isNeighbourProc[pNeighbProcNo] = true;
}
}
}
labelList neighbours(nNeighbours);
labelList neighbours(nNeighbours, -1);
nNeighbours = 0;
forAll(isNeighbourProc, procI)
{
if (isNeighbourProc[procI])
{
neighbours[nNeighbours++] = procI;
}
}
procPatchMap_.setSize(maxNb + 1);
procPatchMap_ = -1;
nNeighbours = 0;
forAll(patches, patchi)
{
const Patch& patch = patches[patchi];
@ -73,8 +91,6 @@ Foam::labelList Foam::ProcessorTopology<Patch, ProcPatch>::procNeighbours
const ProcPatch& procPatch =
refCast<const ProcPatch>(patch);
neighbours[nNeighbours++] = procPatch.neighbProcNo();
// Construct reverse map
procPatchMap_[procPatch.neighbProcNo()] = patchi;
}

View File

@ -30,6 +30,9 @@ Description
*this[procI] gives the list of neighbouring processors.
TODO: This does not currently correctly support multiple processor
patches connecting two processors.
SourceFiles
ProcessorTopology.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,7 +45,8 @@ Foam::data::data(const objectRegistry& obr)
IOobject::NO_READ,
IOobject::NO_WRITE
)
)
),
prevTimeIndex_(0)
{
set("solverPerformance", dictionary());
}
@ -65,7 +66,34 @@ void Foam::data::setSolverPerformance
const lduMatrix::solverPerformance& sp
) const
{
const_cast<dictionary&>(solverPerformanceDict()).set(name, sp);
dictionary& dict = const_cast<dictionary&>(solverPerformanceDict());
List<lduMatrix::solverPerformance> perfs;
if (prevTimeIndex_ != this->time().timeIndex())
{
// reset solver performance between iterations
prevTimeIndex_ = this->time().timeIndex();
dict.clear();
}
else
{
dict.readIfPresent(name, perfs);
}
// append to list
perfs.setSize(perfs.size()+1, sp);
dict.set(name, perfs);
}
void Foam::data::setSolverPerformance
(
const lduMatrix::solverPerformance& sp
) const
{
setSolverPerformance(sp.fieldName(), sp);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -47,13 +47,19 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class data Declaration
Class data Declaration
\*---------------------------------------------------------------------------*/
class data
:
public IOdictionary
{
// Private data
//- Previously used time-index, used for reset between iterations
mutable label prevTimeIndex_;
// Private Member Functions
//- Disallow default bitwise copy construct
@ -90,6 +96,12 @@ public:
const word& name,
const lduMatrix::solverPerformance&
) const;
//- Add/set the solverPerformance entry, using its fieldName
void setSolverPerformance
(
const lduMatrix::solverPerformance&
) const;
};

View File

@ -69,7 +69,7 @@ addToRunTimeSelectionTable
//
// faceList masterFaces(pp.size());
//
// forAll (pp, faceI)
// forAll(pp, faceI)
// {
// masterFaces[faceI] = pp[faceI].reverseFace();
// }
@ -119,13 +119,13 @@ addToRunTimeSelectionTable
//
// label noFiltPoints = 0;
//
// forAll (meshPoints_, pointI)
// forAll(meshPoints_, pointI)
// {
// label curP = meshPoints_[pointI];
//
// bool found = false;
//
// forAll (sharedPoints, sharedI)
// forAll(sharedPoints, sharedI)
// {
// if (sharedPoints[sharedI] == curP)
// {
@ -165,7 +165,7 @@ addToRunTimeSelectionTable
// // Create a HashSet of the point labels for this patch
// Map<label> patchPointSet(2*ppmp.size());
//
// forAll (ppmp, ppi)
// forAll(ppmp, ppi)
// {
// patchPointSet.insert(ppmp[ppi], ppi);
// }
@ -296,7 +296,7 @@ addToRunTimeSelectionTable
// // Create a HashSet of the point labels for the patch
// Map<label> patchPointSet(2*fmp.size());
//
// forAll (fmp, ppi)
// forAll(fmp, ppi)
// {
// patchPointSet.insert(fmp[ppi], ppi);
// }

View File

@ -1164,7 +1164,7 @@ Foam::labelList Foam::globalPoints::reverseMeshPoints
faceList masterFaces(nbrPatch.size());
forAll (nbrPatch, faceI)
forAll(nbrPatch, faceI)
{
masterFaces[faceI] = nbrPatch[faceI].reverseFace();
}

View File

@ -856,7 +856,7 @@ Foam::polyMesh::polyMesh
// Warning: Patches can only be added once the face list is
// completed, as they hold a subList of the face list
forAll (boundaryFaces, patchI)
forAll(boundaryFaces, patchI)
{
dictionary patchDict(boundaryDicts[patchI]);

View File

@ -44,10 +44,10 @@ namespace Foam
addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, word);
addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, dictionary);
}
template<>
const char* NamedEnum<cyclicPolyPatch::transformType, 4>::names[] =
const char* Foam::NamedEnum<Foam::cyclicPolyPatch::transformType, 4>::names[] =
{
"unknown",
"rotational",
@ -55,9 +55,8 @@ const char* NamedEnum<cyclicPolyPatch::transformType, 4>::names[] =
"noOrdering"
};
const NamedEnum<cyclicPolyPatch::transformType, 4>
cyclicPolyPatch::transformTypeNames;
}
const Foam::NamedEnum<Foam::cyclicPolyPatch::transformType, 4>
Foam::cyclicPolyPatch::transformTypeNames;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View File

@ -45,10 +45,7 @@ Foam::fvMotionSolverEngineMesh::fvMotionSolverEngineMesh(const IOobject& io)
pistonLayers_("pistonLayers", dimLength, 0.0),
motionSolver_(*this, engineDB_.engineDict().lookup("motionSolver"))
{
if (engineDB_.engineDict().found("pistonLayers"))
{
engineDB_.engineDict().lookup("pistonLayers") >> pistonLayers_;
}
engineDB_.engineDict().readIfPresent("pistonLayers", pistonLayers_);
}

View File

@ -44,10 +44,7 @@ Foam::layeredEngineMesh::layeredEngineMesh(const IOobject& io)
engineMesh(io),
pistonLayers_("pistonLayers", dimLength, 0.0)
{
if (engineDB_.engineDict().found("pistonLayers"))
{
engineDB_.engineDict().lookup("pistonLayers") >> pistonLayers_;
}
engineDB_.engineDict().readIfPresent("pistonLayers", pistonLayers_);
}

View File

@ -156,7 +156,7 @@ $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityK
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
$(derivedFvPatchFields)/swirlMassFlowRateInletVelocity/swirlMassFlowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C
fvsPatchFields = fields/fvsPatchFields
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C

View File

@ -1,13 +1,17 @@
dictionary pimple = mesh.solutionDict().subDict("PIMPLE");
const dictionary& pimple = mesh.solutionDict().subDict("PIMPLE");
int nOuterCorr(readInt(pimple.lookup("nOuterCorrectors")));
int nCorr(readInt(pimple.lookup("nCorrectors")));
const int nOuterCorr =
pimple.lookupOrDefault<int>("nOuterCorrectors", 1);
int nNonOrthCorr =
const int nCorr =
pimple.lookupOrDefault<int>("nCorrectors", 1);
const int nNonOrthCorr =
pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor =
pimple.lookupOrDefault<Switch>("momentumPredictor", true);
const bool momentumPredictor =
pimple.lookupOrDefault("momentumPredictor", true);
const bool transonic =
pimple.lookupOrDefault("transonic", false);
bool transonic =
pimple.lookupOrDefault<Switch>("transonic", false);

View File

@ -1,15 +1,17 @@
dictionary piso = mesh.solutionDict().subDict("PISO");
const dictionary& piso = mesh.solutionDict().subDict("PISO");
int nCorr(readInt(piso.lookup("nCorrectors")));
const int nOuterCorr =
piso.lookupOrDefault<int>("nOuterCorrectors", 1);
int nNonOrthCorr =
const int nCorr =
piso.lookupOrDefault<int>("nCorrectors", 1);
const int nNonOrthCorr =
piso.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor =
piso.lookupOrDefault<Switch>("momentumPredictor", true);
const bool momentumPredictor =
piso.lookupOrDefault("momentumPredictor", true);
bool transonic =
piso.lookupOrDefault<Switch>("transonic", false);
const bool transonic =
piso.lookupOrDefault("transonic", false);
int nOuterCorr =
piso.lookupOrDefault<int>("nOuterCorrectors", 1);

View File

@ -1,14 +1,11 @@
dictionary simple = mesh.solutionDict().subDict("SIMPLE");
const dictionary& simple = mesh.solutionDict().subDict("SIMPLE");
int nNonOrthCorr =
const int nNonOrthCorr =
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor =
simple.lookupOrDefault<Switch>("momentumPredictor", true);
const bool momentumPredictor =
simple.lookupOrDefault("momentumPredictor", true);
bool fluxGradp =
simple.lookupOrDefault<Switch>("fluxGradp", false);
bool transonic =
simple.lookupOrDefault<Switch>("transonic", false);
const bool transonic =
simple.lookupOrDefault("transonic", false);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,15 +29,11 @@ Description
\*---------------------------------------------------------------------------*/
Switch adjustTimeStep
(
runTime.controlDict().lookup("adjustTimeStep")
);
const bool adjustTimeStep =
runTime.controlDict().lookupOrDefault("adjustTimeStep", false);
scalar maxCo
(
readScalar(runTime.controlDict().lookup("maxCo"))
);
scalar maxCo =
runTime.controlDict().lookupOrDefault<scalar>("maxCo", 1.0);
scalar maxDeltaT =
runTime.controlDict().lookupOrDefault<scalar>("maxDeltaT", GREAT);

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenOAM: The Open Source CFD Toolbox
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
@ -26,15 +26,10 @@ License
#include "directionMixedFvPatchField.H"
#include "symmTransformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
directionMixedFvPatchField<Type>::directionMixedFvPatchField
Foam::directionMixedFvPatchField<Type>::directionMixedFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
@ -48,7 +43,7 @@ directionMixedFvPatchField<Type>::directionMixedFvPatchField
template<class Type>
directionMixedFvPatchField<Type>::directionMixedFvPatchField
Foam::directionMixedFvPatchField<Type>::directionMixedFvPatchField
(
const directionMixedFvPatchField<Type>& ptf,
const fvPatch& p,
@ -64,7 +59,7 @@ directionMixedFvPatchField<Type>::directionMixedFvPatchField
template<class Type>
directionMixedFvPatchField<Type>::directionMixedFvPatchField
Foam::directionMixedFvPatchField<Type>::directionMixedFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
@ -81,7 +76,7 @@ directionMixedFvPatchField<Type>::directionMixedFvPatchField
template<class Type>
directionMixedFvPatchField<Type>::directionMixedFvPatchField
Foam::directionMixedFvPatchField<Type>::directionMixedFvPatchField
(
const directionMixedFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
@ -97,7 +92,7 @@ directionMixedFvPatchField<Type>::directionMixedFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void directionMixedFvPatchField<Type>::autoMap
void Foam::directionMixedFvPatchField<Type>::autoMap
(
const fvPatchFieldMapper& m
)
@ -110,7 +105,7 @@ void directionMixedFvPatchField<Type>::autoMap
template<class Type>
void directionMixedFvPatchField<Type>::rmap
void Foam::directionMixedFvPatchField<Type>::rmap
(
const fvPatchField<Type>& ptf,
const labelList& addr
@ -128,7 +123,8 @@ void directionMixedFvPatchField<Type>::rmap
template<class Type>
tmp<Field<Type> > directionMixedFvPatchField<Type>::snGrad() const
Foam::tmp<Foam::Field<Type> >
Foam::directionMixedFvPatchField<Type>::snGrad() const
{
Field<Type> pif = this->patchInternalField();
@ -146,7 +142,7 @@ tmp<Field<Type> > directionMixedFvPatchField<Type>::snGrad() const
template<class Type>
void directionMixedFvPatchField<Type>::evaluate(const Pstream::commsTypes)
void Foam::directionMixedFvPatchField<Type>::evaluate(const Pstream::commsTypes)
{
if (!this->updated())
{
@ -168,7 +164,8 @@ void directionMixedFvPatchField<Type>::evaluate(const Pstream::commsTypes)
template<class Type>
tmp<Field<Type> > directionMixedFvPatchField<Type>::snGradTransformDiag() const
Foam::tmp<Foam::Field<Type> >
Foam::directionMixedFvPatchField<Type>::snGradTransformDiag() const
{
vectorField diag(valueFraction_.size());
@ -193,7 +190,7 @@ tmp<Field<Type> > directionMixedFvPatchField<Type>::snGradTransformDiag() const
template<class Type>
void directionMixedFvPatchField<Type>::write(Ostream& os) const
void Foam::directionMixedFvPatchField<Type>::write(Ostream& os) const
{
transformFvPatchField<Type>::write(os);
refValue_.writeEntry("refValue", os);
@ -203,8 +200,4 @@ void directionMixedFvPatchField<Type>::write(Ostream& os) const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -118,9 +118,9 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
}
// a simpler way of doing this would be nice
scalar avgU = -flowRate_/gSum(patch().magSf());
const scalar avgU = -flowRate_/gSum(patch().magSf());
vectorField n = patch().nf();
tmp<vectorField> n = patch().nf();
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);

View File

@ -37,9 +37,9 @@ Description
@verbatim
inlet
{
type flowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
value uniform (0 0 0); // placeholder
type flowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
value uniform (0 0 0); // placeholder
}
@endverbatim

View File

@ -80,10 +80,7 @@ freestreamFvPatchField<Type>::freestreamFvPatchField
fvPatchField<Type>::operator=(freestreamValue());
}
if (dict.found("phi"))
{
dict.lookup("phi") >> this->phiName_;
}
dict.readIfPresent("phi", this->phiName_);
}

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "swirlMassFlowRateInletVelocityFvPatchVectorField.H"
#include "swirlFlowRateInletVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
@ -33,8 +33,8 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField::
swirlFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
@ -49,10 +49,10 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField::
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf,
const swirlFlowRateInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
@ -66,8 +66,8 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField::
swirlFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
@ -83,10 +83,10 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField::
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf
const swirlFlowRateInletVelocityFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
@ -98,10 +98,10 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField::
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf,
const swirlFlowRateInletVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
@ -115,25 +115,28 @@ swirlMassFlowRateInletVelocityFvPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
void Foam::swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
scalar totArea = gSum(patch().magSf());
const scalar totArea = gSum(patch().magSf());
// a simpler way of doing this would be nice
scalar avgU = -flowRate_/totArea;
const scalar avgU = -flowRate_/totArea;
vector center = gSum(patch().Cf()*patch().magSf())/totArea;
vector normal = gSum(patch().nf()*patch().magSf())/totArea;
const vector avgCenter = gSum(patch().Cf()*patch().magSf())/totArea;
const vector avgNormal = gSum(patch().Sf())/totArea;
vectorField tangVelo =
// Update angular velocity - convert [rpm] to [rad/s]
vectorField tangentialVelocity =
(
(rpm_*constant::mathematical::pi/30.0)
*(patch().Cf() - center) ^ normal;
* (patch().Cf() - avgCenter) ^ avgNormal
);
vectorField n = patch().nf();
tmp<vectorField> n = patch().nf();
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
@ -141,7 +144,7 @@ void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
if (phi.dimensions() == dimVelocity*dimArea)
{
// volumetric flow-rate
operator==(tangVelo + n*avgU);
operator==(tangentialVelocity + n*avgU);
}
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
@ -149,13 +152,13 @@ void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// mass flow-rate
operator==(tangVelo + n*avgU/rhop);
operator==(tangentialVelocity + n*avgU/rhop);
}
else
{
FatalErrorIn
(
"swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()"
"swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()"
) << "dimensions of " << phiName_ << " are incorrect" << nl
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
@ -167,18 +170,15 @@ void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
}
void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
void Foam::swirlFlowRateInletVelocityFvPatchVectorField::write
(
Ostream& os
) const
{
fvPatchField<vector>::write(os);
os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl;
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
@ -191,7 +191,7 @@ namespace Foam
makePatchTypeField
(
fvPatchVectorField,
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
);
}

View File

@ -22,11 +22,11 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::swirlMassFlowRateInletVelocityFvPatchVectorField
Foam::swirlFlowRateInletVelocityFvPatchVectorField
Description
Describes a volumetric/mass flow normal vector boundary condition by its
magnitude as an integral over its area with a swirl component determined
magnitude as an integral over its area, with a swirl component determined
by the RPM
The basis of the patch (volumetric or mass) is determined by the
@ -38,22 +38,30 @@ Description
@verbatim
inlet
{
type swirlMassFlowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
rpm 100;
type swirlFlowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
rpm 100;
value uniform (0 0 0); // placeholder
}
@endverbatim
Note
- The value is positive inwards
- May not work correctly for transonic inlets
- Swirl is defined in RPM about the patch centre-axis according
to a right-hand rule (inwards axis).
- Primarily useful for planar patches.
See Also
Foam::flowRateInletVelocityFvPatchVectorField
SourceFiles
swirlMassFlowRateInletVelocityFvPatchVectorField.C
swirlFlowRateInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef swirlMassFlowRateInletVelocityFvPatchVectorField_H
#define swirlMassFlowRateInletVelocityFvPatchVectorField_H
#ifndef swirlFlowRateInletVelocityFvPatchVectorField_H
#define swirlFlowRateInletVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
@ -62,10 +70,10 @@ SourceFiles
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class swirlMassFlowRateInletVelocityFvPatchVectorField Declaration
Class swirlFlowRateInletVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class swirlMassFlowRateInletVelocityFvPatchVectorField
class swirlFlowRateInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
@ -80,27 +88,27 @@ class swirlMassFlowRateInletVelocityFvPatchVectorField
//- Name of the density field used to normalize the mass flux
word rhoName_;
//- RPM
//- Swirl rate [rpm]
scalar rpm_;
public:
//- Runtime type information
TypeName("swirlMassFlowRateInletVelocity");
TypeName("swirlFlowRateInletVelocity");
// Constructors
//- Construct from patch and internal field
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
@ -110,18 +118,18 @@ public:
//- Construct by mapping given
// flowRateInletVelocityFvPatchVectorField
// onto a new patch
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField&,
const swirlFlowRateInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField&
const swirlFlowRateInletVelocityFvPatchVectorField&
);
//- Construct and return a clone
@ -129,14 +137,14 @@ public:
{
return tmp<fvPatchVectorField>
(
new swirlMassFlowRateInletVelocityFvPatchVectorField(*this)
new swirlFlowRateInletVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
swirlMassFlowRateInletVelocityFvPatchVectorField
swirlFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField&,
const swirlFlowRateInletVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
@ -148,7 +156,7 @@ public:
{
return tmp<fvPatchVectorField>
(
new swirlMassFlowRateInletVelocityFvPatchVectorField(*this, iF)
new swirlFlowRateInletVelocityFvPatchVectorField(*this, iF)
);
}
@ -169,6 +177,18 @@ public:
return flowRate_;
}
//- Return the swirl rpm
scalar rpm() const
{
return rpm_;
}
//- Return reference to the swirl rpm to allow adjustment
scalar& rpm()
{
return rpm_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();

View File

@ -112,10 +112,7 @@ timeVaryingMappedFixedValueFvPatchField
endSampledValues_(0),
endAverage_(pTraits<Type>::zero)
{
if (dict.found("fieldTableName"))
{
dict.lookup("fieldTableName") >> fieldTableName_;
}
dict.readIfPresent("fieldTableName", fieldTableName_);
if (dict.found("value"))
{

View File

@ -150,6 +150,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
solverPerf.print();
solverPerfVec = max(solverPerfVec, solverPerf);
solverPerfVec.solverName() = solverPerf.solverName();
psi.internalField().replace(cmpt, psiCmpt);
diag() = saveDiag;

View File

@ -101,9 +101,29 @@ template<class ParticleType>
template<class TrackingData>
void Foam::Cloud<ParticleType>::move(TrackingData& td)
{
const polyBoundaryMesh& pbm = pMesh().boundaryMesh();
const globalMeshData& pData = polyMesh_.globalData();
const labelList& processorPatches = pData.processorPatches();
const labelList& processorPatchIndices = pData.processorPatchIndices();
// Which patches are processor patches
const labelList& procPatches = pData.processorPatches();
// Indexing of patches into the procPatches list
const labelList& procPatchIndices = pData.processorPatchIndices();
// Indexing of equivalent patch on neighbour processor into the
// procPatches list on the neighbour
const labelList& procPatchNeighbours = pData.processorPatchNeighbours();
// Which processors this processor is connected to
const labelList& neighbourProcs = pData[Pstream::myProcNo()];
// Indexing from the processor number into the neighbourProcs list
labelList neighbourProcIndices(Pstream::nProcs(), -1);
forAll(neighbourProcs, i)
{
neighbourProcIndices[neighbourProcs[i]] = i;
}
// Initialise the stepFraction moved for the particles
forAllIter(typename Cloud<ParticleType>, *this, pIter)
@ -114,9 +134,19 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td)
// While there are particles to transfer
while (true)
{
// List of lists of particles to be transfered for all the processor
// patches
List<IDLList<ParticleType> > transferList(processorPatches.size());
// List of lists of particles to be transfered for all of the
// neighbour processors
List<IDLList<ParticleType> > particleTransferLists
(
neighbourProcs.size()
);
// List of destination processorPatches indices for all of the
// neighbour processors
List<DynamicList<label> > patchIndexTransferLists
(
neighbourProcs.size()
);
// Loop over all particles
forAllIter(typename Cloud<ParticleType>, *this, pIter)
@ -134,15 +164,28 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td)
// boundary face
if (Pstream::parRun() && p.facei_ >= pMesh().nInternalFaces())
{
label patchi = pMesh().boundaryMesh().whichPatch(p.facei_);
label n = processorPatchIndices[patchi];
label patchi = pbm.whichPatch(p.facei_);
// ... and the face is on a processor patch
// prepare it for transfer
if (n != -1)
if (procPatchIndices[patchi] != -1)
{
label n = neighbourProcIndices
[
refCast<const processorPolyPatch>
(
pbm[patchi]
).neighbProcNo()
];
p.prepareForParallelTransfer(patchi, td);
transferList[n].append(this->remove(&p));
particleTransferLists[n].append(this->remove(&p));
patchIndexTransferLists[n].append
(
procPatchNeighbours[patchi]
);
}
}
}
@ -157,31 +200,30 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td)
break;
}
// Allocate transfer buffers
PstreamBuffers pBufs(Pstream::nonBlocking);
// Stream into send buffers
forAll(transferList, i)
forAll(particleTransferLists, i)
{
if (transferList[i].size())
if (particleTransferLists[i].size())
{
UOPstream particleStream
(
refCast<const processorPolyPatch>
(
pMesh().boundaryMesh()[processorPatches[i]]
).neighbProcNo(),
neighbourProcs[i],
pBufs
);
particleStream << transferList[i];
particleStream
<< patchIndexTransferLists[i]
<< particleTransferLists[i];
}
}
// Set up transfers when in non-blocking mode. Returns sizes (in bytes)
// to be sent/received.
labelListList allNTrans(Pstream::nProcs());
pBufs.finishedSends(allNTrans);
bool transfered = false;
@ -203,34 +245,35 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td)
break;
}
// Retrieve from receive buffers
forAll(processorPatches, i)
forAll(neighbourProcs, i)
{
label patchi = processorPatches[i];
label neighbProci = neighbourProcs[i];
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>
(pMesh().boundaryMesh()[patchi]);
label nRec = allNTrans[neighbProci][Pstream::myProcNo()];
label neighbProci = procPatch.neighbProcNo();
label nRecPs = allNTrans[neighbProci][Pstream::myProcNo()];
if (nRecPs)
if (nRec)
{
UIPstream particleStream(neighbProci, pBufs);
labelList receivePatchIndex(particleStream);
IDLList<ParticleType> newParticles
(
particleStream,
typename ParticleType::iNew(*this)
);
label pI = 0;
forAllIter(typename Cloud<ParticleType>, newParticles, newpIter)
{
ParticleType& newp = newpIter();
label patchi = procPatches[receivePatchIndex[pI++]];
newp.correctAfterParallelTransfer(patchi, td);
addParticle(newParticles.remove(&newp));
}
}

View File

@ -38,6 +38,7 @@ SourceFiles
#include "cloud.H"
#include "IDLList.H"
#include "IOField.H"
#include "IOFieldField.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -267,6 +268,14 @@ public:
const IOField<DataType>& data
) const;
//- Check lagrangian data fieldfield
template<class DataType>
void checkFieldFieldIOobject
(
const Cloud<ParticleType>& c,
const IOFieldField<Field<DataType>, DataType>& data
) const;
//- Read the field data for the cloud of particles. Dummy at
// this level.
virtual void readFields();

View File

@ -205,6 +205,31 @@ void Foam::Cloud<ParticleType>::checkFieldIOobject
}
template<class ParticleType>
template<class DataType>
void Foam::Cloud<ParticleType>::checkFieldFieldIOobject
(
const Cloud<ParticleType>& c,
const IOFieldField<Field<DataType>, DataType>& data
) const
{
if (data.size() != c.size())
{
FatalErrorIn
(
"void Cloud<ParticleType>::checkFieldFieldIOobject"
"("
"const Cloud<ParticleType>&, "
"const IOFieldField<Field<DataType>, DataType>&"
") const"
) << "Size of " << data.name()
<< " field " << data.size()
<< " does not match the number of particles " << c.size()
<< abort(FatalError);
}
}
template<class ParticleType>
void Foam::Cloud<ParticleType>::readFields()
{}

View File

@ -932,7 +932,7 @@ void Foam::InteractionLists<ParticleType>::prepareParticlesToRefer
IDLList<ParticleType>& particlesToRefer = referredParticles_[i];
forAll (realParticles, rM)
forAll(realParticles, rM)
{
const ParticleType& particle = *realParticles[rM];
@ -1188,7 +1188,7 @@ void Foam::InteractionLists<ParticleType>::receiveReferredData
{
UIPstream str(domain, pBufs);
forAll (constructMap, i)
forAll(constructMap, i)
{
referredParticles_[constructMap[i]] = IDLList<ParticleType>
(

View File

@ -51,6 +51,104 @@ Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList(Istream& is)
}
template<class PairType, class WallType>
Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList
(
const labelField& pairAccessed,
const labelField& pairOrigProcOfOther,
const labelField& pairOrigIdOfOther,
const Field<PairType>& pairData,
const labelField& wallAccessed,
const vectorField& wallPRel,
const Field<WallType>& wallData
)
:
pairRecords_(),
wallRecords_()
{
label nPair = pairAccessed.size();
if
(
pairOrigProcOfOther.size() != nPair
|| pairOrigIdOfOther.size() != nPair
|| pairData.size() != nPair
)
{
FatalErrorIn
(
"Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList"
"("
"const labelField& pairAccessed,"
"const labelField& pairOrigProcOfOther,"
"const labelField& pairOrigIdOfOther,"
"const Field<PairType>& pairData,"
"const labelField& wallAccessed,"
"const vectorField& wallPRel,"
"const Field<WallType>& wallData"
")"
)
<< "Pair field size mismatch." << nl
<< pairAccessed << nl
<< pairOrigProcOfOther << nl
<< pairOrigIdOfOther << nl
<< pairData << nl
<< abort(FatalError);
}
forAll(pairAccessed, i)
{
pairRecords_.append
(
PairCollisionRecord<PairType>
(
pairAccessed[i],
pairOrigProcOfOther[i],
pairOrigIdOfOther[i],
pairData[i]
)
);
}
label nWall = wallAccessed.size();
if (wallPRel.size() != nWall || wallData.size() != nWall)
{
FatalErrorIn
(
"Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList"
"("
"const labelField& pairAccessed,"
"const labelField& pairOrigProcOfOther,"
"const labelField& pairOrigIdOfOther,"
"const Field<PairType>& pairData,"
"const labelField& wallAccessed,"
"const vectorField& wallPRel,"
"const Field<WallType>& wallData"
")"
)
<< "Wall field size mismatch." << nl
<< wallAccessed << nl
<< wallPRel << nl
<< wallData << nl
<< abort(FatalError);
}
forAll(wallAccessed, i)
{
wallRecords_.append
(
WallCollisionRecord<WallType>
(
wallAccessed[i],
wallPRel[i],
wallData[i]
)
);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * /
template<class PairType, class WallType>
@ -60,6 +158,111 @@ Foam::CollisionRecordList<PairType, WallType>::~CollisionRecordList()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class PairType, class WallType>
Foam::labelField
Foam::CollisionRecordList<PairType, WallType>::pairAccessed() const
{
labelField f(pairRecords_.size());
forAll(pairRecords_, i)
{
f[i] = pairRecords_[i].accessed();
}
return f;
}
template<class PairType, class WallType>
Foam::labelField
Foam::CollisionRecordList<PairType, WallType>::pairOrigProcOfOther() const
{
labelField f(pairRecords_.size());
forAll(pairRecords_, i)
{
f[i] = pairRecords_[i].origProcOfOther();
}
return f;
}
template<class PairType, class WallType>
Foam::labelField
Foam::CollisionRecordList<PairType, WallType>::pairOrigIdOfOther() const
{
labelField f(pairRecords_.size());
forAll(pairRecords_, i)
{
f[i] = pairRecords_[i].origIdOfOther();
}
return f;
}
template<class PairType, class WallType>
Foam::Field<PairType>
Foam::CollisionRecordList<PairType, WallType>::pairData() const
{
Field<PairType> f(pairRecords_.size());
forAll(pairRecords_, i)
{
f[i] = pairRecords_[i].collisionData();
}
return f;
}
template<class PairType, class WallType>
Foam::labelField
Foam::CollisionRecordList<PairType, WallType>::wallAccessed() const
{
labelField f(wallRecords_.size());
forAll(wallRecords_, i)
{
f[i] = wallRecords_[i].accessed();
}
return f;
}
template<class PairType, class WallType>
Foam::vectorField
Foam::CollisionRecordList<PairType, WallType>::wallPRel() const
{
vectorField f(wallRecords_.size());
forAll(wallRecords_, i)
{
f[i] = wallRecords_[i].pRel();
}
return f;
}
template<class PairType, class WallType>
Foam::Field<WallType>
Foam::CollisionRecordList<PairType, WallType>::wallData() const
{
Field<WallType> f(wallRecords_.size());
forAll(wallRecords_, i)
{
f[i] = wallRecords_[i].collisionData();
}
return f;
}
template<class PairType, class WallType>
Foam::PairCollisionRecord<PairType>&
Foam::CollisionRecordList<PairType, WallType>::matchPairRecord
@ -85,12 +288,12 @@ Foam::CollisionRecordList<PairType, WallType>::matchPairRecord
}
// Record not found, create a new one and return it as the last
// member of the list. The status of the record will be accessed
// by construction.
// member of the list. Setting the status of the record to be accessed
// on construction.
pairRecords_.append
(
PairCollisionRecord<PairType>(origProcOfOther, origIdOfOther)
PairCollisionRecord<PairType>(true, origProcOfOther, origIdOfOther)
);
return pairRecords_.last();
@ -121,10 +324,10 @@ Foam::CollisionRecordList<PairType, WallType>::matchWallRecord
}
// Record not found, create a new one and return it as the last
// member of the list. The status of the record will be accessed
// by construction.
// member of the list. Setting the status of the record to be accessed
// on construction.
wallRecords_.append(WallCollisionRecord<WallType>(pRel));
wallRecords_.append(WallCollisionRecord<WallType>(true, pRel));
return wallRecords_.last();
}

View File

@ -95,6 +95,17 @@ public:
//- Construct from Istream
CollisionRecordList(Istream&);
//- Construct from component fields (for IO)
CollisionRecordList
(
const labelField& pairAccessed,
const labelField& pairOrigProcOfOther,
const labelField& pairOrigIdOfOther,
const Field<PairType>& pairData,
const labelField& wallAccessed,
const vectorField& wallPRel,
const Field<WallType>& wallData
);
//- Destructor
~CollisionRecordList();
@ -102,6 +113,50 @@ public:
// Member Functions
//- Return the active pair collisions
inline const DynamicList<PairCollisionRecord<PairType> >&
pairRecords() const;
//- Return the active wall collisions
inline const DynamicList<WallCollisionRecord<WallType> >&
wallRecords() const;
// Fields representing the data from each record, i.e if the
// records 0-N containing each data members {a, b, c, d...}
// are organised:
//
// a0 b0 c0 d0 ...
// a1 b1 c1 d1 ...
// a2 b2 c2 d2 ...
// ...
// aN bN cN dN ...
//
// Then these field return, for example, (c0, c1, c2,... cN)
//- Return field of pair accessed from each record, used for
// field IO
labelField pairAccessed() const;
//- Return field of pair origProcOfOther from each record,
// used for field IO
labelField pairOrigProcOfOther() const;
//- Return field of pair origIdOfOther from each record, used
// for field IO
labelField pairOrigIdOfOther() const;
//- Return field of pair data from each record, used for field IO
Field<PairType> pairData() const;
//- Return field of wall accessed from each record, used for field IO
labelField wallAccessed() const;
//- Return field of wall pRel from each record, used for field IO
vectorField wallPRel() const;
//- Return field of wall data from each record, used for field IO
Field<WallType> wallData() const;
//- Enquires if the proc and id pair of the other particle are
// present in the records. If so, return non-const access to
// the PairCollisionRecord (hence the data) and mark the
@ -172,6 +227,10 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CollisionRecordListI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "CollisionRecordList.C"
#endif

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class PairType, class WallType>
const Foam::DynamicList<Foam::PairCollisionRecord<PairType> >&
Foam::CollisionRecordList<PairType, WallType>::pairRecords() const
{
return pairRecords_;
}
template<class PairType, class WallType>
const Foam::DynamicList<Foam::WallCollisionRecord<WallType> >&
Foam::CollisionRecordList<PairType, WallType>::wallRecords() const
{
return wallRecords_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -30,8 +30,8 @@ License
template<class Type>
Foam::PairCollisionRecord<Type>::PairCollisionRecord()
:
origProcOfOther_(-VGREAT),
origIdOfOther_(-VGREAT),
origProcOfOther_(0),
origIdOfOther_(-1),
data_(pTraits<Type>::zero)
{}
@ -39,6 +39,7 @@ Foam::PairCollisionRecord<Type>::PairCollisionRecord()
template<class Type>
Foam::PairCollisionRecord<Type>::PairCollisionRecord
(
bool accessed,
label origProcOfOther,
label origIdOfOther,
const Type& data
@ -47,7 +48,14 @@ Foam::PairCollisionRecord<Type>::PairCollisionRecord
origProcOfOther_(origProcOfOther + 1),
origIdOfOther_(origIdOfOther),
data_(data)
{}
{
// Default assignment to origProcOfOther_ assumes accessed is true
if (!accessed)
{
setUnaccessed();
}
}
template<class Type>
@ -56,7 +64,7 @@ Foam::PairCollisionRecord<Type>::PairCollisionRecord
const PairCollisionRecord<Type>& pCR
)
:
origProcOfOther_(pCR.origProcOfOther() + 1),
origProcOfOther_(pCR.origProcOfOther_),
origIdOfOther_(pCR.origIdOfOther_),
data_(pCR.data_)
{}

View File

@ -108,6 +108,7 @@ public:
//- Construct from components
PairCollisionRecord
(
bool accessed,
label origProcOfOther,
label origIdOfOther,
const Type& data = pTraits<Type>::zero
@ -121,7 +122,7 @@ public:
//- Destructor
~PairCollisionRecord();
~PairCollisionRecord();
// Member Functions

View File

@ -25,6 +25,12 @@ License
#include "WallCollisionRecord.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class Type>
const Foam::scalar Foam::WallCollisionRecord<Type>::errorCosAngle(1.0 + 1e-6);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -39,11 +45,12 @@ Foam::WallCollisionRecord<Type>::WallCollisionRecord()
template<class Type>
Foam::WallCollisionRecord<Type>::WallCollisionRecord
(
bool accessed,
const vector& pRel,
const Type& data
)
:
accessed_(true),
accessed_(accessed),
pRel_(pRel),
data_(data)
{}

View File

@ -82,7 +82,7 @@ class WallCollisionRecord
// //- Recording whether or not this record has been accessed
bool accessed_;
//- The position of wall impact relative to the cell centre
//- The position of wall impact relative to the particle centre
vector pRel_;
//- Collision data, stored as if the storing particle was the
@ -92,6 +92,12 @@ class WallCollisionRecord
public:
// Static data members
//- Tolerance for detecting seriously erroneous wall matches
static const scalar errorCosAngle;
// Constructors
//- Construct null
@ -100,6 +106,7 @@ public:
//- Construct from components
WallCollisionRecord
(
bool accessed,
const vector& pRel,
const Type& data = pTraits<Type>::zero
);

View File

@ -39,7 +39,7 @@ inline bool Foam::WallCollisionRecord<Type>::match
// Using the new data as the acceptance criterion
scalar cosAcceptanceAngle = magpRel/radius;
if (cosAcceptanceAngle > 1.0)
if (cosAcceptanceAngle > errorCosAngle)
{
Info<< "pRel_ " << pRel_ << " " << magpRel_ << nl
<< "pRel " << pRel << " " << magpRel << nl
@ -75,6 +75,14 @@ inline bool Foam::WallCollisionRecord<Type>::match
}
template<class Type>
inline const Foam::vector&
Foam::WallCollisionRecord<Type>::pRel() const
{
return pRel_;
}
template<class Type>
inline const Type&
Foam::WallCollisionRecord<Type>::collisionData() const

View File

@ -33,7 +33,7 @@ Description
- drag
- turbulent dispersion
- wall interactions
- many-body collisions
- many-body collisions, including memory of data from previous collision
SourceFiles
KinematicParcelI.H
@ -53,12 +53,18 @@ SourceFiles
#include "KinematicCloud.H"
#include "CollisionRecordList.H"
#include "labelFieldIOField.H"
#include "vectorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef CollisionRecordList<vector, vector> collisionRecordList;
typedef vectorIOFieldField pairDataIOFieldField;
typedef vectorIOFieldField wallDataIOFieldField;
template<class ParcelType>
class KinematicParcel;
@ -268,7 +274,7 @@ protected:
vector UTurb_;
//- Particle collision records
CollisionRecordList<vector, vector> collisionRecords_;
collisionRecordList collisionRecords_;
// Cell-based quantities
@ -400,8 +406,7 @@ public:
inline const vector& UTurb() const;
//- Return const access to the collision records
inline const CollisionRecordList<vector, vector>&
collisionRecords() const;
inline const collisionRecordList& collisionRecords() const;
// Edit
@ -440,7 +445,7 @@ public:
inline vector& UTurb();
//- Return access to collision records
inline CollisionRecordList<vector, vector>& collisionRecords();
inline collisionRecordList& collisionRecords();
// Helper functions

View File

@ -348,7 +348,7 @@ inline bool& Foam::KinematicParcel<ParcelType>::active()
template <class ParcelType>
inline const Foam::CollisionRecordList<Foam::vector, Foam::vector>&
inline const Foam::collisionRecordList&
Foam::KinematicParcel<ParcelType>::collisionRecords() const
{
return collisionRecords_;
@ -426,7 +426,7 @@ inline Foam::vector& Foam::KinematicParcel<ParcelType>::UTurb()
template <class ParcelType>
inline Foam::CollisionRecordList<Foam::vector, Foam::vector>&
inline Foam::collisionRecordList&
Foam::KinematicParcel<ParcelType>::collisionRecords()
{
return collisionRecords_;

View File

@ -43,7 +43,14 @@ Foam::string Foam::KinematicParcel<ParcelType>::propHeader =
+ " (torquex torquey torquez)"
+ " rho"
+ " tTurb"
+ " (UTurbx UTurby UTurbz)";
+ " (UTurbx UTurby UTurbz)"
+ " collisionRecordsPairAccessed"
+ " collisionRecordsPairOrigProcOfOther"
+ " collisionRecordsPairOrigIdOfOther"
+ " (collisionRecordsPairData)"
+ " collisionRecordsWallAccessed"
+ " collisionRecordsWallPRel"
+ " (collisionRecordsWallData)";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -167,7 +174,58 @@ void Foam::KinematicParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
IOField<vector> UTurb(c.fieldIOobject("UTurb", IOobject::MUST_READ));
c.checkFieldIOobject(c, UTurb);
labelIOFieldField collisionRecordsPairAccessed
(
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairAccessed);
labelIOFieldField collisionRecordsPairOrigProcOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigProcOfOther",
IOobject::MUST_READ
)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
labelIOFieldField collisionRecordsPairOrigIdOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigIdOfOther",
IOobject::MUST_READ
)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
pairDataIOFieldField collisionRecordsPairData
(
c.fieldIOobject("collisionRecordsPairData", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairData);
labelIOFieldField collisionRecordsWallAccessed
(
c.fieldIOobject("collisionRecordsWallAccessed", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallAccessed);
vectorIOFieldField collisionRecordsWallPRel
(
c.fieldIOobject("collisionRecordsWallPRel", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallPRel);
wallDataIOFieldField collisionRecordsWallData
(
c.fieldIOobject("collisionRecordsWallData", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallData);
label i = 0;
forAllIter(typename Cloud<ParcelType>, c, iter)
{
ParcelType& p = iter();
@ -182,6 +240,17 @@ void Foam::KinematicParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
p.rho_ = rho[i];
p.tTurb_ = tTurb[i];
p.UTurb_ = UTurb[i];
p.collisionRecords_ = collisionRecordList
(
collisionRecordsPairAccessed[i],
collisionRecordsPairOrigProcOfOther[i],
collisionRecordsPairOrigIdOfOther[i],
collisionRecordsPairData[i],
collisionRecordsWallAccessed[i],
collisionRecordsWallPRel[i],
collisionRecordsWallData[i]
);
i++;
}
}
@ -206,14 +275,56 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
IOField<vector> f(c.fieldIOobject("f", IOobject::NO_READ), np);
IOField<vector> angularMomentum
(
c.fieldIOobject("angularMomentum", IOobject::NO_READ), np
c.fieldIOobject("angularMomentum", IOobject::NO_READ),
np
);
IOField<vector> torque(c.fieldIOobject("torque", IOobject::NO_READ), np);
IOField<scalar> rho(c.fieldIOobject("rho", IOobject::NO_READ), np);
IOField<scalar> tTurb(c.fieldIOobject("tTurb", IOobject::NO_READ), np);
IOField<vector> UTurb(c.fieldIOobject("UTurb", IOobject::NO_READ), np);
labelIOFieldField collisionRecordsPairAccessed
(
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::NO_READ),
np
);
labelIOFieldField collisionRecordsPairOrigProcOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigProcOfOther",
IOobject::NO_READ
),
np
);
labelIOFieldField collisionRecordsPairOrigIdOfOther
(
c.fieldIOobject("collisionRecordsPairOrigIdOfOther", IOobject::NO_READ),
np
);
pairDataIOFieldField collisionRecordsPairData
(
c.fieldIOobject("collisionRecordsPairData", IOobject::NO_READ),
np
);
labelIOFieldField collisionRecordsWallAccessed
(
c.fieldIOobject("collisionRecordsWallAccessed", IOobject::NO_READ),
np
);
vectorIOFieldField collisionRecordsWallPRel
(
c.fieldIOobject("collisionRecordsWallPRel", IOobject::NO_READ),
np
);
wallDataIOFieldField collisionRecordsWallData
(
c.fieldIOobject("collisionRecordsWallData", IOobject::NO_READ),
np
);
label i = 0;
forAllConstIter(typename Cloud<ParcelType>, c, iter)
{
const KinematicParcel<ParcelType>& p = iter();
@ -229,6 +340,16 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
rho[i] = p.rho();
tTurb[i] = p.tTurb();
UTurb[i] = p.UTurb();
collisionRecordsPairAccessed[i] = p.collisionRecords().pairAccessed();
collisionRecordsPairOrigProcOfOther[i] =
p.collisionRecords().pairOrigProcOfOther();
collisionRecordsPairOrigIdOfOther[i] =
p.collisionRecords().pairOrigIdOfOther();
collisionRecordsPairData[i] = p.collisionRecords().pairData();
collisionRecordsWallAccessed[i] = p.collisionRecords().wallAccessed();
collisionRecordsWallPRel[i] = p.collisionRecords().wallPRel();
collisionRecordsWallData[i] = p.collisionRecords().wallData();
i++;
}
@ -243,6 +364,13 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
rho.write();
tTurb.write();
UTurb.write();
collisionRecordsPairAccessed.write();
collisionRecordsPairOrigProcOfOther.write();
collisionRecordsPairOrigIdOfOther.write();
collisionRecordsPairData.write();
collisionRecordsWallAccessed.write();
collisionRecordsWallPRel.write();
collisionRecordsWallData.write();
}

View File

@ -25,6 +25,7 @@ License
#include "basicKinematicParcel.H"
#include "KinematicCloud.H"
#include "KinematicParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -36,6 +36,7 @@ License
#include "PairSpringSliderDashpot.H"
#include "WallSpringSliderDashpot.H"
#include "WallLocalSpringSliderDashpot.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -73,6 +74,13 @@ License
WallSpringSliderDashpot, \
KinematicCloud, \
ParcelType \
); \
\
makeWallModelType \
( \
WallLocalSpringSliderDashpot, \
KinematicCloud, \
ParcelType \
);

View File

@ -37,6 +37,7 @@ License
#include "PairSpringSliderDashpot.H"
#include "WallSpringSliderDashpot.H"
#include "WallLocalSpringSliderDashpot.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -99,9 +100,16 @@ License
KinematicCloud, \
ParcelType, \
ThermoType \
); \
\
makeWallModelThermoType \
( \
WallLocalSpringSliderDashpot, \
KinematicCloud, \
ParcelType, \
ThermoType \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -45,7 +45,12 @@ void Foam::PairSpringSliderDashpot<CloudType>::findMinMaxProperties
// Finding minimum diameter to avoid excessive arithmetic
scalar dEff = p.d()*cbrt(p.nParticle()*volumeFactor_);
scalar dEff = p.d();
if (useEquivalentSize_)
{
dEff *= cbrt(p.nParticle()*volumeFactor_);
}
RMin = min(dEff, RMin);
@ -94,8 +99,14 @@ Foam::PairSpringSliderDashpot<CloudType>::PairSpringSliderDashpot
this->coeffDict().lookup("collisionResolutionSteps")
)
),
volumeFactor_(this->dict().lookupOrDefault("volumeFactor", 1.0))
volumeFactor_(1.0),
useEquivalentSize_(Switch(this->coeffDict().lookup("useEquivalentSize")))
{
if (useEquivalentSize_)
{
volumeFactor_ = readScalar(this->coeffDict().lookup("volumeFactor"));
}
scalar nu = this->owner().constProps().poissonsRatio();
scalar E = this->owner().constProps().youngsModulus();
@ -158,9 +169,19 @@ void Foam::PairSpringSliderDashpot<CloudType>::evaluatePair
{
vector r_AB = (pA.position() - pB.position());
scalar dAEff = pA.d()*cbrt(pA.nParticle()*volumeFactor_);
scalar dAEff = pA.d();
scalar dBEff = pB.d()*cbrt(pB.nParticle()*volumeFactor_);
if (useEquivalentSize_)
{
dAEff *= cbrt(pA.nParticle()*volumeFactor_);
}
scalar dBEff = pB.d();
if (useEquivalentSize_)
{
dBEff *= cbrt(pB.nParticle()*volumeFactor_);
}
scalar normalOverlapMag = 0.5*(dAEff + dBEff) - mag(r_AB);

View File

@ -58,9 +58,6 @@ class PairSpringSliderDashpot
// the same Poisson's ratio and Young's modulus
scalar Gstar_;
//- Poisson's ratio of both particles
scalar sigma_;
//- alpha-coefficient, related to coefficient of restitution
scalar alpha_;
@ -92,6 +89,10 @@ class PairSpringSliderDashpot
// factor
scalar volumeFactor_;
//- Switch to control use of equivalent size particles. Used
// because the calculation can be very expensive.
bool useEquivalentSize_;
// Private Member Functions

View File

@ -0,0 +1,354 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ 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 "WallLocalSpringSliderDashpot.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template <class CloudType>
void Foam::WallLocalSpringSliderDashpot<CloudType>::findMinMaxProperties
(
scalar& rMin,
scalar& rhoMax,
scalar& UMagMax
) const
{
rMin = VGREAT;
rhoMax = -VGREAT;
UMagMax = -VGREAT;
forAllConstIter(typename CloudType, this->owner(), iter)
{
const typename CloudType::parcelType& p = iter();
// Finding minimum diameter to avoid excessive arithmetic
scalar dEff = p.d();
if (useEquivalentSize_)
{
dEff *= cbrt(p.nParticle()*volumeFactor_);
}
rMin = min(dEff, rMin);
rhoMax = max(p.rho(), rhoMax);
UMagMax = max
(
mag(p.U()) + mag(p.omega())*dEff/2,
UMagMax
);
}
// Transform the minimum diameter into minimum radius
// rMin = dMin/2
rMin /= 2.0;
}
template <class CloudType>
void Foam::WallLocalSpringSliderDashpot<CloudType>::evaluateWall
(
typename CloudType::parcelType& p,
const point& site,
const WallSiteData<vector>& data,
scalar pREff
) const
{
// wall patch index
label wPI = patchMap_[data.patchIndex()];
// data for this patch
scalar Estar = Estar_[wPI];
scalar Gstar = Gstar_[wPI];
scalar alpha = alpha_[wPI];
scalar b = b_[wPI];
scalar mu = mu_[wPI];
vector r_PW = p.position() - site;
vector U_PW = p.U() - data.wallData();
scalar normalOverlapMag = max(pREff - mag(r_PW), 0.0);
vector rHat_PW = r_PW/(mag(r_PW) + VSMALL);
scalar kN = (4.0/3.0)*sqrt(pREff)*Estar;
scalar etaN = alpha*sqrt(p.mass()*kN)*pow025(normalOverlapMag);
vector fN_PW =
rHat_PW
*(kN*pow(normalOverlapMag, b) - etaN*(U_PW & rHat_PW));
p.f() += fN_PW;
vector USlip_PW =
U_PW - (U_PW & rHat_PW)*rHat_PW
+ (p.omega() ^ (pREff*-rHat_PW));
scalar deltaT = this->owner().mesh().time().deltaTValue();
vector& tangentialOverlap_PW =
p.collisionRecords().matchWallRecord(-r_PW, pREff).collisionData();
tangentialOverlap_PW += USlip_PW*deltaT;
scalar tangentialOverlapMag = mag(tangentialOverlap_PW);
if (tangentialOverlapMag > VSMALL)
{
scalar kT = 8.0*sqrt(pREff*normalOverlapMag)*Gstar;
scalar etaT = etaN;
// Tangential force
vector fT_PW;
if (kT*tangentialOverlapMag > mu*mag(fN_PW))
{
// Tangential force greater than sliding friction,
// particle slips
fT_PW = -mu*mag(fN_PW)*USlip_PW/mag(USlip_PW);
tangentialOverlap_PW = vector::zero;
}
else
{
fT_PW =
-kT*tangentialOverlapMag
*tangentialOverlap_PW/tangentialOverlapMag
- etaT*USlip_PW;
}
p.f() += fT_PW;
p.torque() += (pREff*-rHat_PW) ^ fT_PW;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template <class CloudType>
Foam::WallLocalSpringSliderDashpot<CloudType>::WallLocalSpringSliderDashpot
(
const dictionary& dict,
CloudType& cloud
)
:
WallModel<CloudType>(dict, cloud, typeName),
Estar_(),
Gstar_(),
alpha_(),
b_(),
mu_(),
patchMap_(),
maxEstarIndex_(-1),
collisionResolutionSteps_
(
readScalar
(
this->coeffDict().lookup("collisionResolutionSteps")
)
),
volumeFactor_(1.0),
useEquivalentSize_(Switch(this->coeffDict().lookup("useEquivalentSize")))
{
if (useEquivalentSize_)
{
volumeFactor_ = readScalar(this->coeffDict().lookup("volumeFactor"));
}
scalar pNu = this->owner().constProps().poissonsRatio();
scalar pE = this->owner().constProps().youngsModulus();
const polyMesh& mesh = cloud.mesh();
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
patchMap_.setSize(bMesh.size(), -1);
DynamicList<label> wallPatchIndices;
forAll(bMesh, patchI)
{
if (isA<wallPolyPatch>(bMesh[patchI]))
{
wallPatchIndices.append(bMesh[patchI].index());
}
}
label nWallPatches = wallPatchIndices.size();
Estar_.setSize(nWallPatches);
Gstar_.setSize(nWallPatches);
alpha_.setSize(nWallPatches);
b_.setSize(nWallPatches);
mu_.setSize(nWallPatches);
scalar maxEstar = -GREAT;
forAll(wallPatchIndices, wPI)
{
const dictionary& patchCoeffDict
(
this->coeffDict().subDict(bMesh[wallPatchIndices[wPI]].name())
);
patchMap_[wallPatchIndices[wPI]] = wPI;
scalar nu = dimensionedScalar
(
patchCoeffDict.lookup("poissonsRatio")
).value();
scalar E = dimensionedScalar
(
patchCoeffDict.lookup("youngsModulus")
).value();
Estar_[wPI] = 1/((1 - sqr(pNu))/pE + (1 - sqr(nu))/E);
Gstar_[wPI] = 1/(2*((2 + pNu - sqr(pNu))/pE + (2 + nu - sqr(nu))/E));
alpha_[wPI] =
dimensionedScalar(patchCoeffDict.lookup("alpha")).value();
b_[wPI] = dimensionedScalar(patchCoeffDict.lookup("b")).value();
mu_[wPI] = dimensionedScalar(patchCoeffDict.lookup("mu")).value();
if (Estar_[wPI] > maxEstar)
{
maxEstarIndex_ = wPI;
maxEstar = Estar_[wPI];
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>
Foam::WallLocalSpringSliderDashpot<CloudType>::~WallLocalSpringSliderDashpot()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::WallLocalSpringSliderDashpot<CloudType>::pREff
(
const typename CloudType::parcelType& p
) const
{
if (useEquivalentSize_)
{
return p.d()/2*cbrt(p.nParticle()*volumeFactor_);
}
else
{
return p.d()/2;
}
}
template<class CloudType>
bool Foam::WallLocalSpringSliderDashpot<CloudType>::controlsTimestep() const
{
return true;
}
template<class CloudType>
Foam::label Foam::WallLocalSpringSliderDashpot<CloudType>::nSubCycles() const
{
if (!(this->owner().size()))
{
return 1;
}
scalar rMin;
scalar rhoMax;
scalar UMagMax;
findMinMaxProperties(rMin, rhoMax, UMagMax);
// Note: pi^(7/5)*(5/4)^(2/5) = 5.429675
scalar minCollisionDeltaT =
5.429675
*rMin
*pow(rhoMax/(Estar_[maxEstarIndex_]*sqrt(UMagMax) + VSMALL), 0.4)
/collisionResolutionSteps_;
return ceil(this->owner().time().deltaTValue()/minCollisionDeltaT);
}
template<class CloudType>
void Foam::WallLocalSpringSliderDashpot<CloudType>::evaluateWall
(
typename CloudType::parcelType& p,
const List<point>& flatSitePoints,
const List<WallSiteData<vector> >& flatSiteData,
const List<point>& sharpSitePoints,
const List<WallSiteData<vector> >& sharpSiteData
) const
{
scalar pREff = this->pREff(p);
forAll(flatSitePoints, siteI)
{
evaluateWall
(
p,
flatSitePoints[siteI],
flatSiteData[siteI],
pREff
);
}
forAll(sharpSitePoints, siteI)
{
// Treating sharp sites like flat sites
evaluateWall
(
p,
sharpSitePoints[siteI],
sharpSiteData[siteI],
pREff
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,184 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ 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::WallLocalSpringSliderDashpot
Description
Forces between particles and walls, interacting with a spring,
slider, damper model
\*---------------------------------------------------------------------------*/
#ifndef WallLocalSpringSliderDashpot_H
#define WallLocalSpringSliderDashpot_H
#include "WallModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class WallLocalSpringSliderDashpot Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class WallLocalSpringSliderDashpot
:
public WallModel<CloudType>
{
// Private data
//- Effective Young's modulus value
scalarList Estar_;
//- Effective shear modulus value
scalarList Gstar_;
//- alpha-coefficient, related to coefficient of restitution
scalarList alpha_;
//- Spring power (b = 1 for linear, b = 3/2 for Hertzian)
scalarList b_;
//- Coefficient of friction in for tangential sliding
scalarList mu_;
//- Mapping the patch index to the model data
labelList patchMap_;
//- Index of the maximum value of Estar_
label maxEstarIndex_;
//- The number of steps over which to resolve the minimum
// harmonic approximation of the collision period
scalar collisionResolutionSteps_;
//- Volume factor for determining the equivalent size of a
// parcel where nParticles is not 1. The equivalent size of
// the parcel is
// parcelEquivVolume = volumeFactor*nParticles*p.volume()
// so
// parcelEquivD = cbrt(volumeFactor*nParticles)*p.d()
// + When volumeFactor = 1, the particles are compressed
// together so that the equivalent volume of the parcel is
// the sum of the constituent particles
// + When volumeFactor = 3*sqrt(2)/pi, the particles are
// close packed, but uncompressed.
// + When volumeFactor > 3*sqrt(2)/pi, the particles loosely
// grouped.
// 3*sqrt(2)/pi = 1.350474 is the volume factor for close
// packing, i.e pi/(3*sqrt(2)) is the maximum close packing
// factor
scalar volumeFactor_;
//- Switch to control use of equivalent size particles. Used
// because the calculation can be very expensive.
bool useEquivalentSize_;
// Private Member Functions
//- Find the appropriate properties for determining the minimum
//- allowable timestep
void findMinMaxProperties
(
scalar& rMin,
scalar& rhoMax,
scalar& vMagMax
) const;
//- Calculate the wall interaction for a parcel at a given site
void evaluateWall
(
typename CloudType::parcelType& p,
const point& site,
const WallSiteData<vector>& data,
scalar pREff
) const;
public:
//- Runtime type information
TypeName("WallLocalSpringSliderDashpot");
// Constructors
//- Construct from dictionary
WallLocalSpringSliderDashpot(const dictionary& dict, CloudType& cloud);
//- Destructor
virtual ~WallLocalSpringSliderDashpot();
// Member Functions
//- Return the volumeFactor
inline scalar volumeFactor() const
{
return volumeFactor_;
}
//- Return the effective radius for a particle for the model
virtual scalar pREff(const typename CloudType::parcelType& p) const;
//- Whether the WallModel has a timestep limit that will
// require subCycling
virtual bool controlsTimestep() const;
//- For WallModels that control the timestep, calculate the
// number of subCycles needed to satisfy the minimum
// allowable timestep
virtual label nSubCycles() const;
//- Calculate the wall interaction for a parcel
virtual void evaluateWall
(
typename CloudType::parcelType& p,
const List<point>& flatSitePoints,
const List<WallSiteData<vector> >& flatSiteData,
const List<point>& sharpSitePoints,
const List<WallSiteData<vector> >& sharpSiteData
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "WallLocalSpringSliderDashpot.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -58,6 +58,14 @@ Foam::WallModel<CloudType>::owner() const
}
template<class CloudType>
CloudType&
Foam::WallModel<CloudType>::owner()
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::WallModel<CloudType>::dict() const
{

View File

@ -111,6 +111,9 @@ public:
//- Return the owner cloud object
const CloudType& owner() const;
//- Return non-const access to the owner cloud object
CloudType& owner();
//- Return the dictionary
const dictionary& dict() const;

View File

@ -45,7 +45,12 @@ void Foam::WallSpringSliderDashpot<CloudType>::findMinMaxProperties
// Finding minimum diameter to avoid excessive arithmetic
scalar dEff = p.d()*cbrt(p.nParticle()*volumeFactor_);
scalar dEff = p.d();
if (useEquivalentSize_)
{
dEff *= cbrt(p.nParticle()*volumeFactor_);
}
rMin = min(dEff, rMin);
@ -64,25 +69,22 @@ void Foam::WallSpringSliderDashpot<CloudType>::findMinMaxProperties
rMin /= 2.0;
}
template <class CloudType>
void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
(
typename CloudType::parcelType& p,
const point& site,
const WallSiteData<vector>& data,
scalar pNu,
scalar pE,
scalar pREff,
scalar Estar,
scalar kN,
scalar Gstar
scalar kN
) const
{
vector r_PW = p.position() - site;
vector U_PW = p.U() - data.wallData();
scalar normalOverlapMag = pREff - mag(r_PW);
scalar normalOverlapMag = max(pREff - mag(r_PW), 0.0);
vector rHat_PW = r_PW/(mag(r_PW) + VSMALL);
@ -109,7 +111,7 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
if (tangentialOverlapMag > VSMALL)
{
scalar kT = 8.0*sqrt(pREff*normalOverlapMag)*Gstar;
scalar kT = 8.0*sqrt(pREff*normalOverlapMag)*Gstar_;
scalar etaT = etaN;
@ -150,8 +152,8 @@ Foam::WallSpringSliderDashpot<CloudType>::WallSpringSliderDashpot
)
:
WallModel<CloudType>(dict, cloud, typeName),
E_(dimensionedScalar(this->coeffDict().lookup("youngsModulus")).value()),
nu_(dimensionedScalar(this->coeffDict().lookup("poissonsRatio")).value()),
Estar_(),
Gstar_(),
alpha_(dimensionedScalar(this->coeffDict().lookup("alpha")).value()),
b_(dimensionedScalar(this->coeffDict().lookup("b")).value()),
mu_(dimensionedScalar(this->coeffDict().lookup("mu")).value()),
@ -162,8 +164,32 @@ Foam::WallSpringSliderDashpot<CloudType>::WallSpringSliderDashpot
this->coeffDict().lookup("collisionResolutionSteps")
)
),
volumeFactor_(this->dict().lookupOrDefault("volumeFactor", 1.0))
{}
volumeFactor_(1.0),
useEquivalentSize_(Switch(this->coeffDict().lookup("useEquivalentSize")))
{
if (useEquivalentSize_)
{
volumeFactor_ = readScalar(this->coeffDict().lookup("volumeFactor"));
}
scalar nu = dimensionedScalar
(
this->coeffDict().lookup("poissonsRatio")
).value();
scalar E = dimensionedScalar
(
this->coeffDict().lookup("youngsModulus")
).value();
scalar pNu = this->owner().constProps().poissonsRatio();
scalar pE = this->owner().constProps().youngsModulus();
Estar_ = 1/((1 - sqr(pNu))/pE + (1 - sqr(nu))/E);
Gstar_ = 1/(2*((2 + pNu - sqr(pNu))/pE + (2 + nu - sqr(nu))/E));
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
@ -181,9 +207,17 @@ Foam::scalar Foam::WallSpringSliderDashpot<CloudType>::pREff
const typename CloudType::parcelType& p
) const
{
return p.d()/2*cbrt(p.nParticle()*volumeFactor_);
if (useEquivalentSize_)
{
return p.d()/2*cbrt(p.nParticle()*volumeFactor_);
}
else
{
return p.d()/2;
}
}
template<class CloudType>
bool Foam::WallSpringSliderDashpot<CloudType>::controlsTimestep() const
{
@ -205,17 +239,11 @@ Foam::label Foam::WallSpringSliderDashpot<CloudType>::nSubCycles() const
findMinMaxProperties(rMin, rhoMax, UMagMax);
scalar pNu = this->owner().constProps().poissonsRatio();
scalar pE = this->owner().constProps().youngsModulus();
scalar Estar = 1/((1 - sqr(pNu))/pE + (1 - sqr(nu_))/E_);
// Note: pi^(7/5)*(5/4)^(2/5) = 5.429675
scalar minCollisionDeltaT =
5.429675
*rMin
*pow(rhoMax/(Estar*sqrt(UMagMax) + VSMALL), 0.4)
*pow(rhoMax/(Estar_*sqrt(UMagMax) + VSMALL), 0.4)
/collisionResolutionSteps_;
return ceil(this->owner().time().deltaTValue()/minCollisionDeltaT);
@ -232,17 +260,9 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
const List<WallSiteData<vector> >& sharpSiteData
) const
{
scalar pNu = this->owner().constProps().poissonsRatio();
scalar pE = this->owner().constProps().youngsModulus();
scalar pREff = this->pREff(p);
scalar Estar = 1/((1 - sqr(pNu))/pE + (1 - sqr(nu_))/E_);
scalar kN = (4.0/3.0)*sqrt(pREff)*Estar;
scalar GStar = 1/(2*((2 + pNu - sqr(pNu))/pE + (2 + nu_ - sqr(nu_))/E_));
scalar kN = (4.0/3.0)*sqrt(pREff)*Estar_;
forAll(flatSitePoints, siteI)
{
@ -251,12 +271,8 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
p,
flatSitePoints[siteI],
flatSiteData[siteI],
pNu,
pE,
pREff,
Estar,
kN,
GStar
kN
);
}
@ -269,12 +285,8 @@ void Foam::WallSpringSliderDashpot<CloudType>::evaluateWall
p,
sharpSitePoints[siteI],
sharpSiteData[siteI],
pNu,
pE,
pREff,
Estar,
kN,
GStar
kN
);
}
}

View File

@ -50,11 +50,11 @@ class WallSpringSliderDashpot
{
// Private data
//- Young's modulus of the wall
scalar E_;
//- Effective Young's modulus value
scalar Estar_;
//- Poisson's ratio of the wall
scalar nu_;
//- Effective shear modulus value
scalar Gstar_;
//- alpha-coefficient, related to coefficient of restitution
scalar alpha_;
@ -87,6 +87,10 @@ class WallSpringSliderDashpot
// factor
scalar volumeFactor_;
//- Switch to control use of equivalent size particles. Used
// because the calculation can be very expensive.
bool useEquivalentSize_;
// Private Member Functions
@ -105,12 +109,8 @@ class WallSpringSliderDashpot
typename CloudType::parcelType& p,
const point& site,
const WallSiteData<vector>& data,
scalar pNu,
scalar pE,
scalar pREff,
scalar Estar,
scalar kN,
scalar Gstar
scalar kN
) const;

View File

@ -229,18 +229,12 @@ void Foam::potential::potential::readPotentialDict()
if (potentialDict.found("external"))
{
Info<< nl << "Reading external forces:" << endl;
const dictionary& externalDict = potentialDict.subDict("external");
// *********************************************************************
// gravity
if (externalDict.found("gravity"))
{
gravity_ = externalDict.lookup("gravity");
}
externalDict.readIfPresent("gravity", gravity_);
}
Info<< nl << tab << "gravity = " << gravity_ << endl;

View File

@ -218,10 +218,7 @@ Foam::layerParameters::layerParameters
<< endl;
}
if (dict.found("nRelaxedIter"))
{
dict.lookup("nRelaxedIter") >> nRelaxedIter_;
}
dict.readIfPresent("nRelaxedIter", nRelaxedIter_);
if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
{
@ -303,10 +300,8 @@ Foam::layerParameters::layerParameters
<< endl;
}
if (dict.found("nRelaxedIter"))
{
dict.lookup("nRelaxedIter") >> nRelaxedIter_;
}
dict.readIfPresent("nRelaxedIter", nRelaxedIter_);
if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
{
FatalErrorIn("layerParameters::layerParameters(..)")

View File

@ -519,11 +519,9 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Collapse checking parameters
scalar volFraction = -1;
if (motionDict.found("minVolCollapseRatio"))
{
volFraction = readScalar(motionDict.lookup("minVolCollapseRatio"));
}
const scalar volFraction =
motionDict.lookupOrDefault<scalar>("minVolCollapseRatio", -1);
const bool checkCollapse = (volFraction > 0);
scalar minArea = -1;
scalar maxNonOrtho = -1;

View File

@ -151,17 +151,10 @@ Foam::refinementSurfaces::refinementSurfaces
}
// Global perpendicular angle
if (dict.found("perpendicularAngle"))
{
globalAngle[surfI] = readScalar(dict.lookup("perpendicularAngle"));
}
dict.readIfPresent("perpendicularAngle", globalAngle[surfI]);
//// Global patch name per surface
//if (dict.found("patchType"))
//{
// dict.lookup("patchType") >> globalPatchType[surfI];
//}
//dict.readIfPresent("patchType", globalPatchType[surfI]);
if (dict.found("regions"))
{
@ -446,13 +439,7 @@ Foam::refinementSurfaces::refinementSurfaces
}
// Global perpendicular angle
if (dict.found("perpendicularAngle"))
{
globalAngle[surfI] = readScalar
(
dict.lookup("perpendicularAngle")
);
}
dict.readIfPresent("perpendicularAngle", globalAngle[surfI]);
if (dict.found("regions"))
{

View File

@ -25,7 +25,6 @@ License
#include "EulerCoordinateRotation.H"
#include "Switch.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
@ -137,7 +136,7 @@ Foam::EulerCoordinateRotation::EulerCoordinateRotation
rotation.component(vector::X),
rotation.component(vector::Y),
rotation.component(vector::Z),
dict.lookupOrDefault<Switch>("degrees", true)
dict.lookupOrDefault("degrees", true)
);
}

View File

@ -25,7 +25,6 @@ License
#include "STARCDCoordinateRotation.H"
#include "Switch.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
@ -138,7 +137,7 @@ Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
rotation.component(vector::X),
rotation.component(vector::Y),
rotation.component(vector::Z),
dict.lookupOrDefault<Switch>("degrees", true)
dict.lookupOrDefault("degrees", true)
);
}

View File

@ -26,7 +26,6 @@ License
#include "cylindricalCS.H"
#include "one.H"
#include "Switch.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
@ -106,7 +105,7 @@ Foam::cylindricalCS::cylindricalCS
)
:
coordinateSystem(name, dict),
inDegrees_(dict.lookupOrDefault<Switch>("degrees", true))
inDegrees_(dict.lookupOrDefault("degrees", true))
{}

View File

@ -26,7 +26,6 @@ License
#include "sphericalCS.H"
#include "one.H"
#include "Switch.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
@ -106,7 +105,7 @@ Foam::sphericalCS::sphericalCS
)
:
coordinateSystem(name, dict),
inDegrees_(dict.lookupOrDefault<Switch>("degrees", true))
inDegrees_(dict.lookupOrDefault("degrees", true))
{}

View File

@ -22,8 +22,8 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
From scotch forum:
By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ]
By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ]
2008-08-22 10:09 Strategy handling in Scotch is a bit tricky. In order
not to be confused, you must have a clear view of how they are built.
Here are some rules:
@ -173,45 +173,39 @@ Foam::label Foam::ptscotchDecomp::decompose
// const dictionary& scotchCoeffs =
// decompositionDict_.subDict("ptscotchCoeffs");
//
// if (scotchCoeffs.found("writeGraph"))
// if (scotchCoeffs.lookupOrDefault("writeGraph", false))
// {
// Switch writeGraph(scotchCoeffs.lookup("writeGraph"));
// OFstream str(mesh_.time().path() / mesh_.name() + ".grf");
//
// if (writeGraph)
// Info<< "Dumping Scotch graph file to " << str.name() << endl
// << "Use this in combination with gpart." << endl;
//
// label version = 0;
// str << version << nl;
// // Numer of vertices
// str << xadj.size()-1 << ' ' << adjncy.size() << nl;
// // Numbering starts from 0
// label baseval = 0;
// // Has weights?
// label hasEdgeWeights = 0;
// label hasVertexWeights = 0;
// label numericflag = 10*hasEdgeWeights+hasVertexWeights;
// str << baseval << ' ' << numericflag << nl;
// for (label cellI = 0; cellI < xadj.size()-1; cellI++)
// {
// OFstream str(mesh_.time().path() / mesh_.name() + ".grf");
// label start = xadj[cellI];
// label end = xadj[cellI+1];
// str << end-start;
//
// Info<< "Dumping Scotch graph file to " << str.name() << endl
// << "Use this in combination with gpart." << endl;
//
// label version = 0;
// str << version << nl;
// // Numer of vertices
// str << xadj.size()-1 << ' ' << adjncy.size() << nl;
// // Numbering starts from 0
// label baseval = 0;
// // Has weights?
// label hasEdgeWeights = 0;
// label hasVertexWeights = 0;
// label numericflag = 10*hasEdgeWeights+hasVertexWeights;
// str << baseval << ' ' << numericflag << nl;
// for (label cellI = 0; cellI < xadj.size()-1; cellI++)
// for (label i = start; i < end; i++)
// {
// label start = xadj[cellI];
// label end = xadj[cellI+1];
// str << end-start;
//
// for (label i = start; i < end; i++)
// {
// str << ' ' << adjncy[i];
// }
// str << nl;
// str << ' ' << adjncy[i];
// }
// str << nl;
// }
// }
// }
// Strategy
// ~~~~~~~~

View File

@ -22,8 +22,8 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
From scotch forum:
By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ]
By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ]
2008-08-22 10:09 Strategy handling in Scotch is a bit tricky. In order
not to be confused, you must have a clear view of how they are built.
Here are some rules:
@ -179,40 +179,35 @@ Foam::label Foam::scotchDecomp::decompose
const dictionary& scotchCoeffs =
decompositionDict_.subDict("scotchCoeffs");
if (scotchCoeffs.found("writeGraph"))
if (scotchCoeffs.lookupOrDefault("writeGraph", false))
{
Switch writeGraph(scotchCoeffs.lookup("writeGraph"));
OFstream str(meshPath + ".grf");
if (writeGraph)
Info<< "Dumping Scotch graph file to " << str.name() << endl
<< "Use this in combination with gpart." << endl;
label version = 0;
str << version << nl;
// Numer of vertices
str << xadj.size()-1 << ' ' << adjncy.size() << nl;
// Numbering starts from 0
label baseval = 0;
// Has weights?
label hasEdgeWeights = 0;
label hasVertexWeights = 0;
label numericflag = 10*hasEdgeWeights+hasVertexWeights;
str << baseval << ' ' << numericflag << nl;
for (label cellI = 0; cellI < xadj.size()-1; cellI++)
{
OFstream str(meshPath + ".grf");
label start = xadj[cellI];
label end = xadj[cellI+1];
str << end-start;
Info<< "Dumping Scotch graph file to " << str.name() << endl
<< "Use this in combination with gpart." << endl;
label version = 0;
str << version << nl;
// Numer of vertices
str << xadj.size()-1 << ' ' << adjncy.size() << nl;
// Numbering starts from 0
label baseval = 0;
// Has weights?
label hasEdgeWeights = 0;
label hasVertexWeights = 0;
label numericflag = 10*hasEdgeWeights+hasVertexWeights;
str << baseval << ' ' << numericflag << nl;
for (label cellI = 0; cellI < xadj.size()-1; cellI++)
for (label i = start; i < end; i++)
{
label start = xadj[cellI];
label end = xadj[cellI+1];
str << end-start;
for (label i = start; i < end; i++)
{
str << ' ' << adjncy[i];
}
str << nl;
str << ' ' << adjncy[i];
}
str << nl;
}
}
}
@ -230,7 +225,6 @@ Foam::label Foam::scotchDecomp::decompose
const dictionary& scotchCoeffs =
decompositionDict_.subDict("scotchCoeffs");
string strategy;
if (scotchCoeffs.readIfPresent("strategy", strategy))
{

View File

@ -38,6 +38,7 @@ SourceFiles
#include "cloud.H"
#include "polyMesh.H"
#include "IOobjectList.H"
#include "IOFieldField.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -67,6 +68,16 @@ tmp<IOField<Type> > reconstructLagrangianField
);
template<class Type>
tmp<IOFieldField<Field<Type>, Type> > reconstructLagrangianFieldField
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const word& fieldName
);
template<class Type>
void reconstructLagrangianFields
(
@ -77,6 +88,16 @@ void reconstructLagrangianFields
);
template<class Type>
void reconstructLagrangianFieldFields
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const IOobjectList& objects
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "IOField.H"
#include "IOFieldField.H"
#include "Time.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
@ -87,6 +88,67 @@ Foam::tmp<Foam::IOField<Type> > Foam::reconstructLagrangianField
}
template<class Type>
Foam::tmp<Foam::IOFieldField<Foam::Field<Type>, Type> >
Foam::reconstructLagrangianFieldField
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const word& fieldName
)
{
// Construct empty field on mesh
tmp<IOFieldField<Field<Type>, Type > > tfield
(
new IOFieldField<Field<Type>, Type>
(
IOobject
(
fieldName,
mesh.time().timeName(),
cloud::prefix/cloudName,
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
Field<Field<Type> >(0)
)
);
Field<Field<Type> >& field = tfield();
forAll(meshes, i)
{
// Check object on local mesh
IOobject localIOobject
(
fieldName,
meshes[i].time().timeName(),
cloud::prefix/cloudName,
meshes[i],
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (localIOobject.headerOk())
{
IOFieldField<Field<Type>, Type> fieldi(localIOobject);
label offset = field.size();
field.setSize(offset + fieldi.size());
forAll(fieldi, j)
{
field[offset + j] = fieldi[j];
}
}
}
return tfield;
}
template<class Type>
void Foam::reconstructLagrangianFields
(
@ -122,4 +184,67 @@ void Foam::reconstructLagrangianFields
}
template<class Type>
void Foam::reconstructLagrangianFieldFields
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const IOobjectList& objects
)
{
{
const word fieldClassName(IOFieldField<Field<Type>, Type>::typeName);
IOobjectList fields = objects.lookupClass(fieldClassName);
if (fields.size())
{
Info<< " Reconstructing lagrangian "
<< fieldClassName << "s\n" << endl;
forAllConstIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianFieldField<Type>
(
cloudName,
mesh,
meshes,
fieldIter()->name()
)().write();
}
Info<< endl;
}
}
{
const word fieldClassName(IOField<Field<Type> >::typeName);
IOobjectList fields = objects.lookupClass(fieldClassName);
if (fields.size())
{
Info<< " Reconstructing lagrangian "
<< fieldClassName << "s\n" << endl;
forAllConstIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianFieldField<Type>
(
cloudName,
mesh,
meshes,
fieldIter()->name()
)().write();
}
Info<< endl;
}
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View File

@ -76,11 +76,9 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
rhoInf_ = readScalar(dict.lookup("rhoInf"));
}
if (dict.found("g"))
if (dict.readIfPresent("g", g_))
{
lookupGravity_ = -2;
g_ = dict.lookup("g");
}
if (!dict.found("value"))

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,6 +28,7 @@ License
#include "error.H"
#include "Time.H"
#include "OSspecific.H"
#include "PstreamReduceOps.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -52,8 +53,12 @@ const Foam::NamedEnum<Foam::abortCalculation::actionType, 3>
void Foam::abortCalculation::removeFile() const
{
if (isFile(abortFile_))
bool hasAbort = isFile(abortFile_);
reduce(hasAbort, orOp<bool>());
if (hasAbort && Pstream::master())
{
// cleanup ABORT file (on master only)
rm(abortFile_);
}
}
@ -92,14 +97,9 @@ Foam::abortCalculation::~abortCalculation()
void Foam::abortCalculation::read(const dictionary& dict)
{
word actionName;
if (dict.found("action"))
{
action_ = actionTypeNames_.read
(
dict.lookup("action")
);
action_ = actionTypeNames_.read(dict.lookup("action"));
}
else
{
@ -115,27 +115,48 @@ void Foam::abortCalculation::read(const dictionary& dict)
void Foam::abortCalculation::execute()
{
if (isFile(abortFile_))
bool hasAbort = isFile(abortFile_);
reduce(hasAbort, orOp<bool>());
if (hasAbort)
{
switch (action_)
{
case noWriteNow :
obr_.time().stopAt(Time::saNoWriteNow);
Info<< "user requested abort - "
"stop immediately without writing data" << endl;
{
if (obr_.time().stopAt(Time::saNoWriteNow))
{
Info<< "USER REQUESTED ABORT (timeIndex="
<< obr_.time().timeIndex()
<< "): stop without writing data"
<< endl;
}
break;
}
case writeNow :
obr_.time().stopAt(Time::saWriteNow);
Info<< "user requested abort - "
"stop immediately with writing data" << endl;
{
if (obr_.time().stopAt(Time::saWriteNow))
{
Info<< "USER REQUESTED ABORT (timeIndex="
<< obr_.time().timeIndex()
<< "): stop+write data"
<< endl;
}
break;
}
case nextWrite :
obr_.time().stopAt(Time::saNextWrite);
Info<< "user requested abort - "
"stop after next data write" << endl;
{
if (obr_.time().stopAt(Time::saNextWrite))
{
Info<< "USER REQUESTED ABORT (timeIndex="
<< obr_.time().timeIndex()
<< "): stop after next data write"
<< endl;
}
break;
}
}
}
}
@ -149,7 +170,7 @@ void Foam::abortCalculation::end()
void Foam::abortCalculation::write()
{
execute();
// Do nothing - only valid on execute
}

View File

@ -47,8 +47,12 @@ bool Foam::residualControl::checkCriteria(const bool verbose) const
if (maxResiduals_.readIfPresent(variableName, maxResidual))
{
// use the residual from the first solution
const scalar eqnResidual =
lduMatrix::solverPerformance(iter().stream()).initialResidual();
List<lduMatrix::solverPerformance>
(
iter().stream()
).first().initialResidual();
achieved = achieved && (eqnResidual < maxResidual);

View File

@ -2,7 +2,7 @@
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile