Saras
Finite   Difference   Solver   for   Fluid   Dynamics   Simulations
derivative.h
Go to the documentation of this file.
1/********************************************************************************************************************************************
2 * Saras
3 *
4 * Copyright (C) 2019, Mahendra K. Verma
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the copyright holder nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 ********************************************************************************************************************************************
31 */
43#ifndef DERIVATIVE_H
44#define DERIVATIVE_H
45
46#include <blitz/array.h>
47#include <blitz/array/stencil-et.h>
48#include <blitz/array/stencilops.h>
49
50#include "field.h"
51#include "grid.h"
52
54 private:
55 const grid &gridData;
56
57 const field &F;
58
59 real ihx, ihy, ihz;
60 real ihx2, ihy2, ihz2;
61
62 blitz::firstIndex i;
63 blitz::secondIndex j;
64 blitz::thirdIndex k;
65
66 blitz::Range fullRange;
67 blitz::Range xRange, yRange, zRange;
68
69 blitz::Array<real, 1> x_Metric, y_Metric, z_Metric;
70 blitz::Array<real, 1> xxMetric, yyMetric, zzMetric;
71 blitz::Array<real, 1> x2Metric, y2Metric, z2Metric;
72
73 blitz::Array<real, 3> tmpArray;
74
75 public:
76 derivative(const grid &gridData, const field &F);
77
78 void calcDerivative1_x(blitz::Array<real, 3> outArray);
79 void calcDerivative1_y(blitz::Array<real, 3> outArray);
80 void calcDerivative1_z(blitz::Array<real, 3> outArray);
81
82 void calcDerivative2xx(blitz::Array<real, 3> outArray);
83 void calcDerivative2yy(blitz::Array<real, 3> outArray);
84 void calcDerivative2zz(blitz::Array<real, 3> outArray);
85};
86
100#endif
Derivative class to perform finite difference operations on the data stored in field.
Definition: derivative.h:53
void calcDerivative1_z(blitz::Array< real, 3 > outArray)
Function to compute the first derivative of the field with respect to z.
Definition: derivative.cc:159
derivative(const grid &gridData, const field &F)
Constructor of the derivative class.
Definition: derivative.cc:61
void calcDerivative1_x(blitz::Array< real, 3 > outArray)
Function to compute the first derivative of the field with respect to x.
Definition: derivative.cc:121
void calcDerivative2zz(blitz::Array< real, 3 > outArray)
Function to compute the second derivatives of the field with respect to z.
Definition: derivative.cc:231
void calcDerivative1_y(blitz::Array< real, 3 > outArray)
Function to compute the first derivative of the field with respect to y.
Definition: derivative.cc:140
void calcDerivative2yy(blitz::Array< real, 3 > outArray)
Function to compute the second derivatives of the field with respect to y.
Definition: derivative.cc:205
void calcDerivative2xx(blitz::Array< real, 3 > outArray)
Function to compute the second derivative of the field with respect to x.
Definition: derivative.cc:178
Field class to store data and perform finite difference operations on the data.
Definition: field.h:52
Contains all the global variables related to the grid, its slices, limits, and grid derivatives used ...
Definition: grid.h:53
Class declaration of field.
Class declaration of grid.