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