nonlinode

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > ODE >

nonlinode

Previous pageReturn to chapter overviewNext page

{ NONLINODE.PDE  

 

 This example shows the application of FlexPDE to the solution of a

 non-linear first-order differential equation.

 

 A liquid flows into the top of a reactor vessel through an unrestricted

 pipe and exits from the bottom through a choke value.  This problem is

 discussed in detail in Silebi and Schiesser.

 

 This is a problem in viscous flow:  

    dH/dt = a - b*sqrt(H)

 

 The analytic solution satisfies the relation  

    sqrt(H0) + (a/b)ln[a-b*sqrt(H0)]

     - sqrt(H) - (a/b)ln[a-b*sqrt(H)] = (b/2)*t

 

 which can be used as an accuracy check.

 

 Since FlexPDE requires a spatial domain, we solve the equation on  

 a simple box with minimum mesh size.

 

}  

 

title  

"NONLINEAR FIRST ORDER ORDINARY DIFFERENTIAL EQUATION"  

 

select  

{ Since there is no spatial information required, use the minimum grid size }  

 ngrid=1                

 

variables  

{ declare Height to be the system variable }  

 Height(threshold=1)    

 

definitions  

{ define the equation parameters }  

 a = 2                  

 b = 0.1  

 H0 = 100  

{ define the accuracy check }  

 T0 = sqrt(H0) + (a/b)*ln(a-b*sqrt(H0))  

 Tcheck = sqrt(Height) + (a/b)*ln(a-b*sqrt(Height))  

 

initial values  

 Height = H0  

 

equations   { The ODE }  

 Height : dt(Height)  = a - b*sqrt(Height)  

 

boundaries  

{ define a fictitious spatial domain }  

region 1                

  start (0,0)  

  line to (1,0) to (1,1) to (0,1) to close  

 

{ define the time range }  

time 0 to 1000            

 

plots  

for t=0, 1, 10 by 10 to endtime  

  { Plot the solution: }  

  history(Height) at (0.5,0.5)  

  { Plot the accuracy check: }  

  history((T0 - Tcheck - (b/2)*t)/((b/2)*t)) at (0.5,0.5)  

              as "Relative Error"  

 

end