Skip to content

Commit 07059b2

Browse files
committed
TODO:Boundary condition. Doesn't work.
1 parent 5c51868 commit 07059b2

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

examples/Hdiv-mixed/qfunctions/darcy-rhs2d.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ CEED_QFUNCTION(SetupDarcyRhs2D)(void *ctx, const CeedInt Q,
6363
{dxdX[0][1][i], dxdX[1][1][i]}};
6464
const CeedScalar detJ = J[1][1]*J[0][0] - J[1][0]*J[0][1];
6565
// *INDENT-ON*
66-
CeedScalar pe = sin(M_PI*x) * sin(M_PI*y);
67-
CeedScalar ue[2] = {-M_PI*cos(M_PI*x) *sin(M_PI*y), -M_PI*sin(M_PI*x) *cos(M_PI*y)};
66+
CeedScalar pe = sin(M_PI*x) * sin(M_PI*y) + M_PI*x*y;
67+
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};
6868
CeedScalar f = 2*M_PI*M_PI*sin(M_PI*x)*sin(M_PI*y);
6969

7070
// 1st eq: component 1

examples/Hdiv-mixed/qfunctions/darcy-rhs3d.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ CEED_QFUNCTION(SetupDarcyRhs3D)(void *ctx, const CeedInt Q,
8181
{dxdX[0][2][i], dxdX[1][2][i], dxdX[2][2][i]}};
8282
const CeedScalar detJ = ComputeDetMat(J);
8383
// *INDENT-ON*
84-
CeedScalar pe = sin(M_PI*x) * sin(M_PI*y) * sin(M_PI*z);
85-
CeedScalar ue[3] = {-M_PI*cos(M_PI*x) *sin(M_PI*y) *sin(M_PI*z),
86-
-M_PI*sin(M_PI*x) *cos(M_PI*y) *sin(M_PI*z),
87-
-M_PI*sin(M_PI*x) *sin(M_PI*y) *cos(M_PI*z)
84+
CeedScalar pe = sin(M_PI*x) * sin(M_PI*y) * sin(M_PI*z) + M_PI*x*y*z;
85+
CeedScalar ue[3] = {-M_PI*cos(M_PI*x) *sin(M_PI*y) *sin(M_PI*z) - M_PI *y*z,
86+
-M_PI*sin(M_PI*x) *cos(M_PI*y) *sin(M_PI*z) - M_PI *x*z,
87+
-M_PI*sin(M_PI*x) *sin(M_PI*y) *cos(M_PI*z) - M_PI *x *y
8888
};
8989
CeedScalar f = 3*M_PI*M_PI*sin(M_PI*x)*sin(M_PI*y)*sin(M_PI*z);
9090

examples/Hdiv-mixed/src/setup-boundary.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ PetscErrorCode BoundaryDirichletMMS(PetscInt dim, PetscReal t,
5757
PetscFunctionBeginUser;
5858

5959
if (dim == 2) {
60-
u[0] = -M_PI*cos(M_PI*x) *sin(M_PI*y);
61-
u[1] = -M_PI*sin(M_PI*x) *cos(M_PI*y);
60+
u[0] = -M_PI*cos(M_PI*x) *sin(M_PI*y) - M_PI*y;
61+
u[1] = -M_PI*sin(M_PI*x) *cos(M_PI*y) - M_PI*x;
6262
} else {
63-
u[0] = -M_PI*cos(M_PI*x) *sin(M_PI*y) *sin(M_PI*z);
64-
u[1] = -M_PI*sin(M_PI*x) *cos(M_PI*y) *sin(M_PI*z);
65-
u[2] = -M_PI*sin(M_PI*x) *sin(M_PI*y) *cos(M_PI*z);
63+
u[0] = -M_PI*cos(M_PI*x) *sin(M_PI*y) *sin(M_PI*z) - M_PI*y*z;
64+
u[1] = -M_PI*sin(M_PI*x) *cos(M_PI*y) *sin(M_PI*z) - M_PI*x*z;
65+
u[2] = -M_PI*sin(M_PI*x) *sin(M_PI*y) *cos(M_PI*z) - M_PI*x*y;
6666
}
6767

6868

examples/Hdiv-mixed/src/setup-solvers.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,9 @@ PetscErrorCode SNESFormResidual(SNES snes, Vec X, Vec Y, void *ctx) {
7373
PetscFunctionBeginUser;
7474

7575
// Use computed BCs
76-
//PetscCall( VecZeroEntries(op_apply_ctx->X_loc) );
77-
//PetscCall( DMPlexInsertBoundaryValues(op_apply_ctx->dm, PETSC_TRUE,
78-
// op_apply_ctx->X_loc,
79-
// 1.0, NULL, NULL, NULL) );
76+
PetscCall( DMPlexInsertBoundaryValues(op_apply_ctx->dm, PETSC_TRUE,
77+
op_apply_ctx->X_loc,
78+
1.0, NULL, NULL, NULL) );
8079

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

0 commit comments

Comments
 (0)