course graining added

This commit is contained in:
alireza Hosseini
2024-11-17 10:19:40 +03:30
parent 7eb707f950
commit 2bd95b933f
43 changed files with 4566 additions and 5 deletions

View File

@ -0,0 +1,104 @@
#include "boundarySphereInteraction.hpp"
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
template <typename cFM, typename gMM>
void pFlow::boundaryGrainInteraction<cFM, gMM>::allocatePPPairs()
{
ppPairs_.reset(nullptr);
ppPairs_ = makeUnique<ContactListType>(1);
}
template <typename cFM, typename gMM>
void pFlow::boundaryGrainInteraction<cFM, gMM>::allocatePWPairs()
{
pwPairs_.reset(nullptr);
pwPairs_ = makeUnique<ContactListType>(1);
}
template <typename cFM, typename gMM>
pFlow::boundaryGrainInteraction<cFM, gMM>::boundaryGrainInteraction(
const boundaryBase &boundary,
const grainParticles &grnPrtcls,
const GeometryMotionModel &geomMotion)
: generalBoundary(boundary, grnPrtcls.pStruct(), "", ""),
geometryMotion_(geomMotion),
grnParticles_(grnPrtcls)
{
}
template <typename cFM, typename gMM>
pFlow::uniquePtr<pFlow::boundaryGrainInteraction<cFM, gMM>>
pFlow::boundaryGrainInteraction<cFM, gMM>::create(
const boundaryBase &boundary,
const grainParticles &grnPrtcls,
const GeometryMotionModel &geomMotion)
{
word cfTypeName = ContactForceModel::TYPENAME();
word gmTypeName = MotionModel::TYPENAME();
word bType = boundary.type();
word boundaryTypeName = angleBracketsNames3(
"boundaryGrainInteraction",
bType,
cfTypeName,
gmTypeName);
word altBTypeName = angleBracketsNames2(
"boundaryGrainInteraction",
cfTypeName,
gmTypeName);
if (boundaryBasevCtorSelector_.search(boundaryTypeName))
{
pOutput.space(4) << "Creating boundry type " << Green_Text(boundaryTypeName) <<
" for boundary " << boundary.name() << " . . ." << END_REPORT;
return boundaryBasevCtorSelector_[boundaryTypeName](
boundary,
grnPrtcls,
geomMotion);
}
else if(boundaryBasevCtorSelector_[altBTypeName])
{
// if boundary condition is not implemented, the default is used
pOutput.space(4) << "Creating boundry type " << Green_Text(altBTypeName) <<
" for boundary " << boundary.name() << " . . ." << END_REPORT;
return boundaryBasevCtorSelector_[altBTypeName](
boundary,
grnPrtcls,
geomMotion);
}
else
{
printKeys
(
fatalError << "Ctor Selector "<< boundaryTypeName<<
" and "<< altBTypeName << " do not exist. \n"
<<"Avaiable ones are: \n\n"
,
boundaryBasevCtorSelector_
);
fatalExit;
}
return nullptr;
}

View File

@ -0,0 +1,186 @@
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#ifndef __boundaryGrainInteraction_hpp__
#define __boundaryGrainInteraction_hpp__
#include "virtualConstructor.hpp"
#include "generalBoundary.hpp"
#include "sortedContactList.hpp"
#include "grainParticles.hpp"
namespace pFlow
{
template<typename contactForceModel,typename geometryMotionModel>
class boundaryGrainInteraction
:
public generalBoundary
{
public:
using BoundaryGrainInteractionType
= boundaryGrainInteraction<contactForceModel, geometryMotionModel>;
using GeometryMotionModel = geometryMotionModel;
using ContactForceModel = contactForceModel;
using MotionModel = typename geometryMotionModel::MotionModel;
using ModelStorage = typename ContactForceModel::contactForceStorage;
using IdType = uint32;
using IndexType = uint32;
using ContactListType =
sortedContactList<ModelStorage, DefaultExecutionSpace, IdType>;
private:
const GeometryMotionModel& geometryMotion_;
/// const reference to sphere particles
const grainParticles& grnParticles_;
uniquePtr<ContactListType> ppPairs_ = nullptr;
uniquePtr<ContactListType> pwPairs_ = nullptr;
protected:
void allocatePPPairs();
void allocatePWPairs();
public:
TypeInfoTemplate12("boundaryGrainInteraction", ContactForceModel, MotionModel);
boundaryGrainInteraction(
const boundaryBase& boundary,
const grainParticles& grnPrtcls,
const GeometryMotionModel& geomMotion);
create_vCtor
(
BoundaryGrainInteractionType,
boundaryBase,
(
const boundaryBase& boundary,
const grainParticles& grnPrtcls,
const GeometryMotionModel& geomMotion
),
(boundary, grnPrtcls, geomMotion)
);
add_vCtor
(
BoundaryGrainInteractionType,
BoundaryGrainInteractionType,
boundaryBase
);
~boundaryGrainInteraction()override=default;
const auto& grnParticles()const
{
return grnParticles_;
}
const auto& geometryMotion()const
{
return geometryMotion_;
}
ContactListType& ppPairs()
{
return ppPairs_();
}
const ContactListType& ppPairs()const
{
return ppPairs_();
}
ContactListType& pwPairs()
{
return pwPairs_();
}
const ContactListType& pwPairs()const
{
return pwPairs_();
}
bool ppPairsAllocated()const
{
if( ppPairs_)return true;
return false;
}
bool pwPairsAllocated()const
{
if( pwPairs_)return true;
return false;
}
virtual
bool grainGrainInteraction(
real dt,
const ContactForceModel& cfModel,
uint32 step)
{
// for default boundary, no thing to be done
return false;
}
bool hearChanges
(
real t,
real dt,
uint32 iter,
const message& msg,
const anyList& varList
) override
{
pOutput<<"Function (hearChanges in boundarySphereInteractions)is not implmented Message "<<
msg <<endl<<" name "<< this->boundaryName() <<" type "<< this->type()<<endl;;
//notImplementedFunction;
return true;
}
static
uniquePtr<BoundaryGrainInteractionType> create(
const boundaryBase& boundary,
const grainParticles& sphPrtcls,
const GeometryMotionModel& geomMotion
);
};
}
#include "boundaryGrainInteraction.cpp"
#endif //__boundaryGrainInteraction_hpp__