forked from gfrd/egfrd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GreensFunction1DRadAbs.cpp
697 lines (594 loc) · 20 KB
/
GreensFunction1DRadAbs.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
#include <sstream>
#include <iostream>
#include <cstdlib>
#include <exception>
#include <vector>
#include <gsl/gsl_math.h>
#include <gsl/gsl_sf_trig.h>
#include <gsl/gsl_sum.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_interp.h>
#include <gsl/gsl_sf_expint.h>
#include <gsl/gsl_sf_elljac.h>
#include <gsl/gsl_roots.h>
#include <math.h>
#include "findRoot.hpp"
#include "GreensFunction1DRadAbs.hpp"
// This is the appropriate definition of the function defining
// the roots of our Green's functions in GSL.
// Later needed by the rootfinder.
//
// It expects a reaction rate h=k/D already divided by D.
double
GreensFunction1DRadAbs::tan_f (double x, void *p)
{
// casts the void to the struct pointer
struct tan_f_params *params = (struct tan_f_params *)p;
const Real a = (params->a);
const Real h = (params->h);
const Real h_a (h*a);
if ( h_a < 1 )
{
// h = k/D
return 1/tan(x) + (h_a)/x;
}
else
{
// h = k/D
return tan(x) + x/(h_a);
}
}
// Calculates the roots of tan(x*a)=-x/h
Real
GreensFunction1DRadAbs::root_n(int n) const
{
const Real L( this->geta()-this->getsigma() );
const Real h( (this->getk()+this->getv()/2.0) / this->getD() );
// the drift v also comes into this constant, h=(k+v/2)/D
Real upper, lower;
if ( h*L < 1 )
{
// 1E-10 to make sure that he doesn't include the transition
lower = (n-1)*M_PI + 1E-10;
// (asymptotic) from infinity to -infinity
upper = n *M_PI - 1E-10;
}
else
{
lower = (n-1)*M_PI + M_PI_2 + 1E-10;
upper = n *M_PI + M_PI_2 - 1E-10;
}
gsl_function F;
struct tan_f_params params = { L, h };
F.function = &GreensFunction1DRadAbs::tan_f;
F.params = ¶ms;
// define a new solver type brent
const gsl_root_fsolver_type* solverType( gsl_root_fsolver_brent );
// make a new solver instance
// TODO: incl typecast?
gsl_root_fsolver* solver( gsl_root_fsolver_alloc( solverType ) );
// get the root = run the rootsolver
const Real root( findRoot( F, solver, lower, upper, 1.0*EPSILON, EPSILON,
"GreensFunction1DRadAbs::root_tan" ) );
gsl_root_fsolver_free( solver );
return root/L;
// This rescaling is important, because the function tan_f is used to solve for
// tan(x)+x/h/L=0, whereas we actually need tan(x*L)+x/h=0, So if x solves the
// subsidiary equation, x/L solves the original one.
}
// This is the non-exponential factor in the Green's function sum, not
// including the factor containing the explicit r-dependency (The latter
// is given by the Bn's, see below).
//
// r0 is here still in the interval from 0 to a (and supposed to be the
// starting point of the particle at t0).
//
// The root a_n also must be the specific one for that interval, thus
// the one rescaled by a (see comments in function a_n(n) ).
//
// The factor calculated here is identical for the cases w. or w/o drift,
// only h changes.
Real
GreensFunction1DRadAbs::An (Real root_n) const
{
const Real h((this->getk()+this->getv()/2.0)/this->getD());
const Real sigma(this->getsigma());
const Real L(this->geta()-this->getsigma());
const Real r0(this->getr0());
const Real rootn_r0_s = root_n*(r0-sigma);
return (root_n*cos(rootn_r0_s) + h*sin(rootn_r0_s)) / (h + (root_n*root_n + h*h)*L);
}
// This factor appears in the survival prob.
Real
GreensFunction1DRadAbs::Bn (Real root_n) const
{
const Real h((this->getk()+this->getv()/2.0)/this->getD());
const Real k(this->getk());
const Real D(this->getD());
const Real v(this->getv());
const Real sigma(this->getsigma());
const Real a(this->geta());
const Real L(this->geta()-this->getsigma());
const Real rootnL(root_n*L);
const Real rootn2(root_n*root_n);
const Real h2(h*h);
const Real v2D(v/2.0/D);
if(v==0.0) return (h2 - (rootn2 + h2)*cos(rootnL)) / (h*root_n);
else return (exp(v2D*sigma)*h*k/D - exp(v2D*a)*(rootn2+h2)*cos(rootnL) ) / (h/root_n*(rootn2+v2D*v2D));
}
// This is the exponential factor in the Green's function sum, also
// appearing in the survival prob. and prop. function.
//
// Also here the root is the one refering to the interval of length L.
Real
GreensFunction1DRadAbs::Cn (Real root_n, Real t)
const
{
const Real D(this->getD());
return std::exp(-D*root_n*root_n*t);
}
// Calculates the probability of finding the particle inside the domain
// at time t, the survival probability.
Real
GreensFunction1DRadAbs::p_survival (Real t) const
{
THROW_UNLESS( std::invalid_argument, t >= 0.0 );
const Real D(this->getD());
const Real v(this->getv());
const Real vexpo(-v*v*t/4.0/D - v*r0/2.0/D);
if (t == 0.0 || (D == 0.0 && v == 0.0) )
{
// if there was no time or no movement the particle was always
// in the domain
return 1.0;
}
Real root_n;
Real sum = 0, term = 0, term_prev = 0;
int n = 1;
do
{
root_n = this->root_n(n);
term_prev = term;
term = this->Cn(root_n, t) * this->An(root_n) * this->Bn(root_n);
sum += term;
n++;
}
while ( fabs(term/sum) > EPSILON ||
fabs(term_prev/sum) > EPSILON ||
n <= MIN_TERMS);
return 2.0*exp(vexpo)*sum;
}
// Calculates the probability density of finding the particle at location r
// at time t.
Real
GreensFunction1DRadAbs::prob_r (Real r, Real t)
const
{
THROW_UNLESS( std::invalid_argument, t >= 0.0 );
THROW_UNLESS( std::invalid_argument, (r-sigma) >= 0.0 && r <= a && (r0 - sigma) >= 0.0 && r0<=a );
const Real sigma(this->getsigma());
const Real a(this->geta());
const Real L(this->geta()-this->getsigma());
const Real r0(this->getr0());
const Real D(this->getD());
const Real v(this->getv());
const Real h((this->getk()+this->getv()/2.0)/this->getD());
const Real vexpo(-v*v*t/D/4.0 + v*(r-r0)/D/2.0);
// if there was no time change or zero diffusivity => no movement
if (t == 0 || D == 0)
{
// the probability density function is a delta function
if (r == r0)
{
return INFINITY;
}
else
{
return 0.0;
}
}
// if r is at the absorbing boundary
if ( fabs(a-r) < EPSILON*L )
{
return 0.0;
}
Real root_n, root_n_r_s;
Real sum = 0, term = 0, prev_term = 0;
int n=1;
do
{
if ( n >= MAX_TERMS )
{
std::cerr << "Too many terms needed for GF1DRad::prob_r. N: "
<< n << std::endl;
break;
}
root_n = this->root_n(n);
root_n_r_s = root_n*(r-sigma);
prev_term = term;
term = Cn(root_n, t) * An(root_n) * (h*sin(root_n_r_s) + root_n*cos(root_n_r_s));
sum += term;
n++;
}
while (fabs(term/sum) > EPSILON*PDENS_TYPICAL ||
fabs(prev_term/sum) > EPSILON*PDENS_TYPICAL ||
n <= MIN_TERMS );
return 2.0*exp(vexpo)*sum;
}
// Calculates the probability density of finding the particle at location z at
// timepoint t, given that the particle is still in the domain.
Real
GreensFunction1DRadAbs::calcpcum (Real r, Real t) const
{
return prob_r(r, t)/p_survival(t);
}
// Calculates the total probability flux leaving the domain at time t
// This is simply the negative of the time derivative of the survival prob.
// at time t [-dS(t')/dt' for t'=t].
Real
GreensFunction1DRadAbs::flux_tot (Real t) const
{
Real root_n;
const Real D(this->getD());
const Real v(this->getv());
const Real vexpo(-v*v*t/4.0/D - v*r0/2.0/D);
const Real D2 = D*D;
const Real v2Dv2D = v*v/4.0/D2;
double sum = 0, term = 0, prev_term = 0;
int n=1;
do
{
if ( n >= MAX_TERMS )
{
std::cerr << "Too many terms needed for GF1DRad::flux_tot. N: "
<< n << std::endl;
break;
}
root_n = this->root_n(n);
prev_term = term;
term = (root_n * root_n + v2Dv2D) * Cn(root_n, t) * An(root_n) * Bn(root_n);
n++;
sum += term;
}
while (fabs(term/sum) > EPSILON*PDENS_TYPICAL ||
fabs(prev_term/sum) > EPSILON*PDENS_TYPICAL ||
n <= MIN_TERMS );
return 2.0*D*exp(vexpo)*sum;
}
// Calculates the probability flux leaving the domain through the radiative
// boundary at time t
Real
GreensFunction1DRadAbs::flux_rad (Real t) const
{
return this->getk() * prob_r(this->getsigma(), t);
}
// Calculates the flux leaving the domain through the radiative boundary as a
// fraction of the total flux. This is the probability that the particle left
// the domain through the radiative boundary instead of the absorbing
// boundary.
Real
GreensFunction1DRadAbs::fluxRatioRadTot (Real t) const
{
return flux_rad(t)/flux_tot(t);
}
// Determine which event has occured, an escape or a reaction. Based on the
// fluxes through the boundaries at the given time. Beware: if t is not a
// first passage time you still get an answer!
GreensFunction1DRadAbs::EventKind
GreensFunction1DRadAbs::drawEventType( Real rnd, Real t )
const
{
THROW_UNLESS( std::invalid_argument, rnd < 1.0 && rnd >= 0.0 );
THROW_UNLESS( std::invalid_argument, t > 0.0 );
// if t=0 nothing has happened => no event
const Real a(this->geta());
const Real L(this->geta()-this->getsigma());
const Real r0(this->getr0());
// if the radiative boundary is impermeable (k==0) or
// the particle is at the absorbing boundary (at a) => IV_ESCAPE event
if ( k == 0 || fabs(a-r0) < EPSILON*L )
{
return IV_ESCAPE;
}
// Else the event is sampled from the flux ratio
const Real fluxratio (this->fluxRatioRadTot(t));
if (rnd > fluxratio )
{
return IV_ESCAPE;
}
else
{
return IV_REACTION;
}
}
// This function is needed to cast the math. form of the function
// into the form needed by the GSL root solver.
double
GreensFunction1DRadAbs::drawT_f (double t, void *p)
{
// casts p to type 'struct drawT_params *'
struct drawT_params *params = (struct drawT_params *)p;
Real Xn, exponent;
Real prefactor = params->prefactor;
int terms = params->terms;
Real sum = 0, term = 0, prev_term = 0;
int n=0;
do
{
if ( n >= terms )
{
std::cerr << "Too many terms needed for GF1DRad::DrawTime. N: "
<< n << std::endl;
break;
}
prev_term = term;
Xn = params->Xn[n];
exponent = params->exponent[n];
term = Xn * exp(exponent * t);
sum += term;
n++;
}
while (fabs(term/sum) > EPSILON*1.0 ||
fabs(prev_term/sum) > EPSILON*1.0 ||
n <= MIN_TERMS );
// find the intersection with the random number
return 1.0 - prefactor*sum - params->rnd;
}
// Draws the first passage time from the survival probability,
// using an assistance function drawT_f that casts the math. function
// into the form needed by the GSL root solver.
Real
GreensFunction1DRadAbs::drawTime (Real rnd) const
{
THROW_UNLESS( std::invalid_argument, 0.0 <= rnd && rnd < 1.0 );
const Real sigma(this->getsigma());
const Real a(this->geta());
const Real L(this->geta()-this->getsigma());
const Real r0(this->getr0());
const Real k(this->getk());
const Real D(this->getD());
const Real v(this->getv());
const Real h((this->getk()+this->getv()/2.0)/this->getD());
if ( D == 0.0 || L == INFINITY )
{
return INFINITY;
}
if ( rnd <= EPSILON || L < 0.0 || fabs(a-r0) < EPSILON*L )
{
return 0.0;
}
const Real v2D(v/2.0/D);
const Real exp_av2D(exp(a*v2D));
const Real exp_sigmav2D(exp(sigma*v2D));
// exponent of the prefactor present in case of v<>0; has to be split because it has a t-dep. and t-indep. part
const Real vexpo_t(-v*v/4.0/D);
const Real vexpo_pref(-v*r0/2.0/D);
// the structure to store the numbers to calculate the numbers for 1-S
struct drawT_params parameters;
// some temporary variables
double root_n = 0;
double root_n2, root_n_r0_s, root_n_L, h_root_n;
double Xn, exponent, prefactor;
// produce the coefficients and the terms in the exponent and put them
// in the params structure. This is not very efficient at this point,
// coefficients should be calculated on demand->TODO
for (int n=0; n<MAX_TERMS; n++)
{
root_n = this->root_n(n+1); // get the n-th root of tan(root*a)=root/-h (Note: root numbering starts at n=1)
root_n2 = root_n * root_n;
root_n_r0_s = root_n * (r0-sigma);
root_n_L = root_n * L;
h_root_n = h / root_n;
if(v==0) Xn = (h*sin(root_n_r0_s) + root_n*cos(root_n_r0_s)) / (L*(root_n2+h*h)+h)
* ( h_root_n + sin(root_n_L) - h_root_n*cos(root_n_L) );
else Xn = (h*sin(root_n_r0_s) + root_n*cos(root_n_r0_s)) / (L*(root_n2+h*h)+h)
* (exp_sigmav2D*h*k/D - exp_av2D*(root_n2+h*h)*cos(root_n_L)) / (h_root_n * (root_n2 + v2D*v2D));
exponent = -D*root_n2 + vexpo_t;
// store the coefficients in the structure
parameters.Xn[n] = Xn;
// also store the values for the exponent
parameters.exponent[n] = exponent;
}
// the prefactor of the sum is also different in case of drift<>0 :
if(v==0) prefactor = 2.0;
else prefactor = 2.0*exp(vexpo_pref);
parameters.prefactor = prefactor;
// store the random number for the probability
parameters.rnd = rnd;
// store the number of terms used
parameters.terms = MAX_TERMS;
parameters.tscale = this->t_scale;
// Define the function for the rootfinder
gsl_function F;
F.function = &GreensFunction1DRadAbs::drawT_f;
F.params = ¶meters;
// Find a good interval to determine the first passage time in
// get the distance to absorbing boundary (disregard rad BC)
const Real dist(fabs(a-r0));
//const Real dist( std::min(r0, a-r0)); // for test purposes
// construct a guess: MSD = sqrt (2*d*D*t)
Real t_guess( dist * dist / ( 2.0*D ) );
// A different guess has to be made in case of nonzero drift to account for the displacement due to it
// TODO: This does not work properly in this case yet, but we don't know why...
// When drifting towards the closest boundary
//if( (r0 >= a/2.0 && v > 0.0) || (r0 <= a/2.0 && v < 0.0) ) t_guess = sqrt(D*D/(v*v*v*v)+dist*dist/(v*v)) - D/(v*v);
// When drifting away from the closest boundary
//if( ( r0 < a/2.0 && v > 0.0) || ( r0 > a/2.0 && v < 0.0) ) t_guess = D/(v*v) - sqrt(D*D/(v*v*v*v)-dist*dist/(v*v));
Real value( GSL_FN_EVAL( &F, t_guess ) );
Real low( t_guess );
Real high( t_guess );
// scale the interval around the guess such that the function straddles
if( value < 0.0 )
{
// if the guess was too low
do
{
// keep increasing the upper boundary until the
// function straddles
high *= 10;
value = GSL_FN_EVAL( &F, high );
if( fabs( high ) >= t_guess * 1e6 )
{
std::cerr << "GF1DRad: Couldn't adjust high. F("
<< high << ") = " << value << std::endl;
throw std::exception();
}
}
while ( value <= 0.0 );
}
else
{
// if the guess was too high
// initialize with 2 so the test below survives the first
// iteration
Real value_prev( 2 );
do
{
if( fabs( low ) <= t_guess * 1e-6 ||
fabs(value-value_prev) < EPSILON*1.0 )
{
std::cerr << "GF1DRad: Couldn't adjust low. F(" << low << ") = "
<< value << " t_guess: " << t_guess << " diff: "
<< (value - value_prev) << " value: " << value
<< " value_prev: " << value_prev << " rnd: "
<< rnd << std::endl;
return low;
}
value_prev = value;
// keep decreasing the lower boundary until the function straddles
low *= 0.1;
// get the accompanying value
value = GSL_FN_EVAL( &F, low );
}
while ( value >= 0.0 );
}
// find the intersection on the y-axis between the random number and
// the function
// define a new solver type brent
const gsl_root_fsolver_type* solverType( gsl_root_fsolver_brent );
// make a new solver instance
// TODO: incl typecast?
gsl_root_fsolver* solver( gsl_root_fsolver_alloc( solverType ) );
const Real t( findRoot( F, solver, low, high, t_scale*EPSILON, EPSILON,
"GreensFunction1DRadAbs::drawTime" ) );
// return the drawn time
return t;
}
double
GreensFunction1DRadAbs::drawR_f (double z, void *p)
{
// casts p to type 'struct drawR_params *'
struct drawR_params *params = (struct drawR_params *)p;
Real v2D = params->H[0]; // = v2D = v/(2D)
Real costerm = params->H[1]; // = k/D
Real sinterm = params->H[2]; // = h*v2D
Real sigma = params->H[3]; // = sigma
int terms = params->terms;
Real expsigma(exp(sigma*v2D));
Real zs(z-sigma);
Real sum = 0, term = 0, prev_term = 0;
Real root_n, S_Cn_root_n;
int n = 0;
do
{
if ( n >= terms )
{
std::cerr << "GF1DRad: Too many terms needed for DrawR. N: "
<< n << std::endl;
break;
}
prev_term = term;
S_Cn_root_n = params->S_Cn_root_n[n];
root_n = params->root_n[n];
term = S_Cn_root_n * ( expsigma*costerm - exp(v2D*z)*( costerm*cos(root_n*zs) - (root_n+sinterm/root_n)*sin(root_n*zs) ));
sum += term;
n++;
}
while (fabs(term/sum) > EPSILON*1.0 ||
fabs(prev_term/sum) > EPSILON*1.0 ||
n <= MIN_TERMS );
// Find the intersection with the random number
return sum - params->rnd;
}
Real
GreensFunction1DRadAbs::drawR (Real rnd, Real t) const
{
THROW_UNLESS( std::invalid_argument, 0.0 <= rnd && rnd < 1.0 );
THROW_UNLESS( std::invalid_argument, t >= 0.0 );
const Real sigma(this->getsigma());
const Real a(this->geta());
const Real L(this->geta()-this->getsigma());
const Real r0(this->getr0());
const Real D(this->getD());
const Real v(this->getv());
const Real k(this->getk());
const Real h((this->getk()+this->getv()/2.0)/this->getD());
if (t==0.0 || (D==0.0 && v==0.0) )
{
// the trivial case
//return r0*this->l_scale; // renormalized version, discontinued
return r0;
}
if ( a<0.0 )
{
// if the domain had zero size
return 0.0;
}
// the structure to store the numbers to calculate the numbers for 1-S
struct drawR_params parameters;
double root_n = 0;
double S_Cn_root_n;
double root_n2, root_n_r0_s;
const Real vexpo(-v*v*t/4.0/D - v*r0/2.0/D); // exponent of the drift-prefactor, same as in survival prob.
const Real v2D(v/2.0/D);
const Real v2Dv2D(v2D*v2D);
const Real S = 2.0*exp(vexpo)/p_survival(t); // This is a prefactor to every term, so it also contains
// the exponential drift-prefactor.
// produce the coefficients and the terms in the exponent and put them
// in the params structure
for (int n=0; n<MAX_TERMS; n++)
{
root_n = this->root_n(n+1); // get the n-th root of tan(alfa*a)=alfa/-k
root_n2 = root_n * root_n;
root_n_r0_s = root_n * (r0-sigma);
S_Cn_root_n = S * exp(-D*root_n2*t)
* (root_n*cos(root_n_r0_s) + h*sin(root_n_r0_s)) / (L*(root_n2 + h*h) + h)
* root_n / (root_n2 + v2Dv2D);
// store the coefficients in the structure
parameters.root_n[n] = root_n;
// also store the values for the exponent
parameters.S_Cn_root_n[n] = S_Cn_root_n;
}
// store the random number for the probability
parameters.rnd = rnd;
// store the number of terms used
parameters.terms = MAX_TERMS;
// also store constant prefactors that appear in the calculation of the
// r-dependent terms
parameters.H[0] = v2D; // appears together with z in one of the prefactors
parameters.H[1] = k/D; // further constant terms of the cosine prefactor
parameters.H[2] = h*v2D; // further constant terms of the sine prefactor
parameters.H[3] = sigma;
// find the intersection on the y-axis between the random number and
// the function
gsl_function F;
F.function = &GreensFunction1DRadAbs::drawR_f;
F.params = ¶meters;
// define a new solver type brent
const gsl_root_fsolver_type* solverType( gsl_root_fsolver_brent );
// make a new solver instance
// TODO: incl typecast?
gsl_root_fsolver* solver( gsl_root_fsolver_alloc( solverType ) );
Real r( findRoot( F, solver, sigma, a, EPSILON*L, EPSILON,
"GreensFunction1DRadAbs::drawR" ) );
// return the drawn position
return r;
}
std::string GreensFunction1DRadAbs::dump() const
{
std::ostringstream ss;
ss << "D = " << this->getD() << ", sigma = " << this->getsigma() <<
", a = " << this->geta() <<
", k = " << this->getk() << std::endl;
return ss.str();
}