Exemple #1
0
 def getVolume(self):
     """
   Returns the volume of the *phi(x)<0* region.
   """
     return integrate(
         es.whereNegative(
             self.__phi.interpolate(esc.Function(self.__domain))))
Exemple #2
0
 def getInterface(self,phi=None,smoothing_width=None):
     """
     creates a characteristic function which is 1 over the over the length
     *2*h*smoothing_width*  around the interface and zero elsewhere
     """
     if smoothing_width is None: smoothing_width = self.__smooth
     if phi is None: phi = self.__phi
     s=smoothing_width*self.__h 
     phi_on_h=es.interpolate(phi,esc.Function(self.__domain))
     return es.whereNegative(abs(phi_on_h)-s)
Exemple #3
0
 def getInterface(self,phi=None,smoothing_width=None):
     """
     creates a characteristic function which is 1 over the over the length
     *2*h*smoothing_width*  around the interface and zero elsewhere
     """
     if smoothing_width is None: smoothing_width = self.__smooth
     if phi is None: phi = self.__phi
     s=smoothing_width*self.__h 
     phi_on_h=es.interpolate(phi,esc.Function(self.__domain))
     return es.whereNegative(abs(phi_on_h)-s)
Exemple #4
0
  def getJumpingParameter(self, param_neg=-1, param_pos=1, phi=None):
      """
      Creates a function with ``param_neg`` where ``phi<0`` and ``param_pos``
      where ``phi>0`` (no smoothing).

      :param param_neg: value of parameter on the negative side (phi<0)
      :param param_pos: value of parameter on the positive side (phi>0)
      :param phi: level set function to be used. If not present the current
                  level set is used.
      """
      mask_neg = es.whereNegative(self.__phi)
      mask_pos = es.whereNonNegative(self.__phi)
      param = param_pos*mask_pos + param_neg*mask_neg
      return param
Exemple #5
0
  def getJumpingParameter(self, param_neg=-1, param_pos=1, phi=None):
      """
      Creates a function with ``param_neg`` where ``phi<0`` and ``param_pos``
      where ``phi>0`` (no smoothing).

      :param param_neg: value of parameter on the negative side (phi<0)
      :param param_pos: value of parameter on the positive side (phi>0)
      :param phi: level set function to be used. If not present the current
                  level set is used.
      """
      mask_neg = es.whereNegative(self.__phi)
      mask_pos = es.whereNonNegative(self.__phi)
      param = param_pos*mask_pos + param_neg*mask_neg
      return param
Exemple #6
0
 def getVolume(self):
     """
     Returns the volume of the *phi(x)<0* region.
     """
     return integrate(es.whereNegative(self.__phi.interpolate(esc.Function(self.__domain))))