diff --git a/src/finiteVolume/interpolation/interpolation/interpolation/interpolation.H b/src/finiteVolume/interpolation/interpolation/interpolation/interpolation.H index f47e52f9c9ea743008b94086aa55edfb801d9da4..ca60aff4f4986a7fb79554bbf510df0b93d6a0b5 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolation/interpolation.H +++ b/src/finiteVolume/interpolation/interpolation/interpolation/interpolation.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -135,18 +135,24 @@ public: const label facei = -1 ) const = 0; - //- Interpolate field to the given point in the tetrahedron + //- Interpolate field to the given coordinates in the tetrahedron // defined by the given indices. Calls interpolate function // above here execpt where overridden by derived // interpolation types. virtual Type interpolate ( - const vector& position, + const barycentric& coordinates, const tetIndices& tetIs, const label facei = -1 ) const { - return interpolate(position, tetIs.cell(), facei); + return + interpolate + ( + tetIs.tet(pMesh_).barycentricToPoint(coordinates), + tetIs.cell(), + facei + ); } }; diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCell/interpolationCell.H b/src/finiteVolume/interpolation/interpolation/interpolationCell/interpolationCell.H index ce6c0df8822113e4d0f3328aae33065fe2522583..d2e61b8e438c818e33b47154f9c8cce0e1c02aa9 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCell/interpolationCell.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationCell/interpolationCell.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,6 +75,19 @@ public: const label celli, const label facei = -1 ) const; + + //- Interpolate field to the given coordinates in the tetrahedron + // defined by the given indices. This is an optimisation which skips + // calculating the position, as cell interpolation doesn't need it. + inline Type interpolate + ( + const barycentric& coordinates, + const tetIndices& tetIs, + const label facei = -1 + ) const + { + return interpolate(vector::zero, tetIs.cell(), facei); + } }; diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.H index d0b11f8ff86ef8ec9e707779dc36961bc0539b56..d95ad7dcb3c9ac952f6cb532d0b8238861e6f320 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -77,6 +77,19 @@ public: const label celli, const label facei = -1 ) const; + + //- Interpolate field to the given coordinates in the tetrahedron + // defined by the given indices. This is an optimisation which skips + // calculating the position, as cell interpolation doesn't need it. + inline Type interpolate + ( + const barycentric& coordinates, + const tetIndices& tetIs, + const label facei = -1 + ) const + { + return interpolate(vector::zero, tetIs.cell(), facei); + } }; diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.H index 7a4302f7aeeb4dde5fa1d85cb21d8ee689d94115..428054ed11ead40a3001e3a431298410dc7ae76d 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -86,11 +86,11 @@ public: const label facei = -1 ) const; - //- Interpolate field to the given point in the tetrahedron + //- Interpolate field to the given coordinates in the tetrahedron // defined by the given indices. inline Type interpolate ( - const vector& position, + const barycentric& coordinates, const tetIndices& tetIs, const label facei = -1 ) const; diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPointI.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPointI.H index e8e5bd3fa50a0ed8cac59f671573c351eae7d7f9..a547a72e601b9692e35ead32382f2c0eb96f8682 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPointI.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPointI.H @@ -58,7 +58,7 @@ inline Type Foam::interpolationCellPoint<Type>::interpolate template<class Type> inline Type Foam::interpolationCellPoint<Type>::interpolate ( - const vector& position, + const barycentric& coordinates, const tetIndices& tetIs, const label facei ) const @@ -79,21 +79,13 @@ inline Type Foam::interpolationCellPoint<Type>::interpolate } } - FixedList<scalar, 4> weights; - - tetIs.tet(this->pMesh_).barycentric(position, weights); - - // Order of weights is the same as that of the vertices of the tet, i.e. - // cellCentre, faceBasePt, facePtA, facePtB. - - Type t = this->psi_[tetIs.cell()]*weights[0]; - const triFace triIs = tetIs.faceTriIs(this->pMesh_); - t += psip_[triIs[0]]*weights[1]; - t += psip_[triIs[1]]*weights[2]; - t += psip_[triIs[2]]*weights[3]; - return t; + return + this->psi_[tetIs.cell()]*coordinates[0] + + psip_[triIs[0]]*coordinates[1] + + psip_[triIs[1]]*coordinates[2] + + psip_[triIs[2]]*coordinates[3]; } diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H index a2bd9c751845f981ae401028433495d3e553ab80..2cfa869fc341cbb9f955fa0db5b9a07dafd339dc 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,11 +78,11 @@ public: const label facei = -1 ) const; - //- Interpolate field to the given point in the tetrahedron + //- Interpolate field to the given coordinates in the tetrahedron // defined by the given indices. inline Type interpolate ( - const vector& position, + const barycentric& coordinates, const tetIndices& tetIs, const label facei = -1 ) const; diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModifiedI.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModifiedI.H index 803c7a440a050570ecc42e6b745a0ff50e4e5fcb..96f90becdc34839f21ed0bf877f38bdeb4190325 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModifiedI.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModifiedI.H @@ -67,7 +67,7 @@ inline Type Foam::interpolationCellPointWallModified<Type>::interpolate template<class Type> inline Type Foam::interpolationCellPointWallModified<Type>::interpolate ( - const vector& position, + const barycentric& coordinates, const tetIndices& tetIs, const label facei ) const @@ -101,7 +101,7 @@ inline Type Foam::interpolationCellPointWallModified<Type>::interpolate return interpolationCellPoint<Type>::interpolate ( - position, + coordinates, tetIs, facei ); diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 0a0b755ea3fceaa055123a5d7d011bde57b4cf9c..49888b5140d447d88c0c049e6525e8a054ecfd69 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -48,7 +48,7 @@ void Foam::KinematicParcel<ParcelType>::setCellValues { tetIndices tetIs = this->currentTetIndices(); - rhoc_ = td.rhoInterp().interpolate(this->position(), tetIs); + rhoc_ = td.rhoInterp().interpolate(this->coordinates(), tetIs); if (rhoc_ < td.cloud().constProps().rhoMin()) { @@ -62,9 +62,9 @@ void Foam::KinematicParcel<ParcelType>::setCellValues rhoc_ = td.cloud().constProps().rhoMin(); } - Uc_ = td.UInterp().interpolate(this->position(), tetIs); + Uc_ = td.UInterp().interpolate(this->coordinates(), tetIs); - muc_ = td.muInterp().interpolate(this->position(), tetIs); + muc_ = td.muInterp().interpolate(this->coordinates(), tetIs); // Apply dispersion components to carrier phase velocity Uc_ = td.cloud().dispersion().update diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 08be00dae3b0e4cc8264d4b322b568eb584f7755..3300c2c3e051e52b3a887ce2ec127a19fa57ce83 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -211,7 +211,7 @@ void Foam::ReactingParcel<ParcelType>::setCellValues pc_ = td.pInterp().interpolate ( - this->position(), + this->coordinates(), this->currentTetIndices() ); diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C index 90f52a9bbc5c24752c140e7eac47bf2c8a55a6f7..4a906cb642eb4b499bc568b0762c27cb958aeb41 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,9 +43,9 @@ void Foam::ThermoParcel<ParcelType>::setCellValues tetIndices tetIs = this->currentTetIndices(); - Cpc_ = td.CpInterp().interpolate(this->position(), tetIs); + Cpc_ = td.CpInterp().interpolate(this->coordinates(), tetIs); - Tc_ = td.TInterp().interpolate(this->position(), tetIs); + Tc_ = td.TInterp().interpolate(this->coordinates(), tetIs); if (Tc_ < td.cloud().constProps().TMin()) { @@ -124,8 +124,8 @@ void Foam::ThermoParcel<ParcelType>::calcSurfaceValues rhos = this->rhoc_*TRatio; tetIndices tetIs = this->currentTetIndices(); - mus = td.muInterp().interpolate(this->position(), tetIs)/TRatio; - kappas = td.kappaInterp().interpolate(this->position(), tetIs)/TRatio; + mus = td.muInterp().interpolate(this->coordinates(), tetIs)/TRatio; + kappas = td.kappaInterp().interpolate(this->coordinates(), tetIs)/TRatio; Pr = Cpc_*mus/kappas; Pr = max(ROOTVSMALL, Pr); @@ -286,7 +286,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer if (td.cloud().radiation()) { tetIndices tetIs = this->currentTetIndices(); - const scalar Gc = td.GInterp().interpolate(this->position(), tetIs); + const scalar Gc = td.GInterp().interpolate(this->coordinates(), tetIs); const scalar sigma = physicoChemical::sigma.value(); const scalar epsilon = td.cloud().constProps().epsilon0(); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Lift/LiftForce/LiftForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Lift/LiftForce/LiftForce.C index c9c7fbc0b5a2a18538d75679642a46abcdaf4fff..1268179b7399a72063a2a760821f7c013220c996 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Lift/LiftForce/LiftForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Lift/LiftForce/LiftForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -137,7 +137,7 @@ Foam::forceSuSp Foam::LiftForce<CloudType>::calcCoupled forceSuSp value(Zero, 0.0); vector curlUc = - curlUcInterp().interpolate(p.position(), p.currentTetIndices()); + curlUcInterp().interpolate(p.coordinates(), p.currentTetIndices()); scalar Cl = this->Cl(p, curlUc, Re, muc); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C index 8426d371403034c796bf5e4a12f759102bb89fd1..a268a07b09938a816a370e113e4b11b0995913c6 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -110,7 +110,7 @@ Foam::forceSuSp Foam::ParamagneticForce<CloudType>::calcNonCoupled value.Su()= mass*3.0*constant::electromagnetic::mu0.value()/p.rho() *magneticSusceptibility_/(magneticSusceptibility_ + 3) - *HdotGradHInterp.interpolate(p.position(), p.currentTetIndices()); + *HdotGradHInterp.interpolate(p.coordinates(), p.currentTetIndices()); return value; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C index e0d6518fba736461445d2a2875eebc6d6c11d9be..0059a6627f158de5165bc781797b7b453476f4ec 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -128,7 +128,7 @@ Foam::forceSuSp Foam::PressureGradientForce<CloudType>::calcCoupled forceSuSp value(Zero, 0.0); vector DUcDt = - DUcDtInterp().interpolate(p.position(), p.currentTetIndices()); + DUcDtInterp().interpolate(p.coordinates(), p.currentTetIndices()); value.Su() = mass*p.rhoc()/p.rho()*DUcDt; diff --git a/src/lagrangian/solidParticle/solidParticle.C b/src/lagrangian/solidParticle/solidParticle.C index ec189b4a141720b7d2bbb9802723ba9d5387d2c9..d21041a4ec91916702028997c8028f0d850870b5 100644 --- a/src/lagrangian/solidParticle/solidParticle.C +++ b/src/lagrangian/solidParticle/solidParticle.C @@ -55,7 +55,6 @@ bool Foam::solidParticle::move } - const label celli = cell(); const scalar sfrac = stepFraction(); const scalar f = 1 - stepFraction(); @@ -63,10 +62,10 @@ bool Foam::solidParticle::move const scalar dt = (stepFraction() - sfrac)*trackTime; - cellPointWeight cpw(mesh(), position(), celli, face()); - scalar rhoc = td.rhoInterp().interpolate(cpw); - vector Uc = td.UInterp().interpolate(cpw); - scalar nuc = td.nuInterp().interpolate(cpw); + const tetIndices tetIs = this->currentTetIndices(); + scalar rhoc = td.rhoInterp().interpolate(this->coordinates(), tetIs); + vector Uc = td.UInterp().interpolate(this->coordinates(), tetIs); + scalar nuc = td.nuInterp().interpolate(this->coordinates(), tetIs); scalar rhop = td.cloud().rhop(); scalar magUr = mag(Uc - U_);