theneq+time

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > Sequenced_Equations >

theneq+time

Previous pageReturn to chapter overviewNext page

{ THENEQ+TIME.PDE

   

   This example demonstrates the use of sequenced equations in time-dependent problems.

 

   The variable U is given a source consistent with the desired solution of  

       U=A-(x^2+y^2)

   The variable V has a source equal to -U.  The analytic solution to this equation is  

       V = A*(x^2+y^2)/4 - (x^4+y^4)/12

   The variable V therefore depends strongly on U, but U is unaffected by V.  

 

   In this case, we can separate the equations and solve for V in a THEN clause.

 

}  

title 'Sequenced equations in time-dependent systems'  

 

select ngrid=40  

 

variables  

   u(0.01),v(0.01)  

 

definitions  

   k = 1  

   a=2  

  ! analytic solutions

   u0 = (a-x^2-y^2)  

   v0 = (a*(x^2+y^2)/4-(x^4+y^4)/12)  

 

equations  

   u: div(K*grad(u)) + 4 = dt(u)  

then  

   v: div(K*grad(v)) - u = dt(v)  

 

boundaries  

  Region 1  

  start(-1,-1)  

    ! ramp the boundary values, so that the initial BV's are consistent with the initial interior values.

    value(u)=u0*Uramp(t, t-10)          

    value(v)=v0*Uramp(t, t-10)  

  line to (1,-1) to (1,1) to (-1,1) to close  

 

time 0 to 100  

 

plots  

  for cycle=10  

    contour(u)  paint  

    surface(u)  

    contour(v)  paint  

    surface(v)  

    elevation(u,div(K*grad(v))) from(-1,0) to (1,0)  

    history(u,v) at (0,0)  

 

end