Uqlink and Nastran

Hello all,
I would like to use UqLink with NASTRAN software. But it requires a very specific format for the .bdf file (the file that UqLink must change for each running realisation). Is it possible to furnish this format as a function (or something similar) in the main file to correctly write the file to run?
Many thanks,
Irma

Dear @Irma

I’m not familiar with NASTRAN, but a quick Google search showed me that the .bdf file is just a text file. Please correct me if I am wrong.
Since you already mention UQLink, I assume you have already checked the Abaqus example here:

You can find all the code and the input and template file for this example in your UQLink installation at the following path: …\Examples\UQLink\Abaqus_Truss.

If this example does not solve your problem, please provide more information about where you are stuck and what errors you are having. Ideally, you can provide your Matlab script and input file.

Best regards
Styfen

Dear Styfen,
you are wright the .bdf file can be read and modified as a text file (uqlab correctly modifies the .bdf file). However, the format used is not allowed in Nastran (Matlab does not have the correct format), so Nastran returns an error. Programming in Nastran is like Fortran: even spaces count. I need complete control over the exact string to write in the .bdf file to successfully run the program.
Best regards,
Irma

Dear @Irma

Thanks for the clarification.
Can you provide the template modified by UQLink, the .bdf file filled by UQLink and the .bdf file as it should look like?

Best regards
Styfen

Hello,
Sorry for the late reply. Here is some explanation of the format needed to write the .bdf file. The standard bdf file is formed by 8-digit with 10 fields (maximum 80 characters for each line). The structure should be like that:

$__1___||__2___||__3___||__4___||__5___||__6___||__7___||__8___||__9___||__10__|
$2345678123456781234567812345678123456781234567812345678123456781234567812345678

$ is used to comment the line in nastran
Each 8-format field may be used to define a string or a number (integer or real). In my case the first 3 fields are used to identify the element (1D) and the others 6 fields are used to identify the properties of the element (a spring). This is the format UqLab wrote (the most similar format I could find).

$__1___||__2___||__3___||__4___||__5___||__6___||__7___||__8___||__9___||__10__|
PBUSH    1       K      1.00E+09 1.00E+09 1.00E+09 1.00E+09 1.00E+09 1.00E+09

This is the correct format:

$__1___||__2___||__3___||__4___||__5___||__6___||__7___||__8___||__9___||__10__|
PBUSH    1       K      1.+09   1.+09   1.+09   1.+09   1.+09   1.+09

I hope the explanation is clear, let me know if you want more explanation.
Best regards,
Irma

Dear @Irma

I think what you want to achieve is already supported by UQLink.
Try to add to following option to your code (from this example:):

ModelOpts.Format = {'%1.8f'}

To choose the right formatting you may checkout the Matlab documentation:

I hope this helps you to solve your problem.

Best regards
Styfen

Hello Styfen,
I tried your idea, but it is not working. I tried your format %1.8f (first line) and %7.1f(second line). The last line is the format I expected to see. However, I could not find a way to fix the length of the whole part of the input. The print input does not even respect the field width I imposed with the command. Do you know how to fix this problem?

$__1___||__2___||__3___||__4___||__5___||__6___||__7___||__8___||__9___||__10__|
PBUSH    1       K      1000118370.36142492999933836.295617821000114832.367397431000030320.51257861999888566.515002851000148997.73765254
PBUSH    1       K      1000118370.4999933836.31000114832.41000030320.5999888566.51000148997.7
PBUSH    1       K      9.9996+89.9991+81.0001+99.9998+89.9988+81.0001+9
$__1___||__2___||__3___||__4___||__5___||__6___||__7___||__8___||__9___||__10__|

Best regards,
Irma

Dear @Irma

The '%1.8f' was just an example. What comes close to what you need is '%8.4g', which would give '4.83e+05' for example. If Nastran doesn’t accept the "e’', then I don’t think there is any way to correctly format large numbers using scientific notation. You could format all numbers as integers, but then the upper limit for the values is smaller than what you need. You might be able to change your units, such as to kN instead of N. Then your numbers will be smaller and their representation may fit into 8 digits using either float or integer formatting. Also note that you can format each input differently, as described in the manual:

Best regards
Styfen

Hello Styfen,
Thank you for your help. In the end, I found another way to build the input file for Nastran.
Best regards,
Irma

Dear @Irma

I am glad you found a way to solve the problem. Can you share the solution that worked for you? This will be helpful for others using Nastran with UQLab in the future.

Best regards
Styfen

Hello,
I found this function on MathWorks that given a number converts it NASTRAN small-field format string.
Best,
Irma
num2nastranBDF.m (1.5 KB)

1 Like