Changes between Version 19 and Version 20 of Tutorials
- Timestamp:
- 09/12/13 11:17:19 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Tutorials
v19 v20 22 22 muscle2 --cxa src/cxa/SimpleSubmodelExample.cxa.rb 23 23 }}} 24 25 24 This example has a writer submodel `w` and a reader submodel `r`. The writer sends data to the reader, and the reader prints that data to screen. 26 27 25 You can run the simple example by specifying that the current MUSCLE command will run the Simulation Manager with the `--main` flag or its shorthand `-m`, and specifying all submodels that should run in this command: 28 26 {{{ 29 27 muscle2 -mc src/cxa/SimpleSubmodelExample.cxa.rb w r 30 28 }}} 31 32 29 Usually, if you want to run all the submodels instances with the current MUSCLE command, specify the `--allinstances` or its shorthand `-a`: 33 30 {{{ 34 31 muscle2 -amc src/cxa/SimpleSubmodelExample.cxa.rb 35 32 }}} 36 37 33 So what do we observe? MUSCLE detects that it should start the Simulation Manager and a Simulation. It first starts the manager, which shows its TCP/IP address. Then the Simulation starts and it executes the submodel instances `w` and `r`. These start their respective conduits, and start 'computing'. 38 39 34 On local machines, these commands are sufficient to run any MUSCLE model. You can try the other examples in the `src/cxa` directory, just run 40 35 {{{ … … 46 41 muscle2 -amc src/cxa/LaplaceExample.cxa.rb 47 42 }}} 48 49 43 It will open two windows that compute temperature dissipation, that are coupled on the boundary. Red is a +1 temparature, blue a -1 temperature, and green a zero temperature. The initial condition, far right and far left correspond to zero temperature, the top to a sine function and the bottom to a cosine. Temperature is dissipated during each time step by taking the average of the four neighboring cells. The adjacent boundary is transmitted each iteration. 50 44 … … 62 56 . [MUSCLE_DIR]/etc/muscle.profile 63 57 }}} 64 65 58 Then go to the unzipped MUSCLE directory. Now we can run muscle on the same site. In the first terminal window, start the main MUSCLE with the writing submodel w. This is done by typing: 66 59 {{{ 67 60 muscle2 -mc src/cxa/SimpleSubmodelExample.cxa.rb w 68 61 }}} 69 70 62 So what do you observe? 71 72 63 One of the most important messages is `Started the connection handler, listening on [IPADDRESS:PORT]`. 73 64 Copy the IP address and port number. … … 77 68 muscle2 -c src/cxa/SimpleSubmodelExample.cxa.rb r -M [IPADDRESS:PORT] 78 69 }}} 79 80 70 What happens in both terminals? 81 71 82 72 2. To isolate the output from the Simulation Manager, we can run it separately. 83 84 73 In the first terminal window, start the Simulation Manager: 85 74 {{{ 86 75 muscle2 -mc src/cxa/SimpleSubmodelExample.cxa.rb 87 76 }}} 88 89 77 In the second terminal, start the submodels. Again, replace the port number 90 78 with the one that is printed by the Simulation Manager. … … 92 80 muscle2 -ac src/cxa/SimpleSubmodelExample.cxa.rb -M [IPADDRESS:PORT] 93 81 }}} 94 95 82 What happens in both terminals? 96 83 … … 101 88 . MUSCLE_DIR/etc/muscle.profile 102 89 }}} 103 104 90 And go to the source directory of MUSCLE. We will perform the same experiment, 105 91 but now on different hosts. So on the first node, for instance run only `w` … … 107 93 muscle2 -mc src/cxa/SimpleSubmodelExample.cxa.rb w 108 94 }}} 109 110 95 On the other node, we now also need to specify which host and port the other 111 96 MUSCLE instance is running on … … 113 98 muscle -c src/cxa/SimpleSubmodelExample.cxa.rb -M [IPADDRESS:PORT] r 114 99 }}} 115 116 100 What is the output in node one? And on the other? 117 101 … … 173 157 this example, call both the sending and the receiving port "messages", for 174 158 example. Test your implementation by running 175 176 159 {{{ 177 160 cd build