# Setting derivative boundary conditions in NDSolve

Posted 9 years ago
22788 Views
|
8 Replies
|
4 Total Likes
|
 Hi, all I'm testing mathematica for 30 days. I've several questions: the first one: Is here the right place to do that? If not, please tell me, where I can do that!Actually I test PDE solutions ( transient heat conduction). Has anyone an idea, why the following PDE example from the Help Documentation worksNDSolve[{D[u[t, x], t] == D[u[t, x], x, x],  u[0, x] == 0,   u[t, 0] == Sin[t],  u[t, 5] == 0},                 u, {t, 0,   10}, {x, 0, 5}]while the following example ( I've changed one boundary condition- I hope, that was the only change- ) doesn't:NDSolve[{D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0,   u[t, 0] == Sin[ t],    D[u[t, 5], x] == 0}, u, {t, 0, 10}, {x, 0,   5}]what is my mistake? hopefully, later on I want solve the following problem:a one dimensional bar (constant heat conductivity, density, heat capacity) is heated ( or cooled) at one end with a given, time dependent fluidtemperature distribution (as a function or at discrete times with interpolation). The heat transfer coefficient is assumed to be constant.The other end of the bar is assumed to be isolated( dT/dx=0)After my first insights in mathematica examples, I think this could be done with mathematica and in an CDF document ( with or without mathematica?) with the following options:changing the material coefficients ( perhaps from mathematica databases or a own one)changing the given, time dependent fluidtemperature distributionand, at top: changing the initial and the possible boundary conditions ( I've seen a comparable CDF document: beam deflection with different boundary conditions)choosing between different solution presentations:3D plot ( temperature distribution as function of space and time)2d plot temperature vs bar length ( at different times)table form temperature vs bar length ( at different times)maybe, that this example is too complicated for a newbie?but anyway, thank you so much for any help!Peter
8 Replies
Sort By:
Posted 9 years ago
 The mistake is that this:D[u[t, 5], x] == 0evaluates to True, because u[t,5] does not depend on x anymore and so the derivative is zero.To write what you want to achieve, first take the derivative of u[t,x] and then replace x with zero:(D[u[t, x], x] /. x -> 0)The whole NDSolve expression then becomes:NDSolve[{ D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0, u[t, 0] == Sin[t], (D[u[t, x], x] /. x -> 0) == 0}, u, {t, 0, 10}, {x, 0, 5}]
Posted 9 years ago
 Hi Arnoud,thank you so much for your help. It works fine!Peter
Posted 9 years ago
 Good to hear. I've updated the post title from 'newbie questions' to something more descriptive. Thank you for using Mathematica. Let us know if you have other questions we can help you with.
Posted 2 years ago
 Hello, all Following the related discussion, I have an error in my written code that I don't have any idea to solve it. the problem is I have 6 partial differential equations of two variables, i.e; x and t. These equations must be solved together in the related initial and boundary conditions.NDSolve[{f1, f2, f3, f4, f5, f6, u[x, 1] == 0, ae[x, 1] == 1, ai[x, 1] == 1, n[x, 1] == 7.2 , p1[x, 1] == 1.152 , p2[x, 1] == 1.152 , u[0.01, t] == 0, (D[ae[x, t], x] /. x -> 0.01) == 0, (D[ai[x, t], x] /. x -> 0.01) == 0}, {u, ae, ai, n, p1, p2}, {t, 1, 10}, {x, 0.01, 0.1}]in related code, f1, ....f6 are the functions which are functions of u[x,t], ae[x,t], ai[x,t], n[x,t], p1[x,t], p2[x,t]. when I run my code, I see the answer written below:NDSolve::bdord: Boundary condition (Ti^(1,0))[0.01,t] should have derivatives of order lower than the differential order of the partial differential equation.My initial and boundary conditions are completely correct. I would be grateful if you help me to solve the problem.thank you.
Posted 9 years ago
 Hi Arnoud,I will purchase the program, but before I've some questions. I've got some emails from your company. Should I ask my questions there or at your contact option in my test version. I've found no way to contact you. I think this place here is the wrong one for my general questions. Do you have my email adress?   Please delete this answer here, because it doesn't belong to the mathematical problem. Thank you!Peter
Posted 9 years ago
 If you have technical questions about Mathematica and its functionality during your trial period, the best place to ask those would be Wolfram Technical Support (support@wolfram.com). When emailing them, please including your license number or activation key along with a description of the problem and maybe notebook with an example of it.
Posted 2 years ago
 Hello, all Following the related discussion, I have an error in my written code that I don't have any idea to solve it. the problem is I have 6 partial differential equation of two variables, i.e; x and t. These equations must be solved together in the related initial and boundary conditions. NDSolve[{f1, f2, f3, f4, f5, f6, u[x, 1] == 0, ae[x, 1] == 1, ai[x, 1] == 1, n[x, 1] == 7.2 , p1[x, 1] == 1.152 , p2[x, 1] == 1.152 , u[0.01, t] == 0, (D[ae[x, t], x] /. x -> 0.01) == 0, (D[ai[x, t], x] /. x -> 0.01) == 0}, {u, ae, ai, n, p1, p2}, {t, 1, 10}, {x, 0.01, 0.1}]in related code, f1, ....f6 are the functions which are functions of u[x,t], ae[x,t], ai[x,t], n[x,t], p1[x,t], p2[x,t]. when I run my code, I see the answer written below:NDSolve::bdord: Boundary condition (Ti^(1,0))[0.01,t] should have derivatives of order lower than the differential order of the partial differential equation.My initial and boundary conditions are completely correct. I would be grateful if you help me to solve the problem.thank you.
Posted 2 years ago
 You can use the Mathematica function 'Derivative'.NDSolve[{D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0, u[t, 0] == Sin[t], Derivative[0, 1][u][t, 5] == 0}, u, {t, 0, 10}, {x, 0, 5}] Plot3D[u[t, x] /. %, {x, 0, 5}, {t, 0, 10}]
Community posts can be styled and formatted using the Markdown syntax.