[petsc-users] Elasticity tensor in ex52
Miguel Angel Salazar de Troya
salazardetroya at gmail.com
Fri Apr 18 13:23:42 CDT 2014
Hello everybody.
First, I am taking this example from the petsc-dev version, I am not sure
if I should have posted this in another mail-list, if so, my apologies.
In this example, for the elasticity case, function g3 is built as:
void g3_elas(const PetscScalar u[], const PetscScalar gradU[], const
PetscScalar a[], const PetscScalar gradA[], const PetscReal x[],
PetscScalar g3[])
{
const PetscInt dim = spatialDim;
const PetscInt Ncomp = spatialDim;
PetscInt compI, d;
for (compI = 0; compI < Ncomp; ++compI) {
for (d = 0; d < dim; ++d) {
g3[((compI*Ncomp+compI)*dim+d)*dim+d] = 1.0;
}
}
}
Therefore, a fourth-order tensor is represented as a vector. I was checking
the indices for different iterator values, and they do not seem to match
the vectorization that I have in mind. For a two dimensional case, the
indices for which the value is set as 1 are:
compI = 0 , d = 0 -----> index = 0
compI = 0 , d = 1 -----> index = 3
compI = 1 , d = 0 -----> index = 12
compI = 1 , d = 1 -----> index = 15
The values for the first and last seem correct to me, but they other two
are confusing me. I see that this elasticity tensor (which is the
derivative of the gradient by itself in this case) would be a four by four
identity matrix in its matrix representation, so the indices in between
would be 5 and 10 instead of 3 and 12, if we put one column on top of each
other.
I guess my question is then, how did you vectorize the fourth order tensor?
Thanks in advance
Miguel
--
*Miguel Angel Salazar de Troya*
Graduate Research Assistant
Department of Mechanical Science and Engineering
University of Illinois at Urbana-Champaign
(217) 550-2360
salaza11 at illinois.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140418/4fd0cf8d/attachment.html>
More information about the petsc-users
mailing list