xref: /honee/qfunctions/advection_types.h (revision 1afd361ba125de14b5ab47c664e0392a795d8276) !
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 extern const char *const AdvDifWindTypes[];
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 extern const char *const AdvDifICTypes[];
31 #endif
32 
33 // Advection-Diffusion wave types
34 typedef enum {
35   ADVDIF_WAVE_SINE   = 0,
36   ADVDIF_WAVE_SQUARE = 1,
37 } AdvDifWaveType;
38 #ifndef CEED_RUNNING_JIT_PASS
39 extern const char *const AdvDifWaveTypes[];
40 #endif
41 
42 // Advection - Bubble Continuity Types
43 typedef enum {
44   ADVDIF_BUBBLE_CONTINUITY_SMOOTH     = 0,  // Original continuous, smooth shape
45   ADVDIF_BUBBLE_CONTINUITY_BACK_SHARP = 1,  // Discontinuous, sharp back half shape
46   ADVDIF_BUBBLE_CONTINUITY_THICK      = 2,  // Define a finite thickness
47   ADVDIF_BUBBLE_CONTINUITY_COSINE     = 3,  // Use cosine wave for smoothing
48 } AdvDifBubbleContinuityType;
49 #ifndef CEED_RUNNING_JIT_PASS
50 extern const char *const AdvDifBubbleContinuityTypes[];
51 #endif
52 
53 typedef struct AdvectionContext_ *AdvectionContext;
54 struct AdvectionContext_ {
55   bool       strong_form;
56   CeedScalar E_wind;
57   bool       implicit;
58   CeedScalar dt;
59   CeedScalar diffusion_coeff;
60 
61   StabilizationType           stabilization;
62   StabilizationTauType        stabilization_tau;
63   CeedScalar                  CtauS;
64   CeedScalar                  Ctau_a, Ctau_d, Ctau_t;
65   DivDiffFluxProjectionMethod divFdiff_method;
66 };
67 
68 typedef struct SetupContextAdv_ *SetupContextAdv;
69 struct SetupContextAdv_ {
70   CeedScalar rc;
71   CeedScalar lx;
72   CeedScalar ly;
73   CeedScalar lz;
74   CeedScalar wind[3];
75   CeedScalar time;
76   CeedScalar wave_frequency, wave_phase;
77   CeedScalar bl_height_factor;  // !< height of boundary layer IC relative to domain height
78 
79   AdvDifWaveType             wave_type;
80   AdvDifWindType             wind_type;
81   AdvDifICType               initial_condition_type;
82   AdvDifBubbleContinuityType bubble_continuity_type;
83 };
84