Skip to content

Commit

Permalink
Reimplemented AssembleH in terms of Piola derivative
Browse files Browse the repository at this point in the history
  • Loading branch information
larsson4 committed Apr 9, 2024
1 parent 8828d50 commit 209e139
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/nlelast_integ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ void TestLinModel::AssembleH(const DenseMatrix &J, const DenseMatrix &DS,
for (size_t n = 0; n < dim; n++) // Looping over derivatives with respect to U
{
const int U_mn = n * dof + m;
Dmat(S_ij, U_mn) = ((i == j) ? L * w * gshape(m,n) : 0.0);
Dmat(S_ij, U_mn) = ((i == j) ? L * gshape(m,n) : 0.0);
Dmat(S_ij, U_mn) += ((n == i) ? M * gshape(m,j) : 0.0);
Dmat(S_ij, U_mn) += ((n == j) ? M * gshape(m,i) : 0.0);
}
}
}
Expand All @@ -236,7 +238,7 @@ void TestLinModel::AssembleH(const DenseMatrix &J, const DenseMatrix &DS,
for (size_t k = 0; k < dim; k++)
{
const int S_jk = k * dim + j;
temp += Dmat(S_jk, mn) * gshape(i,k);
temp += Dmat(S_jk, mn) * w * gshape(i,k);
}
elmat(ij, mn) += temp;

Expand Down
4 changes: 2 additions & 2 deletions test/nlelast_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@ TEST(TempLinStiffnessMatrices, Test_NLElast)
VectorFunctionCoefficient init_x(dim, InitDisplacement);

Vector lambda(mesh.attributes.Max());
double _lambda = 1.0;
double _lambda = 3.14;
lambda = _lambda; // Set lambda for all element attributes.
PWConstCoefficient lambda_c(lambda);
Vector mu(mesh.attributes.Max());
double _mu = 0.0;
double _mu = 2.33;
mu = _mu; // Set mu = 1 for all element attributes.
PWConstCoefficient mu_c(mu);

Expand Down

0 comments on commit 209e139

Please sign in to comment.