| 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 |
| 61 | subroutine 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)) |
| 78 | end subroutine muscle_fortran_init |
| 79 | #endif |
| 80 | |
| 81 | end program piernik |
| 82 | }}} |
| 83 | == First try - run the NOP kernel in MUSCLE environment == |
| 84 | The 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 | }}} |
| 91 | At 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 |
| 94 | cxa = Cxa.LAST |
| 95 | |
| 96 | # declare kernels and their params |
| 97 | cxa.add_kernel('mhd', 'muscle.core.standalone.NativeKernel') |
| 98 | cxa.env["mhd:command"] = "./piernik" |
| 99 | cxa.env["mhd:dt"] = 1; |
| 100 | |
| 101 | # global params |
| 102 | cxa.env["max_timesteps"] = 4 |
| 103 | cxa.env["cxa_path"] = File.dirname(__FILE__) |
| 104 | |
| 105 | # configure connection scheme |
| 106 | cs = cxa.cs |
| 107 | }}} |
| 108 | Now we are ready to run PIERNIK MHD module in MUSCLE: |
| 109 | {{{ |
| 110 | $muscle2 --main --cxa piernik.cxa.rb mhd |
| 111 | Running 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 | |
| 124 | Start of the PIERNIK code. No. of procs = 1 |
| 125 | |
| 126 | Warning @ 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 | |
| 132 | Info @ 0: Working with 2 fluid. |
| 133 | Info @ 0: Number of cells: 1 |
| 134 | Info @ 0: Cell volume: 4.1016785411997372E+032 |
| 135 | Info @ 0: Monomer mass: 4.2893211697012652E-013 |
| 136 | Info @ 0: Temperature: 200.02221228956296 |
| 137 | Info @ 0: Number of monomers per one representative particle: 1.3865676291650172E+030 |
| 138 | Info @ 0: Dust density [g/cm3]: 2.9000000001269637E-013 |
| 139 | Warning @ 0: [initfluids:sanitize_smallx_checks] adjusted smalld to 1.1895E-04 |
| 140 | Warning @ 0: [initfluids:sanitize_smallx_checks] adjusted smallp to 1.7705E-01 |
| 141 | Info @ 0: Timesteps: 2.0416940798311732E+038 50.000000000000000 |
| 142 | Info @ 0: Timesteps: 50.000000000000000 50.000000000000000 |
| 143 | Info @ 0: Timesteps: 2.0416940798311732E+038 50.000000000000000 |
| 144 | Info @ 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 |
| 147 | Info @ 0: Timesteps: 2.0416940798311732E+038 50.000000000000000 |
| 148 | Info @ 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 |
| 151 | Info @ 0: Timesteps: 2.0416940798311732E+038 50.000000000000000 |
| 152 | Info @ 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 |
| 155 | Info @ 0: Timesteps: 2.0416940798311732E+038 50.000000000000000 |
| 156 | Info @ 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 |
| 159 | Info @ 0: Timesteps: 2.0416940798311732E+038 50.000000000000000 |
| 160 | Info @ 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 |
| 163 | Info @ 0: Timesteps: 2.0416940798311732E+038 50.000000000000000 |
| 164 | Info @ 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 |
| 167 | Info @ 0: Simulation has reached final time t = 600.000 |
| 168 | Finishing .......... |
| 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 | |