I am trying to check if mass conservation holds by integrating the area under a curve but to no avail.
Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"];
Needs["VectorAnalysis`"]
Clear[Eq0, EvapThickFilm, h, Bo, ϵ, K1, δ, Bi, m, r]
Eq0[h_, {Bo_, ϵ_, K1_, δ_, Bi_, m_, r_}] :=
D[h, t] + Div[(-h^3)*Bo*Grad[h] + h^3*Grad[Laplacian[h]] + ((δ*h^3)/(Bi*h + K1)^3)*Grad[h]
+ m*(h/(K1 + Bi*h))^2*Grad[h]] + ϵ/(Bi*h + K1) + r*D[D[h^2/(K1 + Bi*h), x]*h^3, x] == 0;
L = 2*92.389;
TMax = 2491.29*100;
Off[NDSolve::mxsst];
hSol[x_, y_, t_] = h[x, y, t] /.
NDSolve[{EvapThickFilm[0.003, 0, 1, 0, 1, 0.025, 0],
h[0, y, t] == h[L, y, t], h[x, 0, t] == h[x, L, t],
h[x, y, 0] == 1 + (-0.25*Cos[2*Pi*(x/L)] - 0.25*Sin[2*Pi*(x/L)])*
Cos[2*Pi*(y/L)]}, h, {x, 0, L}, {y, 0, L}, {t, 0, TMax},
MaxStepFraction -> 1/60][[1]]
When I use NIntegrate[...]
to integrate under the area of the curve for a single value of TMax
, I don't get a single valued number. In fact, my variables are reset! What gives?
NIntegrate[hSol[x, y, 0.1*TMax], {x, 0, L}, {y, 0, L}]
I've tried it with simpler 2D cases instead of 3D and this works fine.
FOOTNOTE: Is there some way I could host this code elsewhere? Any websites that support mathematica code format?
EDIT 1:
The error that NIntegrate[..]
gives me is that x = L is not a valid limit of integration. whilst L has actually been defined in the problem previously.
SubscriptBox
, etc, is extremely difficult to read. Can you convert it toInputForm
and repost? To do so, select the cell, right click (ctrl-click on mac), and Convert To -> InputForm. $\endgroup$