-
Notifications
You must be signed in to change notification settings - Fork 13
/
otm_apps.cpp
587 lines (561 loc) · 26.9 KB
/
otm_apps.cpp
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
#include <lgr_exodus.hpp>
#include <lgr_input.hpp>
#include <lgr_state.hpp>
#include <otm_apps.hpp>
#include <otm_meshless.hpp>
#include <otm_search.hpp>
#include <otm_tet2meshless.hpp>
#include <otm_tetrahedron_util.hpp>
#include <otm_util.hpp>
namespace lgr {
hpc::stress<double>
otm_compute_stress_average(state const& s)
{
auto num_points = s.points.size();
auto points_to_sigma_full = s.sigma_full.cbegin();
auto functor = [=] HPC_DEVICE(point_index const point) {
auto const sigma = points_to_sigma_full[point].load();
return sigma;
};
hpc::stress<double> init(0, 0, 0, 0, 0, 0, 0, 0, 0);
auto const sigma_sum =
hpc::transform_reduce(hpc::device_policy(), s.points, init, hpc::plus<hpc::stress<double>>(), functor);
return sigma_sum / num_points;
}
hpc::deformation_gradient<double>
otm_compute_deformation_gradient_average(state const& s)
{
auto num_points = s.points.size();
auto points_to_F = s.F_total.cbegin();
auto functor = [=] HPC_DEVICE(point_index const point) {
auto const F = points_to_F[point].load();
return F;
};
hpc::deformation_gradient<double> init(0, 0, 0, 0, 0, 0, 0, 0, 0);
auto const F_sum = hpc::transform_reduce(
hpc::device_policy(), s.points, init, hpc::plus<hpc::deformation_gradient<double>>(), functor);
return F_sum / num_points;
}
void
otm_nu_zero_patch_test_ics(state& s, hpc::speed<double> const top_velocity)
{
auto const nodes_to_x = s.x.cbegin();
auto const nodes_to_u = s.u.begin();
auto const nodes_to_v = s.v.begin();
auto const top_vel = top_velocity;
auto functor = [=] HPC_DEVICE(node_index const node) {
auto const x = nodes_to_x[node].load();
auto const vz = top_vel * x(2);
nodes_to_u[node] = hpc::position<double>(0.0, 0.0, 0.0);
nodes_to_v[node] = hpc::velocity<double>(0.0, 0.0, vz);
};
hpc::for_each(hpc::device_policy(), s.nodes, functor);
}
void
otm_uniaxial_patch_test_ics(state& s, hpc::speed<double> const top_velocity, hpc::adimensional<double> nu)
{
auto const nodes_to_x = s.x.cbegin();
auto const nodes_to_u = s.u.begin();
auto const nodes_to_v = s.v.begin();
auto const top_vel = top_velocity;
auto const trans_vel = -nu * top_velocity;
auto functor = [=] HPC_DEVICE(node_index const node) {
auto const x = nodes_to_x[node].load();
auto const vx = trans_vel * x(0);
auto const vy = trans_vel * x(1);
auto const vz = top_vel * x(2);
nodes_to_u[node] = hpc::position<double>(0.0, 0.0, 0.0);
nodes_to_v[node] = hpc::velocity<double>(vx, vy, vz);
};
hpc::for_each(hpc::device_policy(), s.nodes, functor);
}
void
otm_cylindrical_flyer_ics(state& s, hpc::speed<double> const init_velocity)
{
auto const nodes_to_u = s.u.begin();
auto const nodes_to_v = s.v.begin();
auto const vz = init_velocity;
auto functor = [=] HPC_DEVICE(node_index const node) {
nodes_to_u[node] = hpc::position<double>(0.0, 0.0, 0.0);
nodes_to_v[node] = hpc::velocity<double>(0.0, 0.0, vz);
};
hpc::for_each(hpc::device_policy(), s.nodes, functor);
}
bool
otm_j2_nu_zero_patch_test()
{
material_index num_materials(1);
material_index num_boundaries(4);
input in(num_materials, num_boundaries);
state s;
std::string const filename{"cube.g"};
auto const points_in_element = 1;
s.points_in_element.resize(point_in_element_index(points_in_element));
in.otm_material_points_to_add_per_element = points_in_element;
tet_nodes_to_points point_interpolator(points_in_element);
in.xp_transform = std::ref(point_interpolator);
auto const err_code = read_exodus_file(filename, in, s);
if (err_code != 0) {
HPC_ERROR_EXIT("Error reading Exodus file : cube.g");
}
in.name = "nu-zero-patch-test";
in.end_time = 1.0e-03;
in.num_file_output_periods = 100;
in.do_output = false;
in.debug_output = true;
auto const rho = hpc::density<double>(7.8e+03);
auto const nu = hpc::adimensional<double>(0.00);
auto const E = hpc::pressure<double>(200.0e09);
auto const K = hpc::pressure<double>(E / (3.0 * (1.0 - 2.0 * nu)));
auto const G = hpc::pressure<double>(E / (2.0 * (1.0 + nu)));
auto const Y0 = hpc::pressure<double>(1.0e+64);
auto const n = hpc::adimensional<double>(4.0);
auto const eps0 = hpc::strain<double>(1.0e-02);
auto const Svis0 = hpc::pressure<double>(Y0);
auto const m = hpc::adimensional<double>(2.0);
auto const eps_dot0 = hpc::strain_rate<double>(1.0e-01);
constexpr material_index body(0);
constexpr material_index x_min(1);
constexpr material_index y_min(2);
constexpr material_index z_min(3);
constexpr material_index z_max(4);
in.materials = hpc::counting_range<material_index>(1);
in.enable_variational_J2[body] = true;
in.rho0[body] = rho;
in.K0[body] = K;
in.G0[body] = G;
in.Y0[body] = Y0;
in.n[body] = n;
in.eps0[body] = eps0;
in.Svis0[body] = Svis0;
in.m[body] = m;
in.eps_dot0[body] = eps_dot0;
in.CFL = 1.0;
in.use_constant_dt = true;
in.constant_dt = hpc::time<double>(1.0e-06);
in.otm_gamma = 1.5;
auto const tol = hpc::length<double>(1.0e-04);
static constexpr hpc::vector3<double> x_axis(1.0, 0.0, 0.0);
static constexpr hpc::vector3<double> y_axis(0.0, 1.0, 0.0);
static constexpr hpc::vector3<double> z_axis(0.0, 0.0, 1.0);
in.domains[body] = std::make_unique<clipped_domain<all_space>>(all_space{});
in.domains[x_min] = epsilon_around_plane_domain({x_axis, 0.0}, tol);
in.domains[y_min] = epsilon_around_plane_domain({y_axis, 0.0}, tol);
in.domains[z_min] = epsilon_around_plane_domain({z_axis, 0.0}, tol);
in.domains[z_max] = epsilon_around_plane_domain({z_axis, 1.0}, tol);
convert_tet_mesh_to_meshless(in, s);
s.dt = in.constant_dt;
s.dt_old = in.constant_dt;
s.time = hpc::time<double>(0.0);
s.max_stable_dt = in.constant_dt;
s.num_time_steps = static_cast<int>(std::round(in.end_time / in.constant_dt));
otm_allocate_state(in, s);
auto const top_velocity = hpc::speed<double>(10.0);
s.prescribed_v[body] = hpc::velocity<double>(0.0, 0.0, 0.0);
s.prescribed_dof[body] = hpc::vector3<int>(0, 0, 0);
s.prescribed_v[x_min] = hpc::velocity<double>(0.0, 0.0, 0.0);
s.prescribed_dof[x_min] = hpc::vector3<int>(1, 0, 0);
s.prescribed_v[y_min] = hpc::velocity<double>(0.0, 0.0, 0.0);
s.prescribed_dof[y_min] = hpc::vector3<int>(0, 1, 0);
s.prescribed_v[z_min] = hpc::velocity<double>(0.0, 0.0, 0.0);
s.prescribed_dof[z_min] = hpc::vector3<int>(0, 0, 1);
s.prescribed_v[z_max] = hpc::velocity<double>(0.0, 0.0, top_velocity);
s.prescribed_dof[z_max] = hpc::vector3<int>(0, 0, 1);
auto const I = hpc::deformation_gradient<double>::identity();
auto const ep0 = hpc::strain<double>(0.0);
auto const b0 = hpc::acceleration<double>::zero();
hpc::fill(hpc::device_policy(), s.rho, rho);
hpc::fill(hpc::device_policy(), s.F_total, I);
hpc::fill(hpc::device_policy(), s.Fp_total, I);
hpc::fill(hpc::device_policy(), s.ep, ep0);
hpc::fill(hpc::device_policy(), s.b, b0);
otm_nu_zero_patch_test_ics(s, top_velocity);
otm_initialize(in, s);
otm_run(in, s);
auto const top_displacement = top_velocity * s.time;
auto const F33 = hpc::strain<double>(1.0 + top_displacement / hpc::length<double>(1.0));
auto const F = hpc::deformation_gradient<double>(1, 0, 0, 0, 1, 0, 0, 0, F33);
auto const J = hpc::determinant(F);
auto const C = hpc::transpose(F) * F;
auto const e = 0.5 * hpc::log(C);
// Not true in general, but this is nu_zero deformation
auto sigma_gold = (E / J) * e;
auto const sigma_avg = otm_compute_stress_average(s);
auto const F_avg = otm_compute_deformation_gradient_average(s);
auto const error_sigma = hpc::norm(sigma_avg - sigma_gold) / hpc::norm(sigma_gold);
auto const tol_sigma = 1.0e-12;
std::cout << "DEF GRAD GOLD:\n" << F << "\nDEF GRAD AVERAGE:\n" << F_avg << '\n';
std::cout << "STRESS GOLD:\n" << sigma_gold << "\nSTRESS AVERAGE:\n" << sigma_avg << '\n';
std::cout << "STRESS ERROR: " << error_sigma << ", STRESS TOLERANCE: " << tol_sigma << '\n';
return error_sigma <= tol_sigma;
}
bool
otm_j2_uniaxial_patch_test()
{
material_index num_materials(1);
material_index num_boundaries(4);
input in(num_materials, num_boundaries);
state s;
std::string const filename{"cube.g"};
auto const points_in_element = 1;
s.points_in_element.resize(point_in_element_index(points_in_element));
in.otm_material_points_to_add_per_element = points_in_element;
tet_nodes_to_points point_interpolator(points_in_element);
in.xp_transform = std::ref(point_interpolator);
auto const err_code = read_exodus_file(filename, in, s);
if (err_code != 0) {
HPC_ERROR_EXIT("Error reading Exodus file : cube.g");
}
in.name = "uniaxial-patch-test";
in.end_time = 1.0e-03;
in.num_file_output_periods = 100;
in.do_output = false;
in.debug_output = true;
auto const rho = hpc::density<double>(7.8e+03);
auto const nu = hpc::adimensional<double>(0.25);
auto const E = hpc::pressure<double>(200.0e09);
auto const K = hpc::pressure<double>(E / (3.0 * (1.0 - 2.0 * nu)));
auto const G = hpc::pressure<double>(E / (2.0 * (1.0 + nu)));
auto const Y0 = hpc::pressure<double>(1.0e+64);
auto const n = hpc::adimensional<double>(4.0);
auto const eps0 = hpc::strain<double>(1.0e-02);
auto const Svis0 = hpc::pressure<double>(Y0);
auto const m = hpc::adimensional<double>(2.0);
auto const eps_dot0 = hpc::strain_rate<double>(1.0e-01);
constexpr material_index body(0);
constexpr material_index x_min(1);
constexpr material_index y_min(2);
constexpr material_index z_min(3);
constexpr material_index z_max(4);
in.materials = hpc::counting_range<material_index>(1);
in.enable_variational_J2[body] = true;
in.rho0[body] = rho;
in.K0[body] = K;
in.G0[body] = G;
in.Y0[body] = Y0;
in.n[body] = n;
in.eps0[body] = eps0;
in.Svis0[body] = Svis0;
in.m[body] = m;
in.eps_dot0[body] = eps_dot0;
in.CFL = 1.0;
in.use_constant_dt = true;
in.otm_gamma = 1.5;
in.constant_dt = hpc::time<double>(1.0e-06);
auto const tol = hpc::length<double>(1.0e-04);
static constexpr hpc::vector3<double> x_axis(1.0, 0.0, 0.0);
static constexpr hpc::vector3<double> y_axis(0.0, 1.0, 0.0);
static constexpr hpc::vector3<double> z_axis(0.0, 0.0, 1.0);
in.domains[body] = std::make_unique<clipped_domain<all_space>>(all_space{});
in.domains[x_min] = epsilon_around_plane_domain({x_axis, 0.0}, tol);
in.domains[y_min] = epsilon_around_plane_domain({y_axis, 0.0}, tol);
in.domains[z_min] = epsilon_around_plane_domain({z_axis, 0.0}, tol);
in.domains[z_max] = epsilon_around_plane_domain({z_axis, 1.0}, tol);
convert_tet_mesh_to_meshless(in, s);
s.dt = in.constant_dt;
s.dt_old = in.constant_dt;
s.time = hpc::time<double>(0.0);
s.max_stable_dt = in.constant_dt;
s.num_time_steps = static_cast<int>(std::round(in.end_time / in.constant_dt));
otm_allocate_state(in, s);
auto const top_velocity = hpc::speed<double>(10.0);
auto const trans_velocity = -nu * top_velocity;
s.prescribed_v[body] = hpc::velocity<double>(0.0, 0.0, 0.0);
s.prescribed_dof[body] = hpc::vector3<int>(0, 0, 0);
s.prescribed_v[x_min] = hpc::velocity<double>(0.0, 0.0, 0.0);
s.prescribed_dof[x_min] = hpc::vector3<int>(1, 0, 0);
s.prescribed_v[y_min] = hpc::velocity<double>(0.0, 0.0, 0.0);
s.prescribed_dof[y_min] = hpc::vector3<int>(0, 1, 0);
s.prescribed_v[z_min] = hpc::velocity<double>(0.0, 0.0, 0.0);
s.prescribed_dof[z_min] = hpc::vector3<int>(0, 0, 1);
s.prescribed_v[z_max] = hpc::velocity<double>(0.0, 0.0, top_velocity);
s.prescribed_dof[z_max] = hpc::vector3<int>(0, 0, 1);
auto const I = hpc::deformation_gradient<double>::identity();
auto const ep0 = hpc::strain<double>(0.0);
auto const b0 = hpc::acceleration<double>::zero();
hpc::fill(hpc::device_policy(), s.rho, rho);
hpc::fill(hpc::device_policy(), s.F_total, I);
hpc::fill(hpc::device_policy(), s.Fp_total, I);
hpc::fill(hpc::device_policy(), s.ep, ep0);
hpc::fill(hpc::device_policy(), s.b, b0);
otm_uniaxial_patch_test_ics(s, top_velocity, nu);
otm_initialize(in, s);
otm_run(in, s);
auto const top_displacement = top_velocity * s.time;
auto const trans_displacement = trans_velocity * s.time;
auto const F11 = hpc::strain<double>(1.0 + trans_displacement / hpc::length<double>(1.0));
auto const F22 = hpc::strain<double>(1.0 + trans_displacement / hpc::length<double>(1.0));
auto const F33 = hpc::strain<double>(1.0 + top_displacement / hpc::length<double>(1.0));
auto const F = hpc::deformation_gradient<double>(F11, 0, 0, 0, F22, 0, 0, 0, F33);
auto const J = hpc::determinant(F);
auto const Jm13 = 1.0 / std::cbrt(J);
auto const Jm23 = Jm13 * Jm13;
auto const Cdev = Jm23 * hpc::transpose(F) * F;
auto const edev = 0.5 * hpc::log(Cdev);
auto const p = K * std::log(J) / J;
auto const Mdev = 2.0 * G * edev;
auto sigma_vol = p * hpc::matrix3x3<double>::identity();
auto sigma_dev = hpc::transpose(hpc::inverse(F)) * Mdev * hpc::transpose(F) / J;
auto sigma_gold = sigma_vol + sigma_dev;
auto const sigma_avg = otm_compute_stress_average(s);
auto const F_avg = otm_compute_deformation_gradient_average(s);
auto const error_sigma = hpc::norm(sigma_avg - sigma_gold) / hpc::norm(sigma_gold);
auto const tol_sigma = 3.62e-03;
std::cout << "DEF GRAD GOLD:\n" << F << "\nDEF GRAD AVERAGE:\n" << F_avg << '\n';
std::cout << "STRESS GOLD:\n" << sigma_gold << "\nSTRESS AVERAGE:\n" << sigma_avg << '\n';
std::cout << "STRESS ERROR: " << error_sigma << ", STRESS TOLERANCE: " << tol_sigma << '\n';
return error_sigma <= tol_sigma;
}
bool
otm_taylor()
{
constexpr material_index body(0);
constexpr material_index num_materials(1);
constexpr material_index num_boundaries(0);
input in(num_materials, num_boundaries);
state s;
std::string const filename{"cylinder.g"};
auto const points_in_element = 1;
in.otm_material_points_to_add_per_element = points_in_element;
tet_nodes_to_points point_interpolator(points_in_element);
in.xp_transform = std::ref(point_interpolator);
auto const err_code = read_exodus_file(filename, in, s);
if (err_code != 0) {
HPC_ERROR_EXIT("Error reading Exodus file : cylinder.g");
}
auto const_v = [=](hpc::counting_range<node_index> const nodes,
hpc::device_array_vector<hpc::position<double>, node_index> const&,
hpc::device_array_vector<hpc::velocity<double>, node_index>* v_vector) {
auto const nodes_to_v = v_vector->begin();
auto functor = [=] HPC_DEVICE(node_index const node) {
auto v = hpc::velocity<double>(0.0, 0.0, 227.0);
nodes_to_v[node] = v;
};
hpc::for_each(hpc::device_policy(), nodes, functor);
};
in.initial_v = const_v;
in.name = "cylindrical-flyer";
in.end_time = 1.0e-04;
in.num_file_output_periods = 100;
in.do_output = true;
in.debug_output = false;
auto const rho = hpc::density<double>(8.96e+03);
auto const nu = hpc::adimensional<double>(0.343);
auto const E = hpc::pressure<double>(110.0e09);
auto const K = hpc::pressure<double>(E / (3.0 * (1.0 - 2.0 * nu)));
auto const G = hpc::pressure<double>(E / (2.0 * (1.0 + nu)));
auto const Y0 = hpc::pressure<double>(400.0e+06);
auto const n = hpc::adimensional<double>(32.0);
auto const H0 = hpc::pressure<double>(100.0e6);
auto const eps0 = hpc::strain<double>(Y0 / H0);
auto const Svis0 = hpc::pressure<double>(0.0);
auto const m = hpc::adimensional<double>(1.0);
auto const eps_dot0 = hpc::strain_rate<double>(1.0e-01);
in.minimum_support_size = 12;
in.materials = hpc::counting_range<material_index>(1);
in.enable_variational_J2[body] = true;
in.enable_neo_Hookean[body] = false;
in.rho0[body] = rho;
in.K0[body] = K;
in.G0[body] = G;
in.Y0[body] = Y0;
in.n[body] = n;
in.eps0[body] = eps0;
in.Svis0[body] = Svis0;
in.m[body] = m;
in.eps_dot0[body] = eps_dot0;
in.CFL = 0.1;
in.use_constant_dt = false;
in.constant_dt = hpc::time<double>(1.0e-07);
in.otm_gamma = 1.5;
in.domains[body] = std::make_unique<clipped_domain<all_space>>(all_space{});
convert_tet_mesh_to_meshless(in, s);
search::do_otm_iterative_point_support_search(s, in.minimum_support_size);
s.otm_gamma = in.otm_gamma;
s.dt = in.constant_dt;
s.dt_old = in.constant_dt;
s.time = hpc::time<double>(0.0);
s.max_stable_dt = in.constant_dt;
s.num_time_steps = static_cast<int>(std::round(in.end_time / in.constant_dt));
s.use_displacement_contact = true;
s.use_penalty_contact = false;
s.contact_penalty_coeff = hpc::strain_rate_rate<double>(1.0e14);
otm_allocate_state(in, s);
s.prescribed_v[body] = hpc::velocity<double>(0.0, 0.0, 0.0);
s.prescribed_dof[body] = hpc::vector3<int>(0, 0, 0);
auto const I = hpc::deformation_gradient<double>::identity();
auto const ep0 = hpc::strain<double>(0.0);
auto const b0 = hpc::acceleration<double>::zero();
hpc::fill(hpc::device_policy(), s.rho, rho);
hpc::fill(hpc::device_policy(), s.F_total, I);
hpc::fill(hpc::device_policy(), s.Fp_total, I);
hpc::fill(hpc::device_policy(), s.ep, ep0);
hpc::fill(hpc::device_policy(), s.b, b0);
otm_initialize(in, s);
hpc::length<double> init{0};
auto const h_node_max = hpc::transform_reduce(
hpc::device_policy(),
s.nearest_node_neighbor_dist,
init,
hpc::maximum<hpc::length<double>>(),
hpc::identity<hpc::length<double>>());
auto const h_point_max = hpc::transform_reduce(
hpc::device_policy(),
s.nearest_point_neighbor_dist,
init,
hpc::maximum<hpc::length<double>>(),
hpc::identity<hpc::length<double>>());
in.enable_adapt = false;
in.max_node_neighbor_distance = h_node_max;
in.max_point_neighbor_distance = h_point_max;
otm_run(in, s);
return true;
}
bool
otm_rmi()
{
constexpr material_index num_materials(2);
constexpr material_index num_boundaries(4);
constexpr material_index flyer(0);
constexpr material_index target(1);
constexpr material_index x_min(2);
constexpr material_index x_max(3);
constexpr material_index y_min(4);
constexpr material_index y_max(5);
input in(num_materials, num_boundaries);
state s;
std::string const filename{"rmi-one-wave.g"};
auto const points_in_element = 1;
in.otm_material_points_to_add_per_element = points_in_element;
tet_nodes_to_points point_interpolator(points_in_element);
in.xp_transform = std::ref(point_interpolator);
auto const err_code = read_exodus_file(filename, in, s);
if (err_code != 0) {
HPC_ERROR_EXIT("Error reading Exodus file : rmi-one-wave.g");
}
auto const flyer_radius = 0.2 * 0.0254;
auto const eps = flyer_radius / 1000.0;
auto flyer_v = [=](hpc::counting_range<node_index> const nodes,
hpc::device_array_vector<hpc::position<double>, node_index> const& x_vector,
hpc::device_array_vector<hpc::velocity<double>, node_index>* v_vector) {
auto const nodes_to_x = x_vector.cbegin();
auto const nodes_to_v = v_vector->begin();
auto functor = [=] HPC_DEVICE(node_index const node) {
auto const x = hpc::vector3<double>(nodes_to_x[node].load());
auto v = hpc::velocity<double>(0.0, 0.0, 0.0);
if (x(2) < -eps) v(2) = 2200.0;
if (-eps <= x(2) && x(2) <= eps) v(2) = 1226.5;
nodes_to_v[node] = v;
};
hpc::for_each(hpc::device_policy(), nodes, functor);
};
in.initial_v = flyer_v;
in.name = "rmi-one-wave";
in.end_time = 1.0e-04;
in.num_file_output_periods = 100;
in.do_output = true;
in.debug_output = false;
auto const rho = hpc::density<double>(8.96e+03);
auto const nu = hpc::adimensional<double>(0.343);
auto const E = hpc::pressure<double>(110.0e09);
auto const K = hpc::pressure<double>(E / (3.0 * (1.0 - 2.0 * nu)));
auto const G = hpc::pressure<double>(E / (2.0 * (1.0 + nu)));
auto const Y0 = hpc::pressure<double>(400.0e+06);
auto const n = hpc::adimensional<double>(32.0);
auto const H0 = hpc::pressure<double>(100.0e6);
auto const eps0 = hpc::strain<double>(Y0 / H0);
auto const Svis0 = hpc::pressure<double>(0.0);
auto const m = hpc::adimensional<double>(1.0);
auto const eps_dot0 = hpc::strain_rate<double>(1.0e-01);
in.minimum_support_size = 12;
in.materials = hpc::counting_range<material_index>(num_materials);
static constexpr hpc::vector3<double> x_axis(1.0, 0.0, 0.0);
static constexpr hpc::vector3<double> y_axis(0.0, 1.0, 0.0);
static constexpr hpc::vector3<double> z_axis(0.0, 0.0, 1.0);
auto const target_length = hpc::length<double>(0.001);
auto const target_width = hpc::length<double>(0.001);
in.domains[x_min] = epsilon_around_plane_domain({x_axis, -target_length / 2.0}, eps);
in.domains[x_max] = epsilon_around_plane_domain({x_axis, target_length / 2.0}, eps);
in.domains[y_min] = epsilon_around_plane_domain({y_axis, -target_width / 2.0}, eps);
in.domains[y_max] = epsilon_around_plane_domain({y_axis, target_width / 2.0}, eps);
in.zero_displacement_conditions.push_back({x_min, x_axis});
in.zero_displacement_conditions.push_back({x_max, x_axis});
in.zero_displacement_conditions.push_back({y_min, y_axis});
in.zero_displacement_conditions.push_back({y_max, y_axis});
in.CFL = 0.1;
in.use_constant_dt = false;
in.constant_dt = hpc::time<double>(1.0e-07);
in.otm_gamma = 1.5;
in.enable_variational_J2[flyer] = true;
in.enable_neo_Hookean[flyer] = false;
in.rho0[flyer] = rho;
in.K0[flyer] = K;
in.G0[flyer] = G;
in.Y0[flyer] = Y0;
in.n[flyer] = n;
in.eps0[flyer] = eps0;
in.Svis0[flyer] = Svis0;
in.m[flyer] = m;
in.eps_dot0[flyer] = eps_dot0;
in.domains[flyer] = half_space_domain(plane{-z_axis, 0.0});
in.enable_variational_J2[target] = true;
in.enable_neo_Hookean[target] = false;
in.rho0[target] = rho;
in.K0[target] = K;
in.G0[target] = G;
in.Y0[target] = Y0;
in.n[target] = n;
in.eps0[target] = eps0;
in.Svis0[target] = Svis0;
in.m[target] = m;
in.eps_dot0[target] = eps_dot0;
in.domains[target] = half_space_domain(plane{z_axis, 0.0});
convert_tet_mesh_to_meshless(in, s);
search::do_otm_iterative_point_support_search(s, in.minimum_support_size);
s.otm_gamma = in.otm_gamma;
s.dt = in.constant_dt;
s.dt_old = in.constant_dt;
s.time = hpc::time<double>(0.0);
s.max_stable_dt = in.constant_dt;
s.num_time_steps = static_cast<int>(std::round(in.end_time / in.constant_dt));
s.use_displacement_contact = true;
s.use_penalty_contact = false;
s.contact_penalty_coeff = hpc::strain_rate_rate<double>(1.0e14);
otm_allocate_state(in, s);
auto const I = hpc::deformation_gradient<double>::identity();
auto const ep0 = hpc::strain<double>(0.0);
auto const b0 = hpc::acceleration<double>::zero();
hpc::fill(hpc::device_policy(), s.rho, rho);
hpc::fill(hpc::device_policy(), s.F_total, I);
hpc::fill(hpc::device_policy(), s.Fp_total, I);
hpc::fill(hpc::device_policy(), s.ep, ep0);
hpc::fill(hpc::device_policy(), s.b, b0);
otm_initialize(in, s);
hpc::length<double> init{0};
auto const h_node_max = hpc::transform_reduce(
hpc::device_policy(),
s.nearest_node_neighbor_dist,
init,
hpc::maximum<hpc::length<double>>(),
hpc::identity<hpc::length<double>>());
auto const h_point_max = hpc::transform_reduce(
hpc::device_policy(),
s.nearest_point_neighbor_dist,
init,
hpc::maximum<hpc::length<double>>(),
hpc::identity<hpc::length<double>>());
in.enable_adapt = false;
in.max_node_neighbor_distance = h_node_max;
in.max_point_neighbor_distance = h_point_max;
otm_run(in, s);
return true;
}
otm_scope::otm_scope()
{
search::initialize_otm_search();
}
otm_scope::~otm_scope()
{
search::finalize_otm_search();
}
} // namespace lgr