PSCF v1.1
fd1d/solvers/Block.h
1#ifndef FD1D_BLOCK_H
2#define FD1D_BLOCK_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 "Propagator.h" // base class argument
12#include <fd1d/domain/GeometryMode.h> // argument (enum)
13#include <pscf/solvers/BlockTmpl.h> // base class template
14#include <pscf/math/TridiagonalSolver.h> // member
15
16namespace Pscf {
17namespace Fd1d
18{
19
20 class Domain;
21 using namespace Util;
22
31 class Block : public BlockTmpl<Propagator>
32 {
33
34 public:
35
39 Block();
40
44 ~Block();
45
52 void setDiscretization(Domain const & domain, double ds);
53
59 virtual void setLength(double newLength);
60
66 void setupSolver(DArray<double> const & w);
67
80 void computeConcentration(double prefactor);
81
88 void step(DArray<double> const & q, DArray<double>& qNew);
89
93 Domain const & domain() const;
94
98 int ns() const;
99
100 private:
101
103 TridiagonalSolver solver_;
104
105 // Arrays dA_, uA_, lB_ dB_, uB_, luB_ contain elements of the
106 // the tridiagonal matrices A and B used in propagation from
107 // step i to i + 1, which requires solution of a linear system
108 // of the form: A q(i+1) = B q(i).
109
111 DArray<double> dA_;
112
114 DArray<double> uA_;
115
117 DArray<double> lA_;
118
120 DArray<double> dB_;
121
123 DArray<double> uB_;
124
126 DArray<double> lB_;
127
130
132 Domain const * domainPtr_;
133
135 double ds_;
136
137 // Contour length step size (value input in param file).
138 double dsTarget_;
139
141 int ns_;
142
143 };
144
145 // Inline member functions
146
148 inline Domain const & Block::domain() const
149 {
150 UTIL_ASSERT(domainPtr_);
151 return *domainPtr_;
152 }
153
155 inline int Block::ns() const
156 { return ns_; }
157
158}
159}
160#endif
Class template for a block in a block copolymer.
Definition: BlockTmpl.h:89
Block within a branched polymer.
Domain const & domain() const
Return associated domain by reference.
virtual void setLength(double newLength)
Set length and readjust ds_ accordingly.
void step(DArray< double > const &q, DArray< double > &qNew)
Compute one step of integration loop, from i to i+1.
void setupSolver(DArray< double > const &w)
Set Crank-Nicholson solver for this block.
void setDiscretization(Domain const &domain, double ds)
Initialize discretization and allocate required memory.
int ns() const
Number of contour length steps.
void computeConcentration(double prefactor)
Compute concentration for block by integration.
One-dimensional spatial domain and discretization grid.
Solver for Ax=b with tridiagonal matrix A.
Dynamically allocatable contiguous array template.
Definition: DArray.h:32
#define UTIL_ASSERT(condition)
Assertion macro suitable for debugging serial or parallel code.
Definition: global.h:75
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1