PSCF v1.1
|
Block within a branched polymer. More...
#include <Block.h>
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... | |
![]() | |
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... | |
![]() | |
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... | |
Block within a branched polymer.
Derived from BlockTmpl< Propagator<D> >. A BlockTmpl< Propagator<D> > has two Propagator<D> members and is derived from BlockDescriptor.
Definition at line 41 of file pspc/solvers/Block.h.
Pscf::Pspc::Block< D >::Block |
Constructor.
Definition at line 31 of file pspc/solvers/Block.tpp.
References Pscf::BlockTmpl< Propagator< D > >::propagator().
Pscf::Pspc::Block< D >::~Block |
Destructor.
Definition at line 48 of file pspc/solvers/Block.tpp.
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.
ds | desired (optimal) value for contour length step |
mesh | spatial discretization mesh |
Definition at line 52 of file pspc/solvers/Block.tpp.
References Pscf::Mesh< D >::dimensions(), Pscf::Mesh< D >::size(), and UTIL_CHECK.
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.
unitCell | crystallographic unit cell, defines cell dimensions |
Definition at line 158 of file pspc/solvers/Block.tpp.
|
virtual |
Set or reset block length.
newLength | new block length |
Reimplemented from Pscf::BlockDescriptor.
Definition at line 117 of file pspc/solvers/Block.tpp.
References Pscf::BlockDescriptor::setLength(), and UTIL_CHECK.
|
virtual |
Set or reset monomer statistical segment length.
kuhn | new monomer statistical segment length. |
Reimplemented from Pscf::BlockTmpl< Propagator< D > >.
Definition at line 148 of file pspc/solvers/Block.tpp.
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.
w | chemical potential field for this monomer type |
Definition at line 194 of file pspc/solvers/Block.tpp.
References UTIL_CHECK.
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.
q | input slic of q, from step i |
qNew | ouput 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.
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().
prefactor | constant multiplying integral over s |
Definition at line 225 of file pspc/solvers/Block.tpp.
References UTIL_CHECK.
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.
prefactor | constant multiplying integral over s |
Definition at line 281 of file pspc/solvers/Block.tpp.
References Util::FSArray< Data, Capacity >::append(), and UTIL_CHECK.
|
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.
|
inline |
Get contour length step size.
Get number of contour steps.
Definition at line 287 of file pspc/solvers/Block.h.
|
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.
|
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.
n | index of unit cell parameter |
Definition at line 292 of file pspc/solvers/Block.h.
void Pscf::BlockDescriptor::setId | ( | int | id | ) |
Set the id for this block.
id | integer index for this block |
Definition at line 65 of file BlockDescriptor.cpp.
void Pscf::BlockDescriptor::setVertexIds | ( | int | vertexAId, |
int | vertexBId | ||
) |
Set indices of associated vertices.
vertexAId | integer id of vertex A |
vertexBId | integer id of vertex B |
Definition at line 73 of file BlockDescriptor.cpp.
void Pscf::BlockDescriptor::setMonomerId | ( | int | monomerId | ) |
Set the monomer id.
monomerId | integer id of monomer type (>=0) |
Definition at line 80 of file BlockDescriptor.cpp.
|
virtual |
Set the length of this block.
The ``length" is steric volume / reference volume.
length | block length (number of monomers). |
Reimplemented from Pscf::BlockDescriptor.
Definition at line 89 of file BlockDescriptor.cpp.
|
inline |
Get the id of this block.
Definition at line 115 of file BlockDescriptor.h.
|
inline |
Get the monomer type id.
Definition at line 120 of file BlockDescriptor.h.
|
inline |
Get the pair of associated vertex ids.
Definition at line 125 of file BlockDescriptor.h.
|
inline |
Get id of an associated vertex.
i | index of vertex (0 or 1) |
Definition at line 132 of file BlockDescriptor.h.
|
inline |
Get the length (number of monomers) in this block.
Definition at line 137 of file BlockDescriptor.h.