Changes between Version 4 and Version 5 of Piernik

Show
Ignore:
Timestamp:
03/09/13 12:52:52 (12 years ago)
Author:
mmamonski
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Piernik

    v4 v5  
    4040}}} 
    4141The `MUSCLE` and `MHD_KERNEL` stands for preprocessor defines as we want to keep the MUSCLE dependency conditional, we will use them later. 
    42 = First Step - MUSCLE init = 
     42== Preparation - adding MUSCLE_Init and MUSCLE _finalize calls == 
     43Using this [Fortran API|MUSCLE Fortran tuturial] as reference it was relatively easy to add the following code to the main PIERNIK file (piernik.F90): 
     44{{{ 
    4345 
     46#ifdef MUSCLE 
     47   call muscle_fortran_init 
     48#endif 
     49   call init_piernik 
     50 
     51... 
     52 
     53   call cleanup_piernik 
     54#ifdef MUSCLE 
     55   call MUSCLE_Finalize 
     56#endif  
     57 
     58... 
     59 
     60#ifdef MUSCLE 
     61subroutine muscle_fortran_init() 
     62      implicit none 
     63      integer :: argc, i, prevlen, newlen 
     64      character(len=25600) :: argv 
     65      character(len=255) :: arg 
     66 
     67      prevlen = 0 
     68      argc = command_argument_count() 
     69 
     70      do i = 0, argc 
     71        call get_command_argument(i, arg) 
     72        newlen = len_trim(arg) 
     73        argv = argv(1:prevlen) // arg(1:newlen) // char(0) 
     74        prevlen = prevlen + newlen + 1 
     75    end do 
     76 
     77    call MUSCLE_Init(argc, argv(1:prevlen)) 
     78end subroutine muscle_fortran_init 
     79#endif 
     80 
     81end program piernik 
     82}}} 
     83== First try - run the NOP kernel in MUSCLE environment == 
     84The MUSCLE_Init assumes that application is called with MUSCLE environment so it will always fail if  called directly:  
     85{{{ 
     86$./piernik  
     87(12:29:26       ) MUSCLE port not given. Starting new MUSCLE instance. 
     88(12:29:26       ) ERROR: Could not instantiate MUSCLE: no command line arguments given. 
     89(12:29:26       ) Program finished 
     90}}} 
     91At first we need to prepare a simplistic CxA file which describes the simulation, we starts from single kernel and no conduits: 
     92{{{ 
     93# configure cxa properties 
     94cxa = Cxa.LAST 
     95 
     96# declare kernels and their params 
     97cxa.add_kernel('mhd', 'muscle.core.standalone.NativeKernel') 
     98cxa.env["mhd:command"] = "./piernik" 
     99cxa.env["mhd:dt"] = 1; 
     100 
     101# global params 
     102cxa.env["max_timesteps"] = 4 
     103cxa.env["cxa_path"] = File.dirname(__FILE__) 
     104 
     105# configure connection scheme 
     106cs = cxa.cs 
     107}}} 
     108Now we are ready to run PIERNIK MHD module in MUSCLE: 
     109{{{ 
     110$muscle2 --main --cxa piernik.cxa.rb mhd 
     111Running both MUSCLE2 Simulation Manager and the Simulation 
     112=== Running MUSCLE2 Simulation Manager === 
     113[12:39:05 muscle] Started the connection handler, listening on 10.3.1.22:5000 
     114=== Running MUSCLE2 Simulation === 
     115[12:39:06 muscle] Using directory </scratch/26934481.batch.grid.cyf-kr.edu.pl/n3-1-22.local_2013-03-09_12-39-05_23596> 
     116[12:39:06 muscle] mhd: connecting... 
     117[12:39:06 muscle] Registered ID mhd 
     118[12:39:06 muscle] mhd conduit entrances (out): [] 
     119                  mhd conduit exits (in): [] 
     120[12:39:06 muscle] mhd: executing 
     121(12:39:06    mhd) Spawning standalone kernel: [./piernik] 
     122[n3-1-22.local:23649] mca: base: component_find: unable to open /software/local/OpenMPI/1.6.3/ib/gnu/4.1.2/lib/openmpi/mca_mtl_psm: libpsm_infinipath.so.1: cannot open shared object file: No such file or directory (ignored) 
     123 
     124Start of the PIERNIK code. No. of procs =     1 
     125 
     126Warning @    0: [units:init_units] PIERNIK will use 'cm', 'sek', 'gram' defined in problem.par 
     127[units:init_units] cm   =  1.3459000E-11 [user unit] 
     128[units:init_units] sek  =  3.1688088E-08 [user unit] 
     129[units:init_units] gram =  1.0000000E-22 [user unit] 
     130   Starting problem : mctest :: tst 
     131 
     132Info    @    0:  Working with            2  fluid. 
     133Info    @    0:  Number of cells:            1 
     134Info    @    0:  Cell volume:    4.1016785411997372E+032 
     135Info    @    0:  Monomer mass:    4.2893211697012652E-013 
     136Info    @    0:  Temperature:    200.02221228956296 
     137Info    @    0:  Number of monomers per one representative particle:    1.3865676291650172E+030 
     138Info    @    0:  Dust density [g/cm3]:    2.9000000001269637E-013 
     139Warning @    0: [initfluids:sanitize_smallx_checks] adjusted smalld to  1.1895E-04 
     140Warning @    0: [initfluids:sanitize_smallx_checks] adjusted smallp to  1.7705E-01 
     141Info    @    0:  Timesteps:    2.0416940798311732E+038   50.000000000000000 
     142Info    @    0:  Timesteps:    50.000000000000000        50.000000000000000 
     143Info    @    0:  Timesteps:    2.0416940798311732E+038   50.000000000000000 
     144Info    @    0:  Timesteps:    50.000000000000000        50.000000000000000 
     145[MC] nstep =       1   dt =  1.5778800002006178E+09 s   t =  9.9998257934644172E+01 yr   dWallClock =    0.04 s 
     146[MC] Writing output     1 time =  9.9998257934644172E+01 yr =  3.1557600004012356E+09 s 
     147Info    @    0:  Timesteps:    2.0416940798311732E+038   50.000000000000000 
     148Info    @    0:  Timesteps:    50.000000000000000        50.000000000000000 
     149[MC] nstep =       2   dt =  1.5778800002006178E+09 s   t =  1.9999651586928834E+02 yr   dWallClock =    0.04 s 
     150[MC] Writing output     2 time =  1.9999651586928834E+02 yr =  6.3115200008024712E+09 s 
     151Info    @    0:  Timesteps:    2.0416940798311732E+038   50.000000000000000 
     152Info    @    0:  Timesteps:    50.000000000000000        50.000000000000000 
     153[MC] nstep =       3   dt =  1.5778800002006178E+09 s   t =  2.9999477380393250E+02 yr   dWallClock =    0.11 s 
     154[MC] Writing output     3 time =  2.9999477380393250E+02 yr =  9.4672800012037067E+09 s 
     155Info    @    0:  Timesteps:    2.0416940798311732E+038   50.000000000000000 
     156Info    @    0:  Timesteps:    50.000000000000000        50.000000000000000 
     157[MC] nstep =       4   dt =  1.5778800002006178E+09 s   t =  3.9999303173857669E+02 yr   dWallClock =    0.17 s 
     158[MC] Writing output     4 time =  3.9999303173857669E+02 yr =  1.2623040001604942E+10 s 
     159Info    @    0:  Timesteps:    2.0416940798311732E+038   50.000000000000000 
     160Info    @    0:  Timesteps:    50.000000000000000        50.000000000000000 
     161[MC] nstep =       5   dt =  1.5778800002006178E+09 s   t =  4.9999128967322088E+02 yr   dWallClock =    0.18 s 
     162[MC] Writing output     5 time =  4.9999128967322088E+02 yr =  1.5778800002006178E+10 s 
     163Info    @    0:  Timesteps:    2.0416940798311732E+038   50.000000000000000 
     164Info    @    0:  Timesteps:    50.000000000000000        50.000000000000000 
     165[MC] nstep =       6   dt =  1.5778800002006178E+09 s   t =  5.9998954760786501E+02 yr   dWallClock =    0.77 s 
     166[MC] Writing output     6 time =  5.9998954760786501E+02 yr =  1.8934560002407413E+10 s 
     167Info    @    0: Simulation has reached final time t = 600.000 
     168Finishing .......... 
     169(12:39:08    mhd) Program finished. 
     170(12:39:08    mhd) Command [./piernik] finished. 
     171[12:39:08 muscle] mhd: finished 
     172[12:39:08 muscle] All ID's have finished, quitting MUSCLE now. 
     173[12:39:08 muscle] All local submodels have finished; exiting. 
     174 
     175 
     176        Executed in </scratch/26934481.batch.grid.cyf-kr.edu.pl/n3-1-22.local_2013-03-09_12-39-05_23596> 
     177 
     178}}} 
     179== Adding second kernel: MC == 
     180