Skip to content

Commit

Permalink
TODO:Boundary condition. Doesn't work.
Browse files Browse the repository at this point in the history
  • Loading branch information
rezgarshakeri committed Jun 14, 2022
1 parent 5c51868 commit 07059b2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions examples/Hdiv-mixed/qfunctions/darcy-rhs2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ CEED_QFUNCTION(SetupDarcyRhs2D)(void *ctx, const CeedInt Q,
{dxdX[0][1][i], dxdX[1][1][i]}};
const CeedScalar detJ = J[1][1]*J[0][0] - J[1][0]*J[0][1];
// *INDENT-ON*
CeedScalar pe = sin(M_PI*x) * sin(M_PI*y);
CeedScalar ue[2] = {-M_PI*cos(M_PI*x) *sin(M_PI*y), -M_PI*sin(M_PI*x) *cos(M_PI*y)};
CeedScalar pe = sin(M_PI*x) * sin(M_PI*y) + M_PI*x*y;
CeedScalar ue[2] = {-M_PI*cos(M_PI*x) *sin(M_PI*y) - M_PI*y, -M_PI*sin(M_PI*x) *cos(M_PI*y) - M_PI*x};
CeedScalar f = 2*M_PI*M_PI*sin(M_PI*x)*sin(M_PI*y);

// 1st eq: component 1
Expand Down
8 changes: 4 additions & 4 deletions examples/Hdiv-mixed/qfunctions/darcy-rhs3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ CEED_QFUNCTION(SetupDarcyRhs3D)(void *ctx, const CeedInt Q,
{dxdX[0][2][i], dxdX[1][2][i], dxdX[2][2][i]}};
const CeedScalar detJ = ComputeDetMat(J);
// *INDENT-ON*
CeedScalar pe = sin(M_PI*x) * sin(M_PI*y) * sin(M_PI*z);
CeedScalar ue[3] = {-M_PI*cos(M_PI*x) *sin(M_PI*y) *sin(M_PI*z),
-M_PI*sin(M_PI*x) *cos(M_PI*y) *sin(M_PI*z),
-M_PI*sin(M_PI*x) *sin(M_PI*y) *cos(M_PI*z)
CeedScalar pe = sin(M_PI*x) * sin(M_PI*y) * sin(M_PI*z) + M_PI*x*y*z;
CeedScalar ue[3] = {-M_PI*cos(M_PI*x) *sin(M_PI*y) *sin(M_PI*z) - M_PI *y*z,
-M_PI*sin(M_PI*x) *cos(M_PI*y) *sin(M_PI*z) - M_PI *x*z,
-M_PI*sin(M_PI*x) *sin(M_PI*y) *cos(M_PI*z) - M_PI *x *y
};
CeedScalar f = 3*M_PI*M_PI*sin(M_PI*x)*sin(M_PI*y)*sin(M_PI*z);

Expand Down
10 changes: 5 additions & 5 deletions examples/Hdiv-mixed/src/setup-boundary.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ PetscErrorCode BoundaryDirichletMMS(PetscInt dim, PetscReal t,
PetscFunctionBeginUser;

if (dim == 2) {
u[0] = -M_PI*cos(M_PI*x) *sin(M_PI*y);
u[1] = -M_PI*sin(M_PI*x) *cos(M_PI*y);
u[0] = -M_PI*cos(M_PI*x) *sin(M_PI*y) - M_PI*y;
u[1] = -M_PI*sin(M_PI*x) *cos(M_PI*y) - M_PI*x;
} else {
u[0] = -M_PI*cos(M_PI*x) *sin(M_PI*y) *sin(M_PI*z);
u[1] = -M_PI*sin(M_PI*x) *cos(M_PI*y) *sin(M_PI*z);
u[2] = -M_PI*sin(M_PI*x) *sin(M_PI*y) *cos(M_PI*z);
u[0] = -M_PI*cos(M_PI*x) *sin(M_PI*y) *sin(M_PI*z) - M_PI*y*z;
u[1] = -M_PI*sin(M_PI*x) *cos(M_PI*y) *sin(M_PI*z) - M_PI*x*z;
u[2] = -M_PI*sin(M_PI*x) *sin(M_PI*y) *cos(M_PI*z) - M_PI*x*y;
}


Expand Down
7 changes: 3 additions & 4 deletions examples/Hdiv-mixed/src/setup-solvers.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ PetscErrorCode SNESFormResidual(SNES snes, Vec X, Vec Y, void *ctx) {
PetscFunctionBeginUser;

// Use computed BCs
//PetscCall( VecZeroEntries(op_apply_ctx->X_loc) );
//PetscCall( DMPlexInsertBoundaryValues(op_apply_ctx->dm, PETSC_TRUE,
// op_apply_ctx->X_loc,
// 1.0, NULL, NULL, NULL) );
PetscCall( DMPlexInsertBoundaryValues(op_apply_ctx->dm, PETSC_TRUE,
op_apply_ctx->X_loc,
1.0, NULL, NULL, NULL) );

// libCEED for local action of residual evaluator
PetscCall( ApplyLocalCeedOp(X, Y, op_apply_ctx) );
Expand Down

0 comments on commit 07059b2

Please sign in to comment.