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 8 /// @file 9 /// Utility functions for setting up slip boundary condition 10 11 #include "../qfunctions/bc_slip.h" 12 13 #include <ceed.h> 14 #include <petscdm.h> 15 16 #include "../navierstokes.h" 17 #include "../qfunctions/newtonian_types.h" 18 19 PetscErrorCode SlipBCSetup(ProblemData problem, DM dm, void *ctx, CeedQFunctionContext newtonian_ig_qfctx) { 20 User user = *(User *)ctx; 21 Ceed ceed = user->ceed; 22 23 PetscFunctionBeginUser; 24 switch (user->phys->state_var) { 25 case STATEVAR_CONSERVATIVE: 26 problem->apply_slip.qfunction = Slip_Conserv; 27 problem->apply_slip.qfunction_loc = Slip_Conserv_loc; 28 problem->apply_slip_jacobian.qfunction = Slip_Jacobian_Conserv; 29 problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Conserv_loc; 30 break; 31 case STATEVAR_PRIMITIVE: 32 problem->apply_slip.qfunction = Slip_Prim; 33 problem->apply_slip.qfunction_loc = Slip_Prim_loc; 34 problem->apply_slip_jacobian.qfunction = Slip_Jacobian_Prim; 35 problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Prim_loc; 36 break; 37 case STATEVAR_ENTROPY: 38 problem->apply_slip.qfunction = Slip_Entropy; 39 problem->apply_slip.qfunction_loc = Slip_Entropy_loc; 40 problem->apply_slip_jacobian.qfunction = Slip_Jacobian_Entropy; 41 problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Entropy_loc; 42 break; 43 } 44 45 PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip.qfunction_context)); 46 PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip_jacobian.qfunction_context)); 47 PetscFunctionReturn(PETSC_SUCCESS); 48 } 49