xref: /libCEED/examples/solids/include/misc.h (revision 019b76820d7ff306c177822c4e76ffe5939c204b)
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 libceed_solids_examples_misc_h
9 #define libceed_solids_examples_misc_h
10 
11 #include <ceed.h>
12 #include <petsc.h>
13 #include "../include/structs.h"
14 
15 // -----------------------------------------------------------------------------
16 // Context setup
17 // -----------------------------------------------------------------------------
18 // Setup context data for Jacobian evaluation
19 PetscErrorCode SetupJacobianCtx(MPI_Comm comm, AppCtx app_ctx, DM dm, Vec V,
20                                 Vec V_loc, CeedData ceed_data, Ceed ceed,
21                                 CeedQFunctionContext ctx_phys,
22                                 CeedQFunctionContext ctx_phys_smoother,
23                                 UserMult jacobian_ctx);
24 
25 // Setup context data for prolongation and restriction operators
26 PetscErrorCode SetupProlongRestrictCtx(MPI_Comm comm, AppCtx app_ctx, DM dm_c,
27                                        DM dm_f, Vec V_f, Vec V_loc_c, Vec V_loc_f,
28                                        CeedData ceed_data_c, CeedData ceed_data_f,
29                                        Ceed ceed,
30                                        UserMultProlongRestr prolong_restr_ctx);
31 
32 // -----------------------------------------------------------------------------
33 // Jacobian setup
34 // -----------------------------------------------------------------------------
35 PetscErrorCode FormJacobian(SNES snes, Vec U, Mat J, Mat J_pre, void *ctx);
36 
37 // -----------------------------------------------------------------------------
38 // Solution output
39 // -----------------------------------------------------------------------------
40 PetscErrorCode ViewSolution(MPI_Comm comm, AppCtx app_ctx, Vec U,
41                             PetscInt increment, PetscScalar load_increment);
42 
43 PetscErrorCode ViewDiagnosticQuantities(MPI_Comm comm, DM dm_U,
44                                         UserMult user, AppCtx app_ctx, Vec U,
45                                         CeedElemRestriction elem_restr_diagnostic);
46 
47 // -----------------------------------------------------------------------------
48 // Regression testing
49 // -----------------------------------------------------------------------------
50 PetscErrorCode RegressionTests_solids(AppCtx app_ctx, PetscReal energy);
51 
52 #endif // libceed_solids_examples_misc_h
53