PSCF v1.2
|
Block within a branched polymer. More...
#include <Block.h>
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. | |
![]() | |
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. | |
![]() | |
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). | |
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 21 of file rpc/solvers/Propagator.h.
Pscf::Rpc::Block< D >::Block | ( | ) |
Constructor.
Definition at line 33 of file rpc/solvers/Block.tpp.
References Pscf::BlockTmpl< Propagator< D > >::propagator().
Pscf::Rpc::Block< D >::~Block | ( | ) |
Destructor.
Definition at line 52 of file rpc/solvers/Block.tpp.
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.
mesh | spatial discretization mesh |
fft | Fast Fourier Transform object |
cell | unit cell object |
Definition at line 59 of file rpc/solvers/Block.tpp.
References UTIL_CHECK.
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.
ds | desired (optimal) value for contour length step |
Definition at line 78 of file rpc/solvers/Block.tpp.
References UTIL_CHECK.
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.
|
virtual |
Set or reset block length.
newLength | new block length |
Reimplemented from Pscf::BlockDescriptor.
Definition at line 138 of file rpc/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 169 of file rpc/solvers/Block.tpp.
Referenced by Pscf::Rpc::Mixture< D >::setKuhn().
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.
w | chemical potential field for this monomer type |
Definition at line 215 of file rpc/solvers/Block.tpp.
References UTIL_CHECK.
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.
q | input slic of q, from step i |
qNew | ouput 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.
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().
prefactor | constant multiplying integral over s |
Definition at line 246 of file rpc/solvers/Block.tpp.
References UTIL_CHECK.
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.
prefactor | constant multiplying integral over s |
Definition at line 302 of file rpc/solvers/Block.tpp.
References Util::FSArray< T, N >::append(), and UTIL_CHECK.
|
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.
|
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.
|
inline |
Get contour length step size.
Get number of contour steps.
Definition at line 316 of file rpc/solvers/Block.h.
|
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.
|
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 321 of file rpc/solvers/Block.h.
void Pscf::BlockDescriptor::setId | ( | int | id | ) |
Set the id for this block.
id | integer index for this block |
Definition at line 70 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 78 of file BlockDescriptor.cpp.
void Pscf::BlockDescriptor::setMonomerId | ( | int | monomerId | ) |
Set the monomer type id.
monomerId | integer id of monomer type |
Definition at line 85 of file BlockDescriptor.cpp.
|
inline |
Get the id of this block.
Definition at line 116 of file BlockDescriptor.h.
|
inline |
Get the monomer type id.
Definition at line 121 of file BlockDescriptor.h.
Referenced by Pscf::Rpc::Mixture< D >::setKuhn().
|
inline |
Get the pair of associated vertex ids.
Definition at line 126 of file BlockDescriptor.h.
|
inline |
Get id of an associated vertex.
i | index of vertex (0 or 1) |
Definition at line 133 of file BlockDescriptor.h.
|
inline |
Get the length (number of monomers) in this block.
Definition at line 138 of file BlockDescriptor.h.