1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "MultiInteraction.H"
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 template<class CloudType>
31 bool Foam::MultiInteraction<CloudType>::read(const dictionary& dict)
35 Info<< "Patch interaction model " << typeName << nl
36 << "Executing in turn " << endl;
39 forAllConstIter(dictionary, dict, iter)
43 Info<< " " << iter().name() << endl;
49 models_.setSize(nModels);
51 forAllConstIter(dictionary, dict, iter)
58 PatchInteractionModel<CloudType>::New
67 oneInteractionOnly_ = Switch(dict.lookup("oneInteractionOnly"));
69 if (oneInteractionOnly_)
71 Info<< "Stopping upon first model that interacts with particle."
76 Info<< "Allowing multiple models to interact."
84 // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
86 template<class CloudType>
87 Foam::MultiInteraction<CloudType>::MultiInteraction
89 const dictionary& dict,
93 PatchInteractionModel<CloudType>(dict, cloud, typeName)
95 read(this->coeffDict());
99 template<class CloudType>
100 Foam::MultiInteraction<CloudType>::MultiInteraction
102 const MultiInteraction<CloudType>& pim
105 PatchInteractionModel<CloudType>(pim),
106 oneInteractionOnly_(pim.oneInteractionOnly_),
111 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
113 template <class CloudType>
114 Foam::MultiInteraction<CloudType>::~MultiInteraction()
118 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
120 template<class CloudType>
121 bool Foam::MultiInteraction<CloudType>::active() const
125 if (models_[i].active())
134 template <class CloudType>
135 bool Foam::MultiInteraction<CloudType>::correct
137 typename CloudType::parcelType& p,
140 const scalar trackFraction,
141 const tetIndices& tetIs
144 label origFacei = p.face();
145 label patchi = pp.index();
147 bool interacted = false;
151 bool myInteracted = models_[i].correct
154 this->owner().pMesh().boundaryMesh()[patchi],
160 if (myInteracted && oneInteractionOnly_)
165 interacted = (interacted || myInteracted);
168 // Check if perhaps the interaction model has changed patches
169 // (CoincidentBaffleInteraction can do this)
171 if (p.face() != origFacei)
173 origFacei = p.face();
174 patchi = p.patch(p.face());
176 // Interaction model has moved particle off wall?
188 // ************************************************************************* //