Skip to content

Commit

Permalink
Add AutoDiff and CantileverBeam test with NeoHooke + Nonlinear EAS
Browse files Browse the repository at this point in the history
  • Loading branch information
tarun-mitruka committed Oct 29, 2024
1 parent b81e54f commit ffa7248
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/src/checkfebyautodiff.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

template <typename GridView, typename BasisHandler, typename Skills, typename AffordanceColl, typename VectorType>
auto checkFESByAutoDiffImpl(const GridView& gridView, const BasisHandler& basis, Skills&& skills,
AffordanceColl affordance, VectorType& d, const std::string& messageIfFailed = "",
AffordanceColl affordance, VectorType& d, const std::string& testName = "",
double tol = 1e-10) {
double lambda = 7.3;
auto fe = Ikarus::makeFE(basis, std::forward<Skills>(skills));
Expand Down
19 changes: 15 additions & 4 deletions tests/src/testnonlineareas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ using Dune::TestSuite;

template <typename MAT>
auto cantileverBeamTest(const MAT& reducedMat) {
static_assert(MAT::isReduced, "cantileverBeamTest is only valid for a reduced material (planeStress or planeStrain)");
TestSuite t("Cantilever Beam for Nonlinear EAS element (Q1E4)");
constexpr int gridDim = 2;
using Grid = Dune::YaspGrid<gridDim>;
Expand Down Expand Up @@ -117,7 +118,9 @@ auto cantileverBeamTest(const MAT& reducedMat) {
const auto controlInfo = lc.run();

double expectedLambda = 1.0;
double expectedMaxDisp = 4.459851990227056; // abs(maxDisp) in ANSYS APDL = 4.48777
double expectedMaxDisp = std::is_same_v<typename MAT::Underlying, NeoHookeT<double>>
? 4.492526443429457
: 4.459851990227056; // abs(maxDisp) in ANSYS APDL = 4.48777 (SVK) and = 4.50145 (NH)

t.check(controlInfo.success);
const auto maxDisp = std::ranges::max(d.cwiseAbs());
Expand Down Expand Up @@ -153,9 +156,17 @@ int main(int argc, char** argv) {
Dune::TestSuite t("Nonlinear EAS Test");
auto matParameter = toLamesFirstParameterAndShearModulus({.emodul = 100.0, .nu = 0.3});
StVenantKirchhoff matSVK(matParameter);
auto reducedMat = planeStrain(matSVK);
easAutoDiffTest<2>(t, reducedMat);
NeoHooke matNH(matParameter);
auto reducedMatSVK = planeStrain(matSVK);
auto reducedMatNH = planeStrain(matNH);

easAutoDiffTest<2>(t, reducedMatSVK);
easAutoDiffTest<3>(t, matSVK);
t.subTest(cantileverBeamTest(reducedMat));

easAutoDiffTest<2>(t, reducedMatNH);
easAutoDiffTest<3>(t, matNH);

t.subTest(cantileverBeamTest(reducedMatSVK));
t.subTest(cantileverBeamTest(reducedMatNH));
return t.exit();
}

0 comments on commit ffa7248

Please sign in to comment.