xref: /libCEED/examples/solids/include/misc.h (revision 9ba83ac0e4b1fca39d6fa6737a318a9f0cbc172d)
1 // Copyright (c) 2017-2026, 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 <petscdm.h>
11 #include <petscsnes.h>
12 
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, Vec V_loc, CeedData ceed_data, Ceed ceed, CeedQFunctionContext ctx_phys,
20                                 CeedQFunctionContext ctx_phys_smoother, UserMult jacobian_ctx);
21 
22 // Setup context data for prolongation and restriction operators
23 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,
24                                        CeedData ceed_data_f, Ceed ceed, UserMultProlongRestr prolong_restr_ctx);
25 
26 // -----------------------------------------------------------------------------
27 // Jacobian setup
28 // -----------------------------------------------------------------------------
29 PetscErrorCode FormJacobian(SNES snes, Vec U, Mat J, Mat J_pre, void *ctx);
30 
31 // -----------------------------------------------------------------------------
32 // Solution output
33 // -----------------------------------------------------------------------------
34 PetscErrorCode ViewSolution(MPI_Comm comm, AppCtx app_ctx, Vec U, PetscInt increment, PetscScalar load_increment);
35 
36 PetscErrorCode ViewDiagnosticQuantities(MPI_Comm comm, DM dm_U, UserMult user, AppCtx app_ctx, Vec U, CeedElemRestriction elem_restr_diagnostic);
37 
38 // -----------------------------------------------------------------------------
39 // Regression testing
40 // -----------------------------------------------------------------------------
41 PetscErrorCode RegressionTests_solids(AppCtx app_ctx, PetscReal energy);
42