Computational Thermodynamics (CT) Server

Home | Contact Information | Organization | Personnel | Publications | Research | Software
Home | CORBA Geotherm | CORBA MELTS | CORBA Phase Prop | Documentation | Site Admin | Software Download | Thermo Data | Web calculators | Web services
Home | alphaMELTS | Applet | Mac OS X | Unix | Manual | Calculator (forms) | Calculator (applet) | Database
Portal
Portal
subglobal6 link | subglobal6 link | subglobal6 link | subglobal6 link | subglobal6 link | subglobal6 link | subglobal6 link
subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link
subglobal8 link | subglobal8 link | subglobal8 link | subglobal8 link | subglobal8 link | subglobal8 link | subglobal8 link

Software Documentation

small logo

Documentation for CORBA IDL specifications

CORBA IDL specifications are intended for client download. They are compiled into a suitable language (C++, Java) using an IDL compiler. Examples of how to do this for python, C++ and Java programming languages are given below. A series of server methods that retrieve thermodynamic properties of solid phases can be accessed using the phases IDL. Other server methods that implement MELTS-type liquid-solid phase equilibrium calculations can be accessed using the rock IDL.


Documentation for server-side functions referenced in the IDLs

Documentation for the entire set of server methods referenced by the phases and rock IDLs may be viewed at this link.


Example python code

The following short python program demonstrates a simple client that calculates the oxygen fugacity along the Nickel-Nickel oxide (bunsenite) oxygen buffer at specified temperature (T) and reference pressure.

A python aware ORB implementation must be installed on the client for this software to function. We recommend omniORB 4.0.6 and omniORBpy 2.6, both available from the omniORB site at Sourceforge. We install this software at the root location /usr/local.

In a clean working directory, download the files

Compile the IDL, e.g. in omniORB execute

omniidl -I $OMNIROOT/share/idl/omniORB -bpython phases.idl.

where the environment variable OMNIROOT is set to the root install directory of omniORB (on our system that's /usr/local). This command will generate a series of files and subdirectories that provide a python translation of the IDL specification.

Next, make sure that two environment variables are set:

  • OMNIROOT, which points to the root installation directory of omniORB, and
  • PHASEROOT, which points to the location of the file phases.idl. Set this to the current directory for this example.

Now, run the client by typing a command at the terminal prompt like

python NNO.py -ORBInitRef NameService=corbaname::ofm-research.org

The command argument "-ORBInitRef NameService=corbaname::ofm-research.org" identifies the CORBA nameserver at ofm-research.org. Enter a temperature at the prompt and an oxygen fugacity will be returned.

If you examine the python code, you will find that the nuts-and-bolts of the ORB intercommunication are achieved in the module dPhaseClients.py, which implements the call getORB() in NNO.py. This intercommunication includes contacting the OFM nameserver and obtaining from it a reference to the "Phase" object server at OFM. The call to getPhaseFactory(...) returns a reference to the server-side function that generates client-localized instances of specific phases. The spawnPhase methods create those user-specific instances and the methods setTk(...) and getG() set the temperature and retrieve Gibbs free energy respectively. These methods and additional capabilities are documented in the phases IDL. The client can retrieve a list of available phases using the getPhaseNames method on a phaseFactory object.


Example C++ code

The following short C++ program demonstrates a simple client that calculates the oxygen fugacity along the Nickel-Nickel oxide (bunsenite) oxygen buffer at specified temperature (T) and reference pressure. Its functionality is identical to the python code example described above.

An ORB implementation must be installed on the client for this software to function. We recommend omniORB 4.0.6 from the omniORB site at Sourceforge. We install this software at the root location /usr/local.

In a clean working directory, download the files

Compile the IDL, e.g. in omniORB execute

omniidl -I $OMNIROOT/share/idl/omniORB -bcxx phases.idl.

where the environment variable OMNIROOT is set to the root install directory of omniORB (on our system that's /usr/local). This command will generate a series of files and subdirectories that provide a C++ translation of the IDL specification.

Next compile and link the executable using a suitable C++ compiler (we use gcc). The command should look something like this:

g++ -I$OMNIROOT/share/idl/omniORB/ -o NNO NNOcpp.cc dPhaseClientUtils.cc phasesSK.cc -L$OMNIROOT/lib -lomniORB4 -lomnithread

which names the executable image NNO and explicitly points to the omniORB include directory and link libraries. Note that the C++ code file phasesSK.cc is generated by the IDL to C++ translation of the previous step.

Now, run the client by typing a command at the terminal prompt like:

./NNO -ORBInitRef NameService=corbaname::ofm-research.org

The command argument "-ORBInitRef NameService=corbaname::ofm-research.org" identifies the CORBA nameserver at ofm-research.org. Enter a temperature at the prompt and an oxygen fugacity will be returned.

If you examine the C++ code, you will find that the nuts-and-bolts of the ORB intercommunication are achieved in the module dPhaseClients.cc. This intercommunication includes contacting the OFM nameserver and obtaining from it a reference to the "Phase" object server at OFM. The call to getdPhaseFactory(...) returns a reference to the server-side function that generates client-localized instances of specific phases. Note, that unlike the python version of this client, the C++ version deals with exceptions thrown in the event that contact cannot be made with the server. The spawnPhase method of the phaseFactory object creates user-specific instances of phase objects on the server and the methods setTk(...) and getG() set the temperature and retrieve Gibbs free energy respectively. These methods and additional capabilities are documented in the phases IDL. The client can retrieve a list of available phases using the getPhaseNames method on a phaseFactory object.


Example Java code

The following example code is more complex in that it implements a complete GUI applet interface for the Phase Properties applet. The Java source code for this applet will be built as a standalone executable to avoid certain complications involving creating, signing and deploying a jar file.

To compile and run this example a Java development environment must be installed on your computer. We use the Java 2, Standard Edition, version 5.0 Release 1 under Mac OS X 10.4. The IDL to Java compiler is included in this development suite.

An ORB implementation must be installed on the client for this software to function. We recommend omniORB 4.0.6 from the omniORB site at Sourceforge. We install this software at the root location /usr/local.

In a clean working directory, download the files

Compile the IDL, e.g. using omniORB execute

idlj -i $OMNIROOT/share/idl/omniORB -fall phases.idl

where the environment variable OMNIROOT is set to the root install directory of omniORB (on our system that's /usr/local). This command will generate a directory named phases that contains java files. These files implement the methods described in the IDL.

Next, make sure the CLASSPATH environment variable is set to the current working directory. (e.g. setenv CLASSPATH $PWD, or export CLASSPATH=$PWD).

Move into the directory phases and compile all of the newly created java files, e.g.

javac *.java

Then, move into the subdirectory of phases called dPhasePackage and compile all of the java files found there too.

Next return to the directory that contains the files downloaded above and compile the java files found there using a command like javac *.java. A series of "class" files will be produced. Run the application by typing a command at the terminal prompt like:

java CalcClient

When the java class CalcClient is executed in a stand alone environment (outside of a web browser), contact is made with the hard coded nameserver address ofm-research.org. When the class files are packaged into a jar archive and the applet is launched from within a web browser, the nameserver request is automatically directed back to the web server that provided the applet. This is a security feature of applets that cannot be overwritten. We have avoided the problem in this case by running the program as a stand alone application.

If you examine the java code, you will find that the nuts-and-bolts of the ORB intercommunication are achieved in the module Connection.java. This intercommunication includes contacting the OFM nameserver and obtaining from it a reference to the "Phase" object server at OFM. The call to getdPhaseFactory(...) returns a reference to the server-side function that generates client-localized instances of specific phases. Note, that unlike the python version of this client and like the C++ client, this java client deals with exceptions thrown in the event that contact cannot be made with the server. This java client illustrates use of the getPhaseNames() method to retrieve a list of available phases. This list is used to build the pop-up menu displayed on the GUI. The checkAndSetPhase() method illustrates how a particular phase object is spawned on the server once the user selects that phase from the popup menu. Setting phase composition, determining the number of components in a phase, and retrieving thermodynamic properties are all illustrated in the methods displayWTtoX(), displayXtoWT(), and displayXtoThermo().

API documentation for the Phase Properties applet generated by javadoc may be examined at this link.

EAR Funded Research | About Us | Contact Us | ©2005, 2006, 2007 OFM Research Inc., 30-Jan-2012 21:04