Basis of the Weight property?

  • Mdkar
    25th Mar 2020 Member 0 Permalink

    It seems the weights of all elements are integers between 1 and 100. Is there any reason for this or is this arbitrary? Are some of the numbers based on real life densities? If I were to modify Weight to be of type float and then change weights of all elements that exist irl to their approximate actual densities in g/cm^3 would there be any problems in the simulation? (e.g. WATR = 1.00, SLTW = 1.025, TTAN = 4.506, IRON = 7.874)

  • jacob1
    25th Mar 2020 Developer 0 Permalink
    There isn't any real point to doing this. The weight property is in fact arbitrary. It serves no purpose related to density. It's only purpose is deciding what is heavier than other stuff, and what is equal weight. So that when two liquids fall into each other, one goes to the bottom and one sits on top.

    If you want density, I'd suggest defining a new floating point property for density. Maybe you have an idea in mind for something it could do. But for just determining which elements are heavier than others, our integer property from 1 to 100 is good enough.
  • munibf
    25th Mar 2020 Member 0 Permalink

    What part of the code does that? Because yesterday I wanted to mod the weight and I could not find where it does the magic.

    Edited once by munibf. Last: 25th Mar 2020
  • Lord_Bowserinator
    25th Mar 2020 Member 0 Permalink

    src/simulation/Simulation.cpp:2432

     

    //weight check, also prevents particles of same type displacing each other
    if (elements[movingType].Weight <= elements[destinationType].Weight || destinationType == PT_GEL)
         can_move[movingType][destinationType] = 0;
     
    Elements of a lesser weight cannot displace elements of higher weight