# PhasicFlow: src/Interaction/interaction/interaction.cpp Source File

interaction.cpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "interaction.hpp"
pFlow::interaction::interaction
(
systemControl& control,
const particles& prtcl,
const geometry& geom
)
:
demInteraction(control, control.caseSetup().path()+interactionFile__),
interactionBase(prtcl, geom),
fileDict_(control.caseSetup().emplaceObject<dictionary>(
objectFile(
interactionFile__,
"",
objectFile::READ_ALWAYS,
objectFile::WRITE_NEVER),
interactionFile__,
true ))
{
this->subscribe(prtcl.pStruct());
contactSearch_ = contactSearch::create(
fileDict_.subDict("contactSearch"),
this->control().domain(),
prtcl,
geom,
timers()
);
}
pFlow::uniquePtr<pFlow::interaction> pFlow::interaction::create
(
systemControl& control,
const particles& prtcl,
const geometry& geom
)
{
word shapeTypeName = prtcl.shapeTypeName();
word motionTypeName = geom.motionModelTypeName();
fileSystem file = control.caseSetup().path()+interactionFile__;
dictionary dict(interactionFile__, file);
auto interactionDict= dict.subDict("model");
word clType = dict.getVal<word>("contactListType");
word cfModel = interactionDict.getVal<word>("contactForceModel");
word rfModel = interactionDict.getVal<word>("rollingFrictionModel");
auto interactionModel = angleBracketsNames3(
shapeTypeName+"Interaction",
angleBracketsNames(rfModel,cfModel),
motionTypeName,
clType);
REPORT(1)<< "Selecting interaction model..."<<endREPORT;
if( systemControlvCtorSelector_.search(interactionModel) )
{
auto objPtr =
systemControlvCtorSelector_[interactionModel]
(control, prtcl, geom);
REPORT(2)<<"Model "<<greenText(interactionModel)<<" is created."<<endREPORT;
return objPtr;
}
else
{
printKeys
(
fatalError << "Ctor Selector "<<
interactionModel << " dose not exist. \n"
<<"Avaiable ones are: \n\n"
,
systemControlvCtorSelector_
);
fatalExit;
}
return nullptr;
}
pFlow::angleBracketsNames3
word angleBracketsNames3(const word &base, const word &w1, const word &w2, const word &w3)
Definition: bTypesFunctions.cpp:146
endREPORT
#define endREPORT
Definition: streams.hpp:41
fatalExit
#define fatalExit
Definition: error.hpp:57
REPORT
#define REPORT(n)
Definition: streams.hpp:40
pFlow::particles::shapeTypeName
virtual word shapeTypeName() const =0
pFlow::geometry::motionModelTypeName
virtual word motionModelTypeName() const =0
pFlow::interaction::create
static uniquePtr< interaction > create(systemControl &control, const particles &prtcl, const geometry &geom)
Definition: interaction.cpp:56
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::systemControl
Definition: systemControl.hpp:41
pFlow::printKeys
iOstream & printKeys(iOstream &os, const wordHashMap< T > &m)
pFlow::interactionFile__
const char * interactionFile__
Definition: vocabs.hpp:48
pFlow::repository::emplaceObject
T & emplaceObject(const objectFile &objf, Args &&... args)
Definition: repositoryTemplates.cpp:38
interaction.hpp
pFlow::systemControl::caseSetup
const repository & caseSetup() const
Definition: systemControl.hpp:114
greenText
#define greenText(text)
Definition: streams.hpp:32
pFlow::fileSystem
Definition: fileSystem.hpp:63
pFlow::demInteraction
Definition: demInteraction.hpp:32
pFlow::particles
Definition: particles.hpp:33
pFlow::angleBracketsNames
word angleBracketsNames(const word &w1, const word &w2)
Definition: bTypesFunctions.cpp:131
pFlow::particles::pStruct
const auto & pStruct() const
Definition: particles.hpp:118
pFlow::objectFile
Definition: objectFile.hpp:33
fatalError
#define fatalError
Definition: error.hpp:36
pFlow::repository::path
virtual fileSystem path() const
Definition: repository.cpp:61
pFlow::interactionBase
Definition: interactionBase.hpp:31
pFlow::dictionary::subDict
dictionary & subDict(const word &keyword)
Definition: dictionary.cpp:547
pFlow::dictionary::getVal
T getVal(const word &keyword) const
Definition: dictionary.hpp:309
pFlow::uniquePtr
Definition: uniquePtr.hpp:44
pFlow::geometry
Definition: geometry.hpp:37
pFlow::interaction::interaction
interaction(systemControl &control, const particles &prtcl, const geometry &geom)
Definition: interaction.cpp:25
pFlow::dictionary
Definition: dictionary.hpp:38