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