Example #1
0
 def getSmoothedJump(self,phi=None,smoothing_width=None):
     """
     Creates a smooth interface from -1 to 1 over the length
     *2*h*smoothing_width* where -1 is used where the level set is negative
     and 1 where the level set is 1.
     """
     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))
     mask_neg = es.whereNonNegative(-s-phi_on_h)
     mask_pos = es.whereNonNegative(phi_on_h-s)
     mask_interface = 1.-mask_neg-mask_pos
     interface=phi_on_h/s
     return - mask_neg + mask_pos + mask_interface * interface
Example #2
0
 def getSmoothedJump(self,phi=None,smoothing_width=None):
     """
     Creates a smooth interface from -1 to 1 over the length
     *2*h*smoothing_width* where -1 is used where the level set is negative
     and 1 where the level set is 1.
     """
     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))
     mask_neg = es.whereNonNegative(-s-phi_on_h)
     mask_pos = es.whereNonNegative(phi_on_h-s)
     mask_interface = 1.-mask_neg-mask_pos
     interface=phi_on_h/s
     return - mask_neg + mask_pos + mask_interface * interface
Example #3
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
Example #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