diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C index 0d9e84533d..455ee7936d 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C @@ -291,7 +291,10 @@ void Foam::DsmcCloud::initialise template void Foam::DsmcCloud::collisions() { - buildCellOccupancy(); + if (!binaryCollision().active()) + { + return; + } // Temporary storage for subCells List > subCells(8); @@ -1057,6 +1060,9 @@ void Foam::DsmcCloud::evolve() // Move the particles ballistically with their current velocities Cloud::move(td); + // Update cell occupancy + buildCellOccupancy(); + // Calculate new velocities via stochastic collisions collisions(); diff --git a/src/lagrangian/dsmc/parcels/derived/dsmcParcel/makeDsmcParcelBinaryCollisionModels.C b/src/lagrangian/dsmc/parcels/derived/dsmcParcel/makeDsmcParcelBinaryCollisionModels.C index b07fd0cb2d..1e8356ef5f 100644 --- a/src/lagrangian/dsmc/parcels/derived/dsmcParcel/makeDsmcParcelBinaryCollisionModels.C +++ b/src/lagrangian/dsmc/parcels/derived/dsmcParcel/makeDsmcParcelBinaryCollisionModels.C @@ -25,6 +25,7 @@ License #include "dsmcParcel.H" #include "DsmcCloud.H" +#include "NoBinaryCollision.H" #include "VariableHardSphere.H" #include "LarsenBorgnakkeVariableHardSphere.H" @@ -34,6 +35,12 @@ namespace Foam // Add instances of collision model to the table makeBinaryCollisionModelType + ( + NoBinaryCollision, + DsmcCloud, + dsmcParcel + ); + makeBinaryCollisionModelType ( VariableHardSphere, DsmcCloud, diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/BinaryCollisionModel/BinaryCollisionModel.H b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/BinaryCollisionModel/BinaryCollisionModel.H index 27f73d4992..0136cd5f6a 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/BinaryCollisionModel/BinaryCollisionModel.H +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/BinaryCollisionModel/BinaryCollisionModel.H @@ -126,6 +126,9 @@ public: // Member Functions + //- Flag to indicate whether model activates collision model + virtual bool active() const = 0; + //- Return the collision cross section * relative velocity product virtual scalar sigmaTcR ( diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C index c7bf6a00ab..e5112d5c66 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C @@ -117,6 +117,12 @@ Foam::LarsenBorgnakkeVariableHardSphere:: // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +bool Foam::LarsenBorgnakkeVariableHardSphere::active() const +{ + return true; +} + template Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere::sigmaTcR diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.H b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.H index f01f625e3f..3f742a78ae 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.H +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.H @@ -89,6 +89,9 @@ public: // Member Functions + //- Flag to indicate whether model activates collision model + virtual bool active() const; + //- Return the collision cross section * relative velocity product virtual scalar sigmaTcR ( diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.C new file mode 100644 index 0000000000..5ff9889638 --- /dev/null +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.C @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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 "NoBinaryCollision.H" +#include "constants.H" + +using namespace Foam::constant::mathematical; + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::NoBinaryCollision::NoBinaryCollision +( + const dictionary& dict, + CloudType& cloud +) +: + BinaryCollisionModel(cloud) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::NoBinaryCollision::~NoBinaryCollision() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::NoBinaryCollision::active() const +{ + return false; +} + + +template +Foam::scalar Foam::NoBinaryCollision::sigmaTcR +( + label typeIdP, + label typeIdQ, + const vector& UP, + const vector& UQ +) const +{ + FatalErrorIn + ( + "Foam::scalar Foam::NoBinaryCollision::sigmaTcR" + "(" + "label typeIdP," + "label typeIdQ," + "const vector& UP," + "const vector& UQ" + ") const" + ) + << "sigmaTcR called on NoBinaryCollision model, this should " + << "not happen, this is not an actual model." << nl + << "Enclose calls to sigmaTcR within a if(binaryCollision().active()) " + << " check." + << abort(FatalError); + + return 0.0; +} + + +template +void Foam::NoBinaryCollision::collide +( + label typeIdP, + label typeIdQ, + vector& UP, + vector& UQ, + scalar& EiP, + scalar& EiQ +) +{} + + +// ************************************************************************* // diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.H b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.H new file mode 100644 index 0000000000..b48cedb316 --- /dev/null +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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 . +Class + Foam::NoBinaryCollision + +Description + No collison BinaryCollision Model + +\*---------------------------------------------------------------------------*/ + +#ifndef NoBinaryCollision_H +#define NoBinaryCollision_H + +#include "BinaryCollisionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class NoBinaryCollision Declaration +\*---------------------------------------------------------------------------*/ + +template +class NoBinaryCollision +: + public BinaryCollisionModel +{ +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from dictionary + NoBinaryCollision + ( + const dictionary& dict, + CloudType& cloud + ); + + + //- Destructor + virtual ~NoBinaryCollision(); + + + // Member Functions + + //- Flag to indicate whether model activates collision model + virtual bool active() const; + + //- Return the collision cross section * relative velocity product + virtual scalar sigmaTcR + ( + label typeIdP, + label typeIdQ, + const vector& UP, + const vector& UQ + ) const; + + //- Apply collision + virtual void collide + ( + label typeIdP, + label typeIdQ, + vector& UP, + vector& UQ, + scalar& EiP, + scalar& EiQ + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "NoBinaryCollision.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C index e248d01161..8f7d13dd7d 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C @@ -51,6 +51,12 @@ Foam::VariableHardSphere::~VariableHardSphere() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +bool Foam::VariableHardSphere::active() const +{ + return true; +} + template Foam::scalar Foam::VariableHardSphere::sigmaTcR diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.H b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.H index 17e1684ee9..bf986189c0 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.H +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.H @@ -74,6 +74,9 @@ public: // Member Functions + //- Flag to indicate whether model activates collision model + virtual bool active() const; + //- Return the collision cross section * relative velocity product virtual scalar sigmaTcR ( diff --git a/tutorials/discreteMethods/dsmcFoam/freeSpaceStream/0/interpolaterhoN b/tutorials/discreteMethods/dsmcFoam/freeSpaceStream/0/interpolaterhoN deleted file mode 100644 index 73a629252d..0000000000 --- a/tutorials/discreteMethods/dsmcFoam/freeSpaceStream/0/interpolaterhoN +++ /dev/null @@ -1,42 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class surfaceScalarField; - location "0"; - object interpolaterhoN; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 -3 0 0 0 0 0]; - -internalField uniform 0; - -boundaryField -{ - outlet - { - type calculated; - value uniform 0; - } - inlet - { - type calculated; - value uniform 0; - } - sides - { - type calculated; - value uniform 0; - } -} - - -// ************************************************************************* //