| eulervortex.c (f163c87f5f916c922650e26a0ad2b739121e1f13) | eulervortex.c (1864f1c2b4e770a2a9adc26a02ef77fc3a284256) |
|---|---|
| 1// Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at 2// the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights 3// reserved. See files LICENSE and NOTICE for details. 4// 5// This file is part of CEED, a collection of benchmarks, miniapps, software 6// libraries and APIs for efficient high-order finite element and spectral 7// element discretizations for exascale applications. For more information and 8// source code availability see http://github.com/ceed. --- 7 unchanged lines hidden (view full) --- 16 17/// @file 18/// Utility functions for setting up EULER_VORTEX 19 20#include "../navierstokes.h" 21#include "../qfunctions/setupgeo.h" 22#include "../qfunctions/eulervortex.h" 23 | 1// Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at 2// the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights 3// reserved. See files LICENSE and NOTICE for details. 4// 5// This file is part of CEED, a collection of benchmarks, miniapps, software 6// libraries and APIs for efficient high-order finite element and spectral 7// element discretizations for exascale applications. For more information and 8// source code availability see http://github.com/ceed. --- 7 unchanged lines hidden (view full) --- 16 17/// @file 18/// Utility functions for setting up EULER_VORTEX 19 20#include "../navierstokes.h" 21#include "../qfunctions/setupgeo.h" 22#include "../qfunctions/eulervortex.h" 23 |
| 24PetscErrorCode NS_EULER_VORTEX(ProblemData *problem, void *setup_ctx, | 24PetscErrorCode NS_EULER_VORTEX(ProblemData *problem, DM dm, void *setup_ctx, |
| 25 void *ctx) { 26 EulerTestType euler_test; 27 SetupContext setup_context = *(SetupContext *)setup_ctx; 28 User user = *(User *)ctx; 29 StabilizationType stab; 30 MPI_Comm comm = PETSC_COMM_WORLD; 31 PetscBool implicit; 32 PetscBool has_curr_time = PETSC_TRUE; --- 28 unchanged lines hidden (view full) --- 61 problem->print_info = PRINT_EULER_VORTEX; 62 63 // ------------------------------------------------------ 64 // Create the libCEED context 65 // ------------------------------------------------------ 66 CeedScalar vortex_strength = 5.; // - 67 CeedScalar c_tau = 0.5; // - 68 // c_tau = 0.5 is reported as "optimal" in Hughes et al 2010 | 25 void *ctx) { 26 EulerTestType euler_test; 27 SetupContext setup_context = *(SetupContext *)setup_ctx; 28 User user = *(User *)ctx; 29 StabilizationType stab; 30 MPI_Comm comm = PETSC_COMM_WORLD; 31 PetscBool implicit; 32 PetscBool has_curr_time = PETSC_TRUE; --- 28 unchanged lines hidden (view full) --- 61 problem->print_info = PRINT_EULER_VORTEX; 62 63 // ------------------------------------------------------ 64 // Create the libCEED context 65 // ------------------------------------------------------ 66 CeedScalar vortex_strength = 5.; // - 67 CeedScalar c_tau = 0.5; // - 68 // c_tau = 0.5 is reported as "optimal" in Hughes et al 2010 |
| 69 PetscScalar lx = 1000.; // m 70 PetscScalar ly = 1000.; // m 71 PetscScalar lz = 1.; // m | |
| 72 PetscReal center[3], // m 73 mean_velocity[3] = {1., 1., 0}; // m/s | 69 PetscReal center[3], // m 70 mean_velocity[3] = {1., 1., 0}; // m/s |
| 71 PetscReal domain_min[3], domain_max[3], domain_size[3]; 72 ierr = DMGetBoundingBox(dm, domain_min, domain_max); CHKERRQ(ierr); 73 for (int i=0; i<3; i++) domain_size[i] = domain_max[i] - domain_min[i]; |
|
| 74 75 // ------------------------------------------------------ 76 // Create the PETSc context 77 // ------------------------------------------------------ 78 PetscScalar meter = 1e-2; // 1 meter in scaled length units 79 PetscScalar second = 1e-2; // 1 second in scaled time units 80 81 // ------------------------------------------------------ --- 5 unchanged lines hidden (view full) --- 87 ierr = PetscOptionsScalar("-vortex_strength", "Strength of Vortex", 88 NULL, vortex_strength, &vortex_strength, NULL); 89 CHKERRQ(ierr); 90 PetscInt n = problem->dim; 91 PetscBool user_velocity; 92 ierr = PetscOptionsRealArray("-mean_velocity", "Background velocity vector", 93 NULL, mean_velocity, &n, &user_velocity); 94 CHKERRQ(ierr); | 74 75 // ------------------------------------------------------ 76 // Create the PETSc context 77 // ------------------------------------------------------ 78 PetscScalar meter = 1e-2; // 1 meter in scaled length units 79 PetscScalar second = 1e-2; // 1 second in scaled time units 80 81 // ------------------------------------------------------ --- 5 unchanged lines hidden (view full) --- 87 ierr = PetscOptionsScalar("-vortex_strength", "Strength of Vortex", 88 NULL, vortex_strength, &vortex_strength, NULL); 89 CHKERRQ(ierr); 90 PetscInt n = problem->dim; 91 PetscBool user_velocity; 92 ierr = PetscOptionsRealArray("-mean_velocity", "Background velocity vector", 93 NULL, mean_velocity, &n, &user_velocity); 94 CHKERRQ(ierr); |
| 95 ierr = PetscOptionsScalar("-lx", "Length scale in x direction", 96 NULL, lx, &lx, NULL); CHKERRQ(ierr); 97 ierr = PetscOptionsScalar("-ly", "Length scale in y direction", 98 NULL, ly, &ly, NULL); CHKERRQ(ierr); 99 ierr = PetscOptionsScalar("-lz", "Length scale in z direction", 100 NULL, lz, &lz, NULL); CHKERRQ(ierr); | 95 for (int i=0; i<3; i++) center[i] = .5*domain_size[i]; |
| 101 n = problem->dim; | 96 n = problem->dim; |
| 102 center[0] = 0.5 * lx; 103 center[1] = 0.5 * ly; 104 center[2] = 0.5 * lz; | |
| 105 ierr = PetscOptionsRealArray("-center", "Location of vortex center", 106 NULL, center, &n, NULL); CHKERRQ(ierr); 107 ierr = PetscOptionsBool("-implicit", "Use implicit (IFunction) formulation", 108 NULL, implicit=PETSC_FALSE, &implicit, NULL); 109 CHKERRQ(ierr); 110 ierr = PetscOptionsEnum("-euler_test", "Euler test option", NULL, 111 EulerTestTypes, (PetscEnum)(euler_test = EULER_TEST_ISENTROPIC_VORTEX), 112 (PetscEnum *)&euler_test, NULL); CHKERRQ(ierr); --- 30 unchanged lines hidden (view full) --- 143 // ------------------------------------------------------ 144 user->units->meter = meter; 145 user->units->second = second; 146 147 // ------------------------------------------------------ 148 // Set up the libCEED context 149 // ------------------------------------------------------ 150 // -- Scale variables to desired units | 97 ierr = PetscOptionsRealArray("-center", "Location of vortex center", 98 NULL, center, &n, NULL); CHKERRQ(ierr); 99 ierr = PetscOptionsBool("-implicit", "Use implicit (IFunction) formulation", 100 NULL, implicit=PETSC_FALSE, &implicit, NULL); 101 CHKERRQ(ierr); 102 ierr = PetscOptionsEnum("-euler_test", "Euler test option", NULL, 103 EulerTestTypes, (PetscEnum)(euler_test = EULER_TEST_ISENTROPIC_VORTEX), 104 (PetscEnum *)&euler_test, NULL); CHKERRQ(ierr); --- 30 unchanged lines hidden (view full) --- 135 // ------------------------------------------------------ 136 user->units->meter = meter; 137 user->units->second = second; 138 139 // ------------------------------------------------------ 140 // Set up the libCEED context 141 // ------------------------------------------------------ 142 // -- Scale variables to desired units |
| 151 lx = fabs(lx) * meter; 152 ly = fabs(ly) * meter; 153 lz = fabs(lz) * meter; | |
| 154 for (int i=0; i<3; i++) { 155 center[i] *= meter; | 143 for (int i=0; i<3; i++) { 144 center[i] *= meter; |
| 156 mean_velocity[i] = mean_velocity[i] * (meter/second); | 145 domain_size[i] *= meter; 146 mean_velocity[i] *= (meter/second); |
| 157 } | 147 } |
| 148 problem->dm_scale = meter; |
|
| 158 159 // -- Setup Context | 149 150 // -- Setup Context |
| 160 setup_context->lx = lx; 161 setup_context->ly = ly; 162 setup_context->lz = lz; | 151 setup_context->lx = domain_size[0]; 152 setup_context->ly = domain_size[1]; 153 setup_context->lz = domain_size[2]; |
| 163 setup_context->center[0] = center[0]; 164 setup_context->center[1] = center[1]; 165 setup_context->center[2] = center[2]; 166 setup_context->time = 0; 167 168 // -- QFunction Context 169 user->phys->stab = stab; 170 user->phys->euler_test = euler_test; --- 83 unchanged lines hidden --- | 154 setup_context->center[0] = center[0]; 155 setup_context->center[1] = center[1]; 156 setup_context->center[2] = center[2]; 157 setup_context->time = 0; 158 159 // -- QFunction Context 160 user->phys->stab = stab; 161 user->phys->euler_test = euler_test; --- 83 unchanged lines hidden --- |