CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Running OpenFOAM case through shell script (bash)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 27, 2020, 18:46
Default Running OpenFOAM case through shell script (bash)
  #1
New Member
 
Join Date: Jan 2020
Posts: 6
Rep Power: 6
ilaj is on a distinguished road
Hello,


I intend to run an OpenFOAM case through shell script. The example that I chose was lid driven cavity. Here's what I have done -



1. Open the terminal - cd case_directory_name


2. Create a shell script (shown below)


#!/bin/bash
blockMesh > log.blockmesh
icoFoam > log.icofoam
probeLocations -latestTime > log.probes




3. The shell script was saved in the case directory


4. In the same terminal, sudo sh file_name.sh


Here's the error I get -

blockMesh: not found
icoFoam: not found
probeLocations: not found




How should I proceed? Thank you for any suggestions you can provide.


- Ilaj
ilaj is offline   Reply With Quote

Old   January 28, 2020, 02:57
Default
  #2
Member
 
Andreas P.
Join Date: May 2017
Posts: 41
Rep Power: 9
AndreasPe is on a distinguished road
You maybe need to source your OpenFOAM environment in the terminal or in the script?
AndreasPe is offline   Reply With Quote

Old   January 28, 2020, 14:14
Default
  #3
New Member
 
Join Date: Jan 2020
Posts: 6
Rep Power: 6
ilaj is on a distinguished road
Hello,



I tried the following based on your suggestion -



1. In CAE terminal, cd open_OpenFOAM_case_directory


2. sudo bash my_bash_script.sh



bash script had the following commands -
#!/bin/bash
source ~/openfoam6/etc/bashrc
blockMesh > log.blockmesh
icoFoam > log.icofoam


This worked!



Thanks you!


- Ilaj
ilaj is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM] Using python script for automatic post processing of openFoam vPaquet ParaView 12 December 16, 2021 04:30
Almost have my cluster running openfoam, but not quite... bjr OpenFOAM Running, Solving & CFD 17 March 6, 2020 10:52
OpenFOAM v3.0+ ?? SBusch OpenFOAM 22 December 26, 2016 15:24
Statically Compiling OpenFOAM Issues herzfeldd OpenFOAM Installation 21 January 6, 2009 10:38
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 13:24


All times are GMT -4. The time now is 14:10.