M. T. Homer Reid MIT Home Page
Physics Problems Research teaching My Music About Me Miscellany


libscuff API Documentation:
c++ examples

scuff-em API: c++ Examples
1. Scattering Green's functions of a thin plate with a hole

1. Scattering Green's functions of a thin plate with a hole

As a first example, we'll look at the scattering behavior of a thin gold plate with a hole in it. More specifically, we'll compute the scattering contributions to the dyadic Green's functions. The files for this example (including the .cc source file and a barebones makefile (Makefile.manual) for compiling it) are in the subdirectory share/scuff-em/examples/PlateWithHole of the scuff-em installation.

The surface geometry we'll use is described by a gmsh geometry file named PlateWithHole.geo, which we can turn into a meshfile with the command

    % gmsh -2 -clscale 1.0 PlateWithHole.geo

This produces a file named PlateWithHole.msh:

We are interested in the fields scattered from the plate by point dipole sources located at various points on the Z-axis. More specifically, we would like to compute the xx and zz components of the dyadic Green's functions, Gxx(r,r) and Gzz(r,r), for points r on the z- axis. The former of these is computed by placing an x- directed point dipole source at r, solving a scattering problem with the incident field taken to be the field of that point source, and then computing the x-component of the scattered electric field back at the original point r. (Gzz is computed similarly, except that we replace the x-directed point source with a z- directed source, and instead of computing the x- component of the scattered field we want the z- component.)

In addition to scanning the position r over the z axis, we would also like to scan the angular frequency over a range from the low-frequency regime (wavelength much larger than the size of the plate) to moderate frequencies.

Here's some general pseudocode for what we are trying to do:

initialize the geometry
for Omega in list-of-Omega-values
      assemble and LU-factorize the BEM matrix at frequency Omega
      for Z in list-of-Z-values
            put an x-directed point source at coordinates (0,0,Z)
            solve the scattering problem
            compute the x-component of the scattered E-field at (0,0,Z)
            put a z-directed point source at coordinates (0,0,Z)
            solve the scattering problem
            compute the z-component of the scattered E-field at (0,0,Z)

Note that the loop over frequencies is the outer loop here, while the loop over point-source locations is the inner loop. This is almost always the right way to order things in a BEM calculation: The BEM matrix for a scattering problem depends on the frequency, but not on the incident field. Thus, once we have assembled and factorized the matrix, we can solve any number of problems involving different incident fields, and compute the scattered fields at any number of evaluation points, essentially for free (or least without paying the cost of assembling and factorizing the BEM matrix, which is generally the most expensive part of the calculation).

A simple C++ program that implements the above pseudocode is the file PlateWithHole.cc in the share/scuff-em/examples/PlateWithHole. (That directory also includes a simple handwritten makefile named Makefile.manual which, in a perfect world, you should be able to modify slightly and then simply do a make -f Makefile.manual to compile and link against the libscuff binary in your scuff-em installation.)

[an error occurred while processing this directive]

Accessing the scuff-EM core library from C++ programs, by Homer Reid
Last Modified: 11/16/16