xref: /honee/problems/bc_slip.c (revision 149fb5361f5198e41f87e8815a7e9dbfee84a96a)
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 
16*149fb536SJames Wright #include <navierstokes.h>
179ed3d70dSJames Wright #include "../qfunctions/newtonian_types.h"
189ed3d70dSJames Wright 
19991aef52SJames 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;
379b103f75SJames Wright     case STATEVAR_ENTROPY:
389b103f75SJames Wright       problem->apply_slip.qfunction              = Slip_Entropy;
399b103f75SJames Wright       problem->apply_slip.qfunction_loc          = Slip_Entropy_loc;
409b103f75SJames Wright       problem->apply_slip_jacobian.qfunction     = Slip_Jacobian_Entropy;
419b103f75SJames Wright       problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Entropy_loc;
429b103f75SJames Wright       break;
439ed3d70dSJames Wright   }
449ed3d70dSJames Wright 
459ed3d70dSJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip.qfunction_context));
469ed3d70dSJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip_jacobian.qfunction_context));
479ed3d70dSJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
489ed3d70dSJames Wright }
49