diff --git a/ThirdParty/AllMake.stage1 b/ThirdParty/AllMake.stage1 index c17f636ef..2acd5e86b 100755 --- a/ThirdParty/AllMake.stage1 +++ b/ThirdParty/AllMake.stage1 @@ -62,22 +62,35 @@ echo # Gcc and companion libraries # -# Uncomment the following 3 lines for gcc-4.4.5. You need gmp and mpfr for gcc-4.4.5 -#( rpm_make -p gmp-5.0.1 -s gmp-5.0.1.spec -u ftp://ftp.gnu.org/gnu/gmp/gmp-5.0.1.tar.gz ) -#( rpm_make -p mpfr-3.0.1 -s mpfr-3.0.1.spec -u ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.0.1.tar.gz ) -#( rpm_make -p gcc-4.4.5 -s gcc-4.4.5.spec -u ftp://ftp.gnu.org/gnu/gcc/gcc-4.4.5/gcc-4.4.5.tar.gz ) +# Uncomment the following 4 lines for gcc-4.9.2. You need gmp, mpfr and mpc for gcc-4.9.2 +#( rpm_make -p gmp-5.1.2 -s gmp-5.1.2.spec -u ftp://ftp.gnu.org/gnu/gmp/gmp-5.1.2.tar.bz2 ) +#( rpm_make -p mpfr-3.1.2 -s mpfr-3.1.2.spec -u ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.2.tar.gz ) +#( rpm_make -p mpc-1.0.1 -s mpc-1.0.1.spec -u http://www.multiprecision.org/mpc/download/mpc-1.0.1.tar.gz ) +#( rpm_make -p gcc-4.9.2 -s gcc-4.9.2.spec -u ftp://ftp.gnu.org/gnu/gcc/gcc-4.9.2/gcc-4.9.2.tar.gz ) +# +# Uncomment the following 4 lines for gcc-4.7.4. You need gmp, mpfr and mpc for gcc-4.7.4 +#( rpm_make -p gmp-5.1.2 -s gmp-5.1.2.spec -u ftp://ftp.gnu.org/gnu/gmp/gmp-5.1.2.tar.bz2 ) +#( rpm_make -p mpfr-3.1.2 -s mpfr-3.1.2.spec -u ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.2.tar.gz ) +#( rpm_make -p mpc-1.0.1 -s mpc-1.0.1.spec -u http://www.multiprecision.org/mpc/download/mpc-1.0.1.tar.gz ) +#( rpm_make -p gcc-4.7.4 -s gcc-4.7.4.spec -u ftp://ftp.gnu.org/gnu/gcc/gcc-4.7.4/gcc-4.7.4.tar.gz ) +# +# Uncomment the following 4 lines for gcc-4.6.4. You need gmp, mpfr and mpc for gcc-4.6.4 +#( rpm_make -p gmp-5.1.2 -s gmp-5.1.2.spec -u ftp://ftp.gnu.org/gnu/gmp/gmp-5.1.2.tar.bz2 ) +#( rpm_make -p mpfr-3.1.2 -s mpfr-3.1.2.spec -u ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.2.tar.gz ) +#( rpm_make -p mpc-1.0.1 -s mpc-1.0.1.spec -u http://www.multiprecision.org/mpc/download/mpc-1.0.1.tar.gz ) +#( rpm_make -p gcc-4.6.4 -s gcc-4.6.4.spec -u ftp://ftp.gnu.org/gnu/gcc/gcc-4.6.4/gcc-4.6.4.tar.gz ) # # Uncomment the following 4 lines for gcc-4.5.1. You need gmp, mpfr and mpc for gcc-4.5.1 #( rpm_make -p gmp-5.0.1 -s gmp-5.0.1.spec -u ftp://ftp.gnu.org/gnu/gmp/gmp-5.0.1.tar.gz ) #( rpm_make -p mpfr-3.0.1 -s mpfr-3.0.1.spec -u ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.0.1.tar.gz ) #( rpm_make -p mpc-0.8.2 -s mpc-0.8.2.spec -u http://www.multiprecision.org/mpc/download/mpc-0.8.2.tar.gz ) #( rpm_make -p gcc-4.5.1 -s gcc-4.5.1.spec -u ftp://ftp.gnu.org/gnu/gcc/gcc-4.5.1/gcc-4.5.1.tar.gz ) - -# Uncomment the following 4 lines for gcc-4.6.3. You need gmp, mpfr and mpc for gcc-4.6.3 -#( rpm_make -p gmp-5.0.5 -s gmp-5.0.5.spec -u ftp://ftp.gnu.org/gnu/gmp/gmp-5.0.5.tar.bz2 ) -#( rpm_make -p mpfr-3.1.0 -s mpfr-3.1.0.spec -u ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.0.tar.gz ) -#( rpm_make -p mpc-0.9 -s mpc-0.9.spec -u http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz ) -#( rpm_make -p gcc-4.6.3 -s gcc-4.6.3.spec -u ftp://ftp.gnu.org/gnu/gcc/gcc-4.6.3/gcc-4.6.3.tar.gz ) +# +# Uncomment the following 3 lines for gcc-4.4.5. You need gmp and mpfr for gcc-4.4.5 +#( rpm_make -p gmp-5.0.1 -s gmp-5.0.1.spec -u ftp://ftp.gnu.org/gnu/gmp/gmp-5.0.1.tar.gz ) +#( rpm_make -p mpfr-3.0.1 -s mpfr-3.0.1.spec -u ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.0.1.tar.gz ) +#( rpm_make -p gcc-4.4.5 -s gcc-4.4.5.spec -u ftp://ftp.gnu.org/gnu/gcc/gcc-4.4.5/gcc-4.4.5.tar.gz ) +# # Python #( rpm_make -p Python-2.7 -s Python-2.7.spec -u http://www.python.org/ftp/python/2.7/Python-2.7.tgz ) diff --git a/ThirdParty/rpmBuild/SOURCES/ParaView-4.2.0.patch_darwin b/ThirdParty/rpmBuild/SOURCES/ParaView-4.2.0.patch_darwin new file mode 100644 index 000000000..86ebab700 --- /dev/null +++ b/ThirdParty/rpmBuild/SOURCES/ParaView-4.2.0.patch_darwin @@ -0,0 +1,12 @@ +diff -ruN ParaView-4.2.0_orig/Applications/ParaView-4.2.0_extra_install_Darwin.cmake ParaView-4.2.0/Applications/ParaView-4.2.0_extra_install_Darwin.cmake +--- ParaView-4.2.0_orig/Applications/ParaView-4.2.0_extra_install_Darwin.cmake 1969-12-31 19:00:00.000000000 -0500 ++++ ParaView-4.2.0/Applications/ParaView-4.2.0_extra_install_Darwin.cmake 2013-10-02 19:00:00.000000000 -0400 +@@ -0,0 +1,8 @@ ++# ++# Additional install rules for Mac OS X platforms ++# ++INSTALL (DIRECTORY ../../buildObj/bin/paraview.app ++ DESTINATION ${PV_INSTALL_BIN_DIR} ++ USE_SOURCE_PERMISSIONS ++ COMPONENT Runtime) ++ diff --git a/ThirdParty/rpmBuild/SPECS/ParaView-4.2.0.spec b/ThirdParty/rpmBuild/SPECS/ParaView-4.2.0.spec new file mode 100644 index 000000000..05ccbaaa7 --- /dev/null +++ b/ThirdParty/rpmBuild/SPECS/ParaView-4.2.0.spec @@ -0,0 +1,274 @@ +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | foam-extend: Open Source CFD +# \\ / O peration | +# \\ / A nd | For copyright notice see file Copyright +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# 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 . +# +# Script +# RPM spec file for ParaView-4.2.0 +# +# Description +# RPM spec file for creating a relocatable RPM +# +# Authors: +# Martin Beaudoin, Hydro-Quebec, (2010) +# Andreas Feymark, Chalmers University of Technology, (2013) +# +#------------------------------------------------------------------------------ + +# We grab the value of WM_THIRD_PARTY and WM_OPTIONS from the environment variable +%{expand:%%define _WM_THIRD_PARTY_DIR %(echo $WM_THIRD_PARTY_DIR)} +%{expand:%%define _WM_OPTIONS %(echo $WM_OPTIONS)} + +# Disable the generation of debuginfo packages +%define debug_package %{nil} + +# The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory +%define _topdir %{_WM_THIRD_PARTY_DIR}/rpmBuild +%define _tmppath %{_topdir}/tmp + +# Will install the package directly $WM_THIRD_PARTY_DIR +# Some comments about package relocation: +# By using this prefix for the Prefix: parameter in this file, you will make this +# package relocatable. +# +# This is fine, as long as your software is itself relocatable. +# +# Simply take note that libraries built with libtool are not relocatable because the +# prefix we specify will be hard-coded in the library .la files. +# Ref: http://sourceware.org/autobook/autobook/autobook_80.html +# +# In that case, if you ever change the value of the $WM_THIRD_PARTY_DIR, you will +# not be able to reutilize this RPM, even though it is relocatable. You will need to +# regenerate the RPM. +# +%define _prefix %{_WM_THIRD_PARTY_DIR} + +%define name ParaView +%define release %{_WM_OPTIONS} +%define version 4.2.0 + +%define buildroot %{_topdir}/BUILD/%{name}-%{version}-root + +BuildRoot: %{buildroot} +Summary: ParaView +License: Unkown +Name: %{name} +Version: %{version} +Release: %{release} +URL: http://www.paraview.org/files/v4.2/ +Source: %url/%{name}-v%{version}-source.tar.gz +Prefix: %{_prefix} +Group: Development/Tools +Patch0: paraview-4.2.0.patch_darwin + +%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS} + +#-------------------------------------------------------------------------- +# +# Here, we define default compiling options for cmake +# +# One can override the option on the commande line : --define='MACRO EXPR' +# +%{!?_withVerbose: %define _withVerbose false} +%{!?_withMesa: %define _withMesa false} +%{!?_withMPI: %define _withMPI false} +%{!?_withPython: %define _withPython false} +%{!?_withQt: %define _withQt true} +%{!?_qmakePath: %define _qmakePath Undefined} +%{!?_mesaIncludePath: %define _mesaIncludePath Undefined} +%{!?_mesaLibPath: %define _mesaLibPath Undefined} +%{!?_pythonLibPath: %define _pythonLibPath Undefined} + +#-------------------------------------------------------------------------- + +%description +%{summary} + +%prep +%setup -q -n %{name}-v%{version}-source + +%ifos darwin +%patch0 -p1 +%endif + +%build +# +# set CMake cache variables +# + addCMakeVariable() + { + while [ -n "$1" ] + do + CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1" + shift + done + } + + # export WM settings in a form that GNU configure recognizes + [ -n "$WM_CC" ] && export CC="$WM_CC" + [ -n "$WM_CXX" ] && export CXX="$WM_CXX" + [ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS" + [ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS" + [ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS" + + set +x + echo "" + echo "Compilation options:" + echo " _withVerbose : %{_withVerbose}" + echo " _withMesa : %{_withMesa}" + echo " _withMPI : %{_withMPI}" + echo " _withPython : %{_withPython}" + echo " _withQt : %{_withQt}" + echo " _qmakePath : %{_qmakePath}" + echo " _mesaIncludePath : %{_mesaIncludePath}" + echo " _mesaLibPath : %{_mesaLibPath}" + echo " _pythonLibPath : %{_pythonLibPath}" + echo "" + set -x + + # start with these general settings + addCMakeVariable VTK_USE_TK:BOOL=OFF + addCMakeVariable BUILD_SHARED_LIBS:BOOL=ON VTK_USE_RPATH:BOOL=OFF + addCMakeVariable CMAKE_BUILD_TYPE:STRING=Release + + # include development files in "make install" + addCMakeVariable PARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=ON + + # new alternative to "make HTMLDocumentation" + addCMakeVariable PARAVIEW_GENERATE_PROXY_DOCUMENTATION:BOOL=ON + + %ifos darwin + # Additional installation rules for Mac OS X + addCMakeVariable PARAVIEW_EXTRA_INSTALL_RULES_FILE:FILEPATH=%{_topdir}/BUILD/%{name}-%{version}/Applications/ParaView-3.8.1_extra_install_Darwin.cmake +%endif + + # Add the value of _qmakePath for QT_QMAKE_EXECUTABLE + addCMakeVariable QT_QMAKE_EXECUTABLE:FILEPATH=%{_qmakePath} + + echo "CMAKE_VARIABLES: $CMAKE_VARIABLES" + + mkdir -p ./buildObj + cd ./buildObj + + cmake \ + -DCMAKE_INSTALL_PREFIX:PATH=%{_installPrefix} \ + $CMAKE_VARIABLES \ + .. + + [ -z "$WM_NCOMPPROCS" ] && WM_NCOMPPROCS=1 + make -j $WM_NCOMPPROCS + +%install + # On OpenSUSE, rpmbuild, will choke when detecting unreferenced symlinks + # created during installation. + # Qt version 4.6.3 will generate some unreferenced symlinks when + # ParaView is compiled and installed. By enabling the following + # environment variable, the command brp-symlink will still complain + # about missing link targets, but it won't stop rpmbuild from generating + # the final rpm. + # For all other Unix distros, this is a no-op. + export NO_BRP_STALE_LINK_ERROR=yes + + cd buildObj + make install DESTDIR=$RPM_BUILD_ROOT + + # Creation of foam-extend specific .csh and .sh files" + + echo "" + echo "Generating foam-extend specific .csh and .sh files for the package %{name}-%{version}" + echo "" + # + # Generate package specific .sh file for foam-extend + # +mkdir -p $RPM_BUILD_ROOT/%{_installPrefix}/etc +cat << DOT_SH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.sh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export PARAVIEW_DIR=\$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS +export PARAVIEW_BIN_DIR=\$PARAVIEW_DIR/bin +export PARAVIEW_LIB_DIR=\$PARAVIEW_DIR/lib +export PARAVIEW_INCLUDE_DIR=\$PARAVIEW_DIR/include/paraview-4.2 + +export PARAVIEW_VERSION=%{version} + +# NB: It is important to set the PV_PLUGIN_PATH location to a directory containing only the ParaView plugins. +# Otherwise, paraview will try to automatically autoload each and every dynamic library it can find in the +# specified directory to see if a given library is a paraview plugin. +# In the case of \$FOAM_LIBBIN, with over 80 libraries, this is a total waste of time that will slow down the +# startup of paraview or even make paraview crash on startup. +export PV_PLUGIN_PATH=\$FOAM_LIBBIN/paraview_plugins + +[ -d \$PARAVIEW_LIB_DIR/paraview-4.2 ] && _foamAddLib \$PARAVIEW_LIB_DIR/paraview-4.2 + +# Enable access to the package applications if present +[ -d \$PARAVIEW_BIN_DIR ] && _foamAddPath \$PARAVIEW_BIN_DIR + +# Additional binary path if running on Mac OS X +[ -d \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS ] && _foamAddPath \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS + +DOT_SH_EOF + + # + # Generate package specific .csh file for foam-extend + # +cat << DOT_CSH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.csh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +setenv PARAVIEW_DIR \$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS +setenv PARAVIEW_BIN_DIR \$PARAVIEW_DIR/bin +setenv PARAVIEW_LIB_DIR \$PARAVIEW_DIR/lib +setenv PARAVIEW_INCLUDE_DIR \$PARAVIEW_DIR/include/paraview-4.2 + +setenv PARAVIEW_VERSION %{version} + +# NB: It is important to set the PV_PLUGIN_PATH location to a directory containing only the ParaView plugins. +# Otherwise, paraview will try to automatically autoload each and every dynamic library it can find in the +# specified directory to see if a given library is a paraview plugin. +# In the case of \$FOAM_LIBBIN, with over 80 libraries, this is a total waste of time that will slow down the +# startup of paraview or even make paraview crash on startup. +setenv PV_PLUGIN_PATH \$FOAM_LIBBIN/paraview_plugins + +if ( -e \$PARAVIEW_BIN_DIR ) then + _foamAddPath \$PARAVIEW_BIN_DIR +endif + +if ( -e \$PARAVIEW_LIB_DIR/paraview-4.2 ) then + _foamAddLib \$PARAVIEW_LIB_DIR/paraview-4.2 +endif + + +# Additional binary path if running on Mac OS X +if ( -e \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS ) then + _foamAddPath \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS +endif +DOT_CSH_EOF + + #finally, generate a .tgz file for systems where using rpm for installing packages + # as a non-root user might be a problem. + (mkdir -p %{_topdir}/TGZS/%{_target_cpu}; cd $RPM_BUILD_ROOT/%{_prefix}; tar -zcvf %{_topdir}/TGZS/%{_target_cpu}/%{name}-%{version}.tgz packages/%{name}-%{version}) + +%clean + +%files +%defattr(-,root,root) +%{_installPrefix} + diff --git a/ThirdParty/rpmBuild/SPECS/gcc-4.7.4.spec b/ThirdParty/rpmBuild/SPECS/gcc-4.7.4.spec new file mode 100644 index 000000000..d4bed42c5 --- /dev/null +++ b/ThirdParty/rpmBuild/SPECS/gcc-4.7.4.spec @@ -0,0 +1,174 @@ +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | foam-extend: Open Source CFD +# \\ / O peration | +# \\ / A nd | For copyright notice see file Copyright +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# 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 . +# +# Script +# RPM spec file for gcc-4.7.4 +# +# Description +# RPM spec file for creating a relocatable RPM +# +# Author: +# Hrvoje Jasak, Wikki Ltd. (2015) +# +#------------------------------------------------------------------------------ + +# We grab the value of WM_THIRD_PARTY and WM_OPTIONS from the environment variable +%{expand:%%define _WM_THIRD_PARTY_DIR %(echo $WM_THIRD_PARTY_DIR)} +%{expand:%%define _WM_OPTIONS %(echo $WM_OPTIONS)} + +# Disable the generation of debuginfo packages +%define debug_package %{nil} + +# The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory +%define _topdir %{_WM_THIRD_PARTY_DIR}/rpmBuild +%define _tmppath %{_topdir}/tmp + +# Will install the package directly $WM_THIRD_PARTY_DIR +# Some comments about package relocation: +# By using this prefix for the Prefix: parameter in thi file, you will make this +# package relocatable. +# +# This is fine, as long as your software is itself relocatable. +# +# Simply take note that libraries built with libtool are not relocatable because the +# prefix we specify will be hard-coded in the library .la files. +# Ref: http://sourceware.org/autobook/autobook/autobook_80.html +# +# In that case, if you ever change the value of the $WM_THIRD_PARTY_DIR, you will +# not be able to reutilize this RPM, even though it is relocatable. You will need to +# regenerate the RPM. +# +%define _prefix %{_WM_THIRD_PARTY_DIR} + +%define name gcc +%define release %{_WM_OPTIONS} +%define version 4.7.4 + +%define buildroot %{_topdir}/BUILD/%{name}-%{version}-root + +BuildRoot: %{buildroot} +Summary: gcc +License: Unkown +Name: %{name} +Version: %{version} +Release: %{release} +URL: ftp://ftp.gnu.org/gnu/gcc/gcc-4.7.4 +Source: %url/%{name}-%{version}.tar.gz +Prefix: %{_prefix} +Group: Development/Tools + + +%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS} + +%description +%{summary} + +%prep +%setup -q + +%build + # export WM settings in a form that GNU configure recognizes + [ -n "$WM_CC" ] && export CC="$WM_CC" + [ -n "$WM_CXX" ] && export CXX="$WM_CXX" + [ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS" + [ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS" + [ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS" + + GMP_VERSION=gmp-5.1.2 + MPFR_VERSION=mpfr-3.1.2 + MPC_VERSION=mpc-1.0.1 + + mkdir ./objBuildDir + cd ./objBuildDir + + ../configure \ + --prefix=%{_installPrefix} \ + --enable-languages=c,c++ \ + --enable-shared \ + --disable-multilib \ + --with-mpc=$WM_THIRD_PARTY_DIR/packages/$MPC_VERSION/platforms/$WM_OPTIONS \ + --with-gmp=$WM_THIRD_PARTY_DIR/packages/$GMP_VERSION/platforms/$WM_OPTIONS \ + --with-mpfr=$WM_THIRD_PARTY_DIR/packages/$MPFR_VERSION/platforms/$WM_OPTIONS + + [ -z "$WM_NCOMPPROCS" ] && WM_NCOMPPROCS=1 + make -j $WM_NCOMPPROCS + +%install + cd ./objBuildDir + make install DESTDIR=$RPM_BUILD_ROOT + + # Creation of foam-extend specific .csh and .sh files" + + echo "" + echo "Generating foam-extend specific .csh and .sh files for the package %{name}-%{version}" + echo "" + # + # Generate package specific .sh file for foam-extend + # +mkdir -p $RPM_BUILD_ROOT/%{_installPrefix}/etc +cat << DOT_SH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.sh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export GCC_DIR=\$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS + +[ -d \$GCC_DIR/lib ] && _foamAddLib \$GCC_DIR/lib + +[ -d \$GCC_DIR/lib64 ] && _foamAddLib \$GCC_DIR/lib64 + +# Enable access to the package applications if present +[ -d \$GCC_DIR/bin ] && _foamAddPath \$GCC_DIR/bin +DOT_SH_EOF + + # + # Generate package specific .csh file for foam-extend + # +cat << DOT_CSH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.csh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +setenv GCC_DIR \$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS + +if ( -e \$GCC_DIR/lib ) then + _foamAddLib \$GCC_DIR/lib +endif + +if ( -e \$GCC_DIR/lib64 ) then + _foamAddLib \$GCC_DIR/lib64 +endif + +if ( -e \$GCC_DIR/bin ) then + _foamAddPath \$GCC_DIR/bin +endif +DOT_CSH_EOF + + #finally, generate a .tgz file for systems where using rpm for installing packages + # as a non-root user might be a problem. + (mkdir -p %{_topdir}/TGZS/%{_target_cpu}; cd $RPM_BUILD_ROOT/%{_prefix}; tar -zcvf %{_topdir}/TGZS/%{_target_cpu}/%{name}-%{version}.tgz packages/%{name}-%{version}) + + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%{_installPrefix} diff --git a/ThirdParty/rpmBuild/SPECS/gcc-4.9.2.spec b/ThirdParty/rpmBuild/SPECS/gcc-4.9.2.spec new file mode 100644 index 000000000..48bed74e4 --- /dev/null +++ b/ThirdParty/rpmBuild/SPECS/gcc-4.9.2.spec @@ -0,0 +1,174 @@ +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | foam-extend: Open Source CFD +# \\ / O peration | +# \\ / A nd | For copyright notice see file Copyright +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# 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 . +# +# Script +# RPM spec file for gcc-4.9.2 +# +# Description +# RPM spec file for creating a relocatable RPM +# +# Author: +# Hrvoje Jasak, Wikki Ltd. (2015) +# +#------------------------------------------------------------------------------ + +# We grab the value of WM_THIRD_PARTY and WM_OPTIONS from the environment variable +%{expand:%%define _WM_THIRD_PARTY_DIR %(echo $WM_THIRD_PARTY_DIR)} +%{expand:%%define _WM_OPTIONS %(echo $WM_OPTIONS)} + +# Disable the generation of debuginfo packages +%define debug_package %{nil} + +# The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory +%define _topdir %{_WM_THIRD_PARTY_DIR}/rpmBuild +%define _tmppath %{_topdir}/tmp + +# Will install the package directly $WM_THIRD_PARTY_DIR +# Some comments about package relocation: +# By using this prefix for the Prefix: parameter in thi file, you will make this +# package relocatable. +# +# This is fine, as long as your software is itself relocatable. +# +# Simply take note that libraries built with libtool are not relocatable because the +# prefix we specify will be hard-coded in the library .la files. +# Ref: http://sourceware.org/autobook/autobook/autobook_80.html +# +# In that case, if you ever change the value of the $WM_THIRD_PARTY_DIR, you will +# not be able to reutilize this RPM, even though it is relocatable. You will need to +# regenerate the RPM. +# +%define _prefix %{_WM_THIRD_PARTY_DIR} + +%define name gcc +%define release %{_WM_OPTIONS} +%define version 4.9.2 + +%define buildroot %{_topdir}/BUILD/%{name}-%{version}-root + +BuildRoot: %{buildroot} +Summary: gcc +License: Unkown +Name: %{name} +Version: %{version} +Release: %{release} +URL: ftp://ftp.gnu.org/gnu/gcc/gcc-4.9.2 +Source: %url/%{name}-%{version}.tar.gz +Prefix: %{_prefix} +Group: Development/Tools + + +%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS} + +%description +%{summary} + +%prep +%setup -q + +%build + # export WM settings in a form that GNU configure recognizes + [ -n "$WM_CC" ] && export CC="$WM_CC" + [ -n "$WM_CXX" ] && export CXX="$WM_CXX" + [ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS" + [ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS" + [ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS" + + GMP_VERSION=gmp-5.1.2 + MPFR_VERSION=mpfr-3.1.2 + MPC_VERSION=mpc-1.0.1 + + mkdir ./objBuildDir + cd ./objBuildDir + + ../configure \ + --prefix=%{_installPrefix} \ + --enable-languages=c,c++ \ + --enable-shared \ + --disable-multilib \ + --with-mpc=$WM_THIRD_PARTY_DIR/packages/$MPC_VERSION/platforms/$WM_OPTIONS \ + --with-gmp=$WM_THIRD_PARTY_DIR/packages/$GMP_VERSION/platforms/$WM_OPTIONS \ + --with-mpfr=$WM_THIRD_PARTY_DIR/packages/$MPFR_VERSION/platforms/$WM_OPTIONS + + [ -z "$WM_NCOMPPROCS" ] && WM_NCOMPPROCS=1 + make -j $WM_NCOMPPROCS + +%install + cd ./objBuildDir + make install DESTDIR=$RPM_BUILD_ROOT + + # Creation of foam-extend specific .csh and .sh files" + + echo "" + echo "Generating foam-extend specific .csh and .sh files for the package %{name}-%{version}" + echo "" + # + # Generate package specific .sh file for foam-extend + # +mkdir -p $RPM_BUILD_ROOT/%{_installPrefix}/etc +cat << DOT_SH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.sh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export GCC_DIR=\$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS + +[ -d \$GCC_DIR/lib ] && _foamAddLib \$GCC_DIR/lib + +[ -d \$GCC_DIR/lib64 ] && _foamAddLib \$GCC_DIR/lib64 + +# Enable access to the package applications if present +[ -d \$GCC_DIR/bin ] && _foamAddPath \$GCC_DIR/bin +DOT_SH_EOF + + # + # Generate package specific .csh file for foam-extend + # +cat << DOT_CSH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.csh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +setenv GCC_DIR \$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS + +if ( -e \$GCC_DIR/lib ) then + _foamAddLib \$GCC_DIR/lib +endif + +if ( -e \$GCC_DIR/lib64 ) then + _foamAddLib \$GCC_DIR/lib64 +endif + +if ( -e \$GCC_DIR/bin ) then + _foamAddPath \$GCC_DIR/bin +endif +DOT_CSH_EOF + + #finally, generate a .tgz file for systems where using rpm for installing packages + # as a non-root user might be a problem. + (mkdir -p %{_topdir}/TGZS/%{_target_cpu}; cd $RPM_BUILD_ROOT/%{_prefix}; tar -zcvf %{_topdir}/TGZS/%{_target_cpu}/%{name}-%{version}.tgz packages/%{name}-%{version}) + + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%{_installPrefix} diff --git a/ThirdParty/rpmBuild/SPECS/gmp-4.3.2.spec b/ThirdParty/rpmBuild/SPECS/gmp-4.3.2.spec new file mode 100644 index 000000000..f0e5d6733 --- /dev/null +++ b/ThirdParty/rpmBuild/SPECS/gmp-4.3.2.spec @@ -0,0 +1,155 @@ +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | foam-extend: Open Source CFD +# \\ / O peration | +# \\ / A nd | For copyright notice see file Copyright +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# 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 . +# +# Script +# RPM spec file for gmp-4.3.2 +# +# Description +# RPM spec file for creating a relocatable RPM +# +# Author: +# Martin Beaudoin, Hydro-Quebec, (2010) +# +#------------------------------------------------------------------------------ + +# We grab the value of WM_THIRD_PARTY and WM_OPTIONS from the environment variable +%{expand:%%define _WM_THIRD_PARTY_DIR %(echo $WM_THIRD_PARTY_DIR)} +%{expand:%%define _WM_OPTIONS %(echo $WM_OPTIONS)} + +# Disable the generation of debuginfo packages +%define debug_package %{nil} + +# The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory +%define _topdir %{_WM_THIRD_PARTY_DIR}/rpmBuild +%define _tmppath %{_topdir}/tmp + +# Will install the package directly $WM_THIRD_PARTY_DIR +# Some comments about package relocation: +# By using this prefix for the Prefix: parameter in thi file, you will make this +# package relocatable. +# +# This is fine, as long as your software is itself relocatable. +# +# Simply take note that libraries built with libtool are not relocatable because the +# prefix we specify will be hard-coded in the library .la files. +# Ref: http://sourceware.org/autobook/autobook/autobook_80.html +# +# In that case, if you ever change the value of the $WM_THIRD_PARTY_DIR, you will +# not be able to reutilize this RPM, even though it is relocatable. You will need to +# regenerate the RPM. +# +%define _prefix %{_WM_THIRD_PARTY_DIR} + +%define name gmp +%define release %{_WM_OPTIONS} +%define version 4.3.2 + +%define buildroot %{_topdir}/BUILD/%{name}-%{version}-root + +BuildRoot: %{buildroot} +Summary: gmp +License: Unkown +Name: %{name} +Version: %{version} +Release: %{release} +URL: ftp://ftp.gnu.org/gnu/gmp +Source: %url/%{name}-%{version}.tar.bz2 +Prefix: %{_prefix} +Group: Development/Tools + +%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS} + +%description +%{summary} + +%prep +%setup -q + +%build + # export WM settings in a form that GNU configure recognizes + [ -n "$WM_CC" ] && export CC="$WM_CC" + [ -n "$WM_CXX" ] && export CXX="$WM_CXX" + [ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS" + [ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS" + [ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS" + + ./configure --prefix=%{_installPrefix} + + [ -z "$WM_NCOMPPROCS" ] && WM_NCOMPPROCS=1 + make -j $WM_NCOMPPROCS + +%install + make install DESTDIR=$RPM_BUILD_ROOT + + # Creation of foam-extend specific .csh and .sh files" + + echo "" + echo "Generating foam-extend specific .csh and .sh files for the package %{name}-%{version}" + echo "" + # + # Generate package specific .sh file for foam-extend + # +mkdir -p $RPM_BUILD_ROOT/%{_installPrefix}/etc +cat << DOT_SH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.sh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export GMP_DIR=\$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS + +[ -d \$GMP_DIR/lib ] && _foamAddLib \$GMP_DIR/lib + +# Enable access to the package applications if present +[ -d \$GMP_DIR/bin ] && _foamAddPath \$GMP_DIR/bin +DOT_SH_EOF + + # + # Generate package specific .csh file for foam-extend + # +cat << DOT_CSH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.csh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +setenv GMP_DIR \$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS + +if ( -e \$GMP_DIR/lib ) then + _foamAddLib \$GMP_DIR/lib +endif + +if ( -e \$GMP_DIR/bin ) then + _foamAddPath \$GMP_DIR/bin +endif +DOT_CSH_EOF + + #finally, generate a .tgz file for systems where using rpm for installing packages + # as a non-root user might be a problem. + (mkdir -p %{_topdir}/TGZS/%{_target_cpu}; cd $RPM_BUILD_ROOT/%{_prefix}; tar -zcvf %{_topdir}/TGZS/%{_target_cpu}/%{name}-%{version}.tgz packages/%{name}-%{version}) + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%{_installPrefix}/etc +%{_installPrefix}/include +%{_installPrefix}/lib +%{_installPrefix}/share + diff --git a/ThirdParty/rpmBuild/SPECS/mpfr-2.4.2.spec b/ThirdParty/rpmBuild/SPECS/mpfr-2.4.2.spec new file mode 100644 index 000000000..ad7a684b9 --- /dev/null +++ b/ThirdParty/rpmBuild/SPECS/mpfr-2.4.2.spec @@ -0,0 +1,157 @@ +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | foam-extend: Open Source CFD +# \\ / O peration | +# \\ / A nd | For copyright notice see file Copyright +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# 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 . +# +# Script +# RPM spec file for mpfr-2.4.2 +# +# Description +# RPM spec file for creating a relocatable RPM +# +# Author: +# Martin Beaudoin, Hydro-Quebec, (2010) +# +#------------------------------------------------------------------------------ + +# We grab the value of WM_THIRD_PARTY and WM_OPTIONS from the environment variable +%{expand:%%define _WM_THIRD_PARTY_DIR %(echo $WM_THIRD_PARTY_DIR)} +%{expand:%%define _WM_OPTIONS %(echo $WM_OPTIONS)} + +# Disable the generation of debuginfo packages +%define debug_package %{nil} + +# The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory +%define _topdir %{_WM_THIRD_PARTY_DIR}/rpmBuild +%define _tmppath %{_topdir}/tmp + +# Will install the package directly $WM_THIRD_PARTY_DIR +# Some comments about package relocation: +# By using this prefix for the Prefix: parameter in thi file, you will make this +# package relocatable. +# +# This is fine, as long as your software is itself relocatable. +# +# Simply take note that libraries built with libtool are not relocatable because the +# prefix we specify will be hard-coded in the library .la files. +# Ref: http://sourceware.org/autobook/autobook/autobook_80.html +# +# In that case, if you ever change the value of the $WM_THIRD_PARTY_DIR, you will +# not be able to reutilize this RPM, even though it is relocatable. You will need to +# regenerate the RPM. +# +%define _prefix %{_WM_THIRD_PARTY_DIR} + +%define name mpfr +%define release %{_WM_OPTIONS} +%define version 2.4.2 + +%define buildroot %{_topdir}/BUILD/%{name}-%{version}-root + +BuildRoot: %{buildroot} +Summary: mpfr +License: Unkown +Name: %{name} +Version: %{version} +Release: %{release} +URL: http://www.mpfr.org/mpfr-current +Source: %url/%{name}-%{version}.tar.gz +Prefix: %{_prefix} +Group: Development/Tools + +%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS} + +%description +%{summary} + +%prep +%setup -q + +%build + # export WM settings in a form that GNU configure recognizes + [ -n "$WM_CC" ] && export CC="$WM_CC" + [ -n "$WM_CXX" ] && export CXX="$WM_CXX" + [ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS" + [ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS" + [ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS" + + GMP_VERSION=gmp-5.1.2 + ./configure \ + --prefix=%{_installPrefix} \ + --with-gmp=$WM_THIRD_PARTY_DIR/packages/$GMP_VERSION/platforms/$WM_OPTIONS + + [ -z "$WM_NCOMPPROCS" ] && WM_NCOMPPROCS=1 + make -j $WM_NCOMPPROCS + +%install + make install DESTDIR=$RPM_BUILD_ROOT + + + # Creation of foam-extend specific .csh and .sh files" + + echo "" + echo "Generating foam-extend specific .csh and .sh files for the package %{name}-%{version}" + echo "" + # + # Generate package specific .sh file for foam-extend + # +mkdir -p $RPM_BUILD_ROOT/%{_installPrefix}/etc +cat << DOT_SH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.sh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export MPFR_DIR=\$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS + +[ -d \$MPFR_DIR/lib ] && _foamAddLib \$MPFR_DIR/lib + +# Enable access to the package applications if present +[ -d \$MPFR_DIR/bin ] && _foamAddPath \$MPFR_DIR/bin +DOT_SH_EOF + + # + # Generate package specific .csh file for foam-extend + # +cat << DOT_CSH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.csh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +setenv MPFR_DIR \$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS + +if ( -e \$MPFR_DIR/lib ) then + _foamAddLib \$MPFR_DIR/lib +endif + +if ( -e \$MPFR_DIR/bin ) then + _foamAddPath \$MPFR_DIR/bin +endif +DOT_CSH_EOF + + #finally, generate a .tgz file for systems where using rpm for installing packages + # as a non-root user might be a problem. + (mkdir -p %{_topdir}/TGZS/%{_target_cpu}; cd $RPM_BUILD_ROOT/%{_prefix}; tar -zcvf %{_topdir}/TGZS/%{_target_cpu}/%{name}-%{version}.tgz packages/%{name}-%{version}) + + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%{_installPrefix} + diff --git a/ThirdParty/rpmBuild/SPECS/qt-everywhere-opensource-src-4.8.6.spec b/ThirdParty/rpmBuild/SPECS/qt-everywhere-opensource-src-4.8.6.spec new file mode 100644 index 000000000..09b4283ce --- /dev/null +++ b/ThirdParty/rpmBuild/SPECS/qt-everywhere-opensource-src-4.8.6.spec @@ -0,0 +1,183 @@ +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | foam-extend: Open Source CFD +# \\ / O peration | +# \\ / A nd | For copyright notice see file Copyright +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# 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 . +# +# Script +# RPM spec file for qt-everywhere-opensource-src-4.8.6 +# +# Description +# RPM spec file for creating a relocatable RPM +# +# Author: +# Martin Beaudoin, Hydro-Quebec, (2014) +# +#------------------------------------------------------------------------------ + +# We grab the value of WM_THIRD_PARTY and WM_OPTIONS from the environment variable +%{expand:%%define _WM_THIRD_PARTY_DIR %(echo $WM_THIRD_PARTY_DIR)} +%{expand:%%define _WM_OPTIONS %(echo $WM_OPTIONS)} + +# Disable the generation of debuginfo packages +%define debug_package %{nil} + +# The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory +%define _topdir %{_WM_THIRD_PARTY_DIR}/rpmBuild +%define _tmppath %{_topdir}/tmp + +# Will install the package directly $WM_THIRD_PARTY_DIR +# Some comments about package relocation: +# By using this prefix for the Prefix: parameter in this file, you will make this +# package relocatable. +# +# This is fine, as long as your software is itself relocatable. +# +# Simply take note that libraries built with libtool are not relocatable because the +# prefix we specify will be hard-coded in the library .la files. +# Ref: http://sourceware.org/autobook/autobook/autobook_80.html +# +# In that case, if you ever change the value of the $WM_THIRD_PARTY_DIR, you will +# not be able to reutilize this RPM, even though it is relocatable. You will need to +# regenerate the RPM. +# +%define _prefix %{_WM_THIRD_PARTY_DIR} + +%define name qt-everywhere-opensource-src +%define release %{_WM_OPTIONS} +%define version 4.8.6 + +%define buildroot %{_topdir}/BUILD/%{name}-%{version}-root + +%define _unpackaged_files_terminate_build 0 +%define _missing_doc_files_terminate_build 0 + +BuildRoot: %{buildroot} +Summary: qt-everywhere-opensource-src +License: Unkown +Name: %{name} +Version: %{version} +Release: %{release} +URL: http://download.qt-project.org/official_releases/qt/4.8/4.8.6 +Source: %url/%{name}-%{version}.tar.gz +Prefix: %{_prefix} +Group: Development/Tools + + +%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS} + +%description +%{summary} + +%prep +%setup -q + +%build + # export WM settings in a form that GNU configure recognizes + [ -n "$WM_CC" ] && export CC="$WM_CC" + [ -n "$WM_CXX" ] && export CXX="$WM_CXX" + [ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS" + [ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS" + [ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS" + +%ifos darwin + # Under Mac OS X, Qt 4.8 will only compile using the stock native g++ compiler supplied with Xcode. + # If your native Mac OS X g++ compiler is not located under /usr/bin, simply adjust the redefinition of the following variables accordingly. + # This is ugly, I know... + export CC=/usr/bin/gcc + export CXX=/usr/bin/g++ + export PATH=/usr/bin:$PATH +%endif + + ./configure \ + -opensource --confirm-license=yes \ + -release -shared \ + -nomake examples -nomake demos \ + --prefix=%{_installPrefix} + + # Explicitely specify LD_LIBRARY_PATH so it can find QT own libraries + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{_builddir}/%{name}-%{version}/lib + + [ -z "$WM_NCOMPPROCS" ] && WM_NCOMPPROCS=1 + make -j $WM_NCOMPPROCS + +%install + # Makefiles generated by qmake do not to support the DESTDIR= option + # We need to use the INSTALL_ROOT= option instead + + # Somehow, we need to clean up for the RPM to install properly + rm -rf %{_installPrefix} + + make install INSTALL_ROOT=$RPM_BUILD_ROOT + + # Creation of foam-extend specific .csh and .sh files" + + echo "" + echo "Generating foam-extend specific .csh and .sh files for the package %{name}-%{version}" + echo "" + # + # Generate package specific .sh file for foam-extend + # +mkdir -p $RPM_BUILD_ROOT/%{_installPrefix}/etc +cat << DOT_SH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.sh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export QT_DIR=\$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS +export QT_BIN_DIR=\$QT_DIR/bin +export QT_LIB_DIR=\$QT_DIR/lib + +# Enable access to the runtime package applications +[ -d \$QT_BIN_DIR ] && _foamAddPath \$QT_BIN_DIR +[ -d \$QT_LIB_DIR ] && _foamAddLib \$QT_LIB_DIR +DOT_SH_EOF + + # + # Generate package specific .csh file for foam-extend + # +cat << DOT_CSH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.csh +# Load %{name}-%{version} libraries and binaries if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +setenv QT_DIR \$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS +setenv QT_BIN_DIR \$QT_DIR/bin +setenv QT_LIB_DIR \$QT_DIR/lib + +if ( -e \$QT_BIN_DIR ) then + _foamAddPath \$QT_BIN_DIR +endif + +if ( -e \$QT_LIB_DIR ) then + _foamAddLib \$QT_LIB_DIR +endif +DOT_CSH_EOF + + #finally, generate a .tgz file for systems where using rpm for installing packages + # as a non-root user might be a problem. + (mkdir -p %{_topdir}/TGZS/%{_target_cpu}; cd $RPM_BUILD_ROOT/%{_prefix}; tar -zcvf %{_topdir}/TGZS/%{_target_cpu}/%{name}-%{version}.tgz packages/%{name}-%{version}) + + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%{_installPrefix} + + diff --git a/applications/solvers/coupled/pUCoupledFoam/boundPU.H b/applications/solvers/coupled/pUCoupledFoam/boundPU.H new file mode 100644 index 000000000..eca655e8c --- /dev/null +++ b/applications/solvers/coupled/pUCoupledFoam/boundPU.H @@ -0,0 +1,32 @@ +{ + // Bound the pressure + dimensionedScalar p1 = min(p); + dimensionedScalar p2 = max(p); + + if (p1 < pMin || p2 > pMax) + { + Info<< "p: " << p1.value() << " " << p2.value() + << ". Bounding." << endl; + + p.max(pMin); + p.min(pMax); + p.correctBoundaryConditions(); + } + + // Bound the velocity + volScalarField magU = mag(U); + dimensionedScalar U1 = max(magU); + + if (U1 > UMax) + { + Info<< "U: " << U1.value() << ". Bounding." << endl; + + volScalarField Ulimiter = pos(magU - UMax)*UMax/(magU + smallU) + + neg(magU - UMax); + Ulimiter.max(scalar(0)); + Ulimiter.min(scalar(1)); + + U *= Ulimiter; + U.correctBoundaryConditions(); + } +} diff --git a/applications/solvers/coupled/pUCoupledFoam/convergenceCheck.H b/applications/solvers/coupled/pUCoupledFoam/convergenceCheck.H new file mode 100644 index 000000000..9c7734131 --- /dev/null +++ b/applications/solvers/coupled/pUCoupledFoam/convergenceCheck.H @@ -0,0 +1,8 @@ +// Check convergence +if (maxResidual < convergenceCriterion) +{ + Info<< "reached convergence criterion: " << convergenceCriterion << endl; + runTime.writeAndEnd(); + Info<< "latestTime = " << runTime.timeName() << endl; +} + diff --git a/applications/solvers/coupled/pUCoupledFoam/initConvergenceCheck.H b/applications/solvers/coupled/pUCoupledFoam/initConvergenceCheck.H new file mode 100644 index 000000000..482bc421d --- /dev/null +++ b/applications/solvers/coupled/pUCoupledFoam/initConvergenceCheck.H @@ -0,0 +1,4 @@ +// initialize values for convergence checks + + scalar maxResidual = 0; + scalar convergenceCriterion = 0; diff --git a/applications/solvers/coupled/pUCoupledFoam/pUCoupledFoam.C b/applications/solvers/coupled/pUCoupledFoam/pUCoupledFoam.C index 088d41759..355b11ae4 100644 --- a/applications/solvers/coupled/pUCoupledFoam/pUCoupledFoam.C +++ b/applications/solvers/coupled/pUCoupledFoam/pUCoupledFoam.C @@ -52,11 +52,14 @@ int main(int argc, char *argv[]) # include "createMesh.H" # include "createFields.H" # include "initContinuityErrs.H" -# include "readBlockSolverControls.H" +# include "initConvergenceCheck.H" Info<< "\nStarting time loop\n" << endl; while (runTime.loop()) { +# include "readBlockSolverControls.H" +# include "readFieldBounds.H" + Info<< "Time = " << runTime.timeName() << nl << endl; p.storePrevIter(); @@ -74,7 +77,7 @@ int main(int argc, char *argv[]) # include "couplingTerms.H" // Solve the block matrix - UpEqn.solve(); + maxResidual = cmptMax(UpEqn.solve().initialResidual()); // Retrieve solution UpEqn.retrieveSolution(0, U.internalField()); @@ -87,6 +90,8 @@ int main(int argc, char *argv[]) # include "continuityErrs.H" +# include "boundPU.H" + p.relax(); turbulence->correct(); @@ -95,6 +100,8 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; + +# include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/coupled/pUCoupledFoam/readBlockSolverControls.H b/applications/solvers/coupled/pUCoupledFoam/readBlockSolverControls.H index 4ee98e519..93c2bda47 100644 --- a/applications/solvers/coupled/pUCoupledFoam/readBlockSolverControls.H +++ b/applications/solvers/coupled/pUCoupledFoam/readBlockSolverControls.H @@ -1,3 +1,15 @@ -label pRefCell = 0; -scalar pRefValue = 0; -setRefCell(p, mesh.solutionDict().subDict("blockSolver"), pRefCell, pRefValue); + label pRefCell = 0; + scalar pRefValue = 0; + setRefCell + ( + p, + mesh.solutionDict().subDict("blockSolver"), + pRefCell, + pRefValue + ); + + mesh.solutionDict().subDict("blockSolver").readIfPresent + ( + "convergence", + convergenceCriterion + ); diff --git a/applications/solvers/coupled/pUCoupledFoam/readFieldBounds.H b/applications/solvers/coupled/pUCoupledFoam/readFieldBounds.H new file mode 100644 index 000000000..4a6c6f787 --- /dev/null +++ b/applications/solvers/coupled/pUCoupledFoam/readFieldBounds.H @@ -0,0 +1,14 @@ + // Read field bounds + dictionary fieldBounds = mesh.solutionDict().subDict("fieldBounds"); + + // Pressure bounds + dimensionedScalar pMin("pMin", p.dimensions(), 0); + dimensionedScalar pMax("pMax", p.dimensions(), 0); + + fieldBounds.lookup(p.name()) >> pMin.value() >> pMax.value(); + + // Velocity bound + dimensionedScalar UMax("UMax", U.dimensions(), 0); + + fieldBounds.lookup(U.name()) >> UMax.value(); + dimensionedScalar smallU("smallU", dimVelocity, 1e-10); diff --git a/applications/solvers/surfaceTracking/freeSurface/freeSurface.C b/applications/solvers/surfaceTracking/freeSurface/freeSurface.C index d820ac29f..6973a1710 100644 --- a/applications/solvers/surfaceTracking/freeSurface/freeSurface.C +++ b/applications/solvers/surfaceTracking/freeSurface/freeSurface.C @@ -35,7 +35,7 @@ Description #include "wallFvPatch.H" #include "EulerDdtScheme.H" -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "backwardDdtScheme.H" #include "tetFemMatrices.H" @@ -480,7 +480,7 @@ bool freeSurface::movePoints(const scalarField& interfacePhi) if ( ddtScheme - == fv::CrankNicholsonDdtScheme::typeName + == fv::CrankNicolsonDdtScheme::typeName ) { sweptVolCorr *= (1.0/2.0)*DB().deltaT().value(); @@ -890,7 +890,7 @@ bool freeSurface::moveMeshPoints() if ( ddtScheme - == fv::CrankNicholsonDdtScheme::typeName + == fv::CrankNicolsonDdtScheme::typeName ) { sweptVolCorr *= (1.0/2.0)*DB().deltaT().value(); diff --git a/etc/aliases.csh b/etc/aliases.csh index 8beb1b3c2..0c80acbb5 100644 --- a/etc/aliases.csh +++ b/etc/aliases.csh @@ -25,8 +25,8 @@ # aliases.csh # # Description -# Aliases for working with OpenFOAM -# Sourced from OpenFOAM-??/etc/cshrc and/or ~/.cshrc +# Aliases for working with FOAM +# Sourced from FOAM-??/etc/cshrc and/or ~/.cshrc # #------------------------------------------------------------------------------ diff --git a/etc/aliases.sh b/etc/aliases.sh index e25c0e0d1..603f34896 100644 --- a/etc/aliases.sh +++ b/etc/aliases.sh @@ -25,8 +25,8 @@ # aliases.sh # # Description -# Aliases for working with OpenFOAM -# Sourced from OpenFOAM-??/etc/bashrc and/or ~/.bashrc +# Aliases for working with FOAM +# Sourced from FOAM-??/etc/bashrc and/or ~/.bashrc # #------------------------------------------------------------------------------ diff --git a/etc/apps/ensight/bashrc b/etc/apps/ensight/bashrc index c60fcab84..e719aeadc 100644 --- a/etc/apps/ensight/bashrc +++ b/etc/apps/ensight/bashrc @@ -26,7 +26,7 @@ # # Description # Setup file for Ensight 8.? -# Sourced from OpenFOAM-?.?/etc/bashrc +# Sourced from FOAM-?.?/etc/bashrc # #------------------------------------------------------------------------------ diff --git a/etc/apps/ensight/cshrc b/etc/apps/ensight/cshrc index 5e58b2261..71b244478 100644 --- a/etc/apps/ensight/cshrc +++ b/etc/apps/ensight/cshrc @@ -4,7 +4,7 @@ # \\ / O peration | # \\ / A nd | For copyright notice see file Copyright # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of foam-extend. # @@ -26,7 +26,7 @@ # # Description # Startup File for Ensight 8.?. -# Sourced from OpenFOAM-?.?/etc/cshrc +# Sourced from FOAM-?.?/etc/cshrc # #------------------------------------------------------------------------------ diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc index 14b2a15ae..7f67fe6b0 100644 --- a/etc/apps/paraview3/bashrc +++ b/etc/apps/paraview3/bashrc @@ -26,7 +26,7 @@ # # Description # Setup file for paraview-3.x -# Sourced from OpenFOAM-*/etc/bashrc +# Sourced from FOAM-*/etc/bashrc # # Note # The env. variable 'ParaView_DIR' is required for building plugins diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc index 726f4826b..2e2fdafa9 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/apps/paraview3/cshrc @@ -26,7 +26,7 @@ # # Description # Setup file for paraview-3.x -# Sourced from OpenFOAM-*/etc/cshrc +# Sourced from FOAM-*/etc/cshrc # # Note # The env. variable 'ParaView_DIR' is required for building plugins diff --git a/etc/bashrc b/etc/bashrc index dfb9ada4b..479f0a88e 100755 --- a/etc/bashrc +++ b/etc/bashrc @@ -26,7 +26,7 @@ # etc/bashrc # # Description -# Startup file for OpenFOAM +# Startup file for FOAM # Sourced from ~/.profile or ~/.bashrc # Should be usable by any POSIX-compliant shell (eg, ksh) # @@ -43,7 +43,7 @@ export FOAM_DEV=1 # USER EDITABLE PART # # either set $FOAM_INST_DIR before sourcing this file or set -# $foamInstall below to where OpenFOAM is installed +# $foamInstall below to where FOAM is installed # # Location of FOAM installation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -379,7 +379,7 @@ SunOS) cat <::updateCoeffs() if ( ddtScheme == fv::EulerDdtScheme::typeName - || ddtScheme == fv::CrankNicholsonDdtScheme::typeName + || ddtScheme == fv::CrankNicolsonDdtScheme::typeName ) { this->refValue() = @@ -318,7 +318,7 @@ void advectiveFvPatchField::updateCoeffs() if ( ddtScheme == fv::EulerDdtScheme::typeName - || ddtScheme == fv::CrankNicholsonDdtScheme::typeName + || ddtScheme == fv::CrankNicolsonDdtScheme::typeName ) { this->refValue() = field.oldTime().boundaryField()[patchi]; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H index c6a814e7f..2963b1727 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H @@ -28,7 +28,7 @@ Description Advective outflow boundary condition based on solving DDt(psi, U) = 0 at the boundary. - The standard (Euler, backward, CrankNicholson) time schemes are + The standard (Euler, backward, CrankNicolson) time schemes are supported. Additionally an optional mechanism to relax the value at the boundary to a specified far-field value is provided which is switched on by specifying the relaxation length-scale lInf and the diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C index 2fb9604a1..dc597baf5 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C @@ -186,7 +186,7 @@ void pressureInletOutletVelocityFvPatchVectorField::updateCoeffs() InfoIn ( "pressureInletOutletVelocityFvPatchVectorField::updateCoeffs()" - )<< "Cannot find phi. Return" << endl; + ) << "Cannot find phi. Return" << endl; valueFraction() = symmTensor::one; } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/newFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/newFvPatchField.C index 700b6a52b..4f1f534c1 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/newFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/newFvPatchField.C @@ -52,7 +52,8 @@ Foam::tmp > Foam::fvPatchField::New "fvPatchField::New(const word&, const fvPatch&, " "const DimensionedField&)" ) << "Unknown patch field type " << patchFieldType - << endl << endl + << " for field " << iF.name() << " on patch " << p.name() + << nl << nl << "Valid patchField types are :" << endl << patchConstructorTablePtr_->sortedToc() << exit(FatalError); @@ -86,7 +87,7 @@ Foam::tmp > Foam::fvPatchField::New { Info<< "fvPatchField::New(const fvPatch&, " "const DimensionedField&, " - "const dictionary&) : patchFieldType=" << patchFieldType + "const dictionary&) : patchFieldType = " << patchFieldType << endl; } @@ -109,6 +110,7 @@ Foam::tmp > Foam::fvPatchField::New "const dictionary&)", dict ) << "Unknown patch field type " << patchFieldType + << " for field " << iF.name() << " on patch " << p.name() << " for patch type " << p.type() << endl << endl << "Valid patch field types are :" << endl << dictionaryConstructorTablePtr_->sortedToc() @@ -137,8 +139,8 @@ Foam::tmp > Foam::fvPatchField::New "const DimensionedField&, " "const dictionary&)", dict - ) << "inconsistent patch and patchField types for field " - << iF.name() << "\n" + ) << "Inconsistent patch and patchField types for field " + << iF.name() << " on patch " << p.name() << "\n" << " patch type " << p.type() << " and patchField type " << patchFieldType << exit(FatalIOError); @@ -177,7 +179,9 @@ Foam::tmp > Foam::fvPatchField::New "fvPatchField::New(const fvPatchField&, " "const fvPatch&, const DimensionedField&, " "const fvPatchFieldMapper&)" - ) << "unknown patch field type " << ptf.type() << endl << endl + ) << "unknown patch field type " << ptf.type() + << " for field " << iF.name() << " on patch " << p.name() + << nl << nl << "Valid patchField types are :" << endl << patchMapperConstructorTablePtr_->sortedToc() << exit(FatalError); diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C similarity index 95% rename from src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C rename to src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C index adf941c5e..781ad3dc4 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "surfaceInterpolate.H" #include "fvcDiv.H" #include "fvMatrices.H" @@ -42,7 +42,7 @@ namespace fv template template -CrankNicholsonDdtScheme::DDt0Field::DDt0Field +CrankNicolsonDdtScheme::DDt0Field::DDt0Field ( const IOobject& io, const fvMesh& mesh @@ -60,7 +60,7 @@ CrankNicholsonDdtScheme::DDt0Field::DDt0Field template template -CrankNicholsonDdtScheme::DDt0Field::DDt0Field +CrankNicolsonDdtScheme::DDt0Field::DDt0Field ( const IOobject& io, const fvMesh& mesh, @@ -74,7 +74,7 @@ CrankNicholsonDdtScheme::DDt0Field::DDt0Field template template -label CrankNicholsonDdtScheme::DDt0Field:: +label CrankNicolsonDdtScheme::DDt0Field:: startTimeIndex() const { return startTimeIndex_; @@ -83,7 +83,7 @@ startTimeIndex() const template template -GeoField& CrankNicholsonDdtScheme::DDt0Field:: +GeoField& CrankNicolsonDdtScheme::DDt0Field:: operator()() { return *this; @@ -92,7 +92,7 @@ operator()() template template -void CrankNicholsonDdtScheme::DDt0Field:: +void CrankNicolsonDdtScheme::DDt0Field:: operator=(const GeoField& gf) { GeoField::operator=(gf); @@ -101,8 +101,8 @@ operator=(const GeoField& gf) template template -CrankNicholsonDdtScheme::DDt0Field& -CrankNicholsonDdtScheme::ddt0_ +CrankNicolsonDdtScheme::DDt0Field& +CrankNicolsonDdtScheme::ddt0_ ( const word& name, const dimensionSet& dims @@ -183,7 +183,7 @@ CrankNicholsonDdtScheme::ddt0_ template template -bool CrankNicholsonDdtScheme::evaluate +bool CrankNicolsonDdtScheme::evaluate ( const DDt0Field& ddt0 ) const @@ -193,7 +193,7 @@ bool CrankNicholsonDdtScheme::evaluate template template -scalar CrankNicholsonDdtScheme::coef_ +scalar CrankNicolsonDdtScheme::coef_ ( const DDt0Field& ddt0 ) const @@ -211,7 +211,7 @@ scalar CrankNicholsonDdtScheme::coef_ template template -scalar CrankNicholsonDdtScheme::coef0_ +scalar CrankNicolsonDdtScheme::coef0_ ( const DDt0Field& ddt0 ) const @@ -229,7 +229,7 @@ scalar CrankNicholsonDdtScheme::coef0_ template template -dimensionedScalar CrankNicholsonDdtScheme::rDtCoef_ +dimensionedScalar CrankNicolsonDdtScheme::rDtCoef_ ( const DDt0Field& ddt0 ) const @@ -240,7 +240,7 @@ dimensionedScalar CrankNicholsonDdtScheme::rDtCoef_ template template -dimensionedScalar CrankNicholsonDdtScheme::rDtCoef0_ +dimensionedScalar CrankNicolsonDdtScheme::rDtCoef0_ ( const DDt0Field& ddt0 ) const @@ -251,7 +251,7 @@ dimensionedScalar CrankNicholsonDdtScheme::rDtCoef0_ template template -tmp CrankNicholsonDdtScheme::offCentre_ +tmp CrankNicolsonDdtScheme::offCentre_ ( const GeoField& ddt0 ) const @@ -281,7 +281,7 @@ const FieldField& ff template tmp > -CrankNicholsonDdtScheme::fvcDdt +CrankNicolsonDdtScheme::fvcDdt ( const dimensioned& dt ) @@ -343,7 +343,7 @@ CrankNicholsonDdtScheme::fvcDdt template tmp > -CrankNicholsonDdtScheme::fvcDdt +CrankNicolsonDdtScheme::fvcDdt ( const GeometricField& vf ) @@ -432,7 +432,7 @@ CrankNicholsonDdtScheme::fvcDdt template tmp > -CrankNicholsonDdtScheme::fvcDdt +CrankNicolsonDdtScheme::fvcDdt ( const dimensionedScalar& rho, const GeometricField& vf @@ -522,7 +522,7 @@ CrankNicholsonDdtScheme::fvcDdt template tmp > -CrankNicholsonDdtScheme::fvcDdt +CrankNicolsonDdtScheme::fvcDdt ( const volScalarField& rho, const GeometricField& vf @@ -622,7 +622,7 @@ CrankNicholsonDdtScheme::fvcDdt template tmp > -CrankNicholsonDdtScheme::fvmDdt +CrankNicolsonDdtScheme::fvmDdt ( GeometricField& vf ) @@ -705,7 +705,7 @@ CrankNicholsonDdtScheme::fvmDdt template tmp > -CrankNicholsonDdtScheme::fvmDdt +CrankNicolsonDdtScheme::fvmDdt ( const dimensionedScalar& rho, GeometricField& vf @@ -787,7 +787,7 @@ CrankNicholsonDdtScheme::fvmDdt template tmp > -CrankNicholsonDdtScheme::fvmDdt +CrankNicolsonDdtScheme::fvmDdt ( const volScalarField& rho, GeometricField& vf @@ -877,8 +877,8 @@ CrankNicholsonDdtScheme::fvmDdt template -tmp::fluxFieldType> -CrankNicholsonDdtScheme::fvcDdtPhiCorr +tmp::fluxFieldType> +CrankNicolsonDdtScheme::fvcDdtPhiCorr ( const volScalarField& rA, const GeometricField& U, @@ -964,8 +964,8 @@ CrankNicholsonDdtScheme::fvcDdtPhiCorr template -tmp::fluxFieldType> -CrankNicholsonDdtScheme::fvcDdtPhiCorr +tmp::fluxFieldType> +CrankNicolsonDdtScheme::fvcDdtPhiCorr ( const volScalarField& rA, const volScalarField& rho, @@ -1157,7 +1157,7 @@ CrankNicholsonDdtScheme::fvcDdtPhiCorr { FatalErrorIn ( - "CrankNicholsonDdtScheme::fvcDdtPhiCorr" + "CrankNicolsonDdtScheme::fvcDdtPhiCorr" ) << "dimensions of phi are not correct" << abort(FatalError); @@ -1168,7 +1168,7 @@ CrankNicholsonDdtScheme::fvcDdtPhiCorr template -tmp CrankNicholsonDdtScheme::meshPhi +tmp CrankNicolsonDdtScheme::meshPhi ( const GeometricField& vf ) diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.H similarity index 90% rename from src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H rename to src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.H index 3376a4786..7ed4c0e6d 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.H @@ -22,19 +22,19 @@ License along with foam-extend. If not, see . Class - Foam::fv::CrankNicholsonDdtScheme + Foam::fv::CrankNicolsonDdtScheme Description - Second-oder CrankNicholson implicit ddt using the current and + Second-oder CrankNicolson implicit ddt using the current and previous time-step fields as well as the previous time-step ddt. SourceFiles - CrankNicholsonDdtScheme.C + CrankNicolsonDdtScheme.C \*---------------------------------------------------------------------------*/ -#ifndef CrankNicholsonDdtScheme_H -#define CrankNicholsonDdtScheme_H +#ifndef CrankNicolsonDdtScheme_H +#define CrankNicolsonDdtScheme_H #include "ddtScheme.H" @@ -49,11 +49,11 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class CrankNicholsonDdtScheme Declaration + Class CrankNicolsonDdtScheme Declaration \*---------------------------------------------------------------------------*/ template -class CrankNicholsonDdtScheme +class CrankNicolsonDdtScheme : public fv::ddtScheme { @@ -105,10 +105,10 @@ class CrankNicholsonDdtScheme // Private Member Functions //- Disallow default bitwise copy construct - CrankNicholsonDdtScheme(const CrankNicholsonDdtScheme&); + CrankNicolsonDdtScheme(const CrankNicolsonDdtScheme&); //- Disallow default bitwise assignment - void operator=(const CrankNicholsonDdtScheme&); + void operator=(const CrankNicolsonDdtScheme&); template DDt0Field& ddt0_ @@ -149,20 +149,20 @@ class CrankNicholsonDdtScheme public: //- Runtime type information - TypeName("CrankNicholson"); + TypeName("CrankNicolson"); // Constructors //- Construct from mesh - CrankNicholsonDdtScheme(const fvMesh& mesh) + CrankNicolsonDdtScheme(const fvMesh& mesh) : ddtScheme(mesh), ocCoeff_(1.0) {} //- Construct from mesh and Istream - CrankNicholsonDdtScheme(const fvMesh& mesh, Istream& is) + CrankNicolsonDdtScheme(const fvMesh& mesh, Istream& is) : ddtScheme(mesh, is), ocCoeff_(readScalar(is)) @@ -171,7 +171,7 @@ public: { FatalIOErrorIn ( - "CrankNicholsonDdtScheme(const fvMesh& mesh, Istream& is)", + "CrankNicolsonDdtScheme(const fvMesh& mesh, Istream& is)", is ) << "coefficient = " << ocCoeff_ << " should be >= 0 and <= 1" @@ -253,7 +253,7 @@ public: template<> -tmp CrankNicholsonDdtScheme::fvcDdtPhiCorr +tmp CrankNicolsonDdtScheme::fvcDdtPhiCorr ( const volScalarField& rA, const volScalarField& U, @@ -262,7 +262,7 @@ tmp CrankNicholsonDdtScheme::fvcDdtPhiCorr template<> -tmp CrankNicholsonDdtScheme::fvcDdtPhiCorr +tmp CrankNicolsonDdtScheme::fvcDdtPhiCorr ( const volScalarField& rA, const volScalarField& rho, @@ -282,7 +282,7 @@ tmp CrankNicholsonDdtScheme::fvcDdtPhiCorr // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "CrankNicholsonDdtScheme.C" +# include "CrankNicolsonDdtScheme.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C similarity index 94% rename from src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C rename to src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C index 5c1ea9a5c..b154fc37c 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C @@ -25,7 +25,7 @@ Description \*---------------------------------------------------------------------------*/ -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "fvMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -34,7 +34,7 @@ namespace Foam { namespace fv { - makeFvDdtScheme(CrankNicholsonDdtScheme) + makeFvDdtScheme(CrankNicolsonDdtScheme) } } diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H index c9bd2ef14..5afd9b488 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H @@ -163,6 +163,8 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "scalarGaussGrad.H" + #ifdef NoRepository # include "gaussGrad.C" #endif diff --git a/src/finiteVolume/finiteVolume/gradSchemes/scalarGaussGrad/scalarGaussGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/scalarGaussGrad.C similarity index 90% rename from src/finiteVolume/finiteVolume/gradSchemes/scalarGaussGrad/scalarGaussGrad.C rename to src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/scalarGaussGrad.C index 40d3e1e5d..bb22caf7e 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/scalarGaussGrad/scalarGaussGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/scalarGaussGrad.C @@ -27,7 +27,7 @@ Description \*---------------------------------------------------------------------------*/ -#include "scalarGaussGrad.H" +#include "gaussGrad.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -71,20 +71,20 @@ tmp > gaussGrad::fvmGrad bs.negSumDiag(); // Boundary contributions - forAll(vf.boundaryField(), patchI) + forAll (vf.boundaryField(), patchI) { const fvPatchScalarField& pf = vf.boundaryField()[patchI]; const fvPatch& patch = pf.patch(); - const vectorField& Sf = patch.Sf(); + const vectorField& pSf = patch.Sf(); const fvsPatchScalarField& pw = tweights().boundaryField()[patchI]; const labelList& fc = patch.faceCells(); const scalarField internalCoeffs(pf.valueInternalCoeffs(pw)); // Diag contribution - forAll(pf, faceI) + forAll (pf, faceI) { - d[fc[faceI]] += internalCoeffs[faceI]*Sf[faceI]; + d[fc[faceI]] += internalCoeffs[faceI]*pSf[faceI]; } if (patch.coupled()) @@ -94,8 +94,8 @@ tmp > gaussGrad::fvmGrad CoeffField::linearTypeField& pcoupleLower = bs.coupleLower()[patchI].asLinear(); - const vectorField pcl = -pw*Sf; - const vectorField pcu = pcl + Sf; + const vectorField pcl = -pw*pSf; + const vectorField pcu = pcl + pSf; // Coupling contributions pcoupleLower -= pcl; @@ -106,9 +106,9 @@ tmp > gaussGrad::fvmGrad const scalarField boundaryCoeffs(pf.valueBoundaryCoeffs(pw)); // Boundary contribution - forAll(pf, faceI) + forAll (pf, faceI) { - source[fc[faceI]] -= boundaryCoeffs[faceI]*Sf[faceI]; + source[fc[faceI]] -= boundaryCoeffs[faceI]*pSf[faceI]; } } } diff --git a/src/finiteVolume/finiteVolume/gradSchemes/scalarGaussGrad/scalarGaussGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/scalarGaussGrad.H similarity index 100% rename from src/finiteVolume/finiteVolume/gradSchemes/scalarGaussGrad/scalarGaussGrad.H rename to src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/scalarGaussGrad.H diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.H index 4d95e1d58..05ba80d10 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.H @@ -119,6 +119,8 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "scalarLeastSquaresGrad.H" + #ifdef NoRepository # include "leastSquaresGrad.C" #endif diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C index b6934cdcf..dd1ad92b2 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C @@ -36,6 +36,12 @@ namespace Foam } +const Foam::scalar Foam::leastSquaresVectors::smallDotProdTol_ +( + debug::tolerances("leastSquaresSmallDotProdTol", 0.1) +); + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::leastSquaresVectors::leastSquaresVectors(const fvMesh& mesh) @@ -106,7 +112,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const // Set up temporary storage for the dd tensor (before inversion) symmTensorField dd(mesh().nCells(), symmTensor::zero); - forAll(owner, faceI) + forAll (owner, faceI) { label own = owner[faceI]; label nei = neighbour[faceI]; @@ -118,18 +124,18 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const dd[nei] += wdd; } - forAll(lsP.boundaryField(), patchI) + forAll (lsP.boundaryField(), patchI) { const fvPatch& p = mesh().boundary()[patchI]; - const unallocLabelList& faceCells = p.patch().faceCells(); + const unallocLabelList& fc = p.patch().faceCells(); // Better version of d-vectors: Zeljko Tukovic, 25/Apr/2010 const vectorField pd = p.delta(); - forAll(pd, patchFaceI) + forAll (pd, pFaceI) { - const vector& d = pd[patchFaceI]; - dd[faceCells[patchFaceI]] += (1.0/magSqr(d))*sqr(d); + const vector& d = pd[pFaceI]; + dd[fc[pFaceI]] += (1.0/magSqr(d))*sqr(d); } } @@ -147,9 +153,12 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const ), mesh(), dimensionedSymmTensor("zero", dimless, symmTensor::zero), - "zeroGradient" + zeroGradientFvPatchScalarField::typeName ); symmTensorField& invDd = volInvDd.internalField(); + + // Invert least squares matrix using Householder transformations to avoid + // badly posed cells // invDd = inv(dd); invDd = hinv(dd); @@ -158,7 +167,11 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const volInvDd.boundaryField().evaluateCoupled(); // Revisit all faces and calculate the lsP and lsN vectors - forAll(owner, faceI) + vectorField& lsPIn = lsP.internalField(); + vectorField& lsNIn = lsN.internalField(); + + // Least squares vectors on internal faces + forAll (owner, faceI) { label own = owner[faceI]; label nei = neighbour[faceI]; @@ -166,16 +179,17 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const vector d = C[nei] - C[own]; scalar magSfByMagSqrd = 1.0/magSqr(d); - lsP[faceI] = magSfByMagSqrd*(invDd[own] & d); - lsN[faceI] = -magSfByMagSqrd*(invDd[nei] & d); + lsPIn[faceI] = magSfByMagSqrd*(invDd[own] & d); + lsNIn[faceI] = -magSfByMagSqrd*(invDd[nei] & d); } - forAll(lsP.boundaryField(), patchI) + // Least squares vectors on boundary faces + forAll (lsP.boundaryField(), patchI) { fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI]; fvsPatchVectorField& patchLsN = lsN.boundaryField()[patchI]; const fvPatch& p = mesh().boundary()[patchI]; - const unallocLabelList& faceCells = p.faceCells(); + const unallocLabelList& fc = p.faceCells(); // Better version of d-vectors: Zeljko Tukovic, 25/Apr/2010 const vectorField pd = p.delta(); @@ -185,29 +199,215 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const const symmTensorField invDdNei = volInvDd.boundaryField()[patchI].patchNeighbourField(); - forAll(pd, patchFaceI) + forAll (pd, pFaceI) { - const vector& d = pd[patchFaceI]; + const vector& d = pd[pFaceI]; - patchLsP[patchFaceI] = (1.0/magSqr(d)) - *(invDd[faceCells[patchFaceI]] & d); + patchLsP[pFaceI] = (1.0/magSqr(d))*(invDd[fc[pFaceI]] & d); - patchLsN[patchFaceI] = - (1.0/magSqr(d)) - *(invDdNei[patchFaceI] & d); + patchLsN[pFaceI] = - (1.0/magSqr(d))*(invDdNei[pFaceI] & d); } } else { - forAll(pd, patchFaceI) + forAll (pd, pFaceI) { - const vector& d = pd[patchFaceI]; + const vector& d = pd[pFaceI]; - patchLsP[patchFaceI] = (1.0/magSqr(d)) - *(invDd[faceCells[patchFaceI]] & d); + patchLsP[pFaceI] = (1.0/magSqr(d))*(invDd[fc[pFaceI]] & d); } } } +# if 0 + + // Coefficient sign correction on least squares vectors + // The sign of the coefficient must be positive to ensure correct + // behaviour in coupled systems. This is checked by evaluating + // dot-product of the P/N vectors with the face area vector. + // If the dot-product is negative, cell is marked for use with the + // Gauss gradient, which is unconditionally positive + // HJ, 21/Apr/2015 + + // First loop: detect cells with bad least squares vectors + Info<< "NEW LEAST SQUARES VECTORS" << endl; + // Use Gauss Gradient field: set to 1 if Gauss is needed + volScalarField useGaussGrad + ( + IOobject + ( + "useGaussGrad", + mesh().pointsInstance(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + dimensionedScalar("zero", dimVolume, 0), + zeroGradientFvPatchScalarField::typeName + ); + + const surfaceVectorField& Sf = mesh().Sf(); + const surfaceScalarField& w = mesh().weights(); + + const vectorField& SfIn = Sf.internalField(); + const scalarField& wIn = w.internalField(); + scalarField& uggIn = useGaussGrad.internalField(); + + // Check internal faces + forAll (owner, faceI) + { + if + ( + (lsPIn[faceI] & SfIn[faceI])/(mag(lsPIn[faceI])*mag(SfIn[faceI])) + < smallDotProdTol_ + ) + { + // Least square points in the wrong direction for owner + // Use Gauss gradient + uggIn[owner[faceI]] = 1; + } + + if + ( + (lsNIn[faceI] & SfIn[faceI])/(mag(lsNIn[faceI])*mag(SfIn[faceI])) + > -smallDotProdTol_ + ) + { + // Least square points in the wrong direction for owner. + // Note that Sf points into neighbour cell + // Use Gauss gradient + uggIn[neighbour[faceI]] = 1; + } + } + + forAll (lsP.boundaryField(), patchI) + { + fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI]; + const vectorField& pSf = Sf.boundaryField()[patchI]; + const fvPatch& p = mesh().boundary()[patchI]; + const unallocLabelList& fc = p.faceCells(); + + // Same check for coupled and uncoupled + forAll (patchLsP, pFaceI) + { + if + ( + (patchLsP[pFaceI] & pSf[pFaceI])/ + (mag(patchLsP[pFaceI])*mag(pSf[pFaceI])) + < smallDotProdTol_ + ) + { + uggIn[fc[pFaceI]] = 1; + } + } + } + + // Update boundary conditions for coupled boundaries. This synchronises + // the Gauss grad indication field + useGaussGrad.boundaryField().evaluateCoupled(); + + // Replace least square vectors with weighted Gauss gradient vectors + // for marked cells + + // Prepare cell volumes with parallel communications + volScalarField cellV + ( + IOobject + ( + "cellV", + mesh().pointsInstance(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + dimensionedScalar("zero", dimVolume, 0), + zeroGradientFvPatchScalarField::typeName + ); + cellV.internalField() = mesh().V(); + + // Evaluate coupled to exchange coupled neighbour field data + // across coupled boundaries. HJ, 18/Mar/2015 + cellV.boundaryField().evaluateCoupled(); + + const scalarField& cellVIn = cellV.internalField(); + + // Internal faces + forAll (owner, faceI) + { + label own = owner[faceI]; + label nei = neighbour[faceI]; + + if (uggIn[own] > SMALL) + { + // Gauss gradient for owner cell + lsPIn[faceI] = (1 - wIn[faceI])*SfIn[faceI]/cellVIn[own]; + } + + if (uggIn[nei] > SMALL) + { + // Gauss gradient for neighbour cell + lsNIn[faceI] = -wIn[faceI]*SfIn[faceI]/cellVIn[nei]; + } + } + + // Boundary faces + forAll (lsP.boundaryField(), patchI) + { + fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI]; + fvsPatchVectorField& patchLsN = lsN.boundaryField()[patchI]; + const fvPatch& p = mesh().boundary()[patchI]; + const unallocLabelList& fc = p.faceCells(); + + const fvsPatchScalarField& pw = w.boundaryField()[patchI]; + const vectorField& pSf = Sf.boundaryField()[patchI]; + + // Get indicator for local side + const fvPatchScalarField& ugg = useGaussGrad.boundaryField()[patchI]; + const scalarField pUgg = ugg.patchInternalField(); + + if (p.coupled()) + { + const scalarField cellVInNei = + cellV.boundaryField()[patchI].patchNeighbourField(); + + // Get indicator for neighbour side + const scalarField nUgg = ugg.patchNeighbourField(); + + forAll (pUgg, pFaceI) + { + if (pUgg[pFaceI] > SMALL) + { + // Gauss grad for owner cell + patchLsP[pFaceI] = + (1 - pw[pFaceI])*pSf[pFaceI]/cellVIn[fc[pFaceI]]; + } + + if (nUgg[pFaceI] > SMALL) + { + // Gauss gradient for neighbour cell + patchLsN[pFaceI] = + -pw[pFaceI]*pSf[pFaceI]/cellVInNei[pFaceI]; + } + } + } + else + { + forAll (pUgg, pFaceI) + { + if (pUgg[pFaceI] > SMALL) + { + // Gauss grad for owner cell + patchLsP[pFaceI] = + (1 - pw[pFaceI])*pSf[pFaceI]/cellVIn[fc[pFaceI]]; + } + } + } + } + +#endif + if (debug) { Info<< "leastSquaresVectors::makeLeastSquaresVectors() :" diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H index 8ad419e36..61fbe5b4c 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H @@ -74,6 +74,12 @@ public: TypeName("leastSquaresVectors"); + // Static data members + + //- Point merge tolerance + static const scalar smallDotProdTol_; + + // Constructors //- Construct given an fvMesh diff --git a/src/finiteVolume/finiteVolume/gradSchemes/scalarLeastSquaresGrad/scalarLeastSquaresGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/scalarLeastSquaresGrad.C similarity index 95% rename from src/finiteVolume/finiteVolume/gradSchemes/scalarLeastSquaresGrad/scalarLeastSquaresGrad.C rename to src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/scalarLeastSquaresGrad.C index 1b3691312..4c4446c87 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/scalarLeastSquaresGrad/scalarLeastSquaresGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/scalarLeastSquaresGrad.C @@ -27,7 +27,7 @@ Description \*---------------------------------------------------------------------------*/ -#include "scalarLeastSquaresGrad.H" +#include "leastSquaresGrad.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -64,7 +64,7 @@ tmp > leastSquaresGrad::fvmGrad ), mesh, dimensionedScalar("zero", dimVolume, 0), - "zeroGradient" + zeroGradientFvPatchScalarField::typeName ); cellV.internalField() = mesh.V(); cellV.correctBoundaryConditions(); @@ -90,7 +90,7 @@ tmp > leastSquaresGrad::fvmGrad const surfaceVectorField& ownLs = lsv.pVectors(); const surfaceVectorField& neiLs = lsv.nVectors(); - forAll(nei, faceI) + forAll (nei, faceI) { register label owner = own[faceI]; register label neighbour = nei[faceI]; @@ -104,7 +104,7 @@ tmp > leastSquaresGrad::fvmGrad } // Boundary contributions - forAll(vf.boundaryField(), patchI) + forAll (vf.boundaryField(), patchI) { const fvPatchScalarField& pf = vf.boundaryField()[patchI]; const fvPatch& patch = pf.patch(); @@ -113,7 +113,7 @@ tmp > leastSquaresGrad::fvmGrad const labelList& fc = patch.faceCells(); // Part of diagonal contribution irrespective of the patch type - forAll(pf, faceI) + forAll (pf, faceI) { const label cellI = fc[faceI]; d[cellI] -= cellVIn[cellI]*pownLs[faceI]; @@ -131,7 +131,7 @@ tmp > leastSquaresGrad::fvmGrad bs.coupleLower()[patchI].asLinear(); // Coupling and diagonal contributions - forAll(pf, faceI) + forAll (pf, faceI) { const vector upper = cellVIn[fc[faceI]]*pownLs[faceI]; const vector lower = cellVInNei[faceI]*pneiLs[faceI]; @@ -146,7 +146,7 @@ tmp > leastSquaresGrad::fvmGrad const scalarField boundaryCoeffs(pf.valueBoundaryCoeffs(pw)); // Diagonal and source contributions depending on the patch type - forAll(pf, faceI) + forAll (pf, faceI) { const label cellI = fc[faceI]; d[cellI] += cellVIn[cellI]*pownLs[faceI]*internalCoeffs[faceI]; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/scalarLeastSquaresGrad/scalarLeastSquaresGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/scalarLeastSquaresGrad.H similarity index 100% rename from src/finiteVolume/finiteVolume/gradSchemes/scalarLeastSquaresGrad/scalarLeastSquaresGrad.H rename to src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/scalarLeastSquaresGrad.H diff --git a/src/finiteVolume/finiteVolume/gradSchemes/scalarGaussGrad/.scalarGaussGrad.C.swp b/src/finiteVolume/finiteVolume/gradSchemes/scalarGaussGrad/.scalarGaussGrad.C.swp deleted file mode 100644 index a62419570..000000000 Binary files a/src/finiteVolume/finiteVolume/gradSchemes/scalarGaussGrad/.scalarGaussGrad.C.swp and /dev/null differ diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.C b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.C index 7d40119ea..2e1e93b78 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.C +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.C @@ -200,27 +200,25 @@ void Foam::BlockMatrixAgglomeration::calcAgglomeration() } // Collect solo equations - label nSolo = 0; - forAll (zeroCluster, eqnI) { if (zeroCluster[eqnI]) { // Found solo equation - nSolo++; + nSolo_++; agglomIndex_[eqnI] = nCoarseEqns_; } } - if (nSolo > 0) + if (nSolo_ > 0) { // Found solo equations nCoarseEqns_++; - if (BlockLduMatrix::debug >= 2) + if (BlockLduMatrix::debug >= 3) { - Pout<< "Found " << nSolo << " weakly connected equations." + Pout<< "Found " << nSolo_ << " weakly connected equations." << endl; } } @@ -347,7 +345,7 @@ void Foam::BlockMatrixAgglomeration::calcAgglomeration() reduce(coarsen_, andOp()); - if (BlockLduMatrix::debug >= 2) + if (BlockLduMatrix::debug >= 3) { Pout << "Coarse level size: " << nCoarseEqns_; @@ -379,6 +377,7 @@ Foam::BlockMatrixAgglomeration::BlockMatrixAgglomeration normPtr_(BlockCoeffNorm::New(dict)), agglomIndex_(matrix_.lduAddr().size()), groupSize_(groupSize), + nSolo_(0), nCoarseEqns_(0), coarsen_(false) { @@ -441,6 +440,8 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const } # endif + // Does the matrix have solo equations + bool soloEqns = nSolo_ > 0; // Storage for block neighbours and coefficients @@ -468,6 +469,13 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const label rmUpperAddr = agglomIndex_[upperAddr[fineCoeffi]]; label rmLowerAddr = agglomIndex_[lowerAddr[fineCoeffi]]; + // If the coefficient touches block zero and solo equations are + // present, skip it + if (soloEqns && (rmUpperAddr == 0 || rmLowerAddr == 0)) + { + continue; + } + if (rmUpperAddr == rmLowerAddr) { // For each fine coeff inside of a coarse cluster keep the address @@ -563,6 +571,16 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const forAll(coeffRestrictAddr, fineCoeffi) { + label rmUpperAddr = agglomIndex_[upperAddr[fineCoeffi]]; + label rmLowerAddr = agglomIndex_[lowerAddr[fineCoeffi]]; + + // If the coefficient touches block zero and solo equations are + // present, skip it + if (soloEqns && (rmUpperAddr == 0 || rmLowerAddr == 0)) + { + continue; + } + if (coeffRestrictAddr[fineCoeffi] >= 0) { coeffRestrictAddr[fineCoeffi] = @@ -765,6 +783,16 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const forAll(coeffRestrictAddr, fineCoeffI) { + label rmUpperAddr = agglomIndex_[upperAddr[fineCoeffI]]; + label rmLowerAddr = agglomIndex_[lowerAddr[fineCoeffI]]; + + // If the coefficient touches block zero and + // solo equations are present, skip it + if (soloEqns && (rmUpperAddr == 0 || rmLowerAddr == 0)) + { + continue; + } + label cCoeff = coeffRestrictAddr[fineCoeffI]; if (cCoeff >= 0) @@ -837,6 +865,16 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const forAll(coeffRestrictAddr, fineCoeffI) { + label rmUpperAddr = agglomIndex_[upperAddr[fineCoeffI]]; + label rmLowerAddr = agglomIndex_[lowerAddr[fineCoeffI]]; + + // If the coefficient touches block zero and + // solo equations are present, skip it + if (soloEqns && (rmUpperAddr == 0 || rmLowerAddr == 0)) + { + continue; + } + label cCoeff = coeffRestrictAddr[fineCoeffI]; if (cCoeff >= 0) diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.H b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.H index c7fdf9cf7..ca1ceddc4 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.H +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.H @@ -74,6 +74,9 @@ class BlockMatrixAgglomeration //- Group size label groupSize_; + //- Number of solo cells + label nSolo_; + //- Number of coarse equations label nCoarseEqns_; diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.H b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.H index becbba0be..391b51457 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.H +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.H @@ -62,7 +62,7 @@ template class BlockAmgLevel; /*---------------------------------------------------------------------------*\ - Class BlockMatrixCoarsening Declaration + Class BlockMatrixCoarsening Declaration \*---------------------------------------------------------------------------*/ template @@ -79,6 +79,7 @@ class BlockMatrixCoarsening //- Minimum number of coarse level equations label minCoarseEqns_; + // Private Member Functions //- Disallow default bitwise copy construct diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.C b/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.C index c93c5729d..5fd335a55 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.C +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.C @@ -224,7 +224,7 @@ void Foam::coarseBlockAmgLevel::solve // Switch of debug in top-level direct solve label oldDebug = BlockLduMatrix::debug; - if (BlockLduMatrix::debug >= 3) + if (BlockLduMatrix::debug >= 4) { BlockLduMatrix::debug = 1; } diff --git a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C b/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C index 97b2f6e8d..9609b2952 100644 --- a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C +++ b/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C @@ -329,7 +329,7 @@ void Foam::lduMatrix::operator*=(scalar s) } -Foam::tmp Foam::lduMatrix::H1() const +Foam::tmp Foam::lduMatrix::H1() const { tmp tH1 ( diff --git a/src/foam/primitives/BlockCoeff/BlockCoeffNorm/BlockCoeffMaxNorm/BlockCoeffMaxNorm.H b/src/foam/primitives/BlockCoeff/BlockCoeffNorm/BlockCoeffMaxNorm/BlockCoeffMaxNorm.H index 772751950..f3ad6bffc 100644 --- a/src/foam/primitives/BlockCoeff/BlockCoeffNorm/BlockCoeffMaxNorm/BlockCoeffMaxNorm.H +++ b/src/foam/primitives/BlockCoeff/BlockCoeffNorm/BlockCoeffMaxNorm/BlockCoeffMaxNorm.H @@ -66,14 +66,9 @@ class BlockCoeffMaxNorm //- Control data dictionary dictionary dict_; + protected: - // Protected data types - - - // Protected data - - // Protected Member Functions //- Return dictionary @@ -82,6 +77,7 @@ protected: return dict_; } + public: //- Runtime type information diff --git a/src/lduSolvers/amg/amgPolicy/pamgPolicy.C b/src/lduSolvers/amg/amgPolicy/pamgPolicy.C index 9bf006fbd..14b5993a1 100644 --- a/src/lduSolvers/amg/amgPolicy/pamgPolicy.C +++ b/src/lduSolvers/amg/amgPolicy/pamgPolicy.C @@ -179,27 +179,25 @@ void Foam::pamgPolicy::calcChild() } // Collect solo equations - label nSolo = 0; - forAll (zeroCluster, eqnI) { if (zeroCluster[eqnI]) { // Found solo equation - nSolo++; + nSolo_++; child_[eqnI] = nCoarseEqns_; } } - if (nSolo > 0) + if (nSolo_ > 0) { // Found solo equations nCoarseEqns_++; if (lduMatrix::debug >= 2) { - Pout << "Found " << nSolo << " weakly connected equations." + Pout<< "Found " << nSolo_ << " weakly connected equations." << endl; } } @@ -334,6 +332,7 @@ Foam::pamgPolicy::pamgPolicy amgPolicy(groupSize, minCoarseEqns), matrix_(matrix), child_(), + nSolo_(0), nCoarseEqns_(0), coarsen_(false) { @@ -395,6 +394,9 @@ Foam::autoPtr Foam::pamgPolicy::restrictMatrix # endif + // Does the matrix have solo equations + bool soloEqns = nSolo_ > 0; + // Storage for block neighbours and coefficients // Guess initial maximum number of neighbours in block @@ -409,6 +411,9 @@ Foam::autoPtr Foam::pamgPolicy::restrictMatrix scalarList blockCoeffsData(maxNnbrs*nCoarseEqns_, 0.0); // Create face-restriction addressing + // Note: value of coeffRestrictAddr for off-diagonal coefficients + // touching solo cells will be invalid + // HJ, 7/Apr/2015 labelList coeffRestrictAddr(nFineCoeffs); // Initial neighbour array (not in upper-triangle order) @@ -418,17 +423,24 @@ Foam::autoPtr Foam::pamgPolicy::restrictMatrix label nCoarseCoeffs = 0; // Loop through all fine coeffs - forAll (upperAddr, fineCoeffi) + forAll (upperAddr, fineCoeffI) { - label rmUpperAddr = child_[upperAddr[fineCoeffi]]; - label rmLowerAddr = child_[lowerAddr[fineCoeffi]]; + label rmUpperAddr = child_[upperAddr[fineCoeffI]]; + label rmLowerAddr = child_[lowerAddr[fineCoeffI]]; + + // If the coefficient touches block zero and solo equations are + // present, skip it + if (soloEqns && (rmUpperAddr == 0 || rmLowerAddr == 0)) + { + continue; + } if (rmUpperAddr == rmLowerAddr) { // For each fine coeff inside of a coarse cluster keep the address // of the cluster corresponding to the coeff in the // coeffRestrictAddr as a negative index - coeffRestrictAddr[fineCoeffi] = -(rmUpperAddr + 1); + coeffRestrictAddr[fineCoeffI] = -(rmUpperAddr + 1); } else { @@ -455,7 +467,7 @@ Foam::autoPtr Foam::pamgPolicy::restrictMatrix if (initCoarseNeighb[ccCoeffs[i]] == cNei) { nbrFound = true; - coeffRestrictAddr[fineCoeffi] = ccCoeffs[i]; + coeffRestrictAddr[fineCoeffI] = ccCoeffs[i]; break; } } @@ -485,7 +497,7 @@ Foam::autoPtr Foam::pamgPolicy::restrictMatrix ccCoeffs[ccnCoeffs] = nCoarseCoeffs; initCoarseNeighb[nCoarseCoeffs] = cNei; - coeffRestrictAddr[fineCoeffi] = nCoarseCoeffs; + coeffRestrictAddr[fineCoeffI] = nCoarseCoeffs; ccnCoeffs++; // New coarse coeff created @@ -518,12 +530,22 @@ Foam::autoPtr Foam::pamgPolicy::restrictMatrix } } - forAll(coeffRestrictAddr, fineCoeffi) + forAll (coeffRestrictAddr, fineCoeffI) { - if (coeffRestrictAddr[fineCoeffi] >= 0) + label rmUpperAddr = child_[upperAddr[fineCoeffI]]; + label rmLowerAddr = child_[lowerAddr[fineCoeffI]]; + + // If the coefficient touches block zero and solo equations are + // present, skip it + if (soloEqns && (rmUpperAddr == 0 || rmLowerAddr == 0)) { - coeffRestrictAddr[fineCoeffi] = - coarseCoeffMap[coeffRestrictAddr[fineCoeffi]]; + continue; + } + + if (coeffRestrictAddr[fineCoeffI] >= 0) + { + coeffRestrictAddr[fineCoeffI] = + coarseCoeffMap[coeffRestrictAddr[fineCoeffI]]; } } @@ -696,8 +718,18 @@ Foam::autoPtr Foam::pamgPolicy::restrictMatrix scalarField& coarseUpper = coarseMatrix.upper(); scalarField& coarseLower = coarseMatrix.lower(); - forAll(coeffRestrictAddr, fineCoeffI) + forAll (coeffRestrictAddr, fineCoeffI) { + label rmUpperAddr = child_[upperAddr[fineCoeffI]]; + label rmLowerAddr = child_[lowerAddr[fineCoeffI]]; + + // If the coefficient touches block zero and solo equations are + // present, skip it + if (soloEqns && (rmUpperAddr == 0 || rmLowerAddr == 0)) + { + continue; + } + label cCoeff = coeffRestrictAddr[fineCoeffI]; if (cCoeff >= 0) @@ -721,8 +753,18 @@ Foam::autoPtr Foam::pamgPolicy::restrictMatrix // Coarse matrix upper coefficients scalarField& coarseUpper = coarseMatrix.upper(); - forAll(coeffRestrictAddr, fineCoeffI) + forAll (coeffRestrictAddr, fineCoeffI) { + label rmUpperAddr = child_[upperAddr[fineCoeffI]]; + label rmLowerAddr = child_[lowerAddr[fineCoeffI]]; + + // If the coefficient touches block zero and solo equations are + // present, skip it + if (soloEqns && (rmUpperAddr == 0 || rmLowerAddr == 0)) + { + continue; + } + label cCoeff = coeffRestrictAddr[fineCoeffI]; if (cCoeff >= 0) diff --git a/src/lduSolvers/amg/amgPolicy/pamgPolicy.H b/src/lduSolvers/amg/amgPolicy/pamgPolicy.H index 451eae50d..43b9c9382 100644 --- a/src/lduSolvers/amg/amgPolicy/pamgPolicy.H +++ b/src/lduSolvers/amg/amgPolicy/pamgPolicy.H @@ -59,9 +59,12 @@ class pamgPolicy //- Reference to matrix const lduMatrix& matrix_; - //- Child array + //- Child array: for each fine equation give coarse cluster index labelField child_; + //- Number of solo cells + label nSolo_; + //- Number of coarse equations label nCoarseEqns_; diff --git a/src/lduSolvers/amg/fineAmgLevel.C b/src/lduSolvers/amg/fineAmgLevel.C index b013865f1..b84a77454 100644 --- a/src/lduSolvers/amg/fineAmgLevel.C +++ b/src/lduSolvers/amg/fineAmgLevel.C @@ -263,7 +263,9 @@ void Foam::fineAmgLevel::scaleX // Scale x if ( - scalingVector[0]*scalingVector[1] <= 0 + mag(scalingVector[0]) > GREAT + || mag(scalingVector[1]) > GREAT + || scalingVector[0]*scalingVector[1] <= 0 || mag(scalingVector[0]) < mag(scalingVector[1]) ) { diff --git a/src/lduSolvers/lduSolver/deflationSolver/deflationSolver.C b/src/lduSolvers/lduSolver/deflationSolver/deflationSolver.C index 8cb1bc9b4..28a4a886a 100644 --- a/src/lduSolvers/lduSolver/deflationSolver/deflationSolver.C +++ b/src/lduSolvers/lduSolver/deflationSolver/deflationSolver.C @@ -236,7 +236,10 @@ Foam::lduSolverPerformance Foam::deflationSolver::solve if ( nDirs < maxDirs_ - && R[qI][qI] > 1e-3*Foam::max(R[0][0], R[1][1]) + && ( + R[qI][qI] > GREAT + || R[qI][qI] > 1e-3*Foam::max(R[0][0], R[1][1]) + ) ) { Z.set(nDirs, new scalarField(Q[qI])); diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C index 07ccdc82a..c1bb2b275 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C @@ -110,11 +110,11 @@ void Foam::gradientEnthalpyFvPatchScalarField::updateCoeffs() ) { gradient() = thermo.Cp(Tw, patchi)*Tw.snGrad() - + patch().deltaCoeffs()* - ( - thermo.h(Tw, patchi) - - thermo.h(Tw, patch().faceCells()) - ); + + patch().deltaCoeffs()* + ( + thermo.h(Tw, patchi) + - thermo.h(Tw, patch().faceCells()) + ); } else if ( diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnthalpy/mixedEnthalpyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnthalpy/mixedEnthalpyFvPatchScalarField.C index da77fec4c..bb47e746e 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnthalpy/mixedEnthalpyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnthalpy/mixedEnthalpyFvPatchScalarField.C @@ -119,11 +119,11 @@ void Foam::mixedEnthalpyFvPatchScalarField::updateCoeffs() { refValue() = thermo.h(Tw.refValue(), patchi); refGrad() = thermo.Cp(Tw, patchi)*Tw.refGrad() - + patch().deltaCoeffs()* - ( - thermo.h(Tw, patchi) - - thermo.h(Tw, patch().faceCells()) - ); + + patch().deltaCoeffs()* + ( + thermo.h(Tw, patchi) + - thermo.h(Tw, patch().faceCells()) + ); } else if ( @@ -135,11 +135,11 @@ void Foam::mixedEnthalpyFvPatchScalarField::updateCoeffs() { refValue() = thermo.hs(Tw.refValue(), patchi); refGrad() = thermo.Cp(Tw, patchi)*Tw.refGrad() - + patch().deltaCoeffs()* - ( - thermo.hs(Tw, patchi) - - thermo.hs(Tw, patch().faceCells()) - ); + + patch().deltaCoeffs()* + ( + thermo.hs(Tw, patchi) + - thermo.hs(Tw, patch().faceCells()) + ); } mixedFvPatchScalarField::updateCoeffs(); diff --git a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/system/fvSolution b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/system/fvSolution index 88d441f96..5f28675b0 100644 --- a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/system/fvSolution +++ b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/system/fvSolution @@ -68,13 +68,21 @@ solvers } blockSolver -{} +{ + convergence 1e-6; +} SIMPLE { nNonOrthoCorrectors 0; } +fieldBounds +{ + U 500; + p -5e4 5e4; +} + relaxationFactors { U 0.95; diff --git a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/system/fvSolution b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/system/fvSolution index b46b2dcea..25f2f4cab 100644 --- a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/system/fvSolution +++ b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/system/fvSolution @@ -82,7 +82,9 @@ solvers } blockSolver -{} +{ + convergence 1e-6; +} relaxationFactors { @@ -91,6 +93,12 @@ relaxationFactors epsilon 0.9; } +fieldBounds +{ + U 500; + p -5e4 5e4; +} + SIMPLE { nNonOrthoCorrectors 0; diff --git a/tutorials/incompressible/pUCoupledFoam/cavity/system/fvSolution b/tutorials/incompressible/pUCoupledFoam/cavity/system/fvSolution index c8d7f4f87..57f50a02a 100644 --- a/tutorials/incompressible/pUCoupledFoam/cavity/system/fvSolution +++ b/tutorials/incompressible/pUCoupledFoam/cavity/system/fvSolution @@ -69,10 +69,18 @@ solvers blockSolver { + convergence 1e-6; + pRefCell 0; pRefValue 0; } +fieldBounds +{ + U 500; + p -5e4 5e4; +} + relaxationFactors { U 0.999; diff --git a/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes b/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes index e584345e7..e7094ab12 100644 --- a/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes +++ b/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes @@ -16,7 +16,7 @@ FoamFile ddtSchemes { - default CrankNicholson 0.9; + default CrankNicolson 0.9; } gradSchemes