~reducedmodelling/fluidity/ROM_Non-intrusive-ann

« back to all changes in this revision

Viewing changes to tests/shallow_water_optimisation/source_terms.py

  • Committer: Simon Funke
  • Date: 2011-06-01 19:46:34 UTC
  • mto: (3425.14.1 adjoint)
  • mto: This revision was merged to the branch mainline in revision 3521.
  • Revision ID: simon.funke@gmail.com-20110601194634-pu9tmo4zf6o3btgt
optimisation example and schema's

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# This file was *autogenerated* from the file source_terms.sage.
 
2
from sage.all_cmdline import *   # import sage library
 
3
_sage_const_2 = Integer(2); _sage_const_1 = Integer(1); _sage_const_0 = Integer(0)
 
4
t = var('t')
 
5
h = var('h')
 
6
g = var('g')
 
7
H = var('H')
 
8
 
 
9
# --------------------------------------------------
 
10
 
 
11
u = (t+_sage_const_1 )*h*sin(_sage_const_2 *pi*x)
 
12
eta = (t+_sage_const_1 )*h*cos(_sage_const_2 *pi*x)
 
13
 
 
14
u_src = diff(u, t) + g*diff(eta, x)
 
15
eta_src = diff(eta, t) + diff(H*u, x)
 
16
 
 
17
print "u: ", u
 
18
print "eta: ", eta
 
19
 
 
20
print "u_src: ", u_src
 
21
print "eta_src: ", eta_src
 
22
 
 
23
J = integrate((eta.subs(t=_sage_const_1 ))**_sage_const_2 , x, _sage_const_0 , _sage_const_1 )
 
24
print "J(t=1): ", J.subs(h=_sage_const_1 )
 
25
print "diff(J(t=1), h).subs(h=1): ", diff(J, h).subs(h=_sage_const_1 )
 
26
J = integrate((eta.subs(t=_sage_const_0 ))**_sage_const_2 , x, _sage_const_0 , _sage_const_1 )
 
27
print "J(t=0): ", J.subs(h=_sage_const_1 )
 
28
print "diff(J(t=0), h).subs(h=1): ", diff(J, h).subs(h=_sage_const_1 )