diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..55264923b0 --- /dev/null +++ b/.clang-format @@ -0,0 +1,14 @@ +BasedOnStyle: WebKit +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterFunction: true + AfterNamespace: true + SplitEmptyFunction: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeInheritanceComma: true +BreakConstructorInitializers: AfterColon +MaxEmptyLinesToKeep: 2 +SortIncludes: false +SpaceBeforeCtorInitializerColon: false diff --git a/.compileOF1812.sh b/.compileOF1812.sh index 5a1eb7ee8e..aa8ab16de2 100755 --- a/.compileOF1812.sh +++ b/.compileOF1812.sh @@ -1,5 +1,5 @@ docker pull ithacafv/openfoam1812-muq2-pytorch docker run -ti -d --name foam1812 -v "${PWD}":/home/ofuser/app:rw ithacafv/openfoam1812-muq2-pytorch /bin/bash docker exec foam1812 /bin/bash -c "cd /home/ofuser/app; ls" -docker exec foam1812 /bin/bash -c "export MUQ_LIBRARIES=/home/Installations/MUQ_INSTALL; export MUQ_EXT_LIBRARIES=/home/Installations/MUQ_INSTALL/muq_external; export TORCH_LIBRARIES=/pytorch/torch; cd /home/ofuser/app; source /root/OpenFOAM/OpenFOAM-v1812/etc/bashrc; source etc/bashrc; ./Allwmake -taumq" +docker exec foam1812 /bin/bash -c "export MUQ_LIBRARIES=/home/Installations/MUQ_INSTALL; export MUQ_EXT_LIBRARIES=/home/Installations/MUQ_INSTALL/muq_external; export TORCH_LIBRARIES=/pytorch/torch; cd /home/ofuser/app; source /root/OpenFOAM/OpenFOAM-v1812/etc/bashrc; source etc/bashrc; git submodule update --init; ./Allwmake -taumq" diff --git a/.compileOF1906.sh b/.compileOF1906.sh index 2eb6a9b4f3..1095940290 100755 --- a/.compileOF1906.sh +++ b/.compileOF1906.sh @@ -1,5 +1,5 @@ docker pull ithacafv/openfoam1906-muq2-pytorch docker run -ti -d --name foam1906 -v "${PWD}":/home/ofuser/app:rw ithacafv/openfoam1906-muq2-pytorch /bin/bash docker exec foam1906 /bin/bash -c "cd /home/ofuser/app; ls" -docker exec foam1906 /bin/bash -c "export MUQ_LIBRARIES=/home/Installations/MUQ_INSTALL; export MUQ_EXT_LIBRARIES=/home/Installations/MUQ_INSTALL/muq_external; export TORCH_LIBRARIES=/pytorch/torch; cd /home/ofuser/app; source /root/OpenFOAM/OpenFOAM-v1906/etc/bashrc; source etc/bashrc; ./Allwmake -taumq" +docker exec foam1906 /bin/bash -c "export MUQ_LIBRARIES=/home/Installations/MUQ_INSTALL; export MUQ_EXT_LIBRARIES=/home/Installations/MUQ_INSTALL/muq_external; export TORCH_LIBRARIES=/pytorch/torch; cd /home/ofuser/app; source /root/OpenFOAM/OpenFOAM-v1906/etc/bashrc; source etc/bashrc; git submodule update --init; ./Allwmake -taumq" diff --git a/.compileOF1912.sh b/.compileOF1912.sh index aa8305013e..64aec18bf7 100755 --- a/.compileOF1912.sh +++ b/.compileOF1912.sh @@ -1,5 +1,5 @@ docker pull ithacafv/openfoam1912-muq2-pytorch docker run -ti -d --name foam1912 -v "${PWD}":/home/ofuser/app:rw ithacafv/openfoam1912-muq2-pytorch /bin/bash docker exec foam1912 /bin/bash -c "cd /home/ofuser/app; ls" -docker exec foam1912 /bin/bash -c "export MUQ_LIBRARIES=/home/Installations/MUQ_INSTALL; export MUQ_EXT_LIBRARIES=/home/Installations/MUQ_INSTALL/muq_external; export TORCH_LIBRARIES=/pytorch/torch; cd /home/ofuser/app; source /usr/lib/openfoam/openfoam1912/etc/bashrc; source etc/bashrc; ./Allwmake -taumq" +docker exec foam1912 /bin/bash -c "export MUQ_LIBRARIES=/home/Installations/MUQ_INSTALL; export MUQ_EXT_LIBRARIES=/home/Installations/MUQ_INSTALL/muq_external; export TORCH_LIBRARIES=/pytorch/torch; cd /home/ofuser/app; source /usr/lib/openfoam/openfoam1912/etc/bashrc; source etc/bashrc; git submodule update --init; ./Allwmake -taumq" diff --git a/.compileOF2006.sh b/.compileOF2006.sh index 47d1c36c0e..203d4b6714 100755 --- a/.compileOF2006.sh +++ b/.compileOF2006.sh @@ -1,4 +1,4 @@ docker pull ithacafv/openfoam2006-muq2-pytorch docker run -ti -d --name foam2006 -v "${PWD}":/home/ofuser/app:rw ithacafv/openfoam2006-muq2-pytorch /bin/bash docker exec foam2006 /bin/bash -c "cd /home/ofuser/app; ls" -docker exec foam2006 /bin/bash -c "export MUQ_LIBRARIES=/home/Installations/MUQ_INSTALL; export MUQ_EXT_LIBRARIES=/home/Installations/MUQ_INSTALL/muq_external; export TORCH_LIBRARIES=/pytorch/torch; cd /home/ofuser/app; source /usr/lib/openfoam/openfoam2006/etc/bashrc; source etc/bashrc; ./Allwmake -taumq" +docker exec foam2006 /bin/bash -c "export MUQ_LIBRARIES=/home/Installations/MUQ_INSTALL; export MUQ_EXT_LIBRARIES=/home/Installations/MUQ_INSTALL/muq_external; export TORCH_LIBRARIES=/pytorch/torch; cd /home/ofuser/app; source /usr/lib/openfoam/openfoam2006/etc/bashrc; source etc/bashrc; git submodule update --init; ./Allwmake -taumq" diff --git a/.compileOF2012.sh b/.compileOF2012.sh index 9b2695189b..493b4ac0e2 100755 --- a/.compileOF2012.sh +++ b/.compileOF2012.sh @@ -2,4 +2,4 @@ docker pull ithacafv/openfoam2012-muq2-pytorch docker run -ti -d --name foam2012 -v "${PWD}":/home/ofuser/app:rw ithacafv/openfoam2012-muq2-pytorch /bin/bash docker exec foam2012 /bin/bash -c "cd /home/ofuser/app; ls" -docker exec foam2012 /bin/bash -c "export MUQ_LIBRARIES=/home/Installations/MUQ_INSTALL; export MUQ_EXT_LIBRARIES=/home/Installations/MUQ_INSTALL/muq_external; export TORCH_LIBRARIES=/pytorch/torch; cd /home/ofuser/app; source /usr/lib/openfoam/openfoam2012/etc/bashrc; source etc/bashrc; ./Allwmake -taumq" +docker exec foam2012 /bin/bash -c "export MUQ_LIBRARIES=/home/Installations/MUQ_INSTALL; export MUQ_EXT_LIBRARIES=/home/Installations/MUQ_INSTALL/muq_external; export TORCH_LIBRARIES=/pytorch/torch; cd /home/ofuser/app; source /usr/lib/openfoam/openfoam2012/etc/bashrc; source etc/bashrc; git submodule update --init; ./Allwmake -taumq" diff --git a/.compileOF2106.sh b/.compileOF2106.sh index 1e6cd674d3..9e5866c124 100755 --- a/.compileOF2106.sh +++ b/.compileOF2106.sh @@ -1,4 +1,4 @@ #!/bin/bash docker pull ithacafv/openfoam2106-muq2-pytorch docker run -ti -d --name foam2106 -v "${PWD}":/home/ofuser/app:rw ithacafv/openfoam2106-muq2-pytorch /bin/bash -docker exec foam2106 /bin/bash -c "source /usr/lib/openfoam/openfoam2106/etc/bashrc; cd /home/ofuser/app; source etc/bashrc; ./Allwmake -taumq" +docker exec foam2106 /bin/bash -c "source /usr/lib/openfoam/openfoam2106/etc/bashrc; cd /home/ofuser/app; source etc/bashrc; git submodule update --init; ./Allwmake -taumq" diff --git a/.github/Singularity/Singularity_from_def.yml b/.github/Singularity/Singularity_from_def.yml new file mode 100644 index 0000000000..7f6fb14984 --- /dev/null +++ b/.github/Singularity/Singularity_from_def.yml @@ -0,0 +1,36 @@ +name: Singularity_from_Definition_file + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + singularity-from-defination-file: + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v2 + + - uses: eWaterCycle/setup-singularity@v7 + with: + singularity-version: 3.8.3 + + - name: Singularity build in detached mode + run: singularity build --fakeroot -d singularity_image_def.sif `pwd`/singularity/singularity-reciepe.def + + - name: copying necessary files + run: | + mv singularity_image_def.sif `pwd`/tutorials/CFD/01POD/ + mv `pwd`/singularity/Of.sh `pwd`/tutorials/CFD/01POD/ + + - name: Run singulairty in batch mode + run: | + cd `pwd`/tutorials/CFD/01POD/ + singularity exec singularity_image_def.sif /bin/bash Of.sh + + + + diff --git a/.github/Singularity/Singularity_from_docker.yml b/.github/Singularity/Singularity_from_docker.yml new file mode 100644 index 0000000000..324ba4ec03 --- /dev/null +++ b/.github/Singularity/Singularity_from_docker.yml @@ -0,0 +1,36 @@ +name: Singularity_from_Docker_Image + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + singularity-from-docker-image: + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v2 + + - uses: eWaterCycle/setup-singularity@v7 + with: + singularity-version: 3.8.3 + + - name: Singularity build + run: singularity build singularity_image.sif docker://ithacafv/ithacafv:manifest-amd64 + + - name: copying necessary files + run: | + mv singularity_image.sif `pwd`/tutorials/CFD/01POD/ + mv `pwd`/singularity/Of.sh `pwd`/tutorials/CFD/01POD/ + + - name: Singulairty in batch mode + run: | + cd `pwd`/tutorials/CFD/01POD/ + singularity exec singularity_image.sif /bin/bash Of.sh + + + + diff --git a/.github/workflows/docker_ithaca.yml b/.github/workflows/docker_ithaca.yml index 538f5d6635..c6a71da4fc 100755 --- a/.github/workflows/docker_ithaca.yml +++ b/.github/workflows/docker_ithaca.yml @@ -2,7 +2,9 @@ name: Docker on: push: - branches: [ master ] + # Pattern matched against refs/tags + tags: + - '*' # Push events to every tag not containing / jobs: docker-arm64: @@ -61,29 +63,29 @@ jobs: - build-manifest: - needs: [docker-amd64, docker-arm64] + #build-manifest: + #needs: [docker-amd64, docker-arm64] - runs-on: ubuntu-latest - steps: + #runs-on: ubuntu-latest + #steps: - - name: Checkout - uses: actions/checkout@v2 + #- name: Checkout + #uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + #- name: Set up QEMU + #uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + #- name: Set up Docker Buildx + #uses: docker/setup-buildx-action@v1 - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + #- name: Login to DockerHub + #uses: docker/login-action@v1 + #with: + #username: ${{ secrets.DOCKER_USERNAME }} + #password: ${{ secrets.DOCKER_PASSWORD }} - - name: manifest creation - run: docker manifest create ithacafv/ithacafv:manifest-latest --amend ithacafv/ithacafv:manifest-amd64 --amend ithacafv/ithacafv:manifest-arm64 + #- name: manifest creation + #run: docker manifest create ithacafv/ithacafv:manifest-latest --amend ithacafv/ithacafv:manifest-amd64 --amend ithacafv/ithacafv:manifest-arm64 - - name: push manifest - run: docker manifest push ithacafv/ithacafv:manifest-latest + #- name: push manifest + #run: docker manifest push ithacafv/ithacafv:manifest-latest diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 0000000000..a2bd3bab54 --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,52 @@ +name: 'Upstream Sync' + +on: + schedule: + - cron: '*/60 * * * *' # every 30 minutes + + workflow_dispatch: # click the button on Github repo! + +jobs: + sync_latest_from_upstream: + runs-on: ubuntu-latest + name: Sync latest commits from upstream repo + + steps: + # REQUIRED step + # Step 1: run a standard checkout action, provided by github + - name: Checkout target repo + uses: actions/checkout@v2 + with: + # optional: set the branch to checkout, + # sync action checks out your 'target_sync_branch' anyway + ref: master + # REQUIRED if your upstream repo is private (see wiki) + persist-credentials: false + + # REQUIRED step + # Step 2: run the sync action + - name: Sync upstream changes + id: sync + uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 + with: + target_sync_branch: master + # REQUIRED 'target_repo_token' exactly like this! + target_repo_token: ${{ secrets.GITHUB_TOKEN }} + upstream_sync_branch: master + upstream_sync_repo: aormsby/Fork-Sync-With-Upstream-action + upstream_repo_access_token: ${{ secrets.UPSTREAM_REPO_SECRET }} + + # Set test_mode true to run tests instead of the true action!! + test_mode: true + + # Step 3: Display a sample message based on the sync output var 'has_new_commits' + - name: New commits found + if: steps.sync.outputs.has_new_commits == 'true' + run: echo "New commits were found to sync." + + - name: No new commits + if: steps.sync.outputs.has_new_commits == 'false' + run: echo "There were no new commits." + + - name: Show value of 'has_new_commits' + run: echo ${{ steps.sync.outputs.has_new_commits }} \ No newline at end of file diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml deleted file mode 100755 index 3b25bcf7d9..0000000000 --- a/.github/workflows/unit_test.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Unit Testing - -on: - push: - branches: [ master ] - -jobs: - gtest: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Running docker container with openfoam - run : docker run -v "$PWD/:/root" opencfd/openfoam2106-dev /root/gtest/script.sh diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..c8272cfbfe --- /dev/null +++ b/.gitmodules @@ -0,0 +1,7 @@ +[submodule "extern/pybind11"] + path = extern/pybind11 + url = ../../pybind/pybind11 + branch = stable +[submodule "src/thirdparty/Eigen"] + path = src/thirdparty/Eigen + url = https://gitlab.com/libeigen/eigen.git diff --git a/README.md b/README.md index 2ca1686e21..6b68d89519 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- + ITHACA-FV

@@ -10,19 +10,19 @@ Software License - + Codacy Badge

-OF1812 -OF1906 -OF1912 -OF2006 +OF1812 +OF1906 +OF1912 +OF2006

### 0. Introduction -**ITHACA-FV** is an implementation in **OpenFOAM** of several reduced order modelling techniques. **ITHACA-FV** is designed for [**OpenFOAM v2106**](https://www.openfoam.com/releases/openfoam-v2106/) and older openfoam.com versions but it can be easily adapted also to other versions of OpenFOAM. +**ITHACA-FV** is an implementation in **OpenFOAM** of several reduced order modelling techniques. **ITHACA-FV** is designed for [**OpenFOAM v2212**](https://www.openfoam.com/news/main-news/openfoam-v2212/) and older openfoam.com versions but it can be easily adapted also to other versions of OpenFOAM. **ITHACA-FV** can also be used as a basis for more advanced projects that would like to assess the capability of reduced order models in their existing **OpenFOAM**-based software, thanks to the availability of several reduced order methods and algorithms. @@ -32,12 +32,13 @@ Linear and non-linear algebra operations which are not already implemented in Op ### 1. Prerequisites **ITHACA-FV** requires -* [**OpenFOAM 1812**](https://www.openfoam.com/releases/openfoam-v1812/) or -* [**OpenFOAM 1906**](https://www.openfoam.com/releases/openfoam-v1906/) or -* [**OpenFOAM 1912**](https://www.openfoam.com/releases/openfoam-v1912/) or -* [**OpenFOAM 2006**](https://www.openfoam.com/releases/openfoam-v2006/) or -* [**OpenFOAM 2012**](https://www.openfoam.com/releases/openfoam-v2012/) or -* [**OpenFOAM 2106**](https://www.openfoam.com/news/main-news/openfoam-v2106) +* [**OpenFOAM 1812**](https://www.openfoam.com/news/main-news/openfoam-v1812/) or +* [**OpenFOAM 1906**](https://www.openfoam.com/news/main-news/openfoam-v1906/) or +* [**OpenFOAM 1912**](https://www.openfoam.com/news/main-news/openfoam-v1912/) or +* [**OpenFOAM 2006**](https://www.openfoam.com/news/main-news/openfoam-v2006/) or +* [**OpenFOAM 2012**](https://www.openfoam.com/news/main-news/openfoam-v2012/) or +* [**OpenFOAM 2106**](https://www.openfoam.com/news/main-news/openfoam-v2106) or +* [**OpenFOAM 2212**](https://www.openfoam.com/news/main-news/openfoam-v2212) ### 2. Installation and usage @@ -51,11 +52,12 @@ cd ~ ``` Now you can clone the **ITHACA-FV** repository inside the selected folder ``` -git clone https://github.com/mathLab/ITHACA-FV +git clone --depth 1 https://github.com/ITHACA-FV/ITHACA-FV ``` and you can compile **ITHACA-FV** by navigating inside the src folder, sourcing the bashrc file of ITHACA-FV and compiling using wmake: ``` cd ITHACA-FV +git submodule update --init source etc/bashrc ./Allwmake ``` @@ -81,7 +83,7 @@ In the near future the ITHACA-FV will also be linked with the pytorch package fo unzip libtorch.zip -d opt/ && \ ``` -For a brief description of the classes and methods, you can check the official ITHACA-FV doxygen [documentation](https://mathlab.github.io/ITHACA-FV/). +For a brief description of the classes and methods, you can check the official ITHACA-FV doxygen [documentation](https://ithaca-fv.github.io/ITHACA-FV). ### 3. Docker Image @@ -100,26 +102,86 @@ Once the image is downloaded, you can start the container and mount the $HOME di docker run -ti --rm -v "${HOME}:/home/ithacafv/${USER}" ithacafv/ithacafv:manifest-latest ``` -### 4. [Tutorials](https://mathlab.github.io/ITHACA-FV//examples.html) +### 4. Singularity + + +Create a local directory (which you own), followed by using the variables, `SINGULARITY_TMPDIR` and `SINGULARITY_CACHEDIR` for temporary and cache directory during built proccess. This step is highly recommended if you do NOT have `root` access, as singularity uses a temporary directory to build the squashfs filesystem, and this temp space needs to be large enough to hold the entire resulting Singularity image. + +``` +export SINGULARITY_TMPDIR=$HOME/mycontainter +``` +and + +``` +export SINGULARITY_CACHEDIR=$HOME/mycontainter +``` + +Buidling singularity image file `.sif` from the docker image, which is build and stored in `$HOME/mycontainter`, The below image used is based **OpenFOAM-v2106**, and where you can find a compiled version of the master branch of **ITHACA-FV**. + +``` +singularity build ithacafv.sif docker://ithacafv/ithacafv:manifest-latest +``` + +To view / list all the images/cache, + +``` +singularity cache list -v +``` + +To run the singulairty image interactively, use `shell` from your working directory. This mounts your working directory to the container. Activate the the OpenFOAM environment after`shell`, using `source /usr/lib/openfoam/openfoam2106/etc/bashrc` (or, `source /etc/bash.bashrc`) + +``` +singularity shell $HOME/mycontainter/ithacafv.sif +``` + +To build singularity images from scratch use defination files, `singularity-reciepe.def` provided in singularity directory. This require `sudo` prilvildges. Recommened to build in detached mode, by passing the flag `-d`. + +``` +sudo singularity build -d ithacafv.sif singularity/singularity-reciepe.def +``` + +Additionally, `--fakeroot` can be passed if you do NOT have root access for the build. + +``` +singularity build --fakeroot ithacafv.sif singularity/singularity-reciepe.def +``` + +Running singualrity in batch mode, you can add the following in your the batch script, + +``` +singularity exec .sif +``` + +For example, running the any tutorial, add the following in the batch script, + +``` +singularity exec ithacafv.sif /bin/bash -c Of.sh +``` + +the shell script `Of.sh` is provided within the singularity directory. A sample batch scipt is also proived. Please note, over slurm machine, mpi binds without passing any flags. + + + +### 5. [Tutorials](https://ithaca-fv.github.io/ITHACA-FV//examples.html) Several tutorials are provided in the [**tutorials** subfolder](./tutorials). -* [**CFD/Tutorial 1**](https://github.com/mathLab/ITHACA-FV/tree/master/tutorials/CFD/01POD): In this tutorial it is shown how to perform POD on an already run standard **OpenFOAM** case. -* [**CFD/Tutorial 2**](https://github.com/mathLab/ITHACA-FV/tree/master/tutorials/CFD/02thermalBlock): In this tutorial the development of a parametrized POD-Galerkin ROM for a steady heat transfer problem is implemented. The parametrization is on the diffusivity constant. The OpenFOAM full order problem is based on **laplacianFoam**. -* [**CFD/Tutorial 3**](https://github.com/mathLab/ITHACA-FV/tree/master/tutorials/CFD/03steadyNS): In this tutorial, the development of a parametrized POD-Galerkin ROM for a steady NS-problem. The parametrization is on the viscosity is implemented. The OpenFOAM full order problem is based on **simpleFoam**. -* [**CFD/Tutorial 4**](https://mathlab.github.io/ITHACA-FV/04unsteadyNS_8C-example.html): In this tutorial, the development of a parametrized POD-Galerkin method for an unsteady Navier-Stokes problem is implemented. The parametrization is on the viscosity. The OpenFOAM full order problem is based on **pimpleFoam**. +* [**CFD/Tutorial 1**](https://github.com/ithaca-fv/ITHACA-FV/tree/master/tutorials/CFD/01POD): In this tutorial it is shown how to perform POD on an already run standard **OpenFOAM** case. +* [**CFD/Tutorial 2**](https://github.com/ithaca-fv/ITHACA-FV/tree/master/tutorials/CFD/02thermalBlock): In this tutorial the development of a parametrized POD-Galerkin ROM for a steady heat transfer problem is implemented. The parametrization is on the diffusivity constant. The OpenFOAM full order problem is based on **laplacianFoam**. +* [**CFD/Tutorial 3**](https://github.com/ithaca-fv/ITHACA-FV/tree/master/tutorials/CFD/03steadyNS): In this tutorial, the development of a parametrized POD-Galerkin ROM for a steady NS-problem. The parametrization is on the viscosity is implemented. The OpenFOAM full order problem is based on **simpleFoam**. +* [**CFD/Tutorial 4**](https://ithaca-fv.github.io/ITHACA-FV/04unsteadyNS_8C-example.html): In this tutorial, the development of a parametrized POD-Galerkin method for an unsteady Navier-Stokes problem is implemented. The parametrization is on the viscosity. The OpenFOAM full order problem is based on **pimpleFoam**. -* [**CFD/Tutorial 6**](https://mathlab.github.io/ITHACA-FV/06POD_RBF_8C-example.html): This tutorial presents the application of data driven POD-Galerkin model to RANS equation in steady state setting. The components of the velocity at the inlet are paramertized. The OpenFOAM full order problem is based on **simpleFoam**. +* [**CFD/Tutorial 6**](https://ithaca-fv.github.io/ITHACA-FV/06POD_RBF_8C-example.html): This tutorial presents the application of data driven POD-Galerkin model to RANS equation in steady state setting. The components of the velocity at the inlet are paramertized. The OpenFOAM full order problem is based on **simpleFoam**. -* [**CFD/Tutorial 8**](https://mathlab.github.io/ITHACA-FV/08DEIM_8C-example.html): In this tutorial we propose an example concerning the usage of the Discrete Empirical Interpolation Methods for the reconstruction of a non-linear function. In this case we do not perform model reduction but we test just the motodology a non-linear function. +* [**CFD/Tutorial 8**](https://ithaca-fv.github.io/ITHACA-FV/08DEIM_8C-example.html): In this tutorial we propose an example concerning the usage of the Discrete Empirical Interpolation Methods for the reconstruction of a non-linear function. In this case we do not perform model reduction but we test just the motodology a non-linear function. -* [**CFD/Tutorial 9**](https://mathlab.github.io/ITHACA-FV/09DEIM_ROM_8C-example.html): In this tutorial we propose an example concerning the usage of the Discrete Empirical Interpolation Methods for model reduction purposes. The non-linearity is in the forcing term of a heat transfer problem. The OpenFOAM full order problem is based on **laplacianFoam**. +* [**CFD/Tutorial 9**](https://ithaca-fv.github.io/ITHACA-FV/09DEIM_ROM_8C-example.html): In this tutorial we propose an example concerning the usage of the Discrete Empirical Interpolation Methods for model reduction purposes. The non-linearity is in the forcing term of a heat transfer problem. The OpenFOAM full order problem is based on **laplacianFoam**. -### 5. Authors and contributors -**ITHACA-FV** is currently developed and mantained at [SISSA mathLab](http://mathlab.sissa.it/) by [Dr. Giovanni Stabile](mailto:gstabile@sissa.it) under the supervision of [Prof. Gianluigi Rozza](mailto:gianluigi.rozza@sissa.it) +### 6. Authors and contributors +**ITHACA-FV** is currently developed and maintained at the [University of Urbino Carlo Bo](https://www.uniurb.it/) by [Dr. Giovanni Stabile](www.giovannistabile.com) and at [SISSA mathLab](http://mathlab.sissa.it/) in collaboration with [Prof. Gianluigi Rozza](https://people.sissa.it/~grozza/)'s group. -Contact us by email for further information or questions about **ITHACA-FV**, or open an ''Issue'' on this website. **ITHACA-FV** is at an early development stage, so contributions improving either the code or the documentation are welcome, both as patches or merge requests on this website. If you are willing to contribute please follow the [developer instructions](https://github.com/mathLab/ITHACA-FV/tree/master/src). +Contact us by email for further information or questions about **ITHACA-FV**, or open an ''Issue'' on this website. **ITHACA-FV** is at an early development stage, so contributions improving either the code or the documentation are welcome, both as patches or merge requests on this website. If you are willing to contribute please follow the [developer instructions](https://github.com/ithaca-fv/ITHACA-FV/tree/master/src). -### 6. How to cite +### 7. How to cite Most of the theoretical aspects behind **ITHACA-FV** are deeply explained in [ Stabile2017CAIM ](https://arxiv.org/pdf/1701.03424.pdf) and [ Stabile2017CAF ](https://arxiv.org/pdf/1710.11580.pdf). For this reason, if you use this software, please consider citing the mentioned works, reported in the following bibtex entries: ``` @@ -143,9 +205,14 @@ Year = {2018}, Doi = {10.1016/j.compfluid.2018.01.035}} ``` +and cite the [ITHACA-FV website](https://ithaca-fv.github.io/ITHACA-FV). + +### 8. Funding +A significant part of ITHACA-FV has been written either as a by-product for other projects people were funded for, or by people on university-funded positions. There are probably many of such projects that have led to some development of ITHACA-FV. We are very grateful for this support! -and cite the [ITHACA-FV website](http://mathlab.sissa.it/ITHACA-FV). +Beyond this, ITHACA-FV has also been supported by some dedicated projects that have allowed us to work on extensions, documentation, training and dissemination that would otherwise not have been possible. In particular, we acknowledge the following sources of support with great gratitude: +* [H2020 ERC CoG 2015 AROMA-CFD project 681447](https://people.sissa.it/~grozza/aroma-cfd/), P.I. Professor [Gianluigi Rozza](https://people.sissa.it/~grozza) at [SISSA mathLab](https://mathlab.sissa.it/). -### 7. License +### 8. License **ITHACA-FV** is freely available under the GNU LGPL, version 3. diff --git a/dockerfiles/amd64/Dockerfile b/dockerfiles/amd64/Dockerfile index 27b20d68f7..a4e21aa0ee 100644 --- a/dockerfiles/amd64/Dockerfile +++ b/dockerfiles/amd64/Dockerfile @@ -2,8 +2,10 @@ FROM opencfd/openfoam2106-dev LABEL maintainer="moaadkhamlich@gmail.com" -# add and enable the default user +# add enviromental variables and enable the default user ARG USER=ithacafv +ARG of_var="source /usr/lib/openfoam/openfoam2106/etc/bashrc" +ARG ithaca_var="source /usr/lib/ITHACA-FV/etc/bashrc" ENV USER $USER # Create the user @@ -36,11 +38,23 @@ RUN chown -R $USER:$USER openfoam ITHACA-FV RUN chown -R $USER:$USER /home/$USER USER $USER -RUN /bin/bash -c "source openfoam/openfoam2106/etc/bashrc && \ - cd ITHACA-FV && source etc/bashrc && \ - ./Allwmake -au -j 4"; +RUN /bin/bash -c "source /usr/lib/openfoam/openfoam2106/etc/bashrc && \ + cd ITHACA-FV && git submodule update --init && source /etc/bash.bashrc && \ + ./Allwmake -tau -j 4"; + +USER root +RUN cp -r /home/ithacafv/OpenFOAM/ithacafv-v2106/platforms/linux64GccDPInt32Opt/bin/* /bin/ +RUN cp -r /home/ithacafv/OpenFOAM/ithacafv-v2106/platforms/linux64GccDPInt32Opt/lib/* /lib/ + +#Update bashrc +RUN echo $of_var >> /etc/bash.bashrc +RUN echo $ithaca_var >> /etc/bash.bashrc + +#Source bashrc +USER $USER +RUN /bin/bash -c "source /etc/bash.bashrc" USER $USER WORKDIR $HOME -COPY .bashrc $HOME/.bashrc ENTRYPOINT ["/bin/bash"] + diff --git a/dockerfiles/arm64/Dockerfile b/dockerfiles/arm64/Dockerfile index 8023a33d56..b7a91bcde2 100644 --- a/dockerfiles/arm64/Dockerfile +++ b/dockerfiles/arm64/Dockerfile @@ -21,15 +21,22 @@ WORKDIR /opt/ RUN git clone https://github.com/mathLab/ITHACA-FV.git RUN chown -R $USER:$USER OpenFOAM-v2106 OpenFOAM-v2106 ITHACA-FV RUN chown -R $USER:$USER /home/$USER +ARG of_var="source /opt/OpenFOAM-v2106/etc/bashrc" +ARG ithaca_var="source /opt/ITHACA-FV/etc/bashrc" +#Update bashrc +RUN echo $of_var >> /etc/bash.bashrc +RUN echo $ithaca_var >> /etc/bash.bashrc USER $USER ENV HOME /home/$USER ENV USER $USER RUN /bin/bash -c "source OpenFOAM-v2106/etc/bashrc && \ - cd ITHACA-FV && source etc/bashrc && \ + cd ITHACA-FV && git submodule update --init && source etc/bashrc && \ ./Allwmake -au -j 4"; +#Source bashrc +RUN /bin/bash -c "source /etc/bash.bashrc" + WORKDIR $HOME -COPY .bashrc $HOME/.bashrc ENTRYPOINT ["/bin/bash"] diff --git a/docs/Doxyfile b/docs/Doxyfile index 046e32c3bd..192c8f8620 100755 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -38,13 +38,13 @@ PROJECT_NAME = "ITHACA-FV" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "3.0" +PROJECT_NUMBER = "2023.1" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "SISSA mathLab" +PROJECT_BRIEF = "" # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/etc/bashrc b/etc/bashrc index 23ae559232..35e9fc33a8 100755 --- a/etc/bashrc +++ b/etc/bashrc @@ -17,6 +17,8 @@ export LIB_ITHACA="$ithacaDir" export LIB_ITHACA_SRC="$ithacaDir/src" export PYTHONPATH="$PYTHONPATH:${PYTHONPATH:+:}${LIB_ITHACA_SRC}"/python export PATH="$PATH:${LIB_ITHACA}"/bin +export includepybind1=$(python3 -m pybind11 --includes | awk -F '-I' '{print $2}') +export includepybind2=$(python3 -m pybind11 --includes | awk -F '-I' '{print $3}') alias ithaca='cd ${LIB_ITHACA:?}' unset ithacaDir diff --git a/extern/pybind11 b/extern/pybind11 new file mode 160000 index 0000000000..e315e1fe2b --- /dev/null +++ b/extern/pybind11 @@ -0,0 +1 @@ +Subproject commit e315e1fe2bad553ff541ce3bc00804e0e70583a2 diff --git a/singularity/Of.sh b/singularity/Of.sh new file mode 100755 index 0000000000..9211ab5ab6 --- /dev/null +++ b/singularity/Of.sh @@ -0,0 +1,9 @@ +##sourcing the correct bashrc is important +##bashrc for OpenFOAM +source /usr/lib/openfoam/openfoam2106/etc/bashrc +## bashrc for OpenFOAM and Ithaca-FV +##source /etc/bash.bashrc + +##./Allrun +icoFoam ##-paralell +perform_POD diff --git a/singularity/batch_script b/singularity/batch_script new file mode 100644 index 0000000000..103dabbacb --- /dev/null +++ b/singularity/batch_script @@ -0,0 +1,33 @@ +#!/bin/bash +#SBATCH -n 4 # Number of cores +#SBATCH -t 0-00:45 # Runtime in D-HH:MM +#SBATCH --job-name=singularity +#SBATCH -p regular1 + + +#load singularity and MPI modules +module load singularity/3.4.1 +module load intel/2021.2 +module load openmpi3 + + +echo "Starting singularity on host $HOSTNAME" + +#this binds mpi, so we do not need to +#srun -n 4 singularity exec ithacafv.sif /bin/bash Of.sh + +#without MPI +singularity exec ithicafv.sif /bin/bash Of.sh + +#Other valid + +#mpi run not recomeneded +#mpirun -n 4 singularity exec ithacafv.sif /bin/bash Of.sh + +#mpiexec -n 4 singularity exec ithacafv.sif /bin/bash Of.sh + +#singularity exec ithicafv.sif /bin/bash Of.sh + +echo "Completed singularity on host $HOSTNAME" + + diff --git a/singularity/singularity-recipe.def b/singularity/singularity-recipe.def new file mode 100644 index 0000000000..d75d366e92 --- /dev/null +++ b/singularity/singularity-recipe.def @@ -0,0 +1,104 @@ + +Bootstrap: docker +From: opencfd/openfoam2106-dev +Stage: build + + +%environment + of_var="source /usr/lib/openfoam/openfoam2106/etc/bashrc" + ithaca_var="source /usr/lib/ITHACA-FV/etc/bashrc" + export of_var ithaca_var + +%post + + #Define variables + USER="ithacafv" + of_var="source /usr/lib/openfoam/openfoam2106/etc/bashrc" + ithaca_var="source /usr/lib/ITHACA-FV/etc/bashrc" + + # Create the user + cd ~ + adduser --disabled-password --gecos '' $USER && \ + adduser $USER sudo; echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \ + usermod -a -G $USER $USER && \ + userdel sudofoam && \ + usermod -u 1000 ithacafv && \ + groupmod -g 1000 ithacafv + + cd /home/$USER + + chown -R $USER:$USER /home/$USER + chown -R $USER:$USER /home/openfoam && rm -r /home/openfoam && \ + chown -R $USER:$USER /home/sudofoam && rm -r /home/sudofoam + + #install necessary packages + cd ~ + + sudo apt-get update + sudo apt-get install git -y + sudo apt-get install vim -y + + #get the lastest version of ITHACA-FV + cd /usr/lib/ + + git clone https://github.com/mathLab/ITHACA-FV.git + + #install ITHACA-FV + /bin/bash -c "source /usr/lib/openfoam/openfoam2106/etc/bashrc && \ + cd ITHACA-FV && git submodule update --init && source /etc/bash.bashrc && \ + ./Allwmake -tau -j 4 && \ + cd ~ && \ + cp -r /root/OpenFOAM/-v2106/platforms/linux64GccDPInt32Opt/bin/* /bin/ &&\ + cp -r /root/OpenFOAM/-v2106/platforms/linux64GccDPInt32Opt/lib/* /lib/" + + #Update bashrc + echo $of_var >> /etc/bash.bashrc + echo $ithaca_var >> /etc/bash.bashrc + + #source bashrc + /bin/bash -c "source /etc/bash.bashrc" + + +%runscript + /bin/bash -c "source /etc/bash.bashrc" + echo "singularity container for ithacafv with openfoam" + echo "to activate the openfoam environment use" + echo "source /usr/lib/openfoam/openfoam2106/etc/bashrc" + echo "to activate the openfoam and ithacafv environment use" + echo "source /etc/bash.bashrc" + + +%labels + Author Pavan Pranjivan Mehta, Email : pavan_pranjivan_mehta@alumni.brown.edu + Version v0.1 + +%help + This is a singularity container for ITHACA-FV. + + Please note the openFoam version is as per the docker image : "opencfd/openfoam2106-dev". + + Change the docker image in the ".def" file for a different openFoam version. + + Source code : https://github.com/mathLab/ITHACA-FV.git + + 1. To run intertactively, use "run" or "shell", + singularity shell + + 2. To run in batch mode, use "exec" / "run" + singularity exec + + 3. MPI over slurm binds itself, with "exec" + mpirun -n $n singularity exec + + Other valid statements, + + srun -n $n singularity exec + + mpiexec -n $n singularity exec + + 4. Using MPI over non-slurm machine, you will need to pass "--bind" with path to MPI installation directory. + + + Author : Pavan Pranjivan Mehta + Email : pavan.mehta@sissa.it + diff --git a/src/ITHACA_CORE/Foam2Eigen/Foam2Eigen.C b/src/ITHACA_CORE/Foam2Eigen/Foam2Eigen.C old mode 100755 new mode 100644 index 761d4e02a5..42af14dfe3 --- a/src/ITHACA_CORE/Foam2Eigen/Foam2Eigen.C +++ b/src/ITHACA_CORE/Foam2Eigen/Foam2Eigen.C @@ -36,7 +36,28 @@ License // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template class PatchField, class GeoMesh> +template