~reducedmodelling/fluidity/ROM_Non-intrusive-ann

« back to all changes in this revision

Viewing changes to tests/shallow_water_optimisation/constants.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
from math import sin, cos, pi
 
2
import numpy
 
3
 
 
4
# h is the control variable and changes in 
 
5
# each optimisation each iteration
 
6
h = numpy.load("control.npy")[0]
 
7
d0 = 0.5
 
8
theta = 0.5
 
9
g = 0.1
 
10
functional = 2
 
11
dfunctional = 4
 
12
 
 
13
def eta_src(x, t):
 
14
  return 2*(t + 1)*d0*pi*h*cos(2*pi*x) + h*cos(2*pi*x)
 
15
 
 
16
def u_src(x, t):
 
17
  return numpy.array([-2*(t + 1)*pi*g*h*sin(2*pi*x) + h*sin(2*pi*x),0,0])
 
18
 
 
19
def u_exact(x, t):
 
20
  return numpy.array([(t+1)*h*sin(2*pi*x), 0.0, 0.0])
 
21
 
 
22
def eta_exact(x, t):
 
23
  return (t+1)*h*cos(2*pi*x)