35 void Foam::pairPotentialList::readPairPotentialDict
37 const List<word>& idList,
38 const dictionary& pairPotentialDict,
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_;
207 buildPotentials(idList, pairPotentialDict,
mesh);
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);
void size(const label n)
Older name for setAddressableSize.
static autoPtr< pairPotential > New(const word &name, const dictionary &pairPotentialProperties)
Return a reference to the selected viscosity model.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
bool rCutSqr(const label a, const label b, const scalar rIJMagSqr) const
Ostream & endl(Ostream &os)
Add newline and flush stream.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler()
points setSize(newPointi)
const dimensionedScalar e
Elementary charge.
const pairPotential & pairPotentialFunction(const label a, const label b) const
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
errorManip< error > abort(error &err)
void buildPotentials(const List< word > &idList, const dictionary &pairPotentialDict, const polyMesh &mesh)
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
scalar rMin(const label a, const label b) const
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
scalar dr(const label a, const label b) const
scalar rCut(const label a, const label b) const
~pairPotentialList()
Destructor.
scalar force(const label a, const label b, const scalar rIJMag) const
scalar rCutMaxSqr() const
scalar energy(const label a, const label b, const scalar rIJMag) const