Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NASTRAN Float Formatting

Status
Not open for further replies.

andrew0014

Aerospace
Apr 3, 2024
4
I'm trying to locate the FORTRAN file (NASTRAN 95) that contains the code used to format floating point numbers.

I'm writing a reader program in another language and I want to optimize my code and unit-test it more completely. It'd be nice to know what NASTRAN is doing under-the-hood.

I assume NASTRAN-95 and modern NX/MSC NASTRAN (I use NX) are both written in FORTRAN, but the latter two are probably written in modern Fortran95. Am I correct in this assumption? I know very little Fortran but I should be able to work through it.


Thanks for any input!

 
Replies continue below

Recommended for you

Nastran-95 looks like Fortran 77 to me. The codebase for Nastran actually goes back to the 60's, predating quite a lot of changes to Fortran. Backward compatibility is very prized so Nastran is probably representing numbers in its own way. Nastran number formats are quirky, e.g., 7 could be written as 0.7+1

The reference to consult is here and I'd go off of that.
 
I appreciate the reply Alex.

I've read the NX User Guide and have tested as far as I can with those examples. I'm working with a model with millions and millions of elements and its just not practical to keep adding to unit tests. I need to know the underlying FORTRAN logic and use it to write my numbers.

The issue is not reading the numbers in my language (Python, and no I'm not going to use PyNASTRAN), rather formatting them for writing has turned into a giant headache.

- Andrew
 
I checked a Nastran bulk data file that I currently use and 2.85E+10 is written as 2.85+10, just as Alex described it. If I instead in Femap change to "Large Field" format the number becomes 28500000000. "Large Field" can be selected for different parts of the data in Femap.

You say that the issue in not reading, but writing. Are you trying the read a Nastran file and then write a new Nastran file after some "manipulations"?



 
ThomasH, yes I'm trying to write it back out after manipulations. I'm also not using FEMAP and will be using only the standard 8-character wide fields.

tim1958, Yes I've been reading through the programmer's manual but it is slow going. I was hoping somebody would stumble across this post and know the answer off the top of their head. I will of course update this thread if I come to the answer first in the programmer's manual.

- Andrew
 
My point was not Femap, it was an alternative explanation regarding the number format [smile].

You mention "millions and millions" of elements. I assume that you are testing your code with something smaller. Otherwise there can be reasons why the code fails that has nothing to do with the numbers format. I did some Fortran programming in uni but that was some time ago.

I tried asking ChatGPT about this and it had some info but needed more specific information. It might be helpful if you have access to it.
 
Thomas, I am testing with smaller amounts of data and the actual data.

I've also tried asking ChatGPT but I didn't get very far with it. That was a few months ago when ChatGPT got real popular; it has since been blocked at my office.

I'm going to keep searching the fortran code in nastran-95. Hopefully I'll find something. I don't suppose I can compile it with gnu-fortran?

- Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor