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