CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Adjoint method (https://www.cfd-online.com/Forums/openfoam-solving/85057-adjoint-method.html)

Jens February 16, 2011 08:28

Adjoint method
 
Hi,

Is there anybody who have experiences with the adjoint method to optimise a
geometry?
I implemented the adjoint equations based on papers and work of C. Othmers:

=================================================
tmp<fvVectorMatrix> adUEqn
(
...

);


=================================================

I think my problem is in the pressure correction. In all papers that i found they use the
simple method and i did it in the same way:

=================================================
adp.boundaryField().updateCoeffs();

...
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix adpEqn
(
...
);


=================================================


If I calculated adU there are values with 10^(11) or sometimes 10^(30) near the outlet-patch. I think that is not correct ;)

Thanks for every comment.
Regards,
Jens

kalle February 17, 2011 02:50

Hi!

I never tried this stuff, but I read somewhat about it earlier... are you sure about those boundary conditions? If I understood correctly, your cost function should come into the BC's for the adjoint eqs (if the cost function is described as a integral function over the domain). Check 'eq' 44-48 in C. Othmer, Int. J. Numer. Meth. Fluids 2008; 58:861–877

Regard,
K

boger February 17, 2011 07:59

Jens,

Did the equations converge?

Jens February 17, 2011 08:34

Hi,

Thanks for the replies.

@Kalle
I see your point and you are right, the BC's are one problem to solve and the equations are very sensitive to the BC's but the problem is ... that leads me to

@boger
No, that is the "main" problem/issue. The normal velocity converge but "adjoint U" dont converge. The problem is, if i print the divergence of adjoint velocity the values are very hight (16.xx or 0.1) but the priority/task of the pressure correction is the divergence of adjoint U is equal to zero. Well, I think the first problem to solve is that the pressure correction solve -> div(adjoint U) = 0. Isn't it?
The question is, is there a term missing or something else?

Regards,
Jens

fumiya March 10, 2011 01:47

Hi Jens,

Is your pressure equation right?
I think the right hand side of this equation is the divergence of the adjoint velocity field.

Regards,
Fumiya

boger March 10, 2011 07:14

Good point, Fumiya - you're correct!

Jens March 10, 2011 07:49

Thanks for your help and hints.
I got also a few hints by C. Othmer and the problem was the pressure equation.

fumiya March 10, 2011 21:49

In my calculations, the continuity error of the adjoint velocity field does not drop compared to that of the primal velocity field.

1) Though there may be problems in my code, do the adjoint equations have this tendency?
2) Are the adjoint equations sensitive to the boundary conditions?
Do they converge with the same boundary conditions as the primal ones?

I would be grateful if you could share findings from your computations with the original solver from Dr. Othmer.

Regards,
Fumiya

Jens March 11, 2011 03:36

Quote:

Originally Posted by fumiya (Post 298935)
1) Though there may be problems in my code, do the adjoint equations have this tendency?
2) Are the adjoint equations sensitive to the boundary conditions?
Do they converge with the same boundary conditions as the primal ones?

The second problem was the boundary conditions ("kalle" his hint was right). You need special boundary conditions derived from the adjoint equations and the cost function on the boundary.

Regards,
Jens

bastil March 12, 2011 05:55

Quote:

Originally Posted by Jens (Post 298956)
You need special boundary conditions derived from the adjoint equations and the cost function on the boundary

Jens,

thanks for the findings. How do these BCs look like?
Would you mind posting your final case and solver? Thanks.

Regards Bastian.

Jens March 13, 2011 10:39

Quote:

Originally Posted by bastil (Post 299082)
Jens,

thanks for the findings. How do these BCs look like?
Would you mind posting your final case and solver? Thanks.

Regards Bastian.

Unfortunately, I cant.

Regards,
Jens

fumiya March 14, 2011 21:45

I would be grateful if you could post contour plots of the adjoint pressure and
velocity fields for a simple duct when the cost function is dissipated power
and flow is laminar.

I would like to use these data for comparison with my results.
I will prepare a case if it could save your work.

Regards,
Fumiya

fumiya March 16, 2011 01:52

1 Attachment(s)
I calculated surface sensitivities according to Dr. Othmer's article
when the cost function is dissipated power. In this calculation,
outlet boundary conditions are not properly imposed. I have to
implement new boundary conditions to obtain more precise results.

Regards,
Fumiya

fumiya March 18, 2011 03:11

SIMPLE algorithm
 
I'm implementing the adjoint solver in OpenFOAM by myself.
Any comments are appreciated.

***************SIMPLE algorithm***************

/*--------------------------------------------------*\
//Momentum predictor step
\*--------------------------------------------------*/
//Define the equation for adU(adjoint velocity field)
tmp<fvVectorMatrix> adUEqn
(
fvm::div(-phi,adU) //Flux phi is obtained from the primal flow solutions
- (fvc::grad(adU) & U)
+ turbulence->divDevReff(adU)
);

//Under-relax(Inertial relaxation) the equation for adU
adUEqn().relax();

//Solve the momentum predictor using the last known adp(adjoint pressure field) on the RHS.
//This gives us a adjoint velocity field that is "not divergence free", but approximately satisfies momentum.
eqnResidual = solve
(
adUEqn() == -fvc::grad(adp)
).initialResidual();

maxResidual = max(eqnResidual, maxResidual);

//Update the boundary conditions for adp
adp.boundaryField().updateCoeffs();


/*--------------------------------------------------*\
//Pressure solution step(estimate a new pressure field
//that satisfies zero adjoint velocity divergence)
\*--------------------------------------------------*/



To be continued . . .

fumiya June 12, 2011 21:09

I have run several cases and found it difficult to obtain a converged
solution. I think it is related to the adjoint transpose convection term.

What should I do to improve convergence of the adjoint equations?


Best regards,
fumiya


All times are GMT -4. The time now is 18:01.