1
$\begingroup$

I am trying to solve a PDE, but one of the boundary conditions is complex, because it includes an integral over the function that I am looking for.

enter image description here

The code is shown below

ClearAll["Global`*"]
Needs["NDSolve`FEM`"]
R = 0.005;   (*cm*)
\[Rho] = 1.05;    (*g/cm^3*)
St = 57.14;   (*cm^2*)
W = 0.3;       (*g*)
V = 50;      (*cm^3*)
(*L was converted to cm^3*)
k = 0.035/1000;     (*mmol/cm^3*)
(*mmol/L was converted to mmol/cm^3*)
qm = 0.994;     (*mmol/g*)
C0 = 919.43*1000/(1000000*1000*112.4);       (*mmol/cm^3*)
(*200ppm was converted to 919.43mg/m^3 and then to mmol/cm^3*)
De = 3.5*10^-6;           (*cm^2/s*)

q = (qm*Cr[t, r])/(k + Cr[t, r]);
region = ImplicitRegion[True, {{r, 0, R}}];

if = NDSolveValue[{D[Cr[t, r], t] + \[Rho]*
  D[q, t] - De*D[Cr[t, r], r, r] == 
NeumannValue[0, r == 0], Cr[0, r] == 0, DirichletCondition[
Cr[t, r] == 
 C0 - Inactivate[
   NIntegrate[(St/V)*Derivative[Cr[t, R], r], {r, 0, R}]], 
r == R]}, Cr[t, r], {t, 0, 1000}, {r} \[Element] region, Method -> {"PDEDiscretization" -> {"MethodOfLines", 
  "SpatialDiscretization" -> {"FiniteElement"}}}]

But it's giving me this error message:

NDSolveValue::dvnoarg: The function Cr appears with no arguments. >>
$\endgroup$

closed as off-topic by user21, MarcoB, m_goldberg, dr.blochwave, Kuba Oct 9 '15 at 14:23

  • The question does not concern the technical computing software Mathematica by Wolfram Research. Please see the help center to find out about the topics that can be asked here.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ I'm really not sure what you're trying to do with that DirichletCondition; it doesn't seem to match up to anything in the equations above. Can you add the equation in standard mathematical form rather than in code? $\endgroup$ – Michael Seifert Jul 16 '15 at 17:06
  • $\begingroup$ Also, do you mean D[Cr[t, R], r] rather than Derivative[Cr[t, R], r]? I'm not sure that the second form actually means anything in Mathematica. (But the former will evaluate to zero, so I'm still confused.) $\endgroup$ – Michael Seifert Jul 16 '15 at 17:10
  • 2
    $\begingroup$ I'm voting to close this question as off-topic because it is too localized; i.e, it applies only to the local situation and needs of its poster and answers will not benefit others. $\endgroup$ – m_goldberg Oct 9 '15 at 12:44