How can I extract the rotational mass of a model using DPF?

Landon Mitchell Kanner
Landon Mitchell Kanner Member, Employee Posts: 287
100 Comments 25 Answers 25 Likes Photogenic
✭✭✭✭

I would like to use pyDPF to extract the total Rotational mass from a modal analysis in Mechanical/APDL. This is necessary to check if a sufficient number of mode shapes have been extracted in the analysis.

I can get the total mass as:

data_sources = dpf.DataSources()
data_sources.add_file_path(Modefile)
mass_op = dpf.operators.result.total_mass(data_sources=data_sources)
model_total_mass = mass_op.outputs.mass()

Can I similarly read the rotational masses from the .mode or other (e.g. .rst) file?

Answers

  • Pierre Thieffry
    Pierre Thieffry Member, Moderator, Employee Posts: 107
    5 Likes Name Dropper First Comment First Answer
    ✭✭✭✭

    Hi @Landon Mitchell Kanner I can't see a way to extract that information with DPF up to 25R1. Also looked at DPF Post without success...

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 287
    100 Comments 25 Answers 25 Likes Photogenic
    ✭✭✭✭

    Thanks @Pierre Thieffry . Would this be reasonable enhancement request for DPF or is the issue that the data is not available in the .mode and/or .rst files?

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 287
    100 Comments 25 Answers 25 Likes Photogenic
    ✭✭✭✭

    Here is a workaround that reads the .out file as seen in the question's screenshot:

    def get_rotational_masses(Outfile):
        if not os.path.exists(Outfile):
            print("ERROR  File does not exist: " + Outfile)
            return None
        masses = [0,0,0,0,0,0]
        with open(Outfile) as f:
            line = f.readline()
            while line:
                if "Rotational mass (inertia)" in line:
                    for i in range(3):
                        line = f.readline()
                        v = line.split()
                        masses[i+3] = float(v[i+1])
                    line = f.readline()
                    line = f.readline()
                    v = line.split()
                    for i in range(3):
                        masses[i] = float(v[3])
                line = f.readline()
        return masses
    
  • Pierre Thieffry
    Pierre Thieffry Member, Moderator, Employee Posts: 107
    5 Likes Name Dropper First Comment First Answer
    ✭✭✭✭

    I don't see a way to get it with *get, so they are likely not stored. Your workaround is definitely a good one.

  • Mike Rife
    Mike Rife Member, Employee Posts: 50
    First Anniversary 5 Likes First Answer 10 Comments
    ✭✭✭✭

    Hi @Landon Mitchell Kanner
    You can *get these right after a solution. Also you can *get the effective mass after the solve. The total mass and the first and second MoI are stored in the mode file if a PyDOF enhancement is a better solution for you.