~libadjoint/dolfin-adjoint/applications

« back to all changes in this revision

Viewing changes to stokes_topology/reimplementation/bcs.py

  • Committer: Simon Funke
  • Date: 2013-12-19 14:29:26 UTC
  • Revision ID: simon.funke@gmail.com-20131219142926-qnw1037p2ekogiyu
Implement Example4. Also converges nicely to the expected solution.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
  def value_shape(self):
23
23
    return (2,)
 
24
 
 
25
class BCExample4(Expression):
 
26
  gbar     = 1.0
 
27
  l        = 1.0/6.0
 
28
  delta    = 1.0
 
29
 
 
30
  def eval(self, values, x):
 
31
    values[1] = 0.0
 
32
    values[0] = 0.0
 
33
 
 
34
    if x[0] == 0.0 or x[0] == self.delta:
 
35
      if (1.0 / 4 - self.l / 2) < x[1] < (1.0 / 4 + self.l / 2):
 
36
        t = x[1] - 1.0/4
 
37
        values[0] = self.gbar * (1 - (2 * t / self.l)**2)
 
38
      if (3.0 / 4 - self.l / 2) < x[1] < (3.0 / 4 + self.l/2):
 
39
        t = x[1] - 3.0/4
 
40
        values[0] = self.gbar * (1 - (2 * t / self.l)**2)
 
41
 
 
42
  def value_shape(self):
 
43
    return (2,)