xref: /libCEED/examples/solids/problems/linear.c (revision b0d170e7bc2e5c930ee481a47eb73044935a48a4)
1 // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause
5 //
6 // This file is part of CEED:  http://github.com/ceed
7 
8 #include "../qfunctions/linear.h"
9 
10 #include <ceed.h>
11 
12 #include "../include/setup-libceed.h"
13 #include "../include/structs.h"
14 #include "../problems/neo-hookean.h"
15 #include "../problems/problems.h"
16 #include "../qfunctions/common.h"
17 #include "../qfunctions/manufactured-true.h"
18 
19 ProblemData linear_elasticity = {
20     .setup_geo            = SetupGeo,
21     .setup_geo_loc        = SetupGeo_loc,
22     .q_data_size          = 10,
23     .quadrature_mode      = CEED_GAUSS,
24     .residual             = ElasLinearF,
25     .residual_loc         = ElasLinearF_loc,
26     .number_fields_stored = 0,
27     .jacobian             = ElasLineardF,
28     .jacobian_loc         = ElasLineardF_loc,
29     .energy               = ElasLinearEnergy,
30     .energy_loc           = ElasLinearEnergy_loc,
31     .diagnostic           = ElasLinearDiagnostic,
32     .diagnostic_loc       = ElasLinearDiagnostic_loc,
33     .true_soln            = MMSTrueSoln,
34     .true_soln_loc        = MMSTrueSoln_loc,
35 };
36 
37 PetscErrorCode SetupLibceedFineLevel_ElasLinear(DM dm, DM dm_energy, DM dm_diagnostic, Ceed ceed, AppCtx app_ctx, CeedQFunctionContext phys_ctx,
38                                                 PetscInt fine_level, PetscInt num_comp_u, PetscInt U_g_size, PetscInt U_loc_size,
39                                                 CeedVector force_ceed, CeedVector neumann_ceed, CeedData *data) {
40   PetscFunctionBegin;
41 
42   PetscCall(SetupLibceedFineLevel(dm, dm_energy, dm_diagnostic, ceed, app_ctx, phys_ctx, linear_elasticity, fine_level, num_comp_u, U_g_size,
43                                   U_loc_size, force_ceed, neumann_ceed, data));
44 
45   PetscFunctionReturn(0);
46 };
47 
48 PetscErrorCode SetupLibceedLevel_ElasLinear(DM dm, Ceed ceed, AppCtx app_ctx, PetscInt level, PetscInt num_comp_u, PetscInt U_g_size,
49                                             PetscInt U_loc_size, CeedVector fine_mult, CeedData *data) {
50   PetscFunctionBegin;
51 
52   PetscCall(SetupLibceedLevel(dm, ceed, app_ctx, linear_elasticity, level, num_comp_u, U_g_size, U_loc_size, fine_mult, data));
53 
54   PetscFunctionReturn(0);
55 };
56