underworldcode / UWGeodynamics

Underworld Geodynamics
Other
81 stars 32 forks source link

3D plastic damage shape #201

Closed HanyMKhalil closed 4 years ago

HanyMKhalil commented 4 years ago

Hi @rbeucher

I am trying to add a plastic damage in 3D. However, is there a possibility to make it 3D rectangular so that its same along the axis instead of a sphere? How can I adjust the gaussian equation in the plastic damage to make that?

Thanks a lot for the help ^_^

HanyMKhalil commented 4 years ago

Here is the code you use for plastic damage in 3D, I tried to adopt the half spaces to make a rectangular but failed, since the lines that follow the spherical damage only defines the centre of the sphere

def gaussian(xx, centre, width):     return ( np.exp( -(xx - centre)*2 / width )) maxDamage = 0.22 Model.plasticStrain.data[:] = maxDamage np.random.rand(*Model.plasticStrain.data.shape[:])

Model.plasticStrain.data[:,0] = gaussian(Model.swarm.particleCoordinates.data[:,0], (GEO.nd(Model.maxCoord[0] - Model.minCoord[0])) / 2.0, GEO.nd(2.0 u.kilometer))

Model.plasticStrain.data[:,0] = gaussian(Model.swarm.particleCoordinates.data[:,1], GEO.nd(256. u.kilometer) , GEO.nd(2.0 * u.kilometer))

Model.plasticStrain.data[:,0] = gaussian(Model.swarm.particleCoordinates.data[:,2], GEO.nd(-35. u.kilometer) , GEO.nd(5.0 * u.kilometer))

rbeucher commented 4 years ago

Hi @HanyMKhalil,

You can use any predefined box shape or create your own function. That function could be a cube.

R

HanyMKhalil commented 4 years ago

Hi Romain, you mean I create a rectangular seed and assign same viscosity and density like surrounding but only change plasticity? but how I transfer the magnitude of plastic damage to plasticity values (cohesion and strain softening), I though its easier to write a gaussian function to define plastic damage shape as rectangular or cylinder, instead of a sphere, but its really hard for me.

rbeucher commented 4 years ago

OK. Let me cook something for you. I can't guarantee that I will do that today though... Give it some thoughts and I will get back to you.

HanyMKhalil commented 4 years ago

Thanks so much Romain really ^_^

HanyMKhalil commented 4 years ago

Hi Romain:

I tried it in this way and seems to work nicely

maxDamage = 0.22 Model.plasticStrain.data[:] = maxDamage np.random.rand(Model.plasticStrain.data.shape[:])

This function resets damage to 0 where x is < 100 and > 900 km

Model.plasticStrain.data[:,0] =(Model.swarm.particleCoordinates.data[:,0]>(GEO.nd(100.0u.kilometer))) & (Model.swarm.particleCoordinates.data[:,0]<(GEO.nd(150.0*u.kilometer)))

This resets damage to 0 where y < 100 and > 900 km

Model.plasticStrain.data[:,0] =(Model.swarm.particleCoordinates.data[:,1]<(GEO.nd(-40.0u.kilometer))) & (Model.swarm.particleCoordinates.data[:,1]>(GEO.nd(-60.0*u.kilometer)))

And this resets damage to 0 where z < -100 and > 0.

Model.plasticStrain.data[:,0] =(Model.swarm.data[:,2]<(GEO.nd(-100.0u.kilometer))) & (Model.swarm.data[:,2]>(GEO.nd(0.0*u.kilometer)))

rbeucher commented 4 years ago

Sorry it took so long @HanyMKhalil. That's one way to do it. There are others of course.

3D_Plastic_Strain_Initial_Distribution.zip