xref: /honee/problems/bc_slip.c (revision 0c373b74e935da21548f11f3cfcb29344591ba1b)
1ae2b091fSJames Wright // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2ae2b091fSJames Wright // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
39ed3d70dSJames Wright 
49ed3d70dSJames Wright /// @file
59ed3d70dSJames Wright /// Utility functions for setting up slip boundary condition
69ed3d70dSJames Wright 
79ed3d70dSJames Wright #include "../qfunctions/bc_slip.h"
89ed3d70dSJames Wright 
99ed3d70dSJames Wright #include <ceed.h>
109ed3d70dSJames Wright #include <petscdm.h>
119ed3d70dSJames Wright 
12149fb536SJames Wright #include <navierstokes.h>
139ed3d70dSJames Wright #include "../qfunctions/newtonian_types.h"
149ed3d70dSJames Wright 
15991aef52SJames Wright PetscErrorCode SlipBCSetup(ProblemData problem, DM dm, void *ctx, CeedQFunctionContext newtonian_ig_qfctx) {
16*0c373b74SJames Wright   Honee honee = *(Honee *)ctx;
17*0c373b74SJames Wright   Ceed  ceed  = honee->ceed;
189ed3d70dSJames Wright 
199ed3d70dSJames Wright   PetscFunctionBeginUser;
20*0c373b74SJames Wright   switch (honee->phys->state_var) {
219ed3d70dSJames Wright     case STATEVAR_CONSERVATIVE:
22e07531f7SJames Wright       problem->apply_slip.qf_func_ptr          = Slip_Conserv;
23e07531f7SJames Wright       problem->apply_slip.qf_loc               = Slip_Conserv_loc;
24e07531f7SJames Wright       problem->apply_slip_jacobian.qf_func_ptr = Slip_Jacobian_Conserv;
25e07531f7SJames Wright       problem->apply_slip_jacobian.qf_loc      = Slip_Jacobian_Conserv_loc;
269ed3d70dSJames Wright       break;
279ed3d70dSJames Wright     case STATEVAR_PRIMITIVE:
28e07531f7SJames Wright       problem->apply_slip.qf_func_ptr          = Slip_Prim;
29e07531f7SJames Wright       problem->apply_slip.qf_loc               = Slip_Prim_loc;
30e07531f7SJames Wright       problem->apply_slip_jacobian.qf_func_ptr = Slip_Jacobian_Prim;
31e07531f7SJames Wright       problem->apply_slip_jacobian.qf_loc      = Slip_Jacobian_Prim_loc;
329ed3d70dSJames Wright       break;
339b103f75SJames Wright     case STATEVAR_ENTROPY:
34e07531f7SJames Wright       problem->apply_slip.qf_func_ptr          = Slip_Entropy;
35e07531f7SJames Wright       problem->apply_slip.qf_loc               = Slip_Entropy_loc;
36e07531f7SJames Wright       problem->apply_slip_jacobian.qf_func_ptr = Slip_Jacobian_Entropy;
37e07531f7SJames Wright       problem->apply_slip_jacobian.qf_loc      = Slip_Jacobian_Entropy_loc;
389b103f75SJames Wright       break;
399ed3d70dSJames Wright   }
409ed3d70dSJames Wright 
41e07531f7SJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip.qfctx));
42e07531f7SJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip_jacobian.qfctx));
439ed3d70dSJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
449ed3d70dSJames Wright }
45