xref: /honee/qfunctions/advection_types.h (revision 1c94e285dc30dc3bd7c84a205133ffbf79631595)
1 // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2 // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3 #pragma once
4 
5 #include <ceed/types.h>
6 #ifndef CEED_RUNNING_JIT_PASS
7 #include <stdbool.h>
8 #endif
9 #include "stabilization_types.h"
10 
11 typedef enum {
12   ADVDIF_WIND_ROTATION       = 0,
13   ADVDIF_WIND_TRANSLATION    = 1,
14   ADVDIF_WIND_BOUNDARY_LAYER = 2,
15 } AdvDifWindType;
16 #ifndef CEED_RUNNING_JIT_PASS
17 static const char *const AdvDifWindTypes[] = {"ROTATION", "TRANSLATION", "BOUNDARY_LAYER", "WindType", "ADVDIF_WIND_", NULL};
18 #endif
19 
20 // Advection - Initial Condition Types
21 typedef enum {
22   ADVDIF_IC_BUBBLE_SPHERE   = 0,  // dim=3
23   ADVDIF_IC_BUBBLE_CYLINDER = 1,  // dim=2
24   ADVDIF_IC_COSINE_HILL     = 2,  // dim=2
25   ADVDIF_IC_SKEW            = 3,
26   ADVDIF_IC_WAVE            = 4,
27   ADVDIF_IC_BOUNDARY_LAYER  = 5,
28 } AdvDifICType;
29 #ifndef CEED_RUNNING_JIT_PASS
30 static const char *const AdvDifICTypes[] = {"SPHERE",         "CYLINDER",        "COSINE_HILL", "SKEW", "WAVE",
31                                             "BOUNDARY_LAYER", "AdvectionICType", "ADVDIF_IC_",  NULL};
32 #endif
33 
34 // Advection-Diffusion wave types
35 typedef enum {
36   ADVDIF_WAVE_SINE   = 0,
37   ADVDIF_WAVE_SQUARE = 1,
38 } AdvDifWaveType;
39 #ifndef CEED_RUNNING_JIT_PASS
40 static const char *const AdvDifWaveTypes[] = {"SINE", "SQUARE", "AdvDifWaveType", "ADVDIF_WAVE_", NULL};
41 #endif
42 
43 // Advection - Bubble Continuity Types
44 typedef enum {
45   ADVDIF_BUBBLE_CONTINUITY_SMOOTH     = 0,  // Original continuous, smooth shape
46   ADVDIF_BUBBLE_CONTINUITY_BACK_SHARP = 1,  // Discontinuous, sharp back half shape
47   ADVDIF_BUBBLE_CONTINUITY_THICK      = 2,  // Define a finite thickness
48   ADVDIF_BUBBLE_CONTINUITY_COSINE     = 3,  // Use cosine wave for smoothing
49 } AdvDifBubbleContinuityType;
50 #ifndef CEED_RUNNING_JIT_PASS
51 static const char *const AdvDifBubbleContinuityTypes[] = {
52     "SMOOTH", "BACK_SHARP", "THICK", "COSINE", "BubbleContinuityType", "ADVDIF_BUBBLE_CONTINUITY_", NULL};
53 #endif
54 
55 typedef struct AdvectionContext_ *AdvectionContext;
56 struct AdvectionContext_ {
57   bool       strong_form;
58   CeedScalar E_wind;
59   bool       implicit;
60   CeedScalar dt;
61   CeedScalar diffusion_coeff;
62 
63   StabilizationType           stabilization;
64   StabilizationTauType        stabilization_tau;
65   CeedScalar                  CtauS;
66   CeedScalar                  Ctau_a, Ctau_d, Ctau_t;
67   DivDiffFluxProjectionMethod divFdiff_method;
68 };
69 
70 typedef struct SetupContextAdv_ *SetupContextAdv;
71 struct SetupContextAdv_ {
72   CeedScalar rc;
73   CeedScalar lx;
74   CeedScalar ly;
75   CeedScalar lz;
76   CeedScalar wind[3];
77   CeedScalar time;
78   CeedScalar wave_frequency, wave_phase;
79   CeedScalar bl_height_factor;  // !< height of boundary layer IC relative to domain height
80 
81   AdvDifWaveType             wave_type;
82   AdvDifWindType             wind_type;
83   AdvDifICType               initial_condition_type;
84   AdvDifBubbleContinuityType bubble_continuity_type;
85 };
86