Skip to content

add support for nastran 95 generated matrix op2 file#96

Open
tumchang wants to merge 16 commits intoDLR-AE:develfrom
tumchang:feature_add-support-for-nast95-generated-matrix
Open

add support for nastran 95 generated matrix op2 file#96
tumchang wants to merge 16 commits intoDLR-AE:develfrom
tumchang:feature_add-support-for-nast95-generated-matrix

Conversation

@tumchang
Copy link

Hello Arne,

We at Bauhaus Luftfahrt have developed an aeroelastic sizing toolchain based on LoadsKernel and CPACS. Currently, we are using Nastran 95 to generate the required matrices (as we do not have a commercial Nastran license). This PR adds a function to LoadsKernel for reading the .op2 files generated by Nastran 95.

A few points regarding the implementation:

1. Dependency on pyNastran: We are currently using the pyNastran package to read the OP2 files. I noticed that the existing read_op2.py in LoadsKernel is derived from pyNastran but currently only supports reading the USET table. If we want to avoid adding pyNastran as a full dependency, the internal read_op2.py would likely need to be extended significantly.

2. Test Files: It might be not appropriate for us to share the beam FEM model publicly here on GitHub. However, if you would like an example file to test this new code, we would be happy to arrange a bilateral exchange. This would also give us a chance to provide more insight into the toolchain we’ve built.

Thank you for all your work and for making LoadsKernel publicly available—it has been incredibly helpful for our research!

best regards,
Chang Xu

E-mail: chang.xu@bauhaus-luftfahrt.net
Visionary Aircraft Concepts
Airframe & Systems Design

Bauhaus Luftfahrt e. V.
Willy-Messerschmitt-Str. 1
82024 Taufkirchen, Germany

@ArneVoss
Copy link
Collaborator

ArneVoss commented Mar 2, 2026

Hello Chang,

thank you very much for using Loads Kernel (it's always nice to see if other people find my work useful) and for your contribution!

Two things that come to my mind:
a) I triggered the checks, but I'am sure some will fail because pynastran is missing. Solution:

try:
import xy
except ImportError:
pass

And then please add pynastran as an extra package in the setup.py.

b) Instead of integrating Nastran95 in the nastran_interface.py, I propose a new nastran95_interface.py. The new class can inherit most of it's functionality, see the B2000 or CoFe interface as an example.

I was on vacation last week and will be on vacation again next week => I'm happy to have a telecon once I'm back in office to discuss any question and/or your research.

@tumchang
Copy link
Author

tumchang commented Mar 2, 2026

Hi Arne,

Thank you very much for the quick response! I will adjust the code as you suggested and let you know once I am finished. You can then trigger the test again to see if everything passes.

In the meantime, I will send you a meeting invitation shortly so that we can have a brief bilateral discussion after you are back from your holiday :)

Best regards and have a nice vacation!
Chang Xu

@tumchang tumchang marked this pull request as draft March 2, 2026 15:26
@tumchang tumchang marked this pull request as ready for review March 3, 2026 15:33
@tumchang tumchang marked this pull request as draft March 4, 2026 15:52
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is happening here? Why is it necessary to modify this op2 reader, when you actually use pyNastran's OP2 reader?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and a log message would be better than a print statement

Copy link
Author

@tumchang tumchang Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Arne,

For the nastran95 generated USET matrix, it seems not to be binary (with 1 and 2), but with quite weird numbers (see image), I guess this might come from the windows operating system (32bit or 64 bit). But I haven't dive deeper into this matter, this is just a temporary solution to this problem

Image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and a log message would be better than a print statement

sure, I will change that to a log message

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about reading the Nastran 95 USET via pyNastran? Is the same happening ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyNastran is unfortunally not able to read the USET generated by nastran95, probably due to the same reason, pyNastran think the USET table is corrupted

@ArneVoss
Copy link
Collaborator

ArneVoss commented Mar 5, 2026

One problem I see when using pyNastran is that it installs numpy-1.26.4. This causes the long term integration test to fail because of a missing function and differences in eigenvalues...

Fixed.

@ArneVoss ArneVoss marked this pull request as ready for review March 5, 2026 14:11
@tumchang
Copy link
Author

tumchang commented Mar 5, 2026

One problem I see when using pyNastran is that it installs numpy-1.26.4. This causes the long term integration test to fail because of a missing function and differences in eigenvalues...

Fixed.

Thanks a lot Arne for pulling through this

@ArneVoss
Copy link
Collaborator

ArneVoss commented Mar 5, 2026

What I'm wondering is if it's possible to have some tests that cover the new interface? In this way you make sure that the interface will continue to work as you intended in the future.

Also, a tutorial would be nice that gives some instructions on how to use the interface and especially on how to install, use and obtain the matrices in OP2 from Nastran 95. Personally, I tested it a few years ago and found that some elements have a different nomenclature, so that our Nastran models were not directly compatible with Nastran 95.

Update: I looked at my testcase and I see that I wasn't able to use the RBE2 / CRIGD1 elements properly. The points describing my leading and trailing edges should be connected to the main beam but ended up unconnected:

0*** USER WARNING MESSAGE 2015, EITHER NO ELEMENTS CONNECTED TO EXTERNAL GRID POINT 331001
OR IT IS CONNECTED TO A RIGID ELEMENT OR A GENERAL ELEMENT.

It sounds like you could shed some light on this?

@tumchang
Copy link
Author

tumchang commented Mar 5, 2026

What I'm wondering is if it's possible to have some tests that cover the new interface? In this way you make sure that the interface will continue to work as you intended in the future.

Also, a tutorial would be nice that gives some instructions on how to use the interface and especially on how to install, use and obtain the matrices in OP2 from Nastran 95. Personally, I tested it a few years ago and found that some elements have a different nomenclature, so that our Nastran models were not directly compatible with Nastran 95.

Update: I looked at my testcase and I see that I wasn't able to use the RBE2 / CRIGD1 elements properly. The points describing my leading and trailing edges should be connected to the main beam but ended up unconnected:

0*** USER WARNING MESSAGE 2015, EITHER NO ELEMENTS CONNECTED TO EXTERNAL GRID POINT 331001 OR IT IS CONNECTED TO A RIGID ELEMENT OR A GENERAL ELEMENT.

It sounds like you could shed some light on this?

  1. I would add a simple test for the nastran95 in a few days
  2. For the Nastran 95 approach, I remember the RBE2 should be renamed to CRBE2, and for some cards the line continuation string is a must (like ......+CORD2R
    +CORD2R ........)
    And the Executive control deck of Nastran95 is also a little bit different from MSC Nastran

I also spent a large amount of time to make MSC Nastran bdf file to work in nastran 95 in the last year :)
I will prepare a presentation for you for our bi-lateral meeting, and in the mean time I could try modify the DC3 bdf file in LK to make it nastran95 compatible and send it to you

Best
Chang

@tumchang
Copy link
Author

tumchang commented Mar 6, 2026

Hi Arne,

I tried a bit to make your DC3 model to be nastran95 compatible, but it would be a lot of manual work required, I only managed to change the left-wing that Nastran95 is not giving any fatal warnings for left-wing.

there are 3 things to highlight:

  1. RBE2 should be renamed to CRBE2
  2. nastran 95 doesnt support include command, so all the elements should be in one single bdf file.
  3. the line continuation symbol "+" might be only supported by MSC Nastran, in nastran95, the line continuation symbol should be unique for each line

I have attached the text bdf file here, maybe you can take a brief look and let me know if there are any further things that I can help you with!

DC3.txt

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

Successfully merging this pull request may close these issues.

2 participants