Skip to content

Instantly share code, notes, and snippets.

@robinknowles
Last active November 17, 2023 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robinknowles/c4ac5ff6a594cdeaed30ce6c3c9f494c to your computer and use it in GitHub Desktop.
Save robinknowles/c4ac5ff6a594cdeaed30ce6c3c9f494c to your computer and use it in GitHub Desktop.
Using VS Code tasks to run OpenFOAM scripts

Running OpenFOAM with VS Code Tasks

Accompanies OnCFD Newsletter #171

Attached is an example tasks.json file for running your Allrun & Allclean OpenFOAM scripts in VS Code via Tasks.

In VS Code, use cmd/ctrl + shift + p to bring up the command palette & type Tasks: Open User Tasks

Choose the Others option & it will create a tasks.json file in your user area & pop it open in the editor.

You could replace the contents of that file, with the contents of the one below 👇 (or just use it to crib from).

To run your new tasks: use cmd/ctrl + shift + p to bring up the palette, type "Run Tasks" & choose your task.

For more info see the original article 👋

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
// Run the current case's Allrun script
"label": "OF: Allrun",
"type": "shell",
"command": "./Allrun",
"problemMatcher": []
},
{
// Run the current case's Allclean script
"label": "OF: Allclean",
"type": "shell",
"command": "./Allclean"
},
{
// Clean & Run Combo Task
"label": "OF: Clean & Run",
"dependsOn": [
"OF: Allclean",
"OF: Allrun"
],
"dependsOrder": "sequence",
"group": {
"kind": "build",
"isDefault": true
}
},
],
// "Global" settings applied to each task
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false,
},
// No problem checking applied
"problemMatcher": [],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment