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