I'm using ParametricNDsolve to check best fit of a model (function Eb1) with some data, and I have four free parameters I want to test. I can easily construct a Parametric solution between the two boundaries of interest $r_{n}$ and $r_{o}$ - however, I also need to define the function between $0 \leq r \leq r_{n}$; in this case it's a constant whose value is given by Eb1($r_{n}$) , so that for $r \leq r_{n}$ the value is constant. I can do this with Piecewise when I manually specify the parameters (kme, kmn, j, eo) but I am running into errors using Piecewise with a parametric function; my code so far is;
(*Constants required*)
a = 8.2314*10^-7; omega = 3.0318*10^7; Do2 = 2*10^-9; po = 106; ro = 235*10^-6; micron = 1*10^-6; qm = 10^-4; mic = 1*10^-6; De = 5.5*10^-11; con = (a*omega)/(6*Do2); rl = Sqrt[(6*Do2*po)/(omega*a)];
(*Functions that are pre-defined*)
rn = Piecewise[{{0, ro <= rl}, {ro*(0.5 - Cos[(ArcCos[1 - (2*rl*rl)/(ro^2)] - 2*Pi)/3]), ro > rl}}];
p[r_] = Piecewise[{{po + con*(r^2 - ro^2 + 2*(rn^3)*(1/r - 1/ro)), r > rn} , {0 , r <= rn}}];
q[r_] = qm*((kme/(kme + p[r]))*(p[r]/(kmn + p[r])) + (kmn/(kmn + p[r]))*j);
(*Coupled Equations to be solved*)
eqnDe = D[Ef1[r, t], t] - De*(D[Ef1[r, t], r, r] + (2/r)*(D[Ef1[r, t], r])) + q[r]*Ef1[r, t];
eqnBo = D[Eb1[r, t], t] - (Ef1[r, t])*q[r];
(*Parametric solution for unknowns kme, kmn, j and eo*)
x = ParametricNDSolve[{eqnBo == 0, Eb1[r, 0] == 0, eqnDe == 0,
Ef1[r, 0] == 0, Derivative[1, 0][Ef1][rn, t] == 0,
Ef1[ro, t] == eo}, Eb1, {r, rn, ro}, {t, 0, 14400}, {kme, kmn, j, eo}];
So far so good; now to define the full range of Eb1, including the domain $r < r_n$, I try to use Piecewise;
Ebound[r_] =
Piecewise[{{Eb1[rn, 14400] /. x, r < rn}, {Eb1[r, 14400] /. x,
r >= rn}}];
but this yields the error ParametricNDSolve::fpct: "Too many parameters in {kme,kmn,j,eo} to be filled from {r,14400}." - Similar error messages occur when I try Ebound[r_,kme_,kmn_,j_,eo_] - is there anyway I can define this chunk of the domain with the parametric solution? I'll meet to do this before I try fitting to the data and I have and this is proving a stumbling block!