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