Loading [MathJax]/extensions/TeX/AMSsymbols.js
PSCF v1.2
Pscf::Rpc::Block< D > Class Template Reference

Block within a branched polymer. More...

#include <Block.h>

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

Public Member Functions

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

Detailed Description

template<int D>
class Pscf::Rpc::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.

Manual Page

Definition at line 21 of file rpc/solvers/Propagator.h.

Constructor & Destructor Documentation

◆ Block()

template<int D>
Pscf::Rpc::Block< D >::Block ( )

Constructor.

Definition at line 33 of file rpc/solvers/Block.tpp.

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

◆ ~Block()

template<int D>
Pscf::Rpc::Block< D >::~Block ( )

Destructor.

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

Member Function Documentation

◆ associate()

template<int D>
void Pscf::Rpc::Block< D >::associate ( Mesh< D > const & mesh,
FFT< D > const & fft,
UnitCell< D > const & cell )

Initialize discretization and allocate required memory.

This function creates associations of this block with the mesh, fft, and unit cell objects.

Parameters
meshspatial discretization mesh
fftFast Fourier Transform object
cellunit cell object

Definition at line 59 of file rpc/solvers/Block.tpp.

References UTIL_CHECK.

◆ allocate()

template<int D>
void Pscf::Rpc::Block< D >::allocate ( double ds)

Allocate memory and set contour step size.

This function choses values for the number ns of contour variable grid points for this block and the associated step size length/(ns-1) for this block, and allocates memory for a variety of private arrays.

The 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 an odd integer and ns > 1. These requirements allow use of Simpson's rule for integration with respect to the contour variable s to compute monomer concentration fields and stress contributions.

Parameters
dsdesired (optimal) value for contour length step

Definition at line 78 of file rpc/solvers/Block.tpp.

References UTIL_CHECK.

◆ clearUnitCellData()

template<int D>
void Pscf::Rpc::Block< D >::clearUnitCellData ( )

Clear all internal data that depends on the unit cell parameters.

This function should be called once after every change in unit cell parameters. The function marks all variables that depend on the unit cell parameters as being outdated and invalid. Such variables are recomputed by lazy evaluation, just before they are needed.

Definition at line 179 of file rpc/solvers/Block.tpp.

◆ setLength()

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

Set or reset block length.

Parameters
newLengthnew block length

Reimplemented from Pscf::BlockDescriptor.

Definition at line 138 of file rpc/solvers/Block.tpp.

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

◆ setKuhn()

template<int D>
void Pscf::Rpc::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 169 of file rpc/solvers/Block.tpp.

Referenced by Pscf::Rpc::Mixture< D >::setKuhn().

◆ setupSolver()

template<int D>
void Pscf::Rpc::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 215 of file rpc/solvers/Block.tpp.

References UTIL_CHECK.

◆ step()

template<int D>
void Pscf::Rpc::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 413 of file rpc/solvers/Block.tpp.

References Util::Array< Data >::capacity(), Pscf::Prdc::Cpu::FftwDArray< Data >::isAllocated(), and UTIL_CHECK.

◆ computeConcentration()

template<int D>
void Pscf::Rpc::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.

In a closed ensemble, 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 246 of file rpc/solvers/Block.tpp.

References UTIL_CHECK.

◆ computeStress()

template<int D>
void Pscf::Rpc::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 member function computeConcentration.

Parameters
prefactorconstant multiplying integral over s

Definition at line 302 of file rpc/solvers/Block.tpp.

References Util::FSArray< T, N >::append(), and UTIL_CHECK.

◆ mesh()

template<int D>
Mesh< D > const & Pscf::Rpc::Block< D >::mesh ( ) const
inline

Get associated spatial Mesh by const reference.

Get Mesh by reference.

Definition at line 326 of file rpc/solvers/Block.h.

References UTIL_ASSERT.

◆ fft()

template<int D>
FFT< D > const & Pscf::Rpc::Block< D >::fft ( ) const
inline

Get associated FFT object by const reference.

Get FFT by reference.

Definition at line 334 of file rpc/solvers/Block.h.

References UTIL_ASSERT.

◆ ds()

template<int D>
double Pscf::Rpc::Block< D >::ds ( ) const
inline

Get contour length step size.

Get number of contour steps.

Definition at line 316 of file rpc/solvers/Block.h.

◆ ns()

template<int D>
int Pscf::Rpc::Block< D >::ns ( ) const
inline

Get the number of contour length steps in this block.

Get number of contour steps.

Definition at line 311 of file rpc/solvers/Block.h.

◆ stress()

template<int D>
double Pscf::Rpc::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 321 of file rpc/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 70 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 78 of file BlockDescriptor.cpp.

◆ setMonomerId()

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

Set the monomer type id.

Parameters
monomerIdinteger id of monomer type

Definition at line 85 of file BlockDescriptor.cpp.

◆ id()

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

Get the id of this block.

Definition at line 116 of file BlockDescriptor.h.

◆ monomerId()

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

Get the monomer type id.

Definition at line 121 of file BlockDescriptor.h.

Referenced by Pscf::Rpc::Mixture< D >::setKuhn().

◆ vertexIds()

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

Get the pair of associated vertex ids.

Definition at line 126 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 133 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 138 of file BlockDescriptor.h.


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