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

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

#include <Propagator.h>

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

Public Types

typedef RDField< D > Field
 Generic field (function of position). More...
 
typedef RDField< D > WField
 Chemical potential field type. More...
 
typedef RDField< D > CField
 Monomer concentration field type. More...
 
typedef RDField< D > QField
 Propagator q-field type. More...
 

Public Member Functions

 Propagator ()
 Constructor. More...
 
 ~Propagator ()
 Destructor. More...
 
void setBlock (Block< D > &block)
 Associate this propagator with a block. More...
 
void allocate (int ns, const Mesh< D > &mesh)
 Associate this propagator with a block. More...
 
void solve ()
 Solve the modified diffusion equation (MDE) for this block. More...
 
void solve (const cudaReal *head)
 Solve the MDE for a specified initial condition. More...
 
double computeQ ()
 Compute and return partition function for the molecule. More...
 
const cudaReal * q (int i) const
 Return q-field at specified step. More...
 
cudaReal * head () const
 Return q-field at beginning of block (initial condition). More...
 
const cudaReal * tail () const
 Return q-field at end of block. More...
 
Block< D > & block ()
 Get the associated Block object by reference. More...
 
Block< D > const & block () const
 Get the associated Block object by const reference. More...
 
int ns () const
 Get the number of contour grid points. 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::Pspg::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 46 of file pspg/solvers/Propagator.h.

Member Typedef Documentation

◆ Field

template<int D>
typedef RDField<D> Pscf::Pspg::Propagator< D >::Field

Generic field (function of position).

Definition at line 56 of file pspg/solvers/Propagator.h.

◆ WField

template<int D>
typedef RDField<D> Pscf::Pspg::Propagator< D >::WField

Chemical potential field type.

Definition at line 61 of file pspg/solvers/Propagator.h.

◆ CField

template<int D>
typedef RDField<D> Pscf::Pspg::Propagator< D >::CField

Monomer concentration field type.

Definition at line 66 of file pspg/solvers/Propagator.h.

◆ QField

template<int D>
typedef RDField<D> Pscf::Pspg::Propagator< D >::QField

Propagator q-field type.

Definition at line 71 of file pspg/solvers/Propagator.h.

Constructor & Destructor Documentation

◆ Propagator()

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

Constructor.

Definition at line 31 of file pspg/solvers/Propagator.tpp.

◆ ~Propagator()

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

Destructor.

Definition at line 44 of file pspg/solvers/Propagator.tpp.

Member Function Documentation

◆ setBlock()

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

Associate this propagator with a block.

Parameters
blockassociated Block object.

Definition at line 275 of file pspg/solvers/Propagator.h.

◆ allocate()

template<int D>
void Pscf::Pspg::Propagator< D >::allocate ( int  ns,
const Mesh< D > &  mesh 
)

Associate this propagator with a block.

Parameters
nsnumber of contour length steps
meshspatial discretization mesh

Definition at line 53 of file pspg/solvers/Propagator.tpp.

References Pscf::Pspg::ThreadGrid::nBlocks(), Pscf::Pspg::ThreadGrid::setThreadsLogical(), and Pscf::Mesh< D >::size().

◆ solve() [1/2]

template<int D>
void Pscf::Pspg::Propagator< D >::solve

Solve the modified diffusion equation (MDE) for this block.

This function computes an initial QField at the head of this propagator, and then solves the modified diffusion equation for the block to propagate from the head to the tail. The initial QField at the head is computed by pointwise multiplication of of the tail QFields of all source propagators.

Definition at line 109 of file pspg/solvers/Propagator.tpp.

References UTIL_CHECK.

◆ solve() [2/2]

template<int D>
void Pscf::Pspg::Propagator< D >::solve ( const cudaReal *  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 head parameter of the function. The function is intended for use in testing.

Parameters
headinitial condition of QField at head of block

Definition at line 132 of file pspg/solvers/Propagator.tpp.

References Pscf::Pspg::ThreadGrid::setThreadsLogical().

◆ computeQ()

template<int D>
double Pscf::Pspg::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 product of the initial / head Qfield for this propagator and the final / tail Qfield of its partner.

Definition at line 158 of file pspg/solvers/Propagator.tpp.

References UTIL_THROW.

◆ q()

template<int D>
const cudaReal * Pscf::Pspg::Propagator< D >::q ( int  i) const
inline

Return q-field at specified step.

Parameters
istep index

Definition at line 232 of file pspg/solvers/Propagator.h.

Referenced by Pscf::Pspg::Block< D >::computeConcentration(), Pscf::Pspg::System< D >::writeQ(), and Pscf::Pspg::System< D >::writeQSlice().

◆ head()

template<int D>
cudaReal * Pscf::Pspg::Propagator< D >::head
inline

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

Definition at line 216 of file pspg/solvers/Propagator.h.

Referenced by Pscf::Pspg::Block< D >::computeStress().

◆ tail()

template<int D>
const cudaReal * Pscf::Pspg::Propagator< D >::tail
inline

Return q-field at end of block.

Definition at line 224 of file pspg/solvers/Propagator.h.

Referenced by Pscf::Pspg::System< D >::writeQTail().

◆ block() [1/2]

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

Get the associated Block object by reference.

Definition at line 240 of file pspg/solvers/Propagator.h.

◆ block() [2/2]

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

Get the associated Block object by const reference.

Definition at line 251 of file pspg/solvers/Propagator.h.

◆ ns()

template<int D>
int Pscf::Pspg::Propagator< D >::ns
inline

Get the number of contour grid points.

Definition at line 262 of file pspg/solvers/Propagator.h.

Referenced by Pscf::Pspg::System< D >::writeQ().

◆ isAllocated()

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

Has memory been allocated for this propagator?

Definition at line 267 of file pspg/solvers/Propagator.h.

◆ computeHead()

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

Compute initial QField at head from tail QFields of sources.

Definition at line 71 of file pspg/solvers/Propagator.tpp.

References Pscf::Pspg::ThreadGrid::setThreadsLogical(), and UTIL_THROW.


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