-
Notifications
You must be signed in to change notification settings - Fork 9
/
test_integration_thermoelastic.cc
78 lines (59 loc) · 2.76 KB
/
test_integration_thermoelastic.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* Copyright (c) 2016 - 2024, the adamantine authors.
*
* This file is subject to the Modified BSD License and may not be distributed
* without copyright and license information. Please refer to the file LICENSE
* for the text and further information on this license.
*/
#include "MaterialStates.hh"
#define BOOST_TEST_MODULE Integration_Thermoelastic
#include "../application/adamantine.hh"
#include <boost/property_tree/info_parser.hpp>
#include <filesystem>
#include <fstream>
#include "main.cc"
namespace utf = boost::unit_test;
BOOST_AUTO_TEST_CASE(integration_thermoelastic, *utf::tolerance(1.0e-5))
{
MPI_Comm communicator = MPI_COMM_WORLD;
std::vector<adamantine::Timer> timers;
initialize_timers(communicator, timers);
// Read the input.
std::string const filename = "thermoelastic_bare_plate.info";
adamantine::ASSERT_THROW(std::filesystem::exists(filename) == true,
"The file " + filename + " does not exist.");
boost::property_tree::ptree database;
boost::property_tree::info_parser::read_info(filename, database);
database.put("materials.material_0.solid.thermal_expansion_coef", 17.2e-3);
auto [temperature, displacement] =
run<3, 3, adamantine::SolidLiquidPowder, dealii::MemorySpace::Host>(
communicator, database, timers);
// For now doing a simple regression test. Without a dof handler, it's hard to
// do something more meaningful with the vector.
// To generate a new gold solution
// std::cout << "dis l2:" << displacement.l2_norm() << std::endl;
BOOST_TEST(displacement.l2_norm() == 0.21537566016824577);
}
BOOST_AUTO_TEST_CASE(integration_thermoelastic_add_material,
*utf::tolerance(1.0e-5))
{
MPI_Comm communicator = MPI_COMM_WORLD;
std::vector<adamantine::Timer> timers;
initialize_timers(communicator, timers);
// Read the input.
std::string const filename = "thermoelastic_bare_plate.info";
adamantine::ASSERT_THROW(std::filesystem::exists(filename) == true,
"The file " + filename + " does not exist.");
boost::property_tree::ptree database;
boost::property_tree::info_parser::read_info(filename, database);
database.put("geometry.height", 8.0e-3);
database.put("geometry.height_division", 4);
database.put("sources.beam_0.scan_path_file",
"thermoelastic_bare_plate_add_material_scan_path.txt");
database.put("materials.material_0.solid.thermal_expansion_coef", 17.2e-3);
auto [temperature, displacement] =
run<3, 2, adamantine::SolidLiquidPowder, dealii::MemorySpace::Host>(
communicator, database, timers);
// For now doing a simple regression test. Without a dof handler, it's hard to
// do something more meaningful with the vector.
BOOST_TEST(displacement.l2_norm() == 0.355534971638);
}