/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM 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. OpenFOAM 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 OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "InterfaceForce.H" #include "fvcGrad.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::InterfaceForce::InterfaceForce ( CloudType& owner, const fvMesh& mesh, const dictionary& dict ) : ParticleForce(owner, mesh, dict, typeName, true), alphaName_(this->coeffs().lookup("alpha")), C_(this->coeffs().getScalar("C")), gradInterForceInterpPtr_(nullptr) {} template Foam::InterfaceForce::InterfaceForce(const InterfaceForce& pf) : ParticleForce(pf), alphaName_(pf.alphaName_), C_(pf.C_), gradInterForceInterpPtr_(pf.gradInterForceInterpPtr_) {} // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // template Foam::InterfaceForce::~InterfaceForce() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template void Foam::InterfaceForce::cacheFields(const bool store) { static word resultName("gradAlpha"); volVectorField* resultPtr = this->mesh().template getObjectPtr(resultName); if (store) { if (!resultPtr) { const volScalarField& alpha = this->mesh().template lookupObject(alphaName_); resultPtr = new volVectorField ( resultName, fvc::grad(alpha*(1-alpha)) ); resultPtr->store(); } const volVectorField& gradInterForce = *resultPtr; gradInterForceInterpPtr_.reset ( interpolation::New ( this->owner().solution().interpolationSchemes(), gradInterForce ).ptr() ); } else { gradInterForceInterpPtr_.clear(); if (resultPtr) { resultPtr->checkOut(); } } } template Foam::forceSuSp Foam::InterfaceForce::calcNonCoupled ( const typename CloudType::parcelType& p, const typename CloudType::parcelType::trackingData& td, const scalar dt, const scalar mass, const scalar Re, const scalar muc ) const { forceSuSp value(Zero); const interpolation& interp = gradInterForceInterpPtr_(); value.Su() = C_ *mass *interp.interpolate(p.coordinates(), p.currentTetIndices()); return value; } // ************************************************************************* //