xref: /libCEED/examples/solids/include/misc.h (revision d4cc18453651bd0f94c1a2e078b2646a92dafdcc)
1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
33d8e8822SJeremy L Thompson //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
53d8e8822SJeremy L Thompson //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
724a65d3dSJeremy L Thompson #pragma once
85754ecacSJeremy L Thompson 
95754ecacSJeremy L Thompson #include <ceed.h>
1049aac155SJeremy L Thompson #include <petscdm.h>
1149aac155SJeremy L Thompson #include <petscsnes.h>
122b730f8bSJeremy L Thompson 
135754ecacSJeremy L Thompson #include "../include/structs.h"
145754ecacSJeremy L Thompson 
155754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
165754ecacSJeremy L Thompson // Context setup
175754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
185754ecacSJeremy L Thompson // Setup context data for Jacobian evaluation
192b730f8bSJeremy L Thompson PetscErrorCode SetupJacobianCtx(MPI_Comm comm, AppCtx app_ctx, DM dm, Vec V, Vec V_loc, CeedData ceed_data, Ceed ceed, CeedQFunctionContext ctx_phys,
202b730f8bSJeremy L Thompson                                 CeedQFunctionContext ctx_phys_smoother, UserMult jacobian_ctx);
215754ecacSJeremy L Thompson 
225754ecacSJeremy L Thompson // Setup context data for prolongation and restriction operators
232b730f8bSJeremy L Thompson 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,
242b730f8bSJeremy L Thompson                                        CeedData ceed_data_f, Ceed ceed, UserMultProlongRestr prolong_restr_ctx);
255754ecacSJeremy L Thompson 
265754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
275754ecacSJeremy L Thompson // Jacobian setup
285754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
295754ecacSJeremy L Thompson PetscErrorCode FormJacobian(SNES snes, Vec U, Mat J, Mat J_pre, void *ctx);
305754ecacSJeremy L Thompson 
315754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
325754ecacSJeremy L Thompson // Solution output
335754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
342b730f8bSJeremy L Thompson PetscErrorCode ViewSolution(MPI_Comm comm, AppCtx app_ctx, Vec U, PetscInt increment, PetscScalar load_increment);
355754ecacSJeremy L Thompson 
362b730f8bSJeremy L Thompson PetscErrorCode ViewDiagnosticQuantities(MPI_Comm comm, DM dm_U, UserMult user, AppCtx app_ctx, Vec U, CeedElemRestriction elem_restr_diagnostic);
375754ecacSJeremy L Thompson 
385754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
395754ecacSJeremy L Thompson // Regression testing
405754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
415754ecacSJeremy L Thompson PetscErrorCode RegressionTests_solids(AppCtx app_ctx, PetscReal energy);
42