Lines Matching +full:- +full:f

1 // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2 // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
20 PetscScalar *r, f[4], h[4]; in CompressibleBlasiusResidual() local
21 PetscInt N = blasius->n_cheb; in CompressibleBlasiusResidual()
22 State S_infty = blasius->S_infty; in CompressibleBlasiusResidual()
24 NewtonianIGProperties gas = blasius->newt_ctx.gas; in CompressibleBlasiusResidual()
33 // Left boundary conditions f = f' = 0 in CompressibleBlasiusResidual()
34 ChebyshevEval(N, Tf, -1., blasius->eta_max, f); in CompressibleBlasiusResidual()
35 r[0] = f[0]; in CompressibleBlasiusResidual()
36 r[1] = f[1]; in CompressibleBlasiusResidual()
38 // f - right end boundary condition in CompressibleBlasiusResidual()
39 ChebyshevEval(N, Tf, 1., blasius->eta_max, f); in CompressibleBlasiusResidual()
40 r[2] = f[1] - 1.; in CompressibleBlasiusResidual()
42 for (int i = 0; i < N - 3; i++) { in CompressibleBlasiusResidual()
43 ChebyshevEval(N, Tf, blasius->X[i], blasius->eta_max, f); in CompressibleBlasiusResidual()
44 ChebyshevEval(N - 1, Th, blasius->X[i], blasius->eta_max, h); in CompressibleBlasiusResidual()
50 const PetscScalar rho_tilde[2] = {1 / h[0], -h[1] / PetscSqr(h[0])}; in CompressibleBlasiusResidual()
55 r[3 + i] = 2 * (mu_rho_tilde[0] * f[3] + mu_rho_tilde[1] * f[2]) + f[2] * f[0]; in CompressibleBlasiusResidual()
56 …0] * h[2] + mu_rho_tilde[1] * h[1]) + Pr * f[0] * h[1] + Pr * (gamma - 1) * mu_rho_tilde[0] * Pets… in CompressibleBlasiusResidual()
59 // h - left end boundary condition in CompressibleBlasiusResidual()
60 ChebyshevEval(N - 1, Th, -1., blasius->eta_max, h); in CompressibleBlasiusResidual()
61 r[N] = h[0] - blasius->T_wall / S_infty.Y.temperature; in CompressibleBlasiusResidual()
63 // h - right end boundary condition in CompressibleBlasiusResidual()
64 ChebyshevEval(N - 1, Th, 1., blasius->eta_max, h); in CompressibleBlasiusResidual()
65 r[N + 1] = h[0] - 1.; in CompressibleBlasiusResidual()
77 PetscInt N = blasius->n_cheb; in ComputeChebyshevCoefficients()
83 PetscCall(PetscMalloc2(N - 3, &blasius->X, N - 3, &w)); in ComputeChebyshevCoefficients()
84 PetscCall(PetscDTGaussQuadrature(N - 3, -1., 1., blasius->X, w)); in ComputeChebyshevCoefficients()
89 PetscCall(VecSetSizes(sol, PETSC_DECIDE, 2 * N - 1)); in ComputeChebyshevCoefficients()
103 for (int i = 0; i < N; i++) blasius->Tf_cheb[i] = cheb_coefs[i]; in ComputeChebyshevCoefficients()
104 for (int i = 0; i < N - 1; i++) blasius->Th_cheb[i] = cheb_coefs[i + N]; in ComputeChebyshevCoefficients()
107 PetscCall(PetscFree2(blasius->X, w)); in ComputeChebyshevCoefficients()
119 …PetscCall(HoneeBCCreateIFunctionQF(bc_def, Blasius_Inflow, Blasius_Inflow_loc, honee_bc->qfctx, qf… in BlasiusInflowBCSetup_CreateIFunctionQF()
128 …ateIJacobianQF(bc_def, Blasius_Inflow_Jacobian, Blasius_Inflow_Jacobian_loc, honee_bc->qfctx, qf)); in BlasiusInflowBCSetup_CreateIJacobianQF()
134 MPI_Comm comm = honee->comm; in NS_BLASIUS()
135 Ceed ceed = honee->ceed; in NS_BLASIUS()
144 // ------------------------------------------------------ in NS_BLASIUS()
146 // ------------------------------------------------------ in NS_BLASIUS()
147 …problem->ics = (HoneeQFSpec){.qf_func_ptr = ICsBlasius, .qf_loc = ICsBlasius_loc, .qfctx = problem in NS_BLASIUS()
152 CeedScalar delta0 = 4.2e-3; // m in NS_BLASIUS()
159 …PetscCall(PetscOptionsBool("-weakT", "Change from rho weak to T weak at inflow", NULL, weakT, &wea… in NS_BLASIUS()
160 …PetscCall(PetscOptionsScalar("-velocity_infinity", "Velocity at boundary layer edge", NULL, U_inf,… in NS_BLASIUS()
161 …PetscCall(PetscOptionsScalar("-temperature_infinity", "Temperature at boundary layer edge", NULL, … in NS_BLASIUS()
162 …PetscCall(PetscOptionsHasName(NULL, NULL, "-P0", &P0_set)); // For maintaining behavior of -P0 fl… in NS_BLASIUS()
163 PetscCall(PetscOptionsDeprecated("-P0", "-pressure_infinity", "libCEED 0.12.0", in NS_BLASIUS()
164 …"Use -pressure_infinity to set pressure at boundary layer edge and -idl_pressure to set the IDL re… in NS_BLASIUS()
166 …PetscCall(PetscOptionsScalar("-pressure_infinity", "Pressure at boundary layer edge", NULL, P_inf,… in NS_BLASIUS()
167 …PetscCall(PetscOptionsScalar("-temperature_wall", "Temperature at wall", NULL, T_wall, &T_wall, NU… in NS_BLASIUS()
168 …PetscCall(PetscOptionsScalar("-delta0", "Boundary layer height at inflow", NULL, delta0, &delta0, … in NS_BLASIUS()
169 PetscCall(PetscOptionsInt("-n_chebyshev", "Number of Chebyshev terms", NULL, N, &N, NULL)); in NS_BLASIUS()
170 …PetscCheck(3 <= N && N <= BLASIUS_MAX_N_CHEBYSHEV, comm, PETSC_ERR_ARG_OUTOFRANGE, "-n_chebyshev %… in NS_BLASIUS()
172 …PetscCall(PetscOptionsBool("-stg_use", "Use STG inflow boundary condition", NULL, use_stg, &use_st… in NS_BLASIUS()
175 Units units = honee->units; in NS_BLASIUS()
177 T_inf *= units->Kelvin; in NS_BLASIUS()
178 T_wall *= units->Kelvin; in NS_BLASIUS()
179 P_inf *= units->Pascal; in NS_BLASIUS()
180 U_inf *= units->meter / units->second; in NS_BLASIUS()
181 delta0 *= units->meter; in NS_BLASIUS()
184 …PetscCallCeed(ceed, CeedQFunctionContextGetData(problem->apply_vol_rhs.qfctx, CEED_MEM_HOST, &newt… in NS_BLASIUS()
190 State S_infty = StateFromPrimitive(newtonian_ig_ctx->gas, Y_inf); in NS_BLASIUS()
193 blasius_ctx->weakT = weakT; in NS_BLASIUS()
194 blasius_ctx->T_wall = T_wall; in NS_BLASIUS()
195 blasius_ctx->delta0 = delta0; in NS_BLASIUS()
196 blasius_ctx->S_infty = S_infty; in NS_BLASIUS()
197 blasius_ctx->n_cheb = N; in NS_BLASIUS()
198 blasius_ctx->implicit = honee->phys->implicit; in NS_BLASIUS()
199 …if (P0_set) newtonian_ig_ctx->idl_pressure = P_inf; // For maintaining behavior of -P0 flag (whic… in NS_BLASIUS()
200 blasius_ctx->newt_ctx = *newtonian_ig_ctx; in NS_BLASIUS()
205 blasius_ctx->x_inflow = domain_min[0]; in NS_BLASIUS()
206 blasius_ctx->eta_max = 5 * domain_max[1] / blasius_ctx->delta0; in NS_BLASIUS()
209 PetscCall(PetscOptionsGetBool(NULL, NULL, "-diff_filter_mms", &diff_filter_mms, NULL)); in NS_BLASIUS()
212 …PetscCallCeed(ceed, CeedQFunctionContextRestoreData(problem->apply_vol_rhs.qfctx, &newtonian_ig_ct… in NS_BLASIUS()
214 PetscCallCeed(ceed, CeedQFunctionContextCreate(honee->ceed, &blasius_qfctx)); in NS_BLASIUS()
218 PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->ics.qfctx)); in NS_BLASIUS()
219 problem->ics.qfctx = blasius_qfctx; in NS_BLASIUS()
225 …PetscCheck((honee->phys->state_var == STATEVAR_CONSERVATIVE) || (honee->app_ctx->test_type == TEST… in NS_BLASIUS()
227 for (PetscCount b = 0; b < problem->num_bc_defs; b++) { in NS_BLASIUS()
228 BCDefinition bc_def = problem->bc_defs[b]; in NS_BLASIUS()
236 PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(blasius_qfctx, &honee_bc->qfctx)); in NS_BLASIUS()
237 honee_bc->honee = honee; in NS_BLASIUS()
238 honee_bc->num_comps_jac_data = 0; in NS_BLASIUS()