|
PSCF v1.5.0
|
Block within a linear or branched block polymer. More...
#include <Block_c.h>
Public Types | |
| using | BlockTmplT = BlockTmpl< Rp::Propagator<D,CPT>, RField<D,CPT> > |
| Direct (parent) base class. | |
| Public Types inherited from Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > > | |
| using | PropagatorT |
| Modified diffusion equation solver (propagator) type. | |
| using | FieldT |
| Field type. | |
Public Member Functions | |
| Block () | |
| Constructor. | |
| ~Block () | |
| Destructor. | |
Initialization and State Mutators | |
| void | associate (Mesh< D > const &mesh, FFT< D, CPT > const &fft, UnitCell< D > const &cell, WaveList< D, CPT > &waveList) |
| Create permanent associations with related objects. | |
| void | allocate (double ds, bool useBatchedFFT=false) |
| 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 (only used in thread model). | |
| void | setNBead (int nBead) |
| Set or reset the number of beads (only used in bead model). | |
| void | setKuhn (double kuhn) |
| Set or reset monomer statistical segment length. | |
| void | setupSolver (RField< D, CPT > const &w) |
| Set up the MDE solver for this block. | |
MDE Step Functions | |
| void | stepThread (RField< D, CPT > const &qin, RField< D, CPT > &qout) const |
| Compute one step of solution of MDE for the thread model. | |
| void | stepBead (RField< D, CPT > const &qin, RField< D, CPT > &qout) const |
| Compute one step of solution of MDE for the bead model. | |
| void | stepFieldBead (RField< D, CPT > &q) const |
| Apply the exponential field operator for the bead model. | |
| void | stepBondBead (RField< D, CPT > const &qin, RField< D, CPT > &qout) const |
| Apply a bond operator for the bead model. | |
| void | stepHalfBondBead (RField< D, CPT > const &qin, RField< D, CPT > &qout) const |
| Apply a half-bond operator for the bead model. | |
Monomer Concentration Computation | |
| void | computeConcentrationThread (double prefactor) |
| Compute the concentration for this block, for the thread model. | |
| void | computeConcentrationBead (double prefactor) |
| Compute the concentration for this block, using the bead model. | |
Stress Computation | |
| void | computeStressThread (double prefactor) |
| Compute stress contribution for this block, using thread model. | |
| void | computeStressBead (double prefactor) |
| Compute stress contribution for this block, using bead model. | |
| double | stress (int n) const |
| Get derivative of free energy w/ respect to a unit cell parameter. | |
| Public Member Functions inherited from Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > > | |
| Rp::Propagator< D, CPT > & | propagator (int directionId) |
| Get a Propagator for a specified direction (non-const reference). | |
| Rp::Propagator< D, CPT > const & | propagator (int directionId) const |
| Get a Propagator for a specified direction (const reference). | |
| RField< D, CPT > const & | cField () const |
| Get the associated monomer concentration field (const reference). | |
| double | kuhn () const |
| Get monomer statistical segment length. | |
| Public Member Functions inherited from Pscf::Edge | |
| Edge () | |
| Constructor. | |
| virtual | ~Edge ()=default |
| 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 | setMonomerId (int monomerId) |
| Set the monomer type id. | |
| void | setVertexIds (int vertexId0, int vertexId1) |
| Set indices of associated vertices. | |
| void | setPolymerType (PolymerType::Enum type) |
| Set the type of the parent polymer (branched or linear). | |
| int | id () const |
| Get the id of this block (unique within the polymer). | |
| int | monomerId () const |
| Get the monomer type id for this block. | |
| const Pair< int > & | vertexIds () const |
| Get the pair of associated vertex ids. | |
| int | vertexId (int i) const |
| Get the id of one associated vertex. | |
| double | length () const |
| Get the length of this block, in the thread model. | |
| int | nBead () const |
| Get the number of beads in this block, in the bead model. | |
| PolymerType::Enum | polymerType () const |
| Get the type of the parent polymer (branched or linear). | |
Accessors | |
| double | ds () const |
| Get contour length step size. | |
| int | ns () const |
| Get the number of contour grid points, including end points. | |
| Rp::Propagator< D, CPT > & | propagator (int directionId) |
| Get a Propagator for a specified direction (non-const reference). | |
| Rp::Propagator< D, CPT > const & | propagator (int directionId) const |
| Get a Propagator for a specified direction (const reference). | |
| RField< D, CPT > const & | cField () const |
| Get the associated monomer concentration field (const reference). | |
| RField< D, CPT > & | cField () |
| Get associated monomer concentration field (non-const reference). | |
Additional Inherited Members | |
| Protected Member Functions inherited from Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > > | |
| BlockTmpl () | |
| Constructor. | |
| ~BlockTmpl ()=default | |
| Destructor. | |
| RField< D, CPT > & | cField () |
| Get associated monomer concentration field (non-const reference). | |
Block within a linear or branched block polymer.
A Block has two Propagator<D, Types<D> > members, and an RField<D,CPT> concentration field.
| using Pscf::Rp::Block< D, CPT >::BlockTmplT = BlockTmpl< Rp::Propagator<D,CPT>, RField<D,CPT> > |
| Pscf::Rp::Block< D, CPT >::Block | ( | ) |
Constructor.
Definition at line 35 of file rp/solvers/Block.cpp.
References Block(), and propagator().
Referenced by allocate(), associate(), Block(), clearUnitCellData(), computeConcentrationBead(), computeConcentrationThread(), computeStressBead(), computeStressThread(), ds(), ns(), setKuhn(), setLength(), setNBead(), setupSolver(), stepBead(), stepBondBead(), stepFieldBead(), stepHalfBondBead(), stepThread(), stress(), and ~Block().
| Pscf::Rp::Block< D, CPT >::~Block | ( | ) |
| void Pscf::Rp::Block< D, CPT >::associate | ( | Mesh< D > const & | mesh, |
| FFT< D, CPT > const & | fft, | ||
| UnitCell< D > const & | cell, | ||
| WaveList< D, CPT > & | waveList ) |
Create permanent associations with related objects.
This function creates associations of this block with the Mesh, FFT, UnitCell and WaveList objects by storing their addresses. It must be called before the allocate function.
| mesh | Mesh<D> object, spatial discretization meth |
| fft | FFT<D,CPT> object, Fast Fourier Transform |
| cell | UnitCell<D> object, crystallographic unit cell |
| waveList | WaveList<D,CPT>, container for wavevector properties |
Definition at line 64 of file rp/solvers/Block.cpp.
References Block(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CPT >::allocate | ( | double | ds, |
| bool | useBatchedFFT = false ) |
Allocate memory and set contour step size.
This function choses a value for the number ns of contour variable grid points for this block, sets the step size, and allocates memory for several private arrays. Spatial grid dimensions are obtained from a pointers to the associated mesh. The associate function must be called before this function.
For the thread model, if PolymerModel::isThread() is true, the value for the number ns of contour variable grid points for this block is chosen to yield a value for the the actual step size length/(ns-1) as close as possible to the input parameter ds (the target 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.
For the bead model, if PolymerModel::isThread() is true, the value of ns is given by nBead + 2.
The value of input parameter ds is ignored for the bead model.
The value of input parameter useBatchedFFT is is ignored for the C++ backend (T=Pscf::CPT).
| ds | desired (optimal) value for contour length step |
| useBatchedFFT | unused flag (used for other backend) |
Definition at line 87 of file rp/solvers/Block.cpp.
References Block(), cField(), ds(), Pscf::PolymerModel::isBead(), Pscf::PolymerModel::isThread(), Pscf::Edge::length(), Pscf::Edge::nBead(), propagator(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CPT >::clearUnitCellData | ( | ) |
Clear all internal data that depends on the unit cell parameters.
This function must be called once after every time the unit cell parameters change. The function marks all class member variables that depend on the unit cell parameters as being outdated. All such variables are then recomputed just before they are needed.
Definition at line 209 of file rp/solvers/Block.cpp.
References Block().
|
virtual |
Set or reset block length (only used in thread model).
Precondition: PolymerModel::isThread(). An Exception is thrown if this function is called when PolymerModel::isThread() is false.
| newLength | new block length |
Reimplemented from Pscf::Edge.
Definition at line 150 of file rp/solvers/Block.cpp.
References Block(), Pscf::PolymerModel::isThread(), Pscf::Edge::length(), propagator(), Pscf::Edge::setLength(), and UTIL_CHECK.
|
virtual |
Set or reset the number of beads (only used in bead model).
Precondition: PolymerModel::isBead(). If memory is allocated, the propagators are reallocated for the new number of beads.
| nBead | new number of beads in this block |
Reimplemented from Pscf::Edge.
Definition at line 183 of file rp/solvers/Block.cpp.
References Block(), Pscf::Edge::nBead(), propagator(), and Pscf::Edge::setNBead().
|
virtual |
Set or reset monomer statistical segment length.
| kuhn | new monomer statistical segment length. |
Reimplemented from Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > >.
Definition at line 199 of file rp/solvers/Block.cpp.
References Block(), Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > >::kuhn(), and Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > >::setKuhn().
| void Pscf::Rp::Block< D, CPT >::setupSolver | ( | RField< D, CPT > const & | w | ) |
Set up the MDE solver for this block.
This should be called once after every change in w fields, 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 256 of file rp/solvers/Block.cpp.
References Block(), Pscf::PolymerModel::isBead(), Pscf::PolymerModel::isThread(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CPT >::stepThread | ( | RField< D, CPT > const & | qin, |
| RField< D, CPT > & | qout ) const |
Compute one step of solution of MDE for the thread model.
This function is called internally by the Propagator::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.
| qin | input slice of q, from step i |
| qout | output slice of q, from step i+1 |
Definition at line 292 of file rp/solvers/Block.cpp.
References Block(), Pscf::PolymerModel::isThread(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CPT >::stepBead | ( | RField< D, CPT > const & | qin, |
| RField< D, CPT > & | qout ) const |
Compute one step of solution of MDE for the bead model.
This function is called internally by the Propagator::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.
| qin | input slice of q, from step i |
| qout | output slice of q, for step i+1 |
Definition at line 368 of file rp/solvers/Block.cpp.
References Block(), Pscf::PolymerModel::isBead(), stepBondBead(), stepFieldBead(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CPT >::stepFieldBead | ( | RField< D, CPT > & | q | ) | const |
Apply the exponential field operator for the bead model.
This function applies exp( -w(r) ), where w(r) is the w-field for the monomer type of this block.
| q | slice of propagator q, modified in place |
Definition at line 431 of file rp/solvers/Block.cpp.
References Block(), and UTIL_CHECK.
Referenced by stepBead().
| void Pscf::Rp::Block< D, CPT >::stepBondBead | ( | RField< D, CPT > const & | qin, |
| RField< D, CPT > & | qout ) const |
Apply a bond operator for the bead model.
This function applies exp( nabla^2 b^2 / 6 ), where nabla^2 denotes a Laplacian operator with eigenvalues given by -G^2 for reciprocal lattice vectors.
| qin | input slice of q, from step i |
| qout | ouptut slice of q, for step i+1 |
Definition at line 379 of file rp/solvers/Block.cpp.
References Block(), and UTIL_CHECK.
Referenced by stepBead().
| void Pscf::Rp::Block< D, CPT >::stepHalfBondBead | ( | RField< D, CPT > const & | qin, |
| RField< D, CPT > & | qout ) const |
Apply a half-bond operator for the bead model.
This function applies exp( nabla^2 b^2 / 12 ), where nabla^2 denotes a Laplacian operator with eigenvalues given by -G^2 for reciprocal lattice vectors. It is used in the Propagator::solve function to deal with half-bonds at block ends.
| qin | input slice of q, from step i |
| qout | ouptut slice of q, for step i+1 |
Definition at line 405 of file rp/solvers/Block.cpp.
References Block(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CPT >::computeConcentrationThread | ( | double | prefactor | ) |
Compute the concentration for this block, for the thread model.
This function is called by Polymer::compute if a thread model is is used.
The "prefactor" parameter must equal \( \phi / (L_{tot} Q) \), where \( \phi \) is the species volume fraction, \( L_{tot} \) is the total length of all blocks in this polymer species and Q is the species partition function.
Upon return, grid point r of the array returned by the member function cField() contains the integal
\[ p \int_{0}^{l} ds q_{0}(r,s) q_{1}(r, L - s) \]
where \( q_{0}(r,s) \) and \( q_{1}(r,s) \) are propagators associated with different directions, \( p \) is the prefactor parameter, and the integral is taken over the length \( L \) of this block. Simpson's rule is used for the integral with respect to s.
| prefactor | constant multiplying integral over s |
Definition at line 449 of file rp/solvers/Block.cpp.
References Block(), cField(), propagator(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CPT >::computeConcentrationBead | ( | double | prefactor | ) |
Compute the concentration for this block, using the bead model.
This function is called by Polymer::compute if a bead model is is used.
The "prefactor" parameter must equal \( \phi /(N_{tot} Q) \), where \( \phi \) is the species volume fraction, \( N_{tot} \) is the total number of beads in all blocks of the polymer, and \( Q \) is the species partition function.
Upon return, grid point r of the array returned by member function cField() contains the sum
\[ p \sum_{s} q_{0}(r,s) q_{1}(r, N-s) \exp(W(r)*ds) \]
where \( q_{0}(r,s) \) and \( q_{1}(r, N-s) \) denote complementary propagator slices associated with different directions but the same bead, and \( p \) is the prefactor parameter. The sum is taken over all beads in this block.
| prefactor | constant multiplying sum over beads |
Definition at line 511 of file rp/solvers/Block.cpp.
References Block(), cField(), propagator(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CPT >::computeStressThread | ( | double | prefactor | ) |
Compute stress contribution for this block, using thread model.
This function is called by Polymer<D>::computeStress. The prefactor parameter must be equal to that passed to function computeConcentrationThread(double ).
| prefactor | constant multiplying integral over s |
Definition at line 552 of file rp/solvers/Block.cpp.
References Util::FSArray< Data, Capacity >::append(), Block(), Pscf::PolymerModel::isThread(), Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > >::kuhn(), propagator(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CPT >::computeStressBead | ( | double | prefactor | ) |
Compute stress contribution for this block, using bead model.
This function is called by Polymer<D>::computeStress. The prefactor parameter must be equal to that passed to function computeConcentrationBead(double ).
| prefactor | constant multiplying sum over beads |
Definition at line 635 of file rp/solvers/Block.cpp.
References Util::FSArray< Data, Capacity >::append(), Block(), Pscf::PolymerModel::isBead(), Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > >::kuhn(), propagator(), and UTIL_CHECK.
|
inline |
|
inline |
Get contour length step size.
Definition at line 459 of file Block_c.h.
References Block().
Referenced by allocate().
|
inline |
Get the number of contour grid points, including end points.
Thread mdoel: For the thread model, ns is always an odd number ns >= 3 chosen to give an even number ns - 1 of steps of with a step length ds = length/(ns - 1) as close as possible to the target value of ds passed to the allocate function.
Bead model: For the bead model, ns is equal to nBead + 2, so as to include slices for all beads and two attached phantom vertices. Beads are indexed 1, ..., ns - 2, vertices have indices 0 and ns - 1.
Definition at line 454 of file Block_c.h.
References Block().
| Rp::Propagator< D, CPT > & Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > >::propagator | ( | int | directionId | ) |
Get a Propagator for a specified direction (non-const reference).
For a block with v0 = vertexId(0) and v1 = vertexId(1), propagator(0) propagates from vertex v0 to v1, while propagator(1) propagates from vertex v1 to v0.
| directionId | integer index for direction (0 or 1) |
Referenced by allocate(), Block(), computeConcentrationBead(), computeConcentrationThread(), computeStressBead(), computeStressThread(), setLength(), and setNBead().
| Rp::Propagator< D, CPT > const & Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > >::propagator | ( | int | directionId | ) | const |
Get a Propagator for a specified direction (const reference).
For a block with v0 = vertexId(0) and v1 = vertexId(1), propagator(0) propagates from vertex v0 to v1, while propagator(1) propagates from vertex v1 to v0.
| directionId | integer index for direction (0 or 1) |
| RField< D, CPT > const & Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > >::cField | ( | ) | const |
Get the associated monomer concentration field (const reference).
Referenced by allocate(), computeConcentrationBead(), and computeConcentrationThread().
| RField< D, CPT > & Pscf::BlockTmpl< Rp::Propagator< D, CPT >, RField< D, CPT > >::cField | ( | ) |
Get associated monomer concentration field (non-const reference).