setupdm.c (3568c3e82964a3def751ac86e46777809ee904c5) setupdm.c (a2d72b6f1ed489cbeb0eb5f72cf8bf977e7ff50a)
1// Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6// This file is part of CEED: http://github.com/ceed
7
8/// @file

--- 38 unchanged lines hidden (view full) ---

47 PetscFunctionBeginUser;
48
49 PetscCall(DMSetupByOrderBegin_FEM(PETSC_TRUE, PETSC_TRUE, degree, PETSC_DECIDE, q_extra, 1, &num_comp_q, dm));
50
51 { // Add strong boundary conditions to DM
52 DMLabel label;
53 PetscCall(DMGetLabel(dm, "Face Sets", &label));
54 PetscCall(DMPlexLabelComplete(dm, label));
1// Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6// This file is part of CEED: http://github.com/ceed
7
8/// @file

--- 38 unchanged lines hidden (view full) ---

47 PetscFunctionBeginUser;
48
49 PetscCall(DMSetupByOrderBegin_FEM(PETSC_TRUE, PETSC_TRUE, degree, PETSC_DECIDE, q_extra, 1, &num_comp_q, dm));
50
51 { // Add strong boundary conditions to DM
52 DMLabel label;
53 PetscCall(DMGetLabel(dm, "Face Sets", &label));
54 PetscCall(DMPlexLabelComplete(dm, label));
55
56 for (PetscInt i = 0; i < problem->num_bc_defs; i++) {
57 BCDefinition bc_def = problem->bc_defs[i];
58 PetscInt num_essential_comps, num_label_values;
59 const PetscInt *essential_comps, *label_values;
60 const char *name;
61
62 PetscCall(BCDefinitionGetEssential(bc_def, &num_essential_comps, &essential_comps));
63 if (essential_comps > 0) {
64 PetscCall(BCDefinitionGetInfo(bc_def, &name, &num_label_values, &label_values));
65 PetscCall(DMAddBoundary(dm, DM_BC_ESSENTIAL, name, label, num_label_values, label_values, 0, num_essential_comps, essential_comps, NULL, NULL,
66 NULL, NULL));
67 }
55 // Set wall BCs
56 if (bc->num_wall > 0) {
57 PetscCall(DMAddBoundary(dm, DM_BC_ESSENTIAL, "wall", label, bc->num_wall, bc->walls, 0, bc->num_comps, bc->wall_comps, NULL, NULL, NULL, NULL));
68 }
58 }
59 // Set symmetry BCs in the x direction
60 if (bc->num_symmetry[0] > 0) {
61 PetscInt comps[1] = {1};
62 PetscCall(DMAddBoundary(dm, DM_BC_ESSENTIAL, "symmetry_x", label, bc->num_symmetry[0], bc->symmetries[0], 0, 1, comps, NULL, NULL, NULL, NULL));
63 }
64 // Set symmetry BCs in the y direction
65 if (bc->num_symmetry[1] > 0) {
66 PetscInt comps[1] = {2};
67 PetscCall(DMAddBoundary(dm, DM_BC_ESSENTIAL, "symmetry_y", label, bc->num_symmetry[1], bc->symmetries[1], 0, 1, comps, NULL, NULL, NULL, NULL));
68 }
69 // Set symmetry BCs in the z direction
70 if (bc->num_symmetry[2] > 0) {
71 PetscInt comps[1] = {3};
72 PetscCall(DMAddBoundary(dm, DM_BC_ESSENTIAL, "symmetry_z", label, bc->num_symmetry[2], bc->symmetries[2], 0, 1, comps, NULL, NULL, NULL, NULL));
73 }
69 {
70 PetscBool use_strongstg = PETSC_FALSE;
71 PetscCall(PetscOptionsGetBool(NULL, NULL, "-stg_strong", &use_strongstg, NULL));
72 if (use_strongstg) PetscCall(SetupStrongStg(dm, bc, problem, phys));
73 }
74 }
75
76 PetscCall(DMSetupByOrderEnd_FEM(PETSC_TRUE, dm));

--- 13 unchanged lines hidden (view full) ---

90
91 case STATEVAR_PRIMITIVE:
92 PetscCall(PetscSectionSetComponentName(section, 0, 0, "Pressure"));
93 PetscCall(PetscSectionSetComponentName(section, 0, 1, "VelocityX"));
94 PetscCall(PetscSectionSetComponentName(section, 0, 2, "VelocityY"));
95 PetscCall(PetscSectionSetComponentName(section, 0, 3, "VelocityZ"));
96 PetscCall(PetscSectionSetComponentName(section, 0, 4, "Temperature"));
97 break;
74 {
75 PetscBool use_strongstg = PETSC_FALSE;
76 PetscCall(PetscOptionsGetBool(NULL, NULL, "-stg_strong", &use_strongstg, NULL));
77 if (use_strongstg) PetscCall(SetupStrongStg(dm, bc, problem, phys));
78 }
79 }
80
81 PetscCall(DMSetupByOrderEnd_FEM(PETSC_TRUE, dm));

--- 13 unchanged lines hidden (view full) ---

95
96 case STATEVAR_PRIMITIVE:
97 PetscCall(PetscSectionSetComponentName(section, 0, 0, "Pressure"));
98 PetscCall(PetscSectionSetComponentName(section, 0, 1, "VelocityX"));
99 PetscCall(PetscSectionSetComponentName(section, 0, 2, "VelocityY"));
100 PetscCall(PetscSectionSetComponentName(section, 0, 3, "VelocityZ"));
101 PetscCall(PetscSectionSetComponentName(section, 0, 4, "Temperature"));
102 break;
103
104 case STATEVAR_ENTROPY:
105 PetscCall(PetscSectionSetComponentName(section, 0, 0, "EntropyDensity"));
106 PetscCall(PetscSectionSetComponentName(section, 0, 1, "EntropyMomentumX"));
107 PetscCall(PetscSectionSetComponentName(section, 0, 2, "EntropyMomentumY"));
108 PetscCall(PetscSectionSetComponentName(section, 0, 3, "EntropyMomentumZ"));
109 PetscCall(PetscSectionSetComponentName(section, 0, 4, "EntropyTotalEnergy"));
110 break;
98 }
99 PetscFunctionReturn(PETSC_SUCCESS);
100}
101
102// Refine DM for high-order viz
103PetscErrorCode VizRefineDM(DM dm, User user, ProblemData problem, SimpleBC bc, Physics phys) {
104 DM dm_hierarchy[user->app_ctx->viz_refine + 1];
105 VecType vec_type;

--- 33 unchanged lines hidden ---
111 }
112 PetscFunctionReturn(PETSC_SUCCESS);
113}
114
115// Refine DM for high-order viz
116PetscErrorCode VizRefineDM(DM dm, User user, ProblemData problem, SimpleBC bc, Physics phys) {
117 DM dm_hierarchy[user->app_ctx->viz_refine + 1];
118 VecType vec_type;

--- 33 unchanged lines hidden ---