xref: /honee/problems/bc_slip.c (revision 991aef52b7f76ea745826c507d0f3e4bba35bb34)
1dc936754SJeremy L Thompson // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
29ed3d70dSJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
39ed3d70dSJames Wright //
49ed3d70dSJames Wright // SPDX-License-Identifier: BSD-2-Clause
59ed3d70dSJames Wright //
69ed3d70dSJames Wright // This file is part of CEED:  http://github.com/ceed
79ed3d70dSJames Wright 
89ed3d70dSJames Wright /// @file
99ed3d70dSJames Wright /// Utility functions for setting up slip boundary condition
109ed3d70dSJames Wright 
119ed3d70dSJames Wright #include "../qfunctions/bc_slip.h"
129ed3d70dSJames Wright 
139ed3d70dSJames Wright #include <ceed.h>
149ed3d70dSJames Wright #include <petscdm.h>
159ed3d70dSJames Wright 
169ed3d70dSJames Wright #include "../navierstokes.h"
179ed3d70dSJames Wright #include "../qfunctions/newtonian_types.h"
189ed3d70dSJames Wright 
19*991aef52SJames Wright PetscErrorCode SlipBCSetup(ProblemData problem, DM dm, void *ctx, CeedQFunctionContext newtonian_ig_qfctx) {
209ed3d70dSJames Wright   User user = *(User *)ctx;
219ed3d70dSJames Wright   Ceed ceed = user->ceed;
229ed3d70dSJames Wright 
239ed3d70dSJames Wright   PetscFunctionBeginUser;
249ed3d70dSJames Wright   switch (user->phys->state_var) {
259ed3d70dSJames Wright     case STATEVAR_CONSERVATIVE:
269ed3d70dSJames Wright       problem->apply_slip.qfunction              = Slip_Conserv;
279ed3d70dSJames Wright       problem->apply_slip.qfunction_loc          = Slip_Conserv_loc;
289ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction     = Slip_Jacobian_Conserv;
299ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Conserv_loc;
309ed3d70dSJames Wright       break;
319ed3d70dSJames Wright     case STATEVAR_PRIMITIVE:
329ed3d70dSJames Wright       problem->apply_slip.qfunction              = Slip_Prim;
339ed3d70dSJames Wright       problem->apply_slip.qfunction_loc          = Slip_Prim_loc;
349ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction     = Slip_Jacobian_Prim;
359ed3d70dSJames Wright       problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Prim_loc;
369ed3d70dSJames Wright       break;
379ed3d70dSJames Wright   }
389ed3d70dSJames Wright 
399ed3d70dSJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip.qfunction_context));
409ed3d70dSJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip_jacobian.qfunction_context));
419ed3d70dSJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
429ed3d70dSJames Wright }
43