Search:

Summary | Source files | Compilation | Precompiled | References

MagBragg

A simulator for nonlinear magneto-optical Bragg gratings, numerically solving the inverse problem of light scattering for arbitrary polatization state of the light. For an extensive description of the algorithms used in the program, supported command-line options and syntax, as well as the full documentation of the source, see magbragg.pdf [846 kB, 148 pages].

J. Opt. Soc. Am. B 22, 293 (2005)

Figure 1. Example of a spectrum calculated by MagBragg in a linear optical regime. The graph shows the relative intensity transmission Itr/Iin as function of vacuum wavelength λ, for a left circularly polarized incident beam and a magneto-optical perturbation with amplitude gp=5.0×10-3 and width wp=75μm at center positions (a) zp=0.8 mm, (b) zp=1.4 mm, (c) zp=2.0 mm, (d) zp=2.6 mm, and (e) zp=3.2 mm. [From Jonsson & Flytzanis, J. Opt. Soc. Am. B 22, 293 (2005)]

Summary of the program

The MagBragg computer program calculates reflection and transmission spectra of nonlinear magneto-optical Bragg gratings, in a stratified geometry where the material parameters vary only in one Cartesian coordinate. The MagBragg program also simulates the propagation of the electromagnetic field of an optical wave as it traverses a magneto-optical Bragg grating, giving the intra-grating spatial distribution of the optical fields in linear as well as nonlinear optical regimes. The MagBragg program forms the core behind the semi-analytical algorithm that was published in Phys. Rev. Lett. 96, 063902 (2006).

Several sets of options allow the user to modify and perturb the grating structure, both in all-optical as well as magneto-optical aspects, in a linear as well as a nonlinear optical domain. Particular attentiion has been paid to provide all possible modifications as accessible via command line options supplied to the program at startup time. The general algorithm of calculation and related physics are together with examples described in Refs. [5-8].

The MagBragg program is written in CWEB, generating ANSI-C (ISO 9899/C90) conforming source code and documentation as plain TeX-source, and is to be compiled using the sequences as outlined in the enclosed Makefile. The Makefile essentially executes two major calls. First, the CTANGLE program parses the CWEB source document magbragg.w to extract a ANSI C source file magbragg.c, which may be compiled in the usual way using any ANSI C conformant compiler. The output source file includes #line specifications so that any debugging can be done conveniently in terms of the original CWEB source file. Second, the CWEAVE program parses the same CWEB source file to extract a plain TeX source file 'magbragg.tex' which may be compiled in the usual way. It takes appropriate care of typographic details like page layout and the use of indentation, italics, boldface, and so on, and it supplies extensive automatically gathered cross-index information.

After having executed make in the same catalogue where the files magbragg.w and Makefile are located, one is left with an executable file magbragg, being the ready-to-use compiled program, and a PostScript file magbragg.ps which contains the full documentation of the program. Notice that on platforms running Windows NT, Windows 2000, Windows ME, or any other operating system by Microsoft, the executable file will instead automatically be called magbragg.exe. This convention also applies to programs compiled under the UNIX-like environment CYGWIN.

Current revision

Revision 1.43, as of 10/01/2007. Copyright © Fredrik Jonsson 2002-2007, under GPL

Source files

magbragg.pdf [846 kB] Documentation of the MagBragg program in Portable Document Format (PDF) [2], generated from the PostScript [4] documentation.

magbragg.w [331 kB] The CWEB [1] master source code for the MagBragg program. From this master, the ANSI-C (ISO C90) source code for the program and TeX code for the documentation is extracted using the CTANGLE and CWEAVE compilers, respectively.
[ download | view source ]

magbragg.tar.gz [358 kB] Gzip:ed tape archive of the entire MagBragg program directory, including the CWEB [1] master source code source, Makefile:s and all examples needed to rebuild the program and documentation from scratch. Requires CTANGLE and CWEAVE.
[ download ]

Makefile [2 kB] The Makefile for compilation of the executable file, as well as generation of the documentation of the program. Extracts the C and TeX code from the CWEB source, and compiles the C and TeX code into binary executable and PostScript, respectively. To compile the executable and documentation, simply run 'make' in the directory containing the source files and this Makefile.
[ download | view source ]

magbragg.c [90 kB] ANSI-C (ISO C90) conforming source code, extracted from the CWEB master source code using the CTANGLE program by Donald E. Knuth.
[ download | view source ]

magbragg.tex [392 kB] Plain TeX [3] source code, extracted from the CWEB master source code using the CWEAVE program by Donald E. Knuth.
[ download | view source ]

magbragg.ps [2.08 MB] PostScript [4] documentation of the MagBragg program, generated from the TeX-code, which in turn is generated from the CWEB master source code.

Compilation

The program is written in CWEB [1], generating ANSI C (ISO C99) conforming source code and documentation as plain TeX-source, and is to be compiled using the sequences as outlined in the enclosed Makefile, which essentially executes two major calls. First, the CTANGLE program parses the CWEB source file magbragg.w, to extract a C source file magbragg.c which may be compiled into an executable program using any ANSI C conformant compiler. The output source file magbragg.c includes #line specifications so that any debugging conveniently can be done in terms of line numbers in the original CWEB source file magbragg.w. Second, the CWEAVE program parses the same CWEB source file to extract a plain TeX file magbragg.tex which may be compiled into a PostScript [7] or PDF [6] document. The document file magbragg.tex takes appropriate care of typographic details like page layout and text formatting, and supplies extensive cross-indexing information which is gathered automatically. In addition to extracting the documentary text, CWEAVE also includes the source code in cross-referenced blocks corresponding to the descriptors as entered in the CWEB source code.

Having executed make (or gmake for the GNU enthusiast) in the same directory where the files magbragg.w, and Makefile, are located, one is left with the executable file magbragg, being the ready-to-use compiled program, and the PostScript [7] file magbragg.ps (or PDF [6] file magbragg.pdf) which contains the full documentation of the program. Notice that on platforms running any operating system by Microsoft, the executable file will instead automatically be named magbragg.exe. This convention also applies to programs compiled under the UNIX-like environment CYGWIN.

Precompiled executables

magbragg [99 kB] Executable program compiled for Mac OS X 10.7 (Lion) using the GNU C Compiler (GCC). [Compiled Saturday 24 Dec, 2011]

References

[1] For information on the CWEB programming language as written by Donald E. Knuth, as well as samples of CWEB programs, see Knuth's homepage at http://www-cs-faculty.stanford.edu/~knuth/cweb.html For information on literate programming, as well as additional CWEB examples, see http://www.literateprogramming.com

[2] For information on the Portable Document Format (PDF) of Adobe, see for example the homepage of Adobe Systems Inc., at http://www.adobe.com/products/acrobat/

[3] For information on the TeX typesetting system, as well as on the dvips program, see for example the website of the TeX Users Group, at http://www.tug.org

[4] For information on the PostScript programming language, see for example the PostScript area on the website of Adobe Systems Inc., at http://www.adobe.com/products/postscript/ or the reference book "PostScript Language - Tutorial and Cookbook" (Adison-Wesley, Reading, Massachusetts, 1985), ISBN 0-201-10179-3.

[5] F. Jonsson and C. Flytzanis, Phys. Rev. Lett. 82, 1426 (1999) .

[6] F. Jonsson and C. Flytzanis, J. Nonlin. Opt. Phys. Mat. 13, 129 (2004) .

[7] F. Jonsson and C. Flytzanis, J. Opt. Soc. Am. B 22, 293 (2005) .

[8] F. Jonsson and C. Flytzanis, Phys. Rev. Lett. 96, 063902 (2006) .

Return to previous page

Leave a message

Your name:

Your email: (required)

Message:

Generated by ::emailform::

Last modified Wednesday 15 Feb 2023