diff --git a/tests/src/testnonlineareas.cpp b/tests/src/testnonlineareas.cpp index 9d3cc71ab..9fe5275d0 100644 --- a/tests/src/testnonlineareas.cpp +++ b/tests/src/testnonlineareas.cpp @@ -39,7 +39,7 @@ using namespace Ikarus; using Dune::TestSuite; template -auto cantileverBeamTest(const MAT& mat) { +auto cantileverBeamTest(const MAT& reducedMat) { TestSuite t("Cantilever Beam for Nonlinear EAS element (Q1E4)"); constexpr int gridDim = 2; using Grid = Dune::YaspGrid; @@ -53,9 +53,8 @@ auto cantileverBeamTest(const MAT& mat) { using namespace Dune::Functions::BasisFactory; auto basis = Ikarus::makeBasis(gridView, power<2>(lagrange<1>(), FlatInterleaved())); - auto reducedMat = planeStress(mat, 1e-8); - auto sk = skills(nonLinearElastic(reducedMat), eas(4)); - using FEType = decltype(makeFE(basis, sk)); + auto sk = skills(nonLinearElastic(reducedMat), eas(4)); + using FEType = decltype(makeFE(basis, sk)); std::vector fes; for (auto&& ge : elements(gridView)) { @@ -88,13 +87,17 @@ auto cantileverBeamTest(const MAT& mat) { Dune::FieldVector topRightPos{L, h}; const auto globalIndices = utils::globalIndexFromGlobalPosition(basis.flat(), topRightPos); auto pointLoad = [&](const auto&, const auto& par, auto, auto, Eigen::VectorXd& vec) -> void { - auto loadFactor = par.parameter(); + auto loadFactor = par.parameter(); vec[globalIndices[1]] -= loadFactor * 1.0; }; sparseAssemblerAM->bind(pointLoad); auto linSolver = LinearSolver(SolverTypeTag::sd_UmfPackLU); + AffordanceCollection elastoStaticsNoScalar(VectorAffordance::forces, MatrixAffordance::stiffness); + + auto nonOp = NonLinearOperatorFactory::op(sparseAssemblerAM, elastoStaticsNoScalar, sparseAssemblerAM->dBCOption()); + auto nrConfig = Ikarus::NewtonRaphsonConfig{.linearSolver = linSolver}; auto nonLinearSolverObserver = std::make_shared(); auto pathFollowingObserver = std::make_shared(); @@ -102,8 +105,7 @@ auto cantileverBeamTest(const MAT& mat) { std::make_shared>>(basis.flat(), d); vtkWriter->setFileNamePrefix("CantileverNonlinearEAS"); vtkWriter->setFieldInfo("Displacement", Dune::VTK::FieldInfo::Type::vector, 2); - NonlinearSolverFactory nrFactory(nrConfig); - auto nr = nrFactory.create(sparseAssemblerAM); + auto nr = createNonlinearSolver(nrConfig, nonOp); auto lc = LoadControl(nr, 10, {0, 1}); nr->subscribeAll(nonLinearSolverObserver); lc.subscribeAll({pathFollowingObserver, vtkWriter}); @@ -143,6 +145,6 @@ int main(int argc, char** argv) { auto reducedMat = planeStress(matSVK); easAutoDiffTest<2>(t, reducedMat); easAutoDiffTest<3>(t, matSVK); - t.subTest(cantileverBeamTest(matSVK)); + t.subTest(cantileverBeamTest(reducedMat)); return t.exit(); } \ No newline at end of file