pyNastran icon indicating copy to clipboard operation
pyNastran copied to clipboard

Unexpected warnings when using large field format

Open fmamitrotta opened this issue 11 months ago • 4 comments

Summary

I'm using write_bdf with is_double=True and I get two warnings that do not appear when using is_double=False. No big deal of course but I thought about looking into this to improve the code.

The first one is pretty simple:

WARNING: write_mesh.py:1326 is_double=True...changing size from 8 to 16...

Looking into write_mesh.py I've found the following piece of code:

assert size in {8, 16}, f'size={size!r}'
    assert is_double in {True, False}, f'is_double={is_double!r}'
    if size == 8:
        if is_double is True:
            log.warning('is_double=True...changing size from 8 to 16...')
            size = 16
    else:
        assert is_double in {True, False}, f'is_double={is_double!r}'

Now, I've not seen anywhere in write_mesh.py is_double being set to True, so my understanding is that it can only be set explicitly by the user when calling the function write_mesh. For this reason, I propose that we should use log.debug instead of log.warning. Is there any other reason why you wanted to log it as a warning?

The second warning that I'm getting is the following one:

WARNING: dynamics.py:755 sid=12 v1=0.0 v2=0.0 nd=1 msglvl=0 maxset=0 shfscl=0.0 flag1=0 flag2=-1 norm=MASS alpha=0.0 nums=0

The warning happens inside the function _read_eigrl and it appears to be related to the field NUMS of the EIGRL card:

sid, v1, v2, nd, msglvl, maxset, shfscl, flag1, flag2, norm, alpha, nums = out
            norm = norm.decode('latin1').rstrip('\x00 ')
            #print('self._nastran_format =', self._nastran_format)
            if nums == 0: # and self._nastran_format == 'nx':
                op2.log.warning(f'sid={sid} v1={v1} v2={v2} nd={nd} msglvl={msglvl} maxset={maxset} '
                                f'shfscl={shfscl} flag1={flag1} flag2={flag2} norm={norm} alpha={alpha} nums={nums}')
                nums = None
                is_none = True

I'm writing the same BDF object to a bdf file, so with the same EIGRL card, running the analysis with Nastran, and reading the op2 file using read_op2(op2_filename=op2_filepath, load_geometry=True, debug=None). When I write the bdf with the standard field format, nums is equal to 538976288 (by the way, what is this number? I've seen that later in the function there is a check on it), while when I write the bdf with large field format, nums is equal to 0.

However the non-blank fields of my EIGRL card are SID, V1 and ND, so I don't see why nums gets those different values. It should be 1 by default according to MSC Nastran QRG 2022.1, and I guess it's not really needed if you are not using the parallel method. image

Reproduction

Please try the following on the attached files.

model = BDF(debug=None)
model.read_bdf("standard_field.bdf")
model.write_bdf("large_field.bdf", is_double=True)
op2_standard_field = read_op2("standard_field.op2", load_geometry=True, debug=None)
op2_large_field = read_op2("large_field.op2", load_geometry=True, debug=None)

standard_vs_large_field_files.zip

Versions

MSC Nastran 2021.4 platform.python_version() --> 3.9.16 pyNastran.__version__ --> this commit

fmamitrotta avatar Mar 14 '24 11:03 fmamitrotta