1
$\begingroup$

Can anyone tell me how I can use NDSolveValue to model reflective and constant heat flux boundary conditions. I am solving the heat equation. Essentially I have a PDE that is dependent on time, radius, and axial length. I want to solve it such that the spatial derivative of the temperature is equal to 0 on one boundary and equal to a constant on another boundary. Can anyone explain how I can set up NDSolveValue with these types of boundary conditions? I don't think it can be achieved using NeumannValue because that just sets the entire differential equation to a value. I have tried a lot of different approaches but nothing seems to be working for me. Can anyone please recommend a way to achieve this?

Edit: Here is some code

tf = 50; Ti = 100; 
Ls =  250; Lito = 5;  Lsl = 230;
Ltot = Ls + Lito + Lsl;
R = 1500; k = 1; 

eqn = r*\!\(
\*SubscriptBox[\(∂\), \(t\)]\(T[t, r, z]\)\) - r*k*\!\(
\*SubscriptBox[\(∂\), \(z, z\)]\(T[t, r, z]\)\) - k*\!\(
\*SubscriptBox[\(∂\), \(r\)]\(T[t, r, z]\)\) - k*r*\!\(
\*SubscriptBox[\(∂\), \(r, r\)]\(T[t, r, z]\)\);
Subscript[Γ, D] = {DirichletCondition[T[t, r, z] == Ti, z == Ltot], 
   DirichletCondition[T[t, r, z] == Ti, r == R]};

BCr = NDSolveValue[{eqn == 0, Subscript[Γ, D], \!\(
\*SubscriptBox[\(∂\), \(r\)]\(T[t, 0, z]\)\) == 0, \!\(
\*SubscriptBox[\(∂\), \(z\)]\(T[t, r, 0]\)\) == -100, 
    T[0, r, z] == Ti}, T, {t, 0, tf}, {r, 0, R}, {z, 0, Ltot}];
$\endgroup$
2
  • 1
    $\begingroup$ Can you add a simple example (code) and an example of what you expect? $\endgroup$
    – user21
    Commented Nov 13, 2015 at 6:27
  • 1
    $\begingroup$ I encourage you to become a regular contributor to Mathematica.SE.. To do so effectively, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Commented Nov 13, 2015 at 13:43

1 Answer 1

3
$\begingroup$

With v[x, t] the dependent variable, and x the spatial independent variable ranging from x1 to x2, the requested boundary conditions are,

v[x1, t] == 0
(D[v[x, t], x] /. x -> x2) == 0

In answer to the OP's comment below, these and any other boundary and initial conditions are included in the first argument of NDSolveValue, as illustrated by several of the Basic Examples in the documentation.

Edit

As noted in my comment below, the question's recently added code can be made to work with the change,

r0 = .1;
BCr = NDSolveValue[{eqn == 0, Subscript[Γ, D], (D[T[t, r, z], z] /. z -> 0) == 0, 
    (D[T[t, r, z], r] /. r -> r0) == 0, T[0, r, z] == Ti}, T, {t, 0, tf}, 
    {r, r0, R}, {z, 0, Ltot}]

For the parameters chosen in the question, BCr is equal to Ti everywhere.

$\endgroup$
7
  • $\begingroup$ I am assuming this code is independent of the NDSolveValue function. As in this code would be prior to the NDSolveValue function such that the boundary conditions are evaluated prior to solving. $\endgroup$
    – dowlguest
    Commented Nov 13, 2015 at 6:56
  • $\begingroup$ @dowlguest Please see the additional sentence that I added to my answer. $\endgroup$
    – bbgodfrey
    Commented Nov 13, 2015 at 13:39
  • $\begingroup$ I have tried this method in the past and I get an error message that says: NDSolveValue::deqn: Equation or list of equations expected instead of True in the first argument where it is equating the differential boundary conditions equal to True instead of as a boundary condition. I have added code to the original question. This was the first method I tried. $\endgroup$
    – dowlguest
    Commented Nov 14, 2015 at 0:11
  • $\begingroup$ @dowlguest Try using the recommendation in my earlier answer: (D[T[t, r, z], r] /. r -> 0) == 0, (D[T[t, r, z], z] /. z -> 0) == 0. However, you then will receive Infinite expression 1/0. encountered. >>, because the PDE is singular at r = 0. To solve that problem, use some small number, say r0 = 0.1 as the inner boundary condition on r. $\endgroup$
    – bbgodfrey
    Commented Nov 14, 2015 at 1:11
  • $\begingroup$ Thank you for the help. The code you suggested works for reflective conditions but when I add a constant heat flux at the boundary I get another error. I am trying to have a constant heat flux when z=0 and I get the following error: NDSolveValue::ibcinc: Warning: boundary and initial conditions are inconsistent. >> All I did was change the code such that (D[T[t, r, z], z] /. z -> 0) == -100. Any suggestions for eliminating this error? $\endgroup$
    – dowlguest
    Commented Nov 15, 2015 at 4:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.