Saras
Finite   Difference   Solver   for   Fluid   Dynamics   Simulations
probes.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 PROBES_H
44#define PROBES_H
45
46#include <vector>
47#include <fstream>
48#include <cstddef>
49#include <blitz/array.h>
50#include <mpi.h>
51
52#include "field.h"
53#include "grid.h"
54
64typedef struct dataStruct {
67 int x, y, z;
69
71 real probeData[10];
72
74 dataStruct(): x(0), y(0), z(0) { for (int i=0; i<10; i++) probeData[i] = 0.0; }
76
77class probes {
78 public:
79 probes(const grid &mesh, std::vector<field> &pFields);
80
81 void probeData(real time);
82
83 ~probes();
84
85 private:
86 const grid &mesh;
87
88 std::vector<field> &pFields;
89
90 const unsigned int numFields;
91
92 std::vector<blitz::TinyVector<int, 3> > globalProbes, localProbes;
93
94 std::ofstream probeFile;
95
96 MPI_Datatype mpiStruct;
97
98 void getData(dataStruct *outData);
99 void gatherData(dataStruct *outData);
100
101 void createMPIStruct();
102
103 void placeProbes();
104};
115#endif
Contains all the global variables related to the grid, its slices, limits, and grid derivatives used ...
Definition: grid.h:53
Handles the writing of data from probes placed in the domain.
Definition: probes.h:77
probes(const grid &mesh, std::vector< field > &pFields)
Constructor of the probes class.
Definition: probes.cc:61
void probeData(real time)
Function to read the variables at the probe locations and return them.
Definition: probes.cc:127
Class declaration of field.
Class declaration of grid.
The data obtained from the probes is stored in struct for quick transfer across processes.
Definition: probes.h:64
dataStruct()
Default constructor for the struct that initializes all values to 0.
Definition: probes.h:74
int x
Integer values of the global indices of the probe.
Definition: probes.h:67
real probeData[10]
Array of double/single precision numbers that contains the probed data from up to 10 field variables.
Definition: probes.h:71