|
PSCF v1.4.0
|
MDE solver for one direction of one block. More...
#include <Propagator.h>
Public Types | |
| using | PropagatorTmplT = PropagatorTmpl<typename T::Propagator> |
| Direct (parent) base class. | |
Public Member Functions | |
| void | setBlock (typename T::Block &block) |
| Associate this propagator with a block. | |
| virtual void | allocate (int ns, const Mesh< D > &mesh) |
| Allocate memory used by this propagator. | |
| virtual void | reallocate (int ns) |
| Reallocate memory used by this propagator. | |
| void | solve () |
| Solve the modified diffusion equation (MDE) for this block. | |
| void | solve (typename T::RField const &head) |
| Solve the MDE for a specified initial condition. | |
| void | computeQ (double &Q) const |
| Compute and return partition function for the polymer molecule. | |
| const T::RField & | q (int i) const |
| Return q-field at a specified step. | |
| const T::RField & | head () const |
| Return q-field at the initial (head) vertex. | |
| const T::RField & | tail () const |
| Return q-field at the terminal (tail) vertex. | |
| T::Block const & | block () const |
| Get the associated Block object by const reference. | |
| Mesh< D > const & | mesh () const |
| Return the associated Mesh object by const reference. | |
| int | ns () const |
| Get the number of values of s (or slices), including head and tail. | |
| bool | isAllocated () const |
| Has memory been allocated for this propagator? | |
| const typename T::Propagator & | source (int id) const |
| Get a source propagator. | |
| const typename T::Propagator & | partner () const |
| Get partner propagator. | |
| Public Member Functions inherited from Pscf::PropagatorTmpl< T::Propagator > | |
| void | setDirectionId (int directionId) |
| Associate this propagator with a direction index. | |
| void | setPartner (const T::Propagator &partner) |
| Set the partner of this propagator. | |
| void | addSource (const T::Propagator &source) |
| Add a propagator to the list of sources for this one. | |
| void | setIsSolved (bool isSolved) |
| Set the isSolved flag to true or false. | |
| void | setEndFlags (bool isHeadEnd, bool isTailEnd) |
| Set flags indicating whether vertices are chain ends. | |
| const T::Propagator & | source (int id) const |
| Get a source propagator. | |
| const T::Propagator & | partner () const |
| Get partner propagator. | |
| int | directionId () const |
| Get direction index for this propagator. | |
| int | nSource () const |
| Number of source / prerequisite propagators. | |
| bool | hasPartner () const |
| Does this have a partner propagator? | |
| bool | isHeadEnd () const |
| Is the head vertex a chain end? | |
| bool | isTailEnd () const |
| Is the tail vertex a chain end? | |
| bool | isSolved () const |
| Has the modified diffusion equation been solved? | |
| bool | isReady () const |
| Are all source propagators solved? | |
Protected Member Functions | |
| Propagator () | |
| Constructor. | |
| ~Propagator () | |
| Destructor. | |
| void | computeHead () |
| Compute initial q-field at the head vertex. | |
| void | solveMde () |
| Compute solution of modified diffusion equation (MDE). | |
| T::Block & | block () |
| Get the associated Block object by non-const reference. | |
| Protected Member Functions inherited from Pscf::PropagatorTmpl< T::Propagator > | |
| PropagatorTmpl () | |
| Constructor. | |
Protected Attributes | |
| DArray< typename T::RField > | qFields_ |
| Array of propagator slices at different contour variable values. | |
| int | ns_ |
| Number of slices, including head and tail slices. | |
| bool | isAllocated_ |
| Is this propagator allocated? | |
MDE solver for one direction of one block.
A fully initialized Propagator has associations with a parent Block object that owns this propagator, and with a partner Propagator that solves the MDE within the same block in the opposite direction. It also has an association with a Mesh<D> that describes a spatial grid, and associations with zero or more source Propagator objects that are used to compute an initial condition for this propagator at its head vertex.
The parent Block stores information required to numerically solve the modified diffusion equation (MDE), including quantities that depend upon the w-field associated with this block, the unit cell parameters and (in the thread model) the contour step size. These quantities are set and stored by the block because their values are the same for the two propagators owned by each block, but may be different for different blocks. The algorithm used by a Propagator to solve the MDE repeatedly calls step functions provided by the parent Block.
Specializations of this class template are used as base classes for two closely analogous class templates, also named Propagator, that are defined in the Rpc and Rpg program-level name spaces for use in the pscf_rpc and pscf_rpg programs, respectively.
Template parameters :
Definition at line 59 of file rp/solvers/Propagator.h.
| using Pscf::Rp::Propagator< D, T >::PropagatorTmplT = PropagatorTmpl<typename T::Propagator> |
Direct (parent) base class.
Definition at line 182 of file rp/solvers/Propagator.h.
|
protected |
Constructor.
Definition at line 23 of file rp/solvers/Propagator.tpp.
References isAllocated_, and ns_.
|
protected |
Destructor.
Definition at line 34 of file rp/solvers/Propagator.tpp.
|
inline |
Associate this propagator with a block.
| block | associated Block object |
Definition at line 323 of file rp/solvers/Propagator.h.
References block().
|
virtual |
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 at vertices) |
| mesh | spatial discretization mesh |
Reimplemented in Pscf::Rpc::Propagator< D >, and Pscf::Rpg::Propagator< D >.
Definition at line 41 of file rp/solvers/Propagator.tpp.
References isAllocated_, mesh(), ns(), ns_, and UTIL_CHECK.
|
virtual |
Reallocate memory used by this propagator.
This function is used when the value of ns is changed, which can occur during some parameter sweeps. See docs for allocate and ns.
An Exception is thrown if the propagator has not been previously allocated, or if it is allocated but the value of ns is unchanged.
| ns | number of slices (including end points) |
Reimplemented in Pscf::Rpc::Propagator< D >, and Pscf::Rpg::Propagator< D >.
Definition at line 52 of file rp/solvers/Propagator.tpp.
References isAllocated_, ns(), ns_, and UTIL_CHECK.
| void Pscf::Rp::Propagator< D, T >::solve | ( | ) |
Solve the modified diffusion equation (MDE) for this block.
This function computes an initial q-field at the head of this block, and then solves the modified diffusion equation (MDE) to propagate the solution from the head to the tail. Algorithms for the thread or bead model may be used, depending on the value of PolymerModel::model().
Definition at line 96 of file rp/solvers/Propagator.tpp.
References computeHead(), and solveMde().
| void Pscf::Rp::Propagator< D, T >::solve | ( | typename T::RField 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".
| head | initial condition of q-field at head of block |
Definition at line 106 of file rp/solvers/Propagator.tpp.
References Pscf::VecOp::eqV(), head(), mesh(), qFields_, solveMde(), and UTIL_CHECK.
| void Pscf::Rp::Propagator< D, T >::computeQ | ( | double & | Q | ) | const |
Compute and return partition function for the polymer molecule.
This function computes the partition function Q for the molecule as a spatial average of the pointwise product of the initial/head slice for this propagator and the final/tail slice of its partner.
| Q | output value, spatial average of q*q^{+} at head |
Definition at line 171 of file rp/solvers/Propagator.tpp.
References Pscf::PropagatorTmpl< typename T::Propagator >::hasPartner(), head(), Pscf::Reduce::innerProduct(), isAllocated_, Pscf::PolymerModel::isBead(), Pscf::PropagatorTmpl< typename T::Propagator >::isHeadEnd(), Pscf::PropagatorTmpl< T::Propagator >::isSolved(), Pscf::PropagatorTmpl< typename T::Propagator >::isSolved(), Pscf::PropagatorTmpl< T::Propagator >::isTailEnd(), mesh(), ns_, partner(), q(), Pscf::Reduce::sum(), tail(), UTIL_CHECK, and UTIL_THROW.
|
inline |
Return q-field at a specified step.
| i | step index, 0 <= i < ns |
Definition at line 269 of file rp/solvers/Propagator.h.
References Pscf::PropagatorTmpl< typename T::Propagator >::isSolved(), qFields_, and UTIL_CHECK.
Referenced by Pscf::Rpc::Block< D >::computeConcentrationBead(), Pscf::Rpg::Block< D >::computeConcentrationBead(), Pscf::Rpc::Block< D >::computeConcentrationThread(), Pscf::Rpg::Block< D >::computeConcentrationThread(), computeQ(), Pscf::Rpc::Block< D >::computeStressBead(), Pscf::Rpg::Block< D >::computeStressBead(), Pscf::Rpc::Block< D >::computeStressThread(), and Pscf::Rpg::Block< D >::computeStressThread().
|
inline |
Return q-field at the initial (head) vertex.
Definition at line 248 of file rp/solvers/Propagator.h.
References Pscf::PropagatorTmpl< typename T::Propagator >::isSolved(), qFields_, and UTIL_CHECK.
Referenced by computeQ(), and solve().
|
inline |
Return q-field at the terminal (tail) vertex.
This function throws an Exception if invoked while the bead model is in use (i.e., if PolymerModel::isThread() == false) and the tail for this propagator is a chain end (i.e., if isTailEnd() == true). In this case, the tail slice is not needed, and so is not computed.
Definition at line 258 of file rp/solvers/Propagator.h.
References Pscf::PropagatorTmpl< typename T::Propagator >::isSolved(), Pscf::PropagatorTmpl< typename T::Propagator >::isTailEnd(), Pscf::PolymerModel::isThread(), ns_, qFields_, and UTIL_CHECK.
Referenced by computeHead(), and computeQ().
|
inline |
Get the associated Block object by const reference.
Definition at line 279 of file rp/solvers/Propagator.h.
References UTIL_ASSERT.
Referenced by setBlock(), and solveMde().
|
inline |
Return the associated Mesh object by const reference.
Definition at line 299 of file rp/solvers/Propagator.h.
References UTIL_ASSERT.
Referenced by allocate(), computeQ(), and solve().
|
inline |
Get the 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). In the bead model, this is two more than the number of beads in the block. In the thread model, this is one more than the number length/ds of contour length steps.
Definition at line 309 of file rp/solvers/Propagator.h.
References ns_.
Referenced by allocate(), computeHead(), and reallocate().
|
inline |
Has memory been allocated for this propagator?
Definition at line 316 of file rp/solvers/Propagator.h.
References isAllocated_.
Referenced by Pscf::Rpc::Block< D >::computeStressThread(), and solveMde().
|
protected |
Compute initial q-field at the head vertex.
In either the thread or bead model, the head slice of each propagator is the product of tail slices for incoming propagators from other bonds that terminate at the head vertex, or 1 for a chain end.
Definition at line 64 of file rp/solvers/Propagator.tpp.
References Pscf::VecOp::eqS(), isAllocated_, Pscf::PropagatorTmpl< typename T::Propagator >::isHeadEnd(), Pscf::PropagatorTmpl< T::Propagator >::isSolved(), Pscf::VecOp::mulEqV(), ns(), Pscf::PropagatorTmpl< typename T::Propagator >::nSource(), qFields_, source(), tail(), UTIL_CHECK, and UTIL_THROW.
Referenced by solve().
|
protected |
Compute solution of modified diffusion equation (MDE).
This function accesses a precomputed head slice qFields_[0] and computes the rest of the propagator.
Definition at line 121 of file rp/solvers/Propagator.tpp.
References block(), Pscf::VecOp::eqV(), isAllocated(), Pscf::PolymerModel::isBead(), Pscf::PropagatorTmpl< typename T::Propagator >::isHeadEnd(), Pscf::PropagatorTmpl< typename T::Propagator >::isTailEnd(), Pscf::PolymerModel::isThread(), ns_, qFields_, Pscf::PropagatorTmpl< typename T::Propagator >::setIsSolved(), UTIL_CHECK, and UTIL_THROW.
|
inlineprotected |
Get the associated Block object by non-const reference.
Definition at line 289 of file rp/solvers/Propagator.h.
References UTIL_ASSERT.
| const typename T::Propagator & Pscf::PropagatorTmpl< typename T::Propagator >::source | ( | int | id | ) | const |
Get a source propagator.
| id | index of source propagator, < nSource |
Referenced by computeHead().
| const typename T::Propagator & Pscf::PropagatorTmpl< typename T::Propagator >::partner | ( | ) | const |
Get partner propagator.
Referenced by computeQ().
|
protected |
Array of propagator slices at different contour variable values.
Definition at line 191 of file rp/solvers/Propagator.h.
Referenced by computeHead(), head(), q(), solve(), solveMde(), and tail().
|
protected |
Number of slices, including head and tail slices.
Definition at line 194 of file rp/solvers/Propagator.h.
Referenced by allocate(), computeQ(), ns(), Propagator(), reallocate(), solveMde(), and tail().
|
protected |
Is this propagator allocated?
Definition at line 197 of file rp/solvers/Propagator.h.
Referenced by allocate(), computeHead(), computeQ(), isAllocated(), Propagator(), and reallocate().