Comments (14)
Thanks for the update. So this would suggest that the issue is not related to TACS. I think MELD is also ok because we get good derivatives with MELD using other aero codes. If you want be sure about MELD, you can use the same MELD and TACS but separate ADflow. The MELD builder constructor requires an aero_builder, but that's just for sizing its vectors, so it should be ok to give the MELD constructor just one of the ADflow builders then use the meld builder for both scenarios.
from mphys.
Patch for the aerostructural example to produce the above results
--- mphys_as_2scenario.py 2023-04-30 21:15:04.388398203 -0400
+++ mphys_as_2scenario-New.py 2023-04-30 21:40:56.424473571 -0400
@@ -17,7 +17,7 @@
parser = argparse.ArgumentParser()
parser.add_argument("--xfer", default="meld", choices=["meld", "rlt"])
-parser.add_argument("--level", type=str, default="L1")
+parser.add_argument("--level", type=str, default="L3")
args = parser.parse_args()
if args.xfer == "meld":
@@ -147,8 +147,8 @@
aoa1 = 5.0
ap1 = AeroProblem(
name="maneuver",
- mach=0.85,
- altitude=10000,
+ mach=0.5,
+ altitude=0,
alpha=aoa1,
areaRef=45.5,
chordRef=3.25,
@@ -181,17 +181,18 @@
prob = om.Problem()
prob.model = Top()
model = prob.model
-prob.setup()
+prob.setup(mode="rev")
om.n2(prob, show_browser=False, outfile="mphys_as_adflow_tacs_%s_2pt.html" % args.xfer)
prob.run_model()
+prob.check_totals(of=["cruise.aero_post.cd","maneuver.aero_post.cd"], wrt=["aoa0", "aoa1"], compact_print=True, step=1e-5)
-prob.model.list_outputs()
+# prob.model.list_outputs()
-if prob.model.comm.rank == 0:
- print("Cruise")
- print("cl =", prob["cruise.aero_post.cl"])
- print("cd =", prob["cruise.aero_post.cd"])
-
- print("Maneuver")
- print("cl =", prob["maneuver.aero_post.cl"])
- print("cd =", prob["maneuver.aero_post.cd"])
+# if prob.model.comm.rank == 0:
+# print("Cruise")
+# print("cl =", prob["cruise.aero_post.cl"])
+# print("cd =", prob["cruise.aero_post.cd"])
+
+# print("Maneuver")
+# print("cl =", prob["maneuver.aero_post.cl"])
+# print("cd =", prob["maneuver.aero_post.cd"])
from mphys.
@A-CGray , can you try a newer version of OpenMDAO? We found some parallel bugs related to different conventions for when to do an allreduce(). TACS and OpenMDAO were doing it one way, but most of the other codes including ADflow were doing it a different way. This resulted in POEM 75. This convention change is TACS 3.2.1, but you'll need OM 3.25 or later.
from mphys.
@A-CGray , can you try a newer version of OpenMDAO? We found some parallel bugs related to different conventions for when to do an allreduce(). TACS and OpenMDAO were doing it one way, but most of the other codes including ADflow were doing it a different way. This resulted in POEM 75. This convention change is TACS 3.2.1, but you'll need OM 3.25 or later.
Sorry I missed openmdao from the list of updated packages for the second set of results. This issue showed up in both OM 3.20 and 3.26. Also, all the results here are run in serial so this is not a parallelism issue
from mphys.
Did some more experimenting using a single builder or separate builders for each scenario, and checking derivatives w.r.t both aerodynamic and structural DVs. The results below are run with the following package versions:
Package Version
----------------------------- -----------
adflow 2.8.0
funtofem 0.2
mphys Current main branch
openmdao 3.26.1.dev0 (current main branch)
tacs 3.2.1
And the following calls to check_totals
prob.check_totals(
of=[
"cruise.aero_post.cd",
"maneuver.aero_post.cd",
"cruise.ks_vmfailure",
"maneuver.ks_vmfailure",
],
wrt=["aoa0", "aoa1"],
method="fd",
step=1e-4,
compact_print=True,
out_stream=f,
abs_err_tol=1e6,
rel_err_tol=1e-2,
)
prob.check_totals(
of=[
"cruise.aero_post.cd",
"maneuver.aero_post.cd",
"cruise.ks_vmfailure",
"maneuver.ks_vmfailure",
],
wrt=["dv_struct"],
method="fd",
step=1e-4,
compact_print=True,
directional=True,
out_stream=f,
abs_err_tol=1e6,
rel_err_tol=1e-2,
)
Using the same builders for both cruise and maneuver scenarios
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| of '<variable>' | wrt '<variable>' | calc mag. | check mag. | a(cal-chk) | r(cal-chk) | error desc |
+=========================+==================+=============+=============+=============+=============+============+
| 'cruise.aero_post.cd' | 'aoa0' | 6.9902e-04 | 1.6967e-03 | 9.9766e-04 | 5.8801e-01 | >REL_TOL |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'cruise.ks_vmfailure' | 'aoa0' | 1.1390e-01 | 1.1045e-01 | 3.4507e-03 | 3.1243e-02 | >REL_TOL |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.aero_post.cd' | 'aoa1' | 3.1859e-03 | 3.1859e-03 | 3.9210e-08 | 1.2307e-05 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.ks_vmfailure' | 'aoa1' | 1.1160e-01 | 1.1160e-01 | 8.1252e-07 | 7.2807e-06 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| of '<variable>' | wrt '<variable>' | calc mag. | check mag. | a(cal-chk) | r(cal-chk) | error desc |
+=========================+===================+=============+=============+=============+=============+============+
| 'cruise.aero_post.cd' | (d)('dv_struct',) | 1.8737e-04 | 7.9080e-04 | 9.7817e-04 | 1.2369e+00 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'cruise.ks_vmfailure' | (d)('dv_struct',) | 1.3503e-01 | 1.5675e-01 | 2.1719e-02 | 1.3856e-01 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.aero_post.cd' | (d)('dv_struct',) | 2.5000e-02 | 2.7090e-02 | 2.0903e-03 | 7.7162e-02 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.ks_vmfailure' | (d)('dv_struct',) | 1.5108e+01 | 1.7509e+01 | 2.4013e+00 | 1.3714e-01 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
Using separate ADflow, TACS and MELD builders for each scenario
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| of '<variable>' | wrt '<variable>' | calc mag. | check mag. | a(cal-chk) | r(cal-chk) | error desc |
+=========================+==================+=============+=============+=============+=============+============+
| 'cruise.aero_post.cd' | 'aoa0' | 1.6964e-03 | 1.6967e-03 | 3.1186e-07 | 1.8381e-04 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'cruise.ks_vmfailure' | 'aoa0' | 1.1040e-01 | 1.1045e-01 | 4.2086e-05 | 3.8105e-04 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.aero_post.cd' | 'aoa1' | 3.1859e-03 | 3.1859e-03 | 3.9173e-08 | 1.2296e-05 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.ks_vmfailure' | 'aoa1' | 1.1160e-01 | 1.1160e-01 | 8.1325e-07 | 7.2873e-06 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| of '<variable>' | wrt '<variable>' | calc mag. | check mag. | a(cal-chk) | r(cal-chk) | error desc |
+=========================+===================+=============+=============+=============+=============+============+
| 'cruise.aero_post.cd' | (d)('dv_struct',) | 7.1770e-04 | 7.9080e-04 | 7.3100e-05 | 9.2438e-02 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'cruise.ks_vmfailure' | (d)('dv_struct',) | 1.3593e-01 | 1.5675e-01 | 2.0816e-02 | 1.3280e-01 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.aero_post.cd' | (d)('dv_struct',) | 2.5000e-02 | 2.7090e-02 | 2.0900e-03 | 7.7151e-02 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.ks_vmfailure' | (d)('dv_struct',) | 1.5108e+01 | 1.7509e+01 | 2.4013e+00 | 1.3714e-01 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
Using a single ADflow builder and separate TACS and MELD builders
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| of '<variable>' | wrt '<variable>' | calc mag. | check mag. | a(cal-chk) | r(cal-chk) | error desc |
+=========================+==================+=============+=============+=============+=============+============+
| 'cruise.aero_post.cd' | 'aoa0' | 6.9902e-04 | 1.6967e-03 | 9.9766e-04 | 5.8801e-01 | >REL_TOL |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'cruise.ks_vmfailure' | 'aoa0' | 1.1390e-01 | 1.1045e-01 | 3.4507e-03 | 3.1243e-02 | >REL_TOL |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.aero_post.cd' | 'aoa1' | 3.1859e-03 | 3.1859e-03 | 3.9210e-08 | 1.2307e-05 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.ks_vmfailure' | 'aoa1' | 1.1160e-01 | 1.1160e-01 | 8.1252e-07 | 7.2807e-06 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| of '<variable>' | wrt '<variable>' | calc mag. | check mag. | a(cal-chk) | r(cal-chk) | error desc |
+=========================+===================+=============+=============+=============+=============+============+
| 'cruise.aero_post.cd' | (d)('dv_struct',) | 1.8737e-04 | 7.9080e-04 | 9.7817e-04 | 1.2369e+00 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'cruise.ks_vmfailure' | (d)('dv_struct',) | 1.3503e-01 | 1.5675e-01 | 2.1719e-02 | 1.3856e-01 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.aero_post.cd' | (d)('dv_struct',) | 2.5000e-02 | 2.7090e-02 | 2.0903e-03 | 7.7162e-02 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.ks_vmfailure' | (d)('dv_struct',) | 1.5108e+01 | 1.7509e+01 | 2.4013e+00 | 1.3714e-01 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
Using a single TACS builder and separate ADflow and MELD builders
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| of '<variable>' | wrt '<variable>' | calc mag. | check mag. | a(cal-chk) | r(cal-chk) | error desc |
+=========================+==================+=============+=============+=============+=============+============+
| 'cruise.aero_post.cd' | 'aoa0' | 1.6964e-03 | 1.6967e-03 | 3.1186e-07 | 1.8381e-04 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'cruise.ks_vmfailure' | 'aoa0' | 1.1040e-01 | 1.1045e-01 | 4.2086e-05 | 3.8105e-04 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.aero_post.cd' | 'aoa1' | 3.1859e-03 | 3.1859e-03 | 3.9173e-08 | 1.2296e-05 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.ks_vmfailure' | 'aoa1' | 1.1160e-01 | 1.1160e-01 | 8.1325e-07 | 7.2873e-06 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| of '<variable>' | wrt '<variable>' | calc mag. | check mag. | a(cal-chk) | r(cal-chk) | error desc |
+=========================+===================+=============+=============+=============+=============+============+
| 'cruise.aero_post.cd' | (d)('dv_struct',) | 7.1770e-04 | 7.9080e-04 | 7.3100e-05 | 9.2438e-02 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'cruise.ks_vmfailure' | (d)('dv_struct',) | 1.3593e-01 | 1.5675e-01 | 2.0816e-02 | 1.3280e-01 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.aero_post.cd' | (d)('dv_struct',) | 2.5000e-02 | 2.7090e-02 | 2.0900e-03 | 7.7151e-02 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.ks_vmfailure' | (d)('dv_struct',) | 1.5108e+01 | 1.7509e+01 | 2.4013e+00 | 1.3714e-01 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
To summarise:
- Switching from a single ADflow builder to separate ADflow builders improves the accuracy of derivatives of cruise aero functions w.r.t aero variables by 4 orders of magnitude, and w.r.t structural DVs by 1 order of magnitude
- Switching from a single TACS builder to separate TACS builders has no noticeable effect on the accuracy of the derivatives
- The accuracy of struct and aero functions in both scenarios w.r.t structural DVs is not great, but I think this is an unrelated issue.
from mphys.
The MELD builder constructor requires an aero_builder, but that's just for sizing its vectors, so it should be ok to give the MELD constructor just one of the ADflow builders then use the meld builder for both scenarios.
Ah, that's good to know, I hadn't tried that combo yet because I saw the MELD builder needed that aero and structu builders as inputs. Will give it a go now
from mphys.
Using a single TACS and MELD builder, separate ADflow builders
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| of '<variable>' | wrt '<variable>' | calc mag. | check mag. | a(cal-chk) | r(cal-chk) | error desc |
+=========================+==================+=============+=============+=============+=============+============+
| 'cruise.aero_post.cd' | 'aoa0' | 1.6964e-03 | 1.6967e-03 | 3.1186e-07 | 1.8381e-04 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'cruise.ks_vmfailure' | 'aoa0' | 1.1040e-01 | 1.1045e-01 | 4.2086e-05 | 3.8105e-04 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.aero_post.cd' | 'aoa1' | 3.1859e-03 | 3.1859e-03 | 3.9173e-08 | 1.2296e-05 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.ks_vmfailure' | 'aoa1' | 1.1160e-01 | 1.1160e-01 | 8.1325e-07 | 7.2873e-06 | |
+-------------------------+------------------+-------------+-------------+-------------+-------------+------------+
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| of '<variable>' | wrt '<variable>' | calc mag. | check mag. | a(cal-chk) | r(cal-chk) | error desc |
+=========================+===================+=============+=============+=============+=============+============+
| 'cruise.aero_post.cd' | (d)('dv_struct',) | 7.1770e-04 | 7.9080e-04 | 7.3100e-05 | 9.2438e-02 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'cruise.ks_vmfailure' | (d)('dv_struct',) | 1.3593e-01 | 1.5675e-01 | 2.0816e-02 | 1.3280e-01 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.aero_post.cd' | (d)('dv_struct',) | 2.5000e-02 | 2.7090e-02 | 2.0900e-03 | 7.7151e-02 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
| 'maneuver.ks_vmfailure' | (d)('dv_struct',) | 1.5108e+01 | 1.7509e+01 | 2.4013e+00 | 1.3714e-01 | >REL_TOL |
+-------------------------+-------------------+-------------+-------------+-------------+-------------+------------+
from mphys.
Ok. That points to something in ADflow. @anilyil will need to help from here.
from mphys.
Yeah I discussed with @anilyil , for now I will get by with the multiple builder workaround and after the Aviation rush we will take a look into this together
from mphys.
My guess right now is with mesh warping. We do use adflow in multipoint aeropropulsive problems and derivatives are fine. The main difference is the mesh component being inside the coupling group here. And that's also somewhere I can see some assumptions getting broken. As @A-CGray said, we will get to this after the aviation rush, since he has a quick workaround for now.
from mphys.
Sounds good. If you can force qinf = 0, and check the same functions you should be able to isolate the effect of the mesh deformation by breaking the coupling loop. That is, if all your derivatives match with qinf=0, then it is probably meshdef.
from mphys.
I guess you could get the same effect by setting the linear and nonlinear solvers to RunOnce solvers
from mphys.
@A-CGray, is it ok to close this issue since you've determined that is the UM mesh wrapping?
from mphys.
@A-CGray, is it ok to close this issue since you've determined that is the UM mesh wrapping?
Yeah sorry, I should've done that a while ago, go ahead
from mphys.
Related Issues (20)
- PyPI release HOT 1
- Module Error for aerostructural case HOT 5
- Standardize the aerothermal scenario and add example
- Enable coupling with multiple bodies
- Static Aeroelastic Trim
- Structural solver with multiple load sources
- Documentation for Geometry Builders
- Geometry support for multipoint control surface motion
- Sharing of mesh connectivity information
- Establish user-friendly way to handle optimizations split over multiple HPC jobs
- Reorganize Documentation
- Update examples directory to make starting with MPhys easier
- Add CI for code maintenance actions
- pyGeo examples are broken
- Fix automated OpenMDAO options documentation HOT 1
- Tacs and meld derivative tests failing HOT 2
- Assigning multiple design surfaces for aerodynamic optimization HOT 2
- Standardize the aeropropulsive scenario and add an example HOT 1
- Move dvcon to a matrix-based API for partials HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mphys.