Solverdummy C - scripted run

I’d like to run the solverdummy c example using a single bash script. So instead of actually opening two terminals and doing these commands, one in each terminal:

./solverdummy ../precice-config.xml SolverOne MeshOne
./solverdummy ../percice-config.xml SolverTwo MeshTwo

The script I wrote to try and do this looks like this:

#!/bin/bash

$(./solverdummy ../precice-config.xml SolverOne MeshOne) &
pid=$!
./solverdummy ../precice-config.xml SolverTwo MeshTwo

wait $pid

Here is the output:

$> ./run.sh
DUMMY: Running solver dummy with preCICE config file "../precice-config.xml", participant name "SolverTwo", and mesh name "MeshTwo".
preCICE: This is preCICE version 2.1.0
preCICE: Revision info: no-info [Git failed/Not a repository]
preCICE: Configuring preCICE with configuration "../precice-config.xml"
preCICE: I am participant "SolverTwo"
preCICE: Setting up master communication to coupling partner/s
preCICE: Masters are connected
preCICE: Setting up preliminary slaves communication to coupling partner/s
preCICE: Receive global mesh MeshOne
preCICE: Prepare partition for mesh MeshTwo
preCICE: Setting up slaves communication to coupling partner/s
preCICE: Slaves are connected
preCICE: Compute read mapping from mesh "MeshOne" to mesh "MeshTwo".
preCICE: Mapping distance min:0 max:0 avg: 0 var: 0 cnt: 3
preCICE: it 1 of 2 | dt# 1 of 2 | t 0 | dt 1 | max dt 1 | ongoing yes | dt complete no | write-iteration-checkpoint |
DUMMY: Writing iteration checkpoint
preCICE: Compute write mapping from mesh "MeshTwo" to mesh "MeshOne".
preCICE: Mapping distance min:0 max:0 avg: 0 var: 0 cnt: 3
preCICE: min iteration convergence measure: #it = 1 of 5, conv = false
preCICE: it 2 of 2 | dt# 1 of 2 | t 0 | dt 1 | max dt 1 | ongoing yes | dt complete no | read-iteration-checkpoint |
DUMMY: Reading iteration checkpoint
preCICE: min iteration convergence measure: #it = 2 of 5, conv = false
preCICE: Time window completed
preCICE: it 1 of 2 | dt# 2 of 2 | t 1 | dt 1 | max dt 1 | ongoing yes | dt complete yes | write-iteration-checkpoint |
DUMMY: Advancing in time
DUMMY: Writing iteration checkpoint
preCICE: min iteration convergence measure: #it = 1 of 5, conv = false
preCICE: it 2 of 2 | dt# 2 of 2 | t 1 | dt 1 | max dt 1 | ongoing yes | dt complete no | read-iteration-checkpoint |
DUMMY: Reading iteration checkpoint
preCICE: min iteration convergence measure: #it = 2 of 5, conv = false
preCICE: Time window completed
preCICE: it 1 of 2 | dt# 3 of 2 | t 2 | dt 1 | max dt 1 | ongoing no | dt complete yes |
DUMMY: Advancing in time
DUMMY: Closing C solver dummy...
./run.sh: line 3: DUMMY:: command not found

Does anyone know what this line from the output is about?

./run.sh: line 3: DUMMY:: command not found

Thanks!

I think that the line

$(./solverdummy ../precice-config.xml SolverOne MeshOne) &

will start your dummy solver and afterwards interpret the output of the dummysolver as a bash command to run. This is due to the $( ).

Could you change the script to

#!/bin/bash

./solverdummy ../precice-config.xml SolverOne MeshOne &
pid=$!
./solverdummy ../precice-config.xml SolverTwo MeshTwo

wait $pid

and test again?

3 Likes

That was it! Thank you! I shoulda known better but now I do :slight_smile: