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

Python execute Allrun in windows sub linux

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By JNSN

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 5, 2022, 05:18
Default Python execute Allrun in windows sub linux
  #1
Member
 
Jigs
Join Date: Aug 2017
Location: Pune
Posts: 39
Rep Power: 8
jmex is on a distinguished road
Hi Team,

After looking for possible solutions online, I have come here for little help. I am using windows sub linux, installed openfoam and trying to automate tedious task. I am trying to execute Allrun command from python.
Is there any way we can do that?

Using below command:
Code:
from subprocess import call
basedirectory = 'destination folder'
call(['bash', 'Allrun'], cwd=basedirectory)
I am getting below error:
Code:
Allrun: line 3: /bin/tools/RunFunctions: No such file or directory
Allrun: line 7: runApplication: command not found
Allrun: line 8: runApplication: command not found
Allrun: line 9: runApplication: command not found
Allrun: line 10: runApplication: command not found
Allrun: line 11: runApplication: command not found
Any help or direction will be helpful. I am stuck here.
jmex is offline   Reply With Quote

Old   July 6, 2022, 09:45
Default
  #2
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 137
Rep Power: 19
JNSN is on a distinguished road
Here is a minimal working example. Note, that you need to source OpenFOAM, i. e. all environmentvariables have to be set properly, before executing the script below.



Code:
 #! /usr/bin/env python

import subprocess

command='./Allrun'
p = subprocess.run(command,shell=True)
jmex likes this.
JNSN is offline   Reply With Quote

Old   July 7, 2022, 05:39
Default
  #3
Member
 
Jigs
Join Date: Aug 2017
Location: Pune
Posts: 39
Rep Power: 8
jmex is on a distinguished road
Quote:
Originally Posted by JNSN View Post
Here is a minimal working example. Note, that you need to source OpenFOAM, i. e. all environmentvariables have to be set properly, before executing the script below.



Code:
 #! /usr/bin/env python

import subprocess

command='./Allrun'
p = subprocess.run(command,shell=True)
Thanks understood.
jmex is offline   Reply With Quote

Reply

Tags
automate, python


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
Recent thoughts- Fluent on Linux vs Windows jpo FLUENT 1 May 17, 2012 06:20
[Other] How to excecute allrun in windows openfoam padmanathan OpenFOAM Meshing & Mesh Conversion 2 November 28, 2011 16:27
removing of linux and keeping windows Anja Main CFD Forum 4 August 23, 2006 07:01
Windows EXE file and Linux MING Main CFD Forum 4 October 22, 2004 05:31
read unformatted file in windows and linux autofly Main CFD Forum 7 August 11, 2004 03:24


All times are GMT -4. The time now is 09:32.