PSCF v1.2
r1d/solvers/Polymer.cpp
1/*
2* PSCF - Polymer Self-Consistent Field Theory
3*
4* Copyright 2016 - 2022, The Regents of the University of Minnesota
5* Distributed under the terms of the GNU General Public License.
6*/
7
8#include "Polymer.h"
9
10namespace Pscf {
11namespace R1d
12{
13
15 { setClassName("Polymer"); }
16
19
20 void Polymer::setPhi(double phi)
21 {
22 UTIL_CHECK(ensemble() == Species::Closed);
23 UTIL_CHECK(phi >= 0.0);
24 UTIL_CHECK(phi <= 1.0);
25 phi_ = phi;
26 }
27
28 void Polymer::setMu(double mu)
29 {
30 UTIL_CHECK(ensemble() == Species::Open);
31 mu_ = mu;
32 }
33
34 /*
35 * Compute solution to MDE and concentrations.
36 */
38 {
39
40 // Setup solvers for all blocks
41 int monomerId;
42 for (int j = 0; j < nBlock(); ++j) {
43 monomerId = block(j).monomerId();
44 block(j).setupSolver(wFields[monomerId]);
45 }
46
47 solve();
48 }
49
50}
51}
Block & block(int id)
Get a specified Block.
int nBlock() const
Number of blocks.
virtual void solve(double phiTot=1.0)
Solve modified diffusion equation.
void compute(DArray< Block::WField > const &wFields)
Compute solution to modified diffusion equation.
void setMu(double mu)
Set chemical potential mu (if ensemble is open).
Polymer()
Default constructor.
void setPhi(double phi)
Set volume fraction (if ensemble is closed).
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 a compute function.
Definition Species.h:68
double mu_
Chemical potential, set by either setPhi or a compute function.
Definition Species.h:73
double mu() const
Get the chemical potential for this species (units kT=1).
Definition Species.h:96
Dynamically allocatable contiguous array template.
void setClassName(const char *className)
Set class name string.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
PSCF package top-level namespace.
Definition param_pc.dox:1