Jump to content
Ilias Soultanias

OpenFOAM and CAESES connection configured in Windows

Recommended Posts

Hi All,

 

Recently I wanted to investigate the use of OpenFOAM for CFD calculations for a model built in CAESES and perform an optimization at a later stage. Although the OpenFOAM is a C++ library meant to be run in Linux systems, I wanted to test the configuration on my Windows pc and I found this compiled OpenFOAM 2.3 version available. After installing the software as instructed I had to change a little bit the configuration of the software connector in CAESES.

 

Basically, I called the mintty.exe terminal application and run a modified version of the Allrun.sh shell script, as demonstrated at the ahmed body sample. You can find attached a picture of the LocalApplication and its arguments, the modified shell script Allrun.sh and the modified project file of the Ahmed Body sample provided with CAESES installation.

 

Please notice that I have configured the OpenFOAM calculation to run on a single processor and deactivated any parallel computing, because of my restricted resources, but you could easily restore that back. I had also to change some points in the RunFunctions file located in /opt/OpenFOAM/OpenFOAM-2.3.x/bin/tools and you can find attached this new file too.

 

If you are interested in learning how to manipulate OpenFOAM or try some simple simulations on your windows machine, you can give it a try.

 

post-123-0-91444200-1408109402_thumb.png

 

Cheers,

Ilias.

ahmedbody.fdbc

Allrun.zip

Share this post


Link to post
Share on other sites

Hi

I'm currently also using OpenFOAM 2.3.x for Windows. When I try the connector as per tutorial (Sduct with OpenFOAM), it doesn't work. I believe this is because of the coding syntax, so I tried your Allrun.sh-file and i replaced the RunFunctions-file in the OpenFOAM\cygwin64\opt\OpenFOAM\OpenFOAM-2.3.x\bin\tools. But still the same error.

Error message: 
 

*** INFO Runner : finished results [design: baseline]

*** INFO Runner : Preparing process ... [design: baseline]

*** INFO Runner : Writing command files ... [design: baseline]

*** INFO Runner : Finished preparation - running external process ... [design: baseline]

*** INFO Multi Body STL Export : processing [exporting 1 object(s)]

*** INFO Runner : running external process [Allrun.sh in design baseline]

*** INFO Runner : Results are pending

*** INFO LocalResourceManager : External process start failure [starting process C:/OpenFOAM/cygwin64/home/Bram/OpenFOAM/Design/connection with openfoam/Sduct with openfoam/manual_results/baseline/Runner//Allrun.sh failed: Process failed to start: ]

*** INFO Runner : finished results [design: baseline]

 

Would you happen to know what to do about this?

 

Sincerely

Bram

Share this post


Link to post
Share on other sites

Hey Bram,

 

You need to change your allrun script in the software connector.

 

This is my allrun script for the sduct and it is working.

Sure you need to adjust the path to your ones.

#!/bin/bash
#!/bin/sh

if [ -z $WM_PROJECT_DIR ] ; then
  echo "\n\nERROR: Your openFOAM setup is not correct. No openFoamDotFile loaded."
  OFFILE=/opt/OpenFoam/OpenFoam-2.3.x/etc/bashrc  
  if [ -f $OFFILE ] ; then
    . $OFFILE
  else
    echo "\n\nERROR: no openFOAM dot file found.\n\nTry to modify the Allrun.sh in SoftwareConnector"
    exit 1
  fi
fi
#wmUNSET

#wmUNSET
#source /opt/OpenFOAM/OpenFOAM-2.3.x/etc/bashrc.win
. /opt/OpenFOAM/OpenFOAM-2.3.x/bin/tools/RunFunctions

blockMesh.exe -dict constant/polyMesh/blockMeshDict 2>&1 | /usr/bin/tee.exe $BLOCK_LOG
snappyHexMesh.exe -overwrite  2>&1 | /usr/bin/tee.exe $LOG
#checkMesh.exe

simpleFoam.exe 2>&1 | /usr/bin/tee.exe $LOG

/usr/bin/touch.exe case.foam

patchAverage.exe p -latestTime sduct_lightpink > pin.dat

Hope this solves your problem ..

Cheers,

 

Karsten

Share this post


Link to post
Share on other sites

Karsten, Carsten

 

Thanks for the reply, I was abroad for my job and couldn't check it until today, so sorry for the late reply :).
It still doesnt work. I've tried the new Allrun file with both RunFunctions files (original and the one from higher up this page), but it didn't change anything. What is like the main change in this other RunFunctions file?
This is what is in the stdouterroroutput.redirect file:

 

Moving C:/OpenFOAM/cygwin64/home/Bram/OpenFOAM/Design/connection with openfoam/Sduct with openfoam/manual_results/baseline/Runner01/input/0 to C:/OpenFOAM/cygwin64/home/Bram/OpenFOAM/Design/connection with openfoam/Sduct with openfoam/manual_results/baseline/Runner01//0

Moving C:/OpenFOAM/cygwin64/home/Bram/OpenFOAM/Design/connection with openfoam/Sduct with openfoam/manual_results/baseline/Runner01/input/Allrun to C:/OpenFOAM/cygwin64/home/Bram/OpenFOAM/Design/connection with openfoam/Sduct with openfoam/manual_results/baseline/Runner01//Allrun
Moving C:/OpenFOAM/cygwin64/home/Bram/OpenFOAM/Design/connection with openfoam/Sduct with openfoam/manual_results/baseline/Runner01/input/constant to C:/OpenFOAM/cygwin64/home/Bram/OpenFOAM/Design/connection with openfoam/Sduct with openfoam/manual_results/baseline/Runner01//constant
Moving C:/OpenFOAM/cygwin64/home/Bram/OpenFOAM/Design/connection with openfoam/Sduct with openfoam/manual_results/baseline/Runner01/input/system to C:/OpenFOAM/cygwin64/home/Bram/OpenFOAM/Design/connection with openfoam/Sduct with openfoam/manual_results/baseline/Runner01//system
 
 
This is what the Allrun file now looks like:

#!/bin/bash
#!/bin/sh


if [ -z $WM_PROJECT_DIR ] ; then
  echo "\n\nERROR: Your openFOAM setup is not correct. No openFoamDotFile loaded."
  OFFILE=C:/OpenFOAM/cygwin64/opt/OpenFOAM/OpenFOAM-2.3.x/etc/bashrc  
  if [ -f $OFFILE ] ; then
    . $OFFILE
  else
    echo "\n\nERROR: no openFOAM dot file found.\n\nTry to modify the Allrun.sh in SoftwareConnector"
    exit 1
  fi
fi
#wmUNSET


#wmUNSET
#source C:/OpenFOAM/cygwin64/opt/OpenFOAM/OpenFOAM-2.3.x/etc/bashrc.win
. C:/OpenFOAM/cygwin64/opt/OpenFOAM/OpenFOAM-2.3.x/bin/tools/RunFunctions


blockMesh.exe -dict constant/polyMesh/blockMeshDict 2>&1 | /usr/bin/tee.exe $BLOCK_LOG
snappyHexMesh.exe -overwrite  2>&1 | /usr/bin/tee.exe $LOG
#checkMesh.exe


simpleFoam.exe 2>&1 | /usr/bin/tee.exe $LOG


/usr/bin/touch.exe case.foam


patchAverage.exe p -latestTime sduct_lightpink > pin.dat

Sincerely

Bram

Share this post


Link to post
Share on other sites

Hey Bram,

 

I have tested my setup again and it is working.

It looks like that the local application and the argument is not set correctly. post-41-0-35923000-1456076129_thumb.png

  1. click Runner
  2. set the arguement
  3. click the edit or plus button at local application
  4. set the minty.exe file in the cygwin/bin folder as executable
  5. click the Run-button

If it is still not working I'd like you to attach your project file.

 

Here is my modifed allrun script the first 15 lines are not needed at all.

#!/bin/bash
#!/bin/sh

blockMesh.exe -dict constant/polyMesh/blockMeshDict 2>&1 | /usr/bin/tee.exe $BLOCK_LOG
snappyHexMesh.exe -overwrite  2>&1 | /usr/bin/tee.exe $LOG
#checkMesh.exe

simpleFoam.exe 2>&1 | /usr/bin/tee.exe $LOG

/usr/bin/touch.exe case.foam

patchAverage.exe p -latestTime sduct_lightpink > pin.dat

I've download the file from Ilias and created the local application and ran it.

 

Cheers,

 

Karstem

Share this post


Link to post
Share on other sites

Karsten

 

Still doesn't work, but we're heading the good way. I didn't use the mintty.exe ( since it wasn't clear that I should use it). When I only put as argument ";/Allrun" it creates an output file (pin.dat). When I put the whole "-|stdouterroroutput.redirect ./Allrun", it says that it doesn't recognize the "-|" part. 

Also what I've noticed is that when I open the mintty.exe it says: bash: uname: command not found [next line] your "" operating system is not supported.... bla bla bla. I don't know if this has anything to do with it, since I've already done some tutorials (directly) in OpenFOAM and than there wasn't a problem.

 

 

Regards

Bram

Sduct with openfoam_2.fdbc

Share this post


Link to post
Share on other sites

Hey Bram,

 

1) You haven't set the argument. therefore the minty.exe doesn't know what it should do. I've changed that. I also changed the name of the allrun script from Allrun to Allrun.sh not sure if this makes any difference at all.

 

Now OF is running but throwing errors.

 

2) First error was that the control file was missing the endTime VALUE statement in Line 20. See the change file in the software connector.

 

Another try still errors. Which is coming from the blockmeshdict file

 

3) the blockmehdict should be located in constant/polyMesh/ but in your setup it was set to "system/blockmeshdict"

Now the meshing was working but ofcourse another error....

 

Cannot find patchField entry for sduct_lightgray

 

4.1) The reason for this is the name of the exported stl file. You defined it as constant/triSurface/sDuct.stl but it needs to be constant/triSurface/sduct.stl (instead of D it should be d). The reason is that OF is case sensitive.

 

4.2) The color of the duct surface in the trimesh needs to be darkgray instead of lightgray

 

It is really important that you use the same color settings. The colors are used to identify the specified patches (inlet, outlet, wall)

 

Now you can continue with the tutorial.

Hope it is now running for you as well if not let me know and we will get it done.

The modified project file: Sduct_with_openfoam_2_FSYS.fdbc

And also note that I got rid of the white spaces in the projectname because Linux does not really like it that much. At least that is my experience.

 

Cheers,

 

Karsten

Share this post


Link to post
Share on other sites

Hi everyone,

 

I'm new to both CAESES and OpenFOAM and in addition to that intended to use OpenFOAM in Windows. So all the elements to create troubles present  :rolleyes:.​ I've installed OpenFOAM for Windows from http://www.openfoam.com/download/install-windows.php which is using Oracle VM + Docker. OpenFOAM can be operated from the shell.

 

I've done some fiddling around with CAESES but at the point needing to actually solve something I'd need serious help.

 

Now, I've tried to couple CAESES to OpenFOAM but am struggling. I've tried the above post as starting point and example but it seems that the differences between Cygwin and Docker are the issue.

 

Has anyone coupled these sets already and could the solution be shared please? I would appreciate answers for dummies (as being one myself :)).​

 

If it helps to start answering, I've modified the LocalApplication of the 1st post to have C:/Program Files (x86)/ESI/OpenFOAM/1606/Windows/Scripts/start_OF.bat file executed instead of "mintty.exe" to call the OpenFOAM. Would this be a totally wrong way to go?

 

Some modifications had to be made also to Allrun.sh as the OpenFOAM version seems to be different (v1606+).

 

Regards,

 

Sami

Share this post


Link to post
Share on other sites

Hey Sami,

 

I would recommend the OpenFOAM for windows from Sim-Flow https://sim-flow.com/download/openfoam-windows/.

It is really easy and you do not really need to change the allrun script of our openfoam tutorial.

 

I've never used the OpenFOAM for windows which you mentioned.

 

This is an example allrun script for windows for the simflow OF which you need to adapt the allrun script of the sduct tutorial.

::Meshing
surfaceFeatureExtract
blockMesh
snappyHexMesh -overwrite

:: solving
simpleFoam

::postprocessing
:: equivalent for touch on linux systems
echo .> case.foam

patchAverage p -latestTime sduct_Inlet > pin.dat
patchAverage p -latestTime sduct_Outlet > pout.dat

Cheers,

 

Karsten

Share this post


Link to post
Share on other sites
Hi Karsten,

 

I'm having the same problem as Sami was having. I am running Windows. I installed the OpenFOAM from Sim-Flow and use the parameters you specify for Allrun for the sduct tutorial. But I'm getting the *** INFO LocalResourceManager : External process start failure error.

 

Is there anything I should try?

 

Thank you.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...