xref: /libCEED/examples/fluids/problems/bc_slip.c (revision 9ba83ac0e4b1fca39d6fa6737a318a9f0cbc172d)
1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
29f844368SJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
39f844368SJames Wright //
49f844368SJames Wright // SPDX-License-Identifier: BSD-2-Clause
59f844368SJames Wright //
69f844368SJames Wright // This file is part of CEED:  http://github.com/ceed
79f844368SJames Wright 
89f844368SJames Wright /// @file
99f844368SJames Wright /// Utility functions for setting up slip boundary condition
109f844368SJames Wright 
119f844368SJames Wright #include "../qfunctions/bc_slip.h"
129f844368SJames Wright 
139f844368SJames Wright #include <ceed.h>
149f844368SJames Wright #include <petscdm.h>
159f844368SJames Wright 
169f844368SJames Wright #include "../navierstokes.h"
179f844368SJames Wright #include "../qfunctions/newtonian_types.h"
189f844368SJames Wright 
19731c13d7SJames Wright PetscErrorCode SlipBCSetup(ProblemData problem, DM dm, void *ctx, CeedQFunctionContext newtonian_ig_qfctx) {
209f844368SJames Wright   User user = *(User *)ctx;
219f844368SJames Wright   Ceed ceed = user->ceed;
229f844368SJames Wright 
239f844368SJames Wright   PetscFunctionBeginUser;
249f844368SJames Wright   switch (user->phys->state_var) {
259f844368SJames Wright     case STATEVAR_CONSERVATIVE:
269f844368SJames Wright       problem->apply_slip.qfunction              = Slip_Conserv;
279f844368SJames Wright       problem->apply_slip.qfunction_loc          = Slip_Conserv_loc;
289f844368SJames Wright       problem->apply_slip_jacobian.qfunction     = Slip_Jacobian_Conserv;
299f844368SJames Wright       problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Conserv_loc;
309f844368SJames Wright       break;
319f844368SJames Wright     case STATEVAR_PRIMITIVE:
329f844368SJames Wright       problem->apply_slip.qfunction              = Slip_Prim;
339f844368SJames Wright       problem->apply_slip.qfunction_loc          = Slip_Prim_loc;
349f844368SJames Wright       problem->apply_slip_jacobian.qfunction     = Slip_Jacobian_Prim;
359f844368SJames Wright       problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Prim_loc;
369f844368SJames Wright       break;
37a2d72b6fSJames Wright     case STATEVAR_ENTROPY:
38a2d72b6fSJames Wright       problem->apply_slip.qfunction              = Slip_Entropy;
39a2d72b6fSJames Wright       problem->apply_slip.qfunction_loc          = Slip_Entropy_loc;
40a2d72b6fSJames Wright       problem->apply_slip_jacobian.qfunction     = Slip_Jacobian_Entropy;
41a2d72b6fSJames Wright       problem->apply_slip_jacobian.qfunction_loc = Slip_Jacobian_Entropy_loc;
42a2d72b6fSJames Wright       break;
439f844368SJames Wright   }
449f844368SJames Wright 
459f844368SJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip.qfunction_context));
469f844368SJames Wright   PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(newtonian_ig_qfctx, &problem->apply_slip_jacobian.qfunction_context));
479f844368SJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
489f844368SJames Wright }
49