/* This file is part of the OpenLB library
*
* Copyright (C) 2013, 2015 Gilles Zahnd, Mathias J. Krause
* Marie-Luise Maier
* E-mail contact: info@openlb.net
* The most recent release of OpenLB can be downloaded at
* <http://www.openlb.net/>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FRAME_CHANGE_F_3D_HH
#define FRAME_CHANGE_F_3D_HH
#include<cmath>
#include "frameChangeF3D.h"
#include "frameChangeF2D.h"
#include "core/superLattice3D.h"
#include "dynamics/lbHelpers.h" // for computation of lattice rho and velocity
#include "utilities/vectorHelpers.h" // for normalize
#include "geometry/superGeometry3D.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
namespace olb {
template <typename T>
RotatingLinear3D<T>::RotatingLinear3D(std::vector<T> axisPoint_,
std::vector<T> axisDirection_, T w_, T scale_)
: AnalyticalF3D<T,T>(3), axisPoint(axisPoint_), axisDirection(axisDirection_),
w(w_), scale(scale_) { }
template <typename T>
bool RotatingLinear3D<T>::operator()(T output[], const T x[])
{
output[0] = (axisDirection[1]*(x[2]-axisPoint[2]) - axisDirection[2]*(x[1]-axisPoint[1]))*w*scale;
output[1] = (axisDirection[2]*(x[0]-axisPoint[0]) - axisDirection[0]*(x[2]-axisPoint[2]))*w*scale;
output[2] = (axisDirection[0]*(x[1]-axisPoint[1]) - axisDirection[1]*(x[0]-axisPoint[0]))*w*scale;
return true;
}
template <typename T>
RotatingLinearAnnulus3D<T>::RotatingLinearAnnulus3D(std::vector<T> axisPoint_,
std::vector<T> axisDirection_, T w_, T ri_, T ro_, T scale_)
: AnalyticalF3D<T,T>(3), axisPoint(axisPoint_), axisDirection(axisDirection_),
w(w_), ri(ri_), ro(ro_), scale(scale_) { }
template <typename T>
bool RotatingLinearAnnulus3D<T>::operator()(T output[], const T x[])
{
if ( (sqrt((x[0]-axisPoint[0])*(x[0]-axisPoint[0])+(x[1]-axisPoint[1])*(x[1]-axisPoint[1])) < ri) || (sqrt((x[0]-axisPoint[0])*(x[0]-axisPoint[0])+(x[1]-axisPoint[1])*(x[1]-axisPoint[1])) >= ro) ) {
output[0] = 0.;
output[1] = 0.;
output[2] = 0.;
}
else {
T L[3];
T si[3];
T so[3];
int sign1 = 1;
int sign2 = 1;
if ( (axisDirection[2] && (x[0] == axisPoint[0])) || (axisDirection[1] &&<