-
Operating system
UNIX-like operating system (e.g., LINUX or OS X)
-
PETSc (version 3.5 or higher)
-
MaxwellFDFD is a companion MATLAB package to create the input files for FD3D and analyze the solution files. MaxwellFDFD (and MATLAB) does not have to be installed on the same machine you install FD3D. In fact, FD3D is typically installed on a LINUX cluster, whereas MaxwellFDFD is installed on your local machine, such as your laptop.
-
Download the PETSc library source code from the PETSc download page.
-
Unarchive the PETSc package, and move it to the directory where you want to install the library.
For example, you can create a directory
petsc
under your home directory and move the package there. Then, the contents of the PETSc package will be at$HOME/petsc/petsc-X.Y.Z/
, whereX.Y.Z
is the version number. -
Define the environment variables
PETSC_DIR
andPETSC_ARCH
.If your LINUX SHELL is bash, you can open
.bash_profile
file in your home directory (or create one if there is not), and add the following two lines to the file:export PETSC_DIR=YOUR_PETSC_DIRECTORY export PETSC_ARCH=petscfd3d
where
YOUR_PETSC_DIRECTORY
is where your PETSc package exists, e.g.,$HOME/petsc/petsc-X.Y.Z
in Step 2. -
Make the environment variables effective.
If your LINUX shell is bash and you followed Step 3, this can be done by executing:
source `$HOME/.bash_profile`.
-
Copy the PETSc configuration script from FD3D.
In your FD3D directory, you will find
petscfd3d.py
script. Copy this to$PETSC_DIR/config/
directory. -
Make the configuration script executable.
This can be done by executing:
cd $PETSC_DIR/config chmod u+x petscfd3d.py
-
Configure PETSc.
Execute:
cd $PETSC_DIR config/petscfd3d.py
Now, you will see a long configuration message.
-
Build PETSc.
Execute:
make all
-
Test PETSc.
Execute:
make test
If you do not get any error, your PETSc installation is successful. If you have any problem, you may find a solution at PETSc Documentation: Installation.
Follow this instruction after you install the PETSc library following the instruction above.
-
Unarchive the FD3D package, and move it to the directory where you want to install the library.
For example, you can put the unarchived package in your home directory. Then the contents of the FD3D package will be at
$HOME/fd3d/
. -
Define the environment variable
FD3D_ROOT
.You have to let FD3D know its install location via an environment variable named
FD3D_ROOT
. If your LINUX shell is bash, you can create$HOME/.fd3d
file with the following line using your favorite text editor:export FD3D_ROOT=$HOME/fd3d
Then open
$HOME/.bash_profile
file with your favorite text editor to append:source $HOME/.fd3d export PATH=$PATH:$FD3D_ROOT/bin
-
Make the environment variable effective.
Execute:
source $HOME/.bash_profile
-
Build FD3D.
Move to
$FD3D_ROOT/src/
directory by:cd $FD3D_ROOT/src
If this does not place you in
$FD3D_ROOT/src/
directory, it means Step 1, 2 are not done correctly.Now, copy
$FD3D_ROOT/src/makefiles/makefile.tmp
file to$FD3D_ROOT/src/
directory and rename it tomakefile
by:cp makefiles/makefile.tmp makefile
Finally, build fd3d by executing:
make
in
$FD3D_ROOT/src/
directory. -
Test FD3D.
In
$FD3D_ROOT/test/
directory, there are input filespointsrc_2d.h5
,poinstsrc_2d.eps.gz
,pointsrc_2d.srcJ.gz
,pointsrc_2d.srcM.gz
. To create these files you need to install MaxwellFDFD, a companion MATLAB package of FD3D, but these input files are provided so that you can test FD3D without installing MaxwellFDFD.To test FD3D, execute:
cd $FD3D_ROOT/test gzip -d pointsrc_2d.{eps,srcJ,srcM}.gz fd3d -i pointsrc_2d
If this generates normal standard output without error messages, your FD3D installation is successful.