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

why not reading from script?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 1, 2013, 15:29
Default why not reading from script?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
I have put this script (plot)on my desktop as well as some other simple scripts and have given its address to bashrc as below:
Code:
PATH=$PATH:/home/ehsan/Desktop/codes
other scripts are working well but plot doesn't by this error:
Code:
ehsan@Ehsan-com:~/Desktop/WR_Main_Central$ plot rhoCentralFoam
plot: rhoCentralFoam: No such file or directory
plot: ignoring this file
(for example report file performs fine but plot doesn't)
Attached Files
File Type: gz plot.tar.gz (207 Bytes, 7 views)
File Type: gz report.tar.gz (169 Bytes, 4 views)
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 2, 2013, 02:50
Default
  #2
Senior Member
 
Join Date: Dec 2011
Posts: 111
Rep Power: 19
haakon will become famous soon enough
Try to use the export command in .bashrc to make the variable global:
Code:
export PATH="$PATH:/home/ehsan/Desktop/codes"
haakon is offline   Reply With Quote

Old   May 2, 2013, 05:54
Default
  #3
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
thanks.
but the error is repeated.
Code:
ehsan@Ehsan-com:~/Desktop/WR_Main_Central$ plot rhoCentralFoam
plot: rhoCentralFoam: No such file or directory
plot: ignoring this file
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 2, 2013, 06:15
Default
  #4
Senior Member
 
Join Date: Dec 2011
Posts: 111
Rep Power: 19
haakon will become famous soon enough
In the top of your plot script, you have the shebang:
Code:
#! /bin/sh
try to remove the space, such that it become
Code:
#!/bin/sh
Also make sure that you have made the script executable, by calling
Code:
chmod +x plot
from the folder with the plot script.
haakon is offline   Reply With Quote

Old   May 2, 2013, 08:31
Default
  #5
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
I removed space.yes its executable.doesn't perform.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 2, 2013, 08:58
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@Ehsan: What happens if you run the contents of the script directly on the command line? Namely:
Code:
pyFoamPlotRunner.py --hardcopy --with-courant --progress --no-pickled-file rhoCentralFoam
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   May 2, 2013, 09:25
Default
  #7
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
dear Bruno I have been using that untill now and thought it will be better to do that by a short command and script but it doesn't work.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 2, 2013, 09:32
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by immortality View Post
dear Bruno I have been using that untill now and thought it will be better to do that by a short command and script but it doesn't work.
Mmm... strange... OK, then try changing the first line:
Code:
#!/bin/sh
To:
Code:
#!/bin/bash
If it still doesn't work, try:
Code:
#!/bin/bash
which $1
It should tell you where rhoCentralFoam is located, namely it should give the same as running on the command line:
Code:
which rhoCentralFoam
__________________
wyldckat is offline   Reply With Quote

Old   May 2, 2013, 10:15
Default
  #9
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
no.which command doesn't work in script but work in terminal:
Code:
ehsan@Ehsan-com:~/Desktop/WR_Main_Central$ plot rhoCentralFoam
plot: rhoCentralFoam: No such file or directory
plot: ignoring this file
ehsan@Ehsan-com:~/Desktop/WR_Main_Central$ which rhoCentralFoam
/opt/openfoam220/platforms/linux64GccDPOpt/bin/rhoCentralFoam
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 2, 2013, 10:25
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
I finally understand what's happening... try running:
Code:
which plot
#or
type plot
It will probably tell you it's located at "/usr/bin/plot"!

The solution is simple: rename your "plot" script!
__________________

Last edited by wyldckat; May 2, 2013 at 10:26. Reason: added "type plot"
wyldckat is offline   Reply With Quote

Old   May 2, 2013, 11:04
Default
  #11
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
yes that message was shown.then its name is like other script in ubuntu?
but other names don't work:
Code:
ehsan@Ehsan-com:~/Desktop/WR_Main_Central$ do rhoCentralFoam
bash: syntax error near unexpected token `do'
ehsan@Ehsan-com:~/Desktop/WR_Main_Central$ runPlot rhoCentralFoam
ehsan@Ehsan-com:~/Desktop/WR_Main_Central$
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 2, 2013, 11:26
Default
  #12
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
What does the following command output?
Code:
which runPlot
wyldckat is offline   Reply With Quote

Old   May 2, 2013, 11:37
Default
  #13
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
it knows the path:
Code:
ehsan@Ehsan-com:~/Desktop/WR_Main_Central$ which runPlot
/home/ehsan/Desktop/codes/runPlot
but
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 2, 2013, 14:09
Default
  #14
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
OK, then confirm the contents of the file... I don't know what it looks like at this point.

If it all makes sense, try changing the first line to this:
Code:
#!/bin/bash -x
It should show you what it's doing when the script is executed.
__________________
wyldckat is offline   Reply With Quote

Old   May 2, 2013, 14:25
Default
  #15
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
that says this:
Code:
ehsan@Ehsan-com:~/Desktop/WR_Main_Central$ runPlot rhoCentralFoam
+ solver=rhoCentralFoam
+ pyFoamPlotRunner.py --hardcopy --with-courant --progress --no-pickled-file rhoCentralFoam
Killing PID 14778
 PyFoam WARNING on line 232 of file /usr/local/lib/python2.7/dist-packages/PyFoam/Execution/FoamThread.py : Process 14778 was already dead 
Getting LinuxMem: [Errno 2] No such file or directory: '/proc/14778/status'
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 2, 2013, 14:44
Default
  #16
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
resolved!
sorry,i had changed a postProceesing function meanwhile and didn't test full pyFoam command it terminal after that change.
then it must have been resolved when I had changed its header to
Code:
#!/bin/bash

but i learned some more things!
now a simple question how can I set number of processors in line like this:
runPlot 4 rhoCentralFoam
what should i replace for 4 in this code? :
Code:
#!/bin/bash
solver=$1
pyFoamPlotRunner.py --hardcopy --with-deltat --with-courant --procnr=4 $solver
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 2, 2013, 15:23
Default
  #17
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by immortality View Post
now a simple question how can I set number of processors in line like this:
runPlot 4 rhoCentralFoam
what should i replace for 4 in this code? :
Code:
#!/bin/bash
solver=$1
pyFoamPlotRunner.py --hardcopy --with-deltat --with-courant --procnr=4 $solver
I guess you haven't studied properly the other script I made for merging data and the studying references I gave... Anyway, it's very simple:
Code:
#!/bin/bash
solver=$2
pyFoamPlotRunner.py --hardcopy --with-deltat --with-courant --procnr=$1 $solver
__________________
wyldckat is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[Commercial meshers] Mesh conversion problem (fluent3DMeshToFoam) Aadhavan OpenFOAM Meshing & Mesh Conversion 2 March 8, 2018 01:47
[Commercial meshers] Problem converting fluent mesh vinz OpenFOAM Meshing & Mesh Conversion 28 October 12, 2015 06:37
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Meshing & Mesh Conversion 12 May 2, 2013 10:52
Problem in running ICEM grid in Openfoam Tarak OpenFOAM 6 September 9, 2011 17:51
problem when converting mesh (made by ICEM) using fluentMeshToFoam Forrest_Lei OpenFOAM 11 October 16, 2009 06:28


All times are GMT -4. The time now is 19:12.