# Use piecewise parameters in NDSolve

Posted 3 months ago
677 Views
|
3 Replies
|
0 Total Likes
|
 Hello, I am getting the following error message in Mathematica 12 when attempting to numerical solve a system of PDEs with a piecewise-defined parameter: LinearSolve::nosol: Linear equation encountered that has no solution. Does anyone know what is causing this error? I'm including the code below, and I also attached it.Thank you,Abed ClearAll["Global*"]; eqn = { kAC[Subscript[R, outer][x, t], Subscript[R, inner]] D[P[x, t], x] == - QL[x, t], D[QL[x, t], x] == 1 - D[Subscript[A, outer][x, t], t] HeavisideTheta[ Subscript[A, outer][x, t] - Subscript[A, inner]] }; kAC[rO_, rI_] := Piecewise[{ {(Pi/(8 \[Mu])) (rO^4 - rI^4 - ((rO^2 - rI^2)^2/Log[rO/rI])), rO - rI > 0} }, 0 ]; radiiToArea = {Subscript[R, outer][x, t] -> Sqrt[ Subscript[A, outer][x, t]]/Sqrt[\[Pi]], Subscript[R, inner] -> Sqrt[Subscript[A, inner]]/Sqrt[\[Pi]]}; eqn = eqn /. radiiToArea; cond = { P[l, t] == 0, QL[0, t] == 0, QL[x, 0] == 0, P[x, 0] == 0 }; pToARelationship = {P[x, t] == 2 Pi Sqrt[4 Subscript[A, outer][x, t]/Pi]}; aOuterSol = Solve[pToARelationship, Subscript[A, outer][x, t]] // FullSimplify // Flatten; aOuterSol = Join[aOuterSol, D[aOuterSol, t]]; eqn = eqn /. aOuterSol; fullSystem = Join[eqn, cond]; parameterVals = {\[Mu] -> 1, Subscript[A, inner] -> 1, l -> 10}; nSol = NDSolve[ fullSystem /. parameterVals, {P[x, t], QL[x, t]}, {x, 0, 10}, {t, 0, 1000}, Method -> {"PDEDiscretization" -> {"MethodOfLines", "SpatialDiscretization" -> {"FiniteElement"}}}] // Flatten ` Attachments:
3 Replies
Sort By:
Posted 3 months ago
 I was able to figure out the issue with some help from Mathworks. A zero coefficient was preventing the ability to calculate the derivative. I am now encountering a new issue, but I will make a separate post.