Jump to content
Sign in to follow this  
Mr. Paulo Macedo__0001

OpenFOAM® for Windows Tutorial - CAESES + CFD support - Ahmed Body Example

Recommended Posts

Dear all,

It is now proven to easily connect OpenFOAM® for Windows provided by CFD support with CAESES.

 

In this topic I am providing a step by step set-up connection for anyone that wants to connect CAESES and OpenFOAM on a windows machine.

At first glance it might be a long tutorial, but it is rather simple connection if you have basic knowledge in CAESES and OpenFOAM environment.

 

The goal is to provide a base that works seamless for optimizations in CAESES so that you can adapt it to your own OpenFOAM project.

I am not an expert in linux system and somethings might not be entirely accurate or efficient, but the set-up works.

 

STEPS

 

1 - Download OpenFOAM® for Windows provided by CFD support and install it, preferably in the C: drive, accepting all the options that the installation requires.

 

1.1 - --OPTIONAL--- Include the installed OpenFoam bin directories to the windows system environment PATHS (requires administrator access)

Paths to include: (change C:\ to the correct path if necessary)

C:\OpenFOAM\18.06\bin

C:\OpenFOAM\18.06\cygwin64\bin

C:\Program Files\gnuplot\bin

-- and other directories that you might want to use, execute direct commands from OpenFoam --

 

2 - Open the attached CAESES project file with the ahmedbody, select the number of iterations and the number of processors in the |03_OpenFOAM|01_run_controls directory in the CAD folder.

ahmedbody_windowsOpenFOAM_CFDsupport.fdb

 

2.1 - Replace the term %USERNAME% in the bashEditor with the correct name of your user in the windows. You can find it in picture 1 attached.

For more information on this feature, consult the debugging section below.

 

2.2 - If you have executed the step 1.1, you are very likely to be ready to run the simulation, if not, you have to edit a few files in the software connector window.

First, the OFstart.bat file, replace the bash line with the full path of the bash executable, something like:

C:\OpenFOAM\18.06\cygwin64\bin\bash.exe -l -i

Secondly, do the same for the executables that you run in the Allrun.sh script, gnuplot for example.

 

You should be all set to run the simulation.

 

If, by some reason, the simulation did not complete successfully, follow the debugging section.

 

 

DEBUGGING

 

It is very likely that the problem is with the bash/OpenFOAM environment, as well as its functions, and not with CAESES itself.

 

1 - Make sure that the paths are correct, especially the one in the bashEditor feature in the input geometry quarter of the software connector window.

The feature rewrites the .bashrc file of the OpenFoam bash starter, ensuring that when you start the OpenFoam terminal, it is located in the correct project directory from CAESES.

It also executes the Allrun.sh script and shows the output in CAESES task monitor. It might not be the most elegant solution, but it works.

If this is correct, CAESES will execute OpenFOAM without any problems.

 

2 - Run the computation "OpenFOAM" once, just to generate all files, even if the simulation fails.

2.1 - Navigate to the project folder manually inside the OpenFOAM environment (started by a bash command in the windows terminal or starting other alternatives, like: C:\OpenFOAM\18.06\cygwin64\bin\mintty.exe. To navigate to directory, type something like: "cd %UserProfile%/Documents/ahmedbody_windowsOF_CFDsupport/manual_results/baseline/OpenFOAM/", make sure it is where the project is located. To be sure you are in the right location, type "ls" and something similar to picture 2 attached should show up.

 

2.2 - Start executing OpenFOAM commands manually, the ones in the Allrun.sh script, for example. blockMesh.

If you receive a positive output, like picture 3 attached.

 

OpenFOAM is working well, and the problem is related to one of the functions in the Allrun.sh script.

 

2.3 - Manually execute a simulation and fix the errors as they come up in the OpenFOAM output.

If all works well, CAESES will read the results as well.

 

3 - If by any reason the OpenFOAM environment doesn't open anymore, try re-installing the OpenFOAM for windows package.

 

Known problems:

- The full functionality of VTK post -processing files is not confirmed, it might be necessary to install additional programs;

- Post processing features might not be entirely functional depeding on your CAESES version;

- If running an optimization engine be sure to only create 1 variant at a time (change the maximum number of pending designs from 0 to 1).

 

 

RECOMMENDATIONS

 

- CFD support has a very nice example case of the ahmedbody ready to be executed in OpenFOAM outside CAESES.

It contains a lot of options for different OpenFOAM solvers and is VERY worth taking a look at, for the ahmedy body or any other similar case.

You can easily adapt it in the CAESES software connector window.

 

- For debugging of convergence problems, results visualization and post-processing, Paraview is the fastest and best program.

But if you are running an optimization, you can easily set-up the post-processing plots and visualizations in CAESES (after you run at least one simulation outside the design optimization engine) and take screenshots of each design variant, as well as receive updates by e-mail and even on your phone.

 

 

Thats it, I hope you manage to run your cases in OpenFOAM for windows connected with CAESES!

Do not hesitate to post your problems and even project pictures in this topic.

 

Cheers,
Paulo Macedo

post-1038-0-02487000-1536687020_thumb.png

post-1038-0-20141100-1536687020_thumb.png

post-1038-0-32883600-1536687020_thumb.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...