Skip to content

Commit 89394e1

Browse files
authored
apps/comsol: Format code blocks (#805)
1 parent a92f0ad commit 89394e1

File tree

1 file changed

+42
-22
lines changed

1 file changed

+42
-22
lines changed

triton/apps/comsol.rst

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ COMSOL Multiphysics
1212

1313
To check which versions of Comsol are available, run::
1414

15-
module spider comsol
15+
.. code-block:: console
16+
17+
$ module spider comsol
1618
1719
1820
Comsol in Triton is best run in `Batch-mode <https://www.comsol.com/blogs/how-to-run-simulations-in-batch-mode-from-the-command-line/>`_, i.e. without the graphical userinterface. Prepare your models on your workstation and bring the ready-to-run models to triton. For detailed tutorials from COMSOL, see for example the Comsol Knowledge base articles `Running COMSOL® in parallel on clusters <https://www.comsol.com/support/knowledgebase/1001>`_ and `Running parametric sweeps, batch sweeps, and cluster sweeps from the command line <https://www.comsol.com/support/knowledgebase/1250>`_. However, various settings must be edited in the graphical user interface.
@@ -32,31 +34,31 @@ Best practices of using COMSOL Graphical User Interface in Triton
3234

3335
1) Open a terminal, and connect with ssh to triton login node
3436

35-
::
36-
37-
ssh -Y triton.aalto.fi
37+
.. code-block:: console
38+
39+
$ ssh -Y triton.aalto.fi
3840
3941
However, if you use this terminal to start COMSOL, it will be running on the login node, which is a shared resource, and you should be careful not to use too much memory or CPUs.
4042

4143
2) Start comsol
4244

4345
1) First make sure you have graphical connection (should print something like ":1.0")
4446

45-
::
46-
47-
echo $DISPLAY
47+
.. code-block:: console
48+
49+
$ echo $DISPLAY
4850
4951
2) then load the comsol module (version of your choice)
5052

51-
::
52-
53-
module load comsol/6.3
53+
.. code-block:: console
54+
55+
$ module load comsol/6.3
5456
5557
3) and finally start comsol
5658

57-
::
58-
59-
comsol
59+
.. code-block:: console
60+
61+
$ comsol
6062

6163

6264

@@ -68,9 +70,11 @@ There is a largish but limited pool of floating COMSOL licenses in Aalto Univers
6870
- Comsol uses a lot of temp file storage, which by default goes to
6971
``$HOME``. Fix a bit like the following::
7072

71-
$ rm -rf ~/.comsol/
72-
$ mkdir /scratch/work/$USER/comsol_recoveries/
73-
$ ln -sT /scratch/work/$USER/comsol_recoveries/ ~/.comsol
73+
.. code-block:: console
74+
75+
$ rm -rf ~/.comsol/
76+
$ mkdir /scratch/work/$USER/comsol_recoveries/
77+
$ ln -sT /scratch/work/$USER/comsol_recoveries/ ~/.comsol
7478
7579
7680
- You may need to enable access to the whole filesystem in *File|Options --> Preferences --> Security*: **File system access:** "*All files*"
@@ -161,6 +165,8 @@ First set up the cluster preferences, as described above.
161165

162166
Start by opening the graphical user interface to comsol on the login node and open your model. ::
163167

168+
.. code-block:: console
169+
164170
$ module purge
165171
$ module load comsol/6.3
166172
$ comsol
@@ -170,6 +176,8 @@ Add a "Cluster Sweep" node to your study and a "Cluster Computing" node into you
170176

171177
For a larger run, COMSOL can then submit the jobs with comsol but without the GUI::
172178

179+
.. code-block:: console
180+
173181
$ comsol batch -inputfile your_ready_to_run_model.mph -outputfile output_file.mph -study std1 -mode desktop
174182
175183
See also how to `run a parametric sweep from command line? <https://www.comsol.com/support/knowledgebase/1250>`_
@@ -190,6 +198,8 @@ Save a username and password for COMSOL mph server
190198

191199
Before your first use, you need to save the username and password for COMSOL mph server. On the login node, run::
192200

201+
.. code-block:: console
202+
193203
$ module load comsol/6.3
194204
$ comsol mphserver
195205
@@ -202,14 +212,18 @@ Example files for batch job workflow
202212

203213
Please check the available versions and installation locations of comsol and update the below scripts accordingly:
204214

205-
module spider comsol
215+
.. code-block:: console
206216
207-
module show comsol/6.2
217+
$ module spider comsol
218+
219+
$ module show comsol/6.2
208220
209221
The installation folder is on the line with "prepend_path".
210222

211223

212-
Here is an example batch submit script ``comsol_matlab_livelink.sh``::
224+
Here is an example batch submit script ``comsol_matlab_livelink.sh``:
225+
226+
.. code-block:: yaml
213227
214228
#!/bin/bash
215229
@@ -233,7 +247,9 @@ Here is an example batch submit script ``comsol_matlab_livelink.sh``::
233247
echo matlab closed
234248
235249
236-
The MATLAB process is running the ``runner.m`` script::
250+
The MATLAB process is running the ``runner.m`` script:
251+
252+
.. code-block::
237253
238254
disp('Including comsol routines into the path.')
239255
addpath /share/apps/comsol/5.6/mli/
@@ -250,7 +266,9 @@ The MATLAB process is running the ``runner.m`` script::
250266
exit(0);
251267
252268
253-
The Model Control Script ``script.m`` could be e.g. the following::
269+
The Model Control Script ``script.m`` could be e.g. the following:
270+
271+
.. code-block::
254272
255273
import com.comsol.model.*;
256274
import com.comsol.model.util.*;
@@ -259,7 +277,9 @@ The Model Control Script ``script.m`` could be e.g. the following::
259277
%...
260278
261279
262-
The job is submitted with::
280+
The job is submitted with:
281+
282+
.. code-block:: console
263283
264284
$ sbatch comsol_matlab_livelink.sh
265285

0 commit comments

Comments
 (0)