PSCF v1.3
|
MDE solver for one-direction of one block. More...
#include <Propagator.h>
Public Types | |
using | Base = PropagatorTmpl< Propagator<D> > |
Base class type (partial template specialization). | |
using | FieldT = RField<D> |
Field type (function of position, defined on real 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 propagator arrays. | |
void | reallocate (int ns) |
Reallocate memory used by this propagator. | |
void | solve () |
Solve the modified diffusion equation (MDE) for this block. | |
void | solve (RField< D > const &head) |
Solve the MDE for a specified initial condition. | |
double | computeQ () |
Compute and return partition function for the molecule. | |
RField< D > const & | q (int i) const |
Return q-field at specified slice. | |
RField< D > const & | head () |
Return q-field at initial (head) vertex. | |
RField< D > const & | tail () const |
Return q-field at terminal (tail) vertex. | |
DeviceArray< cudaReal > const & | qAll () |
Return the full array of q-fields as an unrolled 1D array. | |
Block< D > & | block () |
Get the associated Block object by reference. | |
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 association 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 on 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 the MDE repeatedly calls the step functions provided by the parent Block.
Definition at line 53 of file rpg/solvers/Propagator.h.
using Pscf::Rpg::Propagator< D >::Base = PropagatorTmpl< Propagator<D> > |
Base class type (partial template specialization).
Definition at line 63 of file rpg/solvers/Propagator.h.
using Pscf::Rpg::Propagator< D >::FieldT = RField<D> |
Field type (function of position, defined on real space grid).
Definition at line 69 of file rpg/solvers/Propagator.h.
Pscf::Rpg::Propagator< D >::Propagator | ( | ) |
Constructor.
Definition at line 26 of file rpg/solvers/Propagator.tpp.
Pscf::Rpg::Propagator< D >::~Propagator | ( | ) |
Destructor.
Definition at line 37 of file rpg/solvers/Propagator.tpp.
|
inline |
Associate this propagator with a block.
block | associated Block object. |
Definition at line 345 of file rpg/solvers/Propagator.h.
References block().
void Pscf::Rpg::Propagator< D >::allocate | ( | int | ns, |
const Mesh< D > & | mesh ) |
Allocate propagator arrays.
The parameter ns is the number of values of s at which q(r,s) is calculated, including 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 points along chain contour |
mesh | spatial discretization mesh |
Definition at line 44 of file rpg/solvers/Propagator.tpp.
References ns(), and Pscf::Mesh< D >::size().
void Pscf::Rpg::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 Exceptions is thrown if the propagator has not been previously allocated.
ns | number of slices (including end points at vertices) |
Definition at line 65 of file rpg/solvers/Propagator.tpp.
References ns(), setIsSolved(), and UTIL_CHECK.
void Pscf::Rpg::Propagator< D >::solve | ( | ) |
Solve the modified diffusion equation (MDE) for this block.
This function computes an initial q-field at the head of this propagator, and then solves the modified diffusion equation for the block to propagate from the head to the tail. Algorithms for the thread or bead model may be used, depending the value of PolymerModel::model().
Definition at line 123 of file rpg/solvers/Propagator.tpp.
References block(), Pscf::Prdc::Cuda::VecOp::eqV(), isAllocated(), Pscf::PolymerModel::isBead(), isHeadEnd(), isTailEnd(), Pscf::PolymerModel::isThread(), setIsSolved(), UTIL_CHECK, and UTIL_THROW.
void Pscf::Rpg::Propagator< D >::solve | ( | RField< D > const & | head | ) |
Solve the MDE for a specified initial condition.
This function solves the modified diffusion equation 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 174 of file rpg/solvers/Propagator.tpp.
References block(), Pscf::Prdc::Cuda::VecOp::eqV(), head(), isAllocated(), Pscf::PolymerModel::isBead(), isHeadEnd(), isTailEnd(), Pscf::PolymerModel::isThread(), setIsSolved(), UTIL_CHECK, and UTIL_THROW.
double Pscf::Rpg::Propagator< D >::computeQ | ( | ) |
Compute and return partition function for the 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 final/tail slice of its partner.
Definition at line 223 of file rpg/solvers/Propagator.tpp.
References hasPartner(), head(), Pscf::PolymerModel::isBead(), isHeadEnd(), isSolved(), isTailEnd(), partner(), UTIL_CHECK, and UTIL_THROW.
|
inline |
Return q-field at specified slice.
i | step index |
Definition at line 288 of file rpg/solvers/Propagator.h.
References isSolved(), and UTIL_CHECK.
Referenced by Pscf::Rpg::Block< D >::computeConcentrationBead(), Pscf::Rpg::Block< D >::computeConcentrationThread(), Pscf::Rpg::Block< D >::computeStressBead(), and Pscf::Rpg::Block< D >::computeStressThread().
|
inline |
Return q-field at initial (head) vertex.
Definition at line 265 of file rpg/solvers/Propagator.h.
References isSolved(), and UTIL_CHECK.
Referenced by computeQ(), and solve().
|
inline |
Return q-field at 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, tail slice is not needed, and so is not computed.
Definition at line 276 of file rpg/solvers/Propagator.h.
References isSolved(), isTailEnd(), Pscf::PolymerModel::isThread(), and UTIL_CHECK.
|
inline |
Return the full array of q-fields as an unrolled 1D array.
Definition at line 299 of file rpg/solvers/Propagator.h.
References isSolved(), and UTIL_CHECK.
Referenced by Pscf::Rpg::Block< D >::computeStressBead(), and Pscf::Rpg::Block< D >::computeStressThread().
|
inline |
Get the associated Block object by reference.
Definition at line 310 of file rpg/solvers/Propagator.h.
Referenced by setBlock(), solve(), and solve().
|
inline |
Get the associated Block object by const reference.
Definition at line 321 of file rpg/solvers/Propagator.h.
|
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 ned 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 332 of file rpg/solvers/Propagator.h.
Referenced by allocate(), and reallocate().
|
inline |
Has memory been allocated for this propagator?
Definition at line 337 of file rpg/solvers/Propagator.h.
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::Rpg::Block< D >::computeStressBead(), Pscf::Rpg::Block< D >::computeStressThread(), head(), q(), qAll(), 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::Rpg::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::Rpg::Block< D >::computeStressBead(), solve(), solve(), and tail().