xref: /libCEED/examples/solids/problems/linear.c (revision 5754ecac3b7d1ff97b39b25dc78c06350f2c900d)
1*5754ecacSJeremy L Thompson #include <ceed.h>
2*5754ecacSJeremy L Thompson #include "../include/structs.h"
3*5754ecacSJeremy L Thompson #include "../include/setup-libceed.h"
4*5754ecacSJeremy L Thompson #include "../problems/problems.h"
5*5754ecacSJeremy L Thompson #include "../problems/neo-hookean.h"
6*5754ecacSJeremy L Thompson #include "../qfunctions/common.h"
7*5754ecacSJeremy L Thompson #include "../qfunctions/linear.h"
8*5754ecacSJeremy L Thompson #include "../qfunctions/manufactured-true.h"
9*5754ecacSJeremy L Thompson 
10*5754ecacSJeremy L Thompson ProblemData linear_elasticity = {
11*5754ecacSJeremy L Thompson   .setup_geo = SetupGeo,
12*5754ecacSJeremy L Thompson   .setup_geo_loc = SetupGeo_loc,
13*5754ecacSJeremy L Thompson   .geo_data_size = 10,
14*5754ecacSJeremy L Thompson   .quadrature_mode = CEED_GAUSS,
15*5754ecacSJeremy L Thompson   .residual = ElasLinearF,
16*5754ecacSJeremy L Thompson   .residual_loc = ElasLinearF_loc,
17*5754ecacSJeremy L Thompson   .number_fields_stored = 0,
18*5754ecacSJeremy L Thompson   .jacobian = ElasLineardF,
19*5754ecacSJeremy L Thompson   .jacobian_loc = ElasLineardF_loc,
20*5754ecacSJeremy L Thompson   .energy = ElasLinearEnergy,
21*5754ecacSJeremy L Thompson   .energy_loc = ElasLinearEnergy_loc,
22*5754ecacSJeremy L Thompson   .diagnostic = ElasLinearDiagnostic,
23*5754ecacSJeremy L Thompson   .diagnostic_loc = ElasLinearDiagnostic_loc,
24*5754ecacSJeremy L Thompson   .true_soln = MMSTrueSoln,
25*5754ecacSJeremy L Thompson   .true_soln_loc = MMSTrueSoln_loc,
26*5754ecacSJeremy L Thompson };
27*5754ecacSJeremy L Thompson 
28*5754ecacSJeremy L Thompson PetscErrorCode SetupLibceedFineLevel_ElasLinear(DM dm, DM dm_energy,
29*5754ecacSJeremy L Thompson     DM dm_diagnostic, Ceed ceed, AppCtx app_ctx, CeedQFunctionContext phys_ctx,
30*5754ecacSJeremy L Thompson     PetscInt fine_level, PetscInt num_comp_u, PetscInt U_g_size,
31*5754ecacSJeremy L Thompson     PetscInt U_loc_size, CeedVector force_ceed, CeedVector neumann_ceed,
32*5754ecacSJeremy L Thompson     CeedData *data) {
33*5754ecacSJeremy L Thompson   PetscErrorCode ierr;
34*5754ecacSJeremy L Thompson 
35*5754ecacSJeremy L Thompson   PetscFunctionBegin;
36*5754ecacSJeremy L Thompson 
37*5754ecacSJeremy L Thompson   ierr = SetupLibceedFineLevel(dm, dm_energy, dm_diagnostic, ceed, app_ctx,
38*5754ecacSJeremy L Thompson                                phys_ctx, linear_elasticity,
39*5754ecacSJeremy L Thompson                                fine_level, num_comp_u, U_g_size, U_loc_size,
40*5754ecacSJeremy L Thompson                                force_ceed, neumann_ceed, data); CHKERRQ(ierr);
41*5754ecacSJeremy L Thompson 
42*5754ecacSJeremy L Thompson   PetscFunctionReturn(0);
43*5754ecacSJeremy L Thompson };
44*5754ecacSJeremy L Thompson 
45*5754ecacSJeremy L Thompson PetscErrorCode SetupLibceedLevel_ElasLinear(DM dm, Ceed ceed, AppCtx app_ctx,
46*5754ecacSJeremy L Thompson     PetscInt level, PetscInt num_comp_u, PetscInt U_g_size, PetscInt U_loc_size,
47*5754ecacSJeremy L Thompson     CeedVector fine_mult, CeedData *data) {
48*5754ecacSJeremy L Thompson   PetscErrorCode ierr;
49*5754ecacSJeremy L Thompson 
50*5754ecacSJeremy L Thompson   PetscFunctionBegin;
51*5754ecacSJeremy L Thompson 
52*5754ecacSJeremy L Thompson   ierr = SetupLibceedLevel(dm, ceed, app_ctx, linear_elasticity,
53*5754ecacSJeremy L Thompson                            level, num_comp_u, U_g_size, U_loc_size, fine_mult, data);
54*5754ecacSJeremy L Thompson   CHKERRQ(ierr);
55*5754ecacSJeremy L Thompson 
56*5754ecacSJeremy L Thompson   PetscFunctionReturn(0);
57*5754ecacSJeremy L Thompson };
58