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

[OpenFOAM.com] Moving already Installed OpenFOAM to different machine (user)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By lhsihan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 26, 2010, 08:58
Post Moving already Installed OpenFOAM to different machine (user)
  #1
New Member
 
Join Date: Aug 2010
Posts: 3
Rep Power: 15
lokendra is on a distinguished road
Hi Everyone,

How to make sure that moving an already existing OpenFOAM installation (built from source) to a different user in same machine or a user in different machine alltogether (assuming all OS, package installation to be the same), works fine (so that one needs not build it again, because its time-consuming).
I mean, just resetting the environment variables would be enough to complete the installation for a new user/machine ?

My actual problem, is that I am trying to run OpenFOAM on a grid.
And I am using my local installation for the grid-user (making sure the permission compatibility) . And I am not able to run OpenFOAM on grid as grid-user (after resetting the env variable according to grid-user)

Following error occurs on running a simple blockMesh Command:

word::stripInvalid() called for word CN=5a631e00-2cdb-4b59-861f-4580f7e05fe2
For debug level (= 2) > 1 this is considered fatal
/tmp/openfoam-test/runOpenFoam: line 23: 16241 Aborted blockMesh

"CN=5a631e00-2cdb-4b59-861f-4580f7e05fe2" is actually the grid-userId on the Grid.
lokendra is offline   Reply With Quote

Old   August 26, 2010, 18:14
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
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 Lokendra and welcome to the forum!

I'm sorry for starting off with a rant, but I'm going to have to say this first: XtreemOS is stupid It's breaking a rule in user naming: No stupid characters in the user names, which should also be short by definition!

So, AFAIK, the explanation is this: OpenFOAM at the core needs to know some $HOME and user details, so it can more easily know where to tread in a multi-core environment. And the user name is also checked for "illegal" characters, to avoid some bad things to happen further down the road with the file systems.

So, I'm going to try to post some minor changes (or hacking ) you need to do to OpenFOAM's file "src/OSspecific/POSIX/POSIX.C". Do this on your original machine/build environment! So, open that file and next I'll give the changes to be done.

... But first, some introduction to the addition needed on your grid account - a new variable in the shell environment is crucial to be defined in .bashrc or something like that:
Code:
export MYUSER="ofuser"
The name "ofuser" is more OpenFOAM friendly, but feel free to make it "lokendra" or your username in your initial build system, but stay clear from strange characters
And make sure your HOME variable is defined:
Code:
echo $HOME
If it isn't defined, then you will need to define it!

Now, as for the changes in the OpenFOAM's file POSIX.C:
  1. Find the line "Foam::word Foam::userName()";
  2. Change this:
    Code:
    Foam::word Foam::userName()
    {
        struct passwd* pw = getpwuid(getuid());
    
        if (pw != NULL)
        {
            return pw->pw_name;
        }
        else
        {
            return word::null;
        }
    }
    To this:
    Code:
    Foam::word Foam::userName()
    {
        char* env = getenv("MYUSER");
    
        if (env != NULL)
        {
            return fileName(env);
        }
        else
        {
          struct passwd* pw = getpwuid(getuid());
    
          if (pw != NULL)
          {
              return pw->pw_name;
          }
          else
          {
              return word::null;
          }
        }
    }
  3. Now find "Foam::fileName Foam::home(const word& userName)";
  4. Change this:
    Code:
    Foam::fileName Foam::home(const word& userName)
    {
        struct passwd* pw;
    
        if (userName.size())
        {
            pw = getpwnam(userName.c_str());
        }
        else
        {
            char* env = getenv("HOME");
    
            if (env != NULL)
            {
                return fileName(env);
            }
    
            pw = getpwuid(getuid());
        }
    
        if (pw != NULL)
        {
            return pw->pw_dir;
        }
        else
        {
            return fileName::null;
        }
    }
    To this:
    Code:
    Foam::fileName Foam::home(const word& userName)
    {
        char* env = getenv("HOME");
    
        if (env != NULL)
        {
            return fileName(env);
        }
    
        struct passwd* pw;
    
        if (userName.size())
        {
            pw = getpwnam(userName.c_str());
        }
        else
        {
            pw = getpwuid(getuid());
        }
    
        if (pw != NULL)
        {
            return pw->pw_dir;
        }
        else
        {
            return fileName::null;
        }
    }
NOTE: I haven't tested this code, but the changes made shouldn't leave margin for bugs

OK, now run ./Allwmake as you've done before. It should build quite quickly, since it will only update libOpenFOAM.so

Keep us posted on the outcome!

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   August 27, 2010, 04:57
Default
  #3
New Member
 
Join Date: Aug 2010
Posts: 3
Rep Power: 15
lokendra is on a distinguished road
Hi Bruno,

Thanks a LOT for such a detailed and clear instructions.
The hack worked like a charm.

Thanx again for your time.

Regards
Lokendra
lokendra is offline   Reply With Quote

Old   November 30, 2011, 12:59
Default
  #4
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
Does anyone know how to solve this problem in Windows?

I try to run OpenFOAM in Windows. The same error appears when I try to run OF.
I cannot find the files you mentioned in my WIndows version, thus I don't know how to solve this problem. Maybe someone knows more.

Thanks a lot.

Best Regards,
tH3f0rC3
tH3f0rC3 is offline   Reply With Quote

Old   December 1, 2011, 02:29
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
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
Hi tH3f0rC3,

Quote:
Originally Posted by tH3f0rC3 View Post
Does anyone know how to solve this problem in Windows?

I try to run OpenFOAM in Windows. The same error appears when I try to run OF.
I cannot find the files you mentioned in my WIndows version, thus I don't know how to solve this problem. Maybe someone knows more.
Wait... you're getting the exact same error as reported on the original post?
Quote:
Originally Posted by lokendra View Post
word::stripInvalid() called for word CN=5a631e00-2cdb-4b59-861f-4580f7e05fe2
For debug level (= 2) > 1 this is considered fatal
/tmp/openfoam-test/runOpenFoam: line 23: 16241 Aborted blockMesh
If you are getting a similar error but with a different word, then it would be easier to help you if you showed said error and tell us with which application it crashed with!

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   December 1, 2011, 02:41
Default
  #6
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
Hi,

it is the nearly the same error:

word::stripInvalid() called for word ***
For debug level (= 2) > 1 this is considered fatal

*** is another word. It is my full name. Maybe because I named the computer like that, I don't know.
When I switch off all debug options in the controldict file OF runs. I haven't found out if OF really runs without a mistake.

This error message occurs no matter which command I have typed in (laplacianFoam, chtMultiRegionFoam, blockMesh...)

Best Regards
tH3f0rC3 is offline   Reply With Quote

Old   December 1, 2011, 02:51
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
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
Hi tH3f0rC3,

Ah, that makes it a lot clearer

The solution for that and some other issues are described at openfoamwiki.net, on this section: Setting up shop in Windows

I didn't even remember that I briefly wrote some tips on how to use MSys there! A year flies by in an instant... (check the history link at the top of the page) and parts of my memory goes with it...

Good luck!
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   December 1, 2011, 03:19
Default
  #8
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
Hi,

thanks, now it works.

Best Regards
tH3f0rC3 is offline   Reply With Quote

Old   December 1, 2011, 04:11
Default
  #9
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
I Don't know exactly what have done, but OF works now.
I think the paths have not been set correct and now they are.

New problem:
I want to have a look at the simulated results with paraView. I have paraView installed but in WIndows paraView needs VTK files, as far as I know. Thus I have tried to foamToVTK the calculated files.
The VTK files are created but paraView can't read. The following error message appears in paraView when opening the vtk-files:

ERROR: In ..\..\..\..\source\VTK\IO\vtkUnstructuredGridReade r.cxx, line 349 vtkUnstructuredGridReader (10C74FD8): Unrecognized keyword: u


Another error message appears when starting foamToVTK :
From function IOstream::compressionEnum(const word&)
in file db/IOstreams/IOstreams/IOstreams.C at line 75
bad compression specifier 'off', using 'uncompressed'


And then the foamToVTK starts.
Do you think this causes the error in paraView? I don't think so, but I can't think off another mistake why paraView can't read the vtk files.


Best Regards
tH3f0rC3 is offline   Reply With Quote

Old   December 1, 2011, 04:24
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
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
Hi tH3f0rC3,

Wasn't there a "parafoam.bat" file in the patch files!? Read step #4 of the previous link

If you use a version of ParaView 3.8.0 or newer, you can open files of type ".foam, which what "parafoam.bat" does.

If you still want to use VTK files, try:
Code:
foamToVTK -help
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   December 1, 2011, 05:02
Default
  #11
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
There was such a file.

I use paraview 3.10.1 -> But how can I open the "normal" results of my solver without foamToVTK these results?

I have copied the parafoam.bat to the bin directory of OpenFoam.
Now I think I have to move the still installed paraView to another directory that the parafoam.bat can find the paraview.exe
This step doesn't work, because I haven't the same directory files described in the link you've posted.
I have tried to modify the parafoam.bat from


echo.>case.foam
start paraview.exe --data="case.foam"

to


echo.>case.foam
start D:\programs\paraview3.10.1\bin\paraview.exe --data="case.foam"

BUt this doesn't work.

->
Or how can I create the .foam file myself?
tH3f0rC3 is offline   Reply With Quote

Old   December 1, 2011, 08:10
Default
  #12
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
An extract from the link you posted:

Paraview should be installed in, or copied to, one of the following folders, according to the versions installed (these are only some of the possible versions):
ThirdParty-1.7.0\platforms\linuxmingw32\paraview-3.8.0
ThirdParty-1.7.0\platforms\linuxmingw-w32\paraview-3.8.0

ThirdParty-1.7.0\platforms\linuxmingw-w64\paraview-3.8.0

This is exactly the thing I havn't done up to now, because I don't have such directories. And I can't find out where the parafoam.bat searches for the paraview.exe


The source code of parafoam.bat:
echo.>case.foam
start paraview.exe --data="case.foam"


Best Regards
tH3f0rC3 is offline   Reply With Quote

Old   December 1, 2011, 14:47
Default
  #13
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
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
Hi tH3f0rC3,

Quote:
Originally Posted by tH3f0rC3 View Post
echo.>case.foam
start D:\programs\paraview3.10.1\bin\paraview.exe --data="case.foam"

BUt this doesn't work.

->
Or how can I create the .foam file myself?
Uhm... it was right in front of you!?
Code:
echo.>case.foam
Run that on the command line at your simulation case and then you can open in ParaView!

It doesn't matter what the file contains, because ParaView only uses the file as a marker of the case to be opened.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   December 2, 2011, 08:36
Default
  #14
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
Perfect, thanks!
tH3f0rC3 is offline   Reply With Quote

Old   December 11, 2018, 01:01
Default
  #15
New Member
 
hui
Join Date: Dec 2018
Posts: 6
Rep Power: 7
lhsihan is on a distinguished road
Would like to do similar thing in the openfoam grid.
I am leanring Openfoam and would like to install it on centos7. But the Openfoam officially just provide the docker version for centos7. So I compiled Openfoam from source on VM called "VM1" and it took several hours to finish. We have 4 VMs and I found if we tar the Openfoam folder on VM1 and scp it to other VMs, with preinstalled some libraries, we could run motorbike example successfully.

So would like to confirm with you about two questions:
1. how to check if one Openfoam installation is correct or not. I previous use "foamInstallationTest" to check the Openfoam installation but it seemed it seldom failed at checking. So not sure if it is correct way to check if Openfoam installation is correct or not.

2. Can we use this kind of installation way such like "tar one pre-installed openfoam folder and untar it on another vm" to install openfoam?

Thanks a lot for the reply!
lhsihan is offline   Reply With Quote

Old   December 16, 2018, 15:10
Default
  #16
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
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
Quick answers @lhsihan:

Quote:
Originally Posted by lhsihan View Post
1. how to check if one Openfoam installation is correct or not. I previous use "foamInstallationTest" to check the Openfoam installation but it seemed it seldom failed at checking. So not sure if it is correct way to check if Openfoam installation is correct or not.
The best way to confirm if OpenFOAM is properly installed is to run one of its tutorial cases. If you are not familiar with which tutorial cases to run, then the following commands should do the trick:
  1. Activate the OpenFOAM environment.
  2. Create the standard user folders for running cases:
    Code:
    mkdir -p $FOAM_RUN
    cd $FOAM_RUN
  3. First run the simplest tutorial that runs with a single core, it's the very first case in the User Guide:
    Code:
    cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity cavityTest
    cd cavityTest
    foamRunTutorials
  4. At the end, check the contents of the files "log.*". Compare this to the original installation, but you can simply do a quick visual check if they look the same.
  5. Go back to the parent folder:
    Code:
    cd ..
  6. Then run a case that needs to run in parallel, which usually also requires the m4 application for meshing and uses only for 4 cores, by running theses commands:
    Code:
    cp -r $FOAM_TUTORIALS/incompressible/pimpleDyMFoam/mixerVesselAMI2D mixerVesselAMI2DTest
    cd mixerVesselAMI2DTest
    ./Allrun
    Should take around a minute or two to run, maybe less, maybe more.
  7. And again, at the end, check the contents of the files "log.*". Compare this to the original installation, but you can simply do a quick visual check if they look the same.
And that's it. This has the added benefit of telling you if the machines are performing properly in comparison to each other, by checking the times it took to run the second case.

Quote:
Originally Posted by lhsihan View Post
2. Can we use this kind of installation way such like "tar one pre-installed openfoam folder and untar it on another vm" to install openfoam?
As long as the system dependencies are also installed on the other machines, then it should work. That's essentially how Docker works...
__________________
wyldckat is offline   Reply With Quote

Old   January 28, 2019, 05:35
Default
  #17
New Member
 
hui
Join Date: Dec 2018
Posts: 6
Rep Power: 7
lhsihan is on a distinguished road
Thanks a lot @wyldckat for the detailed info.
wyldckat likes this.
lhsihan is offline   Reply With Quote

Reply

Tags
already existing, already installed, moving, new user


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
Frequently Asked Questions about Installing OpenFOAM wyldckat OpenFOAM Installation 3 November 14, 2023 11:58
How to contribute to the community of OpenFOAM users and to the OpenFOAM technology wyldckat OpenFOAM 17 November 10, 2017 15:54
OpenFOAM Training, London, Chicago, Munich, Houston 2016-2017 cfd.direct OpenFOAM Announcements from Other Sources 0 September 14, 2016 03:19
[OpenFOAM.org] A Mac OS X of23x Development Environment Using Docker rt08 OpenFOAM Installation 1 February 28, 2016 19:00
OpenFOAM Distribution by Virtual Machine will OpenFOAM Installation 5 June 20, 2008 08:11


All times are GMT -4. The time now is 15:34.