Can I change the reference frame to calculated kinetic energy?

Iwona Wyrębska_20318
Iwona Wyrębska_20318 Altair Community Member
edited January 31 in Community Q&A

Hi Everyone,

I have a question about kinetic energy. This is calculated in relation to the global reference frame. Can I change it? I have four cylinders, and I need particle energy in each cylinder relative to the axis of that cylinder (picture - four points). 

One more question about collisions' energy: which parameter best describes it?

I will be very grateful for any help.

 

Best regards 

Iwona 

+Z.jpg 35.5K
1.jpg 70.3K
2.jpg 73.2K
Tagged:

Answers

  • Stephen Cole
    Stephen Cole
    Altair Employee
    edited November 2023

    Hi Iwona,

    The reference frame is only global currently.  You could export the particles velocity at any point in time in the global frame and if you know the motion of the geometry and the time it would be possible to convert.,  Or consider an EDEMpy script to get and format the data.  For example you could use this as a starting point:

     

    https://community.altair.com/community/en/script-for-computing-radial-and-tangential-velocity-components-of-a?id=kb_article&sysparm_article=KB0122332

    EDEMpy e-learning - https://learn.altair.com/enrol/index.php?id=228

     

    By Default EDEM provides contact information which is instantaneous data about what is happening at that save point.  Collisions are time-dependent (one collision is made from multiple contacts).

     

    We are looking at improving the energy loss options in EDEM and we have an API model here- https://community.altair.com/community/en/edem-api-contact-model-example-energy-loss?id=kb_article&sysparm_article=KB0121821

     

    Regards

    Stephen

     

     

  • Iwona Wyrębska_20318
    Iwona Wyrębska_20318 Altair Community Member
    edited December 2023

    Dear Stephen,

    First, I want to thank you, and I apologize for not responding; I was out of reach. I followed your advice and wanted to use the EDEMpy script, but unfortunately, it's not working.

    I tried to use the script from the website, and some errors occurred:

    image

    After that, I changed line 123:

    WAS: print(f"No {deck.timestep[time[m]].particle[n].name} at timestep {deck.timestepValues[time[m]]}")

    NOW: print("No", xx1, "at timestep", xx2)

    Two variables were added in the try block as follows:

     

    for n in range(n_particles):

                        Try:

                            #get particle velocity vectors

                            x_vel = deck.timestep[time[m]].particle[n].getXVelocities()

                            y_vel = deck.timestep[time[m]].particle[n].getYVelocities()

                            z_vel = deck.timestep[time[m]].particle[n].getZVelocities()

     

                            particle_velocities = np.column_stack((x_vel, y_vel, z_vel))

                            particle_positions = deck.timestep[time[m]].particle[n].getPositions()

                            xx1 = deck.timestep[time[m]].particle[n]

                            xx2 = deck.timestepValues[time[m]]

     

                        Except:

                            print("No", xx1, "at timestep", xx2)

                            #print(f"No {deck.timestep[time[m]].particle[n]} at timestep {deck.timestepValues[time[m]]}")

                            continue

    After running the script in that form, the following error occurred:

    image

    When I tried to remove arguments mode and warningBehavior the script doesn’t run.

    Here, I don’t know what I should do.

     

    Can you help me ?

     

    Best regards 

    Iwona

  • Renan
    Renan
    Altair Employee
    edited December 2023

    Dear Stephen,

    First, I want to thank you, and I apologize for not responding; I was out of reach. I followed your advice and wanted to use the EDEMpy script, but unfortunately, it's not working.

    I tried to use the script from the website, and some errors occurred:

    image

    After that, I changed line 123:

    WAS: print(f"No {deck.timestep[time[m]].particle[n].name} at timestep {deck.timestepValues[time[m]]}")

    NOW: print("No", xx1, "at timestep", xx2)

    Two variables were added in the try block as follows:

     

    for n in range(n_particles):

                        Try:

                            #get particle velocity vectors

                            x_vel = deck.timestep[time[m]].particle[n].getXVelocities()

                            y_vel = deck.timestep[time[m]].particle[n].getYVelocities()

                            z_vel = deck.timestep[time[m]].particle[n].getZVelocities()

     

                            particle_velocities = np.column_stack((x_vel, y_vel, z_vel))

                            particle_positions = deck.timestep[time[m]].particle[n].getPositions()

                            xx1 = deck.timestep[time[m]].particle[n]

                            xx2 = deck.timestepValues[time[m]]

     

                        Except:

                            print("No", xx1, "at timestep", xx2)

                            #print(f"No {deck.timestep[time[m]].particle[n]} at timestep {deck.timestepValues[time[m]]}")

                            continue

    After running the script in that form, the following error occurred:

    image

    When I tried to remove arguments mode and warningBehavior the script doesn’t run.

    Here, I don’t know what I should do.

     

    Can you help me ?

     

    Best regards 

    Iwona

    Hi Iwona,

    Which version of EDEM are you using? I downloaded the script and ran it as is and it worked just fine.

    The error message you posted says that the Deck function wasn't expecting a "mode" as an input option. This suggest that you are using an older version of EDEM, since the mode option is available since the 2022.3 version of EDEM.

    In the case you're using EDEM 2022.3 (or a newer version), removing the mode="w" option, will tell EDEMpy to open the he deck in the default mode, which is read-only. If that's the case then you won't be able to write anything to your deck, meaning you won't be able to create the custom properties.

    Finally, when trying to print a particle name you should do deck.timestep[t].particle[n].name. If you don't add the .name at the end then python will try to print an object, from the Particle class, which really can't be printed.

    Best regards,

    Renan

  • Iwona Wyrębska_20318
    Iwona Wyrębska_20318 Altair Community Member
    edited January 31

    Hi Iwona,

    Which version of EDEM are you using? I downloaded the script and ran it as is and it worked just fine.

    The error message you posted says that the Deck function wasn't expecting a "mode" as an input option. This suggest that you are using an older version of EDEM, since the mode option is available since the 2022.3 version of EDEM.

    In the case you're using EDEM 2022.3 (or a newer version), removing the mode="w" option, will tell EDEMpy to open the he deck in the default mode, which is read-only. If that's the case then you won't be able to write anything to your deck, meaning you won't be able to create the custom properties.

    Finally, when trying to print a particle name you should do deck.timestep[t].particle[n].name. If you don't add the .name at the end then python will try to print an object, from the Particle class, which really can't be printed.

    Best regards,

    Renan

    Dear Renan,

    it's working now! Thank you!

    I'm wondering if in my case this script wouldn't be more appropriate: EDEMpy script that computes particle velocity and path length to a rotating geometry.

    "The attached script computes the particle velocity relative to a rotating geometry in EDEM and writes the results into particle properties called Relative velocity and Relative path length. Example results for the generic bin blender model included with the script are shown below."- whether this script calculates the velocity of particles relative to the centre of mass of the selected geometry? I just want to be sure:)

     

    Best regards 

    Iwona