bc_freestream.c (cce3ee4efcaa7914b8a0b517c757fe3477daefe6) bc_freestream.c (a2d72b6f1ed489cbeb0eb5f72cf8bf977e7ff50a)
1// Copyright (c) 2017-2024, 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/// @file

--- 64 unchanged lines hidden (view full) ---

73 case RIEMANN_HLLC:
74 problem->apply_freestream.qfunction = Freestream_Prim_HLLC;
75 problem->apply_freestream.qfunction_loc = Freestream_Prim_HLLC_loc;
76 problem->apply_freestream_jacobian.qfunction = Freestream_Jacobian_Prim_HLLC;
77 problem->apply_freestream_jacobian.qfunction_loc = Freestream_Jacobian_Prim_HLLC_loc;
78 break;
79 }
80 break;
1// Copyright (c) 2017-2024, 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/// @file

--- 64 unchanged lines hidden (view full) ---

73 case RIEMANN_HLLC:
74 problem->apply_freestream.qfunction = Freestream_Prim_HLLC;
75 problem->apply_freestream.qfunction_loc = Freestream_Prim_HLLC_loc;
76 problem->apply_freestream_jacobian.qfunction = Freestream_Jacobian_Prim_HLLC;
77 problem->apply_freestream_jacobian.qfunction_loc = Freestream_Jacobian_Prim_HLLC_loc;
78 break;
79 }
80 break;
81 case STATEVAR_ENTROPY:
82 switch (riemann) {
83 case RIEMANN_HLL:
84 problem->apply_freestream.qfunction = Freestream_Entropy_HLL;
85 problem->apply_freestream.qfunction_loc = Freestream_Entropy_HLL_loc;
86 problem->apply_freestream_jacobian.qfunction = Freestream_Jacobian_Entropy_HLL;
87 problem->apply_freestream_jacobian.qfunction_loc = Freestream_Jacobian_Entropy_HLL_loc;
88 break;
89 case RIEMANN_HLLC:
90 problem->apply_freestream.qfunction = Freestream_Entropy_HLLC;
91 problem->apply_freestream.qfunction_loc = Freestream_Entropy_HLLC_loc;
92 problem->apply_freestream_jacobian.qfunction = Freestream_Jacobian_Entropy_HLLC;
93 problem->apply_freestream_jacobian.qfunction_loc = Freestream_Jacobian_Entropy_HLLC_loc;
94 break;
95 }
96 break;
81 }
82
83 Y_inf.pressure *= Pascal;
84 for (int i = 0; i < 3; i++) Y_inf.velocity[i] *= meter / second;
85 Y_inf.temperature *= Kelvin;
86
87 State S_infty = StateFromPrimitive(newtonian_ig_ctx, Y_inf);
88

--- 54 unchanged lines hidden (view full) ---

143 problem->apply_outflow_jacobian.qfunction_loc = RiemannOutflow_Jacobian_Conserv_loc;
144 break;
145 case STATEVAR_PRIMITIVE:
146 problem->apply_outflow.qfunction = RiemannOutflow_Prim;
147 problem->apply_outflow.qfunction_loc = RiemannOutflow_Prim_loc;
148 problem->apply_outflow_jacobian.qfunction = RiemannOutflow_Jacobian_Prim;
149 problem->apply_outflow_jacobian.qfunction_loc = RiemannOutflow_Jacobian_Prim_loc;
150 break;
97 }
98
99 Y_inf.pressure *= Pascal;
100 for (int i = 0; i < 3; i++) Y_inf.velocity[i] *= meter / second;
101 Y_inf.temperature *= Kelvin;
102
103 State S_infty = StateFromPrimitive(newtonian_ig_ctx, Y_inf);
104

--- 54 unchanged lines hidden (view full) ---

159 problem->apply_outflow_jacobian.qfunction_loc = RiemannOutflow_Jacobian_Conserv_loc;
160 break;
161 case STATEVAR_PRIMITIVE:
162 problem->apply_outflow.qfunction = RiemannOutflow_Prim;
163 problem->apply_outflow.qfunction_loc = RiemannOutflow_Prim_loc;
164 problem->apply_outflow_jacobian.qfunction = RiemannOutflow_Jacobian_Prim;
165 problem->apply_outflow_jacobian.qfunction_loc = RiemannOutflow_Jacobian_Prim_loc;
166 break;
167 case STATEVAR_ENTROPY:
168 problem->apply_outflow.qfunction = RiemannOutflow_Entropy;
169 problem->apply_outflow.qfunction_loc = RiemannOutflow_Entropy_loc;
170 problem->apply_outflow_jacobian.qfunction = RiemannOutflow_Jacobian_Entropy;
171 problem->apply_outflow_jacobian.qfunction_loc = RiemannOutflow_Jacobian_Entropy_loc;
172 break;
151 }
152 break;
153 case OUTFLOW_PRESSURE:
154 switch (user->phys->state_var) {
155 case STATEVAR_CONSERVATIVE:
156 problem->apply_outflow.qfunction = PressureOutflow_Conserv;
157 problem->apply_outflow.qfunction_loc = PressureOutflow_Conserv_loc;
158 problem->apply_outflow_jacobian.qfunction = PressureOutflow_Jacobian_Conserv;
159 problem->apply_outflow_jacobian.qfunction_loc = PressureOutflow_Jacobian_Conserv_loc;
160 break;
161 case STATEVAR_PRIMITIVE:
162 problem->apply_outflow.qfunction = PressureOutflow_Prim;
163 problem->apply_outflow.qfunction_loc = PressureOutflow_Prim_loc;
164 problem->apply_outflow_jacobian.qfunction = PressureOutflow_Jacobian_Prim;
165 problem->apply_outflow_jacobian.qfunction_loc = PressureOutflow_Jacobian_Prim_loc;
166 break;
173 }
174 break;
175 case OUTFLOW_PRESSURE:
176 switch (user->phys->state_var) {
177 case STATEVAR_CONSERVATIVE:
178 problem->apply_outflow.qfunction = PressureOutflow_Conserv;
179 problem->apply_outflow.qfunction_loc = PressureOutflow_Conserv_loc;
180 problem->apply_outflow_jacobian.qfunction = PressureOutflow_Jacobian_Conserv;
181 problem->apply_outflow_jacobian.qfunction_loc = PressureOutflow_Jacobian_Conserv_loc;
182 break;
183 case STATEVAR_PRIMITIVE:
184 problem->apply_outflow.qfunction = PressureOutflow_Prim;
185 problem->apply_outflow.qfunction_loc = PressureOutflow_Prim_loc;
186 problem->apply_outflow_jacobian.qfunction = PressureOutflow_Jacobian_Prim;
187 problem->apply_outflow_jacobian.qfunction_loc = PressureOutflow_Jacobian_Prim_loc;
188 break;
189 case STATEVAR_ENTROPY:
190 problem->apply_outflow.qfunction = PressureOutflow_Entropy;
191 problem->apply_outflow.qfunction_loc = PressureOutflow_Entropy_loc;
192 problem->apply_outflow_jacobian.qfunction = PressureOutflow_Jacobian_Entropy;
193 problem->apply_outflow_jacobian.qfunction_loc = PressureOutflow_Jacobian_Entropy_loc;
194 break;
167 }
168 break;
169 }
170 PetscCall(PetscCalloc1(1, &outflow_ctx));
171 outflow_ctx->gas = *newtonian_ig_ctx;
172 outflow_ctx->recirc = recirc;
173 outflow_ctx->softplus_velocity = softplus_velocity;
174 outflow_ctx->pressure = pressure;
175 outflow_ctx->temperature = temperature;
176
177 PetscCallCeed(ceed, CeedQFunctionContextCreate(user->ceed, &outflow_context));
178 PetscCallCeed(ceed, CeedQFunctionContextSetData(outflow_context, CEED_MEM_HOST, CEED_USE_POINTER, sizeof(*outflow_ctx), outflow_ctx));
179 PetscCallCeed(ceed, CeedQFunctionContextSetDataDestroy(outflow_context, CEED_MEM_HOST, FreeContextPetsc));
180 problem->apply_outflow.qfunction_context = outflow_context;
181 PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(outflow_context, &problem->apply_outflow_jacobian.qfunction_context));
182 PetscFunctionReturn(PETSC_SUCCESS);
183}
195 }
196 break;
197 }
198 PetscCall(PetscCalloc1(1, &outflow_ctx));
199 outflow_ctx->gas = *newtonian_ig_ctx;
200 outflow_ctx->recirc = recirc;
201 outflow_ctx->softplus_velocity = softplus_velocity;
202 outflow_ctx->pressure = pressure;
203 outflow_ctx->temperature = temperature;
204
205 PetscCallCeed(ceed, CeedQFunctionContextCreate(user->ceed, &outflow_context));
206 PetscCallCeed(ceed, CeedQFunctionContextSetData(outflow_context, CEED_MEM_HOST, CEED_USE_POINTER, sizeof(*outflow_ctx), outflow_ctx));
207 PetscCallCeed(ceed, CeedQFunctionContextSetDataDestroy(outflow_context, CEED_MEM_HOST, FreeContextPetsc));
208 problem->apply_outflow.qfunction_context = outflow_context;
209 PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(outflow_context, &problem->apply_outflow_jacobian.qfunction_context));
210 PetscFunctionReturn(PETSC_SUCCESS);
211}