| misc.c (0d157ec36eee9d67df07e5adf79db10fc668f03d) | misc.c (ef080ff9ce83a1650979d1b767b88f0d6e3ee6ca) |
|---|---|
| 1// Copyright (c) 2017-2022, 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 9/// Miscellaneous utility functions 10 11#include "../navierstokes.h" | 1// Copyright (c) 2017-2022, 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 9/// Miscellaneous utility functions 10 11#include "../navierstokes.h" |
| 12#include "../qfunctions/mass.h" |
|
| 12 13PetscErrorCode ICs_FixMultiplicity(DM dm, CeedData ceed_data, User user, Vec Q_loc, Vec Q, CeedScalar time) { 14 PetscFunctionBeginUser; 15 16 // --------------------------------------------------------------------------- 17 // Update time for evaluation 18 // --------------------------------------------------------------------------- 19 if (user->phys->ics_time_label) CeedOperatorContextSetDouble(ceed_data->op_ics, user->phys->ics_time_label, &time); --- 232 unchanged lines hidden (view full) --- 252 PetscFunctionReturn(0); 253} 254 255// Free a plain data context that was allocated using PETSc; returning libCEED error codes 256int FreeContextPetsc(void *data) { 257 if (PetscFree(data)) return CeedError(NULL, CEED_ERROR_ACCESS, "PetscFree failed"); 258 return CEED_ERROR_SUCCESS; 259} | 13 14PetscErrorCode ICs_FixMultiplicity(DM dm, CeedData ceed_data, User user, Vec Q_loc, Vec Q, CeedScalar time) { 15 PetscFunctionBeginUser; 16 17 // --------------------------------------------------------------------------- 18 // Update time for evaluation 19 // --------------------------------------------------------------------------- 20 if (user->phys->ics_time_label) CeedOperatorContextSetDouble(ceed_data->op_ics, user->phys->ics_time_label, &time); --- 232 unchanged lines hidden (view full) --- 253 PetscFunctionReturn(0); 254} 255 256// Free a plain data context that was allocated using PETSc; returning libCEED error codes 257int FreeContextPetsc(void *data) { 258 if (PetscFree(data)) return CeedError(NULL, CEED_ERROR_ACCESS, "PetscFree failed"); 259 return CEED_ERROR_SUCCESS; 260} |
| 261 262// Return mass qfunction specification for number of components N 263PetscErrorCode CreateMassQFunction(Ceed ceed, CeedInt N, CeedInt q_data_size, CeedQFunction *qf) { 264 CeedQFunctionUser qfunction_ptr; 265 const char *qfunction_loc; 266 PetscFunctionBeginUser; 267 268 switch (N) { 269 case 1: 270 qfunction_ptr = Mass_1; 271 qfunction_loc = Mass_1_loc; 272 break; 273 case 5: 274 qfunction_ptr = Mass_5; 275 qfunction_loc = Mass_5_loc; 276 break; 277 case 9: 278 qfunction_ptr = Mass_9; 279 qfunction_loc = Mass_9_loc; 280 break; 281 case 22: 282 qfunction_ptr = Mass_22; 283 qfunction_loc = Mass_22_loc; 284 break; 285 default: 286 SETERRQ(PETSC_COMM_WORLD, -1, "Could not find mass qfunction of size %d", N); 287 } 288 CeedQFunctionCreateInterior(ceed, 1, qfunction_ptr, qfunction_loc, qf); 289 290 CeedQFunctionAddInput(*qf, "u", N, CEED_EVAL_INTERP); 291 CeedQFunctionAddInput(*qf, "qdata", q_data_size, CEED_EVAL_NONE); 292 CeedQFunctionAddOutput(*qf, "v", N, CEED_EVAL_INTERP); 293 PetscFunctionReturn(0); 294} |
|