xref: /honee/qfunctions/sgs_dd_model.h (revision db5881958b1b18971f4c89872c6477a48dce6e7a)
162b7942eSJames Wright // Copyright (c) 2017-2023, Lawrence Livermore National Security, LLC and other CEED contributors.
262b7942eSJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
362b7942eSJames Wright //
462b7942eSJames Wright // SPDX-License-Identifier: BSD-2-Clause
562b7942eSJames Wright //
662b7942eSJames Wright // This file is part of CEED:  http://github.com/ceed
762b7942eSJames Wright 
862b7942eSJames Wright /// @file
962b7942eSJames Wright /// Structs and helper functions for data-driven subgrid-stress modeling
103fc405b4SJames Wright /// See 'Invariant data-driven subgrid stress modeling in the strain-rate eigenframe for large eddy simulation' 2022 and 'S-frame discrepancy
113fc405b4SJames Wright /// correction models for data-informed Reynolds stress closure' 2022
1262b7942eSJames Wright 
1362b7942eSJames Wright #ifndef sgs_dd_model_h
1462b7942eSJames Wright #define sgs_dd_model_h
1562b7942eSJames Wright 
1662b7942eSJames Wright #include <ceed.h>
1762b7942eSJames Wright 
183fc405b4SJames Wright #include "newtonian_state.h"
199c678832SJames Wright #include "newtonian_types.h"
203fc405b4SJames Wright #include "utils.h"
213fc405b4SJames Wright #include "utils_eigensolver_jacobi.h"
223fc405b4SJames Wright 
2362b7942eSJames Wright typedef struct SGS_DD_ModelContext_ *SGS_DDModelContext;
2462b7942eSJames Wright struct SGS_DD_ModelContext_ {
2562b7942eSJames Wright   CeedInt    num_inputs, num_outputs;
2662b7942eSJames Wright   CeedInt    num_layers;
2762b7942eSJames Wright   CeedInt    num_neurons;
2862b7942eSJames Wright   CeedScalar alpha;
2962b7942eSJames Wright 
30ee1455b7SJames Wright   struct NewtonianIdealGasContext_ gas;
3162b7942eSJames Wright   struct {
3262b7942eSJames Wright     size_t bias1, bias2;
3362b7942eSJames Wright     size_t weight1, weight2;
3462b7942eSJames Wright     size_t out_scaling;
3562b7942eSJames Wright   } offsets;
3662b7942eSJames Wright   size_t     total_bytes;
3762b7942eSJames Wright   CeedScalar data[1];
3862b7942eSJames Wright };
3962b7942eSJames Wright 
403fc405b4SJames Wright // @brief Calculate the inverse of the multiplicity, reducing to a single component
413fc405b4SJames Wright CEED_QFUNCTION(InverseMultiplicity)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
423fc405b4SJames Wright   const CeedScalar(*multiplicity)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0];
433fc405b4SJames Wright   CeedScalar(*inv_multiplicity)               = (CeedScalar(*))out[0];
443fc405b4SJames Wright 
453fc405b4SJames Wright   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) inv_multiplicity[i] = 1.0 / multiplicity[0][i];
463fc405b4SJames Wright   return 0;
473fc405b4SJames Wright }
483fc405b4SJames Wright 
493fc405b4SJames Wright // @brief Calculate Frobenius norm of velocity gradient from eigenframe quantities
503fc405b4SJames Wright CEED_QFUNCTION_HELPER CeedScalar VelocityGradientMagnitude(const CeedScalar strain_sframe[3], const CeedScalar vorticity_sframe[3]) {
513fc405b4SJames Wright   return sqrt(Dot3(strain_sframe, strain_sframe) + 0.5 * Dot3(vorticity_sframe, vorticity_sframe));
523fc405b4SJames Wright };
533fc405b4SJames Wright 
543fc405b4SJames Wright // @brief Denormalize outputs using min-max (de-)normalization
55fb293263SJames Wright CEED_QFUNCTION_HELPER void DenormalizeDDOutputs(CeedScalar output[6], const CeedScalar (*new_bounds)[2], const CeedScalar old_bounds[6][2]) {
563fc405b4SJames Wright   CeedScalar bounds_ratio;
573fc405b4SJames Wright   for (int i = 0; i < 6; i++) {
583fc405b4SJames Wright     bounds_ratio = (new_bounds[i][1] - new_bounds[i][0]) / (old_bounds[i][1] - old_bounds[i][0]);
593fc405b4SJames Wright     output[i]    = bounds_ratio * (output[i] - old_bounds[i][1]) + new_bounds[i][1];
603fc405b4SJames Wright   }
613fc405b4SJames Wright }
623fc405b4SJames Wright 
633fc405b4SJames Wright // @brief Change the order of basis vectors so that they align with vector and obey right-hand rule
643fc405b4SJames Wright // @details The e_1 and e_3 basis vectors are the closest aligned to the vector. The e_2 is set via  e_3 x e_1
653fc405b4SJames Wright // The basis vectors are assumed to form the rows of the basis matrix.
663fc405b4SJames Wright CEED_QFUNCTION_HELPER void OrientBasisWithVector(CeedScalar basis[3][3], const CeedScalar vector[3]) {
673fc405b4SJames Wright   CeedScalar alignment[3] = {0.}, cross[3];
683fc405b4SJames Wright 
693fc405b4SJames Wright   MatVec3(basis, vector, CEED_NOTRANSPOSE, alignment);
703fc405b4SJames Wright 
713fc405b4SJames Wright   if (alignment[0] < 0) ScaleN(basis[0], -1, 3);
723fc405b4SJames Wright   if (alignment[2] < 0) ScaleN(basis[2], -1, 3);
733fc405b4SJames Wright 
743fc405b4SJames Wright   Cross3(basis[2], basis[0], cross);
753fc405b4SJames Wright   CeedScalar basis_1_orientation = Dot3(cross, basis[1]);
763fc405b4SJames Wright   if (basis_1_orientation < 0) ScaleN(basis[1], -1, 3);
773fc405b4SJames Wright }
783fc405b4SJames Wright 
793fc405b4SJames Wright CEED_QFUNCTION_HELPER void LeakyReLU(CeedScalar *x, const CeedScalar alpha, const CeedInt N) {
803fc405b4SJames Wright   for (CeedInt i = 0; i < N; i++) x[i] *= (x[i] < 0 ? alpha : 1.);
813fc405b4SJames Wright }
823fc405b4SJames Wright 
833fc405b4SJames Wright CEED_QFUNCTION_HELPER void DataDrivenInference(const CeedScalar *inputs, CeedScalar *outputs, SGS_DDModelContext sgsdd_ctx) {
843fc405b4SJames Wright   const CeedInt     num_neurons = sgsdd_ctx->num_neurons;
853fc405b4SJames Wright   const CeedInt     num_inputs  = sgsdd_ctx->num_inputs;
863fc405b4SJames Wright   const CeedInt     num_outputs = sgsdd_ctx->num_outputs;
873fc405b4SJames Wright   const CeedScalar  alpha       = sgsdd_ctx->alpha;
883fc405b4SJames Wright   const CeedScalar *bias1       = &sgsdd_ctx->data[sgsdd_ctx->offsets.bias1];
893fc405b4SJames Wright   const CeedScalar *bias2       = &sgsdd_ctx->data[sgsdd_ctx->offsets.bias2];
903fc405b4SJames Wright   const CeedScalar *weight1     = &sgsdd_ctx->data[sgsdd_ctx->offsets.weight1];
913fc405b4SJames Wright   const CeedScalar *weight2     = &sgsdd_ctx->data[sgsdd_ctx->offsets.weight2];
923fc405b4SJames Wright   CeedScalar        V[20]       = {0.};
933fc405b4SJames Wright 
943fc405b4SJames Wright   CopyN(bias1, V, num_neurons);
953fc405b4SJames Wright   MatVecNM(weight1, inputs, num_neurons, num_inputs, CEED_NOTRANSPOSE, V);
963fc405b4SJames Wright   LeakyReLU(V, alpha, num_neurons);
973fc405b4SJames Wright   CopyN(bias2, outputs, num_outputs);
983fc405b4SJames Wright   MatVecNM(weight2, V, num_outputs, num_neurons, CEED_NOTRANSPOSE, outputs);
993fc405b4SJames Wright }
1003fc405b4SJames Wright 
101*db588195SJames Wright /**
102*db588195SJames Wright  * @brief Compute model inputs for anisotropic data-driven model
103*db588195SJames Wright  *
104*db588195SJames Wright  * @param[in]  grad_velo_aniso     Gradient of velocity in physical (anisotropic) coordinates
105*db588195SJames Wright  * @param[in]  km_A_ij             Anisotropy tensor, in Kelvin-Mandel notation
106*db588195SJames Wright  * @param[in]  delta               Length used to create anisotropy tensor
107*db588195SJames Wright  * @param[in]  viscosity           Kinematic viscosity
108*db588195SJames Wright  * @param[out] eigenvectors        Eigenvectors of the (anisotropic) velocity gradient
109*db588195SJames Wright  * @param[out] inputs              Data-driven model inputs
110*db588195SJames Wright  * @param[out] grad_velo_magnitude Frobenius norm of the velocity gradient
111*db588195SJames Wright  */
112*db588195SJames Wright CEED_QFUNCTION_HELPER void ComputeSGS_DDAnisotropicInputs(const CeedScalar grad_velo_aniso[3][3], const CeedScalar km_A_ij[6], const CeedScalar delta,
113*db588195SJames Wright                                                           const CeedScalar viscosity, CeedScalar eigenvectors[3][3], CeedScalar inputs[6], CeedScalar *grad_velo_magnitude) {
114*db588195SJames Wright   CeedScalar strain_sframe[3] = {0.}, vorticity_sframe[3] = {0.};
1153fc405b4SJames Wright   CeedScalar A_ij[3][3] = {{0.}}, grad_velo_iso[3][3] = {{0.}};
1163fc405b4SJames Wright 
1173fc405b4SJames Wright   // -- Transform physical, anisotropic velocity gradient to isotropic
118*db588195SJames Wright   KMUnpack(km_A_ij, A_ij);
1193fc405b4SJames Wright   MatMat3(grad_velo_aniso, A_ij, CEED_NOTRANSPOSE, CEED_NOTRANSPOSE, grad_velo_iso);
1203fc405b4SJames Wright 
1213fc405b4SJames Wright   {  // -- Get Eigenframe
1223fc405b4SJames Wright     CeedScalar kmstrain_iso[6], strain_iso[3][3];
1233fc405b4SJames Wright     CeedInt    work_vector[3] = {0};
1243fc405b4SJames Wright     KMStrainRate(grad_velo_iso, kmstrain_iso);
1253fc405b4SJames Wright     KMUnpack(kmstrain_iso, strain_iso);
1263fc405b4SJames Wright     Diagonalize3(strain_iso, strain_sframe, eigenvectors, work_vector, SORT_DECREASING_EVALS, true, 5);
1273fc405b4SJames Wright   }
1283fc405b4SJames Wright 
1293fc405b4SJames Wright   {  // -- Get vorticity in S-frame
1303fc405b4SJames Wright     CeedScalar rotation_iso[3][3];
1313fc405b4SJames Wright     RotationRate(grad_velo_iso, rotation_iso);
1323fc405b4SJames Wright     CeedScalar vorticity_iso[3] = {-2 * rotation_iso[1][2], 2 * rotation_iso[0][2], -2 * rotation_iso[0][1]};
1333fc405b4SJames Wright     OrientBasisWithVector(eigenvectors, vorticity_iso);
1343fc405b4SJames Wright     MatVec3(eigenvectors, vorticity_iso, CEED_NOTRANSPOSE, vorticity_sframe);
1353fc405b4SJames Wright   }
1363fc405b4SJames Wright 
137*db588195SJames Wright   // -- Calculate DD model inputs
138*db588195SJames Wright   *grad_velo_magnitude = VelocityGradientMagnitude(strain_sframe, vorticity_sframe);
139*db588195SJames Wright   inputs[0] = strain_sframe[0];
140*db588195SJames Wright   inputs[1] = strain_sframe[1];
141*db588195SJames Wright   inputs[2] = strain_sframe[2];
142*db588195SJames Wright   inputs[3] = vorticity_sframe[0];
143*db588195SJames Wright   inputs[4] = vorticity_sframe[1];
144*db588195SJames Wright   inputs[5] = viscosity / Square(delta);
145*db588195SJames Wright   ScaleN(inputs, 1 / (*grad_velo_magnitude + CEED_EPSILON), 6);
146*db588195SJames Wright }
1473fc405b4SJames Wright 
148*db588195SJames Wright CEED_QFUNCTION_HELPER void ComputeSGS_DDAnisotropic(const CeedScalar grad_velo_aniso[3][3], const CeedScalar km_A_ij[6], const CeedScalar delta,
149*db588195SJames Wright                                                     const CeedScalar viscosity, CeedScalar kmsgs_stress[6], SGS_DDModelContext sgsdd_ctx) {
150*db588195SJames Wright   CeedScalar inputs[6], grad_velo_magnitude, eigenvectors[3][3], sgs_sframe_sym[6] = {0.};
151*db588195SJames Wright 
152*db588195SJames Wright   ComputeSGS_DDAnisotropicInputs(grad_velo_aniso, km_A_ij, delta, viscosity, eigenvectors, inputs, &grad_velo_magnitude);
153*db588195SJames Wright 
1543fc405b4SJames Wright   DataDrivenInference(inputs, sgs_sframe_sym, sgsdd_ctx);
1553fc405b4SJames Wright 
1563fc405b4SJames Wright   CeedScalar old_bounds[6][2] = {{0}};
1573fc405b4SJames Wright   for (int j = 0; j < 6; j++) old_bounds[j][1] = 1;
1583fc405b4SJames Wright   const CeedScalar(*new_bounds)[2] = (const CeedScalar(*)[2]) & sgsdd_ctx->data[sgsdd_ctx->offsets.out_scaling];
1593fc405b4SJames Wright   DenormalizeDDOutputs(sgs_sframe_sym, new_bounds, old_bounds);
1603fc405b4SJames Wright 
1613fc405b4SJames Wright   // Re-dimensionalize sgs_stress
1623fc405b4SJames Wright   ScaleN(sgs_sframe_sym, Square(delta) * Square(grad_velo_magnitude), 6);
1633fc405b4SJames Wright 
1643fc405b4SJames Wright   CeedScalar sgs_stress[3][3] = {{0.}};
1653fc405b4SJames Wright   {  // Rotate SGS Stress back to physical frame, SGS_physical = E^T SGS_sframe E
1663fc405b4SJames Wright     CeedScalar       Evec_sgs[3][3]   = {{0.}};
1673fc405b4SJames Wright     const CeedScalar sgs_sframe[3][3] = {
1683fc405b4SJames Wright         {sgs_sframe_sym[0], sgs_sframe_sym[3], sgs_sframe_sym[4]},
1693fc405b4SJames Wright         {sgs_sframe_sym[3], sgs_sframe_sym[1], sgs_sframe_sym[5]},
1703fc405b4SJames Wright         {sgs_sframe_sym[4], sgs_sframe_sym[5], sgs_sframe_sym[2]},
1713fc405b4SJames Wright     };
1723fc405b4SJames Wright     MatMat3(eigenvectors, sgs_sframe, CEED_TRANSPOSE, CEED_NOTRANSPOSE, Evec_sgs);
1733fc405b4SJames Wright     MatMat3(Evec_sgs, eigenvectors, CEED_NOTRANSPOSE, CEED_NOTRANSPOSE, sgs_stress);
1743fc405b4SJames Wright   }
1753fc405b4SJames Wright 
1763fc405b4SJames Wright   KMPack(sgs_stress, kmsgs_stress);
1773fc405b4SJames Wright }
1783fc405b4SJames Wright 
179ee1455b7SJames Wright // @brief Calculate subgrid stress at nodes using anisotropic data-driven model
180ee1455b7SJames Wright CEED_QFUNCTION_HELPER int ComputeSGS_DDAnisotropicNodal(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out,
1818fff8293SJames Wright                                                         StateVariable state_var) {
182ee1455b7SJames Wright   const CeedScalar(*q)[CEED_Q_VLA]            = (const CeedScalar(*)[CEED_Q_VLA])in[0];
183ee1455b7SJames Wright   const CeedScalar(*x)[CEED_Q_VLA]            = (const CeedScalar(*)[CEED_Q_VLA])in[1];
184ee1455b7SJames Wright   const CeedScalar(*grad_velo)[3][CEED_Q_VLA] = (const CeedScalar(*)[3][CEED_Q_VLA])in[2];
185ee1455b7SJames Wright   const CeedScalar(*A_ij_delta)[CEED_Q_VLA]   = (const CeedScalar(*)[CEED_Q_VLA])in[3];
186ee1455b7SJames Wright   const CeedScalar(*inv_multiplicity)         = (const CeedScalar(*))in[4];
187ee1455b7SJames Wright   CeedScalar(*v)[CEED_Q_VLA]                  = (CeedScalar(*)[CEED_Q_VLA])out[0];
188ee1455b7SJames Wright 
189ee1455b7SJames Wright   const SGS_DDModelContext       sgsdd_ctx = (SGS_DDModelContext)ctx;
190ee1455b7SJames Wright   const NewtonianIdealGasContext gas       = &sgsdd_ctx->gas;
191ee1455b7SJames Wright 
192ee1455b7SJames Wright   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) {
193ee1455b7SJames Wright     const CeedScalar qi[5]                 = {q[0][i], q[1][i], q[2][i], q[3][i], q[4][i]};
194ee1455b7SJames Wright     const CeedScalar x_i[3]                = {x[0][i], x[1][i], x[2][i]};
195ee1455b7SJames Wright     const CeedScalar grad_velo_aniso[3][3] = {
196ee1455b7SJames Wright         {grad_velo[0][0][i], grad_velo[0][1][i], grad_velo[0][2][i]},
197ee1455b7SJames Wright         {grad_velo[1][0][i], grad_velo[1][1][i], grad_velo[1][2][i]},
198ee1455b7SJames Wright         {grad_velo[2][0][i], grad_velo[2][1][i], grad_velo[2][2][i]}
199ee1455b7SJames Wright     };
200ee1455b7SJames Wright     const CeedScalar km_A_ij[6] = {A_ij_delta[0][i], A_ij_delta[1][i], A_ij_delta[2][i], A_ij_delta[3][i], A_ij_delta[4][i], A_ij_delta[5][i]};
201ee1455b7SJames Wright     const CeedScalar delta      = A_ij_delta[6][i];
2028fff8293SJames Wright     const State      s          = StateFromQ(gas, qi, x_i, state_var);
203ee1455b7SJames Wright     CeedScalar       km_sgs[6];
204ee1455b7SJames Wright 
205ee1455b7SJames Wright     ComputeSGS_DDAnisotropic(grad_velo_aniso, km_A_ij, delta, gas->mu / s.U.density, km_sgs, sgsdd_ctx);
206ee1455b7SJames Wright 
207ee1455b7SJames Wright     for (int j = 0; j < 6; j++) v[j][i] = inv_multiplicity[i] * km_sgs[j];
208ee1455b7SJames Wright   }
209ee1455b7SJames Wright   return 0;
210ee1455b7SJames Wright }
211ee1455b7SJames Wright 
212ee1455b7SJames Wright CEED_QFUNCTION(ComputeSGS_DDAnisotropicNodal_Prim)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
2138fff8293SJames Wright   return ComputeSGS_DDAnisotropicNodal(ctx, Q, in, out, STATEVAR_PRIMITIVE);
214ee1455b7SJames Wright }
215ee1455b7SJames Wright 
216ee1455b7SJames Wright CEED_QFUNCTION(ComputeSGS_DDAnisotropicNodal_Conserv)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
2178fff8293SJames Wright   return ComputeSGS_DDAnisotropicNodal(ctx, Q, in, out, STATEVAR_CONSERVATIVE);
218ee1455b7SJames Wright }
219ee1455b7SJames Wright 
2209c678832SJames Wright // @brief Adds subgrid stress to residual (during IFunction evaluation)
2219c678832SJames Wright CEED_QFUNCTION_HELPER int FluxSubgridStress(const StatePrimitive Y, const CeedScalar km_sgs[6], CeedScalar Flux[5][3]) {
2229c678832SJames Wright   CeedScalar sgs[3][3];
2239c678832SJames Wright 
2249c678832SJames Wright   KMUnpack(km_sgs, sgs);
2259c678832SJames Wright   for (CeedInt j = 0; j < 3; j++) {
2269c678832SJames Wright     Flux[0][j] = 0.;
2279c678832SJames Wright     for (CeedInt k = 0; k < 3; k++) Flux[k + 1][j] = sgs[k][j];
2289c678832SJames Wright     Flux[4][j] = Y.velocity[0] * sgs[0][j] + Y.velocity[1] * sgs[1][j] + Y.velocity[2] * sgs[2][j];
2299c678832SJames Wright   }
2309c678832SJames Wright   return 0;
2319c678832SJames Wright }
2329c678832SJames Wright 
2339c678832SJames Wright CEED_QFUNCTION_HELPER int IFunction_NodalSubgridStress(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out,
2348fff8293SJames Wright                                                        StateVariable state_var) {
2359c678832SJames Wright   const CeedScalar(*q)[CEED_Q_VLA]      = (const CeedScalar(*)[CEED_Q_VLA])in[0];
2369c678832SJames Wright   const CeedScalar(*q_data)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[1];
2379c678832SJames Wright   const CeedScalar(*x)[CEED_Q_VLA]      = (const CeedScalar(*)[CEED_Q_VLA])in[2];
2389c678832SJames Wright   const CeedScalar(*km_sgs)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[3];
2399c678832SJames Wright   CeedScalar(*Grad_v)[5][CEED_Q_VLA]    = (CeedScalar(*)[5][CEED_Q_VLA])out[0];
2409c678832SJames Wright 
2419c678832SJames Wright   SGS_DDModelContext       sgsdd_ctx = (SGS_DDModelContext)ctx;
2429c678832SJames Wright   NewtonianIdealGasContext gas       = &sgsdd_ctx->gas;
2439c678832SJames Wright 
2449c678832SJames Wright   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) {
2459c678832SJames Wright     const CeedScalar qi[5]  = {q[0][i], q[1][i], q[2][i], q[3][i], q[4][i]};
2469c678832SJames Wright     const CeedScalar x_i[3] = {x[0][i], x[1][i], x[2][i]};
2478fff8293SJames Wright     const State      s      = StateFromQ(gas, qi, x_i, state_var);
2489c678832SJames Wright 
2499c678832SJames Wright     const CeedScalar wdetJ      = q_data[0][i];
2509c678832SJames Wright     const CeedScalar dXdx[3][3] = {
2519c678832SJames Wright         {q_data[1][i], q_data[2][i], q_data[3][i]},
2529c678832SJames Wright         {q_data[4][i], q_data[5][i], q_data[6][i]},
2539c678832SJames Wright         {q_data[7][i], q_data[8][i], q_data[9][i]}
2549c678832SJames Wright     };
2559c678832SJames Wright 
2569c678832SJames Wright     CeedScalar       Flux[5][3];
2579c678832SJames Wright     const CeedScalar km_sgs_i[6] = {km_sgs[0][i], km_sgs[1][i], km_sgs[2][i], km_sgs[3][i], km_sgs[4][i], km_sgs[5][i]};
2589c678832SJames Wright     FluxSubgridStress(s.Y, km_sgs_i, Flux);
2599c678832SJames Wright 
2607523f6aaSJames Wright     for (CeedInt k = 0; k < 3; k++) {
2617523f6aaSJames Wright       for (CeedInt j = 0; j < 5; j++) {
2627523f6aaSJames Wright         Grad_v[k][j][i] = -wdetJ * (dXdx[k][0] * Flux[j][0] + dXdx[k][1] * Flux[j][1] + dXdx[k][2] * Flux[j][2]);
2639c678832SJames Wright       }
2649c678832SJames Wright     }
2659c678832SJames Wright   }
2669c678832SJames Wright   return 0;
2679c678832SJames Wright }
2689c678832SJames Wright 
2699c678832SJames Wright CEED_QFUNCTION(IFunction_NodalSubgridStress_Conserv)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
2708fff8293SJames Wright   return IFunction_NodalSubgridStress(ctx, Q, in, out, STATEVAR_CONSERVATIVE);
2719c678832SJames Wright }
2729c678832SJames Wright 
2739c678832SJames Wright CEED_QFUNCTION(IFunction_NodalSubgridStress_Prim)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
2748fff8293SJames Wright   return IFunction_NodalSubgridStress(ctx, Q, in, out, STATEVAR_PRIMITIVE);
2759c678832SJames Wright }
2769c678832SJames Wright 
27762b7942eSJames Wright #endif  // sgs_dd_model_h
278