PSCF v1.3
|
MDE solver for one direction of one block. More...
#include <Propagator.h>
Public Types | |
using | Base = PropagatorTmpl< Propagator<D> > |
Base class (partial template specialization). | |
using | FieldT = RField<D> |
Field type (function of position, defined on a r-space grid). |
Public Member Functions | |
Propagator () | |
Constructor. | |
~Propagator () | |
Destructor. | |
void | setBlock (Block< D > &block) |
Associate this propagator with a block. | |
void | allocate (int ns, const Mesh< D > &mesh) |
Allocate memory used by this propagator. | |
void | reallocate (int ns) |
Reallocate memory used by this propagator. | |
void | solve () |
Solve the modified diffusion equation (MDE) for this block. | |
void | solve (FieldT const &head) |
Solve the MDE for a specified initial condition. | |
double | computeQ () const |
Compute and return partition function for the polymer. | |
const FieldT & | q (int i) const |
Return q-field at specified step. | |
const FieldT & | head () const |
Return q-field at beginning of the block (initial condition). | |
const FieldT & | tail () const |
Return q-field at the end of the block. | |
Block< D > const & | block () const |
Get the associated Block 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? | |
int | nSource () const |
Number of source / prerequisite propagators. | |
const Propagator< D > & | source (int id) const |
Get a source propagator. | |
const Propagator< D > & | partner () const |
Get partner propagator. | |
void | setIsSolved (bool isSolved) |
Set the isSolved flag to true or false. | |
bool | isSolved () const |
Has the modified diffusion equation been solved? | |
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? | |
Public Member Functions inherited from Pscf::PropagatorTmpl< Propagator< D > > | |
PropagatorTmpl () | |
Constructor. | |
void | setDirectionId (int directionId) |
Associate this propagator with a direction index. | |
void | setPartner (const Propagator< D > &partner) |
Set the partner of this propagator. | |
void | addSource (const Propagator< D > &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 Propagator< D > & | source (int id) const |
Get a source propagator. | |
const Propagator< D > & | 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? |
MDE solver for one direction of one block.
A fully initialized Propagator<D> has an associations with a Block<D> object that owns this propagator and its partner, and with a partner Propagator<D> 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<D> objects that are used to compute an initial condition for this propagator at the head vertex.
The associated Block<D> 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.
Definition at line 51 of file rpc/solvers/Propagator.h.
using Pscf::Rpc::Propagator< D >::Base = PropagatorTmpl< Propagator<D> > |
Base class (partial template specialization).
Definition at line 61 of file rpc/solvers/Propagator.h.
using Pscf::Rpc::Propagator< D >::FieldT = RField<D> |
Field type (function of position, defined on a r-space grid).
Definition at line 66 of file rpc/solvers/Propagator.h.
Pscf::Rpc::Propagator< D >::Propagator | ( | ) |
Constructor.
Definition at line 25 of file rpc/solvers/Propagator.tpp.
Pscf::Rpc::Propagator< D >::~Propagator | ( | ) |
Destructor.
Definition at line 36 of file rpc/solvers/Propagator.tpp.
|
inline |
Associate this propagator with a block.
block | associated Block object. |
Definition at line 300 of file rpc/solvers/Propagator.h.
References block(), and UTIL_ASSERT.
void Pscf::Rpc::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 at vertices) |
mesh | spatial discretization mesh |
Definition at line 43 of file rpc/solvers/Propagator.tpp.
References Pscf::Mesh< D >::dimensions(), ns(), and UTIL_CHECK.
void Pscf::Rpc::Propagator< D >::reallocate | ( | int | ns | ) |
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 the parameter ns is equal to the current value.
ns | number of slices (including end points) |
Definition at line 60 of file rpc/solvers/Propagator.tpp.
References ns(), setIsSolved(), and UTIL_CHECK.
void Pscf::Rpc::Propagator< D >::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 136 of file rpc/solvers/Propagator.tpp.
References Pscf::assign(), block(), isAllocated(), Pscf::PolymerModel::isBead(), isHeadEnd(), isTailEnd(), Pscf::PolymerModel::isThread(), setIsSolved(), UTIL_CHECK, and UTIL_THROW.
void Pscf::Rpc::Propagator< D >::solve | ( | FieldT 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 187 of file rpc/solvers/Propagator.tpp.
References Pscf::assign(), block(), head(), Pscf::PolymerModel::isBead(), isHeadEnd(), isTailEnd(), Pscf::PolymerModel::isThread(), setIsSolved(), UTIL_CHECK, and UTIL_THROW.
double Pscf::Rpc::Propagator< D >::computeQ | ( | ) | const |
Compute and return partition function for the polymer.
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.
Definition at line 243 of file rpc/solvers/Propagator.tpp.
References hasPartner(), head(), Pscf::PolymerModel::isBead(), isHeadEnd(), isSolved(), isTailEnd(), partner(), UTIL_CHECK, and UTIL_THROW.
|
inline |
Return q-field at specified step.
i | step index, 0 <= i < ns |
Definition at line 268 of file rpc/solvers/Propagator.h.
References isSolved(), and UTIL_CHECK.
Referenced by Pscf::Rpc::Block< D >::computeConcentrationBead(), Pscf::Rpc::Block< D >::computeConcentrationThread(), Pscf::Rpc::Block< D >::computeStressBead(), and Pscf::Rpc::Block< D >::computeStressThread().
|
inline |
Return q-field at beginning of the block (initial condition).
Definition at line 246 of file rpc/solvers/Propagator.h.
References isSolved(), and UTIL_CHECK.
Referenced by computeQ(), and solve().
|
inline |
Return q-field at the end of the block.
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 256 of file rpc/solvers/Propagator.h.
References isSolved(), isTailEnd(), Pscf::PolymerModel::isThread(), and UTIL_CHECK.
|
inline |
Get the associated Block object by const reference.
Definition at line 279 of file rpc/solvers/Propagator.h.
References UTIL_ASSERT.
Referenced by setBlock(), solve(), 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 289 of file rpc/solvers/Propagator.h.
Referenced by allocate(), and reallocate().
|
inline |
Has memory been allocated for this propagator?
Definition at line 293 of file rpc/solvers/Propagator.h.
Referenced by Pscf::Rpc::Block< D >::computeStressThread(), and solve().
int Pscf::PropagatorTmpl< Propagator< D > >::nSource | ( | ) | const |
Number of source / prerequisite propagators.
const Propagator< D > & Pscf::PropagatorTmpl< Propagator< D > >::source | ( | int | id | ) | const |
Get a source propagator.
id | index of source propagator, < nSource |
const Propagator< D > & Pscf::PropagatorTmpl< Propagator< D > >::partner | ( | ) | const |
Get partner propagator.
Referenced by computeQ().
void Pscf::PropagatorTmpl< Propagator< D > >::setIsSolved | ( | bool | isSolved | ) |
Set the isSolved flag to true or false.
Referenced by reallocate(), solve(), and solve().
bool Pscf::PropagatorTmpl< Propagator< D > >::isSolved | ( | ) | const |
Has the modified diffusion equation been solved?
Referenced by computeQ(), Pscf::Rpc::Block< D >::computeStressBead(), head(), q(), and tail().
bool Pscf::PropagatorTmpl< Propagator< D > >::hasPartner | ( | ) | const |
Does this have a partner propagator?
Referenced by computeQ().
bool Pscf::PropagatorTmpl< Propagator< D > >::isHeadEnd | ( | ) | const |
Is the head vertex a chain end?
Precondition: PolymerModel::isBead()
Referenced by computeQ(), Pscf::Rpc::Block< D >::computeStressBead(), solve(), and solve().
bool Pscf::PropagatorTmpl< Propagator< D > >::isTailEnd | ( | ) | const |
Is the tail vertex a chain end?
Precondition: PolymerModel::isBead()
Referenced by computeQ(), Pscf::Rpc::Block< D >::computeStressBead(), solve(), solve(), and tail().