Saturday, October 14, 2023

Getting Started with OpenFOAM

15 October 2023

I have spent almost over a week figuring out how to install and run OpenFoam. The getting started phase is now available in this post.

> Setup:  

   OpenFoam version 2306 

   Windows 11 with WSL (Windows Subsystem for Linux)

   ParaView 

> Installation Steps:

# Use Windows Power Shell in Admin Mode to install WSL

wsl --install

# Run wsl and Add the repository

curl https://dl.openfoam.com/add-debian-repo.sh | sudo bash

# Update the repository information

sudo apt-get update

# Install preferred package. Eg,

sudo apt-get install openfoam2306-default

# Install the ParaView 

sudo apt-get install paraview

> Configuration Steps:

# Modify /home/<user>/.bashrc by including the following line at the end

. /usr/lib/openfoam/openfoam2306/etc/bashrc

# Copy tutorials to $FOAM_RUN folder, you need to create the folder first 

/home/<user>/OpenFOAM/<user>-v2306/run

> First Simulation 

. Type wsl and enter in Search

. Change directory to $FOAM_RUN/tutorials/incompressible/icoFoam/cavity

. Execute the command to generate results: ./Allrun 


. Make sure the directory is correct as in the following figure. 
. Execute the openfoam2306 
. Execute the paraview & 


. Open the controlDict from ParaView 


. Select the OpenFOAM Reader from the list and then press OK button
. Press the Apply button from the left pane of the ParaView






No comments:

Post a Comment