def getVolume(self): """ Returns the volume of the *phi(x)<0* region. """ return integrate( es.whereNegative( self.__phi.interpolate(esc.Function(self.__domain))))
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)
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
def getVolume(self): """ Returns the volume of the *phi(x)<0* region. """ return integrate(es.whereNegative(self.__phi.interpolate(esc.Function(self.__domain))))