Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Accessing code parameters from pure IMAS code

Prepare your environment:

Code Block
# clone xmllib library directly from ITER repository
$ git clone ssh://git@git.iter.org/lib/xmllib.git

# OR copy from this location
$ /pfs/work/g2dfigat/tutorials/Poznan-2019-10/xmllib

The structure of your working directory should look like this:

Code Block
$ cd examples/classic/
$ tree
.
├── input_test_xmllib_pathquery.xml
├── input_test_xmllib_pathquery.xsd
├── Makefile						# instructions on how to compile
├── sample_default.xml
├── sample.f90						# code with accessing code parameters
├── sample.xml						# file with parameters
└── sample.xsd						# defining the structure of an XML document

Run an example:

Code Block
$ module load imasenv
$ make
ifort  -fPIC -g  -I/gw/swimas/extra/xmllib/3.2.0/intel/17.0/include/xmllib -I/usr/include/libxml2   -c -o sample.o sample.f90
ifort -fPIC -g  -o sample.exe sample.o  -L/gw/swimas/extra/xmllib/3.2.0/intel/17.0/lib -lxmllib -lxml2
./sample.exe
 Next xml element: parameters
 Next xml element: input
 Next xml element: shot_in
 Read shot_in=           4
 Next xml element: run_in
 Read shot_in=           1
 Next xml element: interpol
 Next xml element: time_dep_input
 Next xml element: output
 Next xml element: dims
 Next xml element: compositions
 Next xml element: startup
 Next xml element: boundary
 Next xml element: equilibrium
 Next xml element: geo_ax
 Read geo_ax=   2.86000000000000
 Next xml element: plasma_ax
 Next xml element: amin
 Next xml element: elong
 Next xml element: tria_up
 Next xml element: tria_low
 Next xml element: solver
 Next xml element: experimental

Compare result with data inside sample.xml file.

Accessing code parameters from FC2K actor

Prepare your environment:

Code Block
# clone xmllib library directly from ITER repository
$ git clone ssh://git@git.iter.org/imex/fc2k-testing-framework.git

# OR copy from this location
$ /pfs/work/g2dfigat/tutorials/Poznan-2019-10/fc2k-testing-framework

The structure of your working directory should look like this:

Code Block
$ cd fc2k-testing-framework/primitives_param/fortran/
$ tree
.
├── clean.sh
├── Makefile
├── primitives_param.f90			# FC2K actor with accessing code parameters
├── primitivesparam_fc2k.xml		# FC2K configuration file
├── primitivesparam_workflow.xml	# example workflow  
├── run_test.sh						# script for run example
├── sample_default.xml
├── sample.xml						# XML file with parameters
└── sample.xsd						# defining the structure of an XML document

Run an example:

Code Block
./run_test.sh
Compilation - OK
Skipping log removal
FC2K build for primitives with params - OK
Skipping log removal
Workflow execution: primitives with params - OK
Skipping log removal
Checking output - should be equal to '3' - OK
Skipping log removal

Investigate test.log file to find more detailed information on this example.