13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 377841947SLeila Ghaffari // 43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 577841947SLeila Ghaffari // 63d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 777841947SLeila Ghaffari 877841947SLeila Ghaffari /// @file 977841947SLeila Ghaffari /// Advection initial condition and operator for Navier-Stokes example using PETSc 1077841947SLeila Ghaffari 1177841947SLeila Ghaffari #ifndef advection_h 1277841947SLeila Ghaffari #define advection_h 1377841947SLeila Ghaffari 14ba6664aeSJames Wright #include <ceed.h> 15c9c2c079SJeremy L Thompson #include <math.h> 1677841947SLeila Ghaffari 1730e1b2c7SJames Wright #include "advection_generic.h" 18c44b1c7dSJames Wright #include "advection_types.h" 198f4d89c8SJames Wright #include "newtonian_state.h" 208f4d89c8SJames Wright #include "newtonian_types.h" 21c44b1c7dSJames Wright #include "stabilization_types.h" 228756a6ccSJames Wright #include "utils.h" 238756a6ccSJames Wright 2477841947SLeila Ghaffari // ***************************************************************************** 2577841947SLeila Ghaffari // This QFunction sets the initial conditions for 3D advection 2677841947SLeila Ghaffari // ***************************************************************************** 272b730f8bSJeremy L Thompson CEED_QFUNCTION(ICsAdvection)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 2877841947SLeila Ghaffari const CeedScalar(*X)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; 2977841947SLeila Ghaffari CeedScalar(*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; 3077841947SLeila Ghaffari 3146603fc5SJames Wright CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { 3277841947SLeila Ghaffari const CeedScalar x[] = {X[0][i], X[1][i], X[2][i]}; 33e6225c47SLeila Ghaffari CeedScalar q[5] = {0.}; 3477841947SLeila Ghaffari 3530e1b2c7SJames Wright Exact_AdvectionGeneric(3, 0., x, 5, q, ctx); 3677841947SLeila Ghaffari for (CeedInt j = 0; j < 5; j++) q0[j][i] = q[j]; 3730e1b2c7SJames Wright } 3877841947SLeila Ghaffari return 0; 3977841947SLeila Ghaffari } 4077841947SLeila Ghaffari 4177841947SLeila Ghaffari // ***************************************************************************** 4277841947SLeila Ghaffari // This QFunction implements the following formulation of the advection equation 4377841947SLeila Ghaffari // 4477841947SLeila Ghaffari // This is 3D advection given in two formulations based upon the weak form. 4577841947SLeila Ghaffari // 4677841947SLeila Ghaffari // State Variables: q = ( rho, U1, U2, U3, E ) 4777841947SLeila Ghaffari // rho - Mass Density 4877841947SLeila Ghaffari // Ui - Momentum Density , Ui = rho ui 4977841947SLeila Ghaffari // E - Total Energy Density 5077841947SLeila Ghaffari // 5177841947SLeila Ghaffari // Advection Equation: 5277841947SLeila Ghaffari // dE/dt + div( E u ) = 0 5377841947SLeila Ghaffari // ***************************************************************************** 542b730f8bSJeremy L Thompson CEED_QFUNCTION(Advection)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 55b28affb2SJames Wright RHSFunction_AdvectionGeneric(ctx, Q, in, out, 3); 5677841947SLeila Ghaffari return 0; 5777841947SLeila Ghaffari } 5877841947SLeila Ghaffari 592b730f8bSJeremy L Thompson CEED_QFUNCTION(IFunction_Advection)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 60372d1924SJames Wright IFunction_AdvectionGeneric(ctx, Q, in, out, 3); 6177841947SLeila Ghaffari return 0; 6277841947SLeila Ghaffari } 6377841947SLeila Ghaffari 642b730f8bSJeremy L Thompson CEED_QFUNCTION(Advection_InOutFlow)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 65*4bdcf5bfSJames Wright Advection_InOutFlowGeneric(ctx, Q, in, out, 3); 6677841947SLeila Ghaffari return 0; 6777841947SLeila Ghaffari } 6877841947SLeila Ghaffari 6977841947SLeila Ghaffari #endif // advection_h 70