xref: /honee/include/navierstokes.h (revision 337840fc9f8b699b98947f09e30443f8c0c7f962)
1ae2b091fSJames Wright // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2ae2b091fSJames Wright // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3149fb536SJames Wright #pragma once
4149fb536SJames Wright 
5149fb536SJames Wright #include <bc_definition.h>
60bf21536SJames Wright #include <ceed.h>
7b7e55d06SJames Wright #include <dm-utils.h>
893ca29b6SJames Wright #include <honee-file.h>
978c5b8e5SJames Wright #include <honee.h>
10149fb536SJames Wright #include <log_events.h>
11149fb536SJames Wright #include <mat-ceed.h>
12149fb536SJames Wright #include <petsc-ceed-utils.h>
13149fb536SJames Wright #include <petscts.h>
14149fb536SJames Wright #include <stdbool.h>
15354560d1SJames Wright #include <time.h>
16149fb536SJames Wright 
178340219bSJames Wright #include <nodal_projection.h>
188340219bSJames Wright 
19149fb536SJames Wright #include <petsc_ops.h>
20149fb536SJames Wright #include "../qfunctions/newtonian_types.h"
21149fb536SJames Wright 
22*2e37a5dbSJames Wright #if PETSC_VERSION_LT(3, 24, 0)
23*2e37a5dbSJames Wright #error "PETSc latest main branch or v3.24 is required"
24149fb536SJames Wright #endif
25149fb536SJames Wright 
26149fb536SJames Wright // -----------------------------------------------------------------------------
27149fb536SJames Wright // Enums
28149fb536SJames Wright // -----------------------------------------------------------------------------
29149fb536SJames Wright 
30149fb536SJames Wright // Euler - test cases
31149fb536SJames Wright typedef enum {
32149fb536SJames Wright   EULER_TEST_ISENTROPIC_VORTEX = 0,
33149fb536SJames Wright   EULER_TEST_1                 = 1,
34149fb536SJames Wright   EULER_TEST_2                 = 2,
35149fb536SJames Wright   EULER_TEST_3                 = 3,
36149fb536SJames Wright   EULER_TEST_4                 = 4,
37149fb536SJames Wright   EULER_TEST_5                 = 5,
38149fb536SJames Wright } EulerTestType;
39149fb536SJames Wright static const char *const EulerTestTypes[] = {"ISENTROPIC_VORTEX", "1", "2", "3", "4", "5", "EulerTestType", "EULER_TEST_", NULL};
40149fb536SJames Wright 
41149fb536SJames Wright // Test mode type
42149fb536SJames Wright typedef enum {
43149fb536SJames Wright   TESTTYPE_NONE           = 0,
44149fb536SJames Wright   TESTTYPE_SOLVER         = 1,
45149fb536SJames Wright   TESTTYPE_TURB_SPANSTATS = 2,
46149fb536SJames Wright   TESTTYPE_DIFF_FILTER    = 3,
470aab7249SJames Wright   TESTTYPE_SPANSTATS      = 4,
48149fb536SJames Wright } TestType;
490aab7249SJames Wright static const char *const TestTypes[] = {"NONE", "SOLVER", "TURB_SPANSTATS", "DIFF_FILTER", "SPANSTATS", "TestType", "TESTTYPE_", NULL};
50149fb536SJames Wright 
51149fb536SJames Wright // Subgrid-Stress mode type
52149fb536SJames Wright typedef enum {
53149fb536SJames Wright   SGS_MODEL_NONE        = 0,
54149fb536SJames Wright   SGS_MODEL_DATA_DRIVEN = 1,
55149fb536SJames Wright } SGSModelType;
56149fb536SJames Wright static const char *const SGSModelTypes[] = {"NONE", "DATA_DRIVEN", "SGSModelType", "SGS_MODEL_", NULL};
57149fb536SJames Wright 
58149fb536SJames Wright // Subgrid-Stress mode type
59149fb536SJames Wright typedef enum {
60149fb536SJames Wright   SGS_MODEL_DD_FUSED           = 0,
61149fb536SJames Wright   SGS_MODEL_DD_SEQENTIAL_CEED  = 1,
62149fb536SJames Wright   SGS_MODEL_DD_SEQENTIAL_TORCH = 2,
63149fb536SJames Wright } SGSModelDDImplementation;
64149fb536SJames Wright static const char *const SGSModelDDImplementations[] = {"FUSED", "SEQUENTIAL_CEED", "SEQUENTIAL_TORCH", "SGSModelDDImplementation", "SGS_MODEL_DD_",
65149fb536SJames Wright                                                         NULL};
66149fb536SJames Wright 
67149fb536SJames Wright // -----------------------------------------------------------------------------
68149fb536SJames Wright // Structs
69149fb536SJames Wright // -----------------------------------------------------------------------------
70149fb536SJames Wright // Structs declarations
71149fb536SJames Wright typedef struct AppCtx_private      *AppCtx;
72149fb536SJames Wright typedef struct Units_private       *Units;
73149fb536SJames Wright typedef struct SimpleBC_private    *SimpleBC;
74149fb536SJames Wright typedef struct Physics_private     *Physics;
75149fb536SJames Wright typedef struct ProblemData_private *ProblemData;
76149fb536SJames Wright 
77149fb536SJames Wright // Application context from user command line options
78149fb536SJames Wright struct AppCtx_private {
79149fb536SJames Wright   // libCEED arguments
80149fb536SJames Wright   char     ceed_resource[PETSC_MAX_PATH_LEN];  // libCEED backend
81149fb536SJames Wright   PetscInt degree;
82149fb536SJames Wright   PetscInt q_extra;
83149fb536SJames Wright   // Solver arguments
84149fb536SJames Wright   MatType amat_type;
85149fb536SJames Wright   // Post-processing arguments
86149fb536SJames Wright   PetscInt  checkpoint_interval;
87149fb536SJames Wright   PetscInt  viz_refine;
88481d14cbSJames Wright   PetscBool use_continue_file;
89149fb536SJames Wright   PetscInt  cont_steps;
90149fb536SJames Wright   PetscReal cont_time;
91149fb536SJames Wright   char      cont_file[PETSC_MAX_PATH_LEN];
92149fb536SJames Wright   char      output_dir[PETSC_MAX_PATH_LEN];
93149fb536SJames Wright   PetscBool add_stepnum2bin;
94149fb536SJames Wright   PetscBool checkpoint_vtk;
95149fb536SJames Wright   // Problem type arguments
96149fb536SJames Wright   PetscFunctionList problems;
97149fb536SJames Wright   char              problem_name[PETSC_MAX_PATH_LEN];
98149fb536SJames Wright   // Test mode arguments
99149fb536SJames Wright   TestType    test_type;
100149fb536SJames Wright   PetscScalar test_tol;
101149fb536SJames Wright   char        test_file_path[PETSC_MAX_PATH_LEN];
102149fb536SJames Wright   // Wall forces
103149fb536SJames Wright   struct {
104149fb536SJames Wright     PetscInt          num_wall;
105149fb536SJames Wright     PetscInt         *walls;
106149fb536SJames Wright     PetscViewer       viewer;
107149fb536SJames Wright     PetscViewerFormat viewer_format;
108149fb536SJames Wright     PetscBool         header_written;
109149fb536SJames Wright   } wall_forces;
110149fb536SJames Wright   // Subgrid Stress Model
111149fb536SJames Wright   SGSModelType sgs_model_type;
112149fb536SJames Wright   PetscBool    sgs_train_enable;
113cb8a476cSJames Wright 
1148c85b835SJames Wright   // Divergence of Diffusive Flux Projection
1158c85b835SJames Wright   DivDiffFluxProjectionMethod divFdiffproj_method;
1168b774af8SJames Wright 
1178b774af8SJames Wright   PetscInt check_step_interval;
118149fb536SJames Wright };
119149fb536SJames Wright 
120f5dc303cSJames Wright typedef struct DivDiffFluxProjectionData_ *DivDiffFluxProjectionData;
121f5dc303cSJames Wright struct DivDiffFluxProjectionData_ {
1228c85b835SJames Wright   PetscInt                    num_diff_flux_comps;
1238c85b835SJames Wright   DivDiffFluxProjectionMethod method;
1248c85b835SJames Wright   NodalProjectionData         projection;
12536038bbcSJames Wright 
12636038bbcSJames Wright   // CeedOperator Objects
12736038bbcSJames Wright   CeedElemRestriction elem_restr_div_diff_flux;
12836038bbcSJames Wright   CeedBasis           basis_div_diff_flux;
12936038bbcSJames Wright   CeedEvalMode        eval_mode_div_diff_flux;
1308c85b835SJames Wright   CeedVector          div_diff_flux_ceed;
13136038bbcSJames Wright 
13236038bbcSJames Wright   // Problem specific setup functions
133e3663b90SJames Wright   PetscErrorCode (*CreateRHSOperator_Direct)(Honee, DivDiffFluxProjectionData, CeedOperator *);
134e3663b90SJames Wright   PetscErrorCode (*CreateRHSOperator_Indirect)(Honee, DivDiffFluxProjectionData, CeedOperator *);
13536038bbcSJames Wright 
1368c85b835SJames Wright   // Only used for direct method:
1378c85b835SJames Wright   Vec          DivDiffFlux_loc;
1388c85b835SJames Wright   PetscMemType DivDiffFlux_memtype;
1398c85b835SJames Wright   PetscBool    ceed_vec_has_array;
14036038bbcSJames Wright 
14136038bbcSJames Wright   // Only used for indirect method:
14236038bbcSJames Wright   OperatorApplyContext calc_div_diff_flux;
14336038bbcSJames Wright };
1448c85b835SJames Wright 
1456a9fb8efSJames Wright typedef struct _HoneeOps *HoneeOps;
1466a9fb8efSJames Wright struct _HoneeOps {};
1476a9fb8efSJames Wright 
1486a9fb8efSJames Wright PetscErrorCode HoneeInit(MPI_Comm comm, Honee *honee);
1496a9fb8efSJames Wright PetscErrorCode HoneeDestroy(Honee *honee);
1506a9fb8efSJames Wright 
151149fb536SJames Wright // PETSc user data
1520c373b74SJames Wright struct Honee_private {
1536a9fb8efSJames Wright   PETSCHEADER(struct _HoneeOps);
154149fb536SJames Wright   MPI_Comm                  comm;
155149fb536SJames Wright   DM                        dm;
156149fb536SJames Wright   DM                        dm_viz;
157149fb536SJames Wright   Mat                       interp_viz;
158149fb536SJames Wright   Ceed                      ceed;
159149fb536SJames Wright   Units                     units;
160149fb536SJames Wright   Vec                       Q_loc, Q_dot_loc;
161149fb536SJames Wright   Physics                   phys;
162149fb536SJames Wright   AppCtx                    app_ctx;
163149fb536SJames Wright   CeedVector                q_ceed, q_dot_ceed, g_ceed, x_ceed;
164149fb536SJames Wright   CeedOperator              op_ifunction;
165149fb536SJames Wright   Mat                       mat_ijacobian;
166149fb536SJames Wright   KSP                       mass_ksp;
167149fb536SJames Wright   OperatorApplyContext      op_rhs_ctx, op_strong_bc_ctx;
168149fb536SJames Wright   CeedScalar                time_bc_set;
1698c85b835SJames Wright   DivDiffFluxProjectionData diff_flux_proj;
170e3663b90SJames Wright 
17178c5b8e5SJames Wright   ProblemData problem_data;
17278c5b8e5SJames Wright 
173e3663b90SJames Wright   OperatorApplyContext op_ics_ctx;
174354560d1SJames Wright 
1754c6ae86eSJames Wright   PetscBool set_poststep;
176354560d1SJames Wright   time_t    start_time;
177354560d1SJames Wright   time_t    max_wall_time;
178354560d1SJames Wright   PetscInt  max_wall_time_interval;
179149fb536SJames Wright };
180149fb536SJames Wright 
181149fb536SJames Wright // Units
182149fb536SJames Wright struct Units_private {
183149fb536SJames Wright   // fundamental units
184149fb536SJames Wright   PetscScalar meter;
185149fb536SJames Wright   PetscScalar kilogram;
186149fb536SJames Wright   PetscScalar second;
187149fb536SJames Wright   PetscScalar Kelvin;
188149fb536SJames Wright   // derived units
189149fb536SJames Wright   PetscScalar Pascal;
190149fb536SJames Wright   PetscScalar J_per_kg_K;
191149fb536SJames Wright   PetscScalar m_per_squared_s;
192149fb536SJames Wright   PetscScalar W_per_m_K;
193149fb536SJames Wright   PetscScalar Joule;
194149fb536SJames Wright };
195149fb536SJames Wright 
196149fb536SJames Wright // Struct that contains all enums and structs used for the physics of all problems
197149fb536SJames Wright struct Physics_private {
198149fb536SJames Wright   PetscBool             implicit;
199149fb536SJames Wright   StateVariable         state_var;
200149fb536SJames Wright   CeedContextFieldLabel solution_time_label;
201149fb536SJames Wright   CeedContextFieldLabel stg_solution_time_label;
202149fb536SJames Wright   CeedContextFieldLabel timestep_size_label;
203149fb536SJames Wright   CeedContextFieldLabel ics_time_label;
204149fb536SJames Wright };
205149fb536SJames Wright 
206f5dc303cSJames Wright typedef struct HoneeBCStruct_ *HoneeBCStruct;
207f5dc303cSJames Wright struct HoneeBCStruct_ {
2085e79d562SJames Wright   Honee                honee;
2091abc2837SJames Wright   CeedInt              num_comps_jac_data;
2105e79d562SJames Wright   CeedQFunctionContext qfctx;
2115e79d562SJames Wright   void                *ctx;
2125e79d562SJames Wright   PetscCtxDestroyFn   *DestroyCtx;
213f5dc303cSJames Wright };
2145e79d562SJames Wright 
215d3c60affSJames Wright PetscErrorCode BoundaryConditionSetUp(Honee honee, ProblemData problem, AppCtx app_ctx);
2165e79d562SJames Wright PetscErrorCode HoneeBCDestroy(void **ctx);
2175e79d562SJames Wright PetscErrorCode HoneeBCCreateIFunctionQF(BCDefinition bc_def, CeedQFunctionUser qf_func_ptr, const char *qf_loc, CeedQFunctionContext qfctx,
2185e79d562SJames Wright                                         CeedQFunction *qf_ifunc);
2195e79d562SJames Wright PetscErrorCode HoneeBCCreateIJacobianQF(BCDefinition bc_def, CeedQFunctionUser qf_func_ptr, const char *qf_loc, CeedQFunctionContext qfctx,
2205e79d562SJames Wright                                         CeedQFunction *qf_ijac);
2215e79d562SJames Wright PetscErrorCode HoneeBCAddIFunctionOp(BCDefinition bc_def, DMLabel domain_label, PetscInt label_value, CeedQFunction qf_ifunc, CeedOperator op_ifunc,
2225e79d562SJames Wright                                      CeedOperator *sub_op_ifunc);
2235e79d562SJames Wright PetscErrorCode HoneeBCAddIJacobianOp(BCDefinition bc_def, CeedOperator sub_op_ifunc, DMLabel domain_label, PetscInt label_value,
2245e79d562SJames Wright                                      CeedQFunction qf_ijac, CeedOperator op_ijac);
225149fb536SJames Wright 
226149fb536SJames Wright typedef struct {
227e07531f7SJames Wright   CeedQFunctionUser    qf_func_ptr;  // !< QFunction function pointer
228e07531f7SJames Wright   const char          *qf_loc;       // !< Absolute path to QFunction source file
229e07531f7SJames Wright   CeedQFunctionContext qfctx;        // !< QFunctionContext to attach to QFunction
230f5dc303cSJames Wright } HoneeQFSpec;
231149fb536SJames Wright 
232149fb536SJames Wright // Problem specific data
233149fb536SJames Wright struct ProblemData_private {
234f27c2204SJames Wright   // DM Field Settings
235f27c2204SJames Wright   PetscInt num_components;
236f27c2204SJames Wright   char   **component_names;
237f27c2204SJames Wright 
2381abc2837SJames Wright   CeedInt     num_comps_jac_data;
239f5dc303cSJames Wright   HoneeQFSpec ics, apply_vol_rhs, apply_vol_ifunction, apply_vol_ijacobian;
240149fb536SJames Wright   bool        compute_exact_solution_error;
24128160fc2SJames Wright   PetscBool   set_bc_from_ics, use_strong_bc_ceed;
242f27c2204SJames Wright 
243f27c2204SJames Wright   // BC Definitions
244ddb7a641SJames Wright   PetscCount    num_bc_defs;
245149fb536SJames Wright   BCDefinition *bc_defs;
246f27c2204SJames Wright 
2470c373b74SJames Wright   PetscErrorCode (*print_info)(Honee, ProblemData, AppCtx);
2480c373b74SJames Wright   PetscErrorCode (*create_mass_operator)(Honee, CeedOperator *);
249149fb536SJames Wright };
250149fb536SJames Wright 
251149fb536SJames Wright extern int FreeContextPetsc(void *);
252149fb536SJames Wright 
253149fb536SJames Wright // -----------------------------------------------------------------------------
254149fb536SJames Wright // Set up problems
255149fb536SJames Wright // -----------------------------------------------------------------------------
256149fb536SJames Wright // Set up function for each problem
257d3c60affSJames Wright extern PetscErrorCode NS_TAYLOR_GREEN(ProblemData problem, DM dm, void *ctx);
258d3c60affSJames Wright extern PetscErrorCode NS_GAUSSIAN_WAVE(ProblemData problem, DM dm, void *ctx);
259d3c60affSJames Wright extern PetscErrorCode NS_CHANNEL(ProblemData problem, DM dm, void *ctx);
260d3c60affSJames Wright extern PetscErrorCode NS_BLASIUS(ProblemData problem, DM dm, void *ctx);
261d3c60affSJames Wright extern PetscErrorCode NS_NEWTONIAN_IG(ProblemData problem, DM dm, void *ctx);
262d3c60affSJames Wright extern PetscErrorCode NS_DENSITY_CURRENT(ProblemData problem, DM dm, void *ctx);
263d3c60affSJames Wright extern PetscErrorCode NS_EULER_VORTEX(ProblemData problem, DM dm, void *ctx);
264d3c60affSJames Wright extern PetscErrorCode NS_SHOCKTUBE(ProblemData problem, DM dm, void *ctx);
265d3c60affSJames Wright extern PetscErrorCode NS_ADVECTION(ProblemData problem, DM dm, void *ctx);
266149fb536SJames Wright 
2670c373b74SJames Wright PetscErrorCode PrintRunInfo(Honee honee, Physics phys_ctx, ProblemData problem, TS ts);
268149fb536SJames Wright 
269149fb536SJames Wright // -----------------------------------------------------------------------------
270149fb536SJames Wright // libCEED functions
271149fb536SJames Wright // -----------------------------------------------------------------------------
272d3c60affSJames Wright PetscErrorCode SetupLibceed(Ceed ceed, DM dm, Honee honee, AppCtx app_ctx, ProblemData problem);
273149fb536SJames Wright 
2749018c49aSJames Wright PetscErrorCode QDataGet(Ceed ceed, DM dm, DMLabel domain_label, PetscInt label_value, CeedElemRestriction *elem_restr_qd, CeedVector *q_data,
2759018c49aSJames Wright                         CeedInt *q_data_size);
276149fb536SJames Wright PetscErrorCode QDataGetNumComponents(DM dm, CeedInt *q_data_size);
27707126c9aSJames Wright PetscErrorCode QDataBoundaryGet(Ceed ceed, DM dm, DMLabel domain_label, PetscInt label_value, CeedElemRestriction *elem_restr_qd, CeedVector *q_data,
27807126c9aSJames Wright                                 CeedInt *q_data_size);
279149fb536SJames Wright PetscErrorCode QDataBoundaryGetNumComponents(DM dm, CeedInt *q_data_size);
2808c85b835SJames Wright PetscErrorCode QDataBoundaryGradientGetNumComponents(DM dm, CeedInt *q_data_size);
281d510ce3cSJames Wright PetscErrorCode QDataBoundaryGradientGet(Ceed ceed, DM dm, DMLabel domain_label, PetscInt label_value, CeedElemRestriction *elem_restr_qd,
282d510ce3cSJames Wright                                         CeedVector *q_data, CeedInt *q_data_size);
283e816a7e4SJames Wright PetscErrorCode QDataClearStoredData();
284149fb536SJames Wright // -----------------------------------------------------------------------------
285149fb536SJames Wright // Time-stepping functions
286149fb536SJames Wright // -----------------------------------------------------------------------------
2872a9a4b51SJames Wright PetscErrorCode TSSolve_NS(DM dm, Honee honee, AppCtx app_ctx, Physics phys, ProblemData problem, Vec Q, PetscScalar *f_time, TS *ts);
2880c373b74SJames Wright PetscErrorCode UpdateBoundaryValues(Honee honee, Vec Q_loc, PetscReal t);
289149fb536SJames Wright 
290149fb536SJames Wright // -----------------------------------------------------------------------------
291149fb536SJames Wright // Setup DM
292149fb536SJames Wright // -----------------------------------------------------------------------------
2934d9179f2SJames Wright PetscErrorCode CreateDM(Honee honee, ProblemData problem, MatType, VecType, DM *dm);
294d3c60affSJames Wright PetscErrorCode SetUpDM(DM dm, ProblemData problem, PetscInt degree, PetscInt q_extra, Physics phys);
295d3c60affSJames Wright PetscErrorCode VizRefineDM(DM dm, Honee honee, ProblemData problem, Physics phys);
2964cb09fddSJames Wright 
297149fb536SJames Wright // -----------------------------------------------------------------------------
298149fb536SJames Wright // Process command line options
299149fb536SJames Wright // -----------------------------------------------------------------------------
300d3c60affSJames Wright PetscErrorCode ProcessCommandLineOptions(Honee honee);
30159572072SJames Wright PetscErrorCode HoneeOptionsSetValueDefault(PetscOptions options, const char name[], const char value[]);
302149fb536SJames Wright 
303149fb536SJames Wright // -----------------------------------------------------------------------------
304149fb536SJames Wright // Miscellaneous utility functions
305149fb536SJames Wright // -----------------------------------------------------------------------------
306149fb536SJames Wright PetscErrorCode GetInverseMultiplicity(Ceed ceed, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height, PetscInt dm_field,
307149fb536SJames Wright                                       PetscBool get_global_multiplicity, CeedElemRestriction *elem_restr_inv_multiplicity,
308149fb536SJames Wright                                       CeedVector *inv_multiplicity);
309e3663b90SJames Wright PetscErrorCode ICs_FixMultiplicity(DM dm, Honee honee, Vec Q_loc, Vec Q, CeedScalar time);
310149fb536SJames Wright 
311149fb536SJames Wright PetscErrorCode DMPlexInsertBoundaryValues_FromICs(DM dm, PetscBool insert_essential, Vec Q_loc, PetscReal time, Vec face_geom_FVM, Vec cell_geom_FVM,
312149fb536SJames Wright                                                   Vec grad_FVM);
313149fb536SJames Wright 
314149fb536SJames Wright PetscErrorCode RegressionTest(AppCtx app_ctx, Vec Q);
315e3663b90SJames Wright PetscErrorCode PrintError(DM dm, Honee honee, Vec Q, PetscScalar final_time);
316e3663b90SJames Wright PetscErrorCode PostProcess(TS ts, DM dm, ProblemData problem, Honee honee, Vec Q, PetscScalar final_time);
317149fb536SJames Wright PetscErrorCode SetBCsFromICs(DM dm, Vec Q, Vec Q_loc);
31864dd23feSJames Wright PetscErrorCode HoneeMassQFunctionCreate(Ceed ceed, CeedInt N, CeedInt q_data_size, CeedQFunction *qf);
31925125139SJames Wright PetscErrorCode HoneeCalculateDomainSize(Honee honee, PetscScalar *volume);
320149fb536SJames Wright 
321149fb536SJames Wright // -----------------------------------------------------------------------------
322149fb536SJames Wright // Data-Driven Subgrid Stress (DD-SGS) Modeling Functions
323149fb536SJames Wright // -----------------------------------------------------------------------------
324e3663b90SJames Wright PetscErrorCode SgsDDSetup(Ceed ceed, Honee honee, ProblemData problem);
3250c373b74SJames Wright PetscErrorCode SgsDDApplyIFunction(Honee honee, const Vec Q_loc, Vec G_loc);
326e3663b90SJames Wright PetscErrorCode VelocityGradientProjectionSetup(Ceed ceed, Honee honee, ProblemData problem, StateVariable state_var_input,
327149fb536SJames Wright                                                CeedElemRestriction elem_restr_input, CeedBasis basis_input, NodalProjectionData *pgrad_velo_proj);
328149fb536SJames Wright PetscErrorCode VelocityGradientProjectionApply(NodalProjectionData grad_velo_proj, Vec Q_loc, Vec VelocityGradient);
329e3663b90SJames Wright PetscErrorCode GridAnisotropyTensorProjectionSetupApply(Ceed ceed, Honee honee, CeedElemRestriction *elem_restr_grid_aniso,
330149fb536SJames Wright                                                         CeedVector *grid_aniso_vector);
331e3663b90SJames Wright PetscErrorCode GridAnisotropyTensorCalculateCollocatedVector(Ceed ceed, Honee honee, CeedElemRestriction *elem_restr_grid_aniso,
332149fb536SJames Wright                                                              CeedVector *aniso_colloc_ceed, PetscInt *num_comp_aniso);
333149fb536SJames Wright 
334149fb536SJames Wright // -----------------------------------------------------------------------------
335149fb536SJames Wright // Boundary Condition Related Functions
336149fb536SJames Wright // -----------------------------------------------------------------------------
337d3c60affSJames Wright PetscErrorCode SetupStrongBC_Ceed(Ceed ceed, DM dm, Honee honee, ProblemData problem);
338d4e423e7SJames Wright PetscErrorCode FreestreamBCSetup(BCDefinition bc_def, ProblemData problem, DM dm, void *ctx, NewtonianIdealGasContext newtonian_ig_ctx,
339d4e423e7SJames Wright                                  const StatePrimitive *reference);
340f978755dSJames Wright PetscErrorCode OutflowBCSetup(BCDefinition bc_def, ProblemData problem, DM dm, void *ctx, NewtonianIdealGasContext newtonian_ig_ctx,
341f978755dSJames Wright                               const StatePrimitive *reference);
3425e79d562SJames Wright PetscErrorCode SlipBCSetup(BCDefinition bc_def, ProblemData problem, DM dm, void *ctx, CeedQFunctionContext newtonian_ig_qfctx);
343149fb536SJames Wright 
344149fb536SJames Wright // -----------------------------------------------------------------------------
3458c85b835SJames Wright // Divergence of Diffusive Flux Projection
3468c85b835SJames Wright // -----------------------------------------------------------------------------
347d9e69621SJames Wright PetscErrorCode DivDiffFluxProjectionCreate(Honee honee, DivDiffFluxProjectionMethod divFdiffproj_method, PetscInt num_diff_flux_comps,
348d9e69621SJames Wright                                            DivDiffFluxProjectionData *pdiff_flux_proj);
3490880fbb6SJames Wright PetscErrorCode DivDiffFluxProjectionGetOperatorFieldData(DivDiffFluxProjectionData diff_flux_proj, CeedElemRestriction *elem_restr, CeedBasis *basis,
3500880fbb6SJames Wright                                                          CeedVector *vector, CeedEvalMode *eval_mode);
351e3663b90SJames Wright PetscErrorCode DivDiffFluxProjectionSetup(Honee honee, DivDiffFluxProjectionData diff_flux_proj);
35236038bbcSJames Wright PetscErrorCode DivDiffFluxProjectionApply(DivDiffFluxProjectionData diff_flux_proj, Vec Q_loc);
3538c85b835SJames Wright PetscErrorCode DivDiffFluxProjectionDataDestroy(DivDiffFluxProjectionData diff_flux_proj);
35425125139SJames Wright 
35525125139SJames Wright PetscErrorCode SetupMontiorTotalKineticEnergy(TS ts, PetscViewerAndFormat *ctx);
35625125139SJames Wright PetscErrorCode TSMonitor_TotalKineticEnergy(TS ts, PetscInt steps, PetscReal solution_time, Vec Q, PetscViewerAndFormat *ctx);
35787fd7f33SJames Wright 
35887fd7f33SJames Wright PetscErrorCode SetupMontiorCfl(TS ts, PetscViewerAndFormat *ctx);
35987fd7f33SJames Wright PetscErrorCode TSMonitor_Cfl(TS ts, PetscInt step, PetscReal solution_time, Vec Q, PetscViewerAndFormat *ctx);
36016cb6b6bSJames Wright 
36116cb6b6bSJames Wright PetscErrorCode KSPPostSolve_Honee(KSP ksp, Vec rhs, Vec x, void *ctx);
362