/[escript]/trunk/downunder/py_src/datasources.py
ViewVC logotype

Diff of /trunk/downunder/py_src/datasources.py

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

revision 4032 by gross, Wed Oct 24 08:06:15 2012 UTC revision 4034 by caltinay, Thu Oct 25 02:54:01 2012 UTC
# Line 749  class SmoothAnomaly(SourceFeature): Line 749  class SmoothAnomaly(SourceFeature):
749          self.rho_inner=rho_inner          self.rho_inner=rho_inner
750          self.rho_outer=rho_outer          self.rho_outer=rho_outer
751          self.rho=None          self.rho=None
752        
753      def getDensity(self):      def getDensity(self):
754          return self.rho          return self.rho
755    
756      def getMask(self, x):      def getMask(self, x):
757          DIM=x.getDomain().getDim()          DIM=x.getDomain().getDim()
758          m=whereNonNegative(x[DIM-1]-(sup(x[DIM-1])-self.depth-self.lz/2)) * whereNonPositive(x[DIM-1]-(sup(x[DIM-1])-self.depth+self.lz/2)) \          m=whereNonNegative(x[DIM-1]-(sup(x[DIM-1])-self.depth-self.lz/2)) * whereNonPositive(x[DIM-1]-(sup(x[DIM-1])-self.depth+self.lz/2)) \
759              *whereNonNegative(x[0]-(self.x-self.lx/2)) * whereNonPositive(x[0]-(self.x+self.lx/2))              *whereNonNegative(x[0]-(self.x-self.lx/2)) * whereNonPositive(x[0]-(self.x+self.lx/2))
760          if DIM>2:          if DIM>2:
761              m*=whereNonNegative(x[1]-(self.y-self.ly/2)) * whereNonPositive(x[1]-(self.y+self.ly/2))              m*=whereNonNegative(x[1]-(self.y-self.ly/2)) * whereNonPositive(x[1]-(self.y+self.ly/2))
762          if self.rho is None:          if self.rho is None:
# Line 765  class SmoothAnomaly(SourceFeature): Line 765  class SmoothAnomaly(SourceFeature):
765              rho=rho*exp(-alpha*((x[DIM-1]-(sup(x[DIM-1])-self.depth))/self.lz)**2)              rho=rho*exp(-alpha*((x[DIM-1]-(sup(x[DIM-1])-self.depth))/self.lz)**2)
766              self.rho=maximum(abs(self.rho_outer), abs(self.rho_inner*rho))              self.rho=maximum(abs(self.rho_outer), abs(self.rho_inner*rho))
767              if self.rho_inner<0: self.rho=-self.rho              if self.rho_inner<0: self.rho=-self.rho
768          return m              return m
769    
770  ##############################################################################  ##############################################################################
771  class SyntheticDataSource(DataSource):  class SyntheticDataSource(DataSource):
# Line 798  class SyntheticDataSource(DataSource): Line 798  class SyntheticDataSource(DataSource):
798              self.logger.debug("Domain size: %d x %d elements"%(NE_new[0], NE_new[1]))              self.logger.debug("Domain size: %d x %d elements"%(NE_new[0], NE_new[1]))
799              self.logger.debug("     length: %g x %g"%(l_new[0],l_new[1]))              self.logger.debug("     length: %g x %g"%(l_new[0],l_new[1]))
800              self.logger.debug("     origin: %g x %g"%(origin_new[0],origin_new[1]))              self.logger.debug("     origin: %g x %g"%(origin_new[0],origin_new[1]))
801          else:            else:
802              from esys.finley import Brick              from esys.finley import Brick
803              dom = Brick(n0=NE_new[0], n1=NE_new[1], n2=NE_new[2], l0=l_new[0], l1=l_new[1], l2=l_new[2])              dom = Brick(n0=NE_new[0], n1=NE_new[1], n2=NE_new[2], l0=l_new[0], l1=l_new[1], l2=l_new[2])
804              self._x = dom.getX() + origin_new              self._x = dom.getX() + origin_new

Legend:
Removed from v.4032  
changed lines
  Added in v.4034

  ViewVC Help
Powered by ViewVC 1.1.26