-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathdem.cc
117 lines (104 loc) · 3.55 KB
/
dem.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// SPDX-FileCopyrightText: Copyright (c) 2020, 2023-2024 The Lethe Authors
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
#include "dem/dem.h"
#include "core/dem_properties.h"
using namespace dealii;
int
main(int argc, char *argv[])
{
try
{
Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
if (argc != 2)
{
std::cout << "Usage:" << argv[0] << " input_file" << std::endl;
std::exit(1);
}
const unsigned int dim = get_dimension(argv[1]);
if (dim == 2)
{
ParameterHandler prm;
DEMSolverParameters<2> dem_parameters;
dem_parameters.declare(prm);
// Parsing of the file
prm.parse_input(argv[1]);
dem_parameters.parse(prm);
const DEM::SolverType solver_type =
dem_parameters.model_parameters.solver_type;
if (solver_type == DEM::SolverType::dem)
{
DEMSolver<2, DEM::DEMProperties::PropertiesIndex> problem(
dem_parameters);
problem.solve();
}
else
{
AssertThrow(
false,
dealii::ExcMessage(
"While reading the solver type from the input file, "
"Lethe found a value different than \"dem\". As of January 2025, "
"the lethe-particles application requires the uses of "
"\"solver type = dem\", which is the default value."));
}
}
else if (dim == 3)
{
ParameterHandler prm;
DEMSolverParameters<3> dem_parameters;
dem_parameters.declare(prm);
// Parsing of the file
prm.parse_input(argv[1]);
dem_parameters.parse(prm);
// const DEM::SolverType solver_type =
// dem_parameters.model_parameters.solver_type;
const DEM::SolverType solver_type = DEM::SolverType::dem;
if (solver_type == DEM::SolverType::dem)
{
DEMSolver<3, DEM::DEMProperties::PropertiesIndex> problem(
dem_parameters);
problem.solve();
}
else
{
AssertThrow(
false,
dealii::ExcMessage(
"While reading the solver type from the input file, "
"Lethe found a value different than \"dem\". As of January 2025, "
"the lethe-particles application requires the uses of "
"\"solver type = dem\", which is the default value."));
}
}
else
{
return 1;
}
}
catch (std::exception &exc)
{
std::cerr << std::endl
<< std::endl
<< "----------------------------------------------------"
<< std::endl;
std::cerr << "Exception on processing: " << std::endl
<< exc.what() << std::endl
<< "Aborting!" << std::endl
<< "----------------------------------------------------"
<< std::endl;
return 1;
}
catch (...)
{
std::cerr << std::endl
<< std::endl
<< "----------------------------------------------------"
<< std::endl;
std::cerr << "Unknown exception!" << std::endl
<< "Aborting!" << std::endl
<< "----------------------------------------------------"
<< std::endl;
return 1;
}
return 0;
}