How to set particle_volume?

Hello, developer
I see that we should assign particle volumes: this->assign_volume(cell_->volume() / cell_->nparticles());
is this mean that we set n_particles in the cell and also the initial particles are set as regular arrangement (looks like the gap between particles are same in every row or col).
Best ragards

Hi @fengzk,

That’s correct, if you don’t specify a particle volume file, the material points in a cell will be assigned equal share of the cell volume.

Alternatively, you can specify particles_volumes option in the input mesh JSON object:
This ASCII file has a list of particle ids and their corresponding volumes. The file should have the following format:

pid0 volume0
pid1 volume1
pid2 volume2
pid3 volume3

Thanks a lot.@kks32
Another question is about the shape function. For the 8-node element, the shape_function is defined as "shapefn( Matrix<3,1>& xi), and the “grad_shapefn(Matrix<3,1>& xi)”. When we caculate the node external force, we will use the grad_shapefn to plus stress. I am confused with the “dn_dx()” function, I think that force=grad_shapefn * stress, right?

Hey @fengzk, you are almost right with the equation. One thing you are missing is the fact that the force and stresses are computed in global coordinates while the grad_shapefns are in natural coordinates. So we need dn_dx which involves Jacobian matrix: dN/dx = [J]^-1 * dN/dxi.

Thank you.@ezrayst
I noticed that in the function “shapefn(Matrix<3,1>& xi)” and “grad_shapefn(Matrix<3,1>& xi)”, the xi have been defined as “xi = 2 * ( point_coordinates -”, so we can use grad_shapefn to deal with the force directly, right? And I understand your answer~ thanks

No, you still need dN/dx not dN/dxi (the grad_shapefn). the equation on xi is just to transfer from global coordinate into the natural coordinate. Is this OK?

Got it. I missunderstand the different of dN/dx and dN/dxi.

Hello, @kks32
Glad to recieve your reply. Based on this question and the code of volume_assign,
case1. volume= cell_vol / cell_nparticles;
case2. volume= particle(id).volume (from the input file)
For these two cases, can I think that the particle is just the center of a cube, because we assume that it has x,y,z length. And also the volume can not be large to invoid the particle body contact or insert. Or is the volume just used to calculate the force = stress * volume?
Best regards.

Hello, @ezrayst
Sorry to bother you again. In the code, the function dn_dx is defined as
dn_dx(const VectorDim& xi, const Eigen::MatrixXd& nodal_coordinates), for the nodal_coordinates, it is the natural corrdinate of the cell ( eg. [( -1., -1., -1.,), (1., -1., -1.,), (1., 1., -1.,), (-1., 1., -1.,), (-1., -1., 1.,), (1., -1., 1.,), (1., 1., 1.,), ( -1., 1., 1.)] )
or it is the global corrdinates of the cell( eg. [(100, 100, 100), (101, 100, 100), (100, 101, 100), (101, 101, 100), (100, 100, 101), (101, 100, 101), (100, 101, 101), (101, 101, 101)] ).
Best regards.

nodal coordinates (anything that has x) - in global (100, 100, 100)
anything that is in xi - in natural coordinate (1, 1, 1)