Git Product home page Git Product logo

dafoam's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dafoam's Issues

tractionDisplacement boundary conditions causes inaccurate adjoint derivative

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.

Compilation using GCC-12.X

Description of feature

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.

Potential solution

Modify the configure setting file ( compiler flags, information about GCC-12.X, etc) in OpenFOAM-v1812?

Add support for Python 3

Type of issue

  • New feature (non-breaking change which adds functionality)

Description

DAFoam is based on Python 2.7 and is not compatible with Python 3.X. Need to fix this.

run regression test partly failed , petsc matrix dimension error

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

Add writeSensMap capability to v3 runScript

Description

"writeSensMap" flag from daoptions is not working for v3 runScript, but it works for v2.

Steps to reproduce issue

  1. Activate "writeSensMap" in a v3 script using runAdjoint mode for FFD design variable and no output file is generated
  2. Now, doing the same in a v2 script creates a sensitivity field altogether with the rest of fields.

Current behavior

The sensitivity map is not computed

Expected behavior

A sensitivity map is computed and saved in the processor*/0.*1 directories

Code versions

DAFoam v3.0.8

Propeller blade performance

I would like to optimize the shape of the propeller blade.

  1. My first objective function will be the aerodynamic performance (the ratio of thrust on the torque). How is this function integrated in daFoam?

bugs during running the incompressible optimization for the airfoil

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
image

kOmegaSST model for MRF cases

Description

The kOmegaSST model does not work well for MRF cases.

Steps to reproduce issue

  1. Run an MRF case using simpleFoam+SST
  2. Run an MRF case using DASimpleFoam+SST

Current behavior

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.

Expected behavior

The difference between the simpleFoam+SST and DASimpleFoam+SST results should be < 0.1 %.

Code versions

DAFoam 3.0.7

Notes

simpleFoam+SA and simpleFoam+SA match well. So it is likely that the DAFoam's SST model has issues for MRF cases.

help for make error

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.

SLSQP optimizer not working for v2 scripts

Description

The SLSQP optimizer does not work for v2 scripts due to a recent pyOptSarse repo update.

Steps to reproduce issue

  1. Use the docker:latest version
  2. Run the DAFoam tutorial NACA0012/incompressible/runScript_v2.py

Current behavior

An error will occur:

ValueError: failed to initialize intent(inout) array -- expected elsize=8 but got 16 -- input 'D' not compatible to 'd'

Expected behavior

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.

Code versions

  • Docker image latest

Sensitivities of alphaPorosity are messed up on mpirun

Description

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

image

The second picture shows an execution on one core with:
python runScript.py 2>&1 | tee logOpt.txt

image

The sensitivities in the first case look unphysical. Maybe it's an domain decomposition issue.

Steps to reproduce 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

  1. Delete the "sensitivity" file in "0" folder
  2. Perform "mpirun -np 4 python runScript.py 2>&1 | tee logOpt.txt" in "mpirun"
  3. Perform "python runScript.py 2>&1 | tee logOpt.txt" in "no_mpirun"
  4. Compare the sensitiviy results stored in "0" after execution

Files for reproduction:

BugReport.zip

regression test

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.

Unable to run the preProcessing.sh in the demo file.

Type of issue

What types of issue is it?
Select the appropriate type(s) that describe this issue

  • Other (please describe) - Local user to run DAFOAM

Description

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.

Steps to reproduce issue

  1. Download the tutorials and run the scripts as a local user in CentOS7

Current behavior

LogOpt.txt not getting generated and the code doesnt seem to run.

Expected behavior

Successful compilration and results in Paraview.

Code version (if relevant)

Python version:

External dependencies:

Internal packages:

How to transfer psi_ adjoint vector to adjoint variables Ua Pa Phia nuTilda_a

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

Improve velocity with use of GPU instead of cpu with tools like OGL

Description of feature

GPU with using OpenCL, HIP and CUDA can accelerate about 4 to 100 times against cpu solution.

Potential 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://www.esi-group.com/sites/default/files/resource/other/1806/8th_OpenFOAM_Conference_Cineca_Spisso_2_0.pdf

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/

Adjoint derivative from compressible kEpsilon mode is not accurate

Type of issue

The adjoint derivatives for the kEpsilon model (compressible flow) is not accurate.

Description

A description of the issue.

Steps to reproduce issue

  1. Run an airfoil case with rhoSimpleDAFoam and kEpsilon turbulence model
  2. Select the testsenshape mode
  3. The adjoint and FD do not match.

Regression tests fail with Petsc-3.9

Type of issue

  • Bugfix (non-breaking change which fixes an issue)

Description

Regression tests work up to Petsc-3.8, and they all fail when upgrading to Petsc-3.9

Total derivatives for the mesh quality functions are not accurate in parallel

Total derivatives for the mesh quality functions are not accurate in parallel

Steps to reproduce issue

  1. Run checkTotals for meshQualityKS

Current behavior

The totals are accurate in serial but not accurate in parallel.

Expected behavior

The totals should be accurate in both serial and in parallel

Code versions

  • 3.0.7

Note: This bug is caused by this issue in OpenFOAM-v1812-AD.

Rotor 37 preProcessing.sh Script issue

Type of issue

Installation

Description

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

Steps to reproduce issue

  1. Using Docker version 19.03.15 I pulled dafoam/opt-packages:v2.2.8 and started the DAFoam Docker image
  2. I tried running the ./preProcessing.sh command which resulted in a permission denied error
  3. Running sudo ./preProcessing.sh resulted in the following error: "OpenFOAM environment not found, forgot to source the OpenFOAM bashrc?"

Current behavior

Screenshot from 2021-09-16 13-23-43

Expected behavior

Mesh generation

Code version (if relevant)

Python version:

External dependencies:

Internal packages:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.