Skip to content

Commit 3265663

Browse files
committed
Get error when try to create ics for pressure
1 parent 4ebe4aa commit 3265663

16 files changed

+153
-75
lines changed

examples/Hdiv-mixed/include/setup-libceed.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Convert PETSc MemType to libCEED MemType
77
CeedMemType MemTypeP2C(PetscMemType mtype);
88
// Destroy libCEED objects
9-
PetscErrorCode CeedDataDestroy(CeedData ceed_data);
9+
PetscErrorCode CeedDataDestroy(CeedData ceed_data, ProblemData problem_data);
1010
// Utility function - essential BC dofs are encoded in closure indices as -(i+1)
1111
PetscInt Involute(PetscInt i);
1212
// Utility function to create local CEED restriction from DMPlex

examples/Hdiv-mixed/include/structs.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ struct OperatorApplyContext_ {
3838
// libCEED data struct
3939
typedef struct CeedData_ *CeedData;
4040
struct CeedData_ {
41-
CeedBasis basis_x, basis_u, basis_p, basis_u_face;
41+
CeedBasis basis_x, basis_u, basis_p, basis_u_face, basis_xc;
4242
CeedElemRestriction elem_restr_x, elem_restr_u, elem_restr_U_i,
4343
elem_restr_p, elem_restr_p_i;
44-
CeedQFunction qf_residual, qf_jacobian, qf_error, qf_ics, qf_true;
45-
CeedOperator op_residual, op_jacobian, op_error, op_ics, op_true;
46-
CeedVector x_ceed, y_ceed, x_coord, x0_ceed, x_t_ceed;
44+
CeedQFunction qf_residual, qf_jacobian, qf_error, qf_ics_u, qf_ics_p;
45+
CeedOperator op_residual, op_jacobian, op_error, op_ics_u, op_ics_p;
46+
CeedVector x_ceed, y_ceed, x_coord, u0_ceed, x_t_ceed;
4747
OperatorApplyContext ctx_residual, ctx_jacobian, ctx_error, ctx_residual_ut;
4848
CeedInt num_elem;
4949
};
5050

5151
// Problem specific data
5252
typedef struct ProblemData_ *ProblemData;
5353
struct ProblemData_ {
54-
CeedQFunctionUser true_solution, residual, jacobian, error, ics,
54+
CeedQFunctionUser true_solution, residual, jacobian, error, ics_u, ics_p,
5555
bc_pressure;
5656
const char *true_solution_loc, *residual_loc, *jacobian_loc,
57-
*error_loc, *bc_pressure_loc, *ics_loc;
57+
*error_loc, *bc_pressure_loc, *ics_u_loc, *ics_p_loc;
5858
CeedQuadMode quadrature_mode;
5959
CeedInt elem_node, dim, q_data_size_face;
6060
CeedQFunctionContext qfunction_context;

examples/Hdiv-mixed/main.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ int main(int argc, char **argv) {
143143
// ---------------------------------------------------------------------------
144144
// Create global initial conditions
145145
// ---------------------------------------------------------------------------
146-
CreateInitialConditions(dm, ceed_data, U_loc, U);
147-
VecView(U, PETSC_VIEWER_STDOUT_WORLD);
146+
//CreateInitialConditions(dm, ceed_data, U_loc, U);
147+
//VecView(U, PETSC_VIEWER_STDOUT_WORLD);
148148
}
149149

150150
if (!problem_data->has_ts) {
@@ -192,6 +192,7 @@ int main(int argc, char **argv) {
192192
PetscCall( DMDestroy(&dm) );
193193
PetscCall( VecDestroy(&U) );
194194
PetscCall( VecDestroy(&U_loc) );
195+
PetscCall( CeedDataDestroy(ceed_data, problem_data) );
195196

196197
// -- Function list
197198
PetscCall( PetscFunctionListDestroy(&app_ctx->problems) );
@@ -203,9 +204,6 @@ int main(int argc, char **argv) {
203204

204205
// Free libCEED objects
205206
//CeedVectorDestroy(&bc_pressure);
206-
//PetscCall( CeedDataDestroy(ceed_data) );
207-
CeedQFunctionDestroy(&ceed_data->qf_true);
208-
CeedOperatorDestroy(&ceed_data->op_true);
209207
CeedDestroy(&ceed);
210208

211209
return PetscFinalize();

examples/Hdiv-mixed/problems/richard2d.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ PetscErrorCode Hdiv_RICHARD2D(Ceed ceed, ProblemData problem_data, void *ctx) {
3939
problem_data->elem_node = 4;
4040
problem_data->q_data_size_face = 3;
4141
problem_data->quadrature_mode = CEED_GAUSS;
42-
problem_data->ics = RichardICs2D;
43-
problem_data->ics_loc = RichardICs2D_loc;
42+
problem_data->ics_u = RichardICsU2D;
43+
problem_data->ics_u_loc = RichardICsU2D_loc;
44+
problem_data->ics_p = RichardICsP2D;
45+
problem_data->ics_p_loc = RichardICsP2D_loc;
4446
problem_data->true_solution = RichardTrue2D;
4547
problem_data->true_solution_loc = RichardTrue2D_loc;
4648
//problem_data->residual = RichardSystem2D;
@@ -97,6 +99,7 @@ PetscErrorCode Hdiv_RICHARD2D(Ceed ceed, ProblemData problem_data, void *ctx) {
9799
CeedQFunctionContextRegisterDouble(richard_context, "final_time",
98100
offsetof(struct RICHARDContext_, t_final), 1, "final time");
99101
problem_data->qfunction_context = richard_context;
102+
PetscCall( PetscFree(richard_ctx) );
100103

101104
PetscFunctionReturn(0);
102105
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define DARCY_ERROR2D_H
2222

2323
#include <math.h>
24+
#include <ceed.h>
2425
#include "utils.h"
2526

2627
// -----------------------------------------------------------------------------

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define DARCY_ERROR3D_H
2222

2323
#include <math.h>
24+
#include <ceed.h>
2425
#include "utils.h"
2526

2627

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#define DARCY_SYSTEM2D_H
2222

2323
#include <math.h>
24-
#include "ceed/ceed-f64.h"
24+
#include <ceed.h>
2525
#include "utils.h"
2626

2727
// -----------------------------------------------------------------------------

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define DARCY_SYSTEM3D_H
2222

2323
#include <math.h>
24+
#include <ceed.h>
2425
#include "utils.h"
2526

2627
// -----------------------------------------------------------------------------

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define DARCY_TRUE2D_H
2222

2323
#include <math.h>
24+
#include <ceed.h>
2425
#include "utils.h"
2526

2627
// -----------------------------------------------------------------------------

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define DARCY_TRUE3D_H
2222

2323
#include <math.h>
24+
#include <ceed.h>
2425
#include "utils.h"
2526

2627
// -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)