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