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

casename.foam file creation for Paraview (manually)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 25, 2011, 12:23
Question casename.foam file creation for Paraview (manually)
  #1
New Member
 
Join Date: Mar 2011
Posts: 4
Rep Power: 15
max_sph is on a distinguished road
Hey guys,

Please can anyone help me on a small issue. I am trying to create a single command or maybe a small program that I can run using terminal in a unix based system (mac os in this case, because paraFoam command doesn't quite work properly.)

Ok, so basically, I need to create the casename.foam file via terminal, so that I can open that with Paraview. This is simple enough using "touch casename.foam", then opening that with Paraview, which loads the files 0, 0.1, 0.2 etc etc to be viewed.

So my questions are:
How do I get the working directory into, say, an export command,
eg. export WORKING="pwd" in my .bashrc file... the problem is that I can't get the working directory to export properly to a global variable which I could use in a command to create the casename.foam file without having to type the case directory/name manually.

Secondly, I had a perusal of the Paraview source code, but I'm stuck with another small thing...
Is there an argument I can add (to a command that opens Paraview.app) to load a file automatically in Paraview?

Many thanks in advance :-)

Regards,

Max
max_sph is offline   Reply With Quote

Old   July 26, 2011, 03:07
Default
  #2
New Member
 
Joel Lehikoinen
Join Date: Jun 2011
Posts: 26
Rep Power: 15
joel.lehikoinen is on a distinguished road
Quote:
Originally Posted by max_sph View Post
Hey guys,

Please can anyone help me on a small issue. I am trying to create a single command or maybe a small program that I can run using terminal in a unix based system (mac os in this case, because paraFoam command doesn't quite work properly.)

Ok, so basically, I need to create the casename.foam file via terminal, so that I can open that with Paraview. This is simple enough using "touch casename.foam", then opening that with Paraview, which loads the files 0, 0.1, 0.2 etc etc to be viewed.

So my questions are:
How do I get the working directory into, say, an export command,
eg. export WORKING="pwd" in my .bashrc file... the problem is that I can't get the working directory to export properly to a global variable which I could use in a command to create the casename.foam file without having to type the case directory/name manually.

Secondly, I had a perusal of the Paraview source code, but I'm stuck with another small thing...
Is there an argument I can add (to a command that opens Paraview.app) to load a file automatically in Paraview?

Many thanks in advance :-)

Regards,

Max
Putting it in your .bashrc file wouldn't work. That file is sourced when you start a new terminal: your global variable would be whatever happens to be the working directory then (probably your home folder). I guess if you really wanted you could create a script that does the trick for you, but you really have to ask yourself how much time would that save vs. how much time you'd need to write the script. By the way, the .OpenFOAM -files don't have to have the same name as the case, although it is of course a good practice.
joel.lehikoinen is offline   Reply With Quote

Old   July 26, 2011, 03:23
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by max_sph View Post
Hey guys,

Please can anyone help me on a small issue. I am trying to create a single command or maybe a small program that I can run using terminal in a unix based system (mac os in this case, because paraFoam command doesn't quite work properly.)

Ok, so basically, I need to create the casename.foam file via terminal, so that I can open that with Paraview. This is simple enough using "touch casename.foam", then opening that with Paraview, which loads the files 0, 0.1, 0.2 etc etc to be viewed.

So my questions are:
How do I get the working directory into, say, an export command,
eg. export WORKING="pwd" in my .bashrc file... the problem is that I can't get the working directory to export properly to a global variable which I could use in a command to create the casename.foam file without having to type the case directory/name manually.

Although generally I would have thought that the following should always work:
Code:
 
paraFoam -builtin -touch
you could also try something simple like this:
Code:
 
touch "${PWD##*/}.foam"
olesen is offline   Reply With Quote

Old   July 26, 2011, 14:06
Default
  #4
New Member
 
Join Date: Mar 2011
Posts: 4
Rep Power: 15
max_sph is on a distinguished road
Thanks guys :-)

I just took a peek inside the paraFoam application that comes with openfoam, and created a .bat file for which there is an alias to, with contents:

caseName=${PWD##*/}
caseFile="$caseName.OpenFOAM"
touch $caseFile

This works good in any directory.

Still unsure how to get the .OpenFOAM file loaded automatically. This is because on my mac os, I required a standalone binary of Paraview, so I have to open this then load up the .OpenFOAM file.
I guess I'll get by with a few extra mouse clicks in the meantime

Thanks again
max_sph is offline   Reply With Quote

Old   July 26, 2011, 17:31
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
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!

Max_sph, in the last lines of paraFoam you would find the solution you are looking for (at least on OpenFOAM 2.0.0/x):
Code:
paraview --data="case.foam"
Keep in mind that the ".OpenFOAM" extension is for official reader that comes with OpenFOAM. The ".foam" is for the internal reader. Well, that is if you don't have to bother having to select from the list of possible readers in ParaView

I haven't yet quite understood what you are trying to do, but you could simply use the already existing paraFoam script to do what you need! At least the one from OpenFOAM 2.0.

Anyway, I suppose that either way, you should now know everything you need for your minimalist script

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   July 28, 2011, 12:10
Default
  #6
New Member
 
Join Date: Mar 2011
Posts: 4
Rep Power: 15
max_sph is on a distinguished road
Thanks Bruno

I did indeed take a quick peek at paraFoam. On a linux system it will work properly, but on a mac os the paraview application is "Paraview.app"... I'm no expert on this, but perhaps someone can't load ".app" applications with a --data argument.
Anyway, the standalone ParaView.app for Mac works good, it's just I have to load the data in manually! (All those clicks... Laziness has got me you see) :P
Anyway, its only a small issue and doesn't matter too much

Thanks for all the support!
max_sph 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 on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51
gcc and executable file from Mac to Linux simone Marras Main CFD Forum 0 April 8, 2007 16:49
Results saving in CFD hawk Main CFD Forum 16 July 21, 2005 21:51
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 16:16


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