xref: /honee/problems/bc_slip.c (revision e07531f7cad484157c281bb3cb12a29a67a96955)
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) {
169ed3d70dSJames Wright   User user = *(User *)ctx;
179ed3d70dSJames Wright   Ceed ceed = user->ceed;
189ed3d70dSJames Wright 
199ed3d70dSJames Wright   PetscFunctionBeginUser;
209ed3d70dSJames Wright   switch (user->phys->state_var) {
219ed3d70dSJames Wright     case STATEVAR_CONSERVATIVE:
22*e07531f7SJames Wright       problem->apply_slip.qf_func_ptr          = Slip_Conserv;
23*e07531f7SJames Wright       problem->apply_slip.qf_loc               = Slip_Conserv_loc;
24*e07531f7SJames Wright       problem->apply_slip_jacobian.qf_func_ptr = Slip_Jacobian_Conserv;
25*e07531f7SJames Wright       problem->apply_slip_jacobian.qf_loc      = Slip_Jacobian_Conserv_loc;
269ed3d70dSJames Wright       break;
279ed3d70dSJames Wright     case STATEVAR_PRIMITIVE:
28*e07531f7SJames Wright       problem->apply_slip.qf_func_ptr          = Slip_Prim;
29*e07531f7SJames Wright       problem->apply_slip.qf_loc               = Slip_Prim_loc;
30*e07531f7SJames Wright       problem->apply_slip_jacobian.qf_func_ptr = Slip_Jacobian_Prim;
31*e07531f7SJames Wright       problem->apply_slip_jacobian.qf_loc      = Slip_Jacobian_Prim_loc;
329ed3d70dSJames Wright       break;
339b103f75SJames Wright     case STATEVAR_ENTROPY:
34*e07531f7SJames Wright       problem->apply_slip.qf_func_ptr          = Slip_Entropy;
35*e07531f7SJames Wright       problem->apply_slip.qf_loc               = Slip_Entropy_loc;
36*e07531f7SJames Wright       problem->apply_slip_jacobian.qf_func_ptr = Slip_Jacobian_Entropy;
37*e07531f7SJames Wright       problem->apply_slip_jacobian.qf_loc      = Slip_Jacobian_Entropy_loc;
389b103f75SJames Wright       break;
399ed3d70dSJames Wright   }
409ed3d70dSJames Wright 
41*e07531f7SJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip.qfctx));
42*e07531f7SJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip_jacobian.qfctx));
439ed3d70dSJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
449ed3d70dSJames Wright }
45