5 #include "libmesh/point.h" 21 TEST_CASE(
"constant_orthotropic_thermoelastic_material_1d",
22 "[orthotropic],[material],[constant],[1D],[thermoelastic]")
30 material.
add(alpha11_f);
32 REQUIRE( material.
contains(
"alpha11_expansion") );
34 SECTION(
"1D material thermal expansion matrix")
39 const libMesh::Point point(2.3, 3.1, 5.2);
40 const Real time = 2.34;
42 mat_texp(point, time, D_texp);
46 D_texp_true(0,0) = 5.43e-05;
56 CHECK_THAT( test, Catch::Approx<double>(truth) );
61 TEST_CASE(
"constant_orthotropic_structural_material_1d",
62 "[orthotropic],[material],[constant],[1D],[structural]")
84 SECTION(
"1D material constitutive matrix")
89 const libMesh::Point point(2.3, 3.1, 5.2);
90 const Real time = 2.34;
92 mat_stiffness(point, time, D);
107 CHECK_THAT( test, Catch::Approx<double>(truth) );
112 TEST_CASE(
"constant_orthotropic_heat_transfer_material_1d",
113 "[orthotropic],[material],[1D],[heat_transfer][constant]")
128 REQUIRE( material.
contains(
"k11_th") );
130 SECTION(
"material depends on the parameters that it should")
135 SECTION(
"material does not depend on other parameters")
141 SECTION(
"1D thermal conductivity matrix")
146 const libMesh::Point point(2.3, 3.1, 5.2);
147 const Real time = 2.34;
149 mat_conduct(point, time, D_k);
163 CHECK_THAT( test, Catch::Approx<double>(truth) );
168 TEST_CASE(
"constant_orthotropic_transient_heat_transfer_material_1d",
169 "[orthotropic],[material],[1D],[heat_transfer],[constant],[transient]")
187 REQUIRE( material.
contains(
"rho") );
190 SECTION(
"material depends on the parameters that it should")
196 SECTION(
"material does not depend on other parameters")
202 SECTION(
"1D thermal capacitance matrix")
207 const libMesh::Point point(2.3, 3.1, 5.2);
208 const Real time = 2.34;
210 mat_capacit(point, time, D_cp);
213 RealMatrixX D_cp_true = RealMatrixX::Identity(1,1);
214 D_cp_true *= (908.0 * 1234.5);
224 CHECK_THAT( test, Catch::Approx<double>(truth) );
229 TEST_CASE(
"constant_orthotropic_thermoelastic_material_2d",
230 "[orthotropic],[material],[2D],[thermoelastic][constant]")
241 material.
add(alpha11_f);
242 material.
add(alpha22_f);
244 REQUIRE( material.
contains(
"alpha11_expansion") );
245 REQUIRE( material.
contains(
"alpha22_expansion") );
247 SECTION(
"material does not depend on other parameters")
253 SECTION(
"2D material thermal expansion matrix")
258 const libMesh::Point point(2.3, 3.1, 5.2);
259 const Real time = 2.34;
261 mat_texp(point, time, D_texp);
265 D_texp_true(0,0) = 5.43e-05;
266 D_texp_true(1,0) = 8.79e-06;
276 CHECK_THAT( test, Catch::Approx<double>(truth) );
281 TEST_CASE(
"constant_orthotropic_structural_material_2d",
282 "[orthotropic],[material],[2D],[structural],[constant]")
309 material.
add(nu12_f);
310 material.
add(nu23_f);
311 material.
add(nu31_f);
315 REQUIRE( material.
contains(
"E11") );
316 REQUIRE( material.
contains(
"E22") );
317 REQUIRE( material.
contains(
"E33") );
318 REQUIRE( material.
contains(
"nu12") );
319 REQUIRE( material.
contains(
"nu23") );
320 REQUIRE( material.
contains(
"nu31") );
321 REQUIRE( material.
contains(
"G12") );
323 SECTION(
"material depends on the parameters that it should")
334 SECTION(
"material does not depend on other parameters")
340 SECTION(
"2D plane stress material constitutive matrix")
342 const bool is_plane_stress =
true;
346 const libMesh::Point point(2.3, 3.1, 5.2);
347 const Real time = 2.34;
349 mat_stiffness(point, time, K_mat);
361 REQUIRE_THAT( test, Catch::Approx<double>(truth) );
364 SelfAdjointEigenSolver<RealMatrixX> eigensolver(K_mat);
365 if (eigensolver.info() != Success)
367 std::cout <<
"eigensolver failed to converge!" << std::endl;
370 RealVectorX eigenvalues = eigensolver.eigenvalues();
371 for (uint i=0; i<K_mat.cols(); i++)
373 REQUIRE( eigenvalues(i) > 0.0 );
378 K_mat_true(0,0) = 7.853296066534869e+10;
379 K_mat_true(1,1) = 5.999045606380803e+10;
380 K_mat_true(2,2) = 6.830000000000000e+10;
381 K_mat_true(0,1) = K_mat_true(1,0) =1.979685050105665e+10;
391 CHECK_THAT( test, Catch::Approx<double>(truth) );
394 SECTION(
"2D plane strain material constitutive matrix")
396 const bool is_plane_stress =
false;
400 const libMesh::Point point(2.3, 3.1, 5.2);
401 const Real time = 2.34;
403 mat_stiffness(point, time, K_mat);
415 REQUIRE_THAT( test, Catch::Approx<double>(truth) );
418 SelfAdjointEigenSolver<RealMatrixX> eigensolver(K_mat);
419 if (eigensolver.info() != Success)
421 std::cout <<
"eigensolver failed to converge!" << std::endl;
424 RealVectorX eigenvalues = eigensolver.eigenvalues();
425 for (uint i=0; i<K_mat.cols(); i++)
427 REQUIRE( eigenvalues(i) > 0.0 );
432 K_mat_true(0,0) = 1.881848591463047e11;
433 K_mat_true(1,1) = 0.841961884847417e11;
434 K_mat_true(2,2) = 0.683000000000000e11;
435 K_mat_true(0,1) = K_mat_true(1,0) = 0.713158228712175e11;
445 CHECK_THAT( test, Catch::Approx<double>(truth) );
448 SECTION(
"transverse shear material stiffness matrix")
453 const libMesh::Point point(2.3, 3.1, 5.2);
454 const Real time = 2.34;
456 mat_trans_shear(point, time, D_trans_shear);
459 RealMatrixX D_trans_shear_true = RealMatrixX::Zero(2,2);
460 D_trans_shear_true(0,0) = 6.830000000000000e+10;
461 D_trans_shear_true(1,1) = 6.830000000000000e+10;
465 std::vector<double> test(D_trans_shear.data(), D_trans_shear.data()+D_trans_shear.rows()*D_trans_shear.cols());
466 std::vector<double> truth(D_trans_shear_true.data(), D_trans_shear_true.data()+D_trans_shear_true.rows()*D_trans_shear_true.cols());
471 CHECK_THAT( test, Catch::Approx<double>(truth) );
476 TEST_CASE(
"constant_orthotropic_heat_transfer_material_2d",
477 "[orthotropic],[material],[2D],[heat_transfer][constant]")
495 REQUIRE( material.
contains(
"k11_th") );
496 REQUIRE( material.
contains(
"k22_th") );
498 SECTION(
"material depends on the parameters that it should")
504 SECTION(
"material does not depend on other parameters")
510 SECTION(
"2D thermal conductivity matrix")
515 const libMesh::Point point(2.3, 3.1, 5.2);
516 const Real time = 2.34;
518 mat_conduct(point, time, D_k);
522 D_k_true(0,0) = 237.0;
523 D_k_true(1,1) = 542.0;
533 CHECK_THAT( test, Catch::Approx<double>(truth) );
538 TEST_CASE(
"constant_orthotropic_transient_heat_transfer_material_2d",
539 "[orthotropic],[material],[2D],[heat_transfer],[constant],[transient]")
557 REQUIRE( material.
contains(
"rho") );
560 SECTION(
"material depends on the parameters that it should")
566 SECTION(
"material does not depend on other parameters")
572 SECTION(
"2D thermal capacitance matrix")
577 const libMesh::Point point(2.3, 3.1, 5.2);
578 const Real time = 2.34;
580 mat_capacit(point, time, D_cp);
583 RealMatrixX D_cp_true = RealMatrixX::Identity(1,1);
584 D_cp_true *= (908.0 * 1234.5);
594 CHECK_THAT( test, Catch::Approx<double>(truth) );
599 TEST_CASE(
"constant_orthotropic_thermoelastic_material_3d",
600 "[orthotropic],[material],[3D],[thermoelastic][constant]")
613 material.
add(alpha11_f);
614 material.
add(alpha22_f);
615 material.
add(alpha33_f);
617 REQUIRE( material.
contains(
"alpha11_expansion") );
618 REQUIRE( material.
contains(
"alpha22_expansion") );
619 REQUIRE( material.
contains(
"alpha33_expansion") );
621 SECTION(
"material does not depend on other parameters")
627 SECTION(
"3D material thermal expansion matrix")
632 const libMesh::Point point(2.3, 3.1, 5.2);
633 const Real time = 2.34;
635 mat_texp(point, time, D_texp);
639 D_texp_true(0,0) = 5.43e-05;
640 D_texp_true(1,0) = 8.79e-06;
641 D_texp_true(2,0) = 2.14e-05;
651 CHECK_THAT( test, Catch::Approx<double>(truth) );
656 TEST_CASE(
"constant_orthotropic_structural_material_3d",
657 "[orthotropic],[material],[3D],[structural],[constant]")
688 material.
add(nu12_f);
689 material.
add(nu23_f);
690 material.
add(nu31_f);
696 REQUIRE( material.
contains(
"E11") );
697 REQUIRE( material.
contains(
"E22") );
698 REQUIRE( material.
contains(
"E33") );
699 REQUIRE( material.
contains(
"nu12") );
700 REQUIRE( material.
contains(
"nu23") );
701 REQUIRE( material.
contains(
"nu31") );
702 REQUIRE( material.
contains(
"G12") );
703 REQUIRE( material.
contains(
"G23") );
704 REQUIRE( material.
contains(
"G13") );
706 SECTION(
"material depends on the parameters that it should")
719 SECTION(
"material does not depend on other parameters")
725 SECTION(
"3D material constitutive matrix")
727 const bool is_plane_stress =
true;
731 const libMesh::Point point(2.3, 3.1, 5.2);
732 const Real time = 2.34;
734 mat_stiffness(point, time, K_mat);
746 REQUIRE_THAT( test, Catch::Approx<double>(truth) );
749 SelfAdjointEigenSolver<RealMatrixX> eigensolver(K_mat);
750 if (eigensolver.info() != Success)
752 std::cout <<
"eigensolver failed to converge!" << std::endl;
755 RealVectorX eigenvalues = eigensolver.eigenvalues();
756 for (uint i=0; i<K_mat.cols(); i++)
758 REQUIRE( eigenvalues(i) > 0.0 );
763 K_mat_true(0,0) = 1.881848591463047e+11;
764 K_mat_true(1,1) = 0.841961884847417e+11;
765 K_mat_true(2,2) = 0.831923864531179e+11;
766 K_mat_true(3,3) = 0.683000000000000e+11;
767 K_mat_true(4,4) = 0.745000000000000e+11;
768 K_mat_true(5,5) = 0.551000000000000e+11;
770 K_mat_true(0,1) = K_mat_true(1,0) = 0.713158228712175e+11;
771 K_mat_true(0,2) = K_mat_true(2,0) = 0.955102251790129e+11;
772 K_mat_true(1,2) = K_mat_true(2,1) = 0.448746325438223e+11;
782 CHECK_THAT( test, Catch::Approx<double>(truth) );
787 TEST_CASE(
"constant_orthotropic_heat_transfer_material_3d",
788 "[orthotropic],[material],[3D],[heat_transfer][constant]")
809 REQUIRE( material.
contains(
"k11_th") );
810 REQUIRE( material.
contains(
"k22_th") );
811 REQUIRE( material.
contains(
"k33_th") );
813 SECTION(
"material depends on the parameters that it should")
820 SECTION(
"material does not depend on other parameters")
826 SECTION(
"3D thermal conductivity matrix")
831 const libMesh::Point point(2.3, 3.1, 5.2);
832 const Real time = 2.34;
834 mat_conduct(point, time, D_k);
838 D_k_true(0,0) = 237.0;
839 D_k_true(1,1) = 542.0;
840 D_k_true(2,2) = 444.4;
850 CHECK_THAT( test, Catch::Approx<double>(truth) );
855 TEST_CASE(
"constant_orthotropic_transient_heat_transfer_material_3d",
856 "[orthotropic],[material],[3D],[heat_transfer],[constant],[transient]")
874 REQUIRE( material.
contains(
"rho") );
877 SECTION(
"material depends on the parameters that it should")
883 SECTION(
"material does not depend on other parameters")
889 SECTION(
"2D thermal capacitance matrix")
894 const libMesh::Point point(2.3, 3.1, 5.2);
895 const Real time = 2.34;
897 mat_capacit(point, time, D_cp);
900 RealMatrixX D_cp_true = RealMatrixX::Identity(1,1);
901 D_cp_true *= (908.0 * 1234.5);
911 CHECK_THAT( test, Catch::Approx<double>(truth) );
917 "[orthotropic],[material],[3D],[dynamic],[constant]")
932 REQUIRE( material.
contains(
"rho") );
934 SECTION(
"material depends on the parameters that it should")
939 SECTION(
"material does not depend on other parameters")
945 SECTION(
"3D inertia matrix")
950 const libMesh::Point point(2.3, 3.1, 5.2);
951 const Real time = 2.34;
953 mat_capacit(point, time, D_inertia);
956 RealMatrixX D_inertia_true = RealMatrixX::Identity(3,3);
957 D_inertia_true *= 1234.5;
967 CHECK_THAT( test, Catch::Approx<double>(truth) );
TEST_CASE("constant_orthotropic_thermoelastic_material_1d", "[orthotropic],[material],[constant],[1D],[thermoelastic]")
virtual const MAST::FieldFunction< RealMatrixX > & conductance_matrix(const unsigned int dim)
virtual const MAST::FieldFunction< RealMatrixX > & thermal_expansion_matrix(const unsigned int dim)
This is a scalar function whose value can be changed and one that can be used as a design variable in...
virtual const MAST::FieldFunction< RealMatrixX > & inertia_matrix(const unsigned int dim)
virtual const MAST::FieldFunction< RealMatrixX > & stiffness_matrix(const unsigned int dim, const bool plane_stress=true)
void add(MAST::FunctionBase &f)
adds the function to this card and returns a reference to it.
std::vector< double > eigen_matrix_to_std_vector(RealMatrixX M)
Converts an Eigen Matrix object to a std::vector.
bool contains(const std::string &nm) const
checks if the card contains the specified property value
Matrix< Real, Dynamic, Dynamic > RealMatrixX
Matrix< Real, Dynamic, 1 > RealVectorX
virtual const MAST::FieldFunction< RealMatrixX > & capacitance_matrix(const unsigned int dim)
virtual const MAST::FieldFunction< RealMatrixX > & transverse_shear_stiffness_matrix()
virtual bool depends_on(const MAST::FunctionBase &f) const
returns true if the property card depends on the function f