xref: /libCEED/examples/solids/problems/problems.h (revision 509d4af65d23546c690c9766d8b29e47dc3b3afb)
1 // Copyright (c) 2017-2024, 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 #pragma once
8 
9 #include <ceed.h>
10 #include <petsc.h>
11 
12 #include "../problems/cl-problems.h"
13 #include "../problems/mooney-rivlin.h"
14 #include "../problems/neo-hookean.h"
15 
16 // Physics options
17 #define SOLIDS_PROBLEM_REGISTER(list, name, fname, physics)                                             \
18   PetscCall(PetscFunctionListAdd(&list->setupPhysics, name, PhysicsContext_##physics));                 \
19   PetscCall(PetscFunctionListAdd(&list->setupSmootherPhysics, name, PhysicsSmootherContext_##physics)); \
20   PetscCall(PetscFunctionListAdd(&list->setupLibceedFineLevel, name, SetupLibceedFineLevel_##fname));   \
21   PetscCall(PetscFunctionListAdd(&list->setupLibceedLevel, name, SetupLibceedLevel_##fname));
22 
23 typedef struct ProblemFunctions_ *ProblemFunctions;
24 struct ProblemFunctions_ {
25   PetscFunctionList setupPhysics, setupSmootherPhysics, setupLibceedFineLevel, setupLibceedLevel;
26 };
27 
28 PetscErrorCode RegisterProblems(ProblemFunctions problem_functions);
29 
30 #define SOLIDS_PROBLEM(name)                                                                                                                   \
31   PetscErrorCode SetupLibceedFineLevel_##name(DM dm, DM dm_energy, DM dm_diagnostic, Ceed ceed, AppCtx app_ctx, CeedQFunctionContext phys_ctx, \
32                                               PetscInt fine_level, PetscInt num_comp_u, PetscInt U_g_size, PetscInt U_loc_size,                \
33                                               CeedVector force_ceed, CeedVector neumann_ceed, CeedData *data);                                 \
34   PetscErrorCode SetupLibceedLevel_##name(DM dm, Ceed ceed, AppCtx app_ctx, PetscInt level, PetscInt num_comp_u, PetscInt U_g_size,            \
35                                           PetscInt u_loc_size, CeedVector fine_mult, CeedData *data);
36 
37 SOLIDS_PROBLEM(ElasLinear);
38 SOLIDS_PROBLEM(ElasSSNH);
39 SOLIDS_PROBLEM(ElasFSCurrentNH1);
40 SOLIDS_PROBLEM(ElasFSCurrentNH2);
41 SOLIDS_PROBLEM(ElasFSInitialNH1);
42 SOLIDS_PROBLEM(ElasFSInitialNH2);
43 SOLIDS_PROBLEM(ElasFSInitialMR1);
44