CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   How to install OF DP and SP in parallel? (https://www.cfd-online.com/Forums/openfoam-installation/94687-how-install-dp-sp-parallel.html)

klausb November 22, 2011 16:29

How to install OF DP and SP in parallel?
 
Hello,

I installed OpenFoam-2.0.1 with standard double precision (DP) on my computer. Works fine!

In addition to that I'd like to install as single precision (SP) version on the same computer for different purposes.

The DP version is installed in /OpenFOAM/OpenFOAM-2.0.1

I use the current version of Linux Mint.

When I tried to install an additional SP version some time ago, I messed the existing DP installation up and was not able to fix it afterwards. This time I'd like to avoid that, hence some questions:

My idea is:

1. Create a new directory $HOME/OpenFOAMSP/OpenFOAM-2.0.1
2. Update $HOME/.bashrc

change 'source $HOME/OpenFOAM/OpenFOAM-2.0.1/etc/bashrc' to 'source $HOME/OpenFOAMSP/OpenFOAM-2.0.1/etc/bashrc'

3. In the bashrc file in $HOME/OpenFOAMSP/OpenFOAM-2.0.1/etc/bashrc

change 'export WM_PROJECT=OpenFOAM' to 'export WM_PROJECT=OpenFOAMSP'

and

change 'export WM_PRECISION_OPTION=DP' to 'export WM_PRECISION_OPTION=SP'

Is there anything else to think about to be able to install and run the two version on one computer independently (but not at the same time)?

Regards,

Klaus

wyldckat November 22, 2011 16:48

Greetings Klaus,

I understand you wanting to make sure that they are separate, but the following method makes it perfectly safe to have both builds in the same OpenFOAM folder:
  1. Remove or comment the entries you added to your "$HOME/.bashrc" file.
  2. Add these instead:
    Code:

    alias of201D='. $HOME/OpenFOAM/OpenFOAM-2.0.1/etc/bashrc'
    alias of201S='. $HOME/OpenFOAM/OpenFOAM-2.0.1/etc/bashrc WM_PRECISION_OPTION=SP'

Then on each new terminal window/tab, run of201D or of201S according to the environment you want. If you want to switch between environments in the same terminal, run wmUNSET like this:
Code:

of201D

<run the commands you want>

wmUNSET
of201S

For more about this, see my (incomplete) blog post on Advanced tips for working with the OpenFOAM shell environment

But if you still want to have 2 fully separate installations, the key variable is "FOAM_INST_DIR", as shown here: http://www.openfoam.org/git.php#x3-9000
Stuffing those 3 lines into an alias can be done with adding ";":
Code:

alias of201D='export FOAM_INST_DIR=$HOME/OpenFOAM/ ; foamDotFile=$FOAM_INST_DIR/OpenFOAM-2.0.1/etc/bashrc ; [ -f $foamDotFile ] && . $foamDotFile'
alias of201S='export FOAM_INST_DIR=$HOME/OpenFOAMSP/ ; foamDotFile=$FOAM_INST_DIR/OpenFOAM-2.0.1/etc/bashrc ; [ -f $foamDotFile ] && . $foamDotFile WM_PRECISION_OPTION=SP'

Best regards,
Bruno

klausb November 27, 2011 10:02

This doesn't work...
 
1 Attachment(s)
Hello Bruno,

background: I need two separate versions as it's not just about SP/DP, there are more changes.

I've just setup the SP version for installation but for some reason, the path stuff in .bashrc and bashrc of the installation is messed up.

Note there is a perfectly working DP installation in $HOME/OpenFOAM...

The SP version needs to be installed in/the sources are in $HOME/OpenFOAMSP/OpenFOAMSP-2.0.1

The .bashrc entry is:

source $HOME/OpenFOAMSP/OpenFOAMSP-2.0.1/etc/bashrc

The bashrc in the installation directory (it's attached renamed bashrc.txt)

I changed export WM_PROJECT=OpenFOAM to:

export WM_PROJECT=OpenFOAMSP

When I try to run the installation ./Allwmake, the pwd check fails and source .bashrc results in the following errors:

source .bashrc
bash: Error: Datei oder Verzeichnis nicht gefunden
bash: :: Datei oder Verzeichnis nicht gefunden
bash: unknown/unsupported: Datei oder Verzeichnis nicht gefunden
bash: naming: Datei oder Verzeichnis nicht gefunden
bash: convention: Datei oder Verzeichnis nicht gefunden
bash: Error: Datei oder Verzeichnis nicht gefunden
bash: :: Datei oder Verzeichnis nicht gefunden
bash: unknown/unsupported: Datei oder Verzeichnis nicht gefunden
bash: naming: Datei oder Verzeichnis nicht gefunden
bash: convention: Datei oder Verzeichnis nicht gefunden
bash: Error: Datei oder Verzeichnis nicht gefunden
bash: :: Datei oder Verzeichnis nicht gefunden
bash: unknown/unsupported: Datei oder Verzeichnis nicht gefunden
bash: naming: Datei oder Verzeichnis nicht gefunden
bash: convention: Datei oder Verzeichnis nicht gefunden
bash: Error: Datei oder Verzeichnis nicht gefunden
bash: :: Datei oder Verzeichnis nicht gefunden
bash: unknown/unsupported: Datei oder Verzeichnis nicht gefunden
bash: naming: Datei oder Verzeichnis nicht gefunden
bash: convention: Datei oder Verzeichnis nicht gefunden


What's wrong with my settings?

klaus

wyldckat November 27, 2011 13:42

Hi Klaus,

The OpenFOAM code, although designed for easy project renaming for situations where the project could be forked, isn't always tested to check how compatible it is with fast forking.

In other words: do not change the WM_PROJECT variable unless you know what you are doing! ;)

What you can do is make the following changes to these two variables:
Code:

export WM_PROJECT_VERSION=2.0.1-SP
foamInstall=$HOME/${WM_PROJECT}SP

If you truly wish to fix how "WM_PROJECT" works, then you'll have to do some debugging to the shell scripts.

By what I've seen, it seems that if you do want to change the WM_PROJECT variable, you'll have to at least change every occurrence of the word "OpenFOAM" to "OpenFOAMSP" in the file "bin/foamEtcFile".

Good luck!
Bruno

klausb November 27, 2011 17:43

Nearly there -ThirdParty-2.0.1-SP not found
 
Hello Bruno,

thank you for your feedback! Things are getting better but I get a compilation error: no ThirdParty sources found - skipping

They are in: $HOME/OpenFOAMSP/ThirdParty-2.0.1-SP

Any idea what's the problem?

Klaus

wyldckat November 28, 2011 16:14

Hi Klaus,

Quote:

Originally Posted by klausb (Post 333725)
thank you for your feedback! Things are getting better but I get a compilation error: no ThirdParty sources found - skipping

They are in: $HOME/OpenFOAMSP/ThirdParty-2.0.1-SP

Mmmm.... try starting a new terminal window, to be 100% certain that the shell environment is initiated properly.

My guess is that since you might have renamed the ThirdParty folder only after you edited OpenFOAM's "etc/bashrc" file, which might leave some essential variables not properly defined until you start a new terminal.

Best regards,
Bruno

klausb January 7, 2012 18:40

solved
 
step-by-step: I use the git version on Linux Mint

1. unpack the new version + ThirdParty in $Home/OpenFoam as usual

2. Update .bashrc in $HOME to match the new version

3. The differentiator is the entry: export WM_PROJECT_VERSION=2.0.1-SP in the $HOME/OpenFoam/OpenFoam-new_version/etc/bashrc

DON'T try to change export WM_PROJECT=OpenFOAM, as that can cause a lot of problems.

Klaus


All times are GMT -4. The time now is 06:29.