(Re-)Creating mercury data files for running coarse graining with MercuryCG

Hi All,

I’m trying to run MercuryCG on simulation data from various other solvers, which necessitates me converting that data into the mercury format of .data, .fstat and .restart files. I’ve based my converter on the documentation: MercuryDPM: Visualising Your Results, although there seems to be nothing on .restart files so I just copied the format of a simulation output for that.

For a simple case, with just one type of sphere and a few simple triangulated walls, this all works fine. However, for a more complex simulation with multiple different particle types in it, my converted data seems to be incorrect.

I get the following message from the terminal when attempting to run on these files:

Message MercuryKernel:
Species type LinearViscoelasticSpecies not understood in restart file: You need to add this species to SpeciesHandler::readMixedObject.
Message MercuryKernel:
Species type Walls not understood in restart file: You need to add this species to SpeciesHandler::readObject.
Message MercuryKernel:
Species type TriangleWall not understood in restart file: You need to add this species to SpeciesHandler::readMixedObject.
Message MercuryKernel:
Species type TriangleWall not understood in restart file: You need to add this species to SpeciesHandler::readMixedObject.
An error has occured
Module : MercuryKernel
Message: DPMBase::read(is): Error during restart: 'Walls' argument could not be found.:

The start of my .restart file looks like this:

MercuryDPM 1.0 name Polydisperse_Multispheres_Cylinder_NoGravity_00000000 revision 8a6674c8 repository https://bitbucket.org/mercurydpm/mercurydpm.git
dataFile    fileType ONE_FILE saveCount 1 counter 1 lastSavedTimeStep 1
fStatFile   fileType ONE_FILE saveCount 1 counter 1 lastSavedTimeStep 1
eneFile     fileType ONE_FILE saveCount 1 counter 0 lastSavedTimeStep 0
restartFile fileType ONE_FILE saveCount 1 counter 1 lastSavedTimeStep 1
statFile    fileType ONE_FILE saveCount 1 counter 0
interactionFile fileType NO_FILE saveCount 0 counter 0
xMin -0.405 xMax 0.405 yMin -0.405 yMax 0.405 zMin -0.002 zMax 0.8565
timeStep 0.01 time 0 ntimeSteps 1 timeMax 0
systemDimensions 3 particleDimensions 3 gravity 0 0 0 backgroundDrag 0 writeVTK 0 NO_FILE NO_FILE 0 0 0 0 0 random  0 1103515245 12345 1073741824 607 273 784607267
Species 3
LinearViscoelasticSpecies id 0 density 2200 stiffness 75857.5125578 dissipation 230.258509299
LinearViscoelasticSpecies id 1 density 2200 stiffness 75857.5125578 dissipation 230.258509299
LinearViscoelasticSpecies id 2 density 2200 stiffness 75857.5125578 dissipation 230.258509299
Walls 104
TriangleWall id 12 groupID 1 indSpecies 0 position 0 0 0 orientation 1 0 0 0 velocity 0 0 0 angularVelocity 0 0 0 force 0.00090954189321 0.00476798557892 0 torque 0 0 0 vertexInLabFrame  0.0689332784604 0.545663085723 0 0.0689332784604 0.545663085723 1.2 0.136779437941 0.532720738621 0
TriangleWall id 13 groupID 1 indSpecies 0 position 0 0 0 orientation 1 0 0 0 velocity 0 0 0 angularVelocity 0 0 0 force 0.00361603947021 0.0189559427394 0 torque 0 0 0 vertexInLabFrame  0.0689332784604 0.545663085723 1.2 0.136779437941 0.532720738621 1.2 0.136779437941 0.532720738621 0
TriangleWall id 14 groupID 1 indSpecies 0 position 0 0 0 orientation 1 0 0 0 velocity 0 0 0 angularVelocity 0 0 0 force 0.00170160390044 0.00523699831117 0 torque 0 0 0 vertexInLabFrame  0.136779437941 0.532720738621 0 0.136779437941 0.532720738621 1.2 0.202468503977 0.511377067239 0
TriangleWall id 15 groupID 1 indSpecies 0 position 0 0 0 orientation 1 0 0 0 velocity 0 0 0 angularVelocity 0 0 0 force 0.00452073182467 0.0139133819128 0 torque 0 0 0 vertexInLabFrame  0.136779437941 0.532720738621 1.2 0.202468503977 0.511377067239 1.2 0.202468503977 0.511377067239 0
TriangleWall id 16 groupID 1 indSpecies 0 position 0 0 0 orientation 1 0 0 0 velocity 0 0 0 angularVelocity 0 0 0 force 0.00290464284195 0.00617268024352 0 torque 0 0 0 vertexInLabFrame  0.202468503977 0.511377067239 0 0.202468503977 0.511377067239 1.2 0.264964520756 0.481968674024 0
TriangleWall id 17 groupID 1 indSpecies 0 position 0 0 0 orientation 1 0 0 0 velocity 0 0 0 angularVelocity 0 0 0 force 0.00666693632175 0.0141679608673 0 torque 0 0 0 vertexInLabFrame  0.202468503977 0.511377067239 1.2 0.264964520756 0.481968674024 1.2 0.264964520756 0.481968674024 0
TriangleWall id 18 groupID 1 indSpecies 0 position 0 0 0 orientation 1 0 0 0 velocity 0 0 0 angularVelocity 0 0 0 force 0.00390452370204 0.00615254486769 0 torque 0 0 0 vertexInLabFrame  0.264964520756 0.481968674024 0 0.264964520756 0.481968674024 1.2 0.323281888761 0.444959346906 0
...

This format is identical to the case that works for a single particle type which I created, except for the species part:

Species 1
LinearViscoelasticSpecies id 0 density 2500 stiffness 75857.5125578 dissipation 230.258509299

So I assume that I’m not correctly creating the species part of the restart file correctly when there are multiple particle types and therefore it never gets to the Walls section which should be correct.

And for clarity, I just want to coarse-grain the data, I’m not actually worried about restarting in MercuryDPM at the moment, although If I provided the correct contact model and contact parameters, it sure that would work, but not actually my concern at the moment.

If the full dataset is required, I can share via link because it’s a bit large to dump here on the forum.

@antRthorn or @TiPlath, any idea what I’ve messed up?

Dear jp,

for me it also seems like the species part is wrong. It looks like it is searching for the mixed species of 0 and 1, 0 and 2, 1 and 2. A minimal example I found looks like this for 2 species (MercuryCGSelfTest):

MercuryDPM 1.0 name MercuryCGSelfTest revision 36e5abe4 repository https://bitbucket.org/mercurydpm/mercurydpm.git
dataFile    fileType ONE_FILE saveCount 1 counter 3 lastSavedTimeStep 2
fStatFile   fileType ONE_FILE saveCount 1 counter 3 lastSavedTimeStep 2
eneFile     fileType ONE_FILE saveCount 1 counter 3 lastSavedTimeStep 2
restartFile fileType ONE_FILE saveCount 1 counter 3 lastSavedTimeStep 2
statFile    fileType ONE_FILE saveCount 1 counter 0
interactionFile fileType NO_FILE saveCount 0 counter 0
xMin 0 xMax 2 yMin 0 yMax 1 zMin 0 zMax 1
timeStep 1 time 2 ntimeSteps 2 timeMax 2
systemDimensions 3 particleDimensions 3 gravity 0 0 0 backgroundDrag 0 writeVTK 0 NO_FILE NO_FILE 0 0 0 0 0 random  0 1103515245 12345 1073741824 607 273 784607267
Species 2
LinearViscoelasticReversibleAdhesiveSpecies id 0 density 1.90985931710274 stiffness 4.93480220054468 dissipation 1.9604554841989e-15 adhesionForceMax 1 adhesionStiffness 4.93480220054468
LinearViscoelasticReversibleAdhesiveSpecies id 1 density 1.90985931710274 stiffness 4.93480220054468 dissipation 1.9604554841989e-15 adhesionForceMax 1 adhesionStiffness 4.93480220054468
LinearViscoelasticReversibleAdhesiveMixedSpecies idA 1 idB 0 stiffness 4.93480220054468 dissipation 1.9604554841989e-15 adhesionForceMax 1 adhesionStiffness 4.93480220054468
Walls 2
InfiniteWall id 0 indSpecies 0 position 0 0 0 orientation 0 0 1 0 velocity 0 0 0 angularVelocity 0 0 0 force 1 0 0 torque 0 0 0
InfiniteWall id 1 indSpecies 0 position 2 0 0 orientation 1 0 0 0 velocity 0 0 0 angularVelocity 0 0 0 force -1 0 0 torque 0 0 0
Boundaries 0
Particles 2
BaseParticle id 0 indSpecies 0 position 0.5 0.5 0.5 orientation 1 0 0 0 velocity 0 0 0 angularVelocity 0 0 0 force 0 0 0 torque 0 0 0 radius 0.5 invMass 1 timeStamp 0
BaseParticle id 1 indSpecies 1 position 1.5 0.5 0.5 orientation 1 0 0 0 velocity 0 0 0 angularVelocity 0 0 0 force 0 0 0 torque 0 0 0 radius 0.5 invMass 1 timeStamp 0
Interactions 3
LinearViscoelasticReversibleAdhesiveInteraction particleIds 0 1 timeStamp 2 contactPoint 1 0.5 0.5 normal -1 0 0 distance 1 overlap 0 force 1 0 0 torque 0 0 0
LinearViscoelasticReversibleAdhesiveInteraction particleWallIds 0 0 timeStamp 2 contactPoint 0 0.5 0.5 normal 1 -0 -0 distance 0.5 overlap 0 force -1 0 0 torque 0 0 0
LinearViscoelasticReversibleAdhesiveInteraction particleWallIds 1 1 timeStamp 2 contactPoint 2 0.5 0.5 normal -1 -0 -0 distance 0.5 overlap 0 force 1 0 0 torque 0 0 0

For me everything else looks fine.
Hope it helps :slight_smile:
Timo

1 Like

Hi @TiPlath,

Thanks for this. So in my case where I have three particle types, should I have:

Species 3
LinearViscoelasticSpecies id 0 density 2200 stiffness 75857.5125578 dissipation 230.258509299
LinearViscoelasticSpecies id 1 density 2200 stiffness 75857.5125578 dissipation 230.258509299
LinearViscoelasticSpecies id 2 density 2200 stiffness 75857.5125578 dissipation 230.258509299
LinearViscoelasticSpecies idA 1 idB 0 stiffness 75857.5125578 dissipation 230.258509299
LinearViscoelasticSpecies idA 2 idB 0 stiffness 75857.5125578 dissipation 230.258509299
LinearViscoelasticSpecies idA 1 idB 2 stiffness 75857.5125578 dissipation 230.258509299

Or should all three particle types/ species be combined on a single line?

Hi JP,

The mixed species info (e.g., how species 1 interacts with species 2) is missing. If you created this restart file by hand, you’ll need to add the missing mixed lines—which it looks like you may have already figured out!

If it’s still unclear, just let me know and I can send you the lines.

Separate lines like you write is correct.

2 Likes

@jpmorr Beware the naming is still wrong; the ViscoelasticSpecies turns into a ViscoelasticMixedSpecies. Below an example for 4 species

Species 4
LinearViscoelasticFrictionSpecies id 0 density 1500 stiffness 100 dissipation 0.01
LinearViscoelasticFrictionSpecies id 1 density 1500 stiffness 100 dissipation 0.01
LinearViscoelasticFrictionMixedSpecies idA 1 idB 0 stiffness 100 dissipation 0.01
LinearViscoelasticFrictionSpecies id 2 density 1500 stiffness 100 dissipation 0.01
LinearViscoelasticFrictionMixedSpecies idA 2 idB 0 stiffness 100 dissipation 0.01
LinearViscoelasticFrictionMixedSpecies idA 2 idB 1 stiffness 100 dissipation 0.01
LinearViscoelasticFrictionSpecies id 3 density 1500 stiffness 100 dissipation 0.01
LinearViscoelasticFrictionMixedSpecies idA 3 idB 0 stiffness 100 dissipation 0.01
LinearViscoelasticFrictionMixedSpecies idA 3 idB 1 stiffness 100 dissipation 0.01
LinearViscoelasticFrictionMixedSpecies idA 3 idB 2 stiffness 100 dissipation 0.01

I am not 100% sure if the order is important, but I guess you are on the safe side when keeping this order

1 Like

OK, Mixed is important. Will test tonight!