mdolab / dafoam Goto Github PK
View Code? Open in Web Editor NEWDAFoam: Discrete Adjoint with OpenFOAM for High-fidelity Multidisciplinary Design Optimization
Home Page: https://dafoam.github.io
License: Other
DAFoam: Discrete Adjoint with OpenFOAM for High-fidelity Multidisciplinary Design Optimization
Home Page: https://dafoam.github.io
License: Other
The whole chain of dF/dXv computation is not tested. Need to add reg_tests.
I got an error in regression test after installation.
The error message is like below.
ImportError: No module named regression_helper
so current reg_test folder need to be added to the pythonpath
please run below command, before run the test.
export PYTHONPATH=$PYTHONPATH:$HOME/repos/dafoam/python/reg_tests
I think the documentation also needs to be updated :)
currently my reg_test is still running and I hope to be finished with OK.
when I make dafoam, I got errors like below
It looks like there are some type mismatch between openfoam and petsc.
error: cannot convert ‘Foam::label {aka long int}’ to ‘const PetscInt* {aka const int*}**
I want to know how to fix it.
mpicc -DOPENFOAM=1812 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=64 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -Wno-unknown-pragmas -O3 -DNoRepository -ftemplate-depth-100 -DFULLDEBUG -g -O0 -DIncompressibleFlow -std=c++11 -Wno-old-style-cast -Wno-conversion-null -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/TurbulenceModels/turbulenceModels/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/TurbulenceModels/incompressible/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/transportModels/incompressible/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/transportModels/compressible/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/transportModels/twoPhaseMixture/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/transportModels/interfaceProperties/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/transportModels -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/transportModels/incompressible/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/thermophysicalModels/basic/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/thermophysicalModels/radiation/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/finiteVolume/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/meshTools/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/sampling/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/fvOptions/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude -I/home/jmpark54/packages/petsc-3.6.4/include -I/home/jmpark54/packages/petsc-3.6.4/real-opt/include -IlnInclude -I. -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude -I/home/jmpark54/OpenFOAM/OpenFOAM-v1812/src/OSspecific/POSIX/lnInclude -fPIC -c AdjointIndexing/AdjointIndexing.C -o Make/linux64Gcc48DPInt64Opt/AdjointIndexing/AdjointIndexing.o
AdjointIndexing/AdjointIndexing.C: In member function ‘void Foam::AdjointIndexing::calcAdjStateID4GlobalAdjIdx(Foam::labelList&)’:
AdjointIndexing/AdjointIndexing.C:772:73: error: cannot convert ‘Foam::label* {aka long int*}’ to ‘const PetscInt* {aka const int*}’ for argument ‘3’ to ‘PetscErrorCode VecSetValues(Vec, PetscInt, const PetscInt*, const PetscScalar*, InsertMode)’
VecSetValues(stateIVec,1,&globalIdx,&valIn,INSERT_VALUES);
^
AdjointIndexing/AdjointIndexing.C:785:69: error: cannot convert ‘Foam::label* {aka long int*}’ to ‘const PetscInt* {aka const int*}’ for argument ‘3’ to ‘PetscErrorCode VecSetValues(Vec, PetscInt, const PetscInt*, const PetscScalar*, InsertMode)’
VecSetValues(stateIVec,1,&globalIdx,&valIn,INSERT_VALUES);
^
thanks in davance.
I've installed dafoam following all the instruction in "https://dafoam.readthedocs.io/en/latest/Installation.html". When I get to the end, and I try to untar the input.tar.gz file in dafoam/python/reg_tests, I get the error message saying that the input.tar.gz file not an archive.
All the prerequisite modules seem to have been installed correctly.
Thanks
"writeSensMap" flag from daoptions is not working for v3 runScript, but it works for v2.
The sensitivity map is not computed
A sensitivity map is computed and saved in the processor*/0.*1 directories
DAFoam v3.0.8
h ave two problem professor
1- i use the same runscript.py for naca0012 airfoil after i chnage the airfoil of s809 and everything is working which i have been changed the coordinate of airfoil and the ffd point and the mesh and every thing working fine till i get this error i hope you help me on this problem and a appreciate your reply and help and thank you advanced
2- the file paraview.foam is empty and can not give any result of my optimization
Total derivatives for the mesh quality functions are not accurate in parallel
The totals are accurate in serial but not accurate in parallel.
The totals should be accurate in both serial and in parallel
Note: This bug is caused by this issue in OpenFOAM-v1812-AD.
GPU with using OpenCL, HIP and CUDA can accelerate about 4 to 100 times against cpu solution.
OGL Openfoam Ginkgo Layer with CUDA can do this with Nvidia Hardware.
See https://github.com/hpsim/OGL
minimum openfoam version is here 2106. so an update is here necessary in openfoam base.
and a solution with OpenCL is also possible with openfoam 1912 with solver petsc4foam
https://wiki.openfoam.com/images/c/cd/OpenFOAM_2020_KAUST_Zampini.pdf
third is OpenMP 5.0 and higher (actual 5.2, 6.0 wip) with possible offloading to GPU with newer adapted openfoam
https://arxiv.org/pdf/2205.05681.pdf
https://www.openmp.org/wp-content/uploads/OpenMP_ECP_Sollve_May2023_AMDtalk.pdf
https://www.openmp.org/resources/refguides/
So two ways: external layer or internal in openfoam with newer Version of openfoam.
actual installation nextfoam with actual openfoam 23.06 and petsc4foam
https://blog.nextfoam.co.kr/2024/01/10/gpu-accelerated-openfoam-with-petsc4foam/
Do you know of any efforts to date to create Spack or EasyBuild recipes for DAFOAM? Such recipes would make DAFOAM much easier for sysadmins and power users to install.
The SLSQP optimizer does not work for v2 scripts due to a recent pyOptSarse repo update.
An error will occur:
ValueError: failed to initialize intent(inout) array -- expected elsize=8 but got 16 -- input 'D' not compatible to 'd'
The v2 script should run without an error.
Note: this seems to be a problem for v2 scripts only. The v3 scripts still work with the SLSQP optimizer.
latest
I would like to optimize the shape of the propeller blade.
Hi Ping He:
I want to make a comparison between the dafoam and my continuous adjoint solver. So I want to display the adjoint variables such as adjoint velocity, adjoint pressure, adjoint flux and adjoint turbulent viscosity.
I think the psi_ (adjoint vector) is the combination of the adjoint variables in the code. May I know how to restore them into adjoint fields in OpenFOAM format?
%Vec Object: 2 MPI processes
% type: mpi
Vec_0x2430d10_5 = [
2.3408021501763571e-10
-4.0155779102974452e-10
-2.2986008393808899e-13
-6.0818491560728194e-09
-1.4040886658018889e-07
2.6810842584837121e-08
-2.3629970887731813e-07
1.4979062944125512e-11
1.4978624960477857e-11
-3.1721950201180557e-06
......
];
I not sure about the list order of cells and faces variables. The magnitude seems much less than I expected. Should I multiply them with the scaling factors?
Thanks,
Qifeng
What types of issue is it?
Select the appropriate type(s) that describe this issue
A description of the issue.
I am a local user in this Linux system (CentOS7) and I do not have administrator priviliges, while using OpenFOAM and DAFoam,
As a localuser, when I run docker and when i try to run the Airfoil code given in the tutorial, the following error appears when running the preProcessing.sh script.
"./preProcessing.sh: line 11: logMeshGeneration.txt: Permission denied
./preProcessing.sh: line 12: logMeshGeneration.txt: Permission denied
./preProcessing.sh: line 13: logMeshGeneration.txt: Permission denied
./preProcessing.sh: line 14: logMeshGeneration.txt: Permission denied
./preProcessing.sh: line 15: logMeshGeneration.txt: Permission denied
"
and when the runScript.py is then run, it says :
"
Generating mesh.. Done!
cp: cannot create directory '0': Permission denied
"
Please tell me a way to fix this.
LogOpt.txt not getting generated and the code doesnt seem to run.
Successful compilration and results in Paraview.
Python version: …
External dependencies: …
Internal packages: …
The DASimpleTFoam reg tests failed when using Ubuntu 20.04 and Python 3.7+. The difference is very small though.
The adjoint derivatives for the kEpsilon model (compressible flow) is not accurate.
A description of the issue.
When calling solver wrapped with Cython, it returns seg fault if forceFunctions is defined, and if more than one .so files are added to the libs in controlDict.
Hi~, sorry to bother you. Would you guys have the plan to compile the dafoam with GCC-12.X?
After the check of OpenFOAM-v1812, I found that it only supports to be compiled with no more than GCC-9.X.
Modify the configure setting file ( compiler flags, information about GCC-12.X, etc) in OpenFOAM-v1812?
I am trying to run Unsteady RANS analysis for DPW4 aircraft. https://dafoam.github.io/mydoc_tutorials_aero_dpw4.html
But not understanding what options need to be set up or changed? Can you give any script for the setup?
Thanks
DAFoam is based on Python 2.7 and is not compatible with Python 3.X. Need to fix this.
During sensitivity calculation of alphaPorosity in the pitzDaily tutorial case the sensitivity seem to be messed up if an mpirun in performed.
The first picture below shows an sensitivity calculation executed on 4 cores with:
mpirun -np 4 python runScript.py 2>&1 | tee logOpt.txt
The second picture shows an execution on one core with:
python runScript.py 2>&1 | tee logOpt.txt
The sensitivities in the first case look unphysical. Maybe it's an domain decomposition issue.
Attached you can find two models "mpirun" and "no_mpirun". The only difference is the argument the function was called with.
The sensitivities are written to the "0" folder in OpenFOAM format for easiely importing them into e.g. ParaView.
For reproduction do the following
Files for reproduction:
It returns seg falt
It should run in parallel
v3.0.8
The kOmegaSST model does not work well for MRF cases.
The simpleFoam+SST results are very different from the DASimpleFoam+SST results. Also, the omega field for the DASimpleFoam+SST case has very high values.
The difference between the simpleFoam+SST and DASimpleFoam+SST results should be < 0.1 %.
DAFoam 3.0.7
simpleFoam+SA and simpleFoam+SA match well. So it is likely that the DAFoam's SST model has issues for MRF cases.
Installation
Issue executing the preProcessing.sh script in rotor 37 tutorial. I have been able to previously generate this mesh and complete the Rotor 37 Compressor tutorial on a Windows system. I am now trying to do the same thing on a Ubuntu system but am running into an issue when I try to generate the mesh. I followed the DAFoam documentation instructions and am not sure how to resolve the issue
Mesh generation
Python version: …
External dependencies: …
Internal packages: …
Regression tests work up to Petsc-3.8, and they all fail when upgrading to Petsc-3.9
The issue is because the tractionDisplacement BC updates the boundary gradient using an iterative approach, it is not a problem when running the primal solver because it will eventually converge after hundreds of iterations. However, for computing Jacobian using the finite-difference approach, this BC is problematic. The current solution is to call this BC multiple times for a perturbed state, such that the perturbed boundary gradient will be accurate. This causes the adjoint to run very slowly and the adjoint accuracy is not very good.
Hi He Ping:
This is Qifeng.
When I run the regression test, I got the following results.
test_buoyantBoussinesqSimpleDAFoam.py
dafoam buoyantBoussinesqSimpleDAFoam: Success!
test_buoyantSimpleDAFoam.py
dafoam buoyantSimpleDAFoam: Failure!
test_calcDeltaVolPointMat.py
dafoam calcDeltaVolPointMat: Success!
test_rhoSimpleCDAFoam.py
dafoam rhoSimpleCDAFoam: Failure!
test_rhoSimpleDAFoam.py
dafoam rhoSimpleDAFoam: Failure!
test_simpleDAFoam.py
dafoam simpleDAFoam: Failure!
test_simpleTDAFoam.py
dafoam simpleTDAFoam: Failure!
test_solidDisplacementDAFoam.py
dafoam solidDisplacementDAFoam: Success!
test_turboDAFoam.py
Error: number of @value lines in file not the same!
dafoam turboDAFoam: Failure!
So I dig into the dafoam_reg_simpleDAFoam.orig log file and find errors printed by Petsc. The other logs seems have the same error.
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Unexpected data in file
[0]PETSC ERROR: Inconsistent # of rows:Matrix in file has (12060) and input matrix has (12048)
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.6.4, Apr, 12, 2016
[0]PETSC ERROR: simpleDAFoam on a real-opt named node-1 by ubuntu Mon Sep 9 06:41:57 2019
[0]PETSC ERROR: Configure options --with-shared-libraries --download-superlu_dist --download-parmetis --download-metis --with-fortran-interfaces --with-debugging=no --with-scalar-type=real --PETSC_ARCH=real-opt --download-fblaslapack
[0]PETSC ERROR: #1 MatLoad_MPIAIJ() line 2941 in /home/ubuntu/songyilei/Wind_Farm_Layout_Opt/petsc-3.6.4/src/mat/impls/aij/mpi/mpiaij.c
[0]PETSC ERROR: #2 MatLoad() line 998 in /home/ubuntu/songyilei/Wind_Farm_Layout_Opt/petsc-3.6.4/src/mat/interface/matrix.c
The Matrices dimensions are different. Is there anything wrong with the openfoam mesh or input deltaVolPointMatPlusEps_4.bin file?
The NACA0012_Incompressible case in the tutorial run well for me. So I guess my installation are correct.
Regards,
Qifeng
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.