10#include <r1d/domain/Domain.h>
11#include <r1d/domain/GeometryMode.h>
12#include <pscf/solvers/BlockTmpl.tpp>
53 ns_ = floor(
length()/dsTarget_ + 0.5) + 1;
57 ds_ =
length()/double(ns_ - 1);
81 ns_ = floor(
length()/dsTarget_ + 0.5) + 1;
85 ds_ =
length()/double(ns_ - 1);
143 ds_ =
length()/double(ns_ - 1);
146 double halfDs = 0.5*ds_;
147 for (
int i = 0; i < nx; ++i) {
148 dA_[i] = halfDs*w[i];
153 double db =
kuhn()/dx;
154 double c1 = halfDs*db*db/6.0;
157 if (mode == Planar) {
161 for (
int i = 1; i < nx - 1; ++i) {
173 double halfDx = 0.5*dx;
179 rp = 1.0 + halfDx/xMin;
180 if (mode == Spherical) {
184 if (mode == Spherical) {
187 if (mode == Cylindrical) {
198 for (
int i = 1; i < nx - 1; ++i) {
202 if (mode == Spherical) {
214 rm = 1.0 - halfDx/xMax;
215 if (mode == Spherical) {
224 for (
int i = 0; i < nx; ++i) {
227 for (
int i = 0; i < nx - 1; ++i) {
230 for (
int i = 0; i < nx - 1; ++i) {
235 for (
int i = 0; i < nx; ++i) {
241 solver_.computeLU(dA_, uA_, lA_);
264 for (i = 0; i < nx; ++i) {
273 for (i = 0; i < nx; ++i) {
274 cField()[i] += 0.5*p0.
q(0)[i]*p1.
q(ns_ - 1)[i];
276 for (
int j = 1; j < ns_ - 1; ++j) {
277 for (i = 0; i < nx; ++i) {
278 cField()[i] += p0.
q(j)[i]*p1.
q(ns_ - 1 - j)[i];
281 for (i = 0; i < nx; ++i) {
282 cField()[i] += 0.5*p0.
q(ns_ - 1)[i]*p1.
q(0)[i];
287 for (i = 0; i < nx; ++i) {
303 v_[0] = dB_[0]*q[0] + uB_[0]*q[1];
304 for (
int i = 1; i < nx - 1; ++i) {
305 v_[i] = dB_[i]*q[i] + lB_[i-1]*q[i-1] + uB_[i]*q[i+1];
307 v_[nx - 1] = dB_[nx-1]*q[nx-1] + lB_[nx-2]*q[nx-2];
308 solver_.solve(v_, qNew);
Class template for a block solver in a block copolymer.
Propagator & propagator(int directionId)
DArray< double > & cField()
virtual void setLength(double length)
Set the length of this block (only valid for thread model).
double length() const
Get the length of this block, in the thread model.
virtual void setLength(double newLength)
Set length and readjust ds_ accordingly.
Domain const & domain() const
Return associated domain by reference.
void setupSolver(DArray< double > const &w)
Set Crank-Nicholson solver for this block.
void step(DArray< double > const &q, DArray< double > &qNew)
Compute one step of integration loop, from i to i+1.
void computeConcentration(double prefactor)
Compute concentration for block by integration.
void setDiscretization(Domain const &domain, double ds)
Initialize discretization and allocate required memory.
One-dimensional spatial domain and discretization grid.
bool isShell() const
Is this a cylindrical or spherical shell?
GeometryMode const & mode() const
Get coordinate system flag (Planar, Cylindrical or Spherical).
int nx() const
Get number of spatial grid points, including both endpoints.
double xMin() const
Get minimum spatial coordinate.
double xMax() const
Get maximum spatial coordinate.
double dx() const
Get spatial grid step size.
MDE solver for one-direction of one block.
FieldT const & q(int i) const
Return q-field at specified step.
Dynamically allocatable contiguous array template.
void allocate(int capacity)
Allocate the underlying C array.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
GeometryMode
Enumeration of geometrical modes for functions of one coordinate.
SCFT with real 1D fields.
PSCF package top-level namespace.