/[escript]/trunk/modellib/py_src/input.py
ViewVC logotype

Diff of /trunk/modellib/py_src/input.py

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

revision 148 by jgs, Tue Aug 23 01:24:31 2005 UTC revision 149 by jgs, Thu Sep 1 03:31:39 2005 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2  from escript.escript import *  from esys.escript import *
3  from escript.modelframe import Model,ParameterSet  from esys.escript.modelframe import Model,ParameterSet
4  from math import log  from math import log
5    
6  class Sequencer(Model):  class Sequencer(Model):
# Line 9  class Sequencer(Model): Line 9  class Sequencer(Model):
9      """      """
10      def __init__(self,t=0.,t_end=Model.UNDEF_DT,dt_max=Model.UNDEF_DT,debug=False):      def __init__(self,t=0.,t_end=Model.UNDEF_DT,dt_max=Model.UNDEF_DT,debug=False):
11          """          """
12             @param t_end: - model is terminated when t_end is passed  (exposed in writeXML)          @param t_end: - model is terminated when t_end is passed  
13             @type t_end: float                     (exposed in writeXML)
14             @param dt_max: - maximum time step size          @type t_end: float
15             @type dt_max: float          @param dt_max: - maximum time step size
16             @param t: - initial time          @type dt_max: float
17             @type t: float          @param t: - initial time
18            @type t: float
19    
20           """          """
21          Model.__init__(self,debug=debug)          Model.__init__(self,debug=debug)
22          self.declareParameter(t=t, \          self.declareParameter(t=t, \
23                                t_end=t_end,  \                                t_end=t_end,  \
# Line 24  class Sequencer(Model): Line 25  class Sequencer(Model):
25    
26      def doInitialization(self):      def doInitialization(self):
27          """          """
28              @brief initialize time integration          initialize time integration
29          """          """
30          self.__t_old = self.t          self.__t_old = self.t
31    
# Line 48  class Sequencer(Model): Line 49  class Sequencer(Model):
49    
50  class GaussianProfile(ParameterSet):  class GaussianProfile(ParameterSet):
51      """      """
52      Generates a gaussian profile at center x_c, width width and height A      Generates a Gaussian profile at center x_c, width width and height A
53      over a domain      over a domain
54    
55      @param domain: (in) - domain      @ivar domain (in): domain
56      @param x_c: (in)  - center of the Gaussian profile (default [0.,0.,0.])      @ivar x_c (in): center of the Gaussian profile (default [0.,0.,0.])
57      @param A: (in)  - height of the profile. A maybe a vector. (default 1.)      @ivar A (in): height of the profile. A maybe a vector. (default 1.)
58      @param width: (in) - width of the profile (default 0.1)      @ivar width (in): width of the profile (default 0.1)
59      @param r: (in) -  radius of the circle (default = 0)      @ivar r (in): radius of the circle (default = 0)
60      @param out: (callable) - profile      @ivar out (callable): profile
61    
62      In the case that the spatial dimension is two, The third component of      In the case that the spatial dimension is two, The third component of
63      x_c is dropped      x_c is dropped
# Line 70  class GaussianProfile(ParameterSet): Line 71  class GaussianProfile(ParameterSet):
71                                r=0)                                r=0)
72    
73      def out(self):      def out(self):
74            """
75            Generate the Gaussian profile
76            """
77          x = self.domain.getX()          x = self.domain.getX()
78          dim = self.domain.getDim()          dim = self.domain.getDim()
79          l = length(x-self.x_c[:dim])          l = length(x-self.x_c[:dim])
# Line 82  class InterpolateOverBox(ParameterSet): Line 86  class InterpolateOverBox(ParameterSet):
86      Returns values at each time. The values are defined through given values      Returns values at each time. The values are defined through given values
87      at time node.      at time node.
88    
89      @param domain: (in) - domain      @ivar domain (in): domain
90      @param left_bottom_front: (in) - coordinates of left,bottom,front corner of the box      @ivar left_bottom_front (in): coordinates of left, bottom, front corner
91      @param right_top_back: (in) - coordinates of the right, top, back corner of the box                of the box
92      @param value_left_bottom_front: (in) - value at left,bottom,front corner      @ivar right_top_back (in): coordinates of the right, top, back corner
93      @param value_right_bottom_front: (in) - value at right, bottom, front corner                of the box
94      @param value_left_top_front: (in) - value at left,top,front corner      @ivar value_left_bottom_front (in): value at left,bottom,front corner
95      @param value_right_top_front: (in) - value at right,top,front corner      @ivar value_right_bottom_front (in): value at right, bottom, front corner
96      @param value_left_bottom_back: (in) - value at  left,bottom,back corner      @ivar value_left_top_front (in): value at left,top,front corner
97      @param value_right_bottom_back: (in) - value at right,bottom,back corner      @ivar value_right_top_front (in): value at right,top,front corner
98      @param value_left_top_back: (in) - value at left,top,back  corner      @ivar value_left_bottom_back (in): value at  left,bottom,back corner
99      @param value_right_top_back: (in) - value at right,top,back corner      @ivar value_right_bottom_back (in): value at right,bottom,back corner
100      @param out: (callable) - values at doamin locations by bilinear interpolation. for two dimensional domains back values are ignored.      @ivar value_left_top_back (in): value at left,top,back  corner
101        @ivar value_right_top_back (in): value at right,top,back corner
102        @ivar out (callable): values at domain locations by bilinear
103                  interpolation.  For two dimensional domains back values are
104                  ignored.
105      """      """
106    
107      def __init__(self, debug=False):      def __init__(self, debug=False):
# Line 157  class InterpolatedTimeProfile(ParameterS Line 165  class InterpolatedTimeProfile(ParameterS
165         For time t<nodes[0], value[0] is used and for t>nodes[l], values[l]         For time t<nodes[0], value[0] is used and for t>nodes[l], values[l]
166         is used where l=len(nodes)-1.         is used where l=len(nodes)-1.
167    
168         @param t: (in) - current time         @ivar t (in): current time
169         @param node: (in) - list of time nodes         @ivar node (in): list of time nodes
170         @param values: (in) - list of values at time nodes         @ivar values (in): list of values at time nodes
171         @param out: (callable) - current value         @ivar out (callable): current value
172         """         """
173    
174         def __init__(self,debug=False):         def __init__(self,debug=False):
# Line 185  class LinearCombination(Model): Line 193  class LinearCombination(Model):
193      """      """
194      Returns a linear combination of the f0*v0+f1*v1+f2*v2+f3*v3+f4*v4      Returns a linear combination of the f0*v0+f1*v1+f2*v2+f3*v3+f4*v4
195                            
196      @param f0: (in) numerical object or None (default: None)      @ivar f0 (in): numerical object or None (default: None)
197      @param v0: (in) numerical object or None (default: None)      @ivar v0 (in): numerical object or None (default: None)
198      @param f1: (in) numerical object or None (default: None)      @ivar f1 (in): numerical object or None (default: None)
199      @param v1: (in) numerical object or None (default: None)      @ivar v1 (in): numerical object or None (default: None)
200      @param f2: (in) numerical object or None (default: None)      @ivar f2 (in): numerical object or None (default: None)
201      @param v2: (in) numerical object or None (default: None)      @ivar v2 (in): numerical object or None (default: None)
202      @param f3: (in) numerical object or None (default: None)      @ivar f3 (in): numerical object or None (default: None)
203      @param v3: (in) numerical object or None (default: None)      @ivar v3 (in): numerical object or None (default: None)
204      @param f4: (in) numerical object or None (default: None)      @ivar f4 (in): numerical object or None (default: None)
205      @param v4: (in) numerical object or None (default: None)      @ivar v4 (in): numerical object or None (default: None)
206      @param out: (callable) - current value      @ivar out (callable): current value
207      """      """
208      def __init__(self,debug=False):      def __init__(self,debug=False):
209          Model.__init__(self,debug=debug)          Model.__init__(self,debug=debug)

Legend:
Removed from v.148  
changed lines
  Added in v.149

  ViewVC Help
Powered by ViewVC 1.1.26