35void Foam::pairPotentialList::readPairPotentialDict
37 const List<word>& idList,
42 Info<<
nl <<
"Building pair potentials." <<
endl;
46 for (label a = 0; a < nIds_; ++a)
50 for (label
b = a;
b < nIds_; ++
b)
54 word pairPotentialName;
58 if (pairPotentialDict.found(idA +
"-" + idB))
60 pairPotentialName = idA +
"-" + idB;
65 <<
"Pair pairPotential specification subDict "
66 << idA <<
"-" << idB <<
" not found"
72 if (pairPotentialDict.found(idA +
"-" + idB))
74 pairPotentialName = idA +
"-" + idB;
77 else if (pairPotentialDict.found(idB +
"-" + idA))
79 pairPotentialName = idB +
"-" + idA;
85 <<
"Pair pairPotential specification subDict "
86 << idA <<
"-" << idB <<
" or "
87 << idB <<
"-" << idA <<
" not found"
93 pairPotentialDict.found(idA+
"-"+idB)
94 && pairPotentialDict.found(idB+
"-"+idA)
98 <<
"Pair pairPotential specification subDict "
99 << idA <<
"-" << idB <<
" and "
100 << idB <<
"-" << idA <<
" found multiple definition"
107 pairPotentialIndex(a,
b),
111 pairPotentialDict.subDict(pairPotentialName)
115 if ((*
this)[pairPotentialIndex(a,
b)].
rCut() > rCutMax_)
117 rCutMax_ = (*this)[pairPotentialIndex(a,
b)].rCut();
120 if ((*
this)[pairPotentialIndex(a,
b)].writeTables())
123 autoPtr<OSstream> ppTabFile
127 mesh.time().path()/pairPotentialName
133 !(*
this)[pairPotentialIndex(a,
b)].writeEnergyAndForceTables
140 <<
"Failed writing to "
141 << ppTabFile().name() <<
nl
148 if (!pairPotentialDict.found(
"electrostatic"))
151 <<
"Pair pairPotential specification subDict electrostatic"
158 pairPotentialDict.subDict(
"electrostatic")
161 if (electrostaticPotential_->rCut() > rCutMax_)
163 rCutMax_ = electrostaticPotential_->rCut();
166 if (electrostaticPotential_->writeTables())
169 autoPtr<OSstream> ppTabFile
173 mesh.time().path()/
"electrostatic"
177 if (!electrostaticPotential_->writeEnergyAndForceTables(ppTabFile()))
180 <<
"Failed writing to "
181 << ppTabFile().name() <<
nl
186 rCutMaxSqr_ = rCutMax_*rCutMax_;
228 nIds_ = idList.
size();
230 readPairPotentialDict(idList, pairPotentialDict,
mesh);
240 return (*
this)[pairPotentialIndex(a,
b)];
246 if (rIJMagSqr < rCutMaxSqr_)
259 const scalar rIJMagSqr
262 if (rIJMagSqr < rCutSqr(a,
b))
277 return (*
this)[pairPotentialIndex(a,
b)].rMin();
287 return (*
this)[pairPotentialIndex(a,
b)].dr();
297 return (*
this)[pairPotentialIndex(a,
b)].rCutSqr();
307 return (*
this)[pairPotentialIndex(a,
b)].rCut();
318 scalar
f = (*this)[pairPotentialIndex(a,
b)].force(rIJMag);
331 scalar
e = (*this)[pairPotentialIndex(a,
b)].energy(rIJMag);
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
constexpr PtrList() noexcept
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler().
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr char nl
The newline '\n' character (0x0a).
points setSize(newPointi)