PSCF v1.1
pspc/solvers/Polymer.h
1#ifndef PSPC_POLYMER_H
2#define PSPC_POLYMER_H
3
4/*
5* PSCF - Polymer Self-Consistent Field Theory
6*
7* Copyright 2016 - 2022, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include "Block.h"
12#include <pscf/solvers/PolymerTmpl.h>
13#include <pspc/field/RField.h>
14#include <util/containers/FArray.h> // member template
15
16namespace Pscf {
17namespace Pspc {
18
39 template <int D>
40 class Polymer : public PolymerTmpl< Block<D> >
41 {
42
43 public:
44
49
53 Polymer();
54
58 ~Polymer();
59
72 void setPhi(double phi);
73
86 void setMu(double mu);
87
97 void setupUnitCell(UnitCell<D> const & unitCell);
98
117 void compute(DArray< RField<D> > const & wFields,
118 double phiTot = 1.0);
119
127 void computeStress();
128
138 double stress(int n) const;
139
140 // Inherited public functions
141 using Base::nBlock;
142 using Base::block;
143 using Base::ensemble;
144 using Base::solve;
145 using Base::length;
146
147 protected:
148
150 using Base::phi_;
151 using Base::mu_;
152
153 private:
154
156 FArray<double, 6> stress_;
157
159 const UnitCell<D>* unitCellPtr_;
160
161 };
162
164 template <int D>
165 inline double Polymer<D>::stress(int n) const
166 { return stress_[n]; }
167
168 #ifndef PSPC_POLYMER_TPP
169 // Supress implicit instantiation
170 extern template class Polymer<1>;
171 extern template class Polymer<2>;
172 extern template class Polymer<3>;
173 #endif
174
175}
176}
177#endif
Descriptor and MDE solver for an acyclic block polymer.
Definition: PolymerTmpl.h:42
Block< D > & block(int id)
Get a specified Block.
Definition: PolymerTmpl.h:276
int nBlock() const
Number of blocks.
Definition: PolymerTmpl.h:241
virtual void solve(double phiTot=1.0)
Solve modified diffusion equation.
Definition: PolymerTmpl.h:522
double length() const
Sum of the lengths of all blocks in the polymer.
Definition: PolymerTmpl.h:255
Descriptor and solver for one polymer species.
void setPhi(double phi)
Set value of phi (volume fraction), if ensemble is closed.
double stress(int n) const
Get precomputed contribution to stress from this species.
void setupUnitCell(UnitCell< D > const &unitCell)
Set up the unit cell after a change in unit cell parameters.
void setMu(double mu)
Set value of mu (chemical potential), if ensemble is closed.
Polymer()
Default constructor.
void compute(DArray< RField< D > > const &wFields, double phiTot=1.0)
Compute solution to MDE and block concentrations.
PolymerTmpl< Block< D > > Base
Base class typedef (PolymerTmpl instance)
void computeStress()
Compute stress contribution from this species.
Field of real double precision values on an FFT mesh.
Definition: RField.h:29
double phi() const
Get the overall volume fraction for this species.
Definition: Species.h:90
Ensemble ensemble()
Get the statistical ensemble for this species (open or closed).
Definition: Species.h:102
double phi_
Volume fraction, set by either setPhi or compute function.
Definition: Species.h:68
double mu_
Chemical potential, set by either setPhi or compute function.
Definition: Species.h:73
double mu() const
Get the chemical potential for this species (units kT=1).
Definition: Species.h:96
Base template for UnitCell<D> classes, D=1, 2 or 3.
Definition: UnitCell.h:44
Dynamically allocatable contiguous array template.
Definition: DArray.h:32
A fixed size (static) contiguous array template.
Definition: FArray.h:47
void setClassName(const char *className)
Set class name string.
C++ namespace for polymer self-consistent field theory (PSCF).