Calypso Manual 1.2
Calypso Manual 1.2
Calypso Manual 1.2
Calypso
User Manual
Version 1.2
Hiroaki Matsui
www.geodynamics.org
Preface
Calypso is a program package of magnetohydrodynamics (MHD) simulations in a rotating
spherical shell for geodynamo problems. This package consists of the simulation program,
preprocessing program, post processing program to generate field data for visualization
programs, and several small utilities. The simulation program runs on parallel computing
systems using MPI and OpenMP parallelization.
1
Contents
1 Introduction 6
2 History 6
2.1 Updates for Ver 1.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Updates for Ver 1.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 Acknowledgements 9
4 Citation 9
5 Model of Simulation 10
5.1 Governing equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.2 Spherical harmonics expansion . . . . . . . . . . . . . . . . . . . . . . . 12
5.3 Evaluation of Coriolis term . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.4 Boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.4.1 Non-slip boundary . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.4.2 Free-slip boundary . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.4.3 Fixed rotation rate . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.4.4 Fixed homogenous temperature . . . . . . . . . . . . . . . . . . 14
5.4.5 Fixed homogenous heat flux . . . . . . . . . . . . . . . . . . . . 14
5.4.6 Fixed composition . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.4.7 Fixed composition flux . . . . . . . . . . . . . . . . . . . . . . . 14
5.4.8 Connection to the magnetic potential field . . . . . . . . . . . . . 15
5.4.9 Magnetic boundary condition for center . . . . . . . . . . . . . . 16
5.4.10 Pseudo-vacuum magnetic boundary condition . . . . . . . . . . . 16
6 Installation 17
6.1 Library Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.2 Known problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.3 Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.4 Doxygen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.5 Install using configure command . . . . . . . . . . . . . . . . . . . 19
6.5.1 Configuration using configure command . . . . . . . . . . . 19
6.5.2 Compile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.5.3 Clean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.5.4 Install . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.6 Install without using configure . . . . . . . . . . . . . . . . . . . . . . . 22
2
6.7 Install using cmake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7 Simulation procedure 25
8 Examples 29
8.1 Examples for preprocessing program . . . . . . . . . . . . . . . . . . . . 29
8.2 Examples of dynamo benchmark . . . . . . . . . . . . . . . . . . . . . . 29
8.2.1 Data files and directories for Case 0 . . . . . . . . . . . . . . . . 31
8.2.2 Data files and directories for Case 1 . . . . . . . . . . . . . . . . 31
8.2.3 Data files and directories for Case 2 . . . . . . . . . . . . . . . . 32
8.2.4 Data files and directories for Compositional Case 1 . . . . . . . . 32
8.3 Example of data assembling program . . . . . . . . . . . . . . . . . . . . 33
8.4 Example of treatment of heat and composition source term . . . . . . . . 33
8.5 Example of thermal and compositional boundary conditions by external file 34
3
10.8 Gauss coefficient data [gauss coef prefix].dat . . . . . . . . . . 58
10.9 Spectrum monitor data [picked sph prefix].dat . . . . . . . . . 59
10.10Nusselt number data [nusselt number prefix].dat . . . . . . . 59
Appendices 78
4
A.7 coefficients ctl . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
A.7.1 thermal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
A.7.2 momentum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
A.7.3 induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
A.7.4 composition . . . . . . . . . . . . . . . . . . . . . . . . . . 86
A.8 temperature define . . . . . . . . . . . . . . . . . . . . . . . . . 86
A.9 time step ctl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
A.10 new time step ctl . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
A.11 restart file ctl . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
A.12 time loop ctl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
A.13 sph monitor ctl . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
A.14 visual control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
A.15 cross section ctl . . . . . . . . . . . . . . . . . . . . . . . . . . 93
A.15.1 surface define . . . . . . . . . . . . . . . . . . . . . . . . 93
A.15.2 output field define . . . . . . . . . . . . . . . . . . . . . 95
A.15.3 isosurf define . . . . . . . . . . . . . . . . . . . . . . . . 96
A.15.4 field on isosurf . . . . . . . . . . . . . . . . . . . . . . . 97
A.16 num domain ctl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
A.17 num grid sph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
A.18 new data files def . . . . . . . . . . . . . . . . . . . . . . . . . . 100
A.19 newrst magne ctl . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5
1 Introduction
Calypso is a program package for magnetohydrodynamics (MHD) simulations in a ro-
tating spherical shell for geodynamo problems. This package consists of the simulation
program, preprocessing program, post processing program to generate field data for visu-
alization programs, and several small utilities. The simulation program runs on parallel
computing systems using MPI and OpenMP parallelization.
Calypso solves the equations that govern convection and magnetic-field generation in a
rotating spherical shell. Flow is driven by thermal or compositional buoyancy in a Boussi-
nesq fluid. Calypso also support various boundary conditions (e.g. fixed temperature, heat
flux, composition, and compositional flux), and permits a conductive and rotatable inner
core. Results are written as spherical harmonics coefficients, Gauss coefficients for the re-
gion outside of the fluid shell, and field data in Cartesian coordinate for easily visualization
with a number of visualization programs.
This user guide describes the essentials of the magnetohydrodynamics theory and
equations behind Calypso, and provides instructions for the configuration and execution
of Calypso.
2 History
Calypso has its origins in two earlier projects. One is a dynamo simulation code written
by Hiroaki Matsui in 1990’s using a spectral method. This code solves for the poloidal
and toroidal spectral coefficients, like Calypso, but it calculates the nonlinear terms in the
spectral domain using a parallelization for SMP architectures. The other project is the
thermal convection version of GeoFEM, which is Finite Element Method (FEM) platform
for massively parallel computational environment, originally written by Hiroshi Okuda in
2000. Under GeoFEM Project, Lee Chen developed cross sectioning, iso-surfacing, and
volume rendering modules for data visualization for parallel computations..
Hiroaki Matsui was responsible for adding routines to GeoFEM to perform magneto-
hydrodynamics simulation in a rotating frame. In 2002 this code successfully performed
dynamo simulations in a rotating spherical shell using insulating magnetic boundary con-
ditions. The following year Matsui implemented a subgrid scale (SGS) model in the FEM
dynamo model in collaboration with Bruce Buffett. A module to solve for double diffusive
convection was added to the FEM dynamo model by Hiroaki Matsui in 2009.
Progress in understanding the role of subgrid scale models in magnetohydrodynamic
simulations relies on quantitative estimates for the transfer of energy between spatial
scales. This information is most easily obtained from a spherical harmonic expansion
of the simulation results, even when the simulation is performed by FEM. Hiroaki Matsui
6
implemented the spherical harmonic transform in 2007 using a combination of MPI and
OpenMP, and later included the spherical harmonic transform routines into his old dynamo
code to create Calypso. Additional software in the program package for visualization is
based on data formats from the FEM model. In addition, the control parameter file format
is adapted from the input formats used in GeoFEM.
Calypso Ver. 1.0 supports the following features and capabilities
• A conductive inner core with the same conductivity as the surrounding fluid
• New ordering is used for spherical harmonics data to reduce communication time.
The old version of spectrum indexing data, which is generated by gen_sph_grids
in Ver. 1.0 is also supported in Ver. 1.1.
7
• Evaluation of Coriolis term is updated. Now, Adams-Gaunt integrals are evaluated
in the initialization process in the simulation program sph_mhd, so the data file for
Adams-Gaunt integrals which is made by gen_sph_grids is not required.
• Add a program sph_add_initial_field. to modify existed initial field data.
This program is used to modify or add new fields in spectrum data. (See Section
13.)
• Heat and composition source terms are implemented. These source terms are fixed
with time, and defined as spectrum data. The source terms are defined by using
initial field generation program
sph_initial_field or sph_add_initial_field. (See section 12 and
13.)
• The boundary conditions for temperature and composition can be defined by using
spherical harmonics coefficients. (i.e. inhomogeneous boundary conditions can be
applied.) These boundary conditions are defined by using single external data file.
(See Section 10.3)
8
3 Acknowledgements
Calypso was primarily developed by Dr. Hiroaki Matsui in collaboration with Prof. Bruce
Buffett at the University of California, Berkeley. The following NSF grants supported the
development of Calypso,
• B.A. Buffett, NSF EAR-0509893; Models of sub-grid scale turbulence in the Earths
core and the geodynamo; 2005 - 2007.
4 Citation
Computational Infrastructure for Geodynamics (CIG) and the Calypso developers are
making the source code to Calypso available to researchers in the hope that it will aid their
research and teaching. A number of individuals have contributed a significant amount of
time and energy into the development of Calypso. We request that you cite the appropriate
papers and make acknowledgements as necessary. The Calypso development team asks
that you cite the following papers:
Matsui, H., E. King, and B.A. Buffett, Multi-scale convection in a geodynamo simula-
tion with uniform heat flux along the outer boundary, Geochemistry, Geophysics, Geosys-
tems, 15, 3212 – 3225, 2014.
9
5 Model of Simulation
5.1 Governing equations
CMB ro
ICB ri
Mantle
Crust
10
∂B
= −η∇ × ∇ × B + ∇ × (u × B) ,
∂t
∂T
+ (u · ∇) T = κT ∇2 T + qT ,
∂t
∂C
+ (u · ∇) C = κC ∇2 C + qC ,
∂t
∇·u = ∇ · B = 0,
ω = ∇ × u,
and
1
J = ∇ × B,
µ0
where, u, ω, P , B , J , T , C, qT , and qC are the velocity, vorticity, pressure, magnetic
field, current density, temperature, compositional variation, heat source, and source of light
element, respectively. Coefficients in the governing equations are the kinetic viscosity
ν, thermal diffusivity κT , compositional diffusivity κC , and magnetic diffusivity η. The
density ρ is written as a function of T , C, average density ρ0 , thermal expansion αT , and
density ratio of light element to main composition αC ,
ρ = ρ0 [1 − αT (T − T0 ) − αC (C − C0 )]
In Calypso, the vorticity equation and divergence of the momentum equation are used for
solving u, ω, and P as,
∂ω
+ ∇ × (ω × u) = −ν∇ × ∇ × ω − 2Ω∇ × (ẑ × u)
∂t
ρ 1
+∇ × g + ∇ × (J × B) ,
ρ0 ρ0
and
2 1 2
∇ · (ω × u) = −∇ P + u − 2Ω∇ · (ẑ × u)
2
ρ 1
+∇ · g + ∇ · (J × B) .
ρ0 ρ0
11
5.2 Spherical harmonics expansion
In Calypso, fields are expanded into spherical harmonics. A scalar field (for example,
temperature T (r, θ, φ)) is expanded as
L X
X l
T (r, θ, φ) = Tlm (r)Ylm (θ, φ),
l=0 m=−l
where Ylm are the spherical harmonics. Solenoidal fields (e.g. velocity u, vorticity ω,
magnetic field B, and current density J ) are decomposed into poloidal and toroidal com-
ponents. For example, the magnetic field is described as
L X
X l
B(r, θ, φ) = (B Slm + B Tml ) ,
l=1 m=−l
where
B Slm (r, θ, φ) = ∇ × ∇ × (BSlm (r)Ylm (θ, φ)r̂) ,
B Tml (r, θ, φ) = ∇ × (BTml (r)Ylm (θ, φ)r̂) .
The spherical harmonics are defined as real functions. Plm cos (mφ) is assigned for
positive m, Plm sin (mφ) is assigned for negative m, where Plm are Legendre polynomi-
als. Because Schmidt quasi normalization is used for the Legendre polynomials Plm , the
orthogonality relation for the spherical harmonics is
Z
0 1
Yl m Yl m
0 sin θdθdφ = 4π δll0 δmm0 ,
2l + 1
where, δll0 is Kronecker delta.
12
5.4 Boundary conditions
Calypso currently supports the following boundary conditions for velocity u, magnetic
field B, temperature T , and composition variation C. These boundary conditions are
defined in the control file control_MHD.
and
UTml (r) = 0 for l > 2.
13
5.4.4 Fixed homogenous temperature
When a constant temperature Tb is is applied, the spherical harmonic coefficients are
T00 (r) = Tb ,
and
C00 (r) = Cb ,
and
15
5.4.9 Magnetic boundary condition for center
If the inner core has the same conductivity as the outer core, we solve the induction equa-
tion for the inner core as for the outer core with the boundary conditions for the center.
The poloidal and toroidal coefficients at center are set to
16
6 Installation
6.1 Library Requirements
Calypso requires the following libraries.
• GNU make
Linux and Max OS X use GNU make as a default ’make’ command, but some system (e.g.
BSD or SOLARIS) does not use GNU make as default. configure command searches
and set correct GNU make command.
In addition, the following environment and libraries can be used (optional).
• OpenMP
• BLAS
Note: Calypso does NOT use MPI and OpenMP features in FFTW3.
In the most of platforms, the Fourier transform by FFTW is faster than that by FFT-
PACK.
HDF5 is used for field data output with XDMF format instead of VTK format. The
comparison of field data format is described in section refsec:VTK.
OpenMP is used for the parallelization under the shared memory. Better choice to use
both MPI and OpenMP parallelization (so-called Hybrid parallelization) or only using MPI
(so-called flat MPI) is depends on the computational platform and compiler. For example,
flat MPI has much better performance on Linux cluster with Intel Xeon processors and
with Intel fortran compiler, but Hybrid model has better performance on Hitachi SR16000
with Power 6 processors.
17
6.2 Known problems
FFTPACK and Intel compiler
FFTPACK fails to compile with Intel fortran using the ‘-warn all’ option. Currently
the ‘-warn all’ option is excluded by Makefile when FFTPACK is compiled.
XL fortran
In XL fortran, preprocessor options is not specified by -D..., but -Wf, ’-D...’.
Pleease edit preprocessor macro opthion F90CPPFLAGS in work/Makefile by an
editor.
6.3 Directories
The top directory of Calypso (ex. [CALYPSO_HOME]) contains the following directories.
% cd [CALYPSO_HOME]
% ls
CMakeLists.txt Makefile.in configure.in examples
INSTALL bin doc src
LICENSE configure doxygen work
18
cmake: directory for document generated by doxygen
doc: documentations
examples: examples
6.4 Doxygen
Doxygen (http://www.doxygen.org) is an powerful document generation tool from
source files. We only save a configuration file in this directory because thousands of html
files generated by doxygen. The documents for source codes are generated by the follow-
ing command:
% cd [CALYPSO_HOME]/doxygen
% doxygen ./Doxyfile_CALYPSO
The html documents can see by opening [CALYPSO_HOME]/doxygen/html/index.html.
Automatically generated documentation is also available on the CIG website at http:
//www.geodynamics.org/cig/software/calypso/.
19
./configure generates a Makefile in the current directory. Available options for configure
can be checked using the ./configure --help command. The following options are
available in the configure command.
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-fftw3 Use fftw3 library
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-hdf5=yes/no/PATH full path of h5pcc for parallel HDF5 configuration
--with-blas=<lib> use BLAS library <lib>
% ./configure --prefix=’/Users/matsui/local’ \
? CFLAGS=’-O -Wall -g’ FCFLAGS=’-O -Wall -g’ \
? PKG_CONFIG_PATH=’/Users/matsui/local/lib/pkgconfig’ \
? --enable-fftw3 --with-hdf5=’/Users/matsui/local/bin/h5pcc’
20
6.5.2 Compile
Compile is performed using the make command. The Makefile in the top directory is
used to generate another Makefile in the work directory, which is automatically used to
complete the compilation. The object file and libraries are compiled in the work directory.
Finally, the executive files are assembled in bin directory. You should find the following
programs in the bin directory.
21
6.5.3 Clean
The object and fortran module files in work directory is deleted by typing
% make clean
This command deletes files with the extension .o, .mod, .par, .diag, and .
6.5.4 Install
The executive files are copied to the install directory $(INSTDIR)/bin. The install di-
rectory $(INSTDIR) is defined in Makefile, and can also set by ${--prefix} option
for configure command. Alternatively, you can use the programs in ${SRCDIR}/bin
directory without running make install. If directory ${PREFIX} does not exist,
make install creates ${PREFIX}, ${PREFIX}/lib, ${PREFIX}/bin, and
${PREFIX}/include directories. No files are installed in ${PREFIX}/lib and
${PREFIX}/include.
MPICHDIR Directory names for MPI implementation. If you set fortran90 compiler
name for MPI programs in MPIF90, you do not need to define this valuable.
MPICHINCDIR Directory names for include files for MPI implementation. If you set
fortran90 compiler name for MPI programs in MPIF90, you do not need to define
this valuable.
MPILIBS Library names for MPI implementation. If you set fortran90 compiler name
for MPI programs in MPIF90, you do not need to define this valuable.
22
F90_LOCAL Command name of local Fortran 90 compiler to compile module depen-
dency listing program.
MPIF90 Command name of Fortran90 compiler and linker for MPI programs. If com-
mand does not have MPI implementation, you need to define the definition of MPI
libraries MPICHDIR, MPICHINCDIR, and MPILIBS.
AR Command name for archive program (ex. ar) to generate libraries. If you need some
options for archive command, options are also included in this valuable.
RANLIB Command name for ranlib to generate index to the contents of an archive.
If system does not have ranlib, set true in this valuable. true command does
not do anything for libraries.
HDF5_FFLAGS Option flags to compile with HDF5. This setting can be found by using
hfd5 command h5pfc -show.
HDF5_LDFLAGS Option flags to link with HDF5. This setting can be found by using
hfd5 command h5pfc -show.
HDF5_FLIBS Library lists for HDF5. This setting can be found by using hfd5 command
h5pfc -show.
23
In this section, [CALYPSO\_HOME]/work is used as the working directory. Options for
CMake can be checked by cmake -i [CALYPSO_HOME] command at [CALYPSO_HOME]
/work. There are a number of options can be found, but the following valuables are im-
portant settings for installation:
CMAKE_INSTALL_PREFIX Install directory
HDF5_INCLUDE_DIRS Include file directories to compile with HDF5. This setting can
be found by using hfd5 command h5pfc -show.
HDF5_LIBRARIES Library lists for HDF5. This setting can be found by using hfd5
command h5pfc -show.
24
/home/matsui/local/lib/libhdf5_fortran.a
/home/matsui/local/lib/libhdf5.a
-L/home/matsui/local/lib -lmpi -lz -ldl -lm
% cmake .. -DCMAKE_LIBRARY_PATH=’/home/matsui/local/lib’ \
? -DCMAKE_INCLUDE_PATH=’/home/matsui/local/include’ \
? -DHDF5_INCLUDE_DIRS=’/home/matsui/local/include’ \
? -DHDF5_LIBRARY_DIRS=’/home/matsui/local/lib’ \
? -DHDF5_LIBRARIES=’/home/matsui/local/lib/libhdf5hl_fortran.a \
? /home/matsui/local/lib/libhdf5_hl.a \
? /home/matsui/local/lib/libhdf5_fortran.a \
? /home/matsui/local/lib/libhdf5.a’
After configuration, compile and install are started by
% make
...
% make install
After running make command, execute files are built in [CALYPSO_HOME]/work/bin
directory.
7 Simulation procedure
Calypso consists of programs shown in Table 1. Because the serial programs do not use
MPI, they are simply invoked by
% [program]
Parallel programs must be invoked using MPI commands. On a Linux cluster using
MPICH, parallel programs are invoked with
% mpirun -np [# of processes] [program]
This command will vary depending on the MPI implementation installed on the ma-
chine. Please consult with your sysadmin for details.
To perform simulations by Calypso, the following processes are required.
1. Generate grids and spherical harmonics indexing information by
gen_sph_grids.
25
Table 1: List of program and required control file name
The simulation program sph_mhd requires an indexing file for spherical transform. sph_mhd
generates spectrum data and monitoring data, and field data in Cartesian coordinate as out-
puts. The data transform programs (sph_snapshot and sph_zm_snapshot) gener-
ate outputs data from parallel spectra data. The flow of data is shown in Figure 2.
26
Input data Program Output data
(Parallel)
Spectr index data Spectr data
(Restart data)
Simulation
(sph_mhd)
Spectr data Field data
(Restart data) (VTK or XDMF)
Data transform
(sph_snapshot)
FEM mesh data (sph_zm_snapshot) Surface data
(VTK)
Figure 2: Data flow of the simulation. Simulations require index data for spherical har-
monics transform, initial spectra (optional) data, and FEM mesh data. Simulation program
also outputs spectra data, monitoring data and field data in Cartesian coordinate. Data
transform program generates output data for simulation program from spectra data.
Each program needs one control file, the name of which is defined by the program.
(Standard input is not supported by Fortran 90 so Calypso uses control files.) The appro-
priate control file names are shown in the Table 1. The following rules are used in the
control files. An example of a control file is shown in Figure 3.
• Lines starting with ‘#’ or ‘!’ are treated as a comment lines and ignored.
• All control files consist of blocks which start with ‘begin [name]’ and end with
‘end [name]’.
• The item name is shown first and the associated value/data is second.
27
• In Fortran program, character ‘/’ is recognized as an end of character valuable if
text with ‘/’ (e.g. file prefix including file paths) is not enclosed by ’ or ".
• Calypso’s control file input is limited to 255 characters for each line.
begin spherical_shell_ctl
!
begin data_files_def
num_subdomain_ctl 4
!
sph_file_prefix ’sph_shell/in’
end data_files_def
!
begin num_grid_sph
truncation_level_ctl 4
ngrid_meridonal_ctl 12
ngrid_zonal_ctl 24
!
radial_grid_type_ctl explicit
array r_layer 4
r_layer 1 0.5384615384615
r_layer 2 0.5384615384615
r_layer 3 1.038461538462
r_layer 4 1.538461538462
end array r_layer
!
end num_grid_sph
end spherical_shell_ctl
28
8 Examples
Several examples are provided in the examples directory. There are three subdirecto-
ries as examples. README files are also provided to perform these examples in each
subdirectory.
assemble sph Examples for assembling program of spectrum data. (see section 15)
dynamo benchmark Examples for dynamo benchmark by Christensen et. al. (2001)
heat composition source Examples for the heat and composition diffusion prob-
lem including source term )
heterogineous temp Examples for the heat and composition diffusion problem in-
cluding thermal and compositional heterogeneity at boundaries.)
explicitly defined Example to generate indexing data with explicitly defined ra-
dial points
with inner core Example to generate indexing data including inner core and exter-
nal of the fluid shell.
The program gen_sph_grids generate spherical harmonics indexing file under the
directory defined by the file control_sph_shell.
29
Case 1 Example of dynamo benchmark case 1 (Dynamo model with co-rotating and
electrically insulated inner core)
Case 2 Example of dynamo benchmark case 2 (Dynamo model with rotatable and con-
ductive inner core)
The process of the simulation in these examples is the same using 4 MPI processes:
1. Change to the directory for Benchmark Case 1 (for example)
[username]$ cd [CALYPSO_DIR]/examples/dynamo_benchmark/dynamobench_case1
[dynamobench_case_1]$ [CALYPSO_DIR]/bin/gen_sph_grids
[dynamobench_case_1]$ [CALYPSO_DIR]/bin/sph_initial_field
30
8.2.1 Data files and directories for Case 0
control sph shell Control file for spherical shell preprocessing
control MHD Control file for simulation
control snapshot Control file for postprocessing
sph lm31r48c 4 Spherical shell indexing data directory
rst 4 Spectr data directory for restarting
field Field data directory for for visualization
setions Cross section data directory for for visualization
31
8.2.3 Data files and directories for Case 2
control sph shell Control file for spherical shell preprocessing
control psf CMB Control file for section at CMB (See Section 10.5)
control psf ICB Control file for section at ICB (See Section 10.5)
control psf eq Control file for section at equatorial plane (See Section 10.5)
control psf z0.3 Control file for section at z = 0.3 (See Section 10.5)
control psf s0.55 Control file for cylindrical surface at s = 0.55 (See Section 10.5)
setions Cross section data directory for for visualization (See Section 10.5)
sph pwr volume s.dat Mean square data over the fluid shell.
32
8.3 Example of data assembling program
An example for spectrum data assembling program is provided in assemble_sph di-
rectory. This example uses simulation results of dynamo benchmark case 1. First, copy
data from dynamo benchmark case 1 as
[assemble_sph]$ cp ../dynamo_benchmark/dynamobench_case_1/sph_lm31r48c_4/
[assemble_sph]$ cp ../dynamo_benchmark/dynamobench_case_1/rst_4/rst.* 4do
Then, construct new domain decomposition data as
[sph_lm31r48c_4]$ sph_lm31r48c_2
[sph_lm31r48c_2]$ [CALYPSO_DIR]/bin/gen_sph_grids
[sph_lm31r48c_2]$ cd ../
Finally restart data for new configuration is generated by assemble_sph in 2doamins
directory.
[sph_lm31r48c_2]$ [CALYPSO_DIR]/bin/assemble_sph
\verb|$[sph_initial_field]$ INITIAL_FIELD|
33
[sph_initial_field]$ cd [CALYPSO_DIR]/work
[work]$ make
[work]$ cd [CALYPSO]/examples/heat_composition_source
After building sph_initial_field, the procedure is the same as for the dynamo
benchmarks. Aftrer the simulation, Y00 component of temperature and composition as a
function of radius and time is written in picked_mode.dat.
34
9 Preprocessing program (gen sph grid)
This program generates index table and a communication table for parallel spherical
harmonics, table of integrals for Coriolis term, and FEM mesh information to generate
visualization data (see Figure 4). This program needs control file for input. This program
can perform with any number of MPI processes less than the number of subdomains. The
output files include the indexing tables.
35
9.1 Position of radial grid
The preprocessing program sets the radial grid spacing, either by a list in the control file
or by setting an equidistant grid or Chebyshev collocation points.
In equidistance grid, radial grids are defined by
k − kICB
r(k) = ri + (ro − ri ) ,
N
where, kICB is the grid points number at ICB. The radial grid set from the closest points
of minimum radius defined by [Min radius ctl] in control file to the closest points
of the maximum radius defined by [Max radius ctl] in control file, and radial grid
number for the innermost points is set to k = 1.
In Chebyshev collocation points, radial grids in the fluid shell are defined by
(ro − ri ) 1 k − kICB
r(k) = ri + − cos π ,
2 2 N
36
• data_files_def (Detail)
– num_subdomain_ctl [Num_PE] (Detail)
– sph_file_prefix [sph_prefix] (Detail)
• num_domain_ctl (Detail)
– num_radial_domain_ctl [Ndomain] (Detail)
– num_horizontal_domain_ctl [Ndomain] (Detail)
– array num_domain_sph_grid [Direction] [Ndomain] (De-
tail)
– array num_domain_legendre [Direction] [Ndomain] (De-
tail)
– array num_domain_spectr [Direction] [Ndomain] (De-
tail)
• num_grid_sph (Detail)
– truncation_level_ctl [Lmax] (Detail)
– ngrid_meridonal_ctl [Ntheta] (Detail)
– ngrid_zonal_ctl [Nphi] (Detail)
– radial_grid_type_ctl [explicit, Chebyshev, or equi_distance]
(Detail)
– num_fluid_grid_ctl [Nr_shell] (Detail)
– fluid_core_size_ctl [Length] (Detail)
– ICB_to_CMB_ratio_ctl [R_ratio] (Detail)
– Min_radius_ctl [Rmin] (Detail)
– Max_radius_ctl [Rmax] (Detail)
37
9.3 Spectrum index data
gen_sph_grid generates indexing table of the spherical transform. To perform spheri-
cal harmonics transform with distributed memory computers, data communication table is
also included in these files. Calypso needs four indexing data for the spherical transform.
38
9.6 How to define spatial resolution and parallelization?
Calypso uses spherical harmonics expansion method and in horizontal discretization and
finite difference methods in the radial direction. In the spherical harmonics expansion
methods, nonlinear terms are solved in the grid space while time integration and dif-
fusion terms are solved in the spectrum space. We need to set truncation degree lmax
of the spherical harmonics and number of grids in the three direction (Nr , Nθ , Nφ ) in
the preprocessing program. The following condition is required (or recommended) for
lmax and (Nr , Nθ , Nφ ). lmax is defined by truncation_level_ctl, and Nr for the
fluid shell (outer core) is defined by num_fluid_grid_ctl. Nθ and Nφ is defined by
ngrid_meridonal_ctl and ngrid_zonal_ctl, respectively.
• Nφ = 2Nθ .
• Choose the number of decomposition in the radial and horizontal direction as close
as possible.
Here is an example for the case with (Nr , lmax ) = (89, 95). The maximum number of
parallelization is 90 × 48 = 4320 processes. Nr + 1 and (lmax + 1) /2 can be decomposed
into 90 = 2×32 ×5 and 48 = 24 ×3. Now, if 160 processes run is intended, 160 = 10×16
is the closest number of decompositions. Comparing with the prime numbers of the spatial
resolution, radial and horizontal decomposition will be 10 and 16, respectively.
39
Spectrum data
for time integration
Communication
Legendre
Grid space data transform
for nonlinear terms
Communication
θ θ
Figure 5: Parallelization and data communication in Calypso in the case using 9 (3x3)
processors. Data are decomposed in radial and meridional direction for nonlinear term
evaluations, decomposed in radial and harmonic order for Legendre transform, and de-
composed in spherical harmonics for linear calculations.
40
10 Simulation program (sph mhd)
The name of the simulation program is sph mhd. This program requires control MHD
as a Control file. This program performs with the indexing file for spherical harmonics and
Coriolis term integration file generated by the preprocessing program gen sph grid.
Data files for this program are listed in Table 3. Indexing data for spherical harmonics
which starting with [sph_prefix] are obtained by the preprocessing program gen_sph_grid.
The boundary condition data file [boundary_data_name] is optionally required if
boundary conditions for temperature and composition are not homogenous.
41
Table 3: List of files for simulation sph mhd
42
10.1 Control file
The format of the control file control_MHD is described below. The detail of each block
is described in section A. You can jump to detailed description by clicking ”(Detail)”.
• data_files_def (Detail)
• model
– phys_values_ctl (Detail)
∗ array nod_value_ctl [Field] [Viz_flag] [Monitor_flag]
(Detail)
– time_evolution_ctl (Detail)
∗ array time_evo_ctl [Field] (Detail)
– boundary_condition (Detail)
∗ array bc_temperature [Group] [Type] [Value]
(Detail)
∗ array bc_velocity [Group] [Type] [Value]
(Detail)
∗ array bc_composition [Group] [Type] [Value]
(Detail)
∗ array bc_magnetic_field [Group] [Type] [Value]
(Detail)
– forces_define (Detail)
43
∗ array force_ctl [Force] (Detail)
– dimensionless_ctl (Detail)
∗ array dimless_ctl [Name] [Value] (Detail)
– coefficients_ctl (Detail)
∗ thermal (Detail)
· array coef_4_termal_ctl [Name] [Power] (Detail)
· array coef_4_t_diffuse_ctl [Name] [Power] (Detail)
· array coef_4_heat_source_ctl [Name] [Power] (De-
tail)
∗ momentum (Detail)
· array coef_4_velocity_ctl [Name] [Power] (Detail)
· array coef_4_press_ctl [Name] [Power] (Detail)
· array coef_4_v_diffuse_ctl [Name] [Power] (Detail)
· array coef_4_buoyancy_ctl [Name] [Power] (Detail)
· array coef_4_Coriolis_ctl [Name] [Power] (Detail)
· array coef_4_Lorentz_ctl [Name] [Power] (Detail)
· array coef_4_composit_buoyancy_ctl [Name] [Power]
(Detail)
∗ induction (Detail)
· array coef_4_magnetic_ctl [Name] [Power] (Detail)
· array coef_4_m_diffuse_ctl [Name] [Power] (Detail)
· array coef_4_induction_ctl [Name] [Power] (Detail)
∗ composition (Detail)
· array coef_4_composition_ctl [Name] [Power] (De-
tail)
· array coef_4_c_diffuse_ctl [Name] [Power] (Detail)
· array coef_4_composition_source_ctl [Name] [Power]
(Detail)
– temperature_define (Detail)
∗ ref_temp_ctl [REFERENCE_TEMP] (Detail)
∗ low_temp_ctl (Detail)
· depth [RADIUS] (Detail)
· temperature [TEMPERATURE] (Detail)
44
∗ high_temp_ctl (Detail)
· depth [RADIUS] (Detail)
· temperature [TEMPERATURE] (Detail)
• control
– time_step_ctl (Detail)
∗ elapsed_time_ctl [ELAPSED_TIME] (Detail)
∗ i_step_init_ctl [ISTEP_START] (Detail)
∗ i_step_finish_ctl [ISTEP_FINISH] (Detail)
∗ i_step_check_ctl [ISTEP_MONITOR] (Detail)
∗ i_step_rst_ctl [ISTEP_RESTART] (Detail)
∗ i_step_field_ctl [ISTEP_FIELD] (Detail)
∗ i_step_sectioning_ctl [ISTEP_SECTION] (Detail)
∗ i_step_isosurface_ctl [ISTEP_ISOSURFACE] (Detail)
∗ dt_ctl [DELTA_TIME] (Detail)
∗ time_init_ctl [INITIAL_TIME] (Detail)
– restart_file_ctl (Detail)
∗ rst_ctl [INITIAL_TYPE] (Detail)
– time_loop_ctl (Detail)
∗ scheme_ctl [EVOLUTION_SCHEME] (Detail)
∗ coef_imp_v_ctl [COEF_INP_U] (Detail)
∗ coef_imp_t_ctl [COEF_INP_T] (Detail)
∗ coef_imp_b_ctl [COEF_INP_B] (Detail)
∗ coef_imp_c_ctl [COEF_INP_C] (Detail)
∗ FFT_library_ctl [FFT_Name] (Detail)
∗ Legendre_trans_loop_ctl [Leg_Loop] (Detail)
• sph_monitor_ctl (Detail)
45
– layered_pwr_spectr_prefix [layer_pwr_prefix]
(Detail)
– picked_sph_prefix [picked_sph_prefix]
(Detail)
– gauss_coefs_prefix [gauss_coef_prefix]
(Detail)
– gauss_coefs_radius_ctl [gauss_coef_radius]
(Detail)
– nusselt_number_prefix [nusselt_number_prefix]
(Detail)
– array pick_layer_ctl [Layer #] (Detail)
– array pick_sph_spectr_ctl [Degree] [Order]
(Detail)
– array pick_sph_degree_ctl [Degree] (Detail)
– array pick_sph_order_ctl [Order] (Detail)
– array pick_gauss_coefs_ctl [Degree] [Order]
(Detail)
– array pick_gauss_coef_degree_ctl [Degree] (Detail)
– array pick_gauss_coef_order_ctl [Order] (Detail)
– nphi_mid_eq_ctl [Nphi_mid_equator] (Detail)
• visual_control (Detail)
46
10.3 Thermal and compositional boundary condition data file
Thermal and compositional heterogeneity at boundaries are defined by a external file
named [boundary_data_name]. In this file, temperature, composition, heat flux,
or compositional flux at ICB or CMB can be defined by spherical harmonics coeffi-
cients. To use boundary conditions in [boundary_data_name], file name is de-
fined by boundary_data_file_name column in control file, and boundary condition
type [type] is set to fixed_file or fixed_flux_file in bc_temperature or
bc_composition column. By setting fixed_file or fixed_flux_file in con-
trol file, boundary conditions are copied from the file [boundary_data_name].
An example of the boundary condition file is shown in Figure 7. As for the control file,
a line starting from ’#’ or ’!’ is recognized as a comment line. In [boundary_data_name],
boundary condition data is defined as following:
1. Number of total boundary conditions to be defined in this file.
2. Field name to define the first boundary condition
3. Place to define the first boundary condition (ICB or CMB)
4. Number of spherical harmonics modes for each boundary condition
5. Spectrum data for the boundary conditions (degree l, order m, and harmonics coef-
ficients)
6. After finishing the list of spectrum data return to Step 2 for the next boundary con-
dition
If harmonics coefficients of the boundary conditions are not listed in item 5, 0.0 is au-
tomatically applied for the harmonics coefficients of the boundary conditions. So, only
non-zero components need to be listed in the boundary condition file.
47
#
# number of boundary conditions
4
#
# boundary condition data list
#
# Fixed temperature at ICB
temperature
ICB
3
0 0 1.0E+00
1 1 2.0E-01
2 2 3.0E-01
#
# Fixed heat flux at CMB
heat_flux
CMB
2
0 0 -0.9E+0
1 -1 5.0E-1
#
# Fixed composition flux at ICB
composite_flux
ICB
2
0 0 0.0E+00
2 0 -2.5E-01
#
# Fixed composition at CMB
composition
CMB
2
0 0 1.0E+00
2 -2 5.0E-01
48
Table 4: Checked visualization application
Format Application
Distributed VTK ParaView (http://www.paraview.org)
Merged VTK ParaView, VisIt (https://wci.llnl.gov/codes/visit/)
Mayavi (http://mayavi.sourceforge.net/)
XDMF ParaView, VisIt
• Advantage
– Faster output
– No external library is required
• Disadvantage
Distributed VTK data consist files listed in Table 5. For ParaView, all subdomain data is
read by choosing [fld_prefix].[step#].pvtk in file menu.
name
[fld_prefix].[step#].[domain#].vtk VTK data for each subdomain
[fld_prefix].[step#].pvtk Subdomain file list for Paraview
49
• Advantage
• Disadvantage
name
[fld_prefix].[step#].vtk Merged VTK data
• Advantage
– Fastest output
– Merged field data is generated
– File size is smaller than the VTK formats
• Disadvantage
Merged XDMF data generate files listed in Table 7. For ParaView, all subdomain data is
read by choosing [fld_prefix].solution.xdmf in file menu.
50
Table 7: List of written files for XDMF format
name
[fld_prefix].mesh.h5 HDF5 file for geometry data
[fld_prefix].[step#].h5 HDF5 file for field data
[fld_prefix].solution.xdmf HDF5 file lists to be read
quadrature function with ten coefficients from a to k in the control array coefs_ctl.
A plane surface is defined by a normal vector (a, b, c) and one point including the
surface (x0 , y0 , z0 ) in arrays normal_vector and center_position, respectively.
A sphere surface is defined by the position of the center (x0 , y0 , z0 ) and radius r in
array center_position and radius, respectively.
51
An Ellipsoid surface is defined the position of the center (x0 , y0 , z0 ) and length of the
each axis (a, b, c) in arrays center_position and axial_length, respectively. If
one component of the axial_length is set to 0, surfacing module generate a Ellipsoidal
tube along with the axis where axial_length is set to 0.
Area for visualization can be defined by array chosen_ele_grp_ctl by choosing
outer_core, inner_core, and all. Fields to display is defined in array output_field.
In array output_field, field type in Table 9 needs to defined. The same field can be
defined more than once in array output_field to output vector field in Cartesian co-
ordinate and radial component, for example.
Table 9: List of field type for cross sectioning and isosurface module
• surface_define (Detail)
52
– section_method [METHOD] (Detail)
– array coefs_ctl [TERM] [COEFFICIENT] (Detail)
– radius [SIZE] (Detail)
– array normal_vector [DIRECTION] [COMPONENT] (Detail)
– array axial_length [DIRECTION] [COMPONENT] (Detail)
– array center_position [DIRECTION] [COMPONENT] (Detail)
– array section_area_ctl [AREA_NAME] (Detail)
• output_field_define (Detail)
• isosurf_define (Detail)
53
– isosurf_component [COMPONENT] (Detail)
– isosurf_value [VALUE] (Detail)
– array isosurf_area_ctl [AREA_NAME] (Detail)
• field_on_isosurf (Detail)
time Time
54
K ene tor Amplitude of toroidal kinetic energy
K ene Amplitude of total kinetic energy
M ene pol Amplitude of poloidal magnetic energy
M ene tor Amplitude of toroidal magnetic energy
M ene Amplitude of total magnetic energy
[Field] pol Mean square amplitude of poloidal component of [Field]
[Field] tor Mean square amplitude of toroidal component of [Field]
[Field] Mean square amplitude of [Field]
[vol pwr prefix l.dat Volume average of mean square amplitude of the fields as
a function of spherical harmonic degree l. For scalar field, the spectrum is
m=l Z
1 X
fsq (l) = (flm )2 dV.
V m=−l
For vector field, spectrum for the poloidal and toroidal components are written by
m=l Z
1 X
BSsq (l) = (B Slm )2 dV,
V m=−l
m=l Z
1 X
BT sq (l) = (B Tml )2 dV.
V m=−l
55
If the vector field F is not solenoidal (i.e. ∇ · F 6= 0), The poloidal component of
mean square data are included mean square field of the potential components as
m=l Z
1 X
(B Slm )2 + (−∇φFml )2 dV.
FSsq (l) =
V m=−l
[vol pwr prefix] m.dat Volume average of mean square amplitude of the fields
as a function of spherical harmonic order m. The zonal wave number is referred in
this spectrum data. For scalar field, the spectrum is
l=m Z
1 X h m 2 2 i
fsq (m) = (fl ) + fl−m dV.
V l=0
For vector field, spectrum for the poloidal and toroidal components are written by
l=m Z
1 X h m 2
i
−m 2
BSsq (m) = (B Sl ) + B Sl dV,
V l=0
l=m Z
1 X h 2 i
BT sq (m) = (B Tml )2 + B T−m
l dV.
V l=0
[vol pwr prefix] lm.dat Volume average of mean square amplitude of the fields
as a function of spherical harmonic order n = l − m. The wave number in the
latitude direction is referred in this spectrum data. For scalar field, the spectrum is
l=l−n Z h
1 X l−n 2
i
−l+n 2
fsq (n) = fl + fl dV.
V l=n
For vector field, spectrum for the poloidal and toroidal components are written by
l=l−n Z h
1 X 2 2 i
BSsq (n) = B Sll−n + B Sl−l+n dV,
V l=n
l=l−n Z h
1 X 2 i
−l+n 2
BT sq (n) = B Tl−n
l + B Tl dV.
V l=n
56
10.7.3 layered spectrum data
Spectrum data for the each radial position are written by defining layered pwr spectr prefix
in control file. By defining layered pwr spectr prefix, following spectrum data
averaged over the fluid shell is written. Data format is the same as the volume spectrum
data, but radial grid point and radius of the layer is added in the list. The following files
are generated. The radial points for output is listed in the array spectr_layer_ctl. If
spectr_layer_ctl is not defined, mean square data at all radial levels will be written.
See example of dynamo benchmark case 2.
[layer pwr prefix] s.dat Surface average of mean square amplitude of the fields.
[layer pwr prefix] l.dat Surface average of mean square amplitude of the fields
as a function of spherical harmonic degree l and radial grid id k. For scalar field, the
spectrum is
m=l Z
1 X
fsq (k, l) = (flm )2 dS.
S m=−l
For vector field, spectrum for the poloidal and toroidal components are written by
m=l Z
1 X
BSsq (k, l) = (B Slm )2 dS,
S m=−l
m=l Z
1 X
BT sq (k, l) = (B Tml )2 dS.
S m=−l
[layer pwr prefix] m.dat Surace average of mean square amplitude of the fields
as a function of spherical harmonic order m and radial grid id k. The zonal wave
number is referred in this spectrum data. For scalar field, the spectrum is
l=L Z
1X h m 2 −m 2
i
fsq (k, m) = (fl ) + fl dS.
S l=m
For vector field, spectrum for the poloidal and toroidal components are written by
l=L Z
1X h 2 i
BSsq (k, m) = (B Slm )2 + B Sl−m dS,
S l=m
l=L Z
1X h m 2 −m 2
i
BT sq (k, m) = (B T l ) + B T l dS.
S l=m
57
[layer pwr prefix] lm.dat Surface average of mean square amplitude of the
fields as a function of spherical harmonic order n = l − m and radial grid id k.
The wave number in the latitude direction is referred in this spectrum data. For
scalar field, the spectrum is
l=L Z
1 X h l−n 2 2 i
fsq (k, n) = fl + fl−l+n dS.
S l=n
For vector field, spectrum for the poloidal and toroidal components are written by
l=L Z
1X h l−n 2
i
−l+n 2
BSsq (k, n) = B Sl + B Sl dS,
S l=n
l=L Z
1X h 2 i
−l+n 2
BT sq (k, n) = B Tl−n
l + B Tl dS.
S l=n
The data file has the following headers in the first three lines,
The data consists of time step, time, and Gauss coefficients for each step in one line. If the
Gauss coefficients data file exist before starting the simulation, programs append Gauss
coefficients at the end of files without checking constancy of the number of data and order
of the field. If you change the configuration of data output structure, please move the old
Gauss coefficients file to another directory before starting the programs.
58
10.9 Spectrum monitor data [picked sph prefix].dat
This program outputs spherical harmonics coefficients at specified spherical harmonics
modes and radial points in single text file. Spectrum data marked [Monitor_On] are
written in our line for each spherical harmonics mode and radial point every
[increment_monitor] steps. If the spectrum monitor data file exist before starting
the simulation, programs append spectrum data at the end of files without checking con-
stancy of the number of data and order of the field. If you change the configuration of data
output structure, please move the old spectrum monitor file to another directory before
starting the programs.
If a vector field F is not a solenoidal field, F is described by the spherical harmonics
coefficients of the poloidal FSlm , toroidal FTm m
l , and potential ϕl components as
L X l
1 ∂ϕ00 X
F (r, θ, φ) = − 2 r̂ + [∇ × ∇ × (FSlm r̂) + ∇ × (FTm m m
l ) − ∇ (ϕl Yl )] .
r ∂r l=1 m=−l
In Calypso, the following coefficients are written for the non-solenoidal vector.
r2 ∂ϕm
FSlm − l
for (l 6= 0)
[field_name]_pol : l (l + 1) ∂r
∂ϕ0
−r2 0
for (l = 0)
∂r
∂FSlm
(
− ϕm l for (l 6= 0)
[field_name]_dpdr : ∂r
0 for (l = 0)
[field_name]_tor : FTm
l
where, < ∂T /∂r > and Tdif f are the horizontal average of the temperature gradient at
ICB and CMB and diffusive temperature profile, respectively. Tdif f is evaluated without
59
heat source, as
ro To − ri Ti ro ri (Ti − To ) 1
Tdif f = + .
ro − ri ro − ri r
This diffusive temperature profile is for the case without heat source in the fluid. If simu-
lation is performed including the heat source, this data file does not written. If the Nusselt
number data file exist before starting the simulation, programs append spectrum data at
the end of files without checking constancy. If you change the configuration of data output
structure, please move the old spectrum monitor file to another directory before starting
the programs.
60
11 Data transform program
(sph snapshot and sph zm snapshot)
Simulation program outputs spectrum data as a whole field data. This program gen-
erates field data from spectrum data for visualization. This program also can pick Gauss
coefficients, mean square data over sphere or each surface from spectrum data as the sim-
ulation program.
This program requires control file control_snapshot. File format of the control
file is same as the control field for simulation control MHD.
The same files as the simulation program are read in this program, and field data are
generated from the snapshots of spectrum data. The monitoring data for snapshots can
also be generated. [step #] is added in the file name, and the [step #] is calculated
by time step/[ISTEP_FIELD].
We recommend to output cross section data at y = 0 by using sectioning module (see
10.5) for zonal mean snapshot program sph_zm_snapshot to reduce data size.
61
Table 10: List of files for simulation sph snap and sph zm snap
62
12 Initial field generation program
(sph initial field)
The initial fields for dynamo benchmark can set in the simulation program by setting
[INITIAL_TYPE] flag. This program is used to generate initial field by user. The heat
source qT and light element source qC are also defined by this program because qT and qC
are defined as scalar fields. The Fortran source file to define initial field
const_sph_initial_spectr.f90 is saved in src/programs/data_utilities
/INITIAL_FIELD/ directory, and please compile again after modifying this module.
This program also needs the files listed in Table 11. This program generates the spectrum
63
please set [ISTEP START] to be 0 and [INITIAL TYPE] to be start from rst file.
The construction routine for each field are called from the top routine
const_sph_initial_spectr.f90. If lines to call subroutines are commented out,
corresponding initial fields are set to 0. In addition, the initial fields to be constructed need
to be defined by nod_value_ctl array in the control_MHD.
64
Initial fields need to be defined by the spherical harmonics coefficients at each radial
points as array d_rj(i,i_field), where i and i_field are the local address of the
spectrum data and field id, respectively. The address of the fields are listed in Table 12.
In Calypso, local data address for each MPI process is used for the spectrum data ad-
dress i. To find the local address i, two functions are required.
First, j = find_local_sph_mode_address(l,m) returns the local spherical har-
monics address j from aa spherical harmonics mode Ylm . If process does not have the
data for Ylm , j is set to 0. Second, i = local_sph_data_address(k,j) re-
turns the local data address i from radial grid number k and local spherical harmonics
id j. For do loops in the radial direction, the total number of radial grid points, radial ad-
dress for ICB, and radial address for CMB are defined as nidx_rj(1), nlayer_ICB,
and nlayer_CMB, respectively. The radius for the k-th grid points can be obtained by
r = radius_1d_rj_r(k). The subroutines to define initial temperature for the dy-
namo benchmark Case 1 is shown below as an example.
After updating the source code, the program sph_initial_field needs to be
updated. To update the program, move to the work directory [CALYPSO_HOME]/work
and run make command as
% cd \verb|[CALYPSO_HOME]/work|
% make
!
subroutine set_initial_temperature
!
use m_sph_spectr_data
!
integer ( kind = kint) :: inod, k, jj
real (kind = kreal) :: pi, rr, xr, shell
real(kind = kreal), parameter :: A_temp = 0.1d0
!
!
!$omp parallel do
do inod = 1, nnod_rj
d_rj(inod,ipol%i_temp) = zero
end do
!$omp end parallel do
65
!
pi = four * atan(one)
shell = r_CMB - r_ICB
!
! search address for (l = m = 0)
jj = find_local_sph_mode_address(0, 0)
!
! set reference temperature if (l = m = 0) mode is there
if (jj .gt. 0) then
do k = 1, nlayer_ICB-1
inod = local_sph_data_address(k,jj)
d_rj(inod,ipol%i_temp) = 1.0d0
end do
do k = nlayer_ICB, nlayer_CMB
inod = local_sph_data_address(k,jj)
d_rj(inod,ipol%i_temp) = (ar_1d_rj(k,1) * 20.d0/13.0d0 &
& - 1.0d0 ) * 7.0d0 / 13.0d0
end do
end if
!
!
! Find local addrtess for (l,m) = (4,4)
jj = find_local_sph_mode_address(4, 4)
! jj = find_local_sph_mode_address(5, 5)
!
! If data for (l,m) = (4,4) is there, set initial temperature
if (jj .gt. 0) then
! Set initial field from ICB to CMB
do k = nlayer_ICB, nlayer_CMB
!
! Set radius data
rr = radius_1d_rj_r(k)
! Set 1d address to substitute at (Nr, j)
inod = local_sph_data_address(k,jj)
!
! set initial temperature
xr = two * rr - one * (r_CMB+r_ICB) / shell
d_rj(inod,ipol%i_temp) = (one-three*xr**2+three*xr**4-xr**6) &
66
& * A_temp * three / (sqrt(two*pi))
end do
end if
!
! Center
if(inod_rj_center .gt. 0) then
jj = find_local_sph_mode_address(0, 0)
inod = local_sph_data_address(1,jj)
d_rj(inod_rj_center,ipol%i_temp) = d_rj(inod,ipol%i_temp)
end if
!
end subroutine set_initial_temperature
!
Caution: This program overwrites existing initial field data. Please run it after
taking a backup.
This program modifies or adds new data to an initial field file. It could be used
to start a new geodynamo simulation by adding seed magnetic field or source terms to
67
a non-magnetic convection simulation. The initial fields to be added are also defined
in const_sph_initial_spectr.f90. data_utilities/INITIAL_FIELD/
directory. This program also needs the files listed in Table 13. This program generates the
Table 13: List of files for simulation sph add initial field
68
Table 14: List of files for dynamo benchmark check sph dynamobench
time: Time
69
ME total: Total magnetic energy (Case 1 and 2)
MAG torque ic z: Magnetic torque integrated over the inner core (Case 2)
phi 1...4: Longitude where ur = 0 and ∂ur /∂φ > 0 at mid-depth in equatorial
plane.
70
Input data Program Output data
(Serial)
Spectr index data
New spectr
index data
• data_files_def (Detail)
71
Table 15: List of files for assemble sph
• new_data_files_def (Detail)
• control
– time_step_ctl (Detail)
∗ i_step_init_ctl [integer] (Detail)
∗ i_step_finish_ctl [integer] (Detail)
∗ i_step_rst_ctl [integer] (Detail)
– new_time_step_ctl (Detail)
∗ i_step_init_ctl [integer] (Detail)
∗ i_step_rst_ctl [integer] (Detail)
∗ time_init_ctl [INITIAL_TIME] (Detail)
• newrst_magne_ctl (Detail)
72
16 Module dependency program (module dependency)
This program is only used to generate Makefile in work directory. Most of case, Fortran
90 modules have to compiled prior to be referred by another fortran90 routines. This
program is generates dependency lists in Makefile. To use this program, the following
limitation is required.
73
Table 16: List of programs to take time average
3. Input data name for radial magnetic field (”B r” in Figure 13)
After obtaining the radial mantric field, the image in figure 14 is obtained by using ”slice”
and ”Contour” tools with appropriate color mapping.
74
Figure 12: File open window for ParaView
75
Figure 13: File open window for ParaView
76
References
[1] Bullard, E. C. and Gellman, H., Homogeneous dynamos and terrestrial magnetism,
Proc. of the Roy. Soc. of London, A247, 213–278, 1954.
[2] Christensen, U.R., Aubert, J., Cardin, P., Dormy, E., Gibbons, S., Glatzmaier, G.
A., Grote, E., Honkura, H., Jones, C., Kono, M., Matsushima, M., Sakuraba, A.,
Takahashi, F., Tilgner, A., Wicht, J. and Zhang, K., A numerical dynamo benchmark,
Physics of the Earth and Planetary Interiors, 128, 25–34, 2001.
77
Appendix A Definition of parameters for control files
A.1 data files def
File names and number of processes and threads are defined in this block.
(Back to control MHD)
(Back to control sph shell)
(Back to control assemble sph)
78
single HDF5 Merged HDF5 file (Available if HDF5 library is linked)
single VTK Merged VTK file (Default)
VTK Distributed VTK file
79
Table 17: List of field name
80
Table 18: List of field name for time evolution
fixed Fixed homogeneous temperature on the boundary. The fixed value is defined in
[Value] by real.
fixed file Fixed temperature defined by external file. [Value] in this line is ig-
nored. See section 10.3.
fixed flux Fixed homogeneous heat flux on the boundary. The value is defined in
[Value] by real. Positive value indicates outward flux from fluid shell. (e.g. Flux
to center at ICB and Flux to mantle at CMB are positive.)
fixed flux file Fixed heat flux defined by external file. [Value] in this line is
ignored. See section 10.3.
non slip sph Non-slip boundary is applied to the boundary defined in [Group].
Real value is required in [Value], but they value is not used in the program.
free slip sph Free-slip boundary is applied to the boundary defined in [Group].
Real value is required in [Value], but they value is not used in the program.
rot inner core If this condition is set, inner core (r < ri ) rotation is solved by using
viscous torque and Lorentz torque. This boundary condition can be used for ICB,
81
and grid is filled to center. Real value is required in [Value], but they value is not
used in the program.
rot x Set constant rotation around x-axis in [Value] by real. Rotation vector can be
defined with rot y and rot z.
rot y Set constant rotation around y-axis in [Value] by real. Rotation vector can be
defined with rot z and rot x.
rot z Set constant rotation around z-axis in [Value] by real. Rotation vector can be
defined with rot x and rot y.
sph to center If this condition is set, magnetic field in conductive inner core (r < ri )
is solved. This boundary condition can be used for ICB, and grid is filled to center.
The value at [Value] does not used.
fixed Fixed homogeneous composition on the boundary. The fixed value is defined in
[Value] by real.
fixed file Fixed composition defined by external file. [Value] in this line is ig-
nored. See section 10.3.
fixed flux Fixed homogeneous compositional flux on the boundary. The value is
defined in [Value] by real. Positive value indicates outward flux from fluid shell.
(e.g. Flux to center at ICB and Flux to mantle at CMB are positive.)
fixed flux file Fixed compositional flux defined by external file. [Value] in this
line is ignored. See section 10.3.
82
A.5 forces define
Forces for the momentum equation are defined in this block.
(Back to control MHD)
83
A.7 coefficients ctl
Coefficients of each term in governing equations are defined in this block. Each co-
efficients are defined by list of name of dimensionless number [Name] and its power
[Power]. For example, coefficient for Coriolis term for the dynamo benchmark 2E −1 is
defined as
array coef_4_Coriolis_ctl 2
coef_4_Coriolis_ctl Two 1.0
coef_4_Coriolis_ctl Ekman_number -1.0
end array coef_4_Coriolis_ctl
A.7.1 thermal
Coefficients of each term in heat equation are defined in this block.
(Back to control MHD)
A.7.2 momentum
Coefficients of each term in momentum equation are defined in this block.
(Back to control MHD)
84
coef 4 press ctl [Name] [Power]
Coefficient for pressure gradient −∇P is defined by this array. Pressure does not appear
the vorticity equation which is used for the time integration. But this coefficient is used to
evaluate pressure field.
A.7.3 induction
Coefficients of each term in magnetic induction equation are defined in this block.
(Back to control MHD)
85
A.7.4 composition
Coefficients of each term in composition equation are defined in this block.
(Back to control MHD)
low temp ctl Amplitude of low reference temperature Tl and its radius rl (Generally
rl = ro ) are defined in this block.
high temp ctl Amplitude of high reference temperature Th and its radius rh (Gener-
ally rh = ri ) are defined in this block.
86
depth [RADIUS]
Radius for reference temperature is defined by real.
temperature [TEMPERATURE]
Temperature for reference temperature is defined by real.
87
i step field ctl [ISTEP_FIELD]
Increment of time step to output field data for visualization [ISTEP_FIELD] is defined
by integer. If [ISTEP_FIELD] is set to be 0, no field data are written.
dt ctl [DELTA_TIME]
Length of time step ∆t is defined by real value.
No data No initial data file. Small temperature perturbation and seed magnetic field are
set as an initial field.
88
start from rst file Initial field is read from spectrum data file. File prefix is
defined by restart file prefix.
Pseudo vacuum benchmark Generate initial field for pseudo vacuum dynamo bench-
mark
Crank Nicolson Crank-Nicolson scheme for diffusion terms and second order Adams-
Bashforth scheme the other terms.
89
FFT library ctl [FFT_Name]
FFT library name for Fourier transform is defined by text. The following libraries are
available for [FFT_Name]. If this flag is not defined, program searches the fastest library
in the initialization process.
Inner radial loop Loop for the radial grids is set as the innermost loop
Outer radial loop Loop for the radial grids is set as the outermost loop
90
If this file prefix is not defined, volume spectrum data are not generated and volume mean
square data is written as sph_pwr_volume_s.dat.
array spectr layer ctl [Layer #] List of radial grid point number [Layer #]
to output power spectrum data by integer. If this array is not defined, layered mean square
data are written for all radial grid points.
91
array pick layer ctl [Layer #] List of radial grid point number [Layer #]
to output picked spectrum data by integer. If this array is not defined, picked spectrum data
are written for all radial grid points.
92
A.14 visual control
Visualization modules are defined in this block. Parameters for cross sections and isosur-
faces are defined in this block.
(Back to visual control)
93
Each coefficient a to k are defined by the name of the term [TERM] and real value
[COEFFICIENT] as shown in Table 22.
radius [SIZE]
[SIZE] defines radius r for a sphere surface defined by
(x − x0 )2 + (y − y0 )2 + (z − z0 )2 = r2 .
94
Each component is defined by [DIRECTION] and real value [COMPONENT] as shown
in Table 23.
section area ctl Areas for the cross sectioning are defined in this array. The fol-
lowing groups can be defined in this block.
output field Field informations for cross section are defined in this array. Name
of the output fields is defined by [FIELD], and component of the fields is defined by
[COMPONENT]. Labels of the field name are listed in Table 17, and labels of the compo-
nent are listed in Table 25.
95
Table 25: List of field type for cross sectioning and isosurface module
isosurf field Field name for isosurface is defined by [FIELD]. Labels of the field
name are listed in Table 17.
isosurf area ctl Areas for the isosurfacing are defined in this array. The same
groups can be defined as section area ctl.
96
A.15.4 field on isosurf
Field data on the isosurface are defined in this block.
(Back to isosurface ctl)
result type Output data type is defined by [TYPE]. Following types can be defined:
constant Constant value is set as a result field. The amplitude is set by result_value.
field field data on the isosurface are written. Fields to be written are defined by
output_field array.
output field Field informations for cross section are defined in this array. Name
of the output fields is defined by [FIELD], and component of the fields is defined by
[COMPONENT]. Labels of the field name are listed in Table 17, and labels of the compo-
nent are listed in Table 25.
97
num domain sph grid [Direction] [Ndomain]
Definition of number of subdomains for physical data in spherical coordinate (r, θ, φ).
Direction radial or meridional is set in [Direction], and number of subdomains
[Ndomain] are defined in the integer field.
98
num fluid grid ctl [Nr_shell]
(This option works with radial_grid_type_ctl is explicit or Chebyshev.)
Number of layer in the fluid shell [Nr_shell] is defined by integer. Number of grids
including CMB and ICB will be ([Nr_shell] + 1).
ICB ICB
CMB CMB
99
A.18 new data files def
File names and number of processes for new domain decomposed data are defined in this
block.
(Back to control assemble sph)
100
Appendix B GNU GENERAL PUBLIC LICENSE
Copyright c 1989, 1991 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies of this license document,
but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share and
change it. By contrast, the GNU General Public License is intended to guarantee your
freedom to share and change free software—to make sure the software is free for all its
users. This General Public License applies to most of the Free Software Foundation’s
software and to any other program whose authors commit to using it. (Some other Free
Software Foundation software is covered by the GNU Library General Public License
instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General
Public Licenses are designed to make sure that you have the freedom to distribute copies
of free software (and charge for this service if you wish), that you receive source code or
can get it if you want it, that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny you
these rights or to ask you to surrender the rights. These restrictions translate to certain
responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a fee,
you must give the recipients all the rights that you have. You must make sure that they,
too, receive or can get the source code. And you must show them these terms so they know
their rights.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this
license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author’s protection and ours, we want to make certain that everyone
understands that there is no warranty for this free software. If the software is modified by
someone else and passed on, we want its recipients to know that what they have is not the
original, so that any problems introduced by others will not reflect on the original authors’
reputations.
Finally, any free program is threatened constantly by software patents. We wish to
avoid the danger that redistributors of a free program will individually obtain patent li-
101
censes, in effect making the program proprietary. To prevent this, we have made it clear
that any patent must be licensed for everyone’s free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification follow.
1. You may copy and distribute verbatim copies of the Program’s source code as you
receive it, in any medium, provided that you conspicuously and appropriately pub-
lish on each copy an appropriate copyright notice and disclaimer of warranty; keep
intact all the notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License along with the
Program.
You may charge a fee for the physical act of transferring a copy, and you may at
your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus form-
ing a work based on the Program, and copy and distribute such modifications or
work under the terms of Section 1 above, provided that you also meet all of these
conditions:
(a) You must cause the modified files to carry prominent notices stating that you
changed the files and the date of any change.
102
(b) You must cause any work that you distribute or publish, that in whole or in part
contains or is derived from the Program or any part thereof, to be licensed as a
whole at no charge to all third parties under the terms of this License.
(c) If the modified program normally reads commands interactively when run, you
must cause it, when started running for such interactive use in the most ordi-
nary way, to print or display an announcement including an appropriate copy-
right notice and a notice that there is no warranty (or else, saying that you
provide a warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this License. (Excep-
tion: if the Program itself is interactive but does not normally print such an
announcement, your work based on the Program is not required to print an
announcement.)
103
code, to be distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
(c) Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for noncommer-
cial distribution and only if you received the program in object code or exe-
cutable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making mod-
ifications to it. For an executable work, complete source code means all the source
code for all modules it contains, plus any associated interface definition files, plus
the scripts used to control compilation and installation of the executable. However,
as a special exception, the source code distributed need not include anything that is
normally distributed (in either source or binary form) with the major components
(compiler, kernel, and so on) of the operating system on which the executable runs,
unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from
a designated place, then offering equivalent access to copy the source code from the
same place counts as distribution of the source code, even though third parties are
not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as expressly
provided under this License. Any attempt otherwise to copy, modify, sublicense or
distribute the Program is void, and will automatically terminate your rights under
this License. However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such parties remain in
full compliance.
5. You are not required to accept this License, since you have not signed it. However,
nothing else grants you permission to modify or distribute the Program or its deriva-
tive works. These actions are prohibited by law if you do not accept this License.
Therefore, by modifying or distributing the Program (or any work based on the Pro-
gram), you indicate your acceptance of this License to do so, and all its terms and
conditions for copying, distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program), the re-
cipient automatically receives a license from the original licensor to copy, distribute
or modify the Program subject to these terms and conditions. You may not impose
any further restrictions on the recipients’ exercise of the rights granted herein. You
are not responsible for enforcing compliance by third parties to this License.
104
7. If, as a consequence of a court judgment or allegation of patent infringement or
for any other reason (not limited to patent issues), conditions are imposed on you
(whether by court order, agreement or otherwise) that contradict the conditions of
this License, they do not excuse you from the conditions of this License. If you
cannot distribute so as to satisfy simultaneously your obligations under this License
and any other pertinent obligations, then as a consequence you may not distribute
the Program at all. For example, if a patent license would not permit royalty-free
redistribution of the Program by all those who receive copies directly or indirectly
through you, then the only way you could satisfy both it and this License would be
to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any particular
circumstance, the balance of the section is intended to apply and the section as a
whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other
property right claims or to contest validity of any such claims; this section has
the sole purpose of protecting the integrity of the free software distribution sys-
tem, which is implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed through that system
in reliance on consistent application of that system; it is up to the author/donor to
decide if he or she is willing to distribute software through any other system and a
licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a conse-
quence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries either
by patents or by copyrighted interfaces, the original copyright holder who places the
Program under this License may add an explicit geographical distribution limitation
excluding those countries, so that distribution is permitted only in or among coun-
tries not thus excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions of the Gen-
eral Public License from time to time. Such new versions will be similar in spirit to
the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies a
version number of this License which applies to it and “any later version”, you have
the option of following the terms and conditions either of that version or of any later
version published by the Free Software Foundation. If the Program does not specify
105
a version number of this License, you may choose any version ever published by the
Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs whose
distribution conditions are different, write to the author to ask for permission. For
software which is copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our decision will be
guided by the two goals of preserving the free status of all derivatives of our free
software and of promoting the sharing and reuse of software generally.
N O WARRANTY
11. B ECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE , THERE IS NO WAR -
RANTY FOR THE PROGRAM , TO THE EXTENT PERMITTED BY APPLICABLE LAW.
E XCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND / OR
OTHER PARTIES PROVIDE THE PROGRAM “AS IS ” WITHOUT WARRANTY OF ANY
KIND , EITHER EXPRESSED OR IMPLIED , INCLUDING , BUT NOT LIMITED TO , THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU -
LAR PURPOSE . T HE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF
THE PROGRAM IS WITH YOU . S HOULD THE PROGRAM PROVE DEFECTIVE , YOU
ASSUME THE COST OF ALL NECESSARY SERVICING , REPAIR OR CORRECTION .
106
Appendix: How to Apply These Terms to Your New Pro-
grams
If you develop a new program, and you want it to be of the greatest possible use to the pub-
lic, the best way to achieve this is to make it free software which everyone can redistribute
and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the
start of each source file to most effectively convey the exclusion of warranty; and each file
should have at least the “copyright” line and a pointer to where the full notice is found.
one line to give the program’s name and a brief idea of what it does.
Copyright (C) yyyy name of author
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Soft-
ware Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABIL-
ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an
interactive mode:
Gnomovision version 69, Copyright (C) yyyy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type
‘show w’.
This is free software, and you are welcome to redistribute it under certain
conditions; type ‘show c’ for details.
The hypothetical commands show w and show c should show the appropriate parts
of the General Public License. Of course, the commands you use may be called some-
thing other than show w and show c; they could even be mouse-clicks or menu items—
whatever suits your program.
107
You should also get your employer (if you work as a programmer) or your school, if
any, to sign a “copyright disclaimer” for the program, if necessary. Here is a sample; alter
the names:
This General Public License does not permit incorporating your program into propri-
etary programs. If your program is a subroutine library, you may consider it more useful
to permit linking proprietary applications with the library. If this is what you want to do,
use the GNU Library General Public License instead of this License.
108