9#include <r1d/domain/Domain.h>
10#include <r1d/domain/GeometryMode.h>
48 ns_ = floor(
length()/dsTarget_ + 0.5) + 1;
52 ds_ =
length()/double(ns_ - 1);
76 ns_ = floor(
length()/dsTarget_ + 0.5) + 1;
80 ds_ =
length()/double(ns_ - 1);
138 ds_ =
length()/double(ns_ - 1);
141 double halfDs = 0.5*ds_;
142 for (
int i = 0; i < nx; ++i) {
143 dA_[i] = halfDs*w[i];
148 double db =
kuhn()/dx;
149 double c1 = halfDs*db*db/6.0;
152 if (mode == Planar) {
156 for (
int i = 1; i < nx - 1; ++i) {
168 double halfDx = 0.5*dx;
174 rp = 1.0 + halfDx/xMin;
175 if (mode == Spherical) {
179 if (mode == Spherical) {
182 if (mode == Cylindrical) {
193 for (
int i = 1; i < nx - 1; ++i) {
197 if (mode == Spherical) {
209 rm = 1.0 - halfDx/xMax;
210 if (mode == Spherical) {
219 for (
int i = 0; i < nx; ++i) {
222 for (
int i = 0; i < nx - 1; ++i) {
225 for (
int i = 0; i < nx - 1; ++i) {
230 for (
int i = 0; i < nx; ++i) {
236 solver_.computeLU(dA_, uA_, lA_);
259 for (i = 0; i < nx; ++i) {
268 for (i = 0; i < nx; ++i) {
269 cField()[i] += 0.5*p0.
q(0)[i]*p1.
q(ns_ - 1)[i];
271 for (
int j = 1; j < ns_ - 1; ++j) {
272 for (i = 0; i < nx; ++i) {
273 cField()[i] += p0.
q(j)[i]*p1.
q(ns_ - 1 - j)[i];
276 for (i = 0; i < nx; ++i) {
277 cField()[i] += 0.5*p0.
q(ns_ - 1)[i]*p1.
q(0)[i];
282 for (i = 0; i < nx; ++i) {
298 v_[0] = dB_[0]*q[0] + uB_[0]*q[1];
299 for (
int i = 1; i < nx - 1; ++i) {
300 v_[i] = dB_[i]*q[i] + lB_[i-1]*q[i-1] + uB_[i]*q[i+1];
302 v_[nx - 1] = dB_[nx-1]*q[nx-1] + lB_[nx-2]*q[nx-2];
303 solver_.solve(v_, qNew);
Propagator & propagator(int directionId)
Propagator::FieldT & 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.
QFieldT const & q(int i) const
Return q-field at specified step.
Dynamically allocatable contiguous array template.
#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.