Versions Compared

Key

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

...

Main purpose of FC2K is to embed native code inside Kepler workflow. This way, you are able to connect various, physics based, calculations into chain of execution. There are few rules you have to follow while embedding native code inside Kepler:

  • your Your routine signature must be exactly the same as one suggested by FC2K
  • in In order to access IDSes, you have to use IMAS based modules inside your Fortran code
  • you You can pass data into and outside of the code in the form of:
    • primitive Primitive types
    • IDSes
    • code Code parameters
  • you You should avoid accessing external files unless it's really impossible to run the simulation without external source of data
  • all All physics related information should be exchanged only via IDSes

...

First of all, we need simple code that will read data. In this sample, we will use very simple code that reads distribution IDS, shows some info, and output scalar value

Let's say we will retrieve the first time index (as integer) from the array of all times. Remember, this is just an exercise where we want to make all things work together. Don't pay attention to whether it's something meaningful or not. Let's say our actor is supposed to retrieve first time index in the IDS.

Code Block
IDS -> actor code [we treat the actor as a black box] -> integer

...

Code Block
> make 
ifort -g -O0 -assume no2underscore -fPIC -shared-intel -c -o distribution_disp.o distribution_disp.f90 `pkg-config --cflags imas-ifort imas-lowlevel`ifort` `pkg-config --libs imas-ifort imas-lowlevel`ifort`
ar -rvs libdistribution_disp.a distribution_disp.o
ar: creating libdistribution_disp.a
a - distribution_disp.o

...