Commit 51c8c307 authored by graham's avatar graham
Browse files

ENH: Adding actve flag to dsmc binary collision submodels to allow

collision step to be skipped for the NoBinaryCollision model.
parent 0368f38a
......@@ -291,7 +291,10 @@ void Foam::DsmcCloud<ParcelType>::initialise
template<class ParcelType>
void Foam::DsmcCloud<ParcelType>::collisions()
{
buildCellOccupancy();
if (!binaryCollision().active())
{
return;
}
// Temporary storage for subCells
List<DynamicList<label> > subCells(8);
......@@ -1057,6 +1060,9 @@ void Foam::DsmcCloud<ParcelType>::evolve()
// Move the particles ballistically with their current velocities
Cloud<ParcelType>::move(td);
// Update cell occupancy
buildCellOccupancy();
// Calculate new velocities via stochastic collisions
collisions();
......
......@@ -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,
......
......@@ -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
(
......
......@@ -117,6 +117,12 @@ Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::active() const
{
return true;
}
template <class CloudType>
Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::sigmaTcR
......
......@@ -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
(
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "NoBinaryCollision.H"
#include "constants.H"
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template <class CloudType>
Foam::NoBinaryCollision<CloudType>::NoBinaryCollision
(
const dictionary& dict,
CloudType& cloud
)
:
BinaryCollisionModel<CloudType>(cloud)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>
Foam::NoBinaryCollision<CloudType>::~NoBinaryCollision()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::NoBinaryCollision<CloudType>::active() const
{
return false;
}
template <class CloudType>
Foam::scalar Foam::NoBinaryCollision<CloudType>::sigmaTcR
(
label typeIdP,
label typeIdQ,
const vector& UP,
const vector& UQ
) const
{
FatalErrorIn
(
"Foam::scalar Foam::NoBinaryCollision<CloudType>::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 <class CloudType>
void Foam::NoBinaryCollision<CloudType>::collide
(
label typeIdP,
label typeIdQ,
vector& UP,
vector& UQ,
scalar& EiP,
scalar& EiQ
)
{}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 <http://www.gnu.org/licenses/>.
Class
Foam::NoBinaryCollision
Description
No collison BinaryCollision Model
\*---------------------------------------------------------------------------*/
#ifndef NoBinaryCollision_H
#define NoBinaryCollision_H
#include "BinaryCollisionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class NoBinaryCollision Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class NoBinaryCollision
:
public BinaryCollisionModel<CloudType>
{
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
// ************************************************************************* //
......@@ -51,6 +51,12 @@ Foam::VariableHardSphere<CloudType>::~VariableHardSphere()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::VariableHardSphere<CloudType>::active() const
{
return true;
}
template <class CloudType>
Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
......
......@@ -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
(
......
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment