xref: /libCEED/examples/solids/problems/finite-strain-mooney-rivlin.c (revision c8565611f4f88586c9ab8f49f4be6e8b5d8096a7)
1*c8565611SJeremy L Thompson // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
2*c8565611SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3*c8565611SJeremy L Thompson //
4*c8565611SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5*c8565611SJeremy L Thompson //
6*c8565611SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7*c8565611SJeremy L Thompson 
8*c8565611SJeremy L Thompson #include "../qfunctions/finite-strain-mooney-rivlin.h"
9*c8565611SJeremy L Thompson 
10*c8565611SJeremy L Thompson #include <ceed.h>
11*c8565611SJeremy L Thompson #include <petscsys.h>
12*c8565611SJeremy L Thompson 
13*c8565611SJeremy L Thompson #include "../include/setup-libceed.h"
14*c8565611SJeremy L Thompson #include "../include/structs.h"
15*c8565611SJeremy L Thompson #include "../problems/mooney-rivlin.h"
16*c8565611SJeremy L Thompson #include "../problems/problems.h"
17*c8565611SJeremy L Thompson #include "../qfunctions/common.h"
18*c8565611SJeremy L Thompson 
19*c8565611SJeremy L Thompson static const char *const field_names[] = {"gradu"};
20*c8565611SJeremy L Thompson static CeedInt           field_sizes[] = {9};
21*c8565611SJeremy L Thompson 
22*c8565611SJeremy L Thompson ProblemData finite_strain_Mooney_Rivlin = {
23*c8565611SJeremy L Thompson     .setup_geo            = SetupGeo,
24*c8565611SJeremy L Thompson     .setup_geo_loc        = SetupGeo_loc,
25*c8565611SJeremy L Thompson     .q_data_size          = 10,
26*c8565611SJeremy L Thompson     .quadrature_mode      = CEED_GAUSS,
27*c8565611SJeremy L Thompson     .residual             = ElasFSResidual_MR,
28*c8565611SJeremy L Thompson     .residual_loc         = ElasFSResidual_MR_loc,
29*c8565611SJeremy L Thompson     .number_fields_stored = 1,
30*c8565611SJeremy L Thompson     .field_names          = field_names,
31*c8565611SJeremy L Thompson     .field_sizes          = field_sizes,
32*c8565611SJeremy L Thompson     .jacobian             = ElasFSJacobian_MR,
33*c8565611SJeremy L Thompson     .jacobian_loc         = ElasFSJacobian_MR_loc,
34*c8565611SJeremy L Thompson     .energy               = ElasFSEnergy_MR,
35*c8565611SJeremy L Thompson     .energy_loc           = ElasFSEnergy_MR_loc,
36*c8565611SJeremy L Thompson     .diagnostic           = ElasFSDiagnostic_MR,
37*c8565611SJeremy L Thompson     .diagnostic_loc       = ElasFSDiagnostic_MR_loc,
38*c8565611SJeremy L Thompson };
39*c8565611SJeremy L Thompson 
40*c8565611SJeremy L Thompson PetscErrorCode SetupLibceedFineLevel_ElasFSMR(DM dm, DM dm_energy, DM dm_diagnostic, Ceed ceed, AppCtx app_ctx, CeedQFunctionContext phys_ctx,
41*c8565611SJeremy L Thompson                                               PetscInt fine_level, PetscInt num_comp_u, PetscInt U_g_size, PetscInt U_loc_size, CeedVector force_ceed,
42*c8565611SJeremy L Thompson                                               CeedVector neumann_ceed, CeedData *data) {
43*c8565611SJeremy L Thompson   PetscFunctionBegin;
44*c8565611SJeremy L Thompson 
45*c8565611SJeremy L Thompson   PetscCall(SetupLibceedFineLevel(dm, dm_energy, dm_diagnostic, ceed, app_ctx, phys_ctx, finite_strain_Mooney_Rivlin, fine_level, num_comp_u,
46*c8565611SJeremy L Thompson                                   U_g_size, U_loc_size, force_ceed, neumann_ceed, data));
47*c8565611SJeremy L Thompson 
48*c8565611SJeremy L Thompson   PetscFunctionReturn(PETSC_SUCCESS);
49*c8565611SJeremy L Thompson };
50*c8565611SJeremy L Thompson 
51*c8565611SJeremy L Thompson PetscErrorCode SetupLibceedLevel_ElasFSMR(DM dm, Ceed ceed, AppCtx app_ctx, PetscInt level, PetscInt num_comp_u, PetscInt U_g_size,
52*c8565611SJeremy L Thompson                                           PetscInt U_loc_size, CeedVector fine_mult, CeedData *data) {
53*c8565611SJeremy L Thompson   PetscFunctionBegin;
54*c8565611SJeremy L Thompson 
55*c8565611SJeremy L Thompson   PetscCall(SetupLibceedLevel(dm, ceed, app_ctx, finite_strain_Mooney_Rivlin, level, num_comp_u, U_g_size, U_loc_size, fine_mult, data));
56*c8565611SJeremy L Thompson 
57*c8565611SJeremy L Thompson   PetscFunctionReturn(PETSC_SUCCESS);
58*c8565611SJeremy L Thompson };
59