xref: /honee/problems/bc_slip.c (revision ae2b091fac884a554e48acc4b4c187524c2a2818)
1*ae2b091fSJames Wright // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2*ae2b091fSJames 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:
229ed3d70dSJames Wright       problem->apply_slip.qfunction              = Slip_Conserv;
239ed3d70dSJames Wright       problem->apply_slip.qfunction_loc          = Slip_Conserv_loc;
249ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction     = Slip_Jacobian_Conserv;
259ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Conserv_loc;
269ed3d70dSJames Wright       break;
279ed3d70dSJames Wright     case STATEVAR_PRIMITIVE:
289ed3d70dSJames Wright       problem->apply_slip.qfunction              = Slip_Prim;
299ed3d70dSJames Wright       problem->apply_slip.qfunction_loc          = Slip_Prim_loc;
309ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction     = Slip_Jacobian_Prim;
319ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Prim_loc;
329ed3d70dSJames Wright       break;
339b103f75SJames Wright     case STATEVAR_ENTROPY:
349b103f75SJames Wright       problem->apply_slip.qfunction              = Slip_Entropy;
359b103f75SJames Wright       problem->apply_slip.qfunction_loc          = Slip_Entropy_loc;
369b103f75SJames Wright       problem->apply_slip_jacobian.qfunction     = Slip_Jacobian_Entropy;
379b103f75SJames Wright       problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Entropy_loc;
389b103f75SJames Wright       break;
399ed3d70dSJames Wright   }
409ed3d70dSJames Wright 
419ed3d70dSJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip.qfunction_context));
429ed3d70dSJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip_jacobian.qfunction_context));
439ed3d70dSJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
449ed3d70dSJames Wright }
45