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