error when using _SetElasticProperty with custom domain

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

error when using _SetElasticProperty with custom domain

mumić
This post was updated on .
Hello Everyone!

Latelly I've been trying to rebuild a mesh generated on a FEM program on GranOO, for future uses.
The form I built this domain is using a homebrew python plugin as it follows:

import pygranoo as granoo
import numpy as np

class DomainConvert(granoo.plugin):

    def __init__(self):
        granoo.plugin.__init__(self, "DomainConvert")
       
    def run(self):
        self.elements = []
        self.pairs_ = []
        for el_coord in self.coords:
            self.elements.append(granoo.discrete_element(granoo.point(*el_coord)))
        for e1, e2 in self.pairs:
            self.pairs_.append(granoo.element_pair(self.elements[e1], self.elements[e2]))
           
        self.up = granoo.discrete_element_set("up")
        self.down = granoo.discrete_element_set("down")
       
        for de in granoo.element_set.glob():
            pos = de.get_pos()
            if pos.y == 1:
                self.up.add(de)
            elif pos.y == 0:
                self.down.add(de)
           
    def init(self):
        pass
       
    def read(self):
        r = granoo.reader.get()
        self.file = r.read_str(granoo.attr.REQUIRED, "File")
        self.file = np.load(self.file)
        self.coords = self.file['coords']
        self.pairs = self.file['pairs']

Where the imported file has two datafields: the coordinates for each node and the element pairs that exist, so I can build build my elements and elementpair. A image of a built domain with its pairs can be seen below. As I didn't define a radius to the elements, they are not visible, leaving only their pair links displayed as red.



Problem is, when I try to use _SetElasticProperties to convert the elementpairs to beams and define their micro properties, I face the following error:

[PRE-PROCESSING][PlugIn _SetElasticProperty...]
[WARNING] Be aware, max stress (brittle failure) feature is experimental !
These values were computed for a coordination number cn=8.000000e+00

UpdateElementAverageRadius with set id Core::SetOf<DEM::DiscreteElement>
Begin conversion from 'Core::Pair<DEM::Element>' to 'DEM::Beam'
I will convert 1466 items
free(): invalid pointer
Aborted (core dumped)

As I don't know how to fix or circumvent this problem, I come here. Would this problem be related to the use of CoordNumber or due to the lack of radii?

If someone can enlighten me on this, thank you so much!

The simulation code is found below and the npz file with mesh data can be found here.

<?xml version="2.0" encoding="UTF-8" standalone="no"?>
<GranOO Version="2.0" TotIteration="0" OutDir="mch" Verbose="No" ThreadNumber="2" > 
  <PreProcessing>
    <PlugIn Id="DomainConvert" File="./meshdata.npz"/>
    <PlugIn Id="_SetDensity" Density="1000" />
    <PlugIn Id="_SetElasticProperty" YoungModulus="19e9" PoissonRatio="0.24" CoordNumber="8.0" MaxStress="30e6"/>
  </PreProcessing>
  <Processing>
  </Processing>
  <PostProcessing>
  </PostProcessing>
</GranOO>
Reply | Threaded
Open this post in threaded view
|

Re: error when using _SetElasticProperty with custom domain

Cédric Hubert
Administrator
Hi !

I can't reproduce your bug with the informations you posted.

• To reproduce your example, I need a 'main' Python file that loads the Python plugin and then runs the input file. I created one, which looks OK, but just to be sure, could you share your own ?
• Even with my main.py, I get an error that tells the 'ComputeVirialStress' plugin is missing. Did you included it in your input file ?
• Finally, even with the 'ComputeVirialStress', the last error is that a SupportShape is needed to compute the domain volume fraction.

To be sure we are on the same wavelength, could you also share the simulation log ?
Reply | Threaded
Open this post in threaded view
|

Re: error when using _SetElasticProperty with custom domain

mumić
Hello and sorry for the very late reply.

Cédric Hubert wrote
• To reproduce your example, I need a 'main' Python file that loads the Python plugin and then runs the input file. I created one, which looks OK, but just to be sure, could you share your own ?
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pygranoo as granoo

from PlugIn_DomainConvert import * # automatically added
p_DomainConvert = DomainConvert() # automatically added

import sys
sys.path.insert(0, './plugins/')

import sys


# Note : don't forget to import and instanciate your python plugins here


if __name__ == "__main__":
    # computation management, get the single problem instance
    # and run it
    granoo.problem.get().run(sys.argv)

Cédric Hubert wrote
• Even with my main.py, I get an error that tells the 'ComputeVirialStress' plugin is missing. Did you included it in your input file ?  
I did not include it on the input file as it was failing before reaching that step (I had it included but then I removed it).

Cédric Hubert wrote
• Finally, even with the 'ComputeVirialStress', the last error is that a SupportShape is needed to compute the domain volume fraction.
Is it needed if a volume fraction is input manually? I was planning on setting an value I'd calculate myself.

As again, sorry for the late reply and thank you a lot for the help.
Reply | Threaded
Open this post in threaded view
|

Re: error when using _SetElasticProperty with custom domain

Damien André
Administrator
Hello, Sorry but the _SetElasticProperty  works well only with domains generated by the cooker algorithm. Please use _ConvertElementPairToBeam (with micro parameters) plugin instead of _SetElasticProperty. Bye, Damien.
Reply | Threaded
Open this post in threaded view
|

Re: error when using _SetElasticProperty with custom domain

mumić
Oh, I see, thak you!

One problem I had is that when trying to convert, an exception is raised saying that my coordination number is too low while my domain has a coordination number of 11.75, the math I did was (2*num_bonds)/num_elements (4279 and 728 for num_bonds and num_elements respectivelly)

[PRE-PROCESSING][PlugIn _ConvertElementPairToBeam...]
Trying to compute automatically the coordination nummber value for automatic calibration
Ok, coordination number value is 3.402664e-01
[PRE-PROCESSING][PlugIn _ConvertElementPairToBeam...]
[ERROR]
####################################################
# An error was encountered ! The program must stop #
####################################################
You have to fix this problem, you may browse the source files to get more informations...
line      : 209
in file   : /home/tulio/programs/granoo/tags/2.0/Lib/GranOO/libPlugIn/ConvertElementPairToBeam.cpp
condition : 'Cn >= 5. && Cn <= 15.'
======================
-- Attached message --
======================
The value of coordination number Cn=0.340266 seems to be false. It is not in the common range of [5, 15]
python: /home/tulio/programs/granoo/tags/2.0/Lib/GranOO/libUtil/Macro.cpp:65: static void GranOO::Util::AssertMsg::RaiseUserAssertion(int, const string&, const string&, const string&): Assertion `0' failed.
Aborted (core dumped)

Is there any way to manually inflate the coordination number or make it read the correct one?

The code I used is right below, also note that the values I'm using for properties are arbitrary.

<?xml version="2.0" encoding="UTF-8" standalone="no"?>
<GranOO Version="2.0" TotIteration="0" OutDir="mch" Verbose="No" ThreadNumber="2" > 
  <PreProcessing>
    <PlugIn Id="DomainConvert" File="./meshdata.npz"/>
    <PlugIn Id="_SetDensity" Density="1000" />
    <PlugIn Id="_ConvertElementPairToBeam" MacroYoungModulus="19e9" MacroPoissonRatio="0.24" MaxStress="30e6" Set="Global"/>
  </PreProcessing>
  <Processing>
  </Processing>
  <PostProcessing>
    <PlugIn Id="_SaveDomain" />
  </PostProcessing>
</GranOO>

Anyway, thank you for the help!
Reply | Threaded
Open this post in threaded view
|

Re: error when using _SetElasticProperty with custom domain

Damien André
Administrator
Hello, you can use the granoo-gddutil tool to tune your coordination number !  
Reply | Threaded
Open this post in threaded view
|

Re: error when using _SetElasticProperty with custom domain

mumić
Hello!
It worked flawlessly, thank you!