-
Notifications
You must be signed in to change notification settings - Fork 99
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
Incorrect AP variable function sensitivities for simple 2D shock problem #208
Comments
The beta derivative is wrong because of a bug in ADflow. The value needs to be converted from 1/radians to 1/degrees as done for alpha: Lines 3599 to 3600 in 196caaa
Did you use a step size of 1e-5 for all the DVs? If so, I suspect the step size is too small for P and T. I would recommend doing a step size study or comparing against complex step. |
I see, the 180/pi factor does correct the beta derivative. I'll correct for that in my work. Given that, I do suspect that the other derivatives are a case of the step size being too small, but I'll have to check tomorrow. Thanks! |
While the
I tried complex step (
Code for this:
|
Thanks for the detailed report. I am able to reproduce the error. It looks like a bug, but I don't have a good idea on how to fix it right now. Please update the issue if you find any leads. |
I got some time to investigate this myself a bit, but I haven't been able to find anything conclusive. The only insight I have is that I'm inclined to trust the AD pressure derivative because the altitude derivative depends on it in the chain rule, and that derivative is correct with the value given by the AD pressure derivative. From pyADFlow:
If the altitude derivative used the finite-differenced/complex-step pressure derivative, it would be way off. This still doesn't explain why the AD pressure derivative disagrees with finite difference, but it lends credibility to the idea that the pressure derivative is actually correct. I don't have any further insight, however. |
Description
I have been using ADFlow to solve a 2D CFD portion of a problem involving a shock impinging on a flat deforming surface, and I am trying to find the sensitivity of the viscous drag on the surface with respect to the shock impingement angle. The shock angle determines the flow properties downstream of the shock (mach, beta, P, T), which I'm trying to get the sensitivies of through the corresponging AeroProblem variables. Beta refers to the angle of attack instead of alpha, since the 2D plane of the mesh is defined on x-z coordinates.
The problem is defined somewhat strangely through the CGNS mesh. The shock originates from the top left corner of the domain. The upstream properties are hard-coded in the CGNS mesh as a supersonic inflow BC on the left surface. The top surface is a far-field BC with properties defined through the AeroProblem, representing the downstream properties of the shock as defined through oblique shock relations. The bottom surface is an inviscid BC up from x= 0 to x=1, and a viscous heat flux wall past that. The right surface is a supersonic outflow BC. As a result, the AeroProblem variables should control only the top surface boundary conditions, allowing for changes in the angle of the shock originating from the top left. The surfaces along the y axis are symmetry planes, and the mesh is 1 cell wide in the y direction.
The derivative of the viscous drag on the bottom surface
cdv
with respect tomach
is correct to 3 places, but thebeta
,P
, andT
derivatives are way off. I suspect this is a consequence of the highly irregular mesh definition, but I'm not sure. I would provide the CGNS mesh, but I can't seem to do that in a bug report here.Steps to reproduce issue
Behavior
The only correct gradient that I have found for this configuration is
cdv
w.r.t.mach
. Top number is approximated via central differencing, bottom number is given byevalFunctionsSens
cdv
w.r.t.beta
:cdv
w.r.t.P
:cdv
w.r.t.T
:Code versions
The text was updated successfully, but these errors were encountered: