Skip to content

Commit

Permalink
Merged v4 into main (#751)
Browse files Browse the repository at this point in the history
* Change version to v4 for all files (#686)

* Removed GH actions.

* Changed version to v4 for all files.

* Verified totals for DASimpleFoam (#715)

* Added first lib with test yml.

* Fixed a bug in the test script.

* Added the first v4 test.

* Added the missing DAOption Make.

* Added test codecov

* Update and rename codecov.yml to code_cov.yml

* Added unit_test verification mechanism

* Unify the incompressible and compressible libs.

* Added more libs.

* Renamed DAObjFunc to DAFunction.

* More renames.

* Re-structue the DAFunction.

* Added more libs and delete unused DAPart and DAJac sub classes.

* DASOlver compiled.

* Re-organized coloring util.

* Re-organized pyDASolvers.

* Fixed the unit test setup file.

* Added the DAInput and DAOutput classes.

* Added -w to all the options files to disable warnings.

* Changed the interfaces for many classes.

* Changed the Allmake files.

* Changed init file.

* Changed mphys and pyDAFoam python layers.

* Changed DASolver and add calcJacTVecProduct function.

* Fixed an issue in init file.

* DAOutput uses its own dicts.

* Added the missing pip install for tests.

* Total accurate for DASimpleFoam.

* Enabled new build modes (#723)

* Fixed a bug for the distributed flag for functions

* Fixed all the Make files.

* Changed the AD -D name to CODI_NO_AD, CODI_ADR and CODI_ADF.

* Changed the cython lib compilation method.

* Changed the pre and post-processing build.

* Changed the python files to new build.

* Added a new libs folder for the cython libs.

* Changed the github action files.

* Added the ADR build in the github action.

* Fixed a bug in the GH action file.

* Fixed the unit test script.

* Added regression, unit, and coverage test templates (#724)

* Fixed a bug for the distributed flag for functions

* Added DASimpleFoam test.

* Fixed codecov test.

* Fixed a bug in codecov

* Added Python coverage.

* Added more tracking files.

* Fixed a codecov typo

* Changed the all run script for test such that it will run all the tests.

* Added checkMesh and printRes to primals.

* Added DARhoSimpleFoam (#726)

* Fixed a bug for the distributed flag for functions

* Made printInterval and maxRes class-wide vars.

* Added the DARhoSimpleFoam tests.

* Fixed test files.

* Added the missing file.

* Enabled forward model and verified adjoint accuracy (#727)

* Fixed a bug for the distributed flag for functions

* Enabled forward mode AD. Verified machine-precision accurate adjoint for DASimpleFoam

* Added new interfaces for inputs (#733)

* Removed 2> log for test files.

* Re-organize input and output. Added patchVelocity

* Added dF back for patchVelocity.

* Enabled CD and CL based on AOA.

* Enabled auto make mode.

* Print info for DAInput and calcJac.

* Changed designVar to solverInput and re-organized all partial calls.

* Added more solvers and functions. (#734)

* Removed the distributed arg for calcJac.

* Added DARhoSimpleCFoam.

* Added DAHeatTransferFoam and related functions.

* Added the missing files.

* Fixed the DATurb order.

* Used mpicc to auto-detect include and lib paths.

* Added DASimpleTFoam and related functions.

* Added the missing files.

* Added kOmegaSST and moved Coloring into DASolver.

* Fixed the code cov.

* Re-organized new turbModel structure and added Fv3 and laminar models.

* Added the moment function.

* Fixed an issue to avoid computing all dF partials.

* Removed un-used funcs in Python layer.

* Removed unused funcs in DASolver.

* Removed parts for DAFunction and re-organized codes.

* Added pimple adjoint and verified totals  (#737)

* Added DAPimpleFoam and primal working.

* Updated the pimple ref.

* Added pimple and verified derivs

* Fixed a critical bug about normRes.

* Added the updatePC call back.

* Updated ref.

* Updated simpleFoam refs.

* Added shape var for pimple. Totals not accurate yet.

* Tested pimple shape with forward and the totals are accurate.

* Added forward tests and changed function interfaces (#741)

* Added DATimeOp and re-organized evalFunctions.

* Added forward AD test.

* Added flags to compile forward mode.

* Renamed the test refs

* Moved old test files.

* Added forward tests and FD refs.

* Add pimpleDym primal (#744)

* Added pimpleDyM.

* Added the docker deploy yml.

* Change pimpledym test file name

* Enabled ADF for docker build

* Fixed an issue in the docker build yml

* Added more inputs, changed solverInto to inputInfo, and added aerothermal (#745)

* Added field input and verifed its totals.

* Added tests for vector field.

* Added the patchVar input.

* Added CHT.

* Added the missing files.

* Added the missing flag.

* Added regModel to pimple (#746)

* Enabled regression par as dv.

* Deleted DAMotion and DARegDb classes

* Removed regDb dependencies.

* Deleted unused models.

* Renamed models to DAMisc

* Moved boundaryConditions to DAMisc.

* Changed the test file name

* Added variance func.

* Added regModel for pimple with a test.

* Removed outdated codes (#747)

* Allowed empty function.

* Removed outdated codes.

* Renamed thermalVar to thermalCoupling.

* Updated the aerothermal test script.

* Fixed aerothermal.

* Added aerostructural (#748)

* Added forceCoupling for FSI.

* Verified the AeroStruct total.

* Removed the masks, aeroProp, and acoustics in mphys_dafoam.

* Adjusted the aero-struct tolerance.

* Added all solvers and functions back (#750)

* Deleted Laplacian and Piso.

* Deleted scalarTransport

* Added turboFoam and mass flow rate func.

* Deleted outdated functions and added all functions back.

* Deleted outdated res and stateInfo.

* Added rhoPimple

* Added all turb models.

* Changed the primalMaxRes calculation.

* Added more tests and fixed issues.

* Added more tests.
  • Loading branch information
friedenhe authored Jan 30, 2025
1 parent 08422e9 commit cdb0ca9
Show file tree
Hide file tree
Showing 602 changed files with 14,993 additions and 39,600 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/code_cov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: codecov

on: [push, pull_request]

env:
REPO_NAME: 'dafoam'
DOCKER_WORKING_DIR: '/home/dafoamuser/dafoam/$REPO_NAME'
DOCKER_MOUNT_DIR: '/home/dafoamuser/mount/$REPO_NAME'
DOCKER_TAG: 'v4'
DOCKER_ENV_FILE: '/home/dafoamuser/dafoam/loadDAFoam.sh'
DOCKER_OF_ADF_BASHRC: '/home/dafoamuser/dafoam/OpenFOAM/OpenFOAM-v1812-ADF/etc/bashrc'
DOCKER_OF_ADR_BASHRC: '/home/dafoamuser/dafoam/OpenFOAM/OpenFOAM-v1812-ADR/etc/bashrc'

jobs:
code_coverage:
runs-on: ubuntu-20.04
name: Codecov
steps:
- uses: actions/checkout@main
- name: Create the docker container and run the tests
run: |
docker pull dafoam/opt-packages:${{env.DOCKER_TAG}}
docker run -i -d -u dafoamuser --name regtest -v $GITHUB_WORKSPACE:${{env.DOCKER_MOUNT_DIR}} dafoam/opt-packages:${{env.DOCKER_TAG}} /bin/bash
docker exec -i regtest /bin/bash -c "rm -rf ${{env.DOCKER_WORKING_DIR}} && cp -r ${{env.DOCKER_MOUNT_DIR}} ${{env.DOCKER_WORKING_DIR}}"
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}}/src && . ./.add_coverage_flag.sh"
docker exec -i -e COMPILE_DAFOAM_ADF=1 regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake"
docker exec -i -e DF_CHECK_COVERAGE=1 regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}}/tests && ./Allrun"
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}}/tests && coverage combine && coverage xml && echo dafoamuser | sudo -S cp -r coverage.xml ${{env.DOCKER_MOUNT_DIR}}/"
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && lcov --capture --directory . --output-file coverage.info && echo dafoamuser | sudo -S cp -r coverage.info ${{env.DOCKER_MOUNT_DIR}}/"
- name: Upload
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./coverage.info
token: ${{secrets.CODECOV_TOKEN}}
verbose: true
78 changes: 0 additions & 78 deletions .github/workflows/codecov.yml

This file was deleted.

18 changes: 8 additions & 10 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ name: docker
on:
push:
branches:
- main
- v4

env:
DOCKER_ENV_FILE: '/home/dafoamuser/dafoam/loadDAFoam.sh'
DOCKER_OF_ADF_BASHRC: '/home/dafoamuser/dafoam/OpenFOAM/OpenFOAM-v1812-ADF/etc/bashrc'
DOCKER_OF_ADR_BASHRC: '/home/dafoamuser/dafoam/OpenFOAM/OpenFOAM-v1812-ADR/etc/bashrc'

jobs:
push_to_registry:
Expand All @@ -19,11 +17,11 @@ jobs:
- name: Build and push
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u dafoam --password-stdin
docker pull dafoam/opt-packages:latest
docker run -i -d -u dafoamuser --name build_latest dafoam/opt-packages:latest /bin/bash
docker exec -i -e DAFOAM_NO_WARNINGS=1 build_latest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd /home/dafoamuser/dafoam/repos && git clone https://github.com/mdolab/dafoam && cd dafoam && ./Allmake && . ${{env.DOCKER_OF_ADR_BASHRC}} && ./Allclean && ./Allmake && . ${{env.DOCKER_OF_ADF_BASHRC}} && ./Allclean && ./Allmake && pip install . && cd .. && rm -rf /home/dafoamuser/dafoam/repos/dafoam"
docker export build_latest > build_latest.tar
docker pull dafoam/opt-packages:v4
docker run -i -d -u dafoamuser --name build_v4 dafoam/opt-packages:v4 /bin/bash
docker exec -e COMPILE_DAFOAM_ADF=1 -i build_v4 /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd /home/dafoamuser/dafoam/repos && rm -rf dafoam && git clone https://github.com/mdolab/dafoam && cd dafoam && git checkout v4 && ./Allmake"
docker export build_v4 > build_v4.tar
docker rm -f $(docker ps -a -q)
docker rmi -f dafoam/opt-packages:latest
docker import build_latest.tar dafoam/opt-packages:latest
docker push dafoam/opt-packages:latest
docker rmi -f dafoam/opt-packages:v4
docker import build_v4.tar dafoam/opt-packages:v4
docker push dafoam/opt-packages:v4
54 changes: 0 additions & 54 deletions .github/workflows/reg_tests.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: tests

on: [push, pull_request]

env:
REPO_NAME: 'dafoam'
DOCKER_WORKING_DIR: '/home/dafoamuser/dafoam/$REPO_NAME'
DOCKER_MOUNT_DIR: '/home/dafoamuser/mount/$REPO_NAME'
DOCKER_TAG: 'v4'
DOCKER_ENV_FILE: '/home/dafoamuser/dafoam/loadDAFoam.sh'
DOCKER_OF_ADF_BASHRC: '/home/dafoamuser/dafoam/OpenFOAM/OpenFOAM-v1812-ADF/etc/bashrc'
DOCKER_OF_ADR_BASHRC: '/home/dafoamuser/dafoam/OpenFOAM/OpenFOAM-v1812-ADR/etc/bashrc'

jobs:

reg_tests:
runs-on: ubuntu-20.04
name: Tests
steps:
- uses: actions/checkout@v3
- name: Create the docker container and run the tests
run: |
docker pull dafoam/opt-packages:${{env.DOCKER_TAG}}
docker run -i -d -u dafoamuser --name regtest -v $GITHUB_WORKSPACE:${{env.DOCKER_MOUNT_DIR}} dafoam/opt-packages:${{env.DOCKER_TAG}} /bin/bash
docker exec -i regtest /bin/bash -c "rm -rf ${{env.DOCKER_WORKING_DIR}} && cp -r ${{env.DOCKER_MOUNT_DIR}} ${{env.DOCKER_WORKING_DIR}}"
docker exec -i -e COMPILE_DAFOAM_ADF=1 regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake"
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}}/tests && ./Allrun"
39 changes: 33 additions & 6 deletions Allclean
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,36 @@ if [ -z "$WM_PROJECT" ]; then
exit 1
fi

cd src/adjoint && ./Allclean && cd -
cd src/pyDASolvers && ./Allclean && cd -
cd src/utilities/coloring && ./Allclean && cd -
cd src/utilities/postProcessing && ./Allclean && cd -
cd src/utilities/preProcessing && ./Allclean && cd -
cd tests && ./Allclean && cd -
function cleanDAFoam()
{
cd src/adjoint && rm -rf lnInclude && cd -
cd src/adjoint && ./Allclean && cd -
cd src/newTurbModels && ./Allclean && cd -
cd src/pyUnitTests && ./Allclean && cd -
cd src/pyDASolvers && ./Allclean && cd -
cd src/utilities/preProcessing && ./Allclean && cd -
}

# clean original mode
echo "***************** Cleaning original mode **************"
. $DAFOAM_ROOT_PATH/loadDAFoam.sh
cleanDAFoam
# clean ADR mode
echo "***************** Cleaning ADR mode **************"
. $DAFOAM_ROOT_PATH/loadDAFoam.sh
. $DAFOAM_ROOT_PATH/OpenFOAM/OpenFOAM-v1812-ADR/etc/bashrc
cleanDAFoam
# if COMPILE_DAFOAM_ADF is set, compile ADF mode
if [ -z "$COMPILE_DAFOAM_ADF" ]; then
echo "COMPILE_DAFOAM_ADF is not set. skip the ADF mode"
else
echo "***************** Cleaning ADF mode **************"
. $DAFOAM_ROOT_PATH/loadDAFoam.sh
. $DAFOAM_ROOT_PATH/OpenFOAM/OpenFOAM-v1812-ADF/etc/bashrc
cleanDAFoam
fi

# reset the OpenFOAM environment to the original mode
. $DAFOAM_ROOT_PATH/loadDAFoam.sh


48 changes: 36 additions & 12 deletions Allmake
Original file line number Diff line number Diff line change
@@ -1,22 +1,46 @@
#!/usr/bin/env bash

# the script will exit if there is any error
set -e

if [ -z "$WM_PROJECT" ]; then
echo "OpenFOAM environment not found, forgot to source the OpenFOAM bashrc?"
exit 1
fi

if [ -z "$1" ]; then
echo "Argument not found. Using the default value: opt"
argm="opt"
function makeDAFoam()
{
# the script will exit if there is any error
set -e
wmakeLnInclude src/adjoint
cd src/adjoint && ./Allmake && cd -
cd src/newTurbModels && ./Allmake && cd -
cd src/pyUnitTests && ./Allmake && cd -
cd src/pyDASolvers && ./Allmake && cd -
cd src/utilities/preProcessing && ./Allmake && cd -
# disable the -e flag
set +e
}

# compile original mode
echo "***************** Compiling original mode **************"
. $DAFOAM_ROOT_PATH/loadDAFoam.sh
makeDAFoam
# compile ADR mode
echo "***************** Compiling ADR mode **************"
. $DAFOAM_ROOT_PATH/loadDAFoam.sh
. $DAFOAM_ROOT_PATH/OpenFOAM/OpenFOAM-v1812-ADR/etc/bashrc
makeDAFoam
# if COMPILE_DAFOAM_ADF is set, compile ADF mode
if [ -z "$COMPILE_DAFOAM_ADF" ]; then
echo "COMPILE_DAFOAM_ADF is not set. skip the ADF mode"
else
argm="$1"
echo "***************** Compiling ADF mode **************"
. $DAFOAM_ROOT_PATH/loadDAFoam.sh
. $DAFOAM_ROOT_PATH/OpenFOAM/OpenFOAM-v1812-ADF/etc/bashrc
makeDAFoam
fi

cd src/adjoint && ./Allmake $argm && cd -
cd src/pyDASolvers && ./Allmake $argm && cd -
cd src/utilities/coloring && ./Allmake $argm && cd -
cd src/utilities/postProcessing && ./Allmake $argm && cd -
cd src/utilities/preProcessing && ./Allmake $argm && cd -
# reset the OpenFOAM environment to the original mode
. $DAFOAM_ROOT_PATH/loadDAFoam.sh

pip install .

ls -R dafoam/libs && echo " " && echo "*** Build Successful! ***" && echo " "
1 change: 1 addition & 0 deletions dafoam/libs/ADF/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# empty_file
1 change: 1 addition & 0 deletions dafoam/libs/ADR/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# empty_file
1 change: 1 addition & 0 deletions dafoam/libs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# empty_file
Loading

0 comments on commit cdb0ca9

Please sign in to comment.