xref: /honee/problems/bc_slip.c (revision 9ed3d70d58d93bd474ae216081539cf94addd4d0)
1*9ed3d70dSJames Wright // Copyright (c) 2017-2023, Lawrence Livermore National Security, LLC and other CEED contributors.
2*9ed3d70dSJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3*9ed3d70dSJames Wright //
4*9ed3d70dSJames Wright // SPDX-License-Identifier: BSD-2-Clause
5*9ed3d70dSJames Wright //
6*9ed3d70dSJames Wright // This file is part of CEED:  http://github.com/ceed
7*9ed3d70dSJames Wright 
8*9ed3d70dSJames Wright /// @file
9*9ed3d70dSJames Wright /// Utility functions for setting up slip boundary condition
10*9ed3d70dSJames Wright 
11*9ed3d70dSJames Wright #include "../qfunctions/bc_slip.h"
12*9ed3d70dSJames Wright 
13*9ed3d70dSJames Wright #include <ceed.h>
14*9ed3d70dSJames Wright #include <petscdm.h>
15*9ed3d70dSJames Wright 
16*9ed3d70dSJames Wright #include "../navierstokes.h"
17*9ed3d70dSJames Wright #include "../qfunctions/newtonian_types.h"
18*9ed3d70dSJames Wright 
19*9ed3d70dSJames Wright PetscErrorCode SlipBCSetup(ProblemData *problem, DM dm, void *ctx, CeedQFunctionContext newtonian_ig_qfctx) {
20*9ed3d70dSJames Wright   User user = *(User *)ctx;
21*9ed3d70dSJames Wright   Ceed ceed = user->ceed;
22*9ed3d70dSJames Wright 
23*9ed3d70dSJames Wright   PetscFunctionBeginUser;
24*9ed3d70dSJames Wright   switch (user->phys->state_var) {
25*9ed3d70dSJames Wright     case STATEVAR_CONSERVATIVE:
26*9ed3d70dSJames Wright       problem->apply_slip.qfunction              = Slip_Conserv;
27*9ed3d70dSJames Wright       problem->apply_slip.qfunction_loc          = Slip_Conserv_loc;
28*9ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction     = Slip_Jacobian_Conserv;
29*9ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Conserv_loc;
30*9ed3d70dSJames Wright       break;
31*9ed3d70dSJames Wright     case STATEVAR_PRIMITIVE:
32*9ed3d70dSJames Wright       problem->apply_slip.qfunction              = Slip_Prim;
33*9ed3d70dSJames Wright       problem->apply_slip.qfunction_loc          = Slip_Prim_loc;
34*9ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction     = Slip_Jacobian_Prim;
35*9ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Prim_loc;
36*9ed3d70dSJames Wright       break;
37*9ed3d70dSJames Wright   }
38*9ed3d70dSJames Wright 
39*9ed3d70dSJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip.qfunction_context));
40*9ed3d70dSJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip_jacobian.qfunction_context));
41*9ed3d70dSJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
42*9ed3d70dSJames Wright }
43