Skip to content

Commit

Permalink
Fix warnings (#358)
Browse files Browse the repository at this point in the history
* Added a flag to supress warnings.

* Updated the new pyGeo interface for tests.

* Fixed the test file.
  • Loading branch information
friedenhe authored Oct 2, 2022
1 parent d72aef6 commit e043da9
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ jobs:
docker exec -i regtest /bin/bash -c "cd ${{env.DOCKER_WORKING_DIR}}/src && cp -r adjoint adjointAD && cp -r pyDASolvers pyDASolversAD"
if [ "${{matrix.args}}" = "forward" ]; then
docker exec -i 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}} && . ${{env.DOCKER_OF_ADF_BASHRC}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjointAD && ./Allmake opt 2> makeWarnings.txt && cd ../pyDASolversAD && ./Allmake opt 2> makeWarnings.txt"
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && . ${{env.DOCKER_OF_ADF_BASHRC}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjointAD && ./Allmake opt 2> errorLog.txt && cd ../pyDASolversAD && ./Allmake opt 2> errorLog.txt"
elif [ "${{matrix.args}}" = "mphys" ]; then
docker exec -i 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}} && . ${{env.DOCKER_OF_ADR_BASHRC}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjointAD && ./Allmake opt 2> makeWarnings.txt && cd ../pyDASolversAD && ./Allmake opt 2> makeWarnings.txt"
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && . ${{env.DOCKER_OF_ADR_BASHRC}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjointAD && ./Allmake opt 2> errorLog.txt && cd ../pyDASolversAD && ./Allmake opt 2> errorLog.txt"
else
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake ${{matrix.args}}"
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && . ${{env.DOCKER_OF_ADR_BASHRC}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjointAD && ./Allmake ${{matrix.args}} 2> makeWarnings.txt && cd ../pyDASolversAD && ./Allmake ${{matrix.args}} 2> makeWarnings.txt"
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && . ${{env.DOCKER_OF_ADR_BASHRC}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjointAD && ./Allmake ${{matrix.args}} 2> errorLog.txt && cd ../pyDASolversAD && ./Allmake ${{matrix.args}} 2> errorLog.txt"
fi
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && pip install ."
docker exec -i -e DF_CHECK_COVERAGE=1 regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}}/tests && ./Allrun ${{matrix.args}}"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/reg_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:
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}}"
if [ "${{matrix.args}}" = "forward" ]; then
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake && . ${{env.DOCKER_OF_ADF_BASHRC}} && ./Allclean && ./Allmake 2> makeWarnings.txt"
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake && . ${{env.DOCKER_OF_ADF_BASHRC}} && ./Allclean && ./Allmake 2> errorLog.txt"
elif [ "${{matrix.args}}" = "mphys" ]; then
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake && . ${{env.DOCKER_OF_ADR_BASHRC}} && ./Allclean && ./Allmake 2> makeWarnings.txt"
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake && . ${{env.DOCKER_OF_ADR_BASHRC}} && ./Allclean && ./Allmake 2> errorLog.txt"
else
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake ${{matrix.args}} && . ${{env.DOCKER_OF_ADR_BASHRC}} && ./Allclean && ./Allmake ${{matrix.args}} 2> makeWarnings.txt"
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake ${{matrix.args}} && . ${{env.DOCKER_OF_ADR_BASHRC}} && ./Allclean && ./Allmake ${{matrix.args}} 2> errorLog.txt"
fi
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && pip install ."
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}}/tests && ./Allrun ${{matrix.args}}"
Expand Down
18 changes: 18 additions & 0 deletions src/adjoint/Allmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ case $1 in
"opt")
cp Make/files_Incompressible Make/files
cp Make/options_Incompressible Make/options
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/-std=c++11/-std=c++11 -w/g' Make/options
fi
if [ -n "$TENSOR_FLOW_INCLUDE_PATH" ]; then
echo "Tensor flow include path found."
sed -i s#"DAModel/DATurbulenceModel/DAkOmegaSST.C"#"DAModel/DATurbulenceModel/DAkOmegaSST.C DAModel/DATurbulenceModel/DAkOmegaSSTFIML.C"#g Make/files
Expand All @@ -28,10 +31,16 @@ case $1 in
./Allclean
cp Make/files_Compressible Make/files
cp Make/options_Compressible Make/options
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/-std=c++11/-std=c++11 -w/g' Make/options
fi
wmake -j 4 || exit 1
./Allclean
cp Make/files_Solid Make/files
cp Make/options_Solid Make/options
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/-std=c++11/-std=c++11 -w/g' Make/options
fi
wmake -j 4 || exit 1
;;
"debug")
Expand All @@ -53,6 +62,9 @@ case $1 in
"incompressible")
cp Make/files_Incompressible Make/files
cp Make/options_Incompressible Make/options
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/-std=c++11/-std=c++11 -w/g' Make/options
fi
if [ -n "$TENSOR_FLOW_INCLUDE_PATH" ]; then
echo "Tensor flow include path found."
sed -i s#"DAModel/DATurbulenceModel/DAkOmegaSST.C"#"DAModel/DATurbulenceModel/DAkOmegaSST.C DAModel/DATurbulenceModel/DAkOmegaSSTFIML.C"#g Make/files
Expand All @@ -65,11 +77,17 @@ case $1 in
"compressible")
cp Make/files_Compressible Make/files
cp Make/options_Compressible Make/options
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/-std=c++11/-std=c++11 -w/g' Make/options
fi
wmake -j 4 || exit 1
;;
"solid")
cp Make/files_Solid Make/files
cp Make/options_Solid Make/options
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/-std=c++11/-std=c++11 -w/g' Make/options
fi
wmake -j 4 || exit 1
;;
*)
Expand Down
2 changes: 1 addition & 1 deletion src/include/setArgs.H
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ char** argv = new char*[argc];
for (int i = 0; i < argc; i++)
{
argv[i] = const_cast<char*>(argvList[i].c_str());
}
}
2 changes: 1 addition & 1 deletion src/include/setForwardADSeeds.H
Original file line number Diff line number Diff line change
Expand Up @@ -373,4 +373,4 @@ if (daOptionPtr_->getAllOptions().subDict("useAD").getWord("mode") == "forward")
}
}

#endif
#endif
18 changes: 18 additions & 0 deletions src/pyDASolvers/Allmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@ fi
case $1 in
"opt")
cp setup_Incompressible.py setup.py
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/"-std=c++11",/"-std=c++11","-w",/g' setup.py
fi
python setup.py build_ext --inplace || exit 1
mv *.so ../../dafoam
./Allclean
cp setup_Compressible.py setup.py
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/"-std=c++11",/"-std=c++11","-w",/g' setup.py
fi
python setup.py build_ext --inplace || exit 1
mv *.so ../../dafoam
./Allclean
cp setup_Solid.py setup.py
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/"-std=c++11",/"-std=c++11","-w",/g' setup.py
fi
python setup.py build_ext --inplace || exit 1
mv *.so ../../dafoam
;;
Expand All @@ -37,16 +46,25 @@ case $1 in
;;
"incompressible")
cp setup_Incompressible.py setup.py
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/"-std=c++11",/"-std=c++11","-w",/g' setup.py
fi
python setup.py build_ext --inplace || exit 1
mv *.so ../../dafoam
;;
"compressible")
cp setup_Compressible.py setup.py
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/"-std=c++11",/"-std=c++11","-w",/g' setup.py
fi
python setup.py build_ext --inplace || exit 1
mv *.so ../../dafoam
;;
"solid")
cp setup_Solid.py setup.py
if [ -n "$DAFOAM_NO_WARNINGS" ]; then
sed -i 's/"-std=c++11",/"-std=c++11","-w",/g' setup.py
fi
python setup.py build_ext --inplace || exit 1
mv *.so ../../dafoam
;;
Expand Down
6 changes: 6 additions & 0 deletions src/utilities/coloring/Allmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ if [ -z "$WM_PROJECT" ]; then
exit 1
fi

if [ "$WM_CODI_AD_MODE" = "CODI_AD_FORWARD" ]; then
exit 0
elif [ "$WM_CODI_AD_MODE" = "CODI_AD_REVERSE" ]; then
exit 0
fi

case $1 in
"opt")
for d in ./*/ ; do
Expand Down
2 changes: 1 addition & 1 deletion tests/runTests_DASimpleFoamFixedPoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def setup(self):
self.add_subsystem("mesh", dafoam_builder.get_mesh_coordinate_subsystem())

# add the geometry component (FFD)
self.add_subsystem("geometry", OM_DVGEOCOMP(ffd_file="FFD/bumpFFD.xyz"))
self.add_subsystem("geometry", OM_DVGEOCOMP(file="FFD/bumpFFD.xyz", type="ffd"))

# add a scenario (flow condition) for optimization, we pass the builder
# to the scenario to actually run the flow and adjoint
Expand Down
2 changes: 1 addition & 1 deletion tests/runTests_MphysAero.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def setup(self):
self.add_subsystem("mesh", dafoam_builder.get_mesh_coordinate_subsystem())

# add the geometry component, we dont need a builder because we do it here.
self.add_subsystem("geometry", OM_DVGEOCOMP(ffd_file="FFD/wingFFD.xyz"))
self.add_subsystem("geometry", OM_DVGEOCOMP(file="FFD/wingFFD.xyz", type="ffd"))

self.mphys_add_scenario("cruise", ScenarioAerodynamic(aero_builder=dafoam_builder))

Expand Down
2 changes: 1 addition & 1 deletion tests/runTests_MphysAeroField.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def setup(self):
self.add_subsystem("mesh", dafoam_builder.get_mesh_coordinate_subsystem())

# add the geometry component, we dont need a builder because we do it here.
self.add_subsystem("geometry", OM_DVGEOCOMP(ffd_file="FFD/wingFFD.xyz"))
self.add_subsystem("geometry", OM_DVGEOCOMP(file="FFD/wingFFD.xyz", type="ffd"))

self.mphys_add_scenario("cruise", ScenarioAerodynamic(aero_builder=dafoam_builder))

Expand Down
4 changes: 2 additions & 2 deletions tests/runTests_MphysAeroStruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def problem_setup(scenario_name, fea_assembler, problem):
dvs = self.add_subsystem("dvs", om.IndepVarComp(), promotes=["*"])

# add the geometry component, we dont need a builder because we do it here.
self.add_subsystem("geometry", OM_DVGEOCOMP(ffd_file="./FFD/parentFFD.xyz"))
self.add_subsystem("geometry", OM_DVGEOCOMP(file="./FFD/parentFFD.xyz", type="ffd"))

# add the coupling solvers
nonlinear_solver = om.NonlinearBlockGS(maxiter=25, iprint=2, use_aitken=True, rtol=1e-8, atol=1e-8)
Expand Down Expand Up @@ -241,7 +241,7 @@ def configure(self):
self.geometry.nom_setConstraintSurface(tri_points)

# geometry setup
self.geometry.nom_addChild(ffd_file="./FFD/wingFFD.xyz")
self.geometry.nom_addChild("./FFD/wingFFD.xyz")
# Create reference axis
nRefAxPts = self.geometry.nom_addRefAxis(name="wingAxis", xFraction=0.25, alignIndex="k", childIdx=0)

Expand Down

0 comments on commit e043da9

Please sign in to comment.