/[escript]/trunk/escript/py_src/mountains.py
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2563 by gross, Tue Jul 28 03:50:45 2009 UTC revision 2564 by gross, Tue Jul 28 04:46:38 2009 UTC
# Line 35  class Mountains: Line 35  class Mountains:
35        where w_hat=w*[1,1,0], dt<0.5*d/max(w_i), d is a characteristic element size; H(x_3=1)=lambda (?)        where w_hat=w*[1,1,0], dt<0.5*d/max(w_i), d is a characteristic element size; H(x_3=1)=lambda (?)
36                
37    """    """
38    def __init__(self,domain,eps=0.01):    def __init__(self,domain,eps=0.01, reduced=False):
39      """      """
40      Sets up the level set method.      Sets up the level set method.
41    
42      @param domain: the domain where the mountains is used      @param domain: the domain where the mountains is used
43      @param eps: the smoothing parameter for (1)      @param eps: the smoothing parameter for (1)
44        @param reduced: if True topography reduced order is used for reconstruction of internal velocity and topography
45      """      """
46      if eps<=0:      if eps<=0:
47          raise ValueError("Smmoting parameter eps must be positive.")          raise ValueError("Smmoting parameter eps must be positive.")
48      self.__domain = domain      self.__domain = domain
49      self.__eps = eps      self.__eps = eps
50        self.__reduced=reduced
51      self.__DIM=domain.getDim()      self.__DIM=domain.getDim()
52      z=domain.getX()[self.__DIM-1]      z=domain.getX()[self.__DIM-1]
53    
54      self.__PDE_W = LinearPDE(domain)      self.__PDE_W = LinearPDE(domain)
55      self.__PDE_W.setSymmetryOn()      self.__PDE_W.setSymmetryOn()
56        if reduced: self.__PDE_W.setReducedOrderOn()
57      A=kronecker(domain)      A=kronecker(domain)
58      A[self.__DIM-1,self.__DIM-1]=1/self.__eps      A[self.__DIM-1,self.__DIM-1]=1/self.__eps
59      self.__PDE_W.setValue(A=A, q=whereZero(sup(z)-z)+whereZero(inf(z)-z))      self.__PDE_W.setValue(A=A, q=whereZero(sup(z)-z)+whereZero(inf(z)-z))
60    
61      self.__PDE_H = LinearPDE(domain)      self.__PDE_H = LinearPDE(domain)
62      self.__PDE_H.setSymmetryOn()      self.__PDE_H.setSymmetryOn()
63        if reduced: self.__PDE_H.setReducedOrderOn()
64      self.__PDE_H.setValue(D=1.0)      self.__PDE_H.setValue(D=1.0)
65      self.__PDE_H.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)      self.__PDE_H.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
66      self.__PDE_H.setValue(q=whereZero(inf(z)-z))      self.__PDE_H.setValue(q=whereZero(inf(z)-z))
# Line 88  class Mountains: Line 92  class Mountains:
92        @type v: vector        @type v: vector
93        """        """
94        self.__dt=None        self.__dt=None
95        self.__v=Vector(0.,Solution(self.getDomain()))        if self.__reduced:
96             fs=ReducedSolution(self.getDomain())
97          else:
98             fs=Solution(self.getDomain())
99          self.__v=Vector(0.,fs)
100        if not v == None:        if not v == None:
101          z=self.getDomain().getX()[self.__DIM-1]          z=self.getDomain().getX()[self.__DIM-1]
102          z_min=inf(z)          z_min=inf(z)
# Line 111  class Mountains: Line 119  class Mountains:
119      @param H: the topography.  If None zero is used.      @param H: the topography.  If None zero is used.
120      @type H: scalar      @type H: scalar
121      """      """
122        if self.__reduced:
123             fs=ReducedSolution(self.getDomain())
124        else:
125             fs=Solution(self.getDomain())
126    
127      if H==None:      if H==None:
128         self.__H=Scalar(0.0, Solution(self.getDomain()))         self.__H=Scalar(0.0, fs)
129      else:      else:
130         self.__H=interpolate(H, Solution(self.getDomain()))         self.__H=interpolate(H, fs)
131                
132    def getTopography(self):    def getTopography(self):
133       """       """

Legend:
Removed from v.2563  
changed lines
  Added in v.2564

  ViewVC Help
Powered by ViewVC 1.1.26