[petsc-users] Applying Natural Boundary Conditions using PETSc FEM Technology

Brandon Denton bldenton at buffalo.edu
Tue Dec 12 11:22:37 CST 2023


Good Afternoon,

I am currently working on an Inviscid Navier-Stokes problem and would like to apply DM_BC_NATURAL boundary conditions to my domain. Looking through the example files on petsc.org, I noticed that in almost all cases there are the following series of calls.

PetscCall(DMAddBoundary(dm, DM_BC_NATURAL, "wall", label, 1, &id, 0, 0, NULL, NULL, NULL, user, &bd));
PetscCall(PetscDSGetBoundary(ds, bd, &wf, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL));
PetscCall(PetscWeakFormSetIndexBdResidual(wf, label, id, 0, 0, 0, f0_bd_u, 0, NULL));

Is this the standard way of applying Natural boundary conditions in PETSc for FEM? Also, I noticed in the signature for the  f0_bd_u function, there is a const PetscReal n[] array. What is this array and what information does it hold. Is it the normal vector at the point?

static void f0_bd_u(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], const PetscReal n[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[])

Thank you in advance for your time.
Brandon




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20231212/c50024ae/attachment.html>


More information about the petsc-users mailing list