/[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 4115 by gross, Fri Dec 14 04:48:48 2012 UTC revision 4116 by gross, Fri Dec 14 07:21:14 2012 UTC
# Line 712  class SyntheticData(SyntheticDataBase): Line 712  class SyntheticData(SyntheticDataBase):
712      """      """
713      defines synthetic  gravity/magnetic data based on harmonic property anomaly      defines synthetic  gravity/magnetic data based on harmonic property anomaly
714            
715          rho = mean + amplitude * sin(n_depth * pi /depth * z) * sin(n_length * pi /length * x - shift )          rho = mean + amplitude * sin(n_depth * pi /depth * (z+depth_offset)) * sin(n_length * pi /length * x - shift )
716                    
717      for all x and z<=0. for z>0 rho = 0.              for all x and z<=0. for z>0 rho = 0.        
718      """      """
719      def __init__(self, datatype,      def __init__(self, datatype,
720                         n_length=1,                         n_length=1,
721                         n_depth=1,                         n_depth=1,
722                         shift=0.,                         depth_offset=0.,
723                           depth=None,
724                         amplitude=None,                         amplitude=None,
725                         DIM=2,                         DIM=2,
726                         number_of_elements=10,                         number_of_elements=10,
# Line 734  class SyntheticData(SyntheticDataBase): Line 735  class SyntheticData(SyntheticDataBase):
735          :param n_length: number of oscillation in the anomaly data within the observation region.          :param n_length: number of oscillation in the anomaly data within the observation region.
736          :type n_length: ``int``          :type n_length: ``int``
737          :param n_depth: number of oscillation in the anomaly data below surface          :param n_depth: number of oscillation in the anomaly data below surface
738          :param shift: lateral phase shift in the  anomaly data          :param depth: vertical extend in the  anomaly data. If not present the depth of the domain is used.
739            :type depth: ``float``
740          :param amplitude: data amplitude. Default value is 200 *U.kg/U.m**3 for gravity and 0.1 for magnetic data.          :param amplitude: data amplitude. Default value is 200 *U.kg/U.m**3 for gravity and 0.1 for magnetic data.
741          :param features: list of features. It is recommended that the features do entirely lay below surface.          :param features: list of features. It is recommended that the features do entirely lay below surface.
742          :type features: ``list`` of ``SourceFeature``          :type features: ``list`` of ``SourceFeature``
# Line 761  class SyntheticData(SyntheticDataBase): Line 763  class SyntheticData(SyntheticDataBase):
763                                   spherical=spherical)                                   spherical=spherical)
764          self.__n_length = n_length          self.__n_length = n_length
765          self.__n_depth = n_depth          self.__n_depth = n_depth
766          self.__shift = shift          self.depth = depth
767            self.depth_offset=depth_offset
768          if amplitude == None:          if amplitude == None:
769          if datatype == DataSource.GRAVITY:          if datatype == DataSource.GRAVITY:
770              amplitude = 200 *U.kg/U.m**3              amplitude = 200 *U.kg/U.m**3
# Line 781  class SyntheticData(SyntheticDataBase): Line 784  class SyntheticData(SyntheticDataBase):
784              x=domain.getX()              x=domain.getX()
785              # set the reference data              # set the reference data
786              z=x[DIM-1]              z=x[DIM-1]
787              k=sin(self.__n_depth * np.pi/inf(z) * z) * whereNegative(z) * self.__amplitude              dd=self.depth
788                if  dd ==None :  dd=inf(z)
789                z2=(z+self.depth_offset)/(self.depth_offset-dd)
790                k=sin(self.__n_depth * np.pi  * z2) * whereNonNegative(z2) * whereNonPositive(z2-1.) * self.__amplitude
791              for i in xrange(DIM-1):              for i in xrange(DIM-1):
792             k*= sin(self.__n_length * np.pi /self.__length * x[i] - shift )             x_i=x[i]
793               m=whereNonNegative(x_i)*whereNonNegative(self.length-x_i)
794               k*= sin(self.__n_length*np.pi /self.length * x_i)*m
795              self._reference_data= k              self._reference_data= k
796          return self._reference_data          return self._reference_data
797    

Legend:
Removed from v.4115  
changed lines
  Added in v.4116

  ViewVC Help
Powered by ViewVC 1.1.26