diff --git a/bin/foamNew b/bin/foamNew index 4c5a996aad01147a3e75afb743ecc31bc4003aba..5d61de63331ed59260c4bec23178278901684d4a 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 069624f513770e59da28f60cf8aadb975c5d82b8..059ea30e336bca5078baed3c2e343c97d678adfa 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 1fc2136530a5374a4d9cc3d9f8955c8858dbb91f..ed45429a650de2aa87ad202bf0634d8af40f32aa 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 db6849d26746be1dbdd6a5ffe56feed4e8dde12b..6313dab9c187afe3b82500ff29651415167cd0c0 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<class Type> -jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField +Foam::jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField ( const fvPatch& p, const DimensionedField<Type, volMesh>& iF @@ -44,7 +39,7 @@ jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField template<class Type> -jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField +Foam::jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField ( const jumpCyclicFvPatchField<Type>& ptf, const fvPatch& p, @@ -57,7 +52,7 @@ jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField template<class Type> -jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField +Foam::jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField ( const fvPatch& p, const DimensionedField<Type, volMesh>& iF, @@ -72,7 +67,7 @@ jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField template<class Type> -jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField +Foam::jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField ( const jumpCyclicFvPatchField<Type>& ptf ) @@ -82,7 +77,7 @@ jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField template<class Type> -jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField +Foam::jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField ( const jumpCyclicFvPatchField<Type>& ptf, const DimensionedField<Type, volMesh>& iF @@ -95,7 +90,8 @@ jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const +Foam::tmp<Foam::Field<Type> > +Foam::jumpCyclicFvPatchField<Type>::patchNeighbourField() const { const Field<Type>& iField = this->internalField(); const labelUList& nbrFaceCells = @@ -133,7 +129,7 @@ tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const template<class Type> -void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix +void Foam::jumpCyclicFvPatchField<Type>::updateInterfaceMatrix ( scalarField& result, const scalarField& psiInternal, @@ -142,48 +138,22 @@ void jumpCyclicFvPatchField<Type>::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<scalar> 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<Type>::updateInterfaceMatrix" + "(" + "scalarField&, " + "const scalarField&, " + "const scalarField&, " + "const direction, " + "const Pstream::commsTypes" + ") const" + ); } template<class Type> -void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix +void Foam::jumpCyclicFvPatchField<Type>::updateInterfaceMatrix ( Field<Type>& result, const Field<Type>& psiInternal, @@ -196,8 +166,8 @@ void jumpCyclicFvPatchField<Type>::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<Type> jf(this->jump()); @@ -231,8 +201,4 @@ void jumpCyclicFvPatchField<Type>::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 a5fd2343bfbf2fdfe13cc55cfbe5e12f4686abe6..42d0c1805f86a345e061b45faedcaffeed665c60 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<scalar>::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 02e25e31da795a6cc4aa4c2d06676ea708f48511..2001e1e2f4bdf3b04dca197402ab49d0141255c7 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 * * * * * * * * * * * * * // + +template<> +void Foam::jumpCyclicFvPatchField<Foam::scalar>::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<scalar> 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]]; + } + } -makePatchFieldsTypeName(jumpCyclic); + // 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 87d7c20efd5ba6f36d52eb22b8596efd211eb1bc..ff36ee9797cfb8b61b259f85048881ce6bf62d64 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<Type>::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<Field<scalar> > 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<Type>::updateInterfaceMatrix" + "(" + "scalarField&, " + "const scalarField&, " + "const scalarField& coeffs," + "const direction, " + "const Pstream::commsTypes" + ") const" + ); } @@ -175,15 +159,16 @@ void Foam::jumpCyclicAMIFvPatchField<Type>::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<Field<Type> > tjf = jump(); + Field<Type> 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 6759b09a36c57ba5a49b75d48147e216f010126e..a2e77f0396e8e31008b7a9e172a16254b144df22 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<scalar>::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 323f460d9f7d99139c13f5d878c6b6e2094a9c05..b7349812dabde90d340cc9a55a29e40bbcc7066b 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<scalar>::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<scalar> 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 18d5b3324288146561b458c4a01b3d9487b0baf6..775c0f1ced57a7af7e54e0df3454b75afe5fe913 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<class Type> +void Foam::fanFvPatchField<Type>::calcFanJump() +{ + if (this->cyclicPatch().owner()) + { + this->jump_ = this->jumpTable_->value(this->db().time().value()); + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Type> @@ -87,9 +99,17 @@ Foam::fanFvPatchField<Type>::fanFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -Foam::tmp<Foam::Field<Type> > Foam::fanFvPatchField<Type>::jump() const +void Foam::fanFvPatchField<Type>::updateCoeffs() { - return uniformJumpFvPatchField<Type>::jump(); + if (this->updated()) + { + return; + } + + calcFanJump(); + + // call fixedJump variant - uniformJump will overwrite the jump value + fixedJumpFvPatchField<scalar>::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H index bf0762f4788ffed8dba16c2b3208df6fa4ec009d..218b4b18626d114127da29094a9f5b0ae4458180 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<Type> { + // Private Member Functions + + //- Calculate the fan pressure jump + void calcFanJump(); + + public: //- Runtime type information @@ -170,17 +174,15 @@ public: // Member functions - // Evaluation functions - - //- Return the "jump" across the patch - tmp<Field<Type> > jump() const; - - //- 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<scalar>::calcFanJump(); + template<> fanFvPatchField<scalar>::fanFvPatchField ( @@ -189,12 +191,6 @@ fanFvPatchField<scalar>::fanFvPatchField const dictionary& ); -template<> -tmp<Field<scalar> > fanFvPatchField<scalar>::jump() const; - -template<> -void fanFvPatchField<scalar>::updateCoeffs(); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C index 7922b66fe37a337e117501c2b5e2639ba66001b1..8535c571279124b0016ac8bf53901ae4c4ebea74 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C @@ -41,6 +41,31 @@ namespace Foam ); } +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<> +void Foam::fanFvPatchField<Foam::scalar>::calcFanJump() +{ + if (this->cyclicPatch().owner()) + { + const surfaceScalarField& phi = + db().lookupObject<surfaceScalarField>("phi"); + + const fvsPatchField<scalar>& phip = + patch().patchField<surfaceScalarField, scalar>(phi); + + scalarField Un(max(phip/patch().magSf(), scalar(0))); + + if (phi.dimensions() == dimDensity*dimVelocity*dimArea) + { + Un /= patch().lookupPatchField<volScalarField, scalar>("rho"); + } + + this->jump_ = this->jumpTable_->value(Un); + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<> @@ -91,11 +116,6 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField this->jumpTable_ = DataEntry<scalar>::New("jumpTable", dict); } } - else - { - // Dummy jump table - this->jumpTable_.reset(new DataEntry<scalar>("jumpTable")); - } if (dict.found("value")) { @@ -111,54 +131,4 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField } -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<> -Foam::tmp<Foam::Field<Foam::scalar> > -Foam::fanFvPatchField<Foam::scalar>::jump() const -{ - if (this->cyclicPatch().owner()) - { - const surfaceScalarField& phi = - db().lookupObject<surfaceScalarField>("phi"); - - const fvsPatchField<scalar>& phip = - patch().patchField<surfaceScalarField, scalar>(phi); - - scalarField Un(max(phip/patch().magSf(), scalar(0))); - - if (phi.dimensions() == dimDensity*dimVelocity*dimArea) - { - Un /= patch().lookupPatchField<volScalarField, scalar>("rho"); - } - - return this->jumpTable_->value(Un); - } - else - { - return refCast<const fanFvPatchField<scalar> > - ( - this->neighbourPatchField() - ).jump(); - } -} - - -template<> -void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs() -{ - if (this->updated()) - { - return; - } - - if (this->cyclicPatch().owner()) - { - this->jump_ = jump(); - } - - uniformJumpFvPatchField<scalar>::updateCoeffs(); -} - - // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C index c4ee64eaa842271da8e38d9c61b2e13121019ee9..250442dad05d416d0ac011b9acb7dfba9ba132ac 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<Type>::uniformJumpFvPatchField ) : fixedJumpFvPatchField<Type>(p, iF), - jumpTable_(0) + jumpTable_(new DataEntry<Type>("jumpTable")) {} @@ -76,6 +76,10 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField Field<Type>("value", dict, p.size()) ); } + else + { + this->evaluate(Pstream::blocking); + } } @@ -105,24 +109,19 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -Foam::tmp<Foam::Field<Type> > Foam::uniformJumpFvPatchField<Type>::jump() const +void Foam::uniformJumpFvPatchField<Type>::updateCoeffs() { - if (this->cyclicPatch().owner()) + if (this->updated()) { - const Type value = jumpTable_->value(this->db().time().value()); - - return tmp<Field<Type> >(new Field<Type>(this->patch().size(), value)); + return; } - else - { - const uniformJumpFvPatchField& nbrPatch = - refCast<const uniformJumpFvPatchField<Type> > - ( - this->neighbourPatchField() - ); - return nbrPatch.jump(); + if (this->cyclicPatch().owner()) + { + this->jump_ = jumpTable_->value(this->db().time().value()); } + + fixedJumpFvPatchField<Type>::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H index 633dc1752e932bc92a6f646b8b73be79cf268623..aba63cb9d0eb70f6a70f3fa7edd13b9468b0384f 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<Field<Type> > 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 a3e1fe659190cf604f8749567e9be9e22a21d501..06f4e3c13457a484a4d525cdb5e645818099d090 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<Type>::uniformJumpAMIFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -Foam::tmp<Foam::Field<Type> > -Foam::uniformJumpAMIFvPatchField<Type>::jump() const +void Foam::uniformJumpAMIFvPatchField<Type>::updateCoeffs() { - if (this->cyclicAMIPatch().owner()) + if (this->updated()) { - Type j = jumpTable_->value(this->db().time().value()); - - return tmp<Field<Type> >(new Field<Type>(this->size(), j)); + return; } - else - { - const uniformJumpAMIFvPatchField& nbrPatch = - refCast<const uniformJumpAMIFvPatchField<Type> > - ( - this->neighbourPatchField() - ); - return this->cyclicAMIPatch().interpolate(nbrPatch.jump()); + if (this->cyclicAMIPatch().owner()) + { + this->jump_ = jumpTable_->value(this->db().time().value()); } + + fixedJumpAMIFvPatchField<Type>::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.H index e5eb2e6826883fb37c33b72c3af8d2118525af10..e00f9f9991dd43b6598a54e008240d031e16930b 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<Field<Type> > jump() const; - + //- Update the coefficients + virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index 64a03c43b1d61e5feca2ca66db5e3d28e8848670..33564024b1c13146cacebe7e0add6ccb3005b64e 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -45,31 +45,56 @@ void Foam::fieldMinMax::calcMinMaxFields const label procI = Pstream::myProcNo(); const fieldType& field = obr_.lookupObject<fieldType>(fieldName); + const fvMesh& mesh = field.mesh(); + + const volVectorField::GeometricBoundaryField& CfBoundary = + mesh.C().boundaryField(); + switch (mode) { case mdMag: { - const scalarField magField(mag(field)); + const volScalarField magField(mag(field)); + const volScalarField::GeometricBoundaryField& magFieldBoundary = + magField.boundaryField(); - labelList minIs(Pstream::nProcs()); scalarList minVs(Pstream::nProcs()); List<vector> minCs(Pstream::nProcs()); - minIs[procI] = findMin(magField); - minVs[procI] = magField[minIs[procI]]; - minCs[procI] = field.mesh().C()[minIs[procI]]; + label minProcI = findMin(magField); + minVs[procI] = magField[minProcI]; + minCs[procI] = field.mesh().C()[minProcI]; - Pstream::gatherList(minIs); - Pstream::gatherList(minVs); - Pstream::gatherList(minCs); labelList maxIs(Pstream::nProcs()); scalarList maxVs(Pstream::nProcs()); List<vector> maxCs(Pstream::nProcs()); - maxIs[procI] = findMax(magField); - maxVs[procI] = magField[maxIs[procI]]; - maxCs[procI] = field.mesh().C()[maxIs[procI]]; + label maxProcI = findMax(magField); + maxVs[procI] = magField[maxProcI]; + maxCs[procI] = field.mesh().C()[maxProcI]; + + forAll(magFieldBoundary, patchI) + { + const scalarField& mfp = magFieldBoundary[patchI]; + const vectorField& Cfp = CfBoundary[patchI]; + + label minPI = findMin(mfp); + if (mfp[minPI] < minVs[procI]) + { + minVs[procI] = mfp[minPI]; + minCs[procI] = Cfp[minPI]; + } + + label maxPI = findMax(mfp); + if (mfp[maxPI] > maxVs[procI]) + { + maxVs[procI] = mfp[maxPI]; + maxCs[procI] = Cfp[maxPI]; + } + } + + Pstream::gatherList(minVs); + Pstream::gatherList(minCs); - Pstream::gatherList(maxIs); Pstream::gatherList(maxVs); Pstream::gatherList(maxCs); @@ -127,25 +152,47 @@ void Foam::fieldMinMax::calcMinMaxFields } case mdCmpt: { + const typename fieldType::GeometricBoundaryField& + fieldBoundary = field.boundaryField(); + List<Type> minVs(Pstream::nProcs()); - labelList minIs(Pstream::nProcs()); List<vector> minCs(Pstream::nProcs()); - minIs[procI] = findMin(field); - minVs[procI] = field[minIs[procI]]; - minCs[procI] = field.mesh().C()[minIs[procI]]; + label minProcI = findMin(field); + minVs[procI] = field[minProcI]; + minCs[procI] = field.mesh().C()[minProcI]; - Pstream::gatherList(minIs); Pstream::gatherList(minVs); Pstream::gatherList(minCs); List<Type> maxVs(Pstream::nProcs()); - labelList maxIs(Pstream::nProcs()); List<vector> maxCs(Pstream::nProcs()); - maxIs[procI] = findMax(field); - maxVs[procI] = field[maxIs[procI]]; - maxCs[procI] = field.mesh().C()[maxIs[procI]]; + label maxProcI = findMax(field); + maxVs[procI] = field[maxProcI]; + maxCs[procI] = field.mesh().C()[maxProcI]; + + forAll(fieldBoundary, patchI) + { + const Field<Type>& fp = fieldBoundary[patchI]; + const vectorField& Cfp = CfBoundary[patchI]; + + label minPI = findMin(fp); + if (fp[minPI] < minVs[procI]) + { + minVs[procI] = fp[minPI]; + minCs[procI] = Cfp[minPI]; + } + + label maxPI = findMax(fp); + if (fp[maxPI] > maxVs[procI]) + { + maxVs[procI] = fp[maxPI]; + maxCs[procI] = Cfp[maxPI]; + } + } + + Pstream::gatherList(minVs); + Pstream::gatherList(minCs); - Pstream::gatherList(maxIs); Pstream::gatherList(maxVs); Pstream::gatherList(maxCs); diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C index 62ac6516efbe0c408c2fa518c6737d38019d4b81..71a097f55f6b9b51aec1498e4f96657f272e920d 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C @@ -113,9 +113,15 @@ void Foam::energyJumpFvPatchScalarField::updateCoeffs() thermo.T().boundaryField()[patchID] ); + fixedJumpFvPatchScalarField& Tbp = + const_cast<fixedJumpFvPatchScalarField&>(TbPatch); + + // force update of jump + Tbp.updateCoeffs(); + const labelUList& faceCells = this->patch().faceCells(); - jump_ = thermo.he(pp, TbPatch.jump(), faceCells); + jump_ = thermo.he(pp, Tbp.jump(), faceCells); } fixedJumpFvPatchField<scalar>::updateCoeffs(); diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C index 9f596c3cdec5589f8de979438241b12b1749023b..81a992b9ab2a93a89d510d3c2b059e68fa71705c 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C @@ -113,9 +113,15 @@ void Foam::energyJumpAMIFvPatchScalarField::updateCoeffs() thermo.T().boundaryField()[patchID] ); + fixedJumpAMIFvPatchScalarField& Tbp = + const_cast<fixedJumpAMIFvPatchScalarField&>(TbPatch); + + // force update of jump + Tbp.updateCoeffs(); + const labelUList& faceCells = this->patch().faceCells(); - jump_ = thermo.he(pp, TbPatch.jump(), faceCells); + jump_ = thermo.he(pp, Tbp.jump(), faceCells); } fixedJumpAMIFvPatchField<scalar>::updateCoeffs(); diff --git a/tutorials/mesh/cvMesh/simpleShapes/Allrun b/tutorials/mesh/cvMesh/simpleShapes/Allrun index f1259d32d27f3acd46796fd6c2afac3c00cf10ae..4c2ecc94734fd310575de005bb4df43b710db1bb 100755 --- a/tutorials/mesh/cvMesh/simpleShapes/Allrun +++ b/tutorials/mesh/cvMesh/simpleShapes/Allrun @@ -12,11 +12,11 @@ runApplication surfaceClean \ constant/triSurface/coneAndSphere_clean.obj mv log.surfaceClean log.surfaceClean.coneAndSphere # Orient so point to be meshed is inside surface -surfaceOrient \ +runApplication surfaceOrient \ constant/triSurface/coneAndSphere_clean.obj \ -inside '(0 -0.5 0)' \ - constant/triSurface/coneAndSphere_clean_orient.obj \ - > log.surfaceOrient.coneAndSphere 2>&1 + constant/triSurface/coneAndSphere_clean_orient.obj +mv log.surfaceOrient log.surfaceOrient.coneAndSphere # Same for outside runApplication surfaceClean \ @@ -24,11 +24,11 @@ runApplication surfaceClean \ 1e-4 1e-6 \ constant/triSurface/domain_clean.stl mv log.surfaceClean log.surfaceClean.domain -surfaceOrient \ +runApplication surfaceOrient \ constant/triSurface/domain_clean.stl \ -inside '(0 -0.5 0)' \ constant/triSurface/domain_clean_orient.stl - > log.surfaceOrient.domain 2>&1 +mv log.surfaceOrient log.surfaceOrient.domain runApplication surfaceFeatureExtract mv log.surfaceFeatureExtract log.surfaceFeatureExtract.coneAndSphere_clean