Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coupling with adjointShapeOptimizationFoam #8

Open
atenamsv opened this issue Jul 9, 2020 · 7 comments
Open

coupling with adjointShapeOptimizationFoam #8

atenamsv opened this issue Jul 9, 2020 · 7 comments

Comments

@atenamsv
Copy link

atenamsv commented Jul 9, 2020

I am trying to couple pimplrCentralFoam with adjointShapeOptimization in openfoam, after replacing the default simple solver (defined inside adjointShapeOptimizationFoam.C) with pimpleCentral solver and compile it successfully, I have some problems to choose the right solver for pa (adjoint pressure) and Ua (adjoint velocity). In original fvSolution file in adjointShapeOptimizationFoam it looks like:
"(p|pa)"
{
solver GAMG;
tolerance 1e-08;
relTol 0.01;
smoother GaussSeidel;
}

"(U|Ua|k|epsilon)"
{
    solver          smoothSolver;
    smoother        GaussSeidel;
    nSweeps         2;
    tolerance       1e-08;
    relTol          0.1;
}

with simple algorithm.
The question is in which way can i define the right solvers inside adjoint solver which can calculate and simulate sonic flow without errors? I receive an error that i think is because of sudden temperature drop, although i have temperature limit between 299-300 K in fvOption.
enclosed i included the fvSolution i already used, and an errorLog i receive during running this foam.
I appriciate your help in this regard.

fvSchemes.txt
fvSolution.txt
errorLog.txt

@unicfdlab
Copy link
Owner

unicfdlab commented Jul 9, 2020

Hi, from the errorLog.txt it is seen that you have a very large continuity error just at the first iteration:

time step continuity errors : sum local = 0.000428673, global = 0.000428523, cumulative = 0

Later, pressure field diverges:

max/min p: 600000/-6952.36

I would recommend to change solver to PBiCGStab with DILU preconditioner, as well as to reduce target tolerance to 1e-8 and target relTol to 0.

If it doesn't work, then you can try to reduce order of spatial approximation by changing fvSchemes:

defaultAdvScheme uwpind;
defaultAdvSchemeV upwind;

After that you can try to avoid sharp initial pressure jump (max/min p: 600000/100709) -- you can start with small pressure difference 106000/100709 and then increase it during the simulation

If the error persists, you must post here you U/p/T BCs and adjoint equations

@atenamsv
Copy link
Author

Thanks for your tips, but unfortunately the error does not vanish.
here are the required files.
createFields.txt
pa.txt
T.txt
U.txt
Ua.txt
p.txt
PadjointShapeOptimizationFoam.txt

@atenamsv
Copy link
Author

Here i could see in each loop pressure is calculating 2 time, that's where density goes minus and causes crash.
errorLog2.txt

@unicfdlab
Copy link
Owner

unicfdlab commented Jul 14, 2020

Hello, it looks like there is a lot to be done with your custom solver. As the first step, can you post here LaTeX (PDF) or Doc file with derivation of equations?

@atenamsv
Copy link
Author

I want to use adjointShapeOptimization for a compressible flow.

adjointShapeOptimizationFoam.txt
createFields.txt

The default solver in openFoam is for incompressible flow, and uses SIMPLE algorithm.
I tried to remove simple solver loop and instead include pimpleCentral loop in adjointShapeOptimization.

Here is the derivation of the equations:
adjoint derivation equation.docx

Thanks in advance.

@atenamsv
Copy link
Author

atenamsv commented Jul 15, 2020

PimpleAdjointShapeOptimizationFoam.txt

hEqn.txt
pEqn.txt
UEqn.txt

I tried to alter the solver, pEqn, UEqn and hEqn. now it is working, and goes some steps forward, but now the problem is that the temperature drops suddenly and rho goes to a big minus quantity, then it crashes.
errorLog.txt

@unicfdlab
Copy link
Owner

Hi, I think, you must add LTS support to your solver -- see https://github.com/unicfdlab/hybridCentralSolvers/blob/digitef-dev-1912/Sources/pimpleCentralFoam/pimpleCentralFoam.C and https://github.com/unicfdlab/hybridCentralSolvers/tree/digitef-dev-1912/Tutorials/compressible/LTS/ConvergingDivergingNozzle as examples.

After that, you have to try running your code w/o shape adjustment.

Also, if you use LTS, than maybe you have to add porosity alpha in temporal derivative term (I'm not sure)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants