diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index f0cc40a8e4..4bef1736f0 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -96,20 +96,29 @@ castellatedMeshControls // refinement. nCellsBetweenLevels 1; + // Explicit feature edge refinement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies a level for any cell intersected by explicitly provided // edges. // This is a featureEdgeMesh, read from constant/triSurface for now. + // Specify 'levels' in the same way as the 'distance' mode in the + // refinementRegions (see below). The old specification + // level 2; + // is equivalent to + // levels ((0 2)); + features ( //{ // file "someLine.eMesh"; - // level 2; + // //level 2; + // levels ((0.0 2) (1.0 3)); //} ); + // Surface based refinement // ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -178,7 +187,7 @@ castellatedMeshControls // three modes // - distance. 'levels' specifies per distance to the surface the // wanted refinement level. The distances need to be specified in - // descending order. + // increasing order. // - inside. 'levels' is only one entry and only the level is used. All // cells inside the surface get refined up to the level. The surface // needs to be closed for this to be possible. diff --git a/bin/foamNew b/bin/foamNew index 4c5a996aad..5d61de6333 100755 --- a/bin/foamNew +++ b/bin/foamNew @@ -52,11 +52,11 @@ USAGE case "$1" in (-s | -source | source) shift - $WM_PROJECT_DIR/etc/codeTemplates/source/foamNewSource $* + $WM_PROJECT_DIR/etc/codeTemplates/source/foamNewSource "$@" ;; (-t | -template | template) shift - $WM_PROJECT_DIR/etc/codeTemplates/template/foamNewTemplate $* + $WM_PROJECT_DIR/etc/codeTemplates/template/foamNewTemplate "$@" ;; (*) usage "unknown type '$1'" diff --git a/etc/config/settings.csh b/etc/config/settings.csh index 069624f513..059ea30e33 100644 --- a/etc/config/settings.csh +++ b/etc/config/settings.csh @@ -391,22 +391,12 @@ case SYSTEMOPENMPI: # Use the system installed openmpi, get library directory via mpicc setenv FOAM_MPI openmpi-system - # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI - setenv PINC "`mpicc --showme:compile`" - setenv PLIBS "`mpicc --showme:link`" - set libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'` + set libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'` # Bit of a hack: strip off 'lib' and hope this is the path to openmpi # include files and libraries. setenv MPI_ARCH_PATH "${libDir:h}" - if ($?FOAM_VERBOSE && $?prompt) then - echo "Using system installed MPI:" - echo " compile flags : $PINC" - echo " link flags : $PLIBS" - echo " libmpi dir : $libDir" - endif - _foamAddLib $libDir unset libDir breaksw diff --git a/etc/config/settings.sh b/etc/config/settings.sh index 1fc2136530..ed45429a65 100644 --- a/etc/config/settings.sh +++ b/etc/config/settings.sh @@ -418,23 +418,12 @@ SYSTEMOPENMPI) # Use the system installed openmpi, get library directory via mpicc export FOAM_MPI=openmpi-system - # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI - export PINC="`mpicc --showme:compile`" - export PLIBS="`mpicc --showme:link`" - libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'` + libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'` # Bit of a hack: strip off 'lib' and hope this is the path to openmpi # include files and libraries. export MPI_ARCH_PATH="${libDir%/*}" - if [ "$FOAM_VERBOSE" -a "$PS1" ] - then - echo "Using system installed MPI:" 1>&2 - echo " compile flags : $PINC" 1>&2 - echo " link flags : $PLIBS" 1>&2 - echo " libmpi dir : $libDir" 1>&2 - fi - _foamAddLib $libDir unset libDir ;; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C index db6849d267..6313dab9c1 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C @@ -25,15 +25,10 @@ License #include "jumpCyclicFvPatchField.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -jumpCyclicFvPatchField::jumpCyclicFvPatchField +Foam::jumpCyclicFvPatchField::jumpCyclicFvPatchField ( const fvPatch& p, const DimensionedField& iF @@ -44,7 +39,7 @@ jumpCyclicFvPatchField::jumpCyclicFvPatchField template -jumpCyclicFvPatchField::jumpCyclicFvPatchField +Foam::jumpCyclicFvPatchField::jumpCyclicFvPatchField ( const jumpCyclicFvPatchField& ptf, const fvPatch& p, @@ -57,7 +52,7 @@ jumpCyclicFvPatchField::jumpCyclicFvPatchField template -jumpCyclicFvPatchField::jumpCyclicFvPatchField +Foam::jumpCyclicFvPatchField::jumpCyclicFvPatchField ( const fvPatch& p, const DimensionedField& iF, @@ -72,7 +67,7 @@ jumpCyclicFvPatchField::jumpCyclicFvPatchField template -jumpCyclicFvPatchField::jumpCyclicFvPatchField +Foam::jumpCyclicFvPatchField::jumpCyclicFvPatchField ( const jumpCyclicFvPatchField& ptf ) @@ -82,7 +77,7 @@ jumpCyclicFvPatchField::jumpCyclicFvPatchField template -jumpCyclicFvPatchField::jumpCyclicFvPatchField +Foam::jumpCyclicFvPatchField::jumpCyclicFvPatchField ( const jumpCyclicFvPatchField& ptf, const DimensionedField& iF @@ -95,7 +90,8 @@ jumpCyclicFvPatchField::jumpCyclicFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -tmp > jumpCyclicFvPatchField::patchNeighbourField() const +Foam::tmp > +Foam::jumpCyclicFvPatchField::patchNeighbourField() const { const Field& iField = this->internalField(); const labelUList& nbrFaceCells = @@ -133,7 +129,7 @@ tmp > jumpCyclicFvPatchField::patchNeighbourField() const template -void jumpCyclicFvPatchField::updateInterfaceMatrix +void Foam::jumpCyclicFvPatchField::updateInterfaceMatrix ( scalarField& result, const scalarField& psiInternal, @@ -142,48 +138,22 @@ void jumpCyclicFvPatchField::updateInterfaceMatrix const Pstream::commsTypes ) const { - scalarField pnf(this->size()); - - const labelUList& nbrFaceCells = - this->cyclicPatch().neighbFvPatch().faceCells(); - - // for AMG solve - only apply jump to finest level - if (psiInternal.size() == this->internalField().size()) - { - Field jf(this->jump()().component(cmpt)); - - if (!this->cyclicPatch().owner()) - { - jf *= -1.0; - } - - forAll(*this, facei) - { - pnf[facei] = psiInternal[nbrFaceCells[facei]] - jf[facei]; - } - } - else - { - forAll(*this, facei) - { - pnf[facei] = psiInternal[nbrFaceCells[facei]]; - } - } - - // Transform according to the transformation tensors - this->transformCoupleField(pnf, cmpt); - - // Multiply the field by coefficients and add into the result - const labelUList& faceCells = this->cyclicPatch().faceCells(); - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + notImplemented + ( + "void Foam::jumpCyclicFvPatchField::updateInterfaceMatrix" + "(" + "scalarField&, " + "const scalarField&, " + "const scalarField&, " + "const direction, " + "const Pstream::commsTypes" + ") const" + ); } template -void jumpCyclicFvPatchField::updateInterfaceMatrix +void Foam::jumpCyclicFvPatchField::updateInterfaceMatrix ( Field& result, const Field& psiInternal, @@ -196,8 +166,8 @@ void jumpCyclicFvPatchField::updateInterfaceMatrix const labelUList& nbrFaceCells = this->cyclicPatch().neighbFvPatch().faceCells(); - // for AMG solve - only apply jump to finest level - if (psiInternal.size() == this->internalField().size()) + // only apply jump to original field + if (&psiInternal == &this->internalField()) { Field jf(this->jump()); @@ -231,8 +201,4 @@ void jumpCyclicFvPatchField::updateInterfaceMatrix } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H index a5fd2343bf..42d0c1805f 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H @@ -144,6 +144,17 @@ public: ) const; }; +//- Update result field based on interface functionality +template<> +void jumpCyclicFvPatchField::updateInterfaceMatrix +( + scalarField& result, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType +) const; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C index 02e25e31da..2001e1e2f4 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,17 +27,63 @@ License #include "addToRunTimeSelectionTable.H" #include "volFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { + makePatchFieldsTypeName(jumpCyclic); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -makePatchFieldsTypeName(jumpCyclic); +template<> +void Foam::jumpCyclicFvPatchField::updateInterfaceMatrix +( + scalarField& result, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes +) const +{ + scalarField pnf(this->size()); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + const labelUList& nbrFaceCells = + this->cyclicPatch().neighbFvPatch().faceCells(); + + // only apply jump to original field + if (&psiInternal == &this->internalField()) + { + Field jf(this->jump()); + + if (!this->cyclicPatch().owner()) + { + jf *= -1.0; + } + + forAll(*this, facei) + { + pnf[facei] = psiInternal[nbrFaceCells[facei]] - jf[facei]; + } + } + else + { + forAll(*this, facei) + { + pnf[facei] = psiInternal[nbrFaceCells[facei]]; + } + } + + // Transform according to the transformation tensors + this->transformCoupleField(pnf, cmpt); + + // Multiply the field by coefficients and add into the result + const labelUList& faceCells = this->cyclicPatch().faceCells(); + forAll(faceCells, elemI) + { + result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; + } +} -} // End namespace Foam // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C index 87d7c20efd..ff36ee9797 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C @@ -129,33 +129,17 @@ void Foam::jumpCyclicAMIFvPatchField::updateInterfaceMatrix const Pstream::commsTypes ) const { - const labelUList& nbrFaceCells = - this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells(); - - scalarField pnf(psiInternal, nbrFaceCells); - - pnf = this->cyclicAMIPatch().interpolate(pnf); - - // for AMG solve - only apply jump to finest level - if (psiInternal.size() == this->internalField().size()) - { - tmp > tjf = jump()().component(cmpt); - if (!this->cyclicAMIPatch().owner()) - { - tjf = -tjf; - } - pnf -= tjf; - } - - // Transform according to the transformation tensors - this->transformCoupleField(pnf, cmpt); - - // Multiply the field by coefficients and add into the result - const labelUList& faceCells = this->cyclicAMIPatch().faceCells(); - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } + notImplemented + ( + "void Foam::jumpCyclicAMIFvPatchField::updateInterfaceMatrix" + "(" + "scalarField&, " + "const scalarField&, " + "const scalarField& coeffs," + "const direction, " + "const Pstream::commsTypes" + ") const" + ); } @@ -175,15 +159,16 @@ void Foam::jumpCyclicAMIFvPatchField::updateInterfaceMatrix pnf = this->cyclicAMIPatch().interpolate(pnf); - // for AMG solve - only apply jump to finest level - if (psiInternal.size() == this->internalField().size()) + // only apply jump to original field + if (&psiInternal == &this->internalField()) { - tmp > tjf = jump(); + Field jf(this->jump()); if (!this->cyclicAMIPatch().owner()) { - tjf = -tjf; + jf *= -1.0; } - pnf -= tjf; + + pnf -= jf; } // Transform according to the transformation tensors diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H index 6759b09a36..a2e77f0396 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H @@ -148,6 +148,18 @@ public: }; +//- Update result field based on interface functionality +template<> +void jumpCyclicAMIFvPatchField::updateInterfaceMatrix +( + scalarField& result, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType +) const; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C index 323f460d9f..b7349812da 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C @@ -36,6 +36,50 @@ namespace Foam makePatchFieldsTypeName(jumpCyclicAMI); +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<> +void Foam::jumpCyclicAMIFvPatchField::updateInterfaceMatrix +( + scalarField& result, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes +) const +{ + const labelUList& nbrFaceCells = + this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells(); + + scalarField pnf(psiInternal, nbrFaceCells); + + pnf = this->cyclicAMIPatch().interpolate(pnf); + + // only apply jump to original field + if (&psiInternal == &this->internalField()) + { + Field jf(this->jump()); + + if (!this->cyclicAMIPatch().owner()) + { + jf *= -1.0; + } + + pnf -= jf; + } + + // Transform according to the transformation tensors + this->transformCoupleField(pnf, cmpt); + + // Multiply the field by coefficients and add into the result + const labelUList& faceCells = this->cyclicAMIPatch().faceCells(); + forAll(faceCells, elemI) + { + result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; + } +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C index 3a150c6f70..775c0f1ced 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C @@ -25,6 +25,18 @@ License #include "fanFvPatchField.H" +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::fanFvPatchField::calcFanJump() +{ + if (this->cyclicPatch().owner()) + { + this->jump_ = this->jumpTable_->value(this->db().time().value()); + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -84,4 +96,21 @@ Foam::fanFvPatchField::fanFvPatchField {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::fanFvPatchField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + calcFanJump(); + + // call fixedJump variant - uniformJump will overwrite the jump value + fixedJumpFvPatchField::updateCoeffs(); +} + + // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H index 463ebeb543..218b4b1862 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H @@ -39,7 +39,6 @@ Description \table Property | Description | Required | Default value patchType | underlying patch type should be \c cyclic| yes | - jump | current jump value | yes | jumpTable | jump data, e.g. \c csvFile | yes | \endtable @@ -49,7 +48,6 @@ Description { type fan; patchType cyclic; - jump uniform 0; jumpTable csvFile; csvFileCoeffs { @@ -101,6 +99,12 @@ class fanFvPatchField public uniformJumpFvPatchField { + // Private Member Functions + + //- Calculate the fan pressure jump + void calcFanJump(); + + public: //- Runtime type information @@ -170,14 +174,15 @@ public: // Member functions - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); }; //- Specialisation of the jump-condition for the pressure +template<> +void fanFvPatchField::calcFanJump(); + template<> fanFvPatchField::fanFvPatchField ( @@ -185,8 +190,6 @@ fanFvPatchField::fanFvPatchField const DimensionedField&, const dictionary& ); -template<> -void fanFvPatchField::updateCoeffs(); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C index 668d43483d..8535c57127 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C @@ -30,18 +30,41 @@ License #include "Tuple2.H" #include "polynomial.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { + makeTemplatePatchTypeField + ( + fvPatchScalarField, + fanFvPatchScalarField + ); +} -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<> +void Foam::fanFvPatchField::calcFanJump() +{ + if (this->cyclicPatch().owner()) + { + const surfaceScalarField& phi = + db().lookupObject("phi"); + + const fvsPatchField& phip = + patch().patchField(phi); + + scalarField Un(max(phip/patch().magSf(), scalar(0))); + + if (phi.dimensions() == dimDensity*dimVelocity*dimArea) + { + Un /= patch().lookupPatchField("rho"); + } + + this->jump_ = this->jumpTable_->value(Un); + } +} -makeTemplatePatchTypeField -( - fvPatchScalarField, - fanFvPatchScalarField -); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -93,11 +116,6 @@ Foam::fanFvPatchField::fanFvPatchField this->jumpTable_ = DataEntry::New("jumpTable", dict); } } - else - { - // Dummy jump table - this->jumpTable_.reset(new DataEntry("jumpTable")); - } if (dict.found("value")) { @@ -113,41 +131,4 @@ Foam::fanFvPatchField::fanFvPatchField } -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -//- Specialisation of the jump-condition for the pressure -template<> -void Foam::fanFvPatchField::updateCoeffs() -{ - if (this->updated()) - { - return; - } - - if (this->cyclicPatch().owner()) - { - const surfaceScalarField& phi = - db().lookupObject("phi"); - - const fvsPatchField& phip = - patch().patchField(phi); - - scalarField Un(max(phip/patch().magSf(), scalar(0))); - - if (phi.dimensions() == dimDensity*dimVelocity*dimArea) - { - Un /= patch().lookupPatchField("rho"); - } - - this->jump_ = this->jumpTable_->value(Un); - } - - uniformJumpFvPatchField::updateCoeffs(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C index e58270ec63..9ef4be21a4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -138,7 +138,8 @@ template void Foam::fixedJumpFvPatchField::write(Ostream& os) const { fvPatchField::write(os); - os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl; + os.writeKeyword("patchType") << this->interfaceFieldType() + << token::END_STATEMENT << nl; jump_.writeEntry("jump", os); this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C index d9cdc383a3..4c3290cf2d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C @@ -141,7 +141,8 @@ template void Foam::fixedJumpAMIFvPatchField::write(Ostream& os) const { fvPatchField::write(os); - os.writeKeyword("patchType") << "cyclicAMI" << token::END_STATEMENT << nl; + os.writeKeyword("patchType") << this->interfaceFieldType() + << token::END_STATEMENT << nl; jump_.writeEntry("jump", os); this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C index c4ee64eaa8..250442dad0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C @@ -35,7 +35,7 @@ Foam::uniformJumpFvPatchField::uniformJumpFvPatchField ) : fixedJumpFvPatchField(p, iF), - jumpTable_(0) + jumpTable_(new DataEntry("jumpTable")) {} @@ -76,6 +76,10 @@ Foam::uniformJumpFvPatchField::uniformJumpFvPatchField Field("value", dict, p.size()) ); } + else + { + this->evaluate(Pstream::blocking); + } } @@ -105,24 +109,19 @@ Foam::uniformJumpFvPatchField::uniformJumpFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -Foam::tmp > Foam::uniformJumpFvPatchField::jump() const +void Foam::uniformJumpFvPatchField::updateCoeffs() { + if (this->updated()) + { + return; + } + if (this->cyclicPatch().owner()) { - const Type value = jumpTable_->value(this->db().time().value()); - - return tmp >(new Field(this->patch().size(), value)); + this->jump_ = jumpTable_->value(this->db().time().value()); } - else - { - const uniformJumpFvPatchField& nbrPatch = - refCast > - ( - this->neighbourPatchField() - ); - return nbrPatch.jump(); - } + fixedJumpFvPatchField::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H index 633dc1752e..aba63cb9d0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H @@ -165,11 +165,8 @@ public: // Member functions - // Access - - //- Return the "jump" across the patch. - virtual tmp > jump() const; - + //- Update the coefficients + virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C index a3e1fe6591..06f4e3c134 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C @@ -102,25 +102,19 @@ Foam::uniformJumpAMIFvPatchField::uniformJumpAMIFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -Foam::tmp > -Foam::uniformJumpAMIFvPatchField::jump() const +void Foam::uniformJumpAMIFvPatchField::updateCoeffs() { + if (this->updated()) + { + return; + } + if (this->cyclicAMIPatch().owner()) { - Type j = jumpTable_->value(this->db().time().value()); - - return tmp >(new Field(this->size(), j)); + this->jump_ = jumpTable_->value(this->db().time().value()); } - else - { - const uniformJumpAMIFvPatchField& nbrPatch = - refCast > - ( - this->neighbourPatchField() - ); - return this->cyclicAMIPatch().interpolate(nbrPatch.jump()); - } + fixedJumpAMIFvPatchField::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.H index e5eb2e6826..e00f9f9991 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.H @@ -165,11 +165,8 @@ public: // Member functions - // Access - - //- Return the "jump" across the patch. - virtual tmp > jump() const; - + //- Update the coefficients + virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index 985bcfd103..dfd769fd15 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -97,6 +97,7 @@ Foam::label Foam::autoRefineDriver::featureEdgeRefine refineParams.curvature(), true, // featureRefinement + false, // featureDistanceRefinement false, // internalRefinement false, // surfaceRefinement false, // curvatureRefinement @@ -207,6 +208,7 @@ Foam::label Foam::autoRefineDriver::surfaceOnlyRefine refineParams.curvature(), false, // featureRefinement + false, // featureDistanceRefinement false, // internalRefinement true, // surfaceRefinement true, // curvatureRefinement @@ -368,6 +370,7 @@ Foam::label Foam::autoRefineDriver::shellRefine refineParams.curvature(), false, // featureRefinement + true, // featureDistanceRefinement true, // internalRefinement false, // surfaceRefinement false, // curvatureRefinement diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index e358ba4ffa..54a78f477c 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -1406,9 +1406,10 @@ void Foam::autoSnapDriver::doSnap adaptPatchIDs ) ); + indirectPrimitivePatch& pp = ppPtr(); // Distance to attract to nearest feature on surface - const scalarField snapDist(calcSnapDistance(snapParams, ppPtr())); + const scalarField snapDist(calcSnapDistance(snapParams, pp)); // Construct iterative mesh mover. @@ -1420,7 +1421,7 @@ void Foam::autoSnapDriver::doSnap motionSmoother meshMover ( mesh, - ppPtr(), + pp, adaptPatchIDs, meshRefinement::makeDisplacementField(pMesh, adaptPatchIDs), motionDict @@ -1475,7 +1476,7 @@ void Foam::autoSnapDriver::doSnap } // Check for displacement being outwards. - outwardsDisplacement(ppPtr(), disp); + outwardsDisplacement(pp, disp); // Set initial distribution of displacement field (on patches) // from patchDisp and make displacement consistent with b.c. @@ -1489,8 +1490,8 @@ void Foam::autoSnapDriver::doSnap ( mesh.time().path() / "patchDisplacement_" + name(iter) + ".obj", - ppPtr().localPoints(), - ppPtr().localPoints() + disp + pp.localPoints(), + pp.localPoints() + disp ); } diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H index bd5dd86188..7cf1e79f61 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H @@ -141,14 +141,6 @@ class autoSnapDriver vectorField& pointSurfaceNormal, vectorField& pointRotation ) const; - //void calcNearestFace - //( - // const label iter, - // const indirectPrimitivePatch& pp, - // vectorField& faceDisp, - // vectorField& faceSurfaceNormal, - // vectorField& faceRotation - //) const; void calcNearestFace ( const label iter, @@ -158,15 +150,19 @@ class autoSnapDriver labelList& faceSurfaceRegion, vectorField& faceRotation ) const; - void interpolateFaceToPoint + void calcNearestFacePointProperties ( const label iter, const indirectPrimitivePatch& pp, - const List >& pointFaceDisp, - const List >& pointFaceRotation, - const List >& pointFaceCentres, - vectorField& patchDisp - //vectorField& patchRotationDisp + + const vectorField& faceDisp, + const vectorField& faceSurfaceNormal, + const labelList& faceSurfaceRegion, + + List >& pointFaceSurfNormals, + List >& pointFaceDisp, + List >& pointFaceCentres, + List& pointFacePatchID ) const; void correctAttraction ( @@ -276,6 +272,7 @@ class autoSnapDriver ( const label iter, const scalar featureCos, + const bool multiRegionFeatureSnap, const indirectPrimitivePatch&, const scalarField&, @@ -339,6 +336,7 @@ class autoSnapDriver ( const label iter, const scalar featureCos, + const bool multiRegionFeatureSnap, const indirectPrimitivePatch& pp, const scalarField& snapDist, diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C index 8bcd9c6270..f32d9ce4bd 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C @@ -321,7 +321,7 @@ void Foam::autoSnapDriver::calcNearestFace const indirectPrimitivePatch& pp, vectorField& faceDisp, vectorField& faceSurfaceNormal, - labelList& faceSurfaceRegion, + labelList& faceSurfaceGlobalRegion, vectorField& faceRotation ) const { @@ -333,8 +333,8 @@ void Foam::autoSnapDriver::calcNearestFace faceDisp = vector::zero; faceSurfaceNormal.setSize(pp.size()); faceSurfaceNormal = vector::zero; - faceSurfaceRegion.setSize(pp.size()); - faceSurfaceRegion = -1; + faceSurfaceGlobalRegion.setSize(pp.size()); + faceSurfaceGlobalRegion = -1; // Divide surfaces into zoned and unzoned labelList zonedSurfaces = surfaces.getNamedSurfaces(); @@ -419,7 +419,7 @@ void Foam::autoSnapDriver::calcNearestFace label faceI = ppFaces[hitI]; faceDisp[faceI] = hitInfo[hitI].hitPoint() - fc[hitI]; faceSurfaceNormal[faceI] = hitNormal[hitI]; - faceSurfaceRegion[faceI] = surfaces.globalRegion + faceSurfaceGlobalRegion[faceI] = surfaces.globalRegion ( hitSurface[hitI], hitRegion[hitI] @@ -477,7 +477,11 @@ void Foam::autoSnapDriver::calcNearestFace label faceI = ppFaces[hitI]; faceDisp[faceI] = hitInfo[hitI].hitPoint() - fc[hitI]; faceSurfaceNormal[faceI] = hitNormal[hitI]; - faceSurfaceRegion[faceI] = hitRegion[hitI]; + faceSurfaceGlobalRegion[faceI] = surfaces.globalRegion + ( + hitSurface[hitI], + hitRegion[hitI] + ); } } @@ -517,6 +521,169 @@ void Foam::autoSnapDriver::calcNearestFace } +// Collect (possibly remote) per point data of all surrounding faces +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// - faceSurfaceNormal +// - faceDisp +// - faceCentres&faceNormal +void Foam::autoSnapDriver::calcNearestFacePointProperties +( + const label iter, + const indirectPrimitivePatch& pp, + + const vectorField& faceDisp, + const vectorField& faceSurfaceNormal, + const labelList& faceSurfaceGlobalRegion, + + List >& pointFaceSurfNormals, + List >& pointFaceDisp, + List >& pointFaceCentres, + List& pointFacePatchID +) const +{ + const fvMesh& mesh = meshRefiner_.mesh(); + + // For now just get all surrounding face data. Expensive - should just + // store and sync data on coupled points only + // (see e.g PatchToolsNormals.C) + + pointFaceSurfNormals.setSize(pp.nPoints()); + pointFaceDisp.setSize(pp.nPoints()); + pointFaceCentres.setSize(pp.nPoints()); + pointFacePatchID.setSize(pp.nPoints()); + + // Fill local data + forAll(pp.pointFaces(), pointI) + { + const labelList& pFaces = pp.pointFaces()[pointI]; + List& pNormals = pointFaceSurfNormals[pointI]; + pNormals.setSize(pFaces.size()); + List& pDisp = pointFaceDisp[pointI]; + pDisp.setSize(pFaces.size()); + List& pFc = pointFaceCentres[pointI]; + pFc.setSize(pFaces.size()); + labelList& pFid = pointFacePatchID[pointI]; + pFid.setSize(pFaces.size()); + + forAll(pFaces, i) + { + label faceI = pFaces[i]; + pNormals[i] = faceSurfaceNormal[faceI]; + pDisp[i] = faceDisp[faceI]; + pFc[i] = pp.faceCentres()[faceI]; + //label meshFaceI = pp.addressing()[faceI]; + //pFid[i] = mesh.boundaryMesh().whichPatch(meshFaceI); + pFid[i] = globalToPatch_[faceSurfaceGlobalRegion[faceI]]; + } + } + + + // Collect additionally 'normal' boundary faces for boundaryPoints of pp + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // points on the boundary of pp should pick up non-pp normals + // as well for the feature-reconstruction to behave correctly. + // (the movement is already constrained outside correctly so it + // is only that the unconstrained attraction vector is calculated + // correctly) + { + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + labelList patchID(pbm.patchID()); + + // Unmark all non-coupled boundary faces + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + + if (pp.coupled() || isA(pp)) + { + forAll(pp, i) + { + label meshFaceI = pp.start()+i; + patchID[meshFaceI-mesh.nInternalFaces()] = -1; + } + } + } + + // Remove any meshed faces + forAll(pp.addressing(), i) + { + label meshFaceI = pp.addressing()[i]; + patchID[meshFaceI-mesh.nInternalFaces()] = -1; + } + + // See if pp point uses any non-meshed boundary faces + + const labelList& boundaryPoints = pp.boundaryPoints(); + forAll(boundaryPoints, i) + { + label pointI = boundaryPoints[i]; + label meshPointI = pp.meshPoints()[pointI]; + const point& pt = mesh.points()[meshPointI]; + const labelList& pFaces = mesh.pointFaces()[meshPointI]; + + List& pNormals = pointFaceSurfNormals[pointI]; + List& pDisp = pointFaceDisp[pointI]; + List& pFc = pointFaceCentres[pointI]; + labelList& pFid = pointFacePatchID[pointI]; + + forAll(pFaces, i) + { + label meshFaceI = pFaces[i]; + if (!mesh.isInternalFace(meshFaceI)) + { + label patchI = patchID[meshFaceI-mesh.nInternalFaces()]; + + if (patchI != -1) + { + vector fn = mesh.faceAreas()[meshFaceI]; + pNormals.append(fn/mag(fn)); + pDisp.append(mesh.faceCentres()[meshFaceI]-pt); + pFc.append(mesh.faceCentres()[meshFaceI]); + pFid.append(patchI); + } + } + } + } + } + + syncTools::syncPointList + ( + mesh, + pp.meshPoints(), + pointFaceSurfNormals, + listPlusEqOp(), + List(), + listTransform() + ); + syncTools::syncPointList + ( + mesh, + pp.meshPoints(), + pointFaceDisp, + listPlusEqOp(), + List(), + listTransform() + ); + syncTools::syncPointList + ( + mesh, + pp.meshPoints(), + pointFaceCentres, + listPlusEqOp(), + List(), + listTransform() + ); + syncTools::syncPointList + ( + mesh, + pp.meshPoints(), + pointFacePatchID, + listPlusEqOp