vector3 for block-coupled solution
This commit is contained in:
parent
f7f9afd80b
commit
681e83ac6f
5 changed files with 333 additions and 0 deletions
63
src/VectorN/OpenFOAM/primitives/vector3/diagTensor3.H
Normal file
63
src/VectorN/OpenFOAM/primitives/vector3/diagTensor3.H
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Type
|
||||||
|
diagTensor3
|
||||||
|
|
||||||
|
Description
|
||||||
|
DiagTensorN of 3 scalars.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef diagTensor3_H
|
||||||
|
#define diagTensor3_H
|
||||||
|
|
||||||
|
#include "DiagTensorN.H"
|
||||||
|
#include "vector3.H"
|
||||||
|
#include "sphericalTensor3.H"
|
||||||
|
#include "contiguous.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
typedef DiagTensorN<scalar, 3> diagTensor3;
|
||||||
|
|
||||||
|
//- Specify data associated with diagTensor3 type is contiguous
|
||||||
|
template<>
|
||||||
|
inline bool contiguous<diagTensor3>() {return true;}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
62
src/VectorN/OpenFOAM/primitives/vector3/sphericalTensor3.H
Normal file
62
src/VectorN/OpenFOAM/primitives/vector3/sphericalTensor3.H
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Type
|
||||||
|
sphericalTensor3
|
||||||
|
|
||||||
|
Description
|
||||||
|
SphericalTensorN of 3 scalars.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef sphericalTensor3_H
|
||||||
|
#define sphericalTensor3_H
|
||||||
|
|
||||||
|
#include "SphericalTensorN.H"
|
||||||
|
#include "vector3.H"
|
||||||
|
#include "contiguous.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
typedef SphericalTensorN<scalar, 3> sphericalTensor3;
|
||||||
|
|
||||||
|
//- Specify data associated with sphericalTensor3 type is contiguous
|
||||||
|
template<>
|
||||||
|
inline bool contiguous<sphericalTensor3>() {return true;}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
67
src/VectorN/OpenFOAM/primitives/vector3/tensor3.H
Normal file
67
src/VectorN/OpenFOAM/primitives/vector3/tensor3.H
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Type
|
||||||
|
tensor3
|
||||||
|
|
||||||
|
Description
|
||||||
|
TensorN of 3 scalars.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef tensor3_H
|
||||||
|
#define tensor3_H
|
||||||
|
|
||||||
|
#include "TensorN.H"
|
||||||
|
#include "vector3.H"
|
||||||
|
#include "sphericalTensor3.H"
|
||||||
|
#include "diagTensor3.H"
|
||||||
|
#include "contiguous.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
typedef TensorN<scalar, 3> tensor3;
|
||||||
|
|
||||||
|
//- Specify data associated with tensor3 type is contiguous
|
||||||
|
template<>
|
||||||
|
inline bool contiguous<tensor3>() {return true;}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// Include inline implementations
|
||||||
|
#include "tensor3I.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
75
src/VectorN/OpenFOAM/primitives/vector3/tensor3I.H
Normal file
75
src/VectorN/OpenFOAM/primitives/vector3/tensor3I.H
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Type
|
||||||
|
tensor3
|
||||||
|
|
||||||
|
Description
|
||||||
|
TensorN of 3 scalars.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
//- Return the determinant of a tensor
|
||||||
|
inline scalar det(const tensor3& t)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
t[0]*t[4]*t[8] + t[1]*t[5]*t[6]
|
||||||
|
+ t[2]*t[3]*t[7] - t[0]*t[5]*t[7]
|
||||||
|
- t[1]*t[3]*t[8] - t[2]*t[4]*t[6]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return the inverse of a tensor given the determinant
|
||||||
|
inline tensor3 inv(const tensor3& t)
|
||||||
|
{
|
||||||
|
tensor3 cofactor;
|
||||||
|
|
||||||
|
cofactor[0] = t[4]*t[8] - t[7]*t[5];
|
||||||
|
cofactor[1] = t[6]*t[5] - t[3]*t[8];
|
||||||
|
cofactor[2] = t[3]*t[7] - t[4]*t[6];
|
||||||
|
cofactor[3] = t[2]*t[7] - t[1]*t[8];
|
||||||
|
cofactor[4] = t[0]*t[8] - t[2]*t[6];
|
||||||
|
cofactor[5] = t[1]*t[6] - t[0]*t[7];
|
||||||
|
cofactor[6] = t[1]*t[5] - t[2]*t[4];
|
||||||
|
cofactor[7] = t[3]*t[2] - t[0]*t[5];
|
||||||
|
cofactor[8] = t[0]*t[4] - t[3]*t[1];
|
||||||
|
|
||||||
|
return cofactor/det(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
66
src/VectorN/OpenFOAM/primitives/vector3/vector3.H
Normal file
66
src/VectorN/OpenFOAM/primitives/vector3/vector3.H
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Type
|
||||||
|
Vector3
|
||||||
|
|
||||||
|
Description
|
||||||
|
Vector3 obtained from generic VectorN
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
Vector3.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef Vector3_H
|
||||||
|
#define Vector3_H
|
||||||
|
|
||||||
|
#include "scalar.H"
|
||||||
|
#include "VectorN.H"
|
||||||
|
#include "contiguous.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
typedef VectorN<scalar, 3> vector3;
|
||||||
|
|
||||||
|
|
||||||
|
//- Specify data associated with vector3 type is contiguous
|
||||||
|
template<>
|
||||||
|
inline bool contiguous<vector3>() {return true;}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
Reference in a new issue