Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
gpu_1d_ppm_nonuniform.hpp
Go to the documentation of this file.
1/*
2 * This file is part of Vlasiator.
3 * Copyright 2010-2016 Finnish Meteorological Institute
4 *
5 * For details of usage, see the COPYING file and read the "Rules of the Road"
6 * at http://www.physics.helsinki.fi/vlasiator/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#ifndef GPU_1D_PPM_NU_H
24#define GPU_1D_PPM_NU_H
25
26#include <iostream>
27#include "algorithm"
28#include "cmath"
29
33#include "../definitions.h"
34
35
36/****
37 Define functions for Realf instead of Vec
38***/
39
40ARCH_DEV inline void compute_ppm_coeff_nonuniform(const Realf* __restrict__ const dv, const Realf* __restrict__ const values, face_estimate_order order, int k, Realf a[3], const Realf threshold, const int index, const int stride){
41 Realf m_face; /*left face value*/
42 Realf p_face; /*right face value*/
43 compute_filtered_face_values_nonuniform(dv, values, k, order, m_face, p_face, threshold, index, stride);
44
45 //Coella et al, check for monotonicity
46 m_face = ((p_face - m_face) * (values[k*stride+index] - (Realf)(0.5) * (m_face + p_face)) >
47 (p_face - m_face)*(p_face - m_face) * ((Realf)(1.0)/(Realf)(6.0))) ?
48 (Realf)(3.0) * values[k*stride+index] - (Realf)(2.0) * p_face :
49 m_face;
50 p_face = (-(p_face - m_face) * (p_face - m_face) * ((Realf)(1.0)/(Realf)(6.0))) >
51 (p_face - m_face) * (values[k*stride+index] - (Realf)(0.5) * (m_face + p_face)) ?
52 (Realf)(3.0) * values[k*stride+index] - (Realf)(2.0) * m_face :
53 p_face;
54
55 //Fit a second order polynomial for reconstruction see, e.g., White
56 //2008 (PQM article) (note additional integration factors built in,
57 //contrary to White (2008) eq. 4
58 a[0] = m_face;
59 a[1] = (Realf)(3.0) * values[k*stride+index] - (Realf)(2.0) * m_face - p_face;
60 a[2] = (m_face + p_face - (Realf)(2.0) * values[k*stride+index]);
61}
62
63#endif
#define ARCH_DEV
face_estimate_order
void compute_filtered_face_values_nonuniform(const Realf *const dv, const Vec *const values, const uint k, const face_estimate_order order, Vec &fv_l, Vec &fv_r, const Realf threshold)
float Realf
Definition definitions.h:33
ARCH_DEV void compute_ppm_coeff_nonuniform(const Realf *__restrict__ const dv, const Realf *__restrict__ const values, face_estimate_order order, int k, Realf a[3], const Realf threshold, const int index, const int stride)
__global__ void vmesh::VelocityMesh **__restrict__ ColumnOffsets split::SplitVector< vmesh::GlobalID > Hashinator::Hashmap< vmesh::GlobalID, vmesh::LocalID > const uint *__restrict__ const Realf const int const int const Realf const Realf dv
const int k
__global__ void const Realf const uint *__restrict__ const uint *__restrict__ const vmesh::GlobalID *__restrict__ const uint const uint const uint const Realf threshold
#define index(i, j, k)