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