... Lin1
Physics Department, North Park University, 3225 W. Foster Ave., Chicago, IL 60625, USA
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...(QTCM1)1.1
http://www.atmos.ucla.edu/$\sim$csi
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... Scientists:1.2
http://www.johnny-lin.com/cdat_tips/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... work.1.3
http://scholar.google.com/scholar?hl=en&lr=&cites=14217886709842286738
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...Download2.1
http://www.johnny-lin.com/py_pkgs/qtcm/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... UCAR2.2
http://www.unidata.ucar.edu/downloads/netcdf/netcdf-3_6_2/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... users2.3
http://finkproject.org/faq/usage-fink.php?phpLang=en#kernel-panics
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... tools.2.4
The package should work in Mac OS X 10.4 with XCode 2.4.1 and higher; I've tried it with both 2.4.1 and XCode 2.5. Note that XCode 3.1 only works on Mac OS X 10.5.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...http://tcltkaqua.sourceforge.net/.2.5
Theoretically you can use Fink to install the equivalent of these packages, but I like the specific collection found in these packages. For instance, Tcl/Tk Aqua BI runs natively on the Mac.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... needed.2.6
The one drawback of Fink is that it sometimes has stability problems. In those cases, Fink provides command line suggestions to fix the problems, which sometimes will work. If not, sometimesdeleting Fink and everything it installed, and starting afresh, will do the trick. It also appeared to me that sometimes when I installed multiple packages via one fink install call, the installation did not work as well as when I installed only one package per call.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... UCAR2.7
http://www.unidata.ucar.edu/downloads/netcdf/netcdf-3_6_2/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... left-to-right2.8
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Link-Options.html#index-l-670
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... command:2.9
I use curl because I usually access my Ubuntu server via a terminal session.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... instructions2.10
http://g95.sourceforge.net/docs.html#starting
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... install.2.11
The G95 installation instructions say you can put g95-install anywhere, and make a link to the executable g95 in $\sim$/bin. I put g95-install in /usr/local, and while in /usr/local/bin, I put a link to the G95 executable using the command:
sudo ln -s ../g95-install_64/bin/x86_64-suse-linux-gnu-g95 g95.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... UCAR2.12
http://www.unidata.ucar.edu/downloads/netcdf/netcdf-3_6_2/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... step).2.13
Note that when you build netCDF, make sure the build directory is not in the directory tree of -prefix or the default directory /usr/local.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... left-to-right2.14
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Link-Options.html#index-l-670
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... (PIC).2.15
http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... source.2.16
http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... Sourceforge2.17
http://sourceforge.net/project/showfiles.php?group_id=80706
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
....3.1
The Python os module enables platform-independent handling of files and directories. The os.path.join function resolves paths without the programmer needing to know all the possible directory separation characters; the function chooses the correct separation character at runtime. The os.getcwd function returns the current working directory.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... instance.3.2
Note non-field variables can also be instances of Field, and that Qtcm instances have other attributes that are not equal to Field instances.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... array.3.3
At the very least, match the rank of the array, which is required for the routines in setbypy to properly choose which Fortran subroutine to use in reading the Python value. I haven't tested if only the rank is needed, however, for the passing to work, for a continuation run (my hunch is it won't).
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... run\_session.3.4
Unless overridden, by default, init_with_instance_state is set to True on Qtcm instance instantiation.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...:3.5
Remember Python assignment defaults to assignment by reference, so in this example the variable mysnapshot is a pointer to the model.snapshot attribute. (However, note that model.snapshot itself is not a reference, but a distinct copy of those variables; to do otherwise would result in a non-static snapshot.) If the model.snapshot attribute is dereferenced, then mysnapshot will become the sole pointer to the dictionary.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... sides.4.1
The private instance attribute is __qtcm. See Section 6.7.3 for details about private Qtcm instance attributes.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... differences.4.2
One difference being mrestart, which in qtcm will have the value of 0 in contrast to the pure-Fortran QTCM1 where the default is the 1.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... level.4.3
That control is via run lists, which are described in Section 4.6.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... fields.4.4
The setbypy Python module is the wrap of the Fortran QTCM1 SetByPy module.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...:4.5
All Fortran routines used to pass variables back and forth are defined in the setbypy module of the .so extension module stored in the Qtcm instance variable __qtcm. All Fortran wrappers that enable Python to call compiled QTCM1 model subroutines are defined in the wrapcall module stored in the Qtcm instance variable __qtcm. These modules are described in detail in Sections 6.3.1 and 6.3.2, respectively.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... unchanged.4.6
We handle this situation in this way to enable the Qtcm instance to store variables even if the compiled model is not yet ready to accept them.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... file.4.7
The cont keyword parameter in run_session and the value of the init_with_instance_state attribute have no effect if compiled_form='full'. With 'full', the call to initialize variables all happens at the Fortran level (via the Fortran varinit, not the Python varinit), with no reference to the Python field states (or even existing Fortran field states, if present).
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...)4.8
init_prognostic_dict is the dictionary giving the default initial values of each prognostic variable and right-hand side (as defined by the restart file specification).
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... contiguously.4.9
For continuation run sessions, you keep the same extension module (the compiled .so library), and all the values that define the state where it left off.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... Fortran-level.4.10
I use the term ``field variables'' to refer to compiled QTCM1 model variables that can be passed back and forth to the Python level.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
....4.11
All field variables must be defined in defaults in order for the proper Fortran routine to be called according to the variable's type.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...6.1
http://www.johnny-lin.com/py_pkgs/qtcm/doc/html-api/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... types.6.2
The interface construct in Fortran 90 is supposed to provide a way to create a single interface to multiple routines, e.g.:
Interface setitem
Module Procedure setitem_real, setitem_int, setitem_str
End Interface
This construct, however, causes a bus error (Mac OS X 10.4, Intel). Thus, I put the same functionality in the Python code.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... subroutine).6.3
I tried to implement Fortran subroutine getitem_real_array using traditional array dimension passing (e.g., subroutine foo(nx, ny, a)) as well as declaring the allocatable array inside the subroutine, but neither option worked on my f2py (version 2_3816) and Python (version 2.4.3).
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...routine:6.4
In the pure-Fortran version of QTCM1, this routine is found in driver.F90.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... literals.6.5
Those literals are defined by defaults private module variables __viscT, __viscQ, and __viscU.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...varinit6.6
http://www.johnny-lin.com/py_docs/qtcm/doc/html-api/qtcm.qtcm.Qtcm-class.html#varinit
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
... Way,''6.7
http://cens.ioc.ee/projects/f2py2e/usersguide/index.html#the-quick-and-smart-way
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...CliMT7.1
http://maths.ucd.ie/$\sim$rca/climt/
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.