1*3d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2*3d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3*3d8e8822SJeremy L Thompson // 4*3d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 5*3d8e8822SJeremy L Thompson // 6*3d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 7*3d8e8822SJeremy L Thompson 8b7c563b6SJeremy L Thompson #ifndef libceed_solids_examples_misc_h 9b7c563b6SJeremy L Thompson #define libceed_solids_examples_misc_h 105754ecacSJeremy L Thompson 115754ecacSJeremy L Thompson #include <ceed.h> 125754ecacSJeremy L Thompson #include <petsc.h> 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 195754ecacSJeremy L Thompson PetscErrorCode SetupJacobianCtx(MPI_Comm comm, AppCtx app_ctx, DM dm, Vec V, 205754ecacSJeremy L Thompson Vec V_loc, CeedData ceed_data, Ceed ceed, 215754ecacSJeremy L Thompson CeedQFunctionContext ctx_phys, 225754ecacSJeremy L Thompson CeedQFunctionContext ctx_phys_smoother, 235754ecacSJeremy L Thompson UserMult jacobian_ctx); 245754ecacSJeremy L Thompson 255754ecacSJeremy L Thompson // Setup context data for prolongation and restriction operators 265754ecacSJeremy L Thompson PetscErrorCode SetupProlongRestrictCtx(MPI_Comm comm, AppCtx app_ctx, DM dm_c, 275754ecacSJeremy L Thompson DM dm_f, Vec V_f, Vec V_loc_c, Vec V_loc_f, 285754ecacSJeremy L Thompson CeedData ceed_data_c, CeedData ceed_data_f, 295754ecacSJeremy L Thompson Ceed ceed, 305754ecacSJeremy L Thompson UserMultProlongRestr prolong_restr_ctx); 315754ecacSJeremy L Thompson 325754ecacSJeremy L Thompson // ----------------------------------------------------------------------------- 335754ecacSJeremy L Thompson // Jacobian setup 345754ecacSJeremy L Thompson // ----------------------------------------------------------------------------- 355754ecacSJeremy L Thompson PetscErrorCode FormJacobian(SNES snes, Vec U, Mat J, Mat J_pre, void *ctx); 365754ecacSJeremy L Thompson 375754ecacSJeremy L Thompson // ----------------------------------------------------------------------------- 385754ecacSJeremy L Thompson // Solution output 395754ecacSJeremy L Thompson // ----------------------------------------------------------------------------- 405754ecacSJeremy L Thompson PetscErrorCode ViewSolution(MPI_Comm comm, AppCtx app_ctx, Vec U, 415754ecacSJeremy L Thompson PetscInt increment, PetscScalar load_increment); 425754ecacSJeremy L Thompson 435754ecacSJeremy L Thompson PetscErrorCode ViewDiagnosticQuantities(MPI_Comm comm, DM dm_U, 445754ecacSJeremy L Thompson UserMult user, AppCtx app_ctx, Vec U, 455754ecacSJeremy L Thompson CeedElemRestriction elem_restr_diagnostic); 465754ecacSJeremy L Thompson 475754ecacSJeremy L Thompson // ----------------------------------------------------------------------------- 485754ecacSJeremy L Thompson // Regression testing 495754ecacSJeremy L Thompson // ----------------------------------------------------------------------------- 505754ecacSJeremy L Thompson PetscErrorCode RegressionTests_solids(AppCtx app_ctx, PetscReal energy); 515754ecacSJeremy L Thompson 52b7c563b6SJeremy L Thompson #endif // libceed_solids_examples_misc_h 53