Skip to content

Commit 0814d5a

Browse files
KennethEJansenjrwrighjeremylt
authored
PetscFE determines basis for examples/fluids/navierstokes (#1264)
* breaking lots of DL stuff to test PetscFE * fixed missing header * fluids: Remove unused `Involute` function * fluids: Set quadrature points for PetscFE * fluids: Fix GetRestrictionForDomain, Use CreateBasisFromPlex * fluids: Remove Q_sur arg from SetupStrongBC_Ceed * fluids: Remove extra SetClosurePermutationTensor * fluids: Correct quadrature order to auxillary DMs - Should factor in q_extra * fluids: Fix parent Restriction creation for spanstats * fluids: Correct qdata creation for strong bcs * fluids: Set tensor closer only for tensor-product elements Co-authored-by: Jeremy L Thompson <jeremy@jeremylt.org> * fluids: Make shocktube test less brittle - Small, insignificant changes to the coordinate locations make a dramatic difference to the initial condition - For the test case, there is a node right at the midpoint of the domain. Adding the epsilon fudge factor makes the if statement more stable * fluids: Fix SGS test - Change the test so that it passes on all hardware. It's a very sentitive test and the changes to the basis creation changed the initial conditions *just* enough to make the test not happy. Should really try and make this more robust at some point... * fluids: Address misc PR comments * fluids: Remove quad_mode arg from CreateBasisFromPlex --------- Co-authored-by: James Wright <james@jameswright.xyz> Co-authored-by: Jeremy L Thompson <jeremy@jeremylt.org>
1 parent 218df6b commit 0814d5a

12 files changed

Lines changed: 316 additions & 94 deletions

examples/fluids/navierstokes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
// ./navierstokes -ceed /cpu/self -problem density_current -degree 1
1919
// ./navierstokes -ceed /gpu/cuda -problem advection -degree 1
2020
//
21+
//TESTARGS(name="blasius_SGS_DataDriven") -ceed {ceed_resource} -options_file examples/fluids/tests-output/blasius_stgtest.yaml -sgs_model_type data_driven -sgs_model_dd_leakyrelu_alpha 0.3 -sgs_model_dd_parameter_dir examples/fluids/dd_sgs_data -ts_dt 2e-9 -state_var primitive -ksp_rtol 1e-12 -snes_rtol 1e-12 -stg_mean_only -stg_fluctuating_IC -test_type solver -compare_final_state_atol 1e-10 -compare_final_state_filename examples/fluids/tests-output/fluids-navierstokes-blasius-sgs-data-driven.bin
2122
//TESTARGS(name="blasius_aniso_diff_filter") -ceed {ceed_resource} -test_type diff_filter -options_file examples/fluids/tests-output/blasius_test.yaml -compare_final_state_atol 5e-10 -compare_final_state_filename examples/fluids/tests-output/fluids-navierstokes-blasius_diff_filter_aniso_vandriest.bin -diff_filter_monitor -ts_max_steps 0 -state_var primitive -diff_filter_friction_length 1e-5 -diff_filter_wall_damping_function van_driest -diff_filter_ksp_rtol 1e-8 -diff_filter_grid_based_width -diff_filter_width_scaling 1,0.7,1
2223
//TESTARGS(name="blasius_iso_diff_filter") -ceed {ceed_resource} -test_type diff_filter -options_file examples/fluids/tests-output/blasius_test.yaml -compare_final_state_atol 2e-12 -compare_final_state_filename examples/fluids/tests-output/fluids-navierstokes-blasius_diff_filter_iso.bin -diff_filter_monitor -ts_max_steps 0 -diff_filter_width_scaling 4.2e-5,4.2e-5,4.2e-5 -diff_filter_ksp_atol 1e-14 -diff_filter_ksp_rtol 1e-16
23-
//TESTARGS(name="blasius_SGS_DataDriven") -ceed {ceed_resource} -test_type solver -options_file examples/fluids/tests-output/blasius_stgtest.yaml -sgs_model_type data_driven -sgs_model_dd_leakyrelu_alpha 0.3 -sgs_model_dd_parameter_dir examples/fluids/dd_sgs_data -ts_dt 1e-9 -compare_final_state_atol 2e-12 -compare_final_state_filename examples/fluids/tests-output/fluids-navierstokes-blasius-sgs-data-driven.bin -state_var primitive
2424
//TESTARGS(name="gaussianwave_idl") -ceed {ceed_resource} -test_type solver -options_file examples/fluids/gaussianwave.yaml -compare_final_state_atol 2e-11 -compare_final_state_filename examples/fluids/tests-output/fluids-navierstokes-gaussianwave-IDL.bin -dm_plex_box_faces 5,5,1 -ts_max_steps 5 -idl_decay_time 2e-3 -idl_length 0.25 -idl_start 0
2525
//TESTARGS(name="turb_spanstats") -ceed {ceed_resource} -test_type turb_spanstats -options_file examples/fluids/tests-output/stats_test.yaml -compare_final_state_atol 1E-11 -compare_final_state_filename examples/fluids/tests-output/fluids-navierstokes-turb-spanstats-stats.bin
2626
//TESTARGS(name="blasius") -ceed {ceed_resource} -test_type solver -options_file examples/fluids/tests-output/blasius_test.yaml -compare_final_state_atol 2E-11 -compare_final_state_filename examples/fluids/tests-output/fluids-navierstokes-blasius.bin
@@ -161,7 +161,7 @@ int main(int argc, char **argv) {
161161
}
162162

163163
// -- Set up DM
164-
PetscCall(SetUpDM(dm, problem, app_ctx->degree, bc, phys_ctx));
164+
PetscCall(SetUpDM(dm, problem, app_ctx->degree, app_ctx->q_extra, bc, phys_ctx));
165165

166166
// -- Refine DM for high-order viz
167167
if (app_ctx->viz_refine) PetscCall(VizRefineDM(dm, user, problem, bc, phys_ctx));

examples/fluids/navierstokes.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,6 @@ PetscErrorCode PrintRunInfo(User user, Physics phys_ctx, ProblemData *problem, M
314314
// -----------------------------------------------------------------------------
315315
// libCEED functions
316316
// -----------------------------------------------------------------------------
317-
// Utility function - essential BC dofs are encoded in closure indices as -(i+1).
318-
PetscInt Involute(PetscInt i);
319-
320317
// Utility function to create local CEED restriction
321318
PetscErrorCode CreateRestrictionFromPlex(Ceed ceed, DM dm, CeedInt height, DMLabel domain_label, CeedInt label_value, PetscInt dm_field,
322319
CeedElemRestriction *elem_restr);
@@ -326,6 +323,8 @@ PetscErrorCode GetRestrictionForDomain(Ceed ceed, DM dm, CeedInt height, DMLabel
326323
CeedInt q_data_size, CeedElemRestriction *elem_restr_q, CeedElemRestriction *elem_restr_x,
327324
CeedElemRestriction *elem_restr_qd_i);
328325

326+
PetscErrorCode CreateBasisFromPlex(Ceed ceed, DM dm, DMLabel domain_label, CeedInt label_value, CeedInt height, CeedInt dm_field, CeedBasis *basis);
327+
329328
// Utility function to create CEED Composite Operator for the entire domain
330329
PetscErrorCode CreateOperatorForDomain(Ceed ceed, DM dm, SimpleBC bc, CeedData ceed_data, Physics phys, CeedOperator op_apply_vol,
331330
CeedOperator op_apply_ijacobian_vol, CeedInt height, CeedInt P_sur, CeedInt Q_sur, CeedInt q_data_size_sur,
@@ -361,7 +360,7 @@ PetscErrorCode UpdateBoundaryValues(User user, Vec Q_loc, PetscReal t);
361360
PetscErrorCode CreateDM(MPI_Comm comm, ProblemData *problem, MatType, VecType, DM *dm);
362361

363362
// Set up DM
364-
PetscErrorCode SetUpDM(DM dm, ProblemData *problem, PetscInt degree, SimpleBC bc, Physics phys);
363+
PetscErrorCode SetUpDM(DM dm, ProblemData *problem, PetscInt degree, PetscInt q_extra, SimpleBC bc, Physics phys);
365364

366365
// Refine DM for high-order viz
367366
PetscErrorCode VizRefineDM(DM dm, User user, ProblemData *problem, SimpleBC bc, Physics phys);
@@ -445,8 +444,7 @@ PetscErrorCode GridAnisotropyTensorCalculateCollocatedVector(Ceed ceed, User use
445444
// -----------------------------------------------------------------------------
446445

447446
// Setup StrongBCs that use QFunctions
448-
PetscErrorCode SetupStrongBC_Ceed(Ceed ceed, CeedData ceed_data, DM dm, User user, ProblemData *problem, SimpleBC bc, CeedInt Q_sur,
449-
CeedInt q_data_size_sur);
447+
PetscErrorCode SetupStrongBC_Ceed(Ceed ceed, CeedData ceed_data, DM dm, User user, ProblemData *problem, SimpleBC bc, CeedInt q_data_size_sur);
450448

451449
PetscErrorCode FreestreamBCSetup(ProblemData *problem, DM dm, void *ctx, NewtonianIdealGasContext newtonian_ig_ctx, const StatePrimitive *reference);
452450
PetscErrorCode OutflowBCSetup(ProblemData *problem, DM dm, void *ctx, NewtonianIdealGasContext newtonian_ig_ctx, const StatePrimitive *reference);

examples/fluids/problems/sgs_dd_model.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,20 @@ PetscErrorCode SGS_DD_ModelSetupDataDestroy(SGS_DD_ModelSetupData sgs_dd_setup_d
2929
}
3030

3131
// @brief Create DM for storing subgrid stress at nodes
32-
PetscErrorCode SGS_DD_ModelCreateDM(DM dm_source, DM *dm_sgs, PetscInt degree, PetscInt *num_components) {
32+
PetscErrorCode SGS_DD_ModelCreateDM(DM dm_source, DM *dm_sgs, PetscInt degree, PetscInt q_extra, PetscInt *num_components) {
3333
PetscFE fe;
3434
PetscSection section;
3535
PetscInt dim;
3636

3737
PetscFunctionBeginUser;
38-
*num_components = 6;
38+
*num_components = 6;
39+
PetscInt q_order = degree + q_extra;
3940

4041
PetscCall(DMClone(dm_source, dm_sgs));
4142
PetscCall(DMGetDimension(*dm_sgs, &dim));
4243
PetscCall(PetscObjectSetName((PetscObject)*dm_sgs, "Subgrid Stress Projection"));
4344

44-
PetscCall(PetscFECreateLagrange(PETSC_COMM_SELF, dim, *num_components, PETSC_FALSE, degree, PETSC_DECIDE, &fe));
45+
PetscCall(PetscFECreateLagrange(PETSC_COMM_SELF, dim, *num_components, PETSC_FALSE, degree, q_order, &fe));
4546
PetscCall(PetscObjectSetName((PetscObject)fe, "Subgrid Stress Projection"));
4647
PetscCall(DMAddField(*dm_sgs, NULL, (PetscObject)fe));
4748
PetscCall(DMCreateDS(*dm_sgs));
@@ -66,7 +67,7 @@ PetscErrorCode SGS_DD_ModelSetupNodalEvaluation(Ceed ceed, User user, CeedData c
6667
SGS_DD_Data sgs_dd_data = user->sgs_dd_data;
6768
CeedQFunction qf_multiplicity, qf_sgs_dd_nodal;
6869
CeedOperator op_multiplicity, op_sgs_dd_nodal;
69-
CeedInt num_elem, elem_size, num_comp_q, num_qpts_1d, num_comp_grad_velo, num_comp_x, num_comp_grid_aniso;
70+
CeedInt num_elem, elem_size, num_comp_q, num_comp_grad_velo, num_comp_x, num_comp_grid_aniso;
7071
PetscInt dim;
7172
CeedVector multiplicity, inv_multiplicity;
7273
CeedElemRestriction elem_restr_inv_multiplicity, elem_restr_grad_velo, elem_restr_sgs;
@@ -78,16 +79,14 @@ PetscErrorCode SGS_DD_ModelSetupNodalEvaluation(Ceed ceed, User user, CeedData c
7879
CeedElemRestrictionGetNumComponents(sgs_dd_setup_data->elem_restr_grid_aniso, &num_comp_grid_aniso);
7980
CeedElemRestrictionGetNumElements(ceed_data->elem_restr_q, &num_elem);
8081
CeedElemRestrictionGetElementSize(ceed_data->elem_restr_q, &elem_size);
81-
CeedBasisGetNumQuadraturePoints1D(ceed_data->basis_q, &num_qpts_1d);
8282

8383
{ // Get velocity gradient information
8484
CeedOperatorField op_field;
8585
CeedOperatorGetFieldByName(user->grad_velo_proj->l2_rhs_ctx->op, "velocity gradient", &op_field);
8686
CeedOperatorFieldGetElemRestriction(op_field, &elem_restr_grad_velo);
8787
CeedElemRestrictionGetNumComponents(elem_restr_grad_velo, &num_comp_grad_velo);
8888
}
89-
90-
PetscCall(GetRestrictionForDomain(ceed, sgs_dd_data->dm_sgs, 0, 0, 0, 0, num_qpts_1d, 0, &elem_restr_sgs, NULL, NULL));
89+
PetscCall(GetRestrictionForDomain(ceed, sgs_dd_data->dm_sgs, 0, 0, 0, 0, -1, 0, &elem_restr_sgs, NULL, NULL));
9190
CeedElemRestrictionCreateVector(elem_restr_sgs, &sgs_dd_data->sgs_nodal_ceed, NULL);
9291

9392
// -- Create inverse multiplicity for correcting nodal assembly
@@ -160,7 +159,7 @@ PetscErrorCode SGS_DD_ModelSetupNodalEvaluation(Ceed ceed, User user, CeedData c
160159
// @brief Create CeedOperator to compute SGS contribution to the residual
161160
PetscErrorCode SGS_ModelSetupNodalIFunction(Ceed ceed, User user, CeedData ceed_data, SGS_DD_ModelSetupData sgs_dd_setup_data) {
162161
SGS_DD_Data sgs_dd_data = user->sgs_dd_data;
163-
CeedInt num_comp_q, num_comp_qd, num_comp_x, num_qpts_1d, num_nodes_1d;
162+
CeedInt num_comp_q, num_comp_qd, num_comp_x;
164163
PetscInt dim;
165164
CeedQFunction qf_sgs_apply;
166165
CeedOperator op_sgs_apply;
@@ -171,10 +170,8 @@ PetscErrorCode SGS_ModelSetupNodalIFunction(Ceed ceed, User user, CeedData ceed_
171170
CeedElemRestrictionGetNumComponents(ceed_data->elem_restr_q, &num_comp_q);
172171
CeedElemRestrictionGetNumComponents(ceed_data->elem_restr_qd_i, &num_comp_qd);
173172
CeedElemRestrictionGetNumComponents(ceed_data->elem_restr_x, &num_comp_x);
174-
CeedBasisGetNumQuadraturePoints1D(ceed_data->basis_q, &num_qpts_1d);
175-
CeedBasisGetNumNodes1D(ceed_data->basis_q, &num_nodes_1d);
176173

177-
CeedBasisCreateTensorH1Lagrange(ceed, dim, sgs_dd_data->num_comp_sgs, num_nodes_1d, num_qpts_1d, CEED_GAUSS, &basis_sgs);
174+
PetscCall(CreateBasisFromPlex(ceed, sgs_dd_data->dm_sgs, 0, 0, 0, 0, &basis_sgs));
178175

179176
switch (user->phys->state_var) {
180177
case STATEVAR_PRIMITIVE:
@@ -330,7 +327,8 @@ PetscErrorCode SGS_DD_ModelSetup(Ceed ceed, User user, CeedData ceed_data, Probl
330327

331328
// -- Create DM for storing SGS tensor at nodes
332329
PetscCall(PetscNew(&user->sgs_dd_data));
333-
PetscCall(SGS_DD_ModelCreateDM(user->dm, &user->sgs_dd_data->dm_sgs, user->app_ctx->degree, &user->sgs_dd_data->num_comp_sgs));
330+
PetscCall(
331+
SGS_DD_ModelCreateDM(user->dm, &user->sgs_dd_data->dm_sgs, user->app_ctx->degree, user->app_ctx->q_extra, &user->sgs_dd_data->num_comp_sgs));
334332

335333
PetscCall(PetscNew(&sgs_dd_setup_data));
336334

examples/fluids/qfunctions/shocktube.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ CEED_QFUNCTION_HELPER CeedInt Exact_ShockTube(CeedInt dim, CeedScalar time, cons
9494
CeedScalar rho, P, u[3] = {0.};
9595

9696
// Initial Conditions
97-
if (x <= mid_point) {
97+
if (x <= mid_point + 200 * CEED_EPSILON) {
9898
rho = rho_high;
9999
P = P_high;
100100
} else {

examples/fluids/src/differential_filter.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@
1717
PetscErrorCode DifferentialFilterCreateOperators(Ceed ceed, User user, CeedData ceed_data, CeedQFunctionContext diff_filter_qfctx) {
1818
DiffFilterData diff_filter = user->diff_filter;
1919
DM dm_filter = diff_filter->dm_filter;
20-
CeedInt num_comp_q, num_comp_qd, num_qpts_1d, num_nodes_1d, num_comp_x;
20+
CeedInt num_comp_q, num_comp_qd, num_comp_x;
2121
PetscInt dim;
2222

2323
PetscFunctionBeginUser;
2424
PetscCall(DMGetDimension(user->dm, &dim));
2525
CeedElemRestrictionGetNumComponents(ceed_data->elem_restr_x, &num_comp_x);
2626
CeedElemRestrictionGetNumComponents(ceed_data->elem_restr_q, &num_comp_q);
2727
CeedElemRestrictionGetNumComponents(ceed_data->elem_restr_qd_i, &num_comp_qd);
28-
CeedBasisGetNumQuadraturePoints1D(ceed_data->basis_q, &num_qpts_1d);
29-
CeedBasisGetNumNodes1D(ceed_data->basis_q, &num_nodes_1d);
3028

3129
{ // -- Create RHS MatopApplyContext
3230
CeedQFunction qf_rhs;
@@ -64,9 +62,8 @@ PetscErrorCode DifferentialFilterCreateOperators(Ceed ceed, User user, CeedData
6462
char field_name[PETSC_MAX_PATH_LEN];
6563
CeedElemRestriction elem_restr_filter;
6664
CeedBasis basis_filter;
67-
68-
PetscCall(GetRestrictionForDomain(ceed, dm_filter, 0, 0, 0, i, num_qpts_1d, 0, &elem_restr_filter, NULL, NULL));
69-
CeedBasisCreateTensorH1Lagrange(ceed, dim, diff_filter->num_field_components[i], num_nodes_1d, num_qpts_1d, CEED_GAUSS, &basis_filter);
65+
PetscCall(GetRestrictionForDomain(ceed, dm_filter, 0, 0, 0, i, -1, 0, &elem_restr_filter, NULL, NULL));
66+
PetscCall(CreateBasisFromPlex(ceed, dm_filter, 0, 0, 0, i, &basis_filter));
7067

7168
PetscCall(PetscSNPrintf(field_name, PETSC_MAX_PATH_LEN, "v%" PetscInt_FMT, i));
7269
CeedOperatorSetField(op_rhs, field_name, elem_restr_filter, basis_filter, CEED_VECTOR_ACTIVE);
@@ -187,7 +184,7 @@ PetscErrorCode DifferentialFilterSetup(Ceed ceed, User user, CeedData ceed_data,
187184
{ // Create DM for filtered quantities
188185
PetscFE fe;
189186
PetscSection section;
190-
PetscInt dim;
187+
PetscInt dim, q_order = user->app_ctx->degree + user->app_ctx->q_extra;
191188

192189
PetscCall(DMClone(user->dm, &diff_filter->dm_filter));
193190
PetscCall(DMGetDimension(diff_filter->dm_filter, &dim));
@@ -198,8 +195,7 @@ PetscErrorCode DifferentialFilterSetup(Ceed ceed, User user, CeedData ceed_data,
198195

199196
if (diff_filter->do_mms_test) {
200197
diff_filter->num_field_components[0] = 1;
201-
PetscCall(
202-
PetscFECreateLagrange(PETSC_COMM_SELF, dim, diff_filter->num_field_components[0], PETSC_FALSE, user->app_ctx->degree, PETSC_DECIDE, &fe));
198+
PetscCall(PetscFECreateLagrange(PETSC_COMM_SELF, dim, diff_filter->num_field_components[0], PETSC_FALSE, user->app_ctx->degree, q_order, &fe));
203199
PetscCall(PetscObjectSetName((PetscObject)fe, "Differential Filtering - MMS"));
204200
PetscCall(DMAddField(diff_filter->dm_filter, NULL, (PetscObject)fe));
205201
PetscCall(PetscFEDestroy(&fe));
@@ -209,15 +205,13 @@ PetscErrorCode DifferentialFilterSetup(Ceed ceed, User user, CeedData ceed_data,
209205
PetscCall(PetscSectionSetComponentName(section, 0, 0, "FilteredPhi"));
210206
} else {
211207
diff_filter->num_field_components[0] = DIFF_FILTER_STATE_NUM;
212-
PetscCall(
213-
PetscFECreateLagrange(PETSC_COMM_SELF, dim, diff_filter->num_field_components[0], PETSC_FALSE, user->app_ctx->degree, PETSC_DECIDE, &fe));
208+
PetscCall(PetscFECreateLagrange(PETSC_COMM_SELF, dim, diff_filter->num_field_components[0], PETSC_FALSE, user->app_ctx->degree, q_order, &fe));
214209
PetscCall(PetscObjectSetName((PetscObject)fe, "Differential Filtering - Primitive State Variables"));
215210
PetscCall(DMAddField(diff_filter->dm_filter, NULL, (PetscObject)fe));
216211
PetscCall(PetscFEDestroy(&fe));
217212

218213
diff_filter->num_field_components[1] = DIFF_FILTER_VELOCITY_SQUARED_NUM;
219-
PetscCall(
220-
PetscFECreateLagrange(PETSC_COMM_SELF, dim, diff_filter->num_field_components[1], PETSC_FALSE, user->app_ctx->degree, PETSC_DECIDE, &fe));
214+
PetscCall(PetscFECreateLagrange(PETSC_COMM_SELF, dim, diff_filter->num_field_components[1], PETSC_FALSE, user->app_ctx->degree, q_order, &fe));
221215
PetscCall(PetscObjectSetName((PetscObject)fe, "Differential Filtering - Velocity Products"));
222216
PetscCall(DMAddField(diff_filter->dm_filter, NULL, (PetscObject)fe));
223217
PetscCall(PetscFEDestroy(&fe));

examples/fluids/src/grid_anisotropy_tensor.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PetscErrorCode GridAnisotropyTensorProjectionSetupApply(Ceed ceed, User user, Ce
1919
CeedQFunction qf_rhs_assemble, qf_mass;
2020
CeedBasis basis_grid_aniso;
2121
PetscInt dim;
22-
CeedInt num_qpts_1d, num_nodes_1d, q_data_size;
22+
CeedInt q_data_size;
2323
MPI_Comm comm = PetscObjectComm((PetscObject)user->dm);
2424
KSP ksp;
2525

@@ -35,7 +35,8 @@ PetscErrorCode GridAnisotropyTensorProjectionSetupApply(Ceed ceed, User user, Ce
3535
{ // -- Setup DM
3636
PetscFE fe;
3737
PetscSection section;
38-
PetscCall(PetscFECreateLagrange(PETSC_COMM_SELF, dim, grid_aniso_proj->num_comp, PETSC_FALSE, user->app_ctx->degree, PETSC_DECIDE, &fe));
38+
PetscInt q_order = user->app_ctx->degree + user->app_ctx->q_extra;
39+
PetscCall(PetscFECreateLagrange(PETSC_COMM_SELF, dim, grid_aniso_proj->num_comp, PETSC_FALSE, user->app_ctx->degree, q_order, &fe));
3940
PetscCall(PetscObjectSetName((PetscObject)fe, "Grid Anisotropy Tensor Projection"));
4041
PetscCall(DMAddField(grid_aniso_proj->dm, NULL, (PetscObject)fe));
4142
PetscCall(DMCreateDS(grid_aniso_proj->dm));
@@ -55,13 +56,10 @@ PetscErrorCode GridAnisotropyTensorProjectionSetupApply(Ceed ceed, User user, Ce
5556
}
5657

5758
// -- Get Pre-requisite things
58-
CeedBasisGetNumQuadraturePoints1D(ceed_data->basis_q, &num_qpts_1d);
59-
CeedBasisGetNumNodes1D(ceed_data->basis_q, &num_nodes_1d);
6059
CeedElemRestrictionGetNumComponents(ceed_data->elem_restr_qd_i, &q_data_size);
6160

62-
PetscCall(
63-
GetRestrictionForDomain(ceed, grid_aniso_proj->dm, 0, 0, 0, 0, num_qpts_1d, grid_aniso_proj->num_comp, elem_restr_grid_aniso, NULL, NULL));
64-
CeedBasisCreateTensorH1Lagrange(ceed, dim, grid_aniso_proj->num_comp, num_nodes_1d, num_qpts_1d, CEED_GAUSS, &basis_grid_aniso);
61+
PetscCall(GetRestrictionForDomain(ceed, grid_aniso_proj->dm, 0, 0, 0, 0, -1, grid_aniso_proj->num_comp, elem_restr_grid_aniso, NULL, NULL));
62+
PetscCall(CreateBasisFromPlex(ceed, grid_aniso_proj->dm, 0, 0, 0, 0, &basis_grid_aniso));
6563

6664
// -- Build RHS operator
6765
CeedQFunctionCreateInterior(ceed, 1, AnisotropyTensorProjection, AnisotropyTensorProjection_loc, &qf_rhs_assemble);
@@ -136,17 +134,15 @@ PetscErrorCode GridAnisotropyTensorProjectionSetupApply(Ceed ceed, User user, Ce
136134

137135
PetscErrorCode GridAnisotropyTensorCalculateCollocatedVector(Ceed ceed, User user, CeedData ceed_data, CeedElemRestriction *elem_restr_grid_aniso,
138136
CeedVector *aniso_colloc_ceed, PetscInt *num_comp_aniso) {
139-
CeedInt q_data_size, num_qpts_1d, num_qpts;
137+
CeedInt q_data_size, num_nodes;
140138
CeedQFunction qf_colloc;
141139
CeedOperator op_colloc;
142140

143141
PetscFunctionBeginUser;
144-
// -- Get Pre-requisite things
145142
*num_comp_aniso = 7;
146-
CeedBasisGetNumQuadraturePoints1D(ceed_data->basis_q, &num_qpts_1d);
143+
CeedBasisGetNumNodes(ceed_data->basis_q, &num_nodes);
147144
CeedElemRestrictionGetNumComponents(ceed_data->elem_restr_qd_i, &q_data_size);
148-
149-
PetscCall(GetRestrictionForDomain(ceed, user->dm, 0, 0, 0, 0, num_qpts_1d, *num_comp_aniso, NULL, NULL, elem_restr_grid_aniso));
145+
PetscCall(GetRestrictionForDomain(ceed, user->dm, 0, 0, 0, 0, num_nodes, *num_comp_aniso, NULL, NULL, elem_restr_grid_aniso));
150146

151147
// -- Build collocation operator
152148
CeedQFunctionCreateInterior(ceed, 1, AnisotropyTensorCollocate, AnisotropyTensorCollocate_loc, &qf_colloc);
@@ -156,7 +152,6 @@ PetscErrorCode GridAnisotropyTensorCalculateCollocatedVector(Ceed ceed, User use
156152
CeedOperatorCreate(ceed, qf_colloc, NULL, NULL, &op_colloc);
157153
CeedOperatorSetField(op_colloc, "qdata", ceed_data->elem_restr_qd_i, CEED_BASIS_COLLOCATED, ceed_data->q_data);
158154
CeedOperatorSetField(op_colloc, "v", *elem_restr_grid_aniso, CEED_BASIS_COLLOCATED, CEED_VECTOR_ACTIVE);
159-
CeedBasisGetNumQuadraturePoints(ceed_data->basis_q, &num_qpts);
160155

161156
CeedElemRestrictionCreateVector(*elem_restr_grid_aniso, aniso_colloc_ceed, NULL);
162157

0 commit comments

Comments
 (0)