mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy2/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -1,165 +0,0 @@
|
||||
// ============================================================================
|
||||
// gzstream, C++ iostream classes wrapping the zlib compression library.
|
||||
// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library 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
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// ============================================================================
|
||||
//
|
||||
// File : gzstream.C
|
||||
// Revision : $Revision: 1.7 $
|
||||
// Revision_date : $Date: 2003/01/08 14:41:27 $
|
||||
// Author(s) : Deepak Bandyopadhyay, Lutz Kettner
|
||||
//
|
||||
// Standard streambuf implementation following Nicolai Josuttis, "The
|
||||
// Standard C++ Library".
|
||||
// ============================================================================
|
||||
|
||||
#include <gzstream.h>
|
||||
#include <iostream>
|
||||
#include <string.h> // for memcpy
|
||||
|
||||
#ifdef GZSTREAM_NAMESPACE
|
||||
namespace GZSTREAM_NAMESPACE {
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Internal classes to implement gzstream. See header file for user classes.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// --------------------------------------
|
||||
// class gzstreambuf:
|
||||
// --------------------------------------
|
||||
|
||||
gzstreambuf* gzstreambuf::open( const char* name, int open_mode) {
|
||||
if ( is_open())
|
||||
return reinterpret_cast<gzstreambuf*>(0);
|
||||
mode = open_mode;
|
||||
// no append nor read/write mode
|
||||
if ((mode & std::ios::ate) || (mode & std::ios::app)
|
||||
|| ((mode & std::ios::in) && (mode & std::ios::out)))
|
||||
return reinterpret_cast<gzstreambuf*>(0);
|
||||
char fmode[10];
|
||||
char* fmodeptr = fmode;
|
||||
if ( mode & std::ios::in)
|
||||
*fmodeptr++ = 'r';
|
||||
else if ( mode & std::ios::out)
|
||||
*fmodeptr++ = 'w';
|
||||
*fmodeptr++ = 'b';
|
||||
*fmodeptr = '\0';
|
||||
file = gzopen( name, fmode);
|
||||
if (file == 0)
|
||||
return reinterpret_cast<gzstreambuf*>(0);
|
||||
opened = 1;
|
||||
return this;
|
||||
}
|
||||
|
||||
gzstreambuf * gzstreambuf::close() {
|
||||
if ( is_open()) {
|
||||
sync();
|
||||
opened = 0;
|
||||
if ( gzclose( file) == Z_OK)
|
||||
return this;
|
||||
}
|
||||
return reinterpret_cast<gzstreambuf*>(0);
|
||||
}
|
||||
|
||||
int gzstreambuf::underflow() { // used for input buffer only
|
||||
if ( gptr() && ( gptr() < egptr()))
|
||||
return * reinterpret_cast<unsigned char *>( gptr());
|
||||
|
||||
if ( ! (mode & std::ios::in) || ! opened)
|
||||
return EOF;
|
||||
// Josuttis' implementation of inbuf
|
||||
int n_putback = gptr() - eback();
|
||||
if ( n_putback > 4)
|
||||
n_putback = 4;
|
||||
memcpy( buffer + (4 - n_putback), gptr() - n_putback, n_putback);
|
||||
|
||||
int num = gzread( file, buffer+4, bufferSize-4);
|
||||
if (num <= 0) // ERROR or EOF
|
||||
return EOF;
|
||||
|
||||
// reset buffer pointers
|
||||
setg( buffer + (4 - n_putback), // beginning of putback area
|
||||
buffer + 4, // read position
|
||||
buffer + 4 + num); // end of buffer
|
||||
|
||||
// return next character
|
||||
return * reinterpret_cast<unsigned char *>( gptr());
|
||||
}
|
||||
|
||||
int gzstreambuf::flush_buffer() {
|
||||
// Separate the writing of the buffer from overflow() and
|
||||
// sync() operation.
|
||||
int w = pptr() - pbase();
|
||||
if ( gzwrite( file, pbase(), w) != w)
|
||||
return EOF;
|
||||
pbump( -w);
|
||||
return w;
|
||||
}
|
||||
|
||||
int gzstreambuf::overflow( int c) { // used for output buffer only
|
||||
if ( ! ( mode & std::ios::out) || ! opened)
|
||||
return EOF;
|
||||
if (c != EOF) {
|
||||
*pptr() = c;
|
||||
pbump(1);
|
||||
}
|
||||
if ( flush_buffer() == EOF)
|
||||
return EOF;
|
||||
return c;
|
||||
}
|
||||
|
||||
int gzstreambuf::sync() {
|
||||
// Changed to use flush_buffer() instead of overflow( EOF)
|
||||
// which caused improper behavior with std::endl and flush(),
|
||||
// bug reported by Vincent Ricard.
|
||||
if ( pptr() && pptr() > pbase()) {
|
||||
if ( flush_buffer() == EOF)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --------------------------------------
|
||||
// class gzstreambase:
|
||||
// --------------------------------------
|
||||
|
||||
gzstreambase::gzstreambase( const char* name, int mode) {
|
||||
init( &buf);
|
||||
open( name, mode);
|
||||
}
|
||||
|
||||
gzstreambase::~gzstreambase() {
|
||||
buf.close();
|
||||
}
|
||||
|
||||
void gzstreambase::open( const char* name, int open_mode) {
|
||||
if ( ! buf.open( name, open_mode))
|
||||
clear( rdstate() | std::ios::badbit);
|
||||
}
|
||||
|
||||
void gzstreambase::close() {
|
||||
if ( buf.is_open())
|
||||
if ( ! buf.close())
|
||||
clear( rdstate() | std::ios::badbit);
|
||||
}
|
||||
|
||||
#ifdef GZSTREAM_NAMESPACE
|
||||
} // namespace GZSTREAM_NAMESPACE
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// EOF //
|
||||
@ -1,121 +0,0 @@
|
||||
// ============================================================================
|
||||
// gzstream, C++ iostream classes wrapping the zlib compression library.
|
||||
// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library 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
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// ============================================================================
|
||||
//
|
||||
// File : gzstream.h
|
||||
// Revision : $Revision: 1.5 $
|
||||
// Revision_date : $Date: 2002/04/26 23:30:15 $
|
||||
// Author(s) : Deepak Bandyopadhyay, Lutz Kettner
|
||||
//
|
||||
// Standard streambuf implementation following Nicolai Josuttis, "The
|
||||
// Standard C++ Library".
|
||||
// ============================================================================
|
||||
|
||||
#ifndef GZSTREAM_H
|
||||
#define GZSTREAM_H 1
|
||||
|
||||
// standard C++ with new header file names and std:: namespace
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef GZSTREAM_NAMESPACE
|
||||
namespace GZSTREAM_NAMESPACE {
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Internal classes to implement gzstream. See below for user classes.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class gzstreambuf : public std::streambuf {
|
||||
private:
|
||||
static const int bufferSize = 47+256; // size of data buff
|
||||
// totals 512 bytes under g++ for igzstream at the end.
|
||||
|
||||
gzFile file; // file handle for compressed file
|
||||
char buffer[bufferSize]; // data buffer
|
||||
char opened; // open/close state of stream
|
||||
int mode; // I/O mode
|
||||
|
||||
int flush_buffer();
|
||||
public:
|
||||
gzstreambuf() : opened(0) {
|
||||
setp( buffer, buffer + (bufferSize-1));
|
||||
setg( buffer + 4, // beginning of putback area
|
||||
buffer + 4, // read position
|
||||
buffer + 4); // end position
|
||||
// ASSERT: both input & output capabilities will not be used together
|
||||
}
|
||||
int is_open() { return opened; }
|
||||
gzstreambuf* open( const char* name, int open_mode);
|
||||
gzstreambuf* close();
|
||||
~gzstreambuf() { close(); }
|
||||
|
||||
virtual int overflow( int c = EOF);
|
||||
virtual int underflow();
|
||||
virtual int sync();
|
||||
};
|
||||
|
||||
class gzstreambase : virtual public std::ios {
|
||||
protected:
|
||||
gzstreambuf buf;
|
||||
public:
|
||||
gzstreambase() { init(&buf); }
|
||||
gzstreambase( const char* name, int open_mode);
|
||||
~gzstreambase();
|
||||
void open( const char* name, int open_mode);
|
||||
void close();
|
||||
gzstreambuf* rdbuf() { return &buf; }
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// User classes. Use igzstream and ogzstream analogously to ifstream and
|
||||
// ofstream respectively. They read and write files based on the gz*
|
||||
// function interface of the zlib. Files are compatible with gzip compression.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class igzstream : public gzstreambase, public std::istream {
|
||||
public:
|
||||
igzstream() : std::istream( &buf) {}
|
||||
igzstream( const char* name, int open_mode = std::ios::in)
|
||||
: gzstreambase( name, open_mode), std::istream( &buf) {}
|
||||
gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); }
|
||||
void open( const char* name, int open_mode = std::ios::in) {
|
||||
gzstreambase::open( name, open_mode);
|
||||
}
|
||||
};
|
||||
|
||||
class ogzstream : public gzstreambase, public std::ostream {
|
||||
public:
|
||||
ogzstream() : std::ostream( &buf) {}
|
||||
ogzstream( const char* name, int mode = std::ios::out)
|
||||
: gzstreambase( name, mode), std::ostream( &buf) {}
|
||||
gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); }
|
||||
void open( const char* name, int open_mode = std::ios::out) {
|
||||
gzstreambase::open( name, open_mode);
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef GZSTREAM_NAMESPACE
|
||||
} // namespace GZSTREAM_NAMESPACE
|
||||
#endif
|
||||
|
||||
#endif // GZSTREAM_H
|
||||
// ============================================================================
|
||||
// EOF //
|
||||
|
||||
@ -803,7 +803,7 @@ public:
|
||||
(
|
||||
const dictionary& shrinkDict,
|
||||
const dictionary& motionDict,
|
||||
const scalar nAllowableErrors,
|
||||
const label nAllowableErrors,
|
||||
motionSmoother&
|
||||
);
|
||||
|
||||
|
||||
@ -2346,7 +2346,7 @@ void Foam::autoHexMeshDriver::addLayers
|
||||
(
|
||||
const dictionary& shrinkDict,
|
||||
const dictionary& motionDict,
|
||||
const scalar nAllowableErrors,
|
||||
const label nAllowableErrors,
|
||||
motionSmoother& meshMover
|
||||
)
|
||||
{
|
||||
|
||||
@ -103,8 +103,6 @@ $(derivedFvPatchFields)/timeVaryingUniformTotalPressure/timeVaryingUniformTotalP
|
||||
$(derivedFvPatchFields)/totalTemperature/totalTemperatureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/turbulentInlet/turbulentInletFvPatchFields.C
|
||||
$(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
|
||||
|
||||
|
||||
@ -32,15 +32,28 @@ License
|
||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// adjust negative resistance values to be multiplier of max value
|
||||
void Foam::porousZone::adjustNegativeResistance(vector& resist)
|
||||
void Foam::porousZone::adjustNegativeResistance(dimensionedVector& resist)
|
||||
{
|
||||
scalar maxCmpt = max(0, cmptMax(resist));
|
||||
scalar maxCmpt = max(0, cmptMax(resist.value()));
|
||||
|
||||
for (label cmpt=0; cmpt < vector::nComponents; ++cmpt)
|
||||
if (maxCmpt < 0)
|
||||
{
|
||||
if (resist[cmpt] < 0)
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::porousZone::porousZone::adjustNegativeResistance"
|
||||
"(dimensionedVector&)"
|
||||
) << "negative resistances! " << resist
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
vector& val = resist.value();
|
||||
for (label cmpt=0; cmpt < vector::nComponents; ++cmpt)
|
||||
{
|
||||
resist[cmpt] *= -maxCmpt;
|
||||
if (val[cmpt] < 0)
|
||||
{
|
||||
val[cmpt] *= -maxCmpt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,24 +84,20 @@ Foam::porousZone::porousZone
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::porousZone::porousZone"
|
||||
"(const fvMesh&, const Istream&)"
|
||||
"(const fvMesh&, const word&, const dictionary&)"
|
||||
) << "cannot find porous cellZone " << name_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// local-to-global transformation tensor
|
||||
const tensor& E = coordSys_.R();
|
||||
|
||||
// porosity
|
||||
if (dict_.found("porosity"))
|
||||
if (dict_.readIfPresent("porosity", porosity_))
|
||||
{
|
||||
dict_.lookup("porosity") >> porosity_;
|
||||
|
||||
if (porosity_ <= 0.0 || porosity_ > 1.0)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"Foam::porousZone::porousZone(const fvMesh&, const Istream&)",
|
||||
"Foam::porousZone::porousZone"
|
||||
"(const fvMesh&, const word&, const dictionary&)",
|
||||
dict_
|
||||
)
|
||||
<< "out-of-range porosity value " << porosity_
|
||||
@ -97,73 +106,64 @@ Foam::porousZone::porousZone
|
||||
}
|
||||
|
||||
// powerLaw coefficients
|
||||
if (dict_.found("powerLaw"))
|
||||
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
|
||||
{
|
||||
const dictionary& subDict = dict_.subDict("powerLaw");
|
||||
if (subDict.found("C0"))
|
||||
{
|
||||
subDict.lookup("C0") >> C0_;
|
||||
}
|
||||
if (subDict.found("C1"))
|
||||
{
|
||||
subDict.lookup("C1") >> C1_;
|
||||
}
|
||||
dictPtr->readIfPresent("C0", C0_);
|
||||
dictPtr->readIfPresent("C1", C1_);
|
||||
}
|
||||
|
||||
// Darcy-Forchheimer coefficients
|
||||
if (dict_.found("Darcy"))
|
||||
if (const dictionary* dictPtr = dict_.subDictPtr("Darcy"))
|
||||
{
|
||||
const dictionary& subDict = dict_.subDict("Darcy");
|
||||
// local-to-global transformation tensor
|
||||
const tensor& E = coordSys_.R();
|
||||
|
||||
dimensionedVector d("d", D_.dimensions(), vector::zero);
|
||||
dimensionedVector f("f", F_.dimensions(), vector::zero);
|
||||
|
||||
if (subDict.found("d"))
|
||||
dimensionedVector d(vector::zero);
|
||||
if (dictPtr->readIfPresent("d", d))
|
||||
{
|
||||
// d = dimensionedVector("d", subDict.lookup("d"));
|
||||
subDict.lookup("d") >> d;
|
||||
adjustNegativeResistance(d.value());
|
||||
if (D_.dimensions() != d.dimensions())
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"Foam::porousZone::porousZone"
|
||||
"(const fvMesh&, const word&, const dictionary&)",
|
||||
dict_
|
||||
) << "incorrect dimensions for d: " << d.dimensions()
|
||||
<< " should be " << D_.dimensions()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
}
|
||||
if (subDict.found("f"))
|
||||
{
|
||||
// f = dimensionedVector("f", subDict.lookup("f"));
|
||||
subDict.lookup("f") >> f;
|
||||
adjustNegativeResistance(f.value());
|
||||
adjustNegativeResistance(d);
|
||||
|
||||
D_.value().xx() = d.value().x();
|
||||
D_.value().yy() = d.value().y();
|
||||
D_.value().zz() = d.value().z();
|
||||
D_.value() = (E & D_ & E.T()).value();
|
||||
}
|
||||
|
||||
if (D_.dimensions() != d.dimensions())
|
||||
dimensionedVector f(vector::zero);
|
||||
if (dictPtr->readIfPresent("f", f))
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"Foam::porousZone::porousZone(const fvMesh&, const Istream&)",
|
||||
dict_
|
||||
) << "incorrect dimensions for d: " << d.dimensions()
|
||||
<< " should be " << D_.dimensions()
|
||||
<< exit(FatalIOError);
|
||||
if (F_.dimensions() != f.dimensions())
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"Foam::porousZone::porousZone"
|
||||
"(const fvMesh&, const word&, const dictionary&)",
|
||||
dict_
|
||||
) << "incorrect dimensions for f: " << f.dimensions()
|
||||
<< " should be " << F_.dimensions()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
adjustNegativeResistance(f);
|
||||
|
||||
// leading 0.5 is from 1/2 * rho
|
||||
F_.value().xx() = 0.5*f.value().x();
|
||||
F_.value().yy() = 0.5*f.value().y();
|
||||
F_.value().zz() = 0.5*f.value().z();
|
||||
F_.value() = (E & F_ & E.T()).value();
|
||||
}
|
||||
|
||||
if (F_.dimensions() != f.dimensions())
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"Foam::porousZone::porousZone(const fvMesh&, const Istream&)",
|
||||
dict_
|
||||
) << "incorrect dimensions for f: " << f.dimensions()
|
||||
<< " should be " << F_.dimensions()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
D_.value().xx() = d.value().x();
|
||||
D_.value().yy() = d.value().y();
|
||||
D_.value().zz() = d.value().z();
|
||||
D_.value() = (E & D_ & E.T()).value();
|
||||
|
||||
// leading 0.5 is from 1/2 * rho
|
||||
F_.value().xx() = 0.5*f.value().x();
|
||||
F_.value().yy() = 0.5*f.value().y();
|
||||
F_.value().zz() = 0.5*f.value().z();
|
||||
F_.value() = (E & F_ & E.T()).value();
|
||||
}
|
||||
|
||||
// provide some feedback for the user
|
||||
@ -179,7 +179,8 @@ Foam::porousZone::porousZone
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"Foam::porousZone::porousZone(const fvMesh&, const Istream&)",
|
||||
"Foam::porousZone::porousZone"
|
||||
"(const fvMesh&, const word&, const dictionary&)",
|
||||
dict_
|
||||
) << "neither powerLaw (C0/C1) "
|
||||
"nor Darcy-Forchheimer law (d/f) specified"
|
||||
|
||||
@ -128,7 +128,7 @@ class porousZone
|
||||
// Private Member Functions
|
||||
|
||||
//- adjust negative resistance values to be multiplier of max value
|
||||
static void adjustNegativeResistance(vector& resist);
|
||||
static void adjustNegativeResistance(dimensionedVector& resist);
|
||||
|
||||
//- Power-law resistance
|
||||
template<class RhoFieldType>
|
||||
|
||||
@ -5,4 +5,6 @@ wmake libso basic
|
||||
wmake libso solidParticle
|
||||
wmake libso intermediate
|
||||
wmake libso dieselSpray
|
||||
wmake libso molecule
|
||||
(cd molecularDynamics && wmake libso potential)
|
||||
(cd molecularDynamics && wmake libso molecule)
|
||||
|
||||
|
||||
@ -11,11 +11,6 @@ referredMolecule = referredMolecule
|
||||
referredCellList = referredCellList
|
||||
referredCell = referredCell
|
||||
referralLists = referralLists
|
||||
|
||||
potentials = potentials
|
||||
pairPotential = $(potentials)/pairPotential
|
||||
tetherPotential = $(potentials)/tetherPotential
|
||||
|
||||
$(distribution)/distribution.C
|
||||
|
||||
$(reducedUnits)/reducedUnits.C
|
||||
@ -42,11 +37,6 @@ $(moleculeCloud)/moleculeCloudIntegrateEquationsOfMotion.C
|
||||
$(moleculeCloud)/moleculeCloudRemoveHighEnergyOverlaps.C
|
||||
$(moleculeCloud)/moleculeCloudApplyConstraintsAndThermostats.C
|
||||
|
||||
$(pairPotential)/basic/pairPotential.C
|
||||
$(pairPotential)/basic/pairPotentialList.C
|
||||
$(tetherPotential)/tetherPotential.C
|
||||
$(tetherPotential)/tetherPotentialList.C
|
||||
|
||||
$(referralLists)/receivingReferralList.C
|
||||
$(referralLists)/sendingReferralList.C
|
||||
$(referredCellList)/referredCellList.C
|
||||
@ -1,8 +1,10 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/molecularDynamics/potential/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-llagrangian
|
||||
-llagrangian \
|
||||
-lpotential
|
||||
|
||||
12
src/lagrangian/molecule/distribution/distribution.C → src/lagrangian/molecularDynamics/molecule/distribution/distribution.C
Executable file → Normal file
12
src/lagrangian/molecule/distribution/distribution.C → src/lagrangian/molecularDynamics/molecule/distribution/distribution.C
Executable file → Normal file
@ -135,7 +135,7 @@ scalar distribution::median()
|
||||
|
||||
scalar runningSum = 0.0;
|
||||
|
||||
List< Pair<scalar> > normDist(normalised());
|
||||
List<Pair<scalar> > normDist(normalised());
|
||||
|
||||
if (normDist.size())
|
||||
{
|
||||
@ -259,7 +259,7 @@ List< Pair<scalar> > distribution::normalised()
|
||||
|
||||
sort(keys);
|
||||
|
||||
List< Pair<scalar> > normDist(size());
|
||||
List<Pair<scalar> > normDist(size());
|
||||
|
||||
forAll(keys,k)
|
||||
{
|
||||
@ -282,9 +282,9 @@ List< Pair<scalar> > distribution::normalisedMinusMean()
|
||||
|
||||
List< Pair<scalar> > distribution::normalisedShifted(const scalar shiftValue)
|
||||
{
|
||||
List< Pair<scalar> > oldDist(normalised());
|
||||
List<Pair<scalar> > oldDist(normalised());
|
||||
|
||||
List< Pair<scalar> > newDist(oldDist.size());
|
||||
List<Pair<scalar> > newDist(oldDist.size());
|
||||
|
||||
forAll(oldDist,u)
|
||||
{
|
||||
@ -383,7 +383,7 @@ List< Pair<scalar> > distribution::normalisedShifted(const scalar shiftValue)
|
||||
}
|
||||
|
||||
|
||||
List< Pair<scalar> > distribution::raw()
|
||||
List<Pair<scalar> > distribution::raw()
|
||||
{
|
||||
insertMissingKeys();
|
||||
|
||||
@ -391,7 +391,7 @@ List< Pair<scalar> > distribution::raw()
|
||||
|
||||
sort(keys);
|
||||
|
||||
List< Pair<scalar> > rawDist(size());
|
||||
List<Pair<scalar> > rawDist(size());
|
||||
|
||||
forAll(keys,k)
|
||||
{
|
||||
1
src/lagrangian/molecule/distribution/distribution.H → src/lagrangian/molecularDynamics/molecule/distribution/distribution.H
Executable file → Normal file
1
src/lagrangian/molecule/distribution/distribution.H → src/lagrangian/molecularDynamics/molecule/distribution/distribution.H
Executable file → Normal file
@ -102,6 +102,7 @@ public:
|
||||
|
||||
List<Pair<scalar> > raw();
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
inline scalar binWidth() const;
|
||||
0
src/lagrangian/molecule/distribution/distributionI.H → src/lagrangian/molecularDynamics/molecule/distribution/distributionI.H
Executable file → Normal file
0
src/lagrangian/molecule/distribution/distributionI.H → src/lagrangian/molecularDynamics/molecule/distribution/distributionI.H
Executable file → Normal file
0
src/lagrangian/molecule/distribution/distributionIO.C → src/lagrangian/molecularDynamics/molecule/distribution/distributionIO.C
Executable file → Normal file
0
src/lagrangian/molecule/distribution/distributionIO.C → src/lagrangian/molecularDynamics/molecule/distribution/distributionIO.C
Executable file → Normal file
0
src/lagrangian/molecule/mdTools/averageMDFields.H → src/lagrangian/molecularDynamics/molecule/mdTools/averageMDFields.H
Executable file → Normal file
0
src/lagrangian/molecule/mdTools/averageMDFields.H → src/lagrangian/molecularDynamics/molecule/mdTools/averageMDFields.H
Executable file → Normal file
@ -79,5 +79,27 @@ if (mesh.time().timeIndex() % pacf.sampleSteps() == 0)
|
||||
|
||||
if (mesh.time().timeIndex() % hfacf.sampleSteps() == 0)
|
||||
{
|
||||
// hFacf.calculateCorrelationFunction();
|
||||
|
||||
IDLList<molecule>::iterator mol(molecules.begin());
|
||||
|
||||
vector s = vector::zero;
|
||||
|
||||
for
|
||||
(
|
||||
mol = molecules.begin();
|
||||
mol != molecules.end();
|
||||
++mol
|
||||
)
|
||||
{
|
||||
s +=
|
||||
(
|
||||
0.5 * mol().mass() * magSqr(mol().U())
|
||||
+
|
||||
mol().potentialEnergy()
|
||||
) * mol().U()
|
||||
+
|
||||
0.5 * ( mol().rf() & mol().U() );
|
||||
}
|
||||
|
||||
hfacf.calculateCorrelationFunction(s);
|
||||
}
|
||||
0
src/lagrangian/molecule/mdTools/calculateMDFields.H → src/lagrangian/molecularDynamics/molecule/mdTools/calculateMDFields.H
Executable file → Normal file
0
src/lagrangian/molecule/mdTools/calculateMDFields.H → src/lagrangian/molecularDynamics/molecule/mdTools/calculateMDFields.H
Executable file → Normal file
@ -59,7 +59,24 @@ Info<< "Viscosity = "
|
||||
|
||||
if(writeHFacf)
|
||||
{
|
||||
|
||||
OFstream hfacfFile
|
||||
(
|
||||
runTime.path()/ + "hfacf"
|
||||
);
|
||||
|
||||
if (!hfacf.writeAveraged(hfacfFile))
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Failed writing to "
|
||||
<< hfacfFile.name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Info << "Thermal conductivity = "
|
||||
<< hfacf.integral()
|
||||
/averageTemperature
|
||||
/averageTemperature
|
||||
/moleculeCloud::kb
|
||||
/ meshVolume
|
||||
<< endl;
|
||||
74
src/lagrangian/molecule/mdTools/createMDFields.H → src/lagrangian/molecularDynamics/molecule/mdTools/createMDFields.H
Executable file → Normal file
74
src/lagrangian/molecule/mdTools/createMDFields.H → src/lagrangian/molecularDynamics/molecule/mdTools/createMDFields.H
Executable file → Normal file
@ -2,25 +2,25 @@
|
||||
|
||||
List< scalarField > allSpeciesN_RU
|
||||
(
|
||||
molecules.nIds(),
|
||||
molecules.pairPotentials().nIds(),
|
||||
scalarField (mesh.nCells(), 0.0)
|
||||
);
|
||||
|
||||
List< scalarField > allSpeciesM_RU
|
||||
(
|
||||
molecules.nIds(),
|
||||
molecules.pairPotentials().nIds(),
|
||||
scalarField (mesh.nCells(), 0.0)
|
||||
);
|
||||
|
||||
List< vectorField > allSpeciesVelocitySum_RU
|
||||
(
|
||||
molecules.nIds(),
|
||||
molecules.pairPotentials().nIds(),
|
||||
vectorField (mesh.nCells(), vector::zero)
|
||||
);
|
||||
|
||||
List< scalarField > allSpeciesVelocityMagSquaredSum_RU
|
||||
(
|
||||
molecules.nIds(),
|
||||
molecules.pairPotentials().nIds(),
|
||||
scalarField (mesh.nCells(), 0.0)
|
||||
);
|
||||
|
||||
@ -34,13 +34,13 @@ Info << nl << "Creating fields." << endl;
|
||||
|
||||
PtrList<volScalarField> allSpeciesRhoN
|
||||
(
|
||||
molecules.nIds()
|
||||
molecules.pairPotentials().nIds()
|
||||
);
|
||||
|
||||
forAll (allSpeciesRhoN, rN)
|
||||
{
|
||||
Info << " Creating number density field for "
|
||||
<< molecules.idList()[rN] << endl;
|
||||
<< molecules.pairPotentials().idList()[rN] << endl;
|
||||
|
||||
allSpeciesRhoN.set
|
||||
(
|
||||
@ -49,7 +49,7 @@ forAll (allSpeciesRhoN, rN)
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoN_" + molecules.idList()[rN],
|
||||
"rhoN_" + molecules.pairPotentials().idList()[rN],
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
@ -89,13 +89,13 @@ totalRhoN.correctBoundaryConditions();
|
||||
|
||||
PtrList<volScalarField> allSpeciesRhoM
|
||||
(
|
||||
molecules.nIds()
|
||||
molecules.pairPotentials().nIds()
|
||||
);
|
||||
|
||||
forAll (allSpeciesRhoM, rM)
|
||||
{
|
||||
Info << " Creating mass density field for "
|
||||
<< molecules.idList()[rM] << endl;
|
||||
<< molecules.pairPotentials().idList()[rM] << endl;
|
||||
|
||||
allSpeciesRhoM.set
|
||||
(
|
||||
@ -104,7 +104,7 @@ forAll (allSpeciesRhoM, rM)
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoM_" + molecules.idList()[rM],
|
||||
"rhoM_" + molecules.pairPotentials().idList()[rM],
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
@ -144,13 +144,13 @@ totalRhoM.correctBoundaryConditions();
|
||||
|
||||
PtrList<volVectorField> allSpeciesVelocity
|
||||
(
|
||||
molecules.nIds()
|
||||
molecules.pairPotentials().nIds()
|
||||
);
|
||||
|
||||
forAll (allSpeciesVelocity, v)
|
||||
{
|
||||
Info << " Creating velocity field for "
|
||||
<< molecules.idList()[v] << endl;
|
||||
<< molecules.pairPotentials().idList()[v] << endl;
|
||||
|
||||
allSpeciesVelocity.set
|
||||
(
|
||||
@ -159,7 +159,7 @@ forAll (allSpeciesVelocity, v)
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"velocity_" + molecules.idList()[v],
|
||||
"velocity_" + molecules.pairPotentials().idList()[v],
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
@ -177,22 +177,40 @@ forAll (allSpeciesVelocity, v)
|
||||
|
||||
Info << " Creating total velocity field" << endl;
|
||||
|
||||
// volVectorField totalVelocity
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "velocity_total",
|
||||
// runTime.timeName(),
|
||||
// mesh,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::AUTO_WRITE
|
||||
// ),
|
||||
// mesh,
|
||||
// dimVelocity,
|
||||
// "zeroGradient"
|
||||
// );
|
||||
// totalVelocity.internalField() = vectorField (mesh.nCells(), vector::zero);
|
||||
// totalVelocity.correctBoundaryConditions();
|
||||
|
||||
|
||||
volVectorField totalVelocity
|
||||
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"velocity_total",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
|
||||
"velocity_total",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
|
||||
),
|
||||
mesh,
|
||||
dimVelocity,
|
||||
"zeroGradient"
|
||||
dimensionedVector("zero", dimVelocity, vector::zero)
|
||||
);
|
||||
totalVelocity.internalField() = vectorField (mesh.nCells(), vector::zero);
|
||||
totalVelocity.correctBoundaryConditions();
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Kinetic temperature
|
||||
@ -200,13 +218,13 @@ totalVelocity.correctBoundaryConditions();
|
||||
|
||||
PtrList<volScalarField> allSpeciesTemperature
|
||||
(
|
||||
molecules.nIds()
|
||||
molecules.pairPotentials().nIds()
|
||||
);
|
||||
|
||||
forAll (allSpeciesTemperature, t)
|
||||
{
|
||||
Info << " Creating temperature field for "
|
||||
<< molecules.idList()[t] << endl;
|
||||
<< molecules.pairPotentials().idList()[t] << endl;
|
||||
|
||||
allSpeciesTemperature.set
|
||||
(
|
||||
@ -215,7 +233,7 @@ forAll (allSpeciesTemperature, t)
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"temperature_" + molecules.idList()[t],
|
||||
"temperature_" + molecules.pairPotentials().idList()[t],
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
@ -256,13 +274,13 @@ totalTemperature.correctBoundaryConditions();
|
||||
|
||||
PtrList<volScalarField> allSpeciesMeanKE
|
||||
(
|
||||
molecules.nIds()
|
||||
molecules.pairPotentials().nIds()
|
||||
);
|
||||
|
||||
forAll (allSpeciesMeanKE, mKE)
|
||||
{
|
||||
Info << " Creating mean kinetic energy field for "
|
||||
<< molecules.idList()[mKE] << endl;
|
||||
<< molecules.pairPotentials().idList()[mKE] << endl;
|
||||
|
||||
allSpeciesMeanKE.set
|
||||
(
|
||||
@ -271,7 +289,7 @@ forAll (allSpeciesMeanKE, mKE)
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"meanKE_" + molecules.idList()[mKE],
|
||||
"meanKE_" + molecules.pairPotentials().idList()[mKE],
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
0
src/lagrangian/molecule/mdTools/md.H → src/lagrangian/molecularDynamics/molecule/mdTools/md.H
Executable file → Normal file
0
src/lagrangian/molecule/mdTools/md.H → src/lagrangian/molecularDynamics/molecule/mdTools/md.H
Executable file → Normal file
8
src/lagrangian/molecule/mdTools/resetMDFields.H → src/lagrangian/molecularDynamics/molecule/mdTools/resetMDFields.H
Executable file → Normal file
8
src/lagrangian/molecule/mdTools/resetMDFields.H → src/lagrangian/molecularDynamics/molecule/mdTools/resetMDFields.H
Executable file → Normal file
@ -2,25 +2,25 @@ if (runTime.outputTime())
|
||||
{
|
||||
allSpeciesN_RU = List< scalarField >
|
||||
(
|
||||
molecules.nIds(),
|
||||
molecules.pairPotentials().nIds(),
|
||||
scalarField (mesh.nCells(), 0.0)
|
||||
);
|
||||
|
||||
allSpeciesM_RU = List< scalarField >
|
||||
(
|
||||
molecules.nIds(),
|
||||
molecules.pairPotentials().nIds(),
|
||||
scalarField (mesh.nCells(), 0.0)
|
||||
);
|
||||
|
||||
allSpeciesVelocitySum_RU = List< vectorField >
|
||||
(
|
||||
molecules.nIds(),
|
||||
molecules.pairPotentials().nIds(),
|
||||
vectorField (mesh.nCells(), vector::zero)
|
||||
);
|
||||
|
||||
allSpeciesVelocityMagSquaredSum_RU = List< scalarField >
|
||||
(
|
||||
molecules.nIds(),
|
||||
molecules.pairPotentials().nIds(),
|
||||
scalarField (mesh.nCells(), 0.0)
|
||||
);
|
||||
}
|
||||
@ -86,6 +86,8 @@ if (runTime.outputTime())
|
||||
<< " m/s" << nl
|
||||
<< "Average temperature = "
|
||||
<< averageTemperature << " K" << nl
|
||||
<< "accumulatedTotalrDotfSum = "
|
||||
<< accumulatedTotalrDotfSum << nl
|
||||
<< "Average pressure = "
|
||||
<< averagePressure << " N/m^2" << nl
|
||||
<< "----------------------------------------" << endl;
|
||||
3
src/lagrangian/molecule/molecule/molecule.C → src/lagrangian/molecularDynamics/molecule/molecule/molecule.C
Executable file → Normal file
3
src/lagrangian/molecule/molecule/molecule.C → src/lagrangian/molecularDynamics/molecule/molecule/molecule.C
Executable file → Normal file
@ -54,7 +54,7 @@ bool molecule::move(molecule::trackData& td)
|
||||
U_ += 0.5*deltaT*A_;
|
||||
}
|
||||
|
||||
while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
|
||||
while (td.keepParticle && !td.switchProcessor && tEnd > (SMALL*SMALL))
|
||||
{
|
||||
// set the lagrangian time-step
|
||||
scalar dt = min(dtMax, tEnd);
|
||||
@ -178,6 +178,7 @@ void molecule::hitWallPatch
|
||||
{
|
||||
U_ -= 2*Un*nw;
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
4
src/lagrangian/molecule/molecule/molecule.H → src/lagrangian/molecularDynamics/molecule/molecule/molecule.H
Executable file → Normal file
4
src/lagrangian/molecule/molecule/molecule.H → src/lagrangian/molecularDynamics/molecule/molecule/molecule.H
Executable file → Normal file
@ -23,10 +23,9 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::molecule
|
||||
molecule
|
||||
|
||||
Description
|
||||
Foam::molecule
|
||||
|
||||
SourceFiles
|
||||
moleculeI.H
|
||||
@ -192,6 +191,7 @@ public:
|
||||
|
||||
//- Return tetherPosition
|
||||
inline const vector& tetherPosition() const;
|
||||
inline vector& tetherPosition();
|
||||
|
||||
|
||||
//- Tracking
|
||||
45
src/lagrangian/molecule/molecule/moleculeI.H → src/lagrangian/molecularDynamics/molecule/molecule/moleculeI.H
Executable file → Normal file
45
src/lagrangian/molecule/molecule/moleculeI.H → src/lagrangian/molecularDynamics/molecule/molecule/moleculeI.H
Executable file → Normal file
@ -24,9 +24,12 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::molecule::molecule
|
||||
inline molecule::molecule
|
||||
(
|
||||
const Cloud<molecule>& c,
|
||||
const vector& position,
|
||||
@ -51,7 +54,7 @@ inline Foam::molecule::molecule
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::molecule::trackData::trackData
|
||||
inline molecule::trackData::trackData
|
||||
(
|
||||
moleculeCloud& molCloud,
|
||||
label part
|
||||
@ -65,88 +68,98 @@ inline Foam::molecule::trackData::trackData
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::label Foam::molecule::id() const
|
||||
inline label molecule::id() const
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::molecule::mass() const
|
||||
inline scalar molecule::mass() const
|
||||
{
|
||||
return mass_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::vector& Foam::molecule::U() const
|
||||
inline const vector& molecule::U() const
|
||||
{
|
||||
return U_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vector& Foam::molecule::U()
|
||||
inline vector& molecule::U()
|
||||
{
|
||||
return U_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::vector& Foam::molecule::A() const
|
||||
inline const vector& molecule::A() const
|
||||
{
|
||||
return A_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vector& Foam::molecule::A()
|
||||
inline vector& molecule::A()
|
||||
{
|
||||
return A_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::molecule::potentialEnergy() const
|
||||
inline scalar molecule::potentialEnergy() const
|
||||
{
|
||||
return potentialEnergy_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::molecule::potentialEnergy()
|
||||
inline scalar& molecule::potentialEnergy()
|
||||
{
|
||||
return potentialEnergy_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::tensor& Foam::molecule::rf() const
|
||||
inline const tensor& molecule::rf() const
|
||||
{
|
||||
return rf_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::tensor& Foam::molecule::rf()
|
||||
inline tensor& molecule::rf()
|
||||
{
|
||||
return rf_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::molecule::tethered() const
|
||||
inline label molecule::tethered() const
|
||||
{
|
||||
return tethered_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::vector& Foam::molecule::tetherPosition() const
|
||||
inline const vector& molecule::tetherPosition() const
|
||||
{
|
||||
return tetherPosition_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::moleculeCloud& Foam::molecule::trackData::molCloud()
|
||||
inline vector& molecule::tetherPosition()
|
||||
{
|
||||
return tetherPosition_;
|
||||
}
|
||||
|
||||
|
||||
inline moleculeCloud& molecule::trackData::molCloud()
|
||||
{
|
||||
return molCloud_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::molecule::trackData::part() const
|
||||
inline label molecule::trackData::part() const
|
||||
{
|
||||
return part_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
0
src/lagrangian/molecule/molecule/moleculeIO.C → src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C
Executable file → Normal file
0
src/lagrangian/molecule/molecule/moleculeIO.C → src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C
Executable file → Normal file
0
src/lagrangian/molecule/moleculeCloud/moleculeCloud.C → src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C
Executable file → Normal file
0
src/lagrangian/molecule/moleculeCloud/moleculeCloud.C → src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C
Executable file → Normal file
22
src/lagrangian/molecule/moleculeCloud/moleculeCloud.H → src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.H
Executable file → Normal file
22
src/lagrangian/molecule/moleculeCloud/moleculeCloud.H → src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.H
Executable file → Normal file
@ -97,18 +97,6 @@ private:
|
||||
|
||||
scalar potentialEnergyLimit_;
|
||||
|
||||
scalar guardRadius_;
|
||||
|
||||
scalar rCutMax_;
|
||||
|
||||
//- storing rCutMaxSqr in class as well as rCutMax to
|
||||
//- avoid needing to calculate it often.
|
||||
//- Possibilty of inconsistency if tinkered with.
|
||||
|
||||
scalar rCutMaxSqr_;
|
||||
|
||||
List<word> idList_;
|
||||
|
||||
labelList removalOrder_;
|
||||
|
||||
labelListList directInteractionList_;
|
||||
@ -189,20 +177,10 @@ public:
|
||||
|
||||
inline scalar potentialEnergyLimit() const;
|
||||
|
||||
inline scalar guardRadius() const;
|
||||
|
||||
inline scalar rCutMax() const;
|
||||
|
||||
inline scalar rCutMaxSqr() const;
|
||||
|
||||
inline const List<word>& idList() const;
|
||||
|
||||
inline const labelList& removalOrder() const;
|
||||
|
||||
inline label nPairPotentials() const;
|
||||
|
||||
inline label nIds() const;
|
||||
|
||||
inline const labelListList& directInteractionList() const;
|
||||
|
||||
inline const referredCellList& referredInteractionList() const;
|
||||
@ -22,13 +22,21 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
moleculeCloud
|
||||
|
||||
Description
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "moleculeCloud.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::moleculeCloud::buildCellOccupancy()
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
void moleculeCloud::buildCellOccupancy()
|
||||
{
|
||||
forAll(cellOccupancy_, cO)
|
||||
{
|
||||
@ -37,7 +45,12 @@ void Foam::moleculeCloud::buildCellOccupancy()
|
||||
|
||||
iterator mol(this->begin());
|
||||
|
||||
for (mol = this->begin(); mol != this->end(); ++mol)
|
||||
for
|
||||
(
|
||||
mol = this->begin();
|
||||
mol != this->end();
|
||||
++mol
|
||||
)
|
||||
{
|
||||
cellOccupancy_[mol().cell()].append(&mol());
|
||||
}
|
||||
@ -50,5 +63,6 @@ void Foam::moleculeCloud::buildCellOccupancy()
|
||||
referredInteractionList_.referMolecules();
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -6,7 +6,7 @@ rIJ = molI->position() - molJ->position();
|
||||
|
||||
rIJMagSq = magSqr(rIJ);
|
||||
|
||||
if (pairPotentials_.rCutSqr(idI, idJ, rIJMagSq))
|
||||
if(pairPotentials_.rCutSqr(idI, idJ, rIJMagSq))
|
||||
{
|
||||
rIJMag = mag(rIJ);
|
||||
|
||||
@ -0,0 +1,193 @@
|
||||
// Parallel coding to access boundary information to build up interaction cell info
|
||||
|
||||
// See preservePatchTypes for how to read the boundary file.
|
||||
|
||||
// Read faceProcAddressing, as per reconstructPar, to get hold of the original,
|
||||
// undecomposed face label from a face on a processor mesh. See email from Mattijs:
|
||||
|
||||
// > Is it a case of reading the faceProcAddressing file, in the same way as
|
||||
// > something like reconstructPar?
|
||||
// Correct.
|
||||
//
|
||||
// Note that faceProcAddressing is a bit weird since it also includes which side
|
||||
// of an internal face we have. If I remember correctly:
|
||||
//
|
||||
// faceI == 0 illegal
|
||||
// faceI > 0 we have the original owner of faceI-1 i.e. we have the face in the
|
||||
// original order.
|
||||
// faceI < 0 we have the original neighbour of -faceI-1 so the face is flipped.
|
||||
|
||||
// Use the same functionality as
|
||||
// label polyBoundaryMesh::whichPatch(const label faceIndex) const
|
||||
// To determine which patch a face was on originally.
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// if (Pstream::myProcNo() == Pstream::masterNo())
|
||||
// // {
|
||||
// dictionary patchDictionary;
|
||||
//
|
||||
// DynamicList<word> patchNames;
|
||||
//
|
||||
// {
|
||||
// IOobject undecomposedBoundaryHeader
|
||||
// (
|
||||
// "undecomposedBoundary",
|
||||
// mesh_.time().constant(),
|
||||
// polyMesh::meshSubDir,
|
||||
// mesh_,
|
||||
// IOobject::MUST_READ,
|
||||
// IOobject::NO_WRITE,
|
||||
// false
|
||||
// );
|
||||
//
|
||||
// if (undecomposedBoundaryHeader.headerOk())
|
||||
// {
|
||||
// polyBoundaryMeshEntries undecomposedPatchEntries
|
||||
// (
|
||||
// undecomposedBoundaryHeader
|
||||
// );
|
||||
//
|
||||
// forAll(undecomposedPatchEntries, patchi)
|
||||
// {
|
||||
// patchNames.append
|
||||
// (
|
||||
// undecomposedPatchEntries[patchi].keyword()
|
||||
// );
|
||||
//
|
||||
// patchDictionary.add
|
||||
// (
|
||||
// undecomposedPatchEntries[patchi]
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "moleculeCloudBuildCellInteractionLists.C\n"
|
||||
// )
|
||||
// << "undecomposedBoundary file not found in "
|
||||
// "constant/polyMesh"
|
||||
// << abort(FatalError);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// labelIOList faceProcAddressing
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "faceProcAddressing",
|
||||
// mesh_.time().constant(),
|
||||
// polyMesh::meshSubDir,
|
||||
// mesh_,
|
||||
// IOobject::MUST_READ,
|
||||
// IOobject::NO_WRITE,
|
||||
// false
|
||||
// )
|
||||
// );
|
||||
|
||||
labelList procPatches(mesh_.globalData().processorPatches());
|
||||
|
||||
forAll(procPatches,pP)
|
||||
{
|
||||
const processorPolyPatch& patch =
|
||||
refCast<const processorPolyPatch>
|
||||
(
|
||||
mesh_.boundaryMesh()[procPatches[pP]]
|
||||
);
|
||||
//
|
||||
// Pout << nl << "name: " << patch.name() << nl
|
||||
// << "start: " << patch.start() << nl
|
||||
// << "size: " << patch.size() << nl
|
||||
// << "separated: " << Switch(patch.separated()) << nl
|
||||
// << "parallel: " << Switch(patch.parallel()) << nl << endl;
|
||||
//
|
||||
// forAll (patch, pI)
|
||||
// {
|
||||
// label decomposedMeshFace = patch.start() + pI;
|
||||
//
|
||||
// label faceProcAdd = faceProcAddressing[decomposedMeshFace];
|
||||
//
|
||||
// label globalFace = abs(faceProcAdd)-1;
|
||||
//
|
||||
// Pout << "Patch index: " << pI
|
||||
// << " " << patch[pI]
|
||||
// << " Mesh index: " << decomposedMeshFace
|
||||
// << " faceProcAdd: " << faceProcAdd
|
||||
// << " globalFace:" << globalFace;
|
||||
//
|
||||
// label minStart = -1;
|
||||
//
|
||||
// // Scanning the dictionary each time is a very ugly way of
|
||||
// // finding out what patch a face originally belonged to, but
|
||||
// // it proves the concept. Read the patch info a container
|
||||
// // class and have a neat way of tell which patch a face is from
|
||||
// // embedded in that. Split each processor face down into
|
||||
// // separate lists for each different originiating patch.
|
||||
//
|
||||
// forAll(patchNames, patchi)
|
||||
// {
|
||||
// if (patchDictionary.found(patchNames[patchi]))
|
||||
// {
|
||||
// const dictionary& patchDict =
|
||||
// patchDictionary.subDict(patchNames[patchi]);
|
||||
//
|
||||
// word faceName(patchNames[patchi]);
|
||||
// label startFace(readLabel(patchDict.lookup("startFace")));
|
||||
// label nFaces(readLabel(patchDict.lookup("nFaces")));
|
||||
//
|
||||
// if
|
||||
// (
|
||||
// minStart < 0
|
||||
// || startFace < minStart
|
||||
// )
|
||||
// {
|
||||
// minStart = startFace;
|
||||
// }
|
||||
//
|
||||
// if
|
||||
// (
|
||||
// globalFace >= startFace
|
||||
// && globalFace < startFace + nFaces
|
||||
// )
|
||||
// {
|
||||
// Pout << " original patch: " << faceName << endl;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (globalFace < minStart)
|
||||
// {
|
||||
// Pout << " originally an internal face" << endl;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
if (patch.separated())
|
||||
{
|
||||
Pout << patch.separation();
|
||||
}
|
||||
|
||||
if (!patch.parallel())
|
||||
{
|
||||
Pout << patch.forwardT();
|
||||
}
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
||||
// Get coords of my shared points
|
||||
// vector sharedPoints(vector::one*(Pstream::myProcNo()+1));
|
||||
// label testRedLab(Pstream::myProcNo()+1);
|
||||
|
||||
// Pout << testRedLab << endl;
|
||||
|
||||
// Append from all processors
|
||||
// combineReduce(sharedPoints, plusEqOp<vector>());
|
||||
// reduce(testRedLab, plusOp<label>());
|
||||
|
||||
// Pout << testRedLab << endl;
|
||||
}
|
||||
30
src/lagrangian/molecule/moleculeCloud/moleculeCloudI.H → src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudI.H
Executable file → Normal file
30
src/lagrangian/molecule/moleculeCloud/moleculeCloudI.H → src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudI.H
Executable file → Normal file
@ -50,42 +50,12 @@ inline scalar moleculeCloud::potentialEnergyLimit() const
|
||||
}
|
||||
|
||||
|
||||
inline scalar moleculeCloud::guardRadius() const
|
||||
{
|
||||
return guardRadius_;
|
||||
}
|
||||
|
||||
|
||||
inline scalar moleculeCloud::rCutMax() const
|
||||
{
|
||||
return rCutMax_;
|
||||
}
|
||||
|
||||
|
||||
inline scalar moleculeCloud::rCutMaxSqr() const
|
||||
{
|
||||
return rCutMaxSqr_;
|
||||
}
|
||||
|
||||
|
||||
inline const List<word>& moleculeCloud::idList() const
|
||||
{
|
||||
return idList_;
|
||||
}
|
||||
|
||||
|
||||
inline label moleculeCloud::nPairPotentials() const
|
||||
{
|
||||
return pairPotentials_.size();
|
||||
}
|
||||
|
||||
|
||||
inline label moleculeCloud::nIds() const
|
||||
{
|
||||
return idList_.size();
|
||||
}
|
||||
|
||||
|
||||
inline const labelList& moleculeCloud::removalOrder() const
|
||||
{
|
||||
return removalOrder_;
|
||||
@ -0,0 +1,177 @@
|
||||
Info<< nl << "Reading MD solution parameters:" << endl;
|
||||
|
||||
IOdictionary mdSolution
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"mdSolution",
|
||||
mesh_.time().system(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
integrationMethod_ = integrationMethodNames_.read
|
||||
(
|
||||
mdSolution.lookup("integrationMethod")
|
||||
);
|
||||
|
||||
potentialEnergyLimit_ = readScalar
|
||||
(
|
||||
mdSolution.lookup("potentialEnergyLimit")
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
IOdictionary potentialDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"potentialDict",
|
||||
mesh_.time().system(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
IOdictionary idListDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"idList",
|
||||
mesh_.time().constant(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
// ****************************************************************************
|
||||
// Pair potentials
|
||||
|
||||
if (!potentialDict.found("pair"))
|
||||
{
|
||||
FatalErrorIn("moleculeCloudReadPotentials.H") << nl
|
||||
<< "pair potential specification subDict not found"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
const dictionary& pairDict = potentialDict.subDict("pair");
|
||||
|
||||
pairPotentials_.buildPotentials(idListDict, pairDict, mesh_);
|
||||
|
||||
if (potentialDict.found("removalOrder"))
|
||||
{
|
||||
List<word> remOrd = potentialDict.lookup("removalOrder");
|
||||
|
||||
removalOrder_.setSize(remOrd.size());
|
||||
|
||||
forAll(removalOrder_, rO)
|
||||
{
|
||||
removalOrder_[rO] = findIndex(pairPotentials_.idList(), remOrd[rO]);
|
||||
}
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Tether potentials
|
||||
|
||||
iterator mol(this->begin());
|
||||
|
||||
DynamicList<label> tetherIds;
|
||||
|
||||
for
|
||||
(
|
||||
mol = this->begin();
|
||||
mol != this->end();
|
||||
++mol
|
||||
)
|
||||
{
|
||||
if (mol().tethered())
|
||||
{
|
||||
if (findIndex(tetherIds, mol().id()) == -1)
|
||||
{
|
||||
tetherIds.append
|
||||
(
|
||||
mol().id()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
List< labelList > allTetherIds(Pstream::nProcs());
|
||||
|
||||
allTetherIds[Pstream::myProcNo()] = tetherIds;
|
||||
|
||||
Pstream::gatherList(allTetherIds);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
DynamicList<label> globalTetherIds;
|
||||
|
||||
forAll(allTetherIds, procN)
|
||||
{
|
||||
const labelList& procNTetherIds = allTetherIds[procN];
|
||||
|
||||
forAll(procNTetherIds, id)
|
||||
{
|
||||
if (findIndex(globalTetherIds, procNTetherIds[id]) == -1)
|
||||
{
|
||||
globalTetherIds.append
|
||||
(
|
||||
procNTetherIds[id]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
globalTetherIds.shrink();
|
||||
|
||||
tetherIds = globalTetherIds;
|
||||
}
|
||||
|
||||
Pstream::scatter(tetherIds);
|
||||
}
|
||||
|
||||
tetherIds.shrink();
|
||||
|
||||
if (tetherIds.size())
|
||||
{
|
||||
if (!potentialDict.found("tether"))
|
||||
{
|
||||
FatalErrorIn("moleculeCloudReadPotentials.H") << nl
|
||||
<< "tether potential specification subDict not found"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
const dictionary& tetherDict = potentialDict.subDict("tether");
|
||||
|
||||
tetherPotentials_.buildPotentials(idListDict, tetherDict, tetherIds);
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// External Forces
|
||||
|
||||
gravity_ = vector::zero;
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
Info << nl << tab << "gravity = " << gravity_ << endl;
|
||||
|
||||
@ -34,7 +34,7 @@ void Foam::moleculeCloud::removeHighEnergyOverlaps()
|
||||
|
||||
forAll(removalOrder_, rO)
|
||||
{
|
||||
Info << " " << idList_[removalOrder_[rO]];
|
||||
Info << " " << pairPotentials_.idList()[removalOrder_[rO]];
|
||||
}
|
||||
|
||||
Info << nl ;
|
||||
@ -12,6 +12,10 @@ if (pairPotentials_.rCutSqr(idI, idJ, rIJMagSq))
|
||||
|
||||
bool remove = false;
|
||||
|
||||
// Guard against pairPotentials_.energy being evaluated
|
||||
// if rIJMag < SMALL. A floating point exception will
|
||||
// happen otherwise.
|
||||
|
||||
if (rIJMag < SMALL)
|
||||
{
|
||||
WarningIn("moleculeCloud::removeHighEnergyOverlaps()")
|
||||
@ -30,10 +34,14 @@ if (pairPotentials_.rCutSqr(idI, idJ, rIJMagSq))
|
||||
|
||||
remove = true;
|
||||
}
|
||||
|
||||
|
||||
// Guard against pairPotentials_.energy being evaluated
|
||||
// if rIJMag < SMALL. A floating point exception will
|
||||
// happen otherwise.
|
||||
// if rIJMag < rMin. A tabulation lookup error will occur otherwise.
|
||||
|
||||
if (rIJMag < pairPotentials_.rMin(idI, idJ))
|
||||
{
|
||||
remove = true;
|
||||
}
|
||||
|
||||
if (!remove)
|
||||
{
|
||||
@ -42,6 +50,7 @@ if (pairPotentials_.rCutSqr(idI, idJ, rIJMagSq))
|
||||
pairPotentials_.energy(idI, idJ, rIJMag) > potentialEnergyLimit_
|
||||
)
|
||||
{
|
||||
|
||||
remove = true;
|
||||
}
|
||||
}
|
||||
@ -47,6 +47,10 @@
|
||||
|
||||
bool remove = false;
|
||||
|
||||
// Guard against pairPotentials_.energy being evaluated
|
||||
// if rKLMag < SMALL. A floating point exception will
|
||||
// happen otherwise.
|
||||
|
||||
if (rKLMag < SMALL)
|
||||
{
|
||||
WarningIn
|
||||
@ -72,8 +76,12 @@
|
||||
}
|
||||
|
||||
// Guard against pairPotentials_.energy being evaluated
|
||||
// if rKLMag < SMALL. A floating point exception will
|
||||
// happen otherwise.
|
||||
// if rIJMag < rMin. A tubulation lookup error will occur otherwise.
|
||||
|
||||
if (rKLMag < pairPotentials_.rMin(idK, idL))
|
||||
{
|
||||
remove = true;
|
||||
}
|
||||
|
||||
if (!remove)
|
||||
{
|
||||
@ -75,7 +75,7 @@ bool Foam::moleculeCloud::testEdgeEdgeDistance
|
||||
&& s <= 1
|
||||
&& t >= 0
|
||||
&& t <= 1
|
||||
&& magSqr(eIs + a*s - eJs - b*t) <= rCutMaxSqr()
|
||||
&& magSqr(eIs + a*s - eJs - b*t) <= pairPotentials_.rCutMaxSqr()
|
||||
);
|
||||
}
|
||||
|
||||
@ -128,14 +128,14 @@ bool Foam::moleculeCloud::testPointFaceDistance
|
||||
|
||||
scalar perpDist((p - faceC) & faceN);
|
||||
|
||||
if (mag(perpDist) > rCutMax())
|
||||
if (mag(perpDist) > pairPotentials_.rCutMax())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
vector pointOnPlane = (p - faceN * perpDist);
|
||||
|
||||
if (magSqr(faceC - pointOnPlane) < rCutMaxSqr()*1e-8)
|
||||
if (magSqr(faceC - pointOnPlane) < pairPotentials_.rCutMaxSqr()*1e-8)
|
||||
{
|
||||
// If pointOnPlane is very close to the face centre
|
||||
// then defining the local axes will be inaccurate
|
||||
@ -143,7 +143,7 @@ bool Foam::moleculeCloud::testPointFaceDistance
|
||||
// inside the face, so return true if the points
|
||||
// are in range to be safe
|
||||
|
||||
return (magSqr(pointOnPlane - p) <= rCutMaxSqr());
|
||||
return (magSqr(pointOnPlane - p) <= pairPotentials_.rCutMaxSqr());
|
||||
}
|
||||
|
||||
vector xAxis = (faceC - pointOnPlane)/mag(faceC - pointOnPlane);
|
||||
@ -158,7 +158,7 @@ bool Foam::moleculeCloud::testPointFaceDistance
|
||||
{
|
||||
const vector& V(points[faceToTest[fTT]]);
|
||||
|
||||
if (magSqr(V-p) <= rCutMaxSqr())
|
||||
if (magSqr(V-p) <= pairPotentials_.rCutMaxSqr())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -206,7 +206,7 @@ bool Foam::moleculeCloud::testPointFaceDistance
|
||||
if (la_valid < 0)
|
||||
{
|
||||
// perpendicular point inside face, nearest point is pointOnPlane;
|
||||
return (magSqr(pointOnPlane-p) <= rCutMaxSqr());
|
||||
return (magSqr(pointOnPlane-p) <= pairPotentials_.rCutMaxSqr());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -215,7 +215,7 @@ bool Foam::moleculeCloud::testPointFaceDistance
|
||||
return
|
||||
(
|
||||
magSqr(pointOnPlane + la_valid*(faceC - pointOnPlane) - p)
|
||||
<= rCutMaxSqr()
|
||||
<= pairPotentials_.rCutMaxSqr()
|
||||
);
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ public:
|
||||
|
||||
//- Construct with no argument, uses default values:
|
||||
// length = 1nm
|
||||
// mass = 1.660538782e−27kg (unified atomic mass unit)
|
||||
// mass = 1.660538782eâ27kg (unified atomic mass unit)
|
||||
// temperature = 1K (therefore, energy = 1*kb)
|
||||
reducedUnits();
|
||||
|
||||
0
src/lagrangian/molecule/referredCell/referredCell.C → src/lagrangian/molecularDynamics/molecule/referredCell/referredCell.C
Executable file → Normal file
0
src/lagrangian/molecule/referredCell/referredCell.C → src/lagrangian/molecularDynamics/molecule/referredCell/referredCell.C
Executable file → Normal file
0
src/lagrangian/molecule/referredCell/referredCell.H → src/lagrangian/molecularDynamics/molecule/referredCell/referredCell.H
Executable file → Normal file
0
src/lagrangian/molecule/referredCell/referredCell.H → src/lagrangian/molecularDynamics/molecule/referredCell/referredCell.H
Executable file → Normal file
0
src/lagrangian/molecule/referredCell/referredCellI.H → src/lagrangian/molecularDynamics/molecule/referredCell/referredCellI.H
Executable file → Normal file
0
src/lagrangian/molecule/referredCell/referredCellI.H → src/lagrangian/molecularDynamics/molecule/referredCell/referredCellI.H
Executable file → Normal file
@ -24,9 +24,6 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::moleculeCloud& Foam::referredCellList::molCloud()
|
||||
@ -35,8 +32,4 @@ inline const Foam::moleculeCloud& Foam::referredCellList::molCloud()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -98,6 +98,7 @@ public:
|
||||
const referredMolecule& b
|
||||
);
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Istream& operator>>
|
||||
35
src/lagrangian/molecularDynamics/potential/Make/files
Normal file
35
src/lagrangian/molecularDynamics/potential/Make/files
Normal file
@ -0,0 +1,35 @@
|
||||
pairPotential = pairPotential
|
||||
|
||||
$(pairPotential)/pairPotentialList/pairPotentialList.C
|
||||
|
||||
$(pairPotential)/basic/pairPotential.C
|
||||
$(pairPotential)/basic/pairPotentialIO.C
|
||||
$(pairPotential)/basic/newPairPotential.C
|
||||
|
||||
$(pairPotential)/derived/lennardJones/lennardJones.C
|
||||
$(pairPotential)/derived/maitlandSmith/maitlandSmith.C
|
||||
$(pairPotential)/derived/azizChen/azizChen.C
|
||||
|
||||
energyScalingFunction = energyScalingFunction
|
||||
|
||||
$(energyScalingFunction)/basic/energyScalingFunction.C
|
||||
$(energyScalingFunction)/basic/newEnergyScalingFunction.C
|
||||
|
||||
$(energyScalingFunction)/derived/shifted/shifted.C
|
||||
$(energyScalingFunction)/derived/shiftedForce/shiftedForce.C
|
||||
$(energyScalingFunction)/derived/noScaling/noScaling.C
|
||||
$(energyScalingFunction)/derived/sigmoid/sigmoid.C
|
||||
$(energyScalingFunction)/derived/doubleSigmoid/doubleSigmoid.C
|
||||
|
||||
tetherPotential = tetherPotential
|
||||
|
||||
$(tetherPotential)/tetherPotentialList/tetherPotentialList.C
|
||||
|
||||
$(tetherPotential)/basic/tetherPotential.C
|
||||
$(tetherPotential)/basic/newTetherPotential.C
|
||||
|
||||
$(tetherPotential)/derived/harmonicSpring/harmonicSpring.C
|
||||
$(tetherPotential)/derived/restrainedHarmonicSpring/restrainedHarmonicSpring.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libpotential
|
||||
|
||||
6
src/lagrangian/molecularDynamics/potential/Make/options
Normal file
6
src/lagrangian/molecularDynamics/potential/Make/options
Normal file
@ -0,0 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I.. \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume
|
||||
@ -0,0 +1,76 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
energyScalingFunction
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "energyScalingFunction.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(energyScalingFunction, 0);
|
||||
defineRunTimeSelectionTable(energyScalingFunction, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::energyScalingFunction::energyScalingFunction
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
energyScalingFunctionProperties_(energyScalingFunctionProperties),
|
||||
pairPot_(pairPot)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
bool Foam::energyScalingFunction::read
|
||||
(
|
||||
const dictionary& energyScalingFunctionProperties
|
||||
)
|
||||
{
|
||||
energyScalingFunctionProperties_ = energyScalingFunctionProperties;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,151 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::energyScalingFunction
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
energyScalingFunction.C
|
||||
newEnergyScalingFunction.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef energyScalingFunction_H
|
||||
#define energyScalingFunction_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "typeInfo.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "autoPtr.H"
|
||||
#include "pairPotential.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class energyScalingFunction Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class energyScalingFunction
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
word name_;
|
||||
|
||||
dictionary energyScalingFunctionProperties_;
|
||||
|
||||
const pairPotential& pairPot_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
energyScalingFunction(const energyScalingFunction&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const energyScalingFunction&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("energyScalingFunction");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
energyScalingFunction,
|
||||
dictionary,
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
),
|
||||
(name, energyScalingFunctionProperties, pairPot)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected viscosity model
|
||||
static autoPtr<energyScalingFunction> New
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
energyScalingFunction
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~energyScalingFunction()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual void scaleEnergy(scalar& e, const scalar r) const = 0;
|
||||
|
||||
const dictionary& energyScalingFunctionProperties() const
|
||||
{
|
||||
return energyScalingFunctionProperties_;
|
||||
}
|
||||
|
||||
//- Read energyScalingFunction dictionary
|
||||
virtual bool read(const dictionary& energyScalingFunctionProperties) = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
energyScalingFunction
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "energyScalingFunction.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
autoPtr<energyScalingFunction> energyScalingFunction::New
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
)
|
||||
{
|
||||
word energyScalingFunctionTypeName
|
||||
(
|
||||
energyScalingFunctionProperties.lookup("energyScalingFunction")
|
||||
);
|
||||
|
||||
Info<< "Selecting energy scaling function "
|
||||
<< energyScalingFunctionTypeName << " for "
|
||||
<< name << " potential energy." << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(energyScalingFunctionTypeName);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"energyScalingFunction::New()"
|
||||
) << "Unknown energyScalingFunction type "
|
||||
<< energyScalingFunctionTypeName << endl << endl
|
||||
<< "Valid energyScalingFunctions are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<energyScalingFunction>
|
||||
(cstrIter()(name, energyScalingFunctionProperties, pairPot));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,104 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "doubleSigmoid.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace energyScalingFunctions
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(doubleSigmoid, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
energyScalingFunction,
|
||||
doubleSigmoid,
|
||||
dictionary
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
scalar doubleSigmoid::sigmoidScale
|
||||
(
|
||||
const scalar r,
|
||||
const scalar shift,
|
||||
const scalar scale
|
||||
) const
|
||||
{
|
||||
return 1.0 / (1.0 + exp( scale * (r - shift)));
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
doubleSigmoid::doubleSigmoid
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
)
|
||||
:
|
||||
energyScalingFunction(name, energyScalingFunctionProperties, pairPot),
|
||||
doubleSigmoidCoeffs_(energyScalingFunctionProperties.subDict(typeName + "Coeffs")),
|
||||
shift1_(readScalar(doubleSigmoidCoeffs_.lookup("shift1"))),
|
||||
scale1_(readScalar(doubleSigmoidCoeffs_.lookup("scale1"))),
|
||||
shift2_(readScalar(doubleSigmoidCoeffs_.lookup("shift2"))),
|
||||
scale2_(readScalar(doubleSigmoidCoeffs_.lookup("scale2")))
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void doubleSigmoid::scaleEnergy(scalar& e, const scalar r) const
|
||||
{
|
||||
e *= sigmoidScale(r, shift1_, scale1_) * sigmoidScale(r, shift2_, scale2_);
|
||||
}
|
||||
|
||||
bool doubleSigmoid::read(const dictionary& energyScalingFunctionProperties)
|
||||
{
|
||||
energyScalingFunction::read(energyScalingFunctionProperties);
|
||||
|
||||
doubleSigmoidCoeffs_ = energyScalingFunctionProperties.subDict(typeName + "Coeffs");
|
||||
|
||||
doubleSigmoidCoeffs_.lookup("shift1") >> shift1_;
|
||||
doubleSigmoidCoeffs_.lookup("scale1") >> scale1_;
|
||||
doubleSigmoidCoeffs_.lookup("shift2") >> shift2_;
|
||||
doubleSigmoidCoeffs_.lookup("scale2") >> scale2_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace energyScalingFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,115 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::energyScalingFunctions::doubleSigmoid
|
||||
|
||||
Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
doubleSigmoid.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef doubleSigmoid_H
|
||||
#define doubleSigmoid_H
|
||||
|
||||
#include "energyScalingFunction.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace energyScalingFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class doubleSigmoid Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class doubleSigmoid
|
||||
:
|
||||
public energyScalingFunction
|
||||
{
|
||||
// Private data
|
||||
|
||||
dictionary doubleSigmoidCoeffs_;
|
||||
|
||||
scalar shift1_;
|
||||
scalar scale1_;
|
||||
scalar shift2_;
|
||||
scalar scale2_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
scalar sigmoidScale
|
||||
(
|
||||
const scalar r,
|
||||
const scalar shift,
|
||||
const scalar scale
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("doubleSigmoid");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
doubleSigmoid
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~doubleSigmoid()
|
||||
{}
|
||||
|
||||
// Member Functions
|
||||
|
||||
void scaleEnergy(scalar& e, const scalar r) const;
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
bool read(const dictionary& energyScalingFunctionProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace energyScalingFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,81 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "noScaling.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace energyScalingFunctions
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(noScaling, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
energyScalingFunction,
|
||||
noScaling,
|
||||
dictionary
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
noScaling::noScaling
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
)
|
||||
:
|
||||
energyScalingFunction(name, energyScalingFunctionProperties, pairPot)
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void noScaling::scaleEnergy(scalar& e, const scalar r) const
|
||||
{}
|
||||
|
||||
bool noScaling::read(const dictionary& energyScalingFunctionProperties)
|
||||
{
|
||||
energyScalingFunction::read(energyScalingFunctionProperties);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace energyScalingFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,97 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::energyScalingFunctions::noScaling
|
||||
|
||||
Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
noScaling.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef noScaling_H
|
||||
#define noScaling_H
|
||||
|
||||
#include "energyScalingFunction.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace energyScalingFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class noScaling Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class noScaling
|
||||
:
|
||||
public energyScalingFunction
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("noScaling");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
noScaling
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~noScaling()
|
||||
{}
|
||||
|
||||
// Member Functions
|
||||
|
||||
void scaleEnergy(scalar& e, const scalar r) const;
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
bool read(const dictionary& energyScalingFunctionProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace energyScalingFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2005 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,73 +22,63 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tetherPotential.H"
|
||||
#include "shifted.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace energyScalingFunctions
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(shifted, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
energyScalingFunction,
|
||||
shifted,
|
||||
dictionary
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
tetherPotential::tetherPotential()
|
||||
{}
|
||||
|
||||
|
||||
tetherPotential::tetherPotential
|
||||
shifted::shifted
|
||||
(
|
||||
const word& tetherPotentialName,
|
||||
const word& tetherPotentialType,
|
||||
const scalar springConstant
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
)
|
||||
:
|
||||
tetherPotentialName_(tetherPotentialName),
|
||||
tetherPotentialType_(tetherPotentialType),
|
||||
springConstant_(springConstant)
|
||||
energyScalingFunction(name, energyScalingFunctionProperties, pairPot),
|
||||
e_at_rCut_(pairPot.unscaledEnergy(pairPot.rCut()))
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
tetherPotential::~tetherPotential()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void tetherPotential::write(Ostream& os) const
|
||||
void shifted::scaleEnergy(scalar& e, const scalar r) const
|
||||
{
|
||||
os << tetherPotentialName_
|
||||
<< nl << tetherPotentialType_
|
||||
<< nl << springConstant_
|
||||
<< endl;
|
||||
e -= e_at_rCut_;
|
||||
}
|
||||
|
||||
bool shifted::read(const dictionary& energyScalingFunctionProperties)
|
||||
{
|
||||
energyScalingFunction::read(energyScalingFunctionProperties);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
scalar tetherPotential::force(const scalar rITMag) const
|
||||
{
|
||||
return -springConstant_ * rITMag;
|
||||
}
|
||||
|
||||
|
||||
scalar tetherPotential::energy(const scalar rITMag) const
|
||||
{
|
||||
return 0.5*springConstant_*rITMag*rITMag;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
Ostream& operator<<(Ostream& os, const tetherPotential& pot)
|
||||
{
|
||||
pot.write(os);
|
||||
os.check("Ostream& operator<<(Ostream& f, const tetherPotential& pot");
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace energyScalingFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,101 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::energyScalingFunctions::shifted
|
||||
|
||||
Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
shifted.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef shifted_H
|
||||
#define shifted_H
|
||||
|
||||
#include "energyScalingFunction.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace energyScalingFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class shifted Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class shifted
|
||||
:
|
||||
public energyScalingFunction
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar e_at_rCut_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("shifted");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
shifted
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~shifted()
|
||||
{}
|
||||
|
||||
// Member Functions
|
||||
|
||||
void scaleEnergy(scalar& e, const scalar r) const;
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
bool read(const dictionary& energyScalingFunctionProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace energyScalingFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,86 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "shiftedForce.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace energyScalingFunctions
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(shiftedForce, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
energyScalingFunction,
|
||||
shiftedForce,
|
||||
dictionary
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
shiftedForce::shiftedForce
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
)
|
||||
:
|
||||
energyScalingFunction(name, energyScalingFunctionProperties, pairPot),
|
||||
rCut_(pairPot.rCut()),
|
||||
e_at_rCut_(pairPot.unscaledEnergy(rCut_)),
|
||||
de_dr_at_rCut_(pairPot.energyDerivative(rCut_, false))
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void shiftedForce::scaleEnergy(scalar& e, const scalar r) const
|
||||
{
|
||||
e -= ( e_at_rCut_ + de_dr_at_rCut_ * (r - rCut_) );
|
||||
}
|
||||
|
||||
bool shiftedForce::read(const dictionary& energyScalingFunctionProperties)
|
||||
{
|
||||
energyScalingFunction::read(energyScalingFunctionProperties);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace energyScalingFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,106 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::energyScalingFunctions::shiftedForce
|
||||
|
||||
Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
shiftedForce.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef shiftedForce_H
|
||||
#define shiftedForce_H
|
||||
|
||||
#include "energyScalingFunction.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace energyScalingFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class shiftedForce Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class shiftedForce
|
||||
:
|
||||
public energyScalingFunction
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar rCut_;
|
||||
|
||||
scalar e_at_rCut_;
|
||||
|
||||
scalar de_dr_at_rCut_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("shiftedForce");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
shiftedForce
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~shiftedForce()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
void scaleEnergy(scalar& e, const scalar r) const;
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
bool read(const dictionary& energyScalingFunctionProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace energyScalingFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,100 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sigmoid.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace energyScalingFunctions
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(sigmoid, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
energyScalingFunction,
|
||||
sigmoid,
|
||||
dictionary
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
scalar sigmoid::sigmoidScale
|
||||
(
|
||||
const scalar r,
|
||||
const scalar shift,
|
||||
const scalar scale
|
||||
) const
|
||||
{
|
||||
return 1.0 / (1.0 + exp( scale * (r - shift)));
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
sigmoid::sigmoid
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
)
|
||||
:
|
||||
energyScalingFunction(name, energyScalingFunctionProperties, pairPot),
|
||||
sigmoidCoeffs_(energyScalingFunctionProperties.subDict(typeName + "Coeffs")),
|
||||
shift_(readScalar(sigmoidCoeffs_.lookup("shift"))),
|
||||
scale_(readScalar(sigmoidCoeffs_.lookup("scale")))
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void sigmoid::scaleEnergy(scalar& e, const scalar r) const
|
||||
{
|
||||
e *= sigmoidScale(r, shift_, scale_);
|
||||
}
|
||||
|
||||
bool sigmoid::read(const dictionary& energyScalingFunctionProperties)
|
||||
{
|
||||
energyScalingFunction::read(energyScalingFunctionProperties);
|
||||
|
||||
sigmoidCoeffs_ = energyScalingFunctionProperties.subDict(typeName + "Coeffs");
|
||||
|
||||
sigmoidCoeffs_.lookup("shift") >> shift_;
|
||||
sigmoidCoeffs_.lookup("scale") >> shift_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace energyScalingFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,115 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::energyScalingFunctions::sigmoid
|
||||
|
||||
Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
sigmoid.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef sigmoid_H
|
||||
#define sigmoid_H
|
||||
|
||||
#include "energyScalingFunction.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace energyScalingFunctions
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class sigmoid Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class sigmoid
|
||||
:
|
||||
public energyScalingFunction
|
||||
{
|
||||
// Private data
|
||||
|
||||
dictionary sigmoidCoeffs_;
|
||||
|
||||
scalar shift_;
|
||||
scalar scale_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
scalar sigmoidScale
|
||||
(
|
||||
const scalar r,
|
||||
const scalar shift,
|
||||
const scalar scale
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("sigmoid");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
sigmoid
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& energyScalingFunctionProperties,
|
||||
const pairPotential& pairPot
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~sigmoid()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
void scaleEnergy(scalar& e, const scalar r) const;
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
bool read(const dictionary& energyScalingFunctionProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace energyScalingFunctions
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user