changing OF171 to single precision
Hi all,
I'm pretty sure this is a really easy thing to do but I want to change openfoam171 from double precision to single precision. Looking around it shows how to do it for OF 1.3 (here: http://openfoamwiki.net/index.php/Ho...on_of_OpenFOAM) but I'm not sure how I would do it for 171. Thanks! Jeff |
I tried changing the line in ~/opt/openfoam171/etc/bashrc that reads:
Code:
# WM_PRECISION_OPTION = DP | SP Code:
# WM_PRECISION_OPTION = DP | SP Code:
sudo ./Allwmake Code:
Error: Current directory is not $WM_PROJECT_DIR Thanks Jeff |
yes, you cant just change the variables and expect the shell to know about them without sourcing it.
if you open a new window and type icoFoam, I would expect the command not be found, which means that the SP version does not exist yet, so you can compile it with Allwmake |
Yeah that is exactly what happened. So then how would I go about changing to single precision?
J |
Greetings to both!
@ozzythewise: I suggest you resort to OF voodoo - run the following commands in your terminal that has a working OpenFOAM environment: Code:
foam Code:
tail -F make.log
Best regards, Bruno |
Hi Bruno,
When I run the command Code:
./Allwmake > make.log 2>&1 Code:
Error: Current directory in not $WM_PROJECT_DIR Thanks Jeff |
Hi Jeff,
Mmm, I have the vague idea I already tripped on that issue before. OK, easiest way to isolate-and-conquer the problem is to edit Allwmake and after the first line add: Code:
set -x I've got a hunch you either have a contaminated environment, or something is amiss on the file system. Best regards, Bruno |
Okay this is weird.
Well first off when I tried what you wrote I got the following error: Code:
bash: make.log: Permission denied Code:
+ cd . Thanks, Jeff |
Wait, reading the 2nd line of the longer error message I just put up, does that mean that $WM_PROJECT_DIR isn't being set at all (hence it's blank in that line?). The code for Allwmake reads:
Code:
if [ "$PWD" != "$WM_PROJECT_DIR" ] |
Hi Jeff,
Ah HA! You omitted crucial information ;) You are trying to change your system installed OpenFOAM, which requires administrative powers, namely using "sudo" or "su -". This changes the ball game! OK, the easiest thing for you to do is this, always as normal user:
Edit: I forgot about "chmod": Point 1: Code:
sudo chmod -R o+w /opt/openfoam171 Code:
sudo chmod -R o-w /opt/openfoam171 Since you're on Ubuntu (or so I guess): Quote:
Code:
sudo apt-get install binutils-dev flex bison build-essential zlib1g-dev libglib2.0-dev Bruno |
It's just one thing after another, I wish I wasn't bad with linux so that I could try and figure out what I'm doing here. When I enter
Code:
sudo -R o+w /opt/openfoam171 Code:
usage: sudo -h | -K | -k | -L | -V Thanks |
Hi Jeff,
AAaarrrg... how could I do such a mistake... I forgot about writing down the chown command :( :rolleyes: It's this command: Code:
sudo chmod -R o+w /opt/openfoam171 I certainly hope that this way you will finally be able to gets things going! Best regards, Bruno |
Hi,
When I tried your last code I got the following error: Code:
chown: invalid user: `o+w' Code:
sudo chmod o+w /opt/openfoam171 Code:
sudo apt-get install binutils-dev flex bison git-core build-essential python-dev libreadline5-dev wget zlib1g-dev cmake libpng12-dev libxt-dev libxi-dev libxrender-dev libxrandr-dev libxcursor-dev libxinerama-dev libfreetype6-dev libfontconfig1-dev libglib2.0-dev freeglut3-dev libqt4-dev qt4-dev-tools Code:
: ${WM_PRECISION_OPTION:=DP}; Thanks by the way for all your help J |
Hi Jeff,
Sorry about that again, my brain is on "weekend mode", so I'm having trouble writing down the proper commands :( chmod is the command I should have written down! I'll try and not forget to fix my previous posts for future readers. The wmSP command will only change the variable in your current environment, it will not automatically change the /opt/openfoam171/etc/bashrc file! By using wmSP, you wouldn't be restricted to only using one version for each time you edit that file! This way you simply have to type wmSP whenever you want to use the SP version, after the OpenFOAM environment has been initialized. If you want to run OpenFOAM in parallel, then add the wmSP command to the line after the initialization of the environment on ~/.bashrc. Returning to DP mode will also be as easy as running wmDP. I hope that I haven't mistyped anything on this post... Best regards, Bruno |
Sorry, I'm confused. Do I need to manually edit the /opt/openfoam171/etc bashrc file to read:
Code:
: ${WM_PRECISION_OPTION:=SP}; Code:
foam |
That the brilliance of wmSP and wmDP: No editing required!
Simply run those 3 commands and you're good to go... or so I hope, since this should have been solved about 5 posts ago :( OK, let me try and give a step by step work flow, for after you've managed to build OpenFOAM in SP mode. This is assuming that you haven't edited OpenFOAM's bashrc file. Normal serial work flow (i.e., not for running in parallel):
To switch back to DP mode, simply comment the line you've added to .bashrc, to look like this: Code:
. /opt/openfoam171/etc/bashrc Bruno |
YEAHHHH got it!
Code:
echo $WM_OPTIONS I'm just going to write out here the steps for anyone that comes along this thread and wants the quick and easy way to change OF171 from double precision to single precision: ______________________________________ Code:
foam |
Hi Jeff,
Finally! Congrats! :) And I forgot to mention that you could speed up the building process if you defined WM_NCOMPPROCS to the number of your machine's processors: http://www.openfoam.com/download/source.php#x5-27000 For example, before you run Allwmake, you could run: Code:
export WM_NCOMPPROCS=4 Oh well... on weekends I'm a bit more slow minded than usual... And a word of warning: SP can be faster to run on most cases, but mesh generation can get a bit troublesome, at least when running snappyHexMesh. And solvers for particles or molecule chemistry, have a tendency to get annoyed at the lack of precision ;) Best regards and have fun! Bruno |
All times are GMT -4. The time now is 20:25. |