Saras
Finite   Difference   Solver   for   Fluid   Dynamics   Simulations
force.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 FORCE_H
44#define FORCE_H
45
46#include <blitz/array.h>
47
48#include "plainvf.h"
49#include "sfield.h"
50#include "vfield.h"
51
52class force {
53 public:
54 force(const grid &mesh, vfield &U);
55
56 virtual void addForcing(plainvf &Hv);
57 virtual void addForcing(plainsf &Ht);
58
59 protected:
60 const grid &mesh;
61
62 vfield &V;
63};
64
73class coriolisForce: public force {
74 public:
75 coriolisForce(const grid &mesh, vfield &U);
76
77 inline void addForcing(plainvf &Hv);
78 inline void addForcing(plainsf &Ht) { };
79 private:
80 real Fr;
81};
82
91class buoyantForce: public force {
92 public:
93 buoyantForce(const grid &mesh, vfield &U, const sfield &T);
94
95 inline void addForcing(plainvf &Hv);
96 inline void addForcing(plainsf &Ht) { };
97 private:
98 real Fb;
99
100 const sfield &T;
101};
102
111class rotatingConv: public force {
112 public:
113 rotatingConv(const grid &mesh, vfield &U, const sfield &T);
114
115 inline void addForcing(plainvf &Hv);
116 inline void addForcing(plainsf &Ht) { };
117 private:
118 real Fb, Fr;
119
120 const sfield &T;
121};
122
131class randomForcing: public force {
132 public:
133 randomForcing(const grid &mesh, vfield &U);
134
135 inline void addForcing(plainvf &Hv);
136 inline void addForcing(plainsf &Ht) { };
137 private:
138 blitz::Array<real, 3> Force_x, Force_y, Force_z;
139};
140
149class constantPGrad: public force {
150 public:
151 constantPGrad(const grid &mesh, vfield &U): force(mesh, U) { };
152
153 inline void addForcing(plainvf &Hv) {Hv.Vx += 1.0;};
154 inline void addForcing(plainsf &Ht) { };
155};
156
165class zeroForcing: public force {
166 public:
167 zeroForcing(const grid &mesh, vfield &U): force(mesh, U) { };
168
169 inline void addForcing(plainvf &Hv) { };
170 inline void addForcing(plainsf &Ht) { };
171};
172
181#endif
The derived class from force to add forcing due to buoyancy to the velocity field in convecting syste...
Definition: force.h:91
void addForcing(plainvf &Hv)
Prototype function to add the forcing field to a plain vector field.
Definition: buoyantForce.cc:59
void addForcing(plainsf &Ht)
Prototype function to add the forcing field to a plain scalar field.
Definition: force.h:96
The derived class from force to add forcing due to constant pressure gradient to the velocity field,...
Definition: force.h:149
void addForcing(plainvf &Hv)
Prototype function to add the forcing field to a plain vector field.
Definition: force.h:153
void addForcing(plainsf &Ht)
Prototype function to add the forcing field to a plain scalar field.
Definition: force.h:154
The derived class from force to add Coriolis forcing to the velocity field in rotating systems.
Definition: force.h:73
void addForcing(plainsf &Ht)
Prototype function to add the forcing field to a plain scalar field.
Definition: force.h:78
void addForcing(plainvf &Hv)
Prototype function to add the forcing field to a plain vector field.
Definition: coriolisForce.cc:50
Contains all the global variables related to the imposing of forcing, and associated functions.
Definition: force.h:52
virtual void addForcing(plainvf &Hv)
Prototype function to add the forcing field to a plain vector field.
Definition: force.cc:69
force(const grid &mesh, vfield &U)
Constructor of the force class.
Definition: force.cc:56
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
The derived class from force to add random forcing to the velocity field.
Definition: force.h:131
void addForcing(plainsf &Ht)
Prototype function to add the forcing field to a plain scalar field.
Definition: force.h:136
void addForcing(plainvf &Hv)
Prototype function to add the forcing field to a plain vector field.
Definition: randomForcing.cc:59
The derived class from force to add forcing due to both buoyancy and rotation to the velocity field i...
Definition: force.h:111
void addForcing(plainvf &Hv)
Prototype function to add the forcing field to a plain vector field.
Definition: rotatingConv.cc:67
void addForcing(plainsf &Ht)
Prototype function to add the forcing field to a plain scalar field.
Definition: force.h:116
Scalar field class to store and operate on scalar fields.
Definition: sfield.h:54
Vector field class to store and operate on vector fields.
Definition: vfield.h:54
The derived class from force to add the default forcing of no forcing.
Definition: force.h:165
void addForcing(plainsf &Ht)
Prototype function to add the forcing field to a plain scalar field.
Definition: force.h:170
void addForcing(plainvf &Hv)
Prototype function to add the forcing field to a plain vector field.
Definition: force.h:169
Class declaration of plainvf - plain vector field.
Class declaration of sfield - scalar field.
Class declaration of vfield - vector field.