xref: /libCEED/examples/fluids/navierstokes.h (revision d9d458ca0068c42852e6ec94b15c2eda42be5067)
1 // Copyright (c) 2017-2022, 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 #ifndef libceed_fluids_examples_navier_stokes_h
9 #define libceed_fluids_examples_navier_stokes_h
10 
11 #include <ceed.h>
12 #include <petscts.h>
13 #include <stdbool.h>
14 
15 #include "./include/petsc_ops.h"
16 #include "qfunctions/newtonian_types.h"
17 #include "qfunctions/stabilization_types.h"
18 
19 #if PETSC_VERSION_LT(3, 20, 0)
20 #error "PETSc v3.20 or later is required"
21 #endif
22 
23 #if PETSC_VERSION_LT(3, 21, 0)
24 #define DMSetCoordinateDisc(a, b, c) DMProjectCoordinates(a, b)
25 #endif
26 
27 #define PetscCallCeed(ceed, ...)                                    \
28   do {                                                              \
29     int ierr = __VA_ARGS__;                                         \
30     if (ierr != CEED_ERROR_SUCCESS) {                               \
31       const char *error_message;                                    \
32       CeedGetErrorMessage(ceed, &error_message);                    \
33       SETERRQ(PETSC_COMM_SELF, PETSC_ERR_LIB, "%s", error_message); \
34     }                                                               \
35   } while (0)
36 
37 // -----------------------------------------------------------------------------
38 // Enums
39 // -----------------------------------------------------------------------------
40 // Translate PetscMemType to CeedMemType
41 static inline CeedMemType MemTypeP2C(PetscMemType mem_type) { return PetscMemTypeDevice(mem_type) ? CEED_MEM_DEVICE : CEED_MEM_HOST; }
42 
43 // Euler - test cases
44 typedef enum {
45   EULER_TEST_ISENTROPIC_VORTEX = 0,
46   EULER_TEST_1                 = 1,
47   EULER_TEST_2                 = 2,
48   EULER_TEST_3                 = 3,
49   EULER_TEST_4                 = 4,
50   EULER_TEST_5                 = 5,
51 } EulerTestType;
52 static const char *const EulerTestTypes[] = {"isentropic_vortex", "test_1",      "test_2", "test_3", "test_4", "test_5",
53                                              "EulerTestType",     "EULER_TEST_", NULL};
54 
55 // Advection - Wind types
56 static const char *const WindTypes[] = {"rotation", "translation", "WindType", "WIND_", NULL};
57 
58 // Advection - Bubble Types
59 static const char *const BubbleTypes[] = {"sphere", "cylinder", "BubbleType", "BUBBLE_", NULL};
60 
61 // Advection - Bubble Continuity Types
62 static const char *const BubbleContinuityTypes[] = {"smooth", "back_sharp", "thick", "BubbleContinuityType", "BUBBLE_CONTINUITY_", NULL};
63 
64 // Stabilization methods
65 static const char *const StabilizationTypes[] = {"none", "SU", "SUPG", "StabilizationType", "STAB_", NULL};
66 
67 // Test mode type
68 typedef enum {
69   TESTTYPE_NONE           = 0,
70   TESTTYPE_SOLVER         = 1,
71   TESTTYPE_TURB_SPANSTATS = 2,
72   TESTTYPE_DIFF_FILTER    = 3,
73 } TestType;
74 static const char *const TestTypes[] = {"none", "solver", "turb_spanstats", "diff_filter", "TestType", "TESTTYPE_", NULL};
75 
76 // Subgrid-Stress mode type
77 typedef enum {
78   SGS_MODEL_NONE        = 0,
79   SGS_MODEL_DATA_DRIVEN = 1,
80 } SGSModelType;
81 static const char *const SGSModelTypes[] = {"none", "data_driven", "SGSModelType", "SGS_MODEL_", NULL};
82 
83 // Mesh transformation type
84 typedef enum {
85   MESH_TRANSFORM_NONE      = 0,
86   MESH_TRANSFORM_PLATEMESH = 1,
87 } MeshTransformType;
88 static const char *const MeshTransformTypes[] = {"none", "platemesh", "MeshTransformType", "MESH_TRANSFORM_", NULL};
89 
90 static const char *const DifferentialFilterDampingFunctions[] = {
91     "none", "van_driest", "mms", "DifferentialFilterDampingFunction", "DIFF_FILTER_DAMP_", NULL};
92 
93 // -----------------------------------------------------------------------------
94 // Log Events
95 // -----------------------------------------------------------------------------
96 extern PetscLogEvent FLUIDS_CeedOperatorApply;
97 extern PetscLogEvent FLUIDS_CeedOperatorAssemble;
98 extern PetscLogEvent FLUIDS_CeedOperatorAssembleDiagonal;
99 extern PetscLogEvent FLUIDS_CeedOperatorAssemblePointBlockDiagonal;
100 PetscErrorCode       RegisterLogEvents();
101 
102 // -----------------------------------------------------------------------------
103 // Structs
104 // -----------------------------------------------------------------------------
105 // Structs declarations
106 typedef struct AppCtx_private   *AppCtx;
107 typedef struct CeedData_private *CeedData;
108 typedef struct User_private     *User;
109 typedef struct Units_private    *Units;
110 typedef struct SimpleBC_private *SimpleBC;
111 typedef struct Physics_private  *Physics;
112 
113 // Application context from user command line options
114 struct AppCtx_private {
115   // libCEED arguments
116   char     ceed_resource[PETSC_MAX_PATH_LEN];  // libCEED backend
117   PetscInt degree;
118   PetscInt q_extra;
119   // Solver arguments
120   MatType   amat_type;
121   PetscBool pmat_pbdiagonal;
122   // Post-processing arguments
123   PetscInt  checkpoint_interval;
124   PetscInt  viz_refine;
125   PetscInt  cont_steps;
126   PetscReal cont_time;
127   char      cont_file[PETSC_MAX_PATH_LEN];
128   char      cont_time_file[PETSC_MAX_PATH_LEN];
129   char      output_dir[PETSC_MAX_PATH_LEN];
130   PetscBool add_stepnum2bin;
131   PetscBool checkpoint_vtk;
132   // Problem type arguments
133   PetscFunctionList problems;
134   char              problem_name[PETSC_MAX_PATH_LEN];
135   // Test mode arguments
136   TestType    test_type;
137   PetscScalar test_tol;
138   char        test_file_path[PETSC_MAX_PATH_LEN];
139   // Turbulent spanwise statistics
140   PetscBool         turb_spanstats_enable;
141   PetscInt          turb_spanstats_collect_interval;
142   PetscInt          turb_spanstats_viewer_interval;
143   PetscViewer       turb_spanstats_viewer;
144   PetscViewerFormat turb_spanstats_viewer_format;
145   // Wall forces
146   struct {
147     PetscInt          num_wall;
148     PetscInt         *walls;
149     PetscViewer       viewer;
150     PetscViewerFormat viewer_format;
151     PetscBool         header_written;
152   } wall_forces;
153   // Subgrid Stress Model
154   SGSModelType sgs_model_type;
155   // Differential Filtering
156   PetscBool         diff_filter_monitor;
157   MeshTransformType mesh_transform_type;
158 };
159 
160 // libCEED data struct
161 struct CeedData_private {
162   CeedVector           x_coord, q_data;
163   CeedBasis            basis_x, basis_xc, basis_q, basis_x_sur, basis_q_sur, basis_xc_sur;
164   CeedElemRestriction  elem_restr_x, elem_restr_q, elem_restr_qd_i;
165   CeedOperator         op_setup_vol;
166   OperatorApplyContext op_ics_ctx;
167   CeedQFunction        qf_setup_vol, qf_ics, qf_rhs_vol, qf_ifunction_vol, qf_setup_sur, qf_apply_inflow, qf_apply_inflow_jacobian, qf_apply_outflow,
168       qf_apply_outflow_jacobian, qf_apply_freestream, qf_apply_freestream_jacobian;
169 };
170 
171 typedef struct {
172   DM                    dm;
173   PetscSF               sf;  // For communicating child data to parents
174   OperatorApplyContext  op_stats_collect_ctx, op_proj_rhs_ctx;
175   PetscInt              num_comp_stats;
176   Vec                   Child_Stats_loc, Parent_Stats_loc;
177   KSP                   ksp;         // For the L^2 projection solve
178   CeedScalar            span_width;  // spanwise width of the child domain
179   PetscBool             do_mms_test;
180   OperatorApplyContext  mms_error_ctx;
181   CeedContextFieldLabel solution_time_label, previous_time_label;
182 } SpanStatsData;
183 
184 typedef struct {
185   DM                   dm;
186   PetscInt             num_comp;
187   OperatorApplyContext l2_rhs_ctx;
188   KSP                  ksp;
189 } *NodalProjectionData;
190 
191 typedef struct {
192   DM                   dm_sgs;
193   PetscInt             num_comp_sgs;
194   OperatorApplyContext op_nodal_evaluation_ctx, op_sgs_apply_ctx;
195   CeedVector           sgs_nodal_ceed;
196 } *SgsDDData;
197 
198 typedef struct {
199   DM                   dm_filter;
200   PetscInt             num_filtered_fields;
201   CeedInt             *num_field_components;
202   OperatorApplyContext op_rhs_ctx;
203   KSP                  ksp;
204   PetscBool            do_mms_test;
205 } *DiffFilterData;
206 
207 // PETSc user data
208 struct User_private {
209   MPI_Comm             comm;
210   DM                   dm;
211   DM                   dm_viz;
212   Mat                  interp_viz;
213   Ceed                 ceed;
214   Units                units;
215   Vec                  M_inv, Q_loc, Q_dot_loc;
216   Physics              phys;
217   AppCtx               app_ctx;
218   CeedVector           q_ceed, q_dot_ceed, g_ceed, coo_values_amat, coo_values_pmat, x_ceed;
219   CeedOperator         op_rhs_vol, op_ifunction_vol, op_ifunction, op_ijacobian;
220   OperatorApplyContext op_rhs_ctx, op_strong_bc_ctx;
221   bool                 matrices_set_up;
222   CeedScalar           time_bc_set;
223   SpanStatsData        spanstats;
224   NodalProjectionData  grad_velo_proj;
225   SgsDDData            sgs_dd_data;
226   DiffFilterData       diff_filter;
227 };
228 
229 // Units
230 struct Units_private {
231   // fundamental units
232   PetscScalar meter;
233   PetscScalar kilogram;
234   PetscScalar second;
235   PetscScalar Kelvin;
236   // derived units
237   PetscScalar Pascal;
238   PetscScalar J_per_kg_K;
239   PetscScalar m_per_squared_s;
240   PetscScalar W_per_m_K;
241   PetscScalar Joule;
242 };
243 
244 // Boundary conditions
245 struct SimpleBC_private {
246   PetscInt num_wall,  // Number of faces with wall BCs
247       wall_comps[5],  // An array of constrained component numbers
248       num_comps,
249       num_slip[3],  // Number of faces with slip BCs
250       num_inflow, num_outflow, num_freestream;
251   PetscInt  walls[16], slips[3][16], inflows[16], outflows[16], freestreams[16];
252   PetscBool user_bc;
253 };
254 
255 // Struct that contains all enums and structs used for the physics of all problems
256 struct Physics_private {
257   PetscBool             implicit;
258   StateVariable         state_var;
259   CeedContextFieldLabel solution_time_label;
260   CeedContextFieldLabel stg_solution_time_label;
261   CeedContextFieldLabel timestep_size_label;
262   CeedContextFieldLabel ics_time_label;
263   CeedContextFieldLabel ijacobian_time_shift_label;
264 };
265 
266 typedef struct {
267   CeedQFunctionUser    qfunction;
268   const char          *qfunction_loc;
269   CeedQFunctionContext qfunction_context;
270 } ProblemQFunctionSpec;
271 
272 // Problem specific data
273 typedef struct ProblemData_private ProblemData;
274 struct ProblemData_private {
275   CeedInt              dim, q_data_size_vol, q_data_size_sur, jac_data_size_sur;
276   CeedScalar           dm_scale;
277   ProblemQFunctionSpec setup_vol, setup_sur, ics, apply_vol_rhs, apply_vol_ifunction, apply_vol_ijacobian, apply_inflow, apply_outflow,
278       apply_freestream, apply_inflow_jacobian, apply_outflow_jacobian, apply_freestream_jacobian;
279   bool      non_zero_time;
280   PetscBool bc_from_ics, use_strong_bc_ceed;
281   PetscErrorCode (*print_info)(User, ProblemData *, AppCtx);
282 };
283 
284 extern int FreeContextPetsc(void *);
285 
286 // -----------------------------------------------------------------------------
287 // Set up problems
288 // -----------------------------------------------------------------------------
289 // Set up function for each problem
290 extern PetscErrorCode NS_TAYLOR_GREEN(ProblemData *problem, DM dm, void *ctx, SimpleBC bc);
291 extern PetscErrorCode NS_GAUSSIAN_WAVE(ProblemData *problem, DM dm, void *ctx, SimpleBC bc);
292 extern PetscErrorCode NS_CHANNEL(ProblemData *problem, DM dm, void *ctx, SimpleBC bc);
293 extern PetscErrorCode NS_BLASIUS(ProblemData *problem, DM dm, void *ctx, SimpleBC bc);
294 extern PetscErrorCode NS_NEWTONIAN_IG(ProblemData *problem, DM dm, void *ctx, SimpleBC bc);
295 extern PetscErrorCode NS_DENSITY_CURRENT(ProblemData *problem, DM dm, void *ctx, SimpleBC bc);
296 extern PetscErrorCode NS_EULER_VORTEX(ProblemData *problem, DM dm, void *ctx, SimpleBC bc);
297 extern PetscErrorCode NS_SHOCKTUBE(ProblemData *problem, DM dm, void *ctx, SimpleBC bc);
298 extern PetscErrorCode NS_ADVECTION(ProblemData *problem, DM dm, void *ctx, SimpleBC bc);
299 extern PetscErrorCode NS_ADVECTION2D(ProblemData *problem, DM dm, void *ctx, SimpleBC bc);
300 
301 // Print function for each problem
302 extern PetscErrorCode PRINT_NEWTONIAN(User user, ProblemData *problem, AppCtx app_ctx);
303 
304 extern PetscErrorCode PRINT_EULER_VORTEX(User user, ProblemData *problem, AppCtx app_ctx);
305 
306 extern PetscErrorCode PRINT_SHOCKTUBE(User user, ProblemData *problem, AppCtx app_ctx);
307 
308 extern PetscErrorCode PRINT_ADVECTION(User user, ProblemData *problem, AppCtx app_ctx);
309 
310 extern PetscErrorCode PRINT_ADVECTION2D(User user, ProblemData *problem, AppCtx app_ctx);
311 
312 PetscErrorCode PrintRunInfo(User user, Physics phys_ctx, ProblemData *problem, MPI_Comm comm);
313 
314 // -----------------------------------------------------------------------------
315 // libCEED functions
316 // -----------------------------------------------------------------------------
317 // Utility function to create local CEED restriction
318 PetscErrorCode CreateRestrictionFromPlex(Ceed ceed, DM dm, CeedInt height, DMLabel domain_label, CeedInt label_value, PetscInt dm_field,
319                                          CeedElemRestriction *elem_restr);
320 
321 PetscErrorCode DMPlexCeedElemRestrictionCreate(Ceed ceed, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height, PetscInt dm_field,
322                                                CeedElemRestriction *restriction);
323 PetscErrorCode DMPlexCeedElemRestrictionCoordinateCreate(Ceed ceed, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height,
324                                                          CeedElemRestriction *restriction);
325 PetscErrorCode DMPlexCeedElemRestrictionQDataCreate(Ceed ceed, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height,
326                                                     PetscInt q_data_size, CeedElemRestriction *restriction);
327 PetscErrorCode DMPlexCeedElemRestrictionCollocatedCreate(Ceed ceed, DM dm, DMLabel domain_label, PetscInt label_value, PetscInt height,
328                                                          PetscInt q_data_size, CeedElemRestriction *restriction);
329 
330 PetscErrorCode CreateBasisFromPlex(Ceed ceed, DM dm, DMLabel domain_label, CeedInt label_value, CeedInt height, CeedInt dm_field, CeedBasis *basis);
331 
332 // Utility function to create CEED Composite Operator for the entire domain
333 PetscErrorCode CreateOperatorForDomain(Ceed ceed, DM dm, SimpleBC bc, CeedData ceed_data, Physics phys, CeedOperator op_apply_vol,
334                                        CeedOperator op_apply_ijacobian_vol, CeedInt height, CeedInt P_sur, CeedInt Q_sur, CeedInt q_data_size_sur,
335                                        CeedInt jac_data_size_sur, CeedOperator *op_apply, CeedOperator *op_apply_ijacobian);
336 
337 PetscErrorCode SetupLibceed(Ceed ceed, CeedData ceed_data, DM dm, User user, AppCtx app_ctx, ProblemData *problem, SimpleBC bc);
338 
339 // -----------------------------------------------------------------------------
340 // Time-stepping functions
341 // -----------------------------------------------------------------------------
342 // Compute mass matrix for explicit scheme
343 PetscErrorCode ComputeLumpedMassMatrix(Ceed ceed, DM dm, CeedData ceed_data, Vec M);
344 
345 // RHS (Explicit time-stepper) function setup
346 PetscErrorCode RHS_NS(TS ts, PetscReal t, Vec Q, Vec G, void *user_data);
347 
348 // Implicit time-stepper function setup
349 PetscErrorCode IFunction_NS(TS ts, PetscReal t, Vec Q, Vec Q_dot, Vec G, void *user_data);
350 
351 // User provided TS Monitor
352 PetscErrorCode TSMonitor_NS(TS ts, PetscInt step_no, PetscReal time, Vec Q, void *ctx);
353 
354 // TS: Create, setup, and solve
355 PetscErrorCode TSSolve_NS(DM dm, User user, AppCtx app_ctx, Physics phys, Vec *Q, PetscScalar *f_time, TS *ts);
356 
357 // Update Boundary Values when time has changed
358 PetscErrorCode UpdateBoundaryValues(User user, Vec Q_loc, PetscReal t);
359 
360 // -----------------------------------------------------------------------------
361 // Setup DM
362 // -----------------------------------------------------------------------------
363 // Create mesh
364 PetscErrorCode CreateDM(MPI_Comm comm, ProblemData *problem, MatType, VecType, DM *dm);
365 
366 // Set up DM
367 PetscErrorCode SetUpDM(DM dm, ProblemData *problem, PetscInt degree, PetscInt q_extra, SimpleBC bc, Physics phys);
368 PetscErrorCode DMSetupByOrderBegin_FEM(PetscBool setup_faces, PetscBool setup_coords, PetscInt degree, PetscInt coord_order, PetscInt q_extra,
369                                        PetscInt num_fields, const PetscInt *field_sizes, DM dm);
370 PetscErrorCode DMSetupByOrderEnd_FEM(PetscBool setup_coords, DM dm);
371 PetscErrorCode DMSetupByOrder_FEM(PetscBool setup_faces, PetscBool setup_coords, PetscInt degree, PetscInt coord_order, PetscInt q_extra,
372                                   PetscInt num_fields, const PetscInt *field_sizes, DM dm);
373 
374 // Refine DM for high-order viz
375 PetscErrorCode VizRefineDM(DM dm, User user, ProblemData *problem, SimpleBC bc, Physics phys);
376 
377 // -----------------------------------------------------------------------------
378 // Process command line options
379 // -----------------------------------------------------------------------------
380 // Register problems to be available on the command line
381 PetscErrorCode RegisterProblems_NS(AppCtx app_ctx);
382 
383 // Process general command line options
384 PetscErrorCode ProcessCommandLineOptions(MPI_Comm comm, AppCtx app_ctx, SimpleBC bc);
385 
386 // -----------------------------------------------------------------------------
387 // Miscellaneous utility functions
388 // -----------------------------------------------------------------------------
389 PetscErrorCode ICs_FixMultiplicity(DM dm, CeedData ceed_data, User user, Vec Q_loc, Vec Q, CeedScalar time);
390 
391 PetscErrorCode DMPlexInsertBoundaryValues_FromICs(DM dm, PetscBool insert_essential, Vec Q_loc, PetscReal time, Vec face_geom_FVM, Vec cell_geom_FVM,
392                                                   Vec grad_FVM);
393 
394 // Compare reference solution values with current test run for CI
395 PetscErrorCode RegressionTest(AppCtx app_ctx, Vec Q);
396 
397 // Get error for problems with exact solutions
398 PetscErrorCode PrintError(CeedData ceed_data, DM dm, User user, Vec Q, PetscScalar final_time);
399 
400 // Post-processing
401 PetscErrorCode PostProcess(TS ts, CeedData ceed_data, DM dm, ProblemData *problem, User user, Vec Q, PetscScalar final_time);
402 
403 // -- Gather initial Q values in case of continuation of simulation
404 PetscErrorCode SetupICsFromBinary(MPI_Comm comm, AppCtx app_ctx, Vec Q);
405 
406 // Record boundary values from initial condition
407 PetscErrorCode SetBCsFromICs(DM dm, Vec Q, Vec Q_loc);
408 
409 // Versioning token for binary checkpoints
410 extern const PetscInt32 FLUIDS_FILE_TOKEN;  // for backwards compatibility
411 extern const PetscInt32 FLUIDS_FILE_TOKEN_32;
412 extern const PetscInt32 FLUIDS_FILE_TOKEN_64;
413 
414 // Create appropriate mass qfunction based on number of components N
415 PetscErrorCode CreateMassQFunction(Ceed ceed, CeedInt N, CeedInt q_data_size, CeedQFunction *qf);
416 
417 PetscErrorCode NodalProjectionDataDestroy(NodalProjectionData context);
418 
419 PetscErrorCode PhastaDatFileOpen(const MPI_Comm comm, const char path[PETSC_MAX_PATH_LEN], const PetscInt char_array_len, PetscInt dims[2],
420                                  FILE **fp);
421 
422 PetscErrorCode PhastaDatFileGetNRows(const MPI_Comm comm, const char path[PETSC_MAX_PATH_LEN], PetscInt *nrows);
423 
424 PetscErrorCode PhastaDatFileReadToArrayReal(const MPI_Comm comm, const char path[PETSC_MAX_PATH_LEN], PetscReal array[]);
425 
426 PetscErrorCode IntArrayC2P(PetscInt num_entries, CeedInt **array_ceed, PetscInt **array_petsc);
427 PetscErrorCode IntArrayP2C(PetscInt num_entries, PetscInt **array_petsc, CeedInt **array_ceed);
428 
429 // -----------------------------------------------------------------------------
430 // Turbulence Statistics Collection Functions
431 // -----------------------------------------------------------------------------
432 
433 PetscErrorCode TurbulenceStatisticsSetup(Ceed ceed, User user, CeedData ceed_data, ProblemData *problem);
434 PetscErrorCode TSMonitor_TurbulenceStatistics(TS ts, PetscInt steps, PetscReal solution_time, Vec Q, void *ctx);
435 PetscErrorCode TurbulenceStatisticsDestroy(User user, CeedData ceed_data);
436 
437 // -----------------------------------------------------------------------------
438 // Data-Driven Subgrid Stress (DD-SGS) Modeling Functions
439 // -----------------------------------------------------------------------------
440 
441 PetscErrorCode SgsDDModelSetup(Ceed ceed, User user, CeedData ceed_data, ProblemData *problem);
442 PetscErrorCode SgsDDDataDestroy(SgsDDData sgs_dd_data);
443 PetscErrorCode SgsDDModelApplyIFunction(User user, const Vec Q_loc, Vec G_loc);
444 PetscErrorCode VelocityGradientProjectionSetup(Ceed ceed, User user, CeedData ceed_data, ProblemData *problem);
445 PetscErrorCode VelocityGradientProjectionApply(User user, Vec Q_loc, Vec VelocityGradient);
446 PetscErrorCode GridAnisotropyTensorProjectionSetupApply(Ceed ceed, User user, CeedData ceed_data, CeedElemRestriction *elem_restr_grid_aniso,
447                                                         CeedVector *grid_aniso_vector);
448 PetscErrorCode GridAnisotropyTensorCalculateCollocatedVector(Ceed ceed, User user, CeedData ceed_data, CeedElemRestriction *elem_restr_grid_aniso,
449                                                              CeedVector *aniso_colloc_ceed, PetscInt *num_comp_aniso);
450 
451 // -----------------------------------------------------------------------------
452 // Boundary Condition Related Functions
453 // -----------------------------------------------------------------------------
454 
455 // Setup StrongBCs that use QFunctions
456 PetscErrorCode SetupStrongBC_Ceed(Ceed ceed, CeedData ceed_data, DM dm, User user, ProblemData *problem, SimpleBC bc);
457 
458 PetscErrorCode FreestreamBCSetup(ProblemData *problem, DM dm, void *ctx, NewtonianIdealGasContext newtonian_ig_ctx, const StatePrimitive *reference);
459 PetscErrorCode OutflowBCSetup(ProblemData *problem, DM dm, void *ctx, NewtonianIdealGasContext newtonian_ig_ctx, const StatePrimitive *reference);
460 
461 // -----------------------------------------------------------------------------
462 // Differential Filtering Functions
463 // -----------------------------------------------------------------------------
464 
465 PetscErrorCode DifferentialFilterSetup(Ceed ceed, User user, CeedData ceed_data, ProblemData *problem);
466 PetscErrorCode DifferentialFilterDataDestroy(DiffFilterData diff_filter);
467 PetscErrorCode TSMonitor_DifferentialFilter(TS ts, PetscInt steps, PetscReal solution_time, Vec Q, void *ctx);
468 PetscErrorCode DifferentialFilterApply(User user, const PetscReal solution_time, const Vec Q, Vec Filtered_Solution);
469 PetscErrorCode DifferentialFilterMmsICSetup(ProblemData *problem);
470 
471 #endif  // libceed_fluids_examples_navier_stokes_h
472