32 void Foam::pairPotentialList::readPairPotentialDict
34 const List<word>& idList,
35 const dictionary& pairPotentialDict,
39 Info<<
nl <<
"Building pair potentials." <<
endl;
43 for (
label a = 0; a < nIds_; ++a)
51 word pairPotentialName;
55 if (pairPotentialDict.found(idA +
"-" + idB))
57 pairPotentialName = idA +
"-" + idB;
62 <<
"Pair pairPotential specification subDict "
63 << idA <<
"-" << idB <<
" not found"
69 if (pairPotentialDict.found(idA +
"-" + idB))
71 pairPotentialName = idA +
"-" + idB;
74 else if (pairPotentialDict.found(idB +
"-" + idA))
76 pairPotentialName = idB +
"-" + idA;
82 <<
"Pair pairPotential specification subDict "
83 << idA <<
"-" << idB <<
" or "
84 << idB <<
"-" << idA <<
" not found"
90 pairPotentialDict.found(idA+
"-"+idB)
91 && pairPotentialDict.found(idB+
"-"+idA)
95 <<
"Pair pairPotential specification subDict "
96 << idA <<
"-" << idB <<
" and "
97 << idB <<
"-" << idA <<
" found multiple definition"
104 pairPotentialIndex(a,
b),
108 pairPotentialDict.subDict(pairPotentialName)
112 if ((*
this)[pairPotentialIndex(a,
b)].
rCut() > rCutMax_)
114 rCutMax_ = (*this)[pairPotentialIndex(a,
b)].rCut();
117 if ((*
this)[pairPotentialIndex(a,
b)].writeTables())
120 autoPtr<Ostream> ppTabFile
130 !(*
this)[pairPotentialIndex(a,
b)].writeEnergyAndForceTables
137 <<
"Failed writing to "
138 << ppTabFile().name() <<
nl
145 if (!pairPotentialDict.found(
"electrostatic"))
148 <<
"Pair pairPotential specification subDict electrostatic"
155 pairPotentialDict.subDict(
"electrostatic")
158 if (electrostaticPotential_->rCut() > rCutMax_)
160 rCutMax_ = electrostaticPotential_->rCut();
163 if (electrostaticPotential_->writeTables())
166 autoPtr<Ostream> ppTabFile
174 if (!electrostaticPotential_->writeEnergyAndForceTables(ppTabFile()))
177 <<
"Failed writing to "
178 << ppTabFile().name() <<
nl
183 rCutMaxSqr_ = rCutMax_*rCutMax_;
225 nIds_ = idList.
size();
227 readPairPotentialDict(idList, pairPotentialDict,
mesh);
237 return (*
this)[pairPotentialIndex(a,
b)];
243 if (rIJMagSqr < rCutMaxSqr_)
258 const scalar rIJMagSqr
261 if (rIJMagSqr < rCutSqr(a,
b))
278 return (*
this)[pairPotentialIndex(a,
b)].rMin();
288 return (*
this)[pairPotentialIndex(a,
b)].dr();
298 return (*
this)[pairPotentialIndex(a,
b)].rCutSqr();
308 return (*
this)[pairPotentialIndex(a,
b)].rCut();
319 scalar
f = (*this)[pairPotentialIndex(a,
b)].force(rIJMag);
332 scalar
e = (*this)[pairPotentialIndex(a,
b)].energy(rIJMag);
void size(const label)
Override size to be inconsistent with allocated storage.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
fileName path() const
Explicitly inherit path from TimePaths to disambiguate from.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
virtual bool mkDir(const fileName &, mode_t=0777) const =0
Make directory.
const Time & time() const
Return the top-level database.
scalar energy(const label a, const label b, const scalar rIJMag) const
scalar force(const label a, const label b, const scalar rIJMag) const
scalar rCut(const label a, const label b) const
scalar rCutMaxSqr() const
bool rCutSqr(const label a, const label b, const scalar rIJMagSqr) const
~pairPotentialList()
Destructor.
scalar dr(const label a, const label b) const
void buildPotentials(const List< word > &idList, const dictionary &pairPotentialDict, const polyMesh &mesh)
const pairPotential & pairPotentialFunction(const label a, const label b) const
scalar rMin(const label a, const label b) const
static autoPtr< pairPotential > New(const word &name, const dictionary &pairPotentialProperties)
Return a reference to the selected viscosity model.
Mesh consisting of general polyhedral cells.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fileOperation & fileHandler()
Get current file handler.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
points setSize(newPointi)