{"id":18368935,"url":"https://github.com/cheginit/uhworkshop","last_synced_at":"2025-04-06T17:31:59.460Z","repository":{"id":74574755,"uuid":"118494909","full_name":"cheginit/UHWorkshop","owner":"cheginit","description":"Workshops on CFD at the University of Houston","archived":false,"fork":false,"pushed_at":"2019-03-18T12:02:35.000Z","size":240818,"stargazers_count":13,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-22T04:03:08.952Z","etag":null,"topics":["cfd","openfoam","workshop-materials"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheginit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-22T18:05:50.000Z","updated_at":"2025-02-28T09:49:53.000Z","dependencies_parsed_at":"2023-07-09T08:34:33.339Z","dependency_job_id":null,"html_url":"https://github.com/cheginit/UHWorkshop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheginit%2FUHWorkshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheginit%2FUHWorkshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheginit%2FUHWorkshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheginit%2FUHWorkshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheginit","download_url":"https://codeload.github.com/cheginit/UHWorkshop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247522438,"owners_count":20952552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cfd","openfoam","workshop-materials"],"created_at":"2024-11-05T23:27:54.704Z","updated_at":"2025-04-06T17:31:54.442Z","avatar_url":"https://github.com/cheginit.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CFD Code Development Frameworks (Workshop III)\nThis workshop provides an overview of available frameworks for developing CFD codes. The slides can be found [here](https://github.com/taataam/UHOFWorkshop/blob/master/workshop3/CFD.pdf). The topics are as follows:\n\n1. Introduction to CFD: A general introduction to underpinnings of CFD followed by a discussion on Artificial Compressibility Method (ACM) since it is easy to implement while is applicable to some interesting problems, particularly Lid-Driven Cavity.\n2. Development from scratch: A simple implementation of ACM with Finite Difference method from scratch using C and python. It provides a general overview of programming a solver from scratch.\n3. Development with OpenFOAM: A simple implementation of ACM with Finite Volume method using OpenFOAM framework. It demonstrates advantages of using an already established CFD framework.\n4. Development with Fenics A simple implementation of ACM with Finite Element method using Fenics framework. It demonstrates advantages of using an already established CFD framework.\n\nPlease note that all the codes are tested in Linux environemnt only. So it might not work on other OSs such macOS. If any problem is encountered please open up an issue and so someone hopefully can provide a fix.\n\nThe required python libraries can be installed as follows:\n\n**Option 1**. If you're using the Hyper-V in the training room, follow these steps:\n```bash\nsudo yum install centos-release-scl cmake\nsudo yum install rh-python36 rh-python36-python-tkinter.x86_64 texlive.x86_64 dvipng\nscl enable rh-python36 bash\nsudo -H $(which pip) install -U pip\nsudo -H $(which pip) install -U matplotlib numba numpy flake8\n```\n\n**Option 2**. Follow these step for other systems\n```bash\n# 1- Download Anaconda if you it's not already installed otherwise \n# go to step 6.\nwget \"https://repo.anaconda.com/archive/Anaconda3-5.3.0-Linux-x86_64.sh\"\n\n# 2- Install Anaconda. It is recommended not to add it to the PATH  \n# system permanently.\nbash Anaconda3-5.3.0-Linux-x86_64.sh\n\n# 3- Create an alias for loading Anaconda in bashrc file. You can replace \n# the path with the installation directory specified during installation.\necho 'alias ana3=\"source $HOME/anaconda3/etc/profile.d/conda.sh \u0026\u0026 export PATH=$HOME/anaconda3/bin:$PATH\"' \u003e\u003e ~/.bashrc\n\n# 4- Re-source bashrc to make the change.\nsource ~/.bashrc\n\n# 5- Load Anaconda.\nana3\n\n# 6- Create a new environment called \"cfd\" and install the libraries.\nconda create -n cfd --file workshop3/requirements.txt\n\n# 7- Load the newly created environment.\nsource activate cfd\n```\n\n## Instructions\nThe codes can be run as follows:\n\n1. C codes:\n```bash\n./run -r 1000 -c\n```\nwhere the flag ```-r``` is used to pass the Reynolds number (100, 1000, 5000 or 10000) and ```-c``` should be used if a different configuration for compilation is desired. Moreover, in order to change to the compiler the following commands maybe used:\n```bash\nCC=icc ./run -r 1000 -c\n```\nfor using intel compiler, or:\n```bash\nCC=clang ./run -r 1000 -c\n```\nfor using clang.\n\n2. Python codes:\n```bash\n./run -r 1000\n```\nwhere the flag ```-r``` is used to pass the Reynolds number (100, 1000, 5000 or 10000).\n\n## Manual Compilation\n\nThe C codes can be manually compiled as follows:\n```bash\ncd C_original\nmkdir bin build data\ngcc -march=native -O3 -fopenmp src/lidCavity.c -o bin/lidCavity -lm\n```\nor if using intel compiler:\n```bash\nicc -xHost -O3 -qopenmp src/lidCavity.c -o bin/lidCavity -lm\n```\nand may be run, for example for Re = 1000, by invoking:\n```bash\nbin/lidCavity 1000\npython3 ../plotter/plotter.py 1000 2\n```\n\n\u003cimg src=\"https://github.com/taataam/UHOFWorkshop/blob/master/workshop3/OpenFOAM/cavity/plots/results.png\" width=\"700\"\u003e\n\n___\n\n# OpenFOAM Workshops (I and II):\nWorkshop I and II are introductory workshops to OpenFOAM. The slides are [UHOF I](https://github.com/taataam/UHOFWorkshop/blob/master/workshop1/UHOF.pdf) and [UHOF II](https://github.com/taataam/UHOFWorkshop/blob/master/workshop2/UHOF.pdf). The workshops are project-based and includes the basic concepts of utilizing OpenFOAM's framework. Four cases that are considered for these workshops are as follows; **1D Sod problem** which includes validation with analytical solution, **2D Lid driven cavity** which includes validation with results from the literature, **3D Dam break with obstacle** which includes validation with results from the literature and **V2D ortex Shedding** for demonstrating more advanced meshing and working with paraview python module.\n\n\u003cimg src=\"https://github.com/taataam/UHOFWorkshop/blob/master/workshop1/shockTube/plots/initialCondition.png\" width=\"300\"\u003e \u003cimg src=\"https://github.com/taataam/UHOFWorkshop/blob/master/workshop1/lidDrivenCavity/plots/cavity.png\" width=\"300\"\u003e\n\n\u003cimg src=\"https://github.com/taataam/UHOFWorkshop/blob/master/workshop1/damBreakWithObstacle/plots/dbconfig.png\" width=\"300\"\u003e \u003cimg src=\"https://github.com/taataam/UHOFWorkshop/blob/master/workshop2/vortexShedding/plots/frames/250.png\" width=\"300\"\u003e\n\nNote that for calculating initial values of turbulence paramaters, [CFD-online Turbulence Calculator](https://www.cfd-online.com/Tools/turbulence.php) can be used.\n\nMoreover, there are two ways of working with Praview's python module:\n1. (recommended) Use python libraries in the Paraview's intallation folder. A good way to use this method is to write a bash script for calling the python script and include these two lines:\n```bash\n...\nexport PYTHONPATH=\"$PYTHONPATH:$WM_THIRD_PARTY_DIR/platforms/linux64Gcc/ParaView-5.5.2/lib:$WM_THIRD_PARTY_DIR/platforms/linux64Gcc/ParaView-5.5.2/lib/python2.7/site-packages\"\nexport LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:$WM_THIRD_PARTY_DIR/platforms/linux64Gcc/ParaView-5.5.2/lib\"\n...\npython path/to/python/script\n```\nNote that, Paraview version (5.5.2) should be adjusted according to the installed version.\n\n2. Install a stand-alone paraview module from [conda-forge channel](https://anaconda.org/conda-forge/paraview). Keep in mind that you should always use the *builtin* flag of paraFoam when generating a python script (using the trace option) i.e, use ```paraFoam -builtin``` to run paraview. The module can be install as follows:\n\n```bash\n# 1- Download Anaconda if you it's not already installed otherwise \n# go to step 6.\nwget \"https://repo.anaconda.com/archive/Anaconda2-5.3.0-Linux-x86_64.sh\"\n\n# 2- Install Anaconda. It is recommended not to add it to the PATH  \n# system permanently.\nbash Anaconda2-5.3.0-Linux-x86_64.sh\n\n# 3- Create an alias for loading Anaconda in bashrc file. You can replace \n# the path with the installation directory specified during installation.\necho 'alias ana2=\"source $HOME/anaconda2/etc/profile.d/conda.sh \u0026\u0026 export PATH=$HOME/anaconda2/bin:$PATH\"' \u003e\u003e ~/.bashrc\n\n# 4- Re-source bashrc to make the change.\nsource ~/.bashrc\n\n# 5- Load Anaconda.\nana2\n\n# 6- Create a new environment called \"pypv\" using conda-forge channel and install the same version as the one installed with OpenFOAM.\nconda create -n pypv -c conda-forge paraview=5.5.2\n\n# 7- Load the newly created environment.\nsource activate pypv\n\n# 8- Test the installation. If the installation was successful, the \n# folowing command should not have any output.\npython -c \"from paraview.simple import *\"\n\n# 9- Deactivate the environment.\nsource deactivate\n```\nMake sure to use the same version as the installed Paraview.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheginit%2Fuhworkshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheginit%2Fuhworkshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheginit%2Fuhworkshop/lists"}