[petsc-users] Elasticity tensor in ex52
Matthew Knepley
knepley at gmail.com
Sat Apr 19 11:35:20 CDT 2014
On Fri, Apr 18, 2014 at 1:23 PM, Miguel Angel Salazar de Troya <
salazardetroya at gmail.com> wrote:
> 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 have read this a few times, but I cannot understand that you are asking.
The simplest thing I can
respond is that we are indexing a row-major array, using the indices:
g3[ic, id, jc, jd]
where ic indexes the components of the trial field, id indexes the
derivative components,
jc indexes the basis field components, and jd its derivative components.
Matt
> 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
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140419/fb224c40/attachment.html>
More information about the petsc-users
mailing list