def initialize(self,evaluation_points=None): if evaluation_points is not None: self._evaluation_points = evaluation_points self._inside = _bempplib.areInside(self._grid,evaluation_points) self._outside = _np.logical_not(self._inside) self._space = _bempplib.createRaviartThomas0VectorSpace(self._context,self._grid) if self._operator_cache: self._boundary_operator_cache = _tools.OperatorCache(self._operator_cache_tol) self._potential_operator_cache = _tools.OperatorCache(self._operator_cache_tol)
def transform_to_full_field_domain_solution(grid,incident_wave,domain_solution,times,points): if _mpi_rank == 0: incident_values_domain = _np.zeros_like(domain_solution) inside = _bempplib.areInside(grid,points) outside = _np.logical_not(inside) for ind, t in enumerate(times): incident_values_domain[:,outside,ind] = incident_wave.value(points[:,outside],t) sol = incident_values_domain - domain_solution else: sol = None return sol
slPotInt = lib.createHelmholtz3dSingleLayerPotentialOperator(context, kInt) dlPotInt = lib.createHelmholtz3dDoubleLayerPotentialOperator(context, kInt) slPotExt = lib.createHelmholtz3dSingleLayerPotentialOperator(context, kExt) dlPotExt = lib.createHelmholtz3dDoubleLayerPotentialOperator(context, kExt) # Create a grid of points nPointsX = 201 nPointsY = 201 x, y, z = np.mgrid[-5:5:nPointsX*1j, -5:5:nPointsY*1j, 0:0:1j] points = np.vstack((x.ravel(), y.ravel(), z.ravel())) # Split the points into those located inside and outside the scatterer inside = lib.areInside(grid, points) outside = np.logical_not(inside) # Use appropriate Green's representation formulas to evaluate the total field # inside and outside the scatterer evalOptions = lib.createEvaluationOptions() valsExt = (- slPotExt.evaluateAtPoints(uScDeriv, points[:,outside], evalOptions) + dlPotExt.evaluateAtPoints(uSc, points[:,outside], evalOptions) + uIncData(points[:,outside])) valsInt = ( slPotInt.evaluateAtPoints(uIntDeriv, points[:,inside], evalOptions) - dlPotInt.evaluateAtPoints(uInt, points[:,inside], evalOptions)) # Combine the results obtained for points inside and outside the scatterer # in a single array