Saras
Finite   Difference   Solver   for   Fluid   Dynamics   Simulations
sfield.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 SFIELD_H
44#define SFIELD_H
45
46#include "field.h"
47#include "derivative.h"
48
49// Forward declarations of relevant classes
50class plainsf;
51class plainvf;
52class vfield;
53
54class sfield {
55 private:
56 const grid &gridData;
57
58 blitz::Array<real, 3> derivTempF;
59
60 public:
61 field F;
62
65
67 std::string fieldName;
68
69 blitz::Array<real, 3> interTempF;
70
71 sfield(const grid &gridData, std::string fieldName);
72
73 void computeDiff(plainsf &H);
74 void computeNLin(const vfield &V, plainsf &H);
75
76 void gradient(plainvf &gradF, const vfield &V);
77
78 void syncData();
79
82
85
86 sfield& operator *= (real a);
87
88 void operator = (plainsf &a);
89 void operator = (sfield &a);
90 void operator = (real a);
91
92 ~sfield() { };
93};
94
111#endif
Derivative class to perform finite difference operations on the data stored in field.
Definition: derivative.h:53
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
Plain scalar field class to store simple scalar fields with no differentiation or interpolation.
Definition: plainsf.h:51
Plain vector field class to store simple vector fields with no additional operators like differentiat...
Definition: plainvf.h:49
Scalar field class to store and operate on scalar fields.
Definition: sfield.h:54
void operator=(plainsf &a)
Overloaded operator to assign a plain scalar field to the scalar field.
Definition: sfield.cc:284
void gradient(plainvf &gradF, const vfield &V)
Operator to compute the gradient of the scalar field.
Definition: sfield.cc:155
sfield(const grid &gridData, std::string fieldName)
Constructor of the sfield class.
Definition: sfield.cc:62
void syncData()
Function to synchronise data across all processors when performing parallel computations.
Definition: sfield.cc:181
sfield & operator*=(real a)
Overloaded operator to multiply a scalar value to the scalar field.
Definition: sfield.cc:269
derivative derS
derS is an instance of the derivative class used to compute derivatives
Definition: sfield.h:64
std::string fieldName
This string is used to identify the vector field, and is useful in file-writing.
Definition: sfield.h:67
sfield & operator-=(plainsf &a)
Overloaded operator to subtract a given plain scalar field.
Definition: sfield.cc:215
void computeDiff(plainsf &H)
Function to compute the diffusion term.
Definition: sfield.cc:86
void computeNLin(const vfield &V, plainsf &H)
Function to compute the convective derivative of the scalar field.
Definition: sfield.cc:113
sfield & operator+=(plainsf &a)
Overloaded operator to add a given plain scalar field.
Definition: sfield.cc:197
Vector field class to store and operate on vector fields.
Definition: vfield.h:54
Class declaration of derivative.
Class declaration of field.