NDSolve Question
- To: mathgroup at smc.vnet.net
- Subject: [mg19370] NDSolve Question
- From: Don Paddleford <don-paddleford at worldnet.att.net>
- Date: Fri, 20 Aug 1999 23:09:43 -0400
- Organization: AT&T WorldNet Services
- Sender: owner-wri-mathgroup at wolfram.com
Using NDSolve to solve differential equations I have run across many problems where I would like to initiate (or terminate) some action based on the dependent variable reaching a setvalue. Examples are: 1) Trying to maintain level between desired upper and lower limits in a vessel that has a leak by turning the pump on and off. 2) A closed system with internal gas generation that will buildup to the rupture pressure of a rupture disk, at which time a gas blowdown would begin. 3) Initiate a shutdown when the temperature or temperature gets too high, etc. The brute force way of running the problem first without any actions,and noting the time (or whatever the independent variable is) when the dependent variable first reaches the point where action is desired, then rerunning the problem with the action initiating at that time (perhaps by using an If test based on the noted time, or some function based on time), is what I usually end up having to do. It works, but is tedious. I'd like to be able to just have a test on the dependent variable, so that it having reached a predetermined value, I could initiate a pump trip, or start a gas blowdown, etc. Have a hunch the answer may be simple---but I seem to have a mental block on how to do this with Mathematica's NDSolve. Any help would be appreciated. Don