NDSolve, coupled equations, different number of variables
- To: mathgroup at smc.vnet.net
- Subject: [mg48736] NDSolve, coupled equations, different number of variables
- From: "Stergios J. Papadakis" <stergios.papadakis at jhuapl.edu>
- Date: Fri, 11 Jun 2004 23:59:05 -0400 (EDT)
- Organization: Johns Hopkins University Applied Physics Lab, Laurel, MD, USA
- Sender: owner-wri-mathgroup at wolfram.com
Dear group, I am trying to numerically solve a set of two coupled equations. I'll describe how they come about to motivate this. I have a harmonic oscillator (z''[t] + gamma*z'[t]+(omegbarmod[T])^2*z[t] == 0). However, the spring constant of that oscillator depends on its temperature (omegabarmod is a funtion of T: omegabarmod[T]). The temperature of the spring depends on the heat flow into the spring, which depends on the position of the oscillator. Using the 1-D heat equation with boundary/initial conditions: D[T[x, t], {t, 1}] == tdiff*D[T[x, t], {x, 2}], T[x, 0] == 0, T[0, t] == 0, (D[T[x, t], {x, 1}] /. x -> barlength/2) == heatin[z[t]] So, the position of the oscillating beam governs the heat input, which is a time-varying Neumann boundary condition on the homogenous heat equation governing the temperature of the bar, and the spring constant of the oscillator is a function of the temperature of the bar at its center. If I try: result = NDSolve[{D[z[t], {t, 2}] + gamma*D[z[t], {t, 1}] == -(omegabarmod[T[barlength/2, t]])^2*z[t], D[T[x, t], {t, 1}] == tdiff*D[T[x, t], {x, 2}], T[x, 0] == 0, T[0, t] == 0, (D[T[x, t], {x, 1}] /. x -> barlength/2) == (1 - E^(-t/(Pi/10^8)))*heatin[z[t]]/2, z[0] == initialposition, (D[z[t], {t, 1}] /. t -> 0) == 0}, {z, T}, {t, 0, numperiods*2*Pi/omegadrive}, {x, 0, barlength/2}]; (with all of the constants and the functions heatin[T] and omegabarmod[T] defined previously, or course) I get: NDSolve::derlen:The length of the derivative operator Derivative[1] in z'[t] is not the same as the number of arguments Basically, it looks like it will not let me solve a system of equations where z is a function of t only and T is a function of x and t. I have also tried using the total derivative Dt in place of D for the oscillator equation, but I get the same result. I've run a bunch of test cases where I put independent equations and boundary conditions into NDSolve. It only solves them if they are functions of the same number of variables. Then I couple them together in some way, and it still solves them. So, the problem really seems to be that I can't solve for z[t] and T[x,t]. I have spent a lot of time trying things like making z[x,t] a function of both x and t anyway, and trying to set up the boundary conditions in a way that makes z essentially independent of x. If I decouple the equations and use z[x,t] and T[x,t], it solves them, giving the solution that z is independent of x, which would be fine. However, when I couple the equations again, I get underdetermined or overdetermined system errors. If you have any ideas on how to pose this problem to Mathematica I'd appreciate your help. Thanks very much, Stergios