Functions defined in the XML files

 I was looking into the XML file of the Dam Break example for the modified boundary conditions. This is ./examples/mdbc/04_Dambreak/CaseDamBreak3D_Def.xml in the package tree.

I have noted in the general XMLGUIDEv5.0.pdf (Sec 2.4.2) and then in the specific XML_GUIDE_MDBC.pdf the usage of variables and numerical expressions. This is a valuable addition to DualSPHysics 5.0, really well thought of!

In the code of the CaseDamBreak3D_Def.xml file above, I have also noted the usage of some functions . In the example below, roundposx, roundposy, roundposz. What do they do precisely?

<newvarcte Tankpx1="roundposx(DefTankpx)" Tankpx2="roundposx(DefTankpx+DefTanksx)" />
<newvarcte Tankpy1="roundposy(DefTankpy)" Tankpy2="roundposy(DefTankpy+DefTanksy)" />
<newvarcte Tankpz1="roundposz(DefTankpz)" Tankpz2="roundposz(DefTankpz+DefTanksz)" />
<newvarcte Boxpx1="roundposx(DefBoxpx)" Boxpx2="roundposx(DefBoxpx+DefBoxsx)" />
<newvarcte Boxpy1="roundposy(DefBoxpy)" Boxpy2="roundposy(DefBoxpy+DefBoxsy)" />
<newvarcte Boxpz2="roundposy(DefTankpz+DefBoxsz)" />

Would you please point me to where I can find a definition of these or provide one?

Knowing what they do can be pretty useful when designing new cases or customising old ones.

Thanks.

Comments

  • Thanks for making the post!

    I also discovered them a bit randomly and found no documentation. Basically I found it to be very useful when I had to actually calculate normals for mDBC. Sometimes even if I used the correct Dp*0.5 approach it would still be slightly off - using roundpos then fixed that issue for me.

    Of course it can change your exact location of particles, so if you care a lot about this one should double check. A good way to understand what they do is to draw a square with and without I suppose.

    Kind regards

  • edited November 2020

    Addition. Knowing what these functions are and do appears to be important because you cannot move them around in the XML code at your own will.

    For example, if I move

    <newvarcte Tankpx1="roundposx(DefTankpx)" Tankpx2="roundposx(DefTankpx+DefTanksx)" />
    

    into a <predefinition> section (as seems granted by the XML guide Sec 2.4.2 p60), then the code throws the error

    *** Exception (JNumexVars::GetVarNum) at JNumexVars.cpp:250

    Text: The variable 'PosMin_x' does not exist.

    File: CaseDamBreak3D_Def.xml(row:25)

    Apparently this function calls some internal variable not defined yet in the predefinition stage. So it must be handled somehow specially.

    May I take the liberty of bothering @jmdalonso for a sanity check on this post? Thanks in advance.

Sign In or Register to comment.