Commit 5df26ecf authored by GILLES Sebastien's avatar GILLES Sebastien

#1303 Remove test P2/P1 for non linear membrane operator, which is not...

#1303 Remove test P2/P1 for non linear membrane operator, which is not meaningful from a mathematical standpoint.
parent f39ee06d
......@@ -4655,8 +4655,6 @@
BEBFCEC5205A7FA30033C4C1 /* UnknownP1TestP1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnknownP1TestP1.cpp; sourceTree = "<group>"; };
BEBFCEC7205A80FF0033C4C1 /* UnknownP2TestP1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnknownP2TestP1.cpp; sourceTree = "<group>"; };
BEBFCEC9205AC58E0033C4C1 /* ExpectedResults_P2P1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExpectedResults_P2P1.cpp; sourceTree = "<group>"; };
BEC1319F206B74CC0050AA8B /* TestP2P1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestP2P1.cpp; sourceTree = "<group>"; };
BEC131A1206B8C970050AA8B /* ExpectedResults_P2P1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExpectedResults_P2P1.cpp; sourceTree = "<group>"; };
BEC157F11A249C3D007D20EB /* Numeric.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Numeric.hpp; path = Sources/Utilities/Numeric/Numeric.hpp; sourceTree = SOURCE_ROOT; };
BEC1FC6918C470C500A4EB89 /* Mpi.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Mpi.hpp; sourceTree = "<group>"; };
BEC1FC6D18C470C500A4EB89 /* Parmetis.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Parmetis.hpp; sourceTree = "<group>"; };
......@@ -8728,11 +8726,9 @@
BE7E68682065615100AA2FB3 /* InputData.hpp */,
BE7E686E2065615100AA2FB3 /* Model.cpp */,
BE7E688A206B71F200AA2FB3 /* TestP1P1.cpp */,
BEC1319F206B74CC0050AA8B /* TestP2P1.cpp */,
BE7E686A2065615100AA2FB3 /* Model.hpp */,
BE7E686C2065615100AA2FB3 /* Model.hxx */,
BE7E68762066730F00AA2FB3 /* ExpectedResults_P1P1.cpp */,
BEC131A1206B8C970050AA8B /* ExpectedResults_P2P1.cpp */,
BE7E68752066728800AA2FB3 /* ExpectedResults.hpp */,
);
path = NonlinearMembrane;
......@@ -4,9 +4,7 @@ target_sources(MoReFEMTestNonLinearMembrane_lib
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Model.cpp"
"${CMAKE_CURRENT_LIST_DIR}/TestP1P1.cpp"
"${CMAKE_CURRENT_LIST_DIR}/TestP2P1.cpp"
"${CMAKE_CURRENT_LIST_DIR}/ExpectedResults_P1P1.cpp"
"${CMAKE_CURRENT_LIST_DIR}/ExpectedResults_P2P1.cpp"
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Model.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Model.hxx"
......
......@@ -76,23 +76,6 @@ namespace MoReFEM
expected_results_type<IsMatrixOrVector::vector> GetExpectedVectorP1P1();
/*!
* \brief Returns the expected matrix when unknown is P2 and test function P1.
*
* \return The expected content of the matrix, in \a content_type format. The pre-filled matrix is dense.
*/
expected_results_type<IsMatrixOrVector::matrix> GetExpectedMatrixP2P1();
/*!
* \brief Returns the expected vector when unknown is P2 and test function P1.
*
* \return The expected content of the vector, in \a content_type format.
*/
expected_results_type<IsMatrixOrVector::vector> GetExpectedVectorP2P1();
} // namespace TestNS::NonLinearMembraneOperatorNS
......
/*!
// \file
//
//
// Created by Sebastien Gilles <sebastien.gilles@inria.fr> on the Wed, 28 Mar 2018 10:48:06 +0200
// Copyright (c) Inria. All rights reserved.
//
*/
#include "Test/Operators/VariationalInstances/NonlinearMembrane/ExpectedResults.hpp"
namespace MoReFEM
{
namespace TestNS::NonLinearMembraneOperatorNS
{
expected_results_type<IsMatrixOrVector::matrix> GetExpectedMatrixP2P1()
{
// #1259 The results below are those computed with current instance; Dominique should provide soon
// independently obtained ones with greater precision.
return expected_results_type<IsMatrixOrVector::matrix>
{
{ 9.24496e+08, -5.08502e+08, 0., -5.59314e+08, 1.22953e+09, 0., -3.65182e+08, -7.21025e+08, 0., 1.17058e+09, -1.76323e+08, 0., -3.50671e+09, 4.52115e+08, 0., 2.33612e+09, -2.75792e+08, 0. },
{ -2.90145e+08, 4.20034e+09, 0., 1.89397e+08, -9.60781e+09, 0., 1.00747e+08, 5.40747e+09, 0., 1.91481e+09, 9.97412e+08, 0., -2.53626e+08, -2.34382e+09, 0., -1.66118e+09, 1.34641e+09, 0. },
{ -1.13029e+08, 2.12631e+09, 0., 6.7287e+07, -2.99312e+09, 0., 4.57416e+07, 8.66813e+08, 0., 4.02989e+08, 1.84602e+09, 0., 1.20035e+08, -4.44324e+09, 0., -5.23024e+08, 2.59721e+09, 0. },
{ -5.59314e+08, 2.42443e+08, 0., 4.08456e+08, -8.06065e+08, 0., 1.50857e+08, 5.63622e+08, 0., -4.14032e+08, 7.52451e+07, 0., 2.09165e+09, -2.69148e+08, 0., -1.67761e+09, 1.93903e+08, 0. },
{ 1.91276e+08, -1.79835e+09, 0., -1.45608e+08, 5.90083e+09, 0., -4.5668e+07, -4.10249e+09, 0., -1.23153e+09, -3.52266e+08, 0., 2.82533e+08, 1.32832e+09, 0., 9.48999e+08, -9.76054e+08, 0. },
{ 6.8948e+07, -1.01966e+09, 0., -4.84758e+07, 1.82055e+09, 0., -2.04723e+07, -8.00892e+08, 0., -2.54713e+08, -7.00645e+08, 0., -3.17787e+07, 2.59721e+09, 0., 2.86492e+08, -1.89657e+09, 0. },
{ -3.65182e+08, 2.66059e+08, 0., 1.50857e+08, -4.23462e+08, 0., 2.14325e+08, 1.57403e+08, 0., -7.56552e+08, 1.01077e+08, 0., 1.41506e+09, -1.82966e+08, 0., -6.58509e+08, 8.18891e+07, 0. },
{ 9.88684e+07, -2.40199e+09, 0., -4.3789e+07, 3.70697e+09, 0., -5.50795e+07, -1.30498e+09, 0., -6.83278e+08, -6.45146e+08, 0., -2.89073e+07, 1.0155e+09, 0., 7.12185e+08, -3.70356e+08, 0. },
{ 4.40806e+07, -1.10665e+09, 0., -1.88113e+07, 1.17257e+09, 0., -2.52693e+07, -6.59212e+07, 0., -1.48276e+08, -1.14538e+09, 0., -8.82561e+07, 1.84602e+09, 0., 2.36532e+08, -7.00645e+08, 0. }
};
}
expected_results_type<IsMatrixOrVector::vector> GetExpectedVectorP2P1()
{
// #1259 The results below are those computed with current instance; Dominique should provide soon
// independently obtained ones with greater precision.
return expected_results_type<IsMatrixOrVector::vector>
{
1.63454e+10,
-8.48116e+10,
-3.56282e+10,
-9.66401e+09,
4.64395e+10,
1.77902e+10,
-6.68136e+09,
3.83721e+10,
1.78379e+10
};
}
} // namespace TestNS::NonLinearMembraneOperatorNS
} // namespace MoReFEM
/*!
// \file
//
//
// Created by Gautier Bureau <gautier.bureau@inria.fr> on the Fri, 3 Feb 2017 11:26:22 +0100
// Copyright (c) Inria. All rights reserved.
//
*/
#include "ThirdParty/IncludeWithoutWarning/Boost/Test.hpp"
#include "ParameterInstances/Compound/Solid/Solid.hpp"
#include "OperatorInstances/VariationalOperator/NonlinearForm/NonlinearMembrane.hpp"
#include "Test/Operators/VariationalInstances/NonlinearMembrane/Model.hpp"
#include "Test/Operators/VariationalInstances/NonlinearMembrane/ExpectedResults.hpp"
#include "Test/Tools/TestLinearAlgebra.hpp"
namespace MoReFEM
{
namespace TestNS::NonLinearMembraneOperatorNS
{
namespace // anonymous
{
using ::MoReFEM::Internal::assemble_into_matrix;
using ::MoReFEM::Internal::assemble_into_vector;
} // namespace anonymous
void Model::TestP2P1() const
{
const auto& god_of_dof = GetGodOfDof(EnumUnderlyingType(MeshIndex::mesh));
decltype(auto) morefem_data = parent::GetMoReFEMData();
const auto& displacement_p1_numbering_subset =
god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::displacementP1));
const auto& displacement_p2_numbering_subset =
god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::displacementP2));
const auto& felt_space_surface = god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::surface));
decltype(auto) domain_full_mesh =
DomainManager::GetInstance(__FILE__, __LINE__).GetDomain(EnumUnderlyingType(DomainIndex::full_mesh), __FILE__, __LINE__);
Solid solid(morefem_data.GetInputData(),
domain_full_mesh,
felt_space_surface.GetQuadratureRulePerTopology());
decltype(auto) unknown_manager = UnknownManager::GetInstance(__FILE__, __LINE__);
const auto& displacement_p1_ptr =
unknown_manager.GetUnknownPtr(EnumUnderlyingType(UnknownIndex::displacementP1));
const auto& displacement_p2_ptr =
unknown_manager.GetUnknownPtr(EnumUnderlyingType(UnknownIndex::displacementP2));
namespace GVO = GlobalVariationalOperatorNS;
namespace IPL = Utilities::InputDataNS;
using scalar_parameter_type = Internal::ParameterNS::ParameterInstance
<
ParameterNS::Type::scalar,
::MoReFEM::ParameterNS::Policy::Constant,
ParameterNS::TimeDependencyNS::None
>;
decltype(auto) domain_manager = DomainManager::GetInstance(__FILE__, __LINE__);
decltype(auto) domain_surface =
domain_manager.GetDomain(EnumUnderlyingType(DomainIndex::surface), __FILE__, __LINE__);
scalar_parameter_type thickness("Thickness",
domain_surface,
1.);
scalar_parameter_type pretension("Pretension",
domain_surface,
0.);
GVO::NonlinearMembrane stiffness_operator(felt_space_surface,
displacement_p2_ptr,
displacement_p1_ptr,
solid.GetYoungModulus(),
solid.GetPoissonRatio(),
thickness,
pretension);
GlobalMatrix matrix_tangent_stiffness(displacement_p1_numbering_subset, displacement_p2_numbering_subset);
AllocateGlobalMatrix(god_of_dof, matrix_tangent_stiffness);
GlobalVector vector_stiffness_residual(displacement_p1_numbering_subset);
AllocateGlobalVector(god_of_dof, vector_stiffness_residual);
GlobalVector previous_iteration(displacement_p2_numbering_subset);
AllocateGlobalVector(god_of_dof, previous_iteration);
{
Wrappers::Petsc::AccessVectorContent<Utilities::Access::read_and_write>
content(previous_iteration,
__FILE__, __LINE__);
content[0] = 30.;
content[3] = -42.;
content[6] = -17.;
content[1] = 10.;
content[4] = 97.;
content[7] = 41.;
content[2] = 5.;
content[5] = -84.;
content[8] = -20.5;
content[9] = 1.84;
content[10] = -113.98;
content[11] = -8.97;
content[12] = 29.43;
content[13] = .32;
content[14] = -49.83;
content[15] = 2.432;
content[16] = -231.24;
content[17] = -70.5;
}
GlobalMatrixWithCoefficient mat(matrix_tangent_stiffness, 1.);
GlobalVectorWithCoefficient vec(vector_stiffness_residual, 1.);
stiffness_operator.Assemble(std::make_tuple(std::ref(mat), std::ref(vec)),
previous_iteration);
/* BOOST_CHECK_NO_THROW */(CheckMatrix(god_of_dof,
matrix_tangent_stiffness,
GetExpectedMatrixP2P1(),
__FILE__, __LINE__,
1.e6)); // #1259 Obviously we need more precise reference values!
/* BOOST_CHECK_NO_THROW */(CheckVector(god_of_dof,
vector_stiffness_residual,
GetExpectedVectorP2P1(),
__FILE__, __LINE__,
1.e6)); // #1259 Obviously we need more precise reference values!
}
} // namespace TestNS::NonLinearMembraneOperatorNS
} // namespace MoReFEM
......@@ -82,16 +82,6 @@ BOOST_FIXTURE_TEST_SUITE(same_unknown_for_test, fixture_type)
BOOST_AUTO_TEST_SUITE_END()
BOOST_FIXTURE_TEST_SUITE(different_unknown, fixture_type)
BOOST_AUTO_TEST_CASE(unknown_p2_test_p1)
{
GetModel().TestP2P1();
}
BOOST_AUTO_TEST_SUITE_END()
namespace // anonymous
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment