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

Block within a branched polymer. More...

#include <Block.h>

Inheritance diagram for Pscf::Pspc::Block< D >:
Pscf::BlockTmpl< Propagator< D > > Pscf::BlockDescriptor

Public Member Functions

 Block ()
 Constructor. More...
 
 ~Block ()
 Destructor. More...
 
void setDiscretization (double ds, const Mesh< D > &mesh)
 Initialize discretization and allocate required memory. More...
 
void setupUnitCell (const UnitCell< D > &unitCell)
 Setup parameters that depend on the unit cell. More...
 
void setLength (double newLength)
 Set or reset block length. More...
 
void setKuhn (double kuhn)
 Set or reset monomer statistical segment length. More...
 
void setupSolver (RField< D > const &w)
 Set solver for this block. More...
 
void step (RField< D > const &q, RField< D > &qNew)
 Compute one step of solution of MDE, from step i to i+1. More...
 
void computeConcentration (double prefactor)
 Compute concentration (volume fraction) for block by integration. More...
 
void computeStress (double prefactor)
 Compute stress contribution for this block. More...
 
Mesh< D > const & mesh () const
 Get associated spatial Mesh by const reference. More...
 
double ds () const
 Get contour length step size. More...
 
int ns () const
 Get the number of contour length steps in this block. More...
 
double stress (int n) const
 Get derivative of free energy w/ respect to unit cell parameter n. More...
 
void setId (int id)
 Set the id for this block. More...
 
void setVertexIds (int vertexAId, int vertexBId)
 Set indices of associated vertices. More...
 
void setMonomerId (int monomerId)
 Set the monomer id. More...
 
virtual void setLength (double length)
 Set the length of this block. More...
 
int id () const
 Get the id of this block. More...
 
int monomerId () const
 Get the monomer type id. More...
 
const Pair< int > & vertexIds () const
 Get the pair of associated vertex ids. More...
 
int vertexId (int i) const
 Get id of an associated vertex. More...
 
double length () const
 Get the length (number of monomers) in this block. More...
 
- Public Member Functions inherited from Pscf::BlockTmpl< Propagator< D > >
 BlockTmpl ()
 Constructor. More...
 
virtual ~BlockTmpl ()
 Destructor. More...
 
virtual void setKuhn (double kuhn)
 Set monomer statistical segment length. More...
 
Propagator< D > & propagator (int directionId)
 Get a Propagator for a specified direction. More...
 
Propagator< D > const & propagator (int directionId) const
 Get a const Propagator for a specified direction. More...
 
TP::CField & cField ()
 Get the associated monomer concentration field. More...
 
TP::CField const & cField () const
 Get the associated const monomer concentration field. More...
 
double kuhn () const
 Get monomer statistical segment length. More...
 
- Public Member Functions inherited from Pscf::BlockDescriptor
 BlockDescriptor ()
 Constructor. More...
 
virtual ~BlockDescriptor ()
 Destructor. More...
 
template<class Archive >
void serialize (Archive &ar, unsigned int versionId)
 Serialize to/from archive. More...
 
void setId (int id)
 Set the id for this block. More...
 
void setVertexIds (int vertexAId, int vertexBId)
 Set indices of associated vertices. More...
 
void setMonomerId (int monomerId)
 Set the monomer id. More...
 
void setPolymerType (PolymerType::Enum type)
 Set the polymer type. More...
 
int id () const
 Get the id of this block. More...
 
int monomerId () const
 Get the monomer type id. More...
 
const Pair< int > & vertexIds () const
 Get the pair of associated vertex ids. More...
 
int vertexId (int i) const
 Get id of an associated vertex. More...
 
double length () const
 Get the length (number of monomers) in this block. More...
 
PolymerType::Enum polymerType () const
 Get the type of the parent polymer (branched or linear). More...
 

Detailed Description

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

Block within a branched polymer.

Derived from BlockTmpl< Propagator<D> >. A BlockTmpl< Propagator<D> > has two Propagator<D> members and is derived from BlockDescriptor.

Parameter File Format

Definition at line 41 of file pspc/solvers/Block.h.

Constructor & Destructor Documentation

◆ Block()

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

Constructor.

Definition at line 31 of file pspc/solvers/Block.tpp.

References Pscf::BlockTmpl< Propagator< D > >::propagator().

◆ ~Block()

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

Destructor.

Definition at line 48 of file pspc/solvers/Block.tpp.

Member Function Documentation

◆ setDiscretization()

template<int D>
void Pscf::Pspc::Block< D >::setDiscretization ( double  ds,
const Mesh< D > &  mesh 
)

Initialize discretization and allocate required memory.

This function chooses a value for the number ns of contour variable grid points for this block so as to yield a value for the the actual step size length/(ns-1) as close as possible to the input parameter ds (the desired step size) consistent with the requirements that ns be odd and ns > 1. These requirements allow use of Simpson's rule for integration with respect to the contour variable s.

Parameters
dsdesired (optimal) value for contour length step
meshspatial discretization mesh

Definition at line 52 of file pspc/solvers/Block.tpp.

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

◆ setupUnitCell()

template<int D>
void Pscf::Pspc::Block< D >::setupUnitCell ( const UnitCell< D > &  unitCell)

Setup parameters that depend on the unit cell.

This should be called once after every change in unit cell parameters. Doing so marks internal variables that depends on the unit cell parameters as being "dirty" or outdated. These internal variables are actually recomputed later, in the setupSolver function, which is called within Polymer<D>::compute function before solving the modified diffusion equation (MDE) for all propagators associated with the polymer, using a pointer to the unit cell that is set in this function.

Parameters
unitCellcrystallographic unit cell, defines cell dimensions

Definition at line 158 of file pspc/solvers/Block.tpp.

◆ setLength() [1/2]

template<int D>
void Pscf::Pspc::Block< D >::setLength ( double  newLength)
virtual

Set or reset block length.

Parameters
newLengthnew block length

Reimplemented from Pscf::BlockDescriptor.

Definition at line 117 of file pspc/solvers/Block.tpp.

References Pscf::BlockDescriptor::setLength(), and UTIL_CHECK.

◆ setKuhn()

template<int D>
void Pscf::Pspc::Block< D >::setKuhn ( double  kuhn)
virtual

Set or reset monomer statistical segment length.

Parameters
kuhnnew monomer statistical segment length.

Reimplemented from Pscf::BlockTmpl< Propagator< D > >.

Definition at line 148 of file pspc/solvers/Block.tpp.

◆ setupSolver()

template<int D>
void Pscf::Pspc::Block< D >::setupSolver ( RField< D > const &  w)

Set solver for this block.

This should be called once after every change in w fields, the unit cell parameters, block length or kuhn length, before entering the loop used to solve the MDE for either propagator. This function is called by Polymer<D>::compute.

Parameters
wchemical potential field for this monomer type

Definition at line 194 of file pspc/solvers/Block.tpp.

References UTIL_CHECK.

◆ step()

template<int D>
void Pscf::Pspc::Block< D >::step ( RField< D > const &  q,
RField< D > &  qNew 
)

Compute one step of solution of MDE, from step i to i+1.

This function is called internally by the PropagatorTmpl solve function within a loop over steps. It is implemented in the Block class because the same private data structures are needed for the two propagators associated with a Block.

Parameters
qinput slic of q, from step i
qNewouput slice of q, from step i+1

Definition at line 394 of file pspc/solvers/Block.tpp.

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

◆ computeConcentration()

template<int D>
void Pscf::Pspc::Block< D >::computeConcentration ( double  prefactor)

Compute concentration (volume fraction) for block by integration.

This should be called after both associated propagators are known. Upon return, grid point r of array cField() contains the integal, int ds q(r,s)q^{*}(r,L-s) times the prefactor parameter, where q(r,s) is the solution obtained from propagator(0), q^{*}(r,s) is the solution of propagator(1), and s is a contour variable that is integrated over the domain 0 < s < length(), where length() is the block length. The "prefactor" parameter for a system with a constant total density should be set to prefactor = phi/(L q), where phi is the overall volume fraction for this molecular species, L is the total number of monomers in the polymer species, and q is the species partition function, i.e., the spatial average of q(r,L). This function is called by Polymer<D>::compute().

Parameters
prefactorconstant multiplying integral over s

Definition at line 225 of file pspc/solvers/Block.tpp.

References UTIL_CHECK.

◆ computeStress()

template<int D>
void Pscf::Pspc::Block< D >::computeStress ( double  prefactor)

Compute stress contribution for this block.

This function is called by Polymer<D>::computeStress. The parameter prefactor should be the same as that passed to the function computeConcentration.

Parameters
prefactorconstant multiplying integral over s

Definition at line 281 of file pspc/solvers/Block.tpp.

References Util::FSArray< Data, Capacity >::append(), and UTIL_CHECK.

◆ mesh()

template<int D>
Mesh< D > const & Pscf::Pspc::Block< D >::mesh
inline

Get associated spatial Mesh by const reference.

Get Mesh by reference.

Definition at line 297 of file pspc/solvers/Block.h.

References UTIL_ASSERT.

◆ ds()

template<int D>
double Pscf::Pspc::Block< D >::ds
inline

Get contour length step size.

Get number of contour steps.

Definition at line 287 of file pspc/solvers/Block.h.

◆ ns()

template<int D>
int Pscf::Pspc::Block< D >::ns
inline

Get the number of contour length steps in this block.

Get number of contour steps.

Definition at line 282 of file pspc/solvers/Block.h.

◆ stress()

template<int D>
double Pscf::Pspc::Block< D >::stress ( int  n) const
inline

Get derivative of free energy w/ respect to unit cell parameter n.

Stress with respect to unit cell parameter n.

This function returns a value computed by a previous call to the computeStress function.

Parameters
nindex of unit cell parameter

Definition at line 292 of file pspc/solvers/Block.h.

◆ setId()

template<int D>
void Pscf::BlockDescriptor::setId ( int  id)

Set the id for this block.

Parameters
idinteger index for this block

Definition at line 65 of file BlockDescriptor.cpp.

◆ setVertexIds()

template<int D>
void Pscf::BlockDescriptor::setVertexIds ( int  vertexAId,
int  vertexBId 
)

Set indices of associated vertices.

Parameters
vertexAIdinteger id of vertex A
vertexBIdinteger id of vertex B

Definition at line 73 of file BlockDescriptor.cpp.

◆ setMonomerId()

template<int D>
void Pscf::BlockDescriptor::setMonomerId ( int  monomerId)

Set the monomer id.

Parameters
monomerIdinteger id of monomer type (>=0)

Definition at line 80 of file BlockDescriptor.cpp.

◆ setLength() [2/2]

template<int D>
void Pscf::BlockDescriptor::setLength ( double  length)
virtual

Set the length of this block.

The ``length" is steric volume / reference volume.

Parameters
lengthblock length (number of monomers).

Reimplemented from Pscf::BlockDescriptor.

Definition at line 89 of file BlockDescriptor.cpp.

◆ id()

template<int D>
int Pscf::BlockDescriptor::id ( ) const
inline

Get the id of this block.

Definition at line 115 of file BlockDescriptor.h.

◆ monomerId()

template<int D>
int Pscf::BlockDescriptor::monomerId ( ) const
inline

Get the monomer type id.

Definition at line 120 of file BlockDescriptor.h.

◆ vertexIds()

template<int D>
const Pair< int > & Pscf::BlockDescriptor::vertexIds ( ) const
inline

Get the pair of associated vertex ids.

Definition at line 125 of file BlockDescriptor.h.

◆ vertexId()

template<int D>
int Pscf::BlockDescriptor::vertexId ( int  i) const
inline

Get id of an associated vertex.

Parameters
iindex of vertex (0 or 1)

Definition at line 132 of file BlockDescriptor.h.

◆ length()

template<int D>
double Pscf::BlockDescriptor::length ( ) const
inline

Get the length (number of monomers) in this block.

Definition at line 137 of file BlockDescriptor.h.


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