Feature: Pre-release fixes for Windows port, update to build instructions and minor bug fixes.

This commit is contained in:
Hrvoje Jasak 2015-09-11 16:16:01 +01:00
commit ca2e6524a9
24 changed files with 593 additions and 433 deletions

View file

@ -23,10 +23,11 @@
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# build.sh
# clean.sh
#
# Description
# Removes previous thirdy-party dependencies build directories (does not remove installed packages directory)
# Removes previous thirdy-party dependencies build directories
# (does not remove installed packages directory)
#
# Author:
# Cesare Guardino, Alstom Power Ltd., (2015)

View file

@ -85,9 +85,9 @@ int main(int argc, char *argv[])
// Mesh motion update
if (meshChanged)
{
T = max(T, TMin);
p = max(p, pMin);
e = max(e, thermo.Cv()*TMin);
T.max(TMin);
p.max(pMin);
e == max(e, thermo.Cv()*TMin);
thermo.correct();
rho = thermo.rho();

View file

@ -23,7 +23,7 @@
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# createReleasePackage.mingw
# createWindowsBinaryPackage
#
# Description
# Creates stand-alone .zip packages for MinGW-based builds on Windows.
@ -36,13 +36,19 @@
cd ${0%/*} || exit 1 # run from this directory
create_package() {
RELEASE_DIR=$1
PACKAGE_DIR=$1
TYPE=$2
PACKAGE_FILE=$RELEASE_DIR.$TYPE
echo ""
PACKAGE_FILE=$PACKAGE_DIR.$TYPE
if [ -f $PACKAGE_FILE ] ; then
echo "Removing previous $PACKAGE_FILE ..."
rm -f $PACKAGE_FILE
fi
echo "Creating $PACKAGE_FILE ..."
7z -t$TYPE a $PACKAGE_FILE $RELEASE_DIR
7z -t$TYPE a $PACKAGE_FILE $PACKAGE_DIR
if [ -f $PACKAGE_FILE ] ; then
echo "Successfully created $PACKAGE_FILE"
@ -52,7 +58,7 @@ create_package() {
}
echo
echo "=========== FOAM-EXTEND WINDOWS STAND-ALONE PACKAGE CREATION SCRIPT ==========="
echo "=========== FOAM-EXTEND STAND-ALONE PACKAGE CREATION SCRIPT FOR WINDOWS ==========="
if [ "$PWD" != "$WM_PROJECT_DIR/bin" ]
then
@ -62,36 +68,43 @@ then
exit 1
fi
RELEASE_DIR=$WM_PROJECT-$WM_FORK-$WM_PROJECT_VERSION-win-x64
MPI_VERSION=`basename $FOAM_MPI_LIBBIN`
if [ -d $RELEASE_DIR ] ; then
echo "Removing previous $RELEASE_DIR"
rm -rf $RELEASE_DIR
RELEASE_DIR=$WM_PROJECT_DIR/releasePackages
if [ ! -d $RELEASE_DIR ] ; then
echo "Creating $RELEASE_DIR ..."
mkdir $RELEASE_DIR
fi
mkdir $RELEASE_DIR
PACKAGE_DIR=$RELEASE_DIR/$WM_PROJECT-$WM_FORK-$WM_PROJECT_VERSION-win-x64
if [ -d $PACKAGE_DIR ] ; then
echo "Removing previous $PACKAGE_DIR ..."
rm -rf $PACKAGE_DIR
fi
echo "Creating $PACKAGE_DIR ..."
mkdir $PACKAGE_DIR
echo "Copying bin directory ..."
cp -rp $FOAM_APPBIN $RELEASE_DIR/bin
cp -rp $FOAM_APPBIN $PACKAGE_DIR/bin
echo "Copying DLLs from lib directory ..."
mkdir $RELEASE_DIR/lib
cp -p $FOAM_LIBBIN/*.dll $RELEASE_DIR/lib
mkdir $RELEASE_DIR/lib/$MPI_VERSION
cp -p $FOAM_MPI_LIBBIN/*.dll $RELEASE_DIR/lib/$MPI_VERSION
mkdir $PACKAGE_DIR/lib
cp -p $FOAM_LIBBIN/*.dll $PACKAGE_DIR/lib
echo "Copying extra files from bin directory ..."
cp -p $WM_PROJECT_DIR/bin/setWindowsEnvironment.bat $PACKAGE_DIR/
cp -p $WM_PROJECT_DIR/bin/foamWindowsShell.bat $PACKAGE_DIR/
cp -p $WM_PROJECT_DIR/bin/paraFoam.bat $PACKAGE_DIR/bin
echo "Copying extra files from etc directory ..."
mkdir $RELEASE_DIR/etc
cp -p $WM_PROJECT_DIR/bin/setWindowsEnvironment.bat $RELEASE_DIR/
cp -p $WM_PROJECT_DIR/bin/foamWindowsShell.bat $RELEASE_DIR/
cp -p $WM_PROJECT_DIR/etc/controlDict-EXAMPLE $RELEASE_DIR/etc
cp -p $WM_PROJECT_DIR/etc/cellModels $RELEASE_DIR/etc
cp -rp $WM_PROJECT_DIR/etc/thermoData $RELEASE_DIR/etc
cp -p $WM_PROJECT_DIR/doc/buildInstructions/Windows/READMEBinaryPackage.txt $RELEASE_DIR/
cp -p $WM_PROJECT_DIR/bin/paraFoam.bat $RELEASE_DIR/bin
cp -p $WM_PROJECT_DIR/COPYING $RELEASE_DIR/LICENSE.txt
unix2dos $RELEASE_DIR/LICENSE.txt
mkdir $PACKAGE_DIR/etc
cp -p $WM_PROJECT_DIR/etc/cellModels $PACKAGE_DIR/etc
cp -rp $WM_PROJECT_DIR/etc/thermoData $PACKAGE_DIR/etc
create_package $RELEASE_DIR zip
#create_package $RELEASE_DIR 7z
echo "Copying doc and license files ..."
cp -p $WM_PROJECT_DIR/doc/buildInstructions/Windows/READMEBinaryPackage.txt $PACKAGE_DIR/
cp -p $WM_PROJECT_DIR/COPYING $PACKAGE_DIR/LICENSE.txt
unix2dos $PACKAGE_DIR/LICENSE.txt
rm -rf $RELEASE_DIR
create_package $PACKAGE_DIR zip
create_package $PACKAGE_DIR 7z
rm -rf $PACKAGE_DIR

View file

@ -37,7 +37,7 @@
It is strongly recommended to install all required systems tools and utilities
in a directory with no embedded white spaces. You can skip some steps if you
already have some of these system tools.
already have the correct tools installed on your system.
2. INSTRUCTIONS FOR BUILDING ON WINDOWS
@ -46,22 +46,32 @@ already have some of these system tools.
1) Download and install 7-Zip (see reference list below). This is necessary to
be able to unzip the rest of the required packages mentioned in later steps.
2) Download and install wget, CMake, Git, MinGW-w64, ParaView and PExports (see
reference list below). Note that some components (example PExports and GMake)
may already be available in other packages (such as Strawberry Perl), although
you need to be careful of the version numbers.
2) Download and install wget, CMake, Git, MinGW-w64, ParaView, PExports, Java,
Subversion, Python (see reference list below). Note that some components
(for example PExports and GMake) may already be available in other packages
(such as Strawberry Perl), although you need to be careful of the
version numbers.
3) Download and install MSYS (see reference list below). If this is your first
use of MSYS, create a file fstab in cMinGW/1.0/etc with single-line contents:
use of MSYS, create a file fstab in c/MinGW/msys/1.0/etc with single-line
contents:
c/mingw /mingw
c:/mingw /mingw
to mount your home directory. From Windows, you will find your home directory
under c:/MinGW/msys/1.0/home/<user name>
to mount your home directory (this assumes you have installed MSYS to the default
c:/MinGW directory).
From Windows, you will find your home directory under
c:/MinGW/msys/1.0/home/<user name>
4) Download the foam-extend source code from http://sourceforge.net/projects/openfoam-extend/
4) Download the foam-extend source code from
5) Open a new MSYS shell and chdir to your foam-extend-3.1 source directory.
http://sourceforge.net/projects/openfoam-extend/
using the command:
git clone --branch nextRelease git://git.code.sf.net/p/openfoam-extend/foam-extend-3.1 foam-extend-3.2
5) Open a new MSYS shell and chdir to your foam-extend-3.2 source directory.
6) Edit the user-modifiable entries in etc/bashrc.mingw to point to the
locations where you have installed the required system tools in the first two
@ -92,9 +102,9 @@ already have some of these system tools.
approach for developers.
(b). From a standard Windows CMD.exe command prompt using the created
foam-extend-3.1-win-x64.zip stand-alone package. This can be used on any
Windows machine without access to MSYS shells or compilers. See the README.txt
contained within the package for further details.
foam-extend-3.2-win-x64.zip stand-alone package. This can be used on any
Windows machine without access to MSYS shells or compilers. See the
READMEBinaryPackage.txt contained within the package for further details.
3. EXTERNAL PACKAGE REFERENCE
@ -115,6 +125,11 @@ Version: 1.9.5
URL : https://git-scm.com/download/win
For : Version control system. Choose "Use Git from the Windows command prompt" and "Check out as-is. Commit as-is" in installer.
Name : Java
Version: Version 8 Update 60
URL : http://www.java.com
For : Not essential
Name : Microsoft Visual C++ 2010 Redistributable Package (x64)
Version: 2010
URL : http://www.microsoft.com/en-us/download/details.aspx?id=14632
@ -147,11 +162,21 @@ Version: 0.44 (or above)
URL : http://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/pexports-0.46/pexports-0.46-mingw32-bin.tar.xz/download
For : Extracting symbols from OpenMPI DLLs to pass to dlltool.exe (supplied in MinGW-w64 package). Move directory "bin" to "pexports-0.46" after unpacking.
Name : Pyhton
Version: 2.7
URL : https://www.python.org/download/releases/2.7/
For : Not essential
Name : Strawberry Perl
Version: 5.20.2.1 (or above)
URL : http://strawberryperl.com/download/5.20.2.1/strawberry-perl-5.20.2.1-64bit.msi
For : Running Perl scripts, "pexports.exe" and "gmake.exe" utilities
Name : Subversion
Version: 1.8.13
URL : http://sourceforge.net/projects/win32svn/files/1.8.13/
For : ??????????
Name : wget
Version: 1.11.4-1 (or above)
URL : http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-bin.zip, http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-dep.zip, http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-doc.zip
@ -160,22 +185,22 @@ For : Automatically downloading files from internet (eg. for use in automated
git clone --branch nextRelease git://git.code.sf.net/p/openfoam-extend/foam-extend-3.1
4. EXAMPLE OUTPUT FROM SOUCING etc/bashrc.mingw
===============================================
4. EXAMPLE OUTPUT FROM SOURCING etc/bashrc.mingw
================================================
$ . etc/bashrc.mingw
Setting environment variables for user-defined installed system tools and utilities ...
Sourcing: /c/Users/UserName/Git/foam-extend-3.1/etc/bashrc
Sourcing: /c/Users/UserName/Git/foam-extend-3.1/etc/prefs.sh.mingw
Sourcing: /c/Users/UserName/Git/foam-extend-3.1/etc/settings.sh
MESQUITE_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.1/ThirdParty/packages/mesquite-2.1.2
METIS_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.1/ThirdParty/packages/metis-5.1.0
PARMETIS_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.1/ThirdParty/packages/parmetis-4.0.3
PARMGRIDGEN_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.1/ThirdParty/packages/ParMGridGen-1.0
Sourcing: /c/Users/UserName/Git/foam-extend-3.2/etc/bashrc
Sourcing: /c/Users/UserName/Git/foam-extend-3.2/etc/prefs.sh.mingw
Sourcing: /c/Users/UserName/Git/foam-extend-3.2/etc/settings.sh
MESQUITE_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.2/ThirdParty/packages/mesquite-2.1.2
METIS_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.2/ThirdParty/packages/metis-5.1.0
PARMETIS_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.2/ThirdParty/packages/parmetis-4.0.3
PARMGRIDGEN_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.2/ThirdParty/packages/ParMGridGen-1.0
LIBCCMIO_DIR is initialized to:
SCOTCH_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.1/ThirdParty/packages/scotch_6.0.0
SCOTCH_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.1/ThirdParty/packages/scotch_6.0.0
SCOTCH_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.2/ThirdParty/packages/scotch_6.0.0
SCOTCH_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.2/ThirdParty/packages/scotch_6.0.0
CMAKE_DIR is initialized to:
M4_DIR is initialized to:
BISON_DIR is initialized to:
@ -183,13 +208,13 @@ Sourcing: /c/Users/UserName/Git/foam-extend-3.1/etc/settings.sh
ZOLTAN_DIR is initialized to:
PYTHON_DIR is initialized to:
PYFOAM_DIR is initialized to:
PYFOAM_SITE_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.1/ThirdParty/PyFoamSiteScripts
PYFOAM_SITE_DIR is initialized to: /c/Users/UserName/Git/foam-extend-3.2/ThirdParty/PyFoamSiteScripts
HWLOC_DIR is initialized to:
QT_DIR is initialized to:
PARAVIEW_DIR is initialized to:
LLVM_DIR is initialized to:
MESA_DIR is initialized to:
Sourcing: /c/Users/UserName/Git/foam-extend-3.1/etc/aliases.sh
Sourcing: /c/Users/UserName/Git/foam-extend-3.2/etc/aliases.sh
Adding user-defined installed system tools to PATH ...
Setting OpenMPI environment settings ...
@ -218,6 +243,6 @@ Wget: /c/Programs/wget-1.11.4-1/bin/wget.exe [GNU Wget 1.11.4 Copyright (
FOAM_INST_DIR=/c/Users/UserName/Git
WM_PROJECT_DIR=/c/Users/UserName/Git/foam-extend-3.1
WM_PROJECT_DIR=/c/Users/UserName/Git/foam-extend-3.2
WM_OSTYPE=MSWindows
ENVIRONMENT SETUP COMPLETE.

View file

@ -22,7 +22,7 @@
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
#
# File
# README_Windows.txt
# READMEBinaryPackage.txt
#
# Description
# Installation and usage instructions for stand-alone Windows builds.

View file

@ -22,10 +22,11 @@
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
#
# File
# etc/prefs.sh
# etc/prefs.sh.mingw
#
# Description
# Preset variables for the FOAM configuration - POSIX shell syntax.
# Preset variables for the FOAM configuration - POSIX shell syntax
# for MS Windows
#
# The prefs.sh file will be sourced by the FOAM etc/bashrc when it is
# found

View file

@ -70,6 +70,33 @@ Foam::scalar Foam::finiteRotation::rotAngle(const tensor& rotT)
}
Foam::vector Foam::finiteRotation::eulerAngles(const tensor& rotT)
{
// Define a vector containing euler angles (x = roll, y = pitch, z = yaw)
vector eulerAngles;
scalar& rollAngle = eulerAngles.x();
scalar& pitchAngle = eulerAngles.y();
scalar& yawAngle = eulerAngles.z();
// Calculate roll angle
rollAngle = atan2(rotT.yz(), rotT.zz());
const scalar c2 = sqrt(rotT.xx() + rotT.xy());
// Calculate pitch angle
pitchAngle = atan2(-rotT.xz(), c2);
const scalar s1 = sin(rollAngle);
const scalar c1 = cos(rollAngle);
// Calculate yaw angle
yawAngle = atan2(s1*rotT.zx() - c1*rotT.yx(), c1*rotT.yy() - s1*rotT.zy());
return eulerAngles;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::finiteRotation::finiteRotation(const HamiltonRodriguezRot& rot)
@ -139,6 +166,12 @@ Foam::scalar Foam::finiteRotation::rotAngle() const
}
Foam::vector Foam::finiteRotation::eulerAngles() const
{
return eulerAngles(rotTensor_);
}
const Foam::tensor& Foam::finiteRotation::rotIncrementTensor() const
{
return rotIncrementTensor_;

View file

@ -69,6 +69,11 @@ class finiteRotation
//- Calculate rotation angle from given rotation tensor
static scalar rotAngle(const tensor& rotT);
//- Calculate Euler angles (x-y-z (roll-pitch-yaw) convenction) from
// given rotation tensor. Reference: Mike Day, Insomniac Games,
// Extracting Euler Angles from a Rotation Matrix.
static vector eulerAngles(const tensor& rotT);
public:
@ -110,6 +115,9 @@ public:
//- Return rotation angle
scalar rotAngle() const;
//- Return Euler angles (see static function eulerAngles for convention)
vector eulerAngles() const;
// Transformations between new and previous rotation
const tensor& rotIncrementTensor() const;

View file

@ -236,6 +236,9 @@ public:
//- Return average velocity of origin for the previous time-step
inline const dimensionedVector& Uaverage() const;
//- Return finite rotation
inline const finiteRotation& rotation() const;
//- Return acceleration of origin
inline dimensionedVector A() const;
@ -246,7 +249,7 @@ public:
inline dimensionedScalar rotAngle() const;
// Non-constant access to
// Non-constant access
//- Set position of origin
inline void setXrel(const vector& x);

View file

@ -172,6 +172,12 @@ const Foam::dimensionedVector& Foam::sixDOFqODE::Uaverage() const
}
const Foam::finiteRotation& Foam::sixDOFqODE::rotation() const
{
return rotation_;
}
Foam::vector Foam::sixDOFqODE::rotVectorAverage() const
{
return rotation_.rotVectorAverage();

View file

@ -9,6 +9,7 @@ EXE_INC = \
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-L$(PARMGRIDGEN_LIB_DIR) -lIMlib -lmgrid
#else
@ -23,6 +24,8 @@ EXE_INC = \
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-L$(PARMGRIDGEN_LIB_DIR) -lIMlib -lMGridGen
#endif
#endif

View file

@ -51,7 +51,8 @@ void basicSymmetryFvPatchField<scalar>::evaluate(const Pstream::commsTypes)
// Local typedefs
typedef scalar Type;
typedef outerProduct<vector, Type>::type gradType;
typedef GeometricField<gradType, Foam::fvPatchField, volMesh> gradFieldType;
typedef GeometricField<gradType, Foam::fvPatchField, volMesh>
gradFieldType;
if (!updated())
{
@ -141,7 +142,8 @@ tmp<vectorField> basicSymmetryFvPatchField<vector>::snGrad() const
// Local typedefs
typedef vector Type;
typedef outerProduct<vector, Type>::type gradType;
typedef GeometricField<gradType, Foam::fvPatchField, volMesh> gradFieldType;
typedef GeometricField<gradType, Foam::fvPatchField, volMesh>
gradFieldType;
vectorField nHat = this->patch().nf();
@ -214,7 +216,8 @@ void basicSymmetryFvPatchField<vector>::evaluate(const Pstream::commsTypes)
// Local typedefs
typedef vector Type;
typedef outerProduct<vector, Type>::type gradType;
typedef GeometricField<gradType, Foam::fvPatchField, volMesh> gradFieldType;
typedef GeometricField<gradType, Foam::fvPatchField, volMesh>
gradFieldType;
if (!updated())
{

View file

@ -38,6 +38,7 @@ SourceFiles
#include "coupledFvPatchField.H"
#include "cyclicLduInterfaceField.H"
#include "cyclicFvPatch.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -159,11 +160,41 @@ public:
//- Transform neighbour field
virtual void transformCoupleField
(
scalarField& f,
scalarField& pnf,
const direction cmpt
) const
{
cyclicLduInterfaceField::transformCoupleField(f, cmpt);
// See comments in cyclicLduInterfaceField
// HJ, 3/Sep/2015
// cyclicLduInterfaceField::transformCoupleField(pnf, cmpt);
if (doTransform())
{
label sizeby2 = pnf.size()/2;
Type powFwdTransform = transform
(
this->forwardT()[0],
pTraits<Type>::one
);
scalar forwardScale =
pow(component(powFwdTransform, cmpt), rank());
Type powRevTransform = transform
(
this->reverseT()[0],
pTraits<Type>::one
);
scalar reverseScale =
pow(component(powRevTransform, cmpt), rank());
for (label facei = 0; facei < sizeby2; facei++)
{
pnf[facei] *= forwardScale;
pnf[facei + sizeby2] *= reverseScale;
}
}
}
//- Update result field based on interface functionality

View file

@ -172,7 +172,10 @@ template<class Type>
tmp<scalarField> advectiveFvPatchField<Type>::advectionSpeed() const
{
const surfaceScalarField& phi =
this->db().objectRegistry::template lookupObject<surfaceScalarField>(phiName_);
this->db().objectRegistry::template lookupObject<surfaceScalarField>
(
phiName_
);
fvsPatchField<scalar> phip = this->lookupPatchField
(

View file

@ -26,11 +26,16 @@ License
#include "fvBlockMatrix.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
template<class fieldType>
void Foam::fvBlockMatrix<Type>::insertSolutionVector
void fvBlockMatrix<Type>::insertSolutionVector
(
const direction dir,
const Field<fieldType>& xSingle
@ -59,7 +64,7 @@ void Foam::fvBlockMatrix<Type>::insertSolutionVector
template<class Type>
template<class matrixType>
void Foam::fvBlockMatrix<Type>::insertDiagSource
void fvBlockMatrix<Type>::insertDiagSource
(
const direction dir,
fvMatrix<matrixType>& matrix
@ -162,7 +167,7 @@ void Foam::fvBlockMatrix<Type>::insertDiagSource
template<class Type>
template<class matrixType>
void Foam::fvBlockMatrix<Type>::insertUpperLower
void fvBlockMatrix<Type>::insertUpperLower
(
const direction dir,
const fvMatrix<matrixType>& matrix
@ -290,7 +295,7 @@ void Foam::fvBlockMatrix<Type>::insertUpperLower
template<class Type>
template<class matrixType>
void Foam::fvBlockMatrix<Type>::updateCouplingCoeffs
void fvBlockMatrix<Type>::updateCouplingCoeffs
(
const direction dir,
const fvMatrix<matrixType>& matrix
@ -563,7 +568,7 @@ void Foam::fvBlockMatrix<Type>::insertBoundaryContributions
template<class Type>
void Foam::fvBlockMatrix<Type>::insertCouplingDiag
void fvBlockMatrix<Type>::insertCouplingDiag
(
const direction dirI,
const direction dirJ,
@ -586,7 +591,7 @@ void Foam::fvBlockMatrix<Type>::insertCouplingDiag
template<class Type>
void Foam::fvBlockMatrix<Type>::insertCouplingUpperLower
void fvBlockMatrix<Type>::insertCouplingUpperLower
(
const direction dirI,
const direction dirJ,
@ -673,7 +678,7 @@ void Foam::fvBlockMatrix<Type>::insertCouplingUpperLower
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::fvBlockMatrix<Type>::fvBlockMatrix
fvBlockMatrix<Type>::fvBlockMatrix
(
GeometricField<Type, fvPatchField, volMesh>& psi
)
@ -686,7 +691,7 @@ Foam::fvBlockMatrix<Type>::fvBlockMatrix
template<class Type>
Foam::fvBlockMatrix<Type>::fvBlockMatrix
fvBlockMatrix<Type>::fvBlockMatrix
(
const fvBlockMatrix<Type>& bxs
)
@ -700,7 +705,7 @@ Foam::fvBlockMatrix<Type>::fvBlockMatrix
template<class Type>
template<class fieldType>
void Foam::fvBlockMatrix<Type>::retrieveSolution
void fvBlockMatrix<Type>::retrieveSolution
(
const direction dir,
Field<fieldType>& xSingle
@ -729,7 +734,7 @@ void Foam::fvBlockMatrix<Type>::retrieveSolution
template<class Type>
template<class matrixType>
void Foam::fvBlockMatrix<Type>::insertEquation
void fvBlockMatrix<Type>::insertEquation
(
const direction dir,
fvMatrix<matrixType>& matrix
@ -744,7 +749,7 @@ void Foam::fvBlockMatrix<Type>::insertEquation
template<class Type>
template<class blockType, class fieldType>
void Foam::fvBlockMatrix<Type>::insertBlockCoupling
void fvBlockMatrix<Type>::insertBlockCoupling
(
const direction dirI,
const direction dirJ,
@ -773,7 +778,7 @@ void Foam::fvBlockMatrix<Type>::insertEquationCoupling
template<class Type>
void Foam::fvBlockMatrix<Type>::blockAdd
void fvBlockMatrix<Type>::blockAdd
(
const direction dir,
const scalarField& xSingle,
@ -822,7 +827,7 @@ void Foam::fvBlockMatrix<Type>::updateSourceCoupling()
template<class Type>
Foam::BlockSolverPerformance<Type> Foam::fvBlockMatrix<Type>::solve
BlockSolverPerformance<Type> fvBlockMatrix<Type>::solve
(
const dictionary& solverControls
)
@ -844,7 +849,7 @@ Foam::BlockSolverPerformance<Type> Foam::fvBlockMatrix<Type>::solve
template<class Type>
Foam::BlockSolverPerformance<Type> Foam::fvBlockMatrix<Type>::solve()
BlockSolverPerformance<Type> fvBlockMatrix<Type>::solve()
{
return solve(psi_.mesh().solutionDict().solverDict(psi_.name()));
}
@ -853,7 +858,7 @@ Foam::BlockSolverPerformance<Type> Foam::fvBlockMatrix<Type>::solve()
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
Ostream& operator<<
(
Ostream& os,
const fvBlockMatrix<Type>& bxs
@ -866,4 +871,8 @@ Foam::Ostream& Foam::operator<<
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -24,7 +24,7 @@ License
Author
Martin Beaudoin, Hydro-Quebec, (2008)
\*----------------------------------------------------------------------------*/
\*---------------------------------------------------------------------------*/
#include "SutherlandHodgman.H"
@ -157,8 +157,8 @@ Foam::SutherlandHodgman::SutherlandHodgman
Foam::List<Foam::point2D> Foam::SutherlandHodgman::evaluate()
{
DynamicList<point2D> clippedPolygon(0);
DynamicList<bool> clippedVertexInside(0);
DynamicList<point2D, 8> clippedPolygon(0);
DynamicList<bool, 8> clippedVertexInside(0);
point2D interSectPt;
label S = subjectPolygon_.size() - 1;
@ -249,7 +249,7 @@ Foam::List<Foam::point2D> Foam::SutherlandHodgman::evaluate()
// Are we done?
if (currentClipEdgeP2_ < clippingPolygon_.size())
{
//clip against next edge, re-entrant.
// Clip against next edge, re-entrant.
evaluate();
}

View file

@ -270,11 +270,6 @@ void GGIInterpolation<MasterPatch, SlavePatch>::calcAddressing() const
<< "This is strange..." << endl;
}
// The master face neighbours polygons projected in the plane UV
// We will only keep the ones with some area overlap
DynamicList<List<point2D> > masterNeighFace2DPolygonInUV;
DynamicList<scalarField> masterNeighFace2DPolygonInUVErrorProjection;
// Next, project the candidate master neighbours faces points
// onto the same plane using the new orthonormal basis
const labelList& curCMN = candidateMasterNeighbors[faceMi];
@ -614,7 +609,7 @@ GGIInterpolation<MasterPatch, SlavePatch>::findNonOverlappingFaces
tmp<labelField> tpatchFaceNonOverlapAddr(new labelField());
labelField& patchFaceNonOverlapAddr = tpatchFaceNonOverlapAddr();
DynamicList<label> patchFaceNonOverlap(patchWeights.size());
DynamicList<label, 64> patchFaceNonOverlap(patchWeights.size());
// Scan the list of patch weights, looking for empty lists
forAll (patchWeights, paWi)

View file

@ -52,13 +52,31 @@ void Foam::cyclicLduInterfaceField::transformCoupleField
{
label sizeby2 = pnf.size()/2;
//HJ This is wrong
// For a vector, the implicit contribution is correct:
// power of diagonal of the transformation tensor for the vector
// For a tensor this is wrong: the diag of transformation tensor
// is a vector and I am asking for a component cmpt which corresponds
// to the component of the variable I am offering. If the variable
// is a tensor, it has got 6 or 9 components, so the component
// access is out of range and rubbish anyway
// The forwardScale/reverseScale should be the power of the complete
// transformation matrix for a tensor. Something like:
// Type powTransform = transform(pTraits<Type>::one);
// forwardScale = pow(powTransform.component(cmpt), rank());
// This needs to be moved under templating into cyclicFvPatchField
// because it requires access to Type
// HJ, 3/Sep/2015
scalar forwardScale =
pow(diag(forwardT()[0]).component(cmpt), rank());
scalar reverseScale =
pow(diag(reverseT()[0]).component(cmpt), rank());
for (label facei=0; facei<sizeby2; facei++)
for (label facei = 0; facei < sizeby2; facei++)
{
pnf[facei] *= forwardScale;
pnf[facei + sizeby2] *= reverseScale;

View file

@ -1,235 +1,240 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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 3 of the License, or (at your
option) any later version.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::octreeDataTriSurface
Description
Encapsulates data for octree searches on triSurface.
SourceFiles
octreeDataTriSurface.C
\*---------------------------------------------------------------------------*/
#ifndef octreeDataTriSurface_H
#define octreeDataTriSurface_H
#include "treeBoundBoxList.H"
#include "labelList.H"
#include "point.H"
#include "triSurface.H"
#include "linePointRef.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class Type> class octree;
/*---------------------------------------------------------------------------*\
Class octreeDataTriSurface Declaration
\*---------------------------------------------------------------------------*/
class octreeDataTriSurface
{
// Static data
//- tolerance on linear dimensions
static scalar tol;
// Private data
const triSurface& surface_;
const treeBoundBoxList allBb_;
// Extra data to speed up distance searches.
// Triangles expressed as base + spanning vectors
pointField base_;
pointField E0_;
pointField E1_;
scalarList a_;
scalarList b_;
scalarList c_;
// Private Static Functions
//- fast triangle nearest point calculation. Returns point in E0, E1
// coordinate system: base + s*E0 + t*E1
static void nearestCoords
(
const point& base,
const point& E0,
const point& E1,
const scalar a,
const scalar b,
const scalar c,
const point& P,
scalar& s,
scalar& t
);
//- Calculate bounding boxes for triangles
static treeBoundBoxList calcBb(const triSurface&);
// Private Member Functions
//- nearest point in xyz coord system
point nearestPoint(const label index, const point& P) const;
public:
// Declare name of the class and its debug switch
ClassName("octreeDataTriSurface");
// Constructors
//- Construct from triSurface. Holds reference. Bounding box
// calculated from triangle points.
octreeDataTriSurface(const triSurface&);
//- Construct from triSurface and bounding box.
// Holds references.
octreeDataTriSurface(const triSurface&, const treeBoundBoxList&);
// Member Functions
// Access
const triSurface& surface() const
{
return surface_;
}
const treeBoundBoxList& allBb() const
{
return allBb_;
}
label size() const
{
return allBb_.size();
}
// Search
//- Get type of sample
label getSampleType
(
const octree<octreeDataTriSurface>&,
const point&
) const;
//- Does (bb of) shape at index overlap bb
bool overlaps
(
const label index,
const treeBoundBox& sampleBb
) const;
//- Does shape at index contain sample
bool contains
(
const label index,
const point& sample
) const;
//- Segment (from start to end) intersection with shape
// at index. If intersects returns true and sets intersectionPoint
bool intersects
(
const label index,
const point& start,
const point& end,
point& intersectionPoint
) const;
//- Sets newTightest to bounding box (and returns true) if
// nearer to sample than tightest bounding box. Otherwise
// returns false.
bool findTightest
(
const label index,
const point& sample,
treeBoundBox& tightest
) const;
//- Given index get unit normal and calculate (numerical) sign
// of sample.
// Used to determine accuracy of calcNearest or inside/outside.
scalar calcSign
(
const label index,
const point& sample,
vector& n
) const;
//- Calculates nearest (to sample) point in shape.
// Returns point and mag(nearest - sample)
scalar calcNearest
(
const label index,
const point& sample,
point& nearest
) const;
//- Calculates nearest (to line segment) point in shape.
// Returns distance and both point.
scalar calcNearest
(
const label index,
const linePointRef& ln,
point& linePt, // nearest point on line
point& shapePt // nearest point on shape
) const;
// Write
// Write shape at index
void write(Ostream& os, const label index) const;
// IOstream Operators
friend Istream& operator>>(Istream&, octreeDataTriSurface&);
friend Ostream& operator<<(Ostream&, const octreeDataTriSurface&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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 3 of the License, or (at your
option) any later version.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::octreeDataTriSurface
Description
Encapsulates data for octree searches on triSurface.
SourceFiles
octreeDataTriSurface.C
\*---------------------------------------------------------------------------*/
#ifndef octreeDataTriSurface_H
#define octreeDataTriSurface_H
#include "treeBoundBoxList.H"
#include "labelList.H"
#include "point.H"
#include "triSurface.H"
#include "linePointRef.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class Type> class octree;
/*---------------------------------------------------------------------------*\
Class octreeDataTriSurface Declaration
\*---------------------------------------------------------------------------*/
class octreeDataTriSurface
{
// Static data
//- tolerance on linear dimensions
static scalar tol;
// Private data
const triSurface& surface_;
const treeBoundBoxList allBb_;
// Extra data to speed up distance searches.
// Triangles expressed as base + spanning vectors
pointField base_;
pointField E0_;
pointField E1_;
scalarList a_;
scalarList b_;
scalarList c_;
// Private Static Functions
//- fast triangle nearest point calculation. Returns point in E0, E1
// coordinate system: base + s*E0 + t*E1
static void nearestCoords
(
const point& base,
const point& E0,
const point& E1,
const scalar a,
const scalar b,
const scalar c,
const point& P,
scalar& s,
scalar& t
);
//- Calculate bounding boxes for triangles
static treeBoundBoxList calcBb(const triSurface&);
// Private Member Functions
//- nearest point in xyz coord system
point nearestPoint(const label index, const point& P) const;
public:
// Declare name of the class and its debug switch
ClassName("octreeDataTriSurface");
// Constructors
//- Construct from triSurface. Holds reference. Bounding box
// calculated from triangle points.
octreeDataTriSurface(const triSurface&);
//- Construct from triSurface and bounding box.
// Holds references.
octreeDataTriSurface(const triSurface&, const treeBoundBoxList&);
// Member Functions
// Access
const triSurface& surface() const
{
return surface_;
}
const treeBoundBoxList& allBb() const
{
return allBb_;
}
label size() const
{
return allBb_.size();
}
// Search
//- Get type of sample
label getSampleType
(
const octree<octreeDataTriSurface>&,
const point&
) const;
//- Does (bb of) shape at index overlap bb
bool overlaps
(
const label index,
const treeBoundBox& sampleBb
) const;
//- Does shape at index contain sample
bool contains
(
const label index,
const point& sample
) const;
//- Segment (from start to end) intersection with shape
// at index. If intersects returns true and sets intersectionPoint
bool intersects
(
const label index,
const point& start,
const point& end,
point& intersectionPoint
) const;
//- Sets newTightest to bounding box (and returns true) if
// nearer to sample than tightest bounding box. Otherwise
// returns false.
bool findTightest
(
const label index,
const point& sample,
treeBoundBox& tightest
) const;
//- Given index get unit normal and calculate (numerical) sign
// of sample.
// Used to determine accuracy of calcNearest or inside/outside.
scalar calcSign
(
const label index,
const point& sample,
vector& n
) const;
//- Calculates nearest (to sample) point in shape.
// Returns point and mag(nearest - sample)
scalar calcNearest
(
const label index,
const point& sample,
point& nearest
) const;
//- Calculates nearest (to line segment) point in shape.
// Returns distance and both point.
scalar calcNearest
(
const label index,
const linePointRef& ln,
point& linePt, // nearest point on line
point& shapePt // nearest point on shape
) const;
// Write
// Write shape at index
void write(Ostream& os, const label index) const;
// IOstream Operators
friend Istream& operator>>(Istream&, octreeDataTriSurface&);
friend Ostream& operator<<(Ostream&, const octreeDataTriSurface&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "octreeDataTriSurfaceTreeLeaf.H"
#endif
// ************************************************************************* //

View file

@ -1,83 +1,83 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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 3 of the License, or (at your
option) any later version.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "octreeDataTriSurfaceTreeLeaf.H"
#include "octreeDataTriSurface.H"
// * * * * * * * * * * * * * Template Specialisations * * * * * * * * * * * //
template<>
bool Foam::treeLeaf<Foam::octreeDataTriSurface>::findNearest
(
const octreeDataTriSurface& shapes,
const point& sample,
treeBoundBox& tightest,
label& tightestI,
scalar& tightestDist
) const
{
// Some aliases
const treeBoundBoxList& allBb = shapes.allBb();
point& min = tightest.min();
point& max = tightest.max();
point nearest;
bool changed = false;
forAll(indices_, i)
{
label faceI = indices_[i];
// Quick rejection test.
if (tightest.overlaps(allBb[faceI]))
{
// Full calculation
scalar dist = shapes.calcNearest(faceI, sample, nearest);
if (dist < tightestDist)
{
// Update bb (centered around sample, span is dist)
min.x() = sample.x() - dist;
min.y() = sample.y() - dist;
min.z() = sample.z() - dist;
max.x() = sample.x() + dist;
max.y() = sample.y() + dist;
max.z() = sample.z() + dist;
tightestI = faceI;
tightestDist = dist;
changed = true;
}
}
}
return changed;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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 3 of the License, or (at your
option) any later version.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "octreeDataTriSurface.H"
#include "octreeDataTriSurfaceTreeLeaf.H"
// * * * * * * * * * * * * * Template Specialisations * * * * * * * * * * * //
template<>
bool Foam::treeLeaf<Foam::octreeDataTriSurface>::findNearest
(
const octreeDataTriSurface& shapes,
const point& sample,
treeBoundBox& tightest,
label& tightestI,
scalar& tightestDist
) const
{
// Some aliases
const treeBoundBoxList& allBb = shapes.allBb();
point& min = tightest.min();
point& max = tightest.max();
point nearest;
bool changed = false;
forAll(indices_, i)
{
label faceI = indices_[i];
// Quick rejection test.
if (tightest.overlaps(allBb[faceI]))
{
// Full calculation
scalar dist = shapes.calcNearest(faceI, sample, nearest);
if (dist < tightestDist)
{
// Update bb (centered around sample, span is dist)
min.x() = sample.x() - dist;
min.y() = sample.y() - dist;
min.z() = sample.z() - dist;
max.x() = sample.x() + dist;
max.y() = sample.y() + dist;
max.z() = sample.z() + dist;
tightestI = faceI;
tightestDist = dist;
changed = true;
}
}
}
return changed;
}
// ************************************************************************* //

View file

@ -45,7 +45,7 @@ namespace Foam
// Forward declaration of classes
class octreeDataTriSurface;
template<> inline
template<>
bool treeLeaf<octreeDataTriSurface>::findNearest
(
const octreeDataTriSurface& shapes,

View file

@ -2,4 +2,5 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lfoam \
-lfiniteVolume

View file

@ -32,6 +32,8 @@ License
#include "polyBoundaryMesh.H"
#include "polyMesh.H"
#include "surfMesh.H"
#include "Xfer.H"
#include "surfZone.H"
#include "primitivePatch.H"
#include "addToRunTimeSelectionTable.H"
@ -170,9 +172,9 @@ Foam::MeshedSurface<Face>::MeshedSurface()
template<class Face>
Foam::MeshedSurface<Face>::MeshedSurface
(
const Xfer< pointField >& pointLst,
const Xfer< List<Face> >& faceLst,
const Xfer< surfZoneList >& zoneLst
const Xfer<pointField >& pointLst,
const Xfer<List<Face> >& faceLst,
const Xfer<surfZoneList>& zoneLst
)
:
ParentType(List<Face>(), pointField()),
@ -185,8 +187,8 @@ Foam::MeshedSurface<Face>::MeshedSurface
template<class Face>
Foam::MeshedSurface<Face>::MeshedSurface
(
const Xfer< pointField >& pointLst,
const Xfer< List<Face> >& faceLst,
const Xfer<pointField>& pointLst,
const Xfer<List<Face> >& faceLst,
const UList<label>& zoneSizes,
const UList<word>& zoneNames
)
@ -534,17 +536,17 @@ void Foam::MeshedSurface<Face>::reset
// Take over new primitive data.
// Optimized to avoid overwriting data at all
if (!pointLst().empty())
if (!pointLst->empty())
{
storedPoints().transfer(pointLst());
}
if (!faceLst().empty())
if (!faceLst->empty())
{
storedFaces().transfer(faceLst());
}
if (!zoneLst().empty())
if (!zoneLst->empty())
{
storedZones().transfer(zoneLst());
}
@ -554,26 +556,26 @@ void Foam::MeshedSurface<Face>::reset
template<class Face>
void Foam::MeshedSurface<Face>::reset
(
const Xfer< List<point> >& pointLst,
const Xfer< List<Face> >& faceLst,
const Xfer< surfZoneList >& zoneLst
const Xfer<List<point> >& pointLst,
const Xfer<List<Face> >& faceLst,
const Xfer<surfZoneList>& zoneLst
)
{
ParentType::clearOut();
// Take over new primitive data.
// Optimized to avoid overwriting data at all
if (!pointLst().empty())
if (!pointLst->empty())
{
storedPoints().transfer(pointLst());
}
if (!faceLst().empty())
if (!faceLst->empty())
{
storedFaces().transfer(faceLst());
}
if (!zoneLst().empty())
if (!zoneLst->empty())
{
storedZones().transfer(zoneLst());
}

View file

@ -446,7 +446,7 @@ void LaunderGibsonRSTM::correct()
// Change for consistency with Fluent implementation.
// Emil Baric, NUMAP-FOAM 2011
// HJ, 13/Dec/2011
- Clg2_*(dev(P) - dev(C))
- Clg2_*(rho_*dev(P) - dev(C))
// wall reflection terms
+ symm