PSCF v1.1
Public Types | Public Member Functions | Protected Member Functions | List of all members
Pscf::Pspc::Propagator< D > Class Template Reference

MDE solver for one direction of one block. More...

#include <Propagator.h>

Inheritance diagram for Pscf::Pspc::Propagator< D >:
Pscf::PropagatorTmpl< Propagator< D > >

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 QFieldq (int i) const
 Return q-field at specified step. More...
 
const QFieldhead () const
 Return q-field at beginning of the block (initial condition). More...
 
const QFieldtail () 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...
 
- Public Member Functions inherited from Pscf::PropagatorTmpl< Propagator< D > >
 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...
 

Detailed Description

template<int D>
class Pscf::Pspc::Propagator< D >

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.

Member Typedef Documentation

◆ Field

template<int D>
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.

◆ WField

template<int D>
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.

◆ CField

template<int D>
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.

◆ QField

template<int D>
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.

Constructor & Destructor Documentation

◆ Propagator()

template<int D>
Pscf::Pspc::Propagator< D >::Propagator

Constructor.

Definition at line 25 of file pspc/solvers/Propagator.tpp.

◆ ~Propagator()

template<int D>
Pscf::Pspc::Propagator< D >::~Propagator

Destructor.

Definition at line 36 of file pspc/solvers/Propagator.tpp.

Member Function Documentation

◆ setBlock()

template<int D>
void Pscf::Pspc::Propagator< D >::setBlock ( Block< D > &  block)
inline

Associate this propagator with a unique block.

Parameters
blockassociated Block object.

Definition at line 291 of file pspc/solvers/Propagator.h.

◆ allocate()

template<int D>
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.

Parameters
nsnumber of slices (including end points)
meshspatial discretization mesh

Definition at line 43 of file pspc/solvers/Propagator.tpp.

References Pscf::Mesh< D >::dimensions(), and UTIL_CHECK.

◆ reallocate()

template<int D>
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.

Parameters
nsnumber of slices (including end points)

Definition at line 60 of file pspc/solvers/Propagator.tpp.

References UTIL_CHECK.

◆ solve() [1/2]

template<int D>
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.

◆ solve() [2/2]

template<int D>
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>.

Parameters
headinitial 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.

◆ computeQ()

template<int D>
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.

Returns
value of Q (spatial average of q*q^{+} at head)

Definition at line 153 of file pspc/solvers/Propagator.tpp.

References Util::Array< Data >::capacity(), UTIL_CHECK, and UTIL_THROW.

◆ q()

template<int D>
Propagator< D >::QField const & Pscf::Pspc::Propagator< D >::q ( int  i) const
inline

Return q-field at specified step.

Parameters
istep 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().

◆ head()

template<int D>
Propagator< D >::QField const & Pscf::Pspc::Propagator< D >::head
inline

Return q-field at beginning of the block (initial condition).

Definition at line 246 of file pspc/solvers/Propagator.h.

◆ tail()

template<int D>
Propagator< D >::QField const & Pscf::Pspc::Propagator< D >::tail
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().

◆ block()

template<int D>
Block< D > & Pscf::Pspc::Propagator< D >::block
inline

Get the associated Block object by reference.

Definition at line 270 of file pspc/solvers/Propagator.h.

◆ ns()

template<int D>
int Pscf::Pspc::Propagator< D >::ns
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().

◆ isAllocated()

template<int D>
bool Pscf::Pspc::Propagator< D >::isAllocated
inline

Has memory been allocated for this propagator?

Definition at line 284 of file pspc/solvers/Propagator.h.

◆ computeHead()

template<int D>
void Pscf::Pspc::Propagator< D >::computeHead
protected

Compute initial QField at head from tail QFields of sources.

Definition at line 88 of file pspc/solvers/Propagator.tpp.

References UTIL_THROW.


The documentation for this class was generated from the following files: