# Diff of /trunk/escript/py_src/mountains.py

revision 3431 by jfenwick, Mon Oct 11 01:48:14 2010 UTC revision 3432 by jfenwick, Fri Jan 7 01:32:07 2011 UTC
21
22  from esys.escript import *  from esys.escript import inf, atan, Lsup, log, whereZero, Vector, Solution, Scalar, length, interpolate, vol, integrate
23    import esys.escript as escript
24  from esys.escript.linearPDEs import LinearPDE, SolverOptions  from esys.escript.linearPDEs import LinearPDE, SolverOptions
25
26  import math  import math
# Line 50  class Mountains: Line 51  class Mountains:
51      :param domain: the domain where the mountains is used      :param domain: the domain where the mountains is used
52      :param eps: the smoothing parameter for (1)      :param eps: the smoothing parameter for (1)
53      """      """
54      order=Solution(domain).getApproximationOrder()      order=escript.Solution(domain).getApproximationOrder()
55      if order>1:      if order>1:
56          reduced = True          reduced = True
57          if ReducedSolution(domain).getApproximationOrder()>1: raise ValueError,"Reduced order needs to be equal to 1."          if ReducedSolution(domain).getApproximationOrder()>1: raise ValueError,"Reduced order needs to be equal to 1."
# Line 65  class Mountains: Line 66  class Mountains:
66
67      self.__PDE_W = LinearPDE(domain)      self.__PDE_W = LinearPDE(domain)
68      self.__PDE_W.setSymmetryOn()      self.__PDE_W.setSymmetryOn()
69      A=kronecker(domain)*eps*0      A=escript.kronecker(domain)*eps*0
70      A[self.__DIM-1,self.__DIM-1]=(0.3*(sup(z)-inf(z))/log(2.))**2      A[self.__DIM-1,self.__DIM-1]=(0.3*(escript.sup(z)-inf(z))/log(2.))**2
71      # A[self.__DIM-1,self.__DIM-1]=(sup(FunctionOnBoundary(self.__domain).getSize())/log(2.))**2      # A[self.__DIM-1,self.__DIM-1]=(sup(FunctionOnBoundary(self.__domain).getSize())/log(2.))**2
72      self.__PDE_W.setValue(D=1, A=A, q=whereZero(sup(z)-z)+whereZero(inf(z)-z))      self.__PDE_W.setValue(D=1, A=A, q=whereZero(escript.sup(z)-z)+whereZero(inf(z)-z))
73
74      self.__PDE_H = LinearPDE(domain)      self.__PDE_H = LinearPDE(domain)
75      self.__PDE_H.setSymmetryOn()      self.__PDE_H.setSymmetryOn()
# Line 108  class Mountains: Line 109  class Mountains:
109        self.__v=Vector(0.,Solution(self.getDomain()))        self.__v=Vector(0.,Solution(self.getDomain()))
110        if not v == None:        if not v == None:
111          xi=self.getDomain().getX()[self.getDomain().getDim()-1]          xi=self.getDomain().getX()[self.getDomain().getDim()-1]
112          v=(xi-inf(xi))/(sup(xi)-inf(xi))*v          v=(xi-inf(xi))/(escript.sup(xi)-inf(xi))*v
113          for d in range(self.__DIM):          for d in range(self.__DIM):
114             self.__PDE_W.setValue(r=v[d])             self.__PDE_W.setValue(r=v[d])
115             self.__v[d]=self.__PDE_W.getSolution()             self.__v[d]=self.__PDE_W.getSolution()

Legend:
 Removed from v.3431 changed lines Added in v.3432