  We develop a software package libEMMI\_MGFD for 3D frequency-domain marine
controlled-source electromagnetic (CSEM) modelling and inversion. It is the
first open-source C program tailored for geometrical multigrid (GMG) CSEM
simulation. An volumetric anisotropic averaging scheme has been employed to
compute effective medium for modelling over uniform and nonuniform grid. The
computing coordinate is aligned with acquisition geometry by rotation with the
azimuth and dip angles, facilitating the injection of the source and the
extraction of data with arbitrary orientations. Efficient nonlinear
optimization is achieved using quasi-Newton scheme assisted with bisection
backtracking line search. In constructing the modularized Maxwell solver and
evaluating the misfit and gradient for 3D CSEM inversion, the reverse
communication technique is the key to the compaction of the software while
maintaining the computational performance. A number of numeric tests
demonstrate the efficiency of the modelling while preserving the solution
accuracy. A 3D marine CSEM inversion example has been examined for resistivity
imaging.
