PSCF v1.1
|
MDE solver for one direction of one block. More...
#include <Propagator.h>
Public Types | |
typedef RField< D > | Field |
Generic field (function of position, defined on regular grid). More... | |
typedef RField< D > | WField |
Chemical potential field type (r-grid format) More... | |
typedef RField< D > | CField |
Monomer concentration field type (r-grid format) More... | |
typedef RField< D > | QField |
Propagator q-field type, i.e., q(r,s) at fixed s. More... | |
Public Member Functions | |
Propagator () | |
Constructor. More... | |
~Propagator () | |
Destructor. More... | |
void | setBlock (Block< D > &block) |
Associate this propagator with a unique block. More... | |
void | allocate (int ns, const Mesh< D > &mesh) |
Allocate memory used by this propagator. More... | |
void | reallocate (int ns) |
Reallocate memory used by this propagator. More... | |
void | solve () |
Solve the modified diffusion equation (MDE) for this block. More... | |
void | solve (QField const &head) |
Solve the MDE for a specified initial condition. More... | |
double | computeQ () |
Compute and return partition function for the polymer. More... | |
const QField & | q (int i) const |
Return q-field at specified step. More... | |
const QField & | head () const |
Return q-field at beginning of the block (initial condition). More... | |
const QField & | tail () const |
Return q-field at the end of the block. More... | |
Block< D > & | block () |
Get the associated Block object by reference. More... | |
int | ns () const |
Number of values of s (or slices), including head and tail. More... | |
bool | isAllocated () const |
Has memory been allocated for this propagator? More... | |
![]() | |
PropagatorTmpl () | |
Constructor. More... | |
void | setDirectionId (int directionId) |
Associate this propagator with a direction index. More... | |
void | setPartner (const Propagator< D > &partner) |
Set the partner of this propagator. More... | |
void | addSource (const Propagator< D > &source) |
Add a propagator to the list of sources for this one. More... | |
void | setIsSolved (bool isSolved) |
Set the isSolved flag to true or false. More... | |
const Propagator< D > & | source (int id) const |
Get a source propagator. More... | |
const Propagator< D > & | partner () const |
Get partner propagator. More... | |
int | directionId () const |
Get direction index for this propagator. More... | |
int | nSource () const |
Number of source / prerequisite propagators. More... | |
bool | hasPartner () const |
Does this have a partner propagator? More... | |
bool | isSolved () const |
Has the modified diffusion equation been solved? More... | |
bool | isReady () const |
Are all source propagators are solved? More... | |
Protected Member Functions | |
void | computeHead () |
Compute initial QField at head from tail QFields of sources. More... | |
MDE solver for one direction of one block.
A fully initialized Propagator<D> has an association with a Block<D> that owns this propagator and its partner, and has an association with a Mesh<D> that describes a spatial grid, in addition to associations with partner and source Propagator<D> objects that are managed by the PropagatorTmpl base class template.
The associated Block<D> stores information required to numerically solve the modified diffusion equation (MDE), including the contour step size ds and all parameters that depend on ds. These quantities are set and stored by the block because their values must be the same for the two propagators owned by each block (i.e., this propagator and its partner). The algorithm used by a propagator to solve the the MDE simply repeatedly calls the step() function of the associated block, because that function has access to all the parameters used in the numerical solution.
Definition at line 47 of file pspc/solvers/Propagator.h.
typedef RField<D> Pscf::Pspc::Propagator< D >::Field |
Generic field (function of position, defined on regular grid).
Definition at line 57 of file pspc/solvers/Propagator.h.
typedef RField<D> Pscf::Pspc::Propagator< D >::WField |
Chemical potential field type (r-grid format)
Definition at line 62 of file pspc/solvers/Propagator.h.
typedef RField<D> Pscf::Pspc::Propagator< D >::CField |
Monomer concentration field type (r-grid format)
Definition at line 67 of file pspc/solvers/Propagator.h.
typedef RField<D> Pscf::Pspc::Propagator< D >::QField |
Propagator q-field type, i.e., q(r,s) at fixed s.
Definition at line 72 of file pspc/solvers/Propagator.h.
Pscf::Pspc::Propagator< D >::Propagator |
Constructor.
Definition at line 25 of file pspc/solvers/Propagator.tpp.
Pscf::Pspc::Propagator< D >::~Propagator |
Destructor.
Definition at line 36 of file pspc/solvers/Propagator.tpp.
|
inline |
Associate this propagator with a unique block.
block | associated Block object. |
Definition at line 291 of file pspc/solvers/Propagator.h.
void Pscf::Pspc::Propagator< D >::allocate | ( | int | ns, |
const Mesh< D > & | mesh | ||
) |
Allocate memory used by this propagator.
The parameter ns is the number of values of s at which q(r,s) is calculated, including the end values at the terminating vertices. See docs for the function ns(), which returns this value.
The address of the associated Mesh<D> object is retained.
An Exception is thrown if the propagator is already allocated.
ns | number of slices (including end points) |
mesh | spatial discretization mesh |
Definition at line 43 of file pspc/solvers/Propagator.tpp.
References Pscf::Mesh< D >::dimensions(), and UTIL_CHECK.
void Pscf::Pspc::Propagator< D >::reallocate | ( | int | ns | ) |
Reallocate memory used by this propagator.
This function is used when the value of ns is changed after initial allocation. This occurs during parameter sweeps that change the block length. See the docs for the function ns() for the definition of ns.
The spatial mesh is set by derefencing a pointer to the associated Mesh<D> object, which was set by a previous call to allocate.
An Exception is thrown if the propagator has not been previously allocated, or if the parameter ns is equal to the current value.
ns | number of slices (including end points) |
Definition at line 60 of file pspc/solvers/Propagator.tpp.
References UTIL_CHECK.
void Pscf::Pspc::Propagator< D >::solve |
Solve the modified diffusion equation (MDE) for this block.
This function computes an initial QField at the head of this block, and then solves the modified diffusion equation (MDE) to propagate the solution from the head to the tail. The initial QField at the head is computed by pointwise multiplication of the tail QFields of all source propagators. The MDE is solved by repeatedly calling the step() function of the associated Block<D> .
Definition at line 117 of file pspc/solvers/Propagator.tpp.
References UTIL_CHECK.
void Pscf::Pspc::Propagator< D >::solve | ( | QField const & | head | ) |
Solve the MDE for a specified initial condition.
This function solves the modified diffusion equation (MDE) for this block with a specified initial condition, which is given by the function parameter "head". The MDE is solved by repeatedly calling the step() function of the associated Block<D>.
head | initial condition of QField at head of block |
Definition at line 131 of file pspc/solvers/Propagator.tpp.
References Util::Array< Data >::capacity(), and UTIL_CHECK.
double Pscf::Pspc::Propagator< D >::computeQ |
Compute and return partition function for the polymer.
This function computes the partition function Q for the molecule as a spatial average of pointwise product of the initial/head Qfield for this propagator and the final/tail Qfield of its partner.
Definition at line 153 of file pspc/solvers/Propagator.tpp.
References Util::Array< Data >::capacity(), UTIL_CHECK, and UTIL_THROW.
|
inline |
Return q-field at specified step.
i | step index, 0 <= i < ns |
Definition at line 262 of file pspc/solvers/Propagator.h.
Referenced by Pscf::Pspc::System< D >::writeQ(), and Pscf::Pspc::System< D >::writeQSlice().
|
inline |
Return q-field at beginning of the block (initial condition).
Definition at line 246 of file pspc/solvers/Propagator.h.
|
inline |
Return q-field at the end of the block.
Definition at line 254 of file pspc/solvers/Propagator.h.
Referenced by Pscf::Pspc::System< D >::writeQTail().
|
inline |
Get the associated Block object by reference.
Definition at line 270 of file pspc/solvers/Propagator.h.
|
inline |
Number of values of s (or slices), including head and tail.
The value of ns is the number of values of s at which q(r,s) is calculated, including the end values at the terminating vertices (the head and tail). This is one more than the number of contour variable steps.
Definition at line 280 of file pspc/solvers/Propagator.h.
Referenced by Pscf::Pspc::System< D >::writeQ().
|
inline |
Has memory been allocated for this propagator?
Definition at line 284 of file pspc/solvers/Propagator.h.
|
protected |
Compute initial QField at head from tail QFields of sources.
Definition at line 88 of file pspc/solvers/Propagator.tpp.
References UTIL_THROW.