mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-22 16:28:30 +00:00
src folder
This commit is contained in:
284
src/Interaction/Models/contactForce/linearCF.H
Normal file
284
src/Interaction/Models/contactForce/linearCF.H
Normal file
@ -0,0 +1,284 @@
|
||||
/*------------------------------- 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 __linearCF_H__
|
||||
#define __linearCF_H__
|
||||
|
||||
#include "types.H"
|
||||
#include "symArrays.H"
|
||||
|
||||
namespace pFlow::cfModels
|
||||
{
|
||||
|
||||
template<bool limited=true>
|
||||
class linear
|
||||
{
|
||||
public:
|
||||
|
||||
struct contactForceStorage
|
||||
{
|
||||
realx3 overlap_t_ = 0.0;
|
||||
};
|
||||
|
||||
struct linearProperties
|
||||
{
|
||||
real kn_ = 1000.0;
|
||||
real kt_ = 800.0;
|
||||
real ethan_ = 0.0;
|
||||
real ethat_ = 0.0;
|
||||
real mu_ = 0.00001;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
linearProperties(){}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
linearProperties(real kn, real kt, real etha_n, real etha_t, real mu ):
|
||||
kn_(kn), kt_(kt), ethan_(etha_n),ethat_(etha_t), mu_(mu)
|
||||
{}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
linearProperties(const linearProperties&)=default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
linearProperties& operator=(const linearProperties&)=default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
~linearProperties() = default;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
using LinearArrayType = symArray<linearProperties>;
|
||||
|
||||
int32 numMaterial_ = 0;
|
||||
|
||||
ViewType1D<real> rho_;
|
||||
|
||||
LinearArrayType linearProperties_;
|
||||
|
||||
/**/
|
||||
|
||||
bool readLinearDictionary(const dictionary& dict)
|
||||
{
|
||||
auto kn = dict.getVal<realVector>("kn");
|
||||
auto kt = dict.getVal<realVector>("kt");
|
||||
auto en = dict.getVal<realVector>("en");
|
||||
auto et = dict.getVal<realVector>("et");
|
||||
auto mu = dict.getVal<realVector>("mu");
|
||||
|
||||
auto nElem = kn.size();
|
||||
|
||||
|
||||
if(nElem != kt.size())
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"sizes of kn("<<nElem<<") and kt("<<kt.size()<<") do not match.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(nElem != en.size())
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"sizes of kn("<<nElem<<") and en("<<en.size()<<") do not match.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(nElem != et.size())
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"sizes of kn("<<nElem<<") and et("<<et.size()<<") do not match.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(nElem != mu.size())
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"sizes of kn("<<nElem<<") and mu("<<mu.size()<<") do not match.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// check if size of vector matchs a symetric array
|
||||
uint32 nMat;
|
||||
if( !LinearArrayType::getN(nElem, nMat) )
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"sizes of properties do not match a symetric array with size ("<<
|
||||
numMaterial_<<"x"<<numMaterial_<<").\n";
|
||||
return false;
|
||||
}
|
||||
else if( numMaterial_ != nMat)
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"size mismatch for porperties. \n"<<
|
||||
"you supplied "<< numMaterial_<<" items in materials list and "<<
|
||||
nMat << " for other properties.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
realVector etha_n(nElem);
|
||||
realVector etha_t(nElem);
|
||||
forAll(i , kn)
|
||||
{
|
||||
etha_n[i] = -2.0*log(en[i])*sqrt(kn[i])/
|
||||
sqrt(pow(log(en[i]),2.0)+ pow(Pi,2.0));
|
||||
|
||||
etha_t[i] = -2.0*log( et[i]*sqrt(kt[i]) )/
|
||||
sqrt(pow(log(et[i]),2.0)+ pow(Pi,2.0));
|
||||
}
|
||||
|
||||
Vector<linearProperties> prop(nElem);
|
||||
forAll(i,kn)
|
||||
{
|
||||
prop[i] = {kn[i], kt[i], etha_n[i], etha_t[i], mu[i]};
|
||||
}
|
||||
|
||||
linearProperties_.assign(prop);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
static const char* modelName()
|
||||
{
|
||||
if constexpr (limited)
|
||||
{
|
||||
return "linearLimited";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "linearNonLimited";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
|
||||
TypeNameNV(modelName());
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
linear(){}
|
||||
|
||||
linear(int32 nMaterial, const ViewType1D<real>& rho, const dictionary& dict)
|
||||
:
|
||||
numMaterial_(nMaterial),
|
||||
rho_("rho",nMaterial),
|
||||
linearProperties_("linearProperties",nMaterial)
|
||||
{
|
||||
|
||||
Kokkos::deep_copy(rho_,rho);
|
||||
if(!readLinearDictionary(dict))
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
linear(const linear&) = default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
linear(linear&&) = default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
linear& operator=(const linear&) = default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
linear& operator=(linear&&) = default;
|
||||
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
~linear()=default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
int32 numMaterial()const
|
||||
{
|
||||
return numMaterial_;
|
||||
}
|
||||
|
||||
//// - Methods
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
void contactForce
|
||||
(
|
||||
const real dt,
|
||||
const int32 i,
|
||||
const int32 j,
|
||||
const int32 propId_i,
|
||||
const int32 propId_j,
|
||||
const real Ri,
|
||||
const real Rj,
|
||||
const real ovrlp_n,
|
||||
const realx3& Vr,
|
||||
const realx3& Nij,
|
||||
contactForceStorage& history,
|
||||
realx3& FCn,
|
||||
realx3& FCt
|
||||
)const
|
||||
{
|
||||
|
||||
auto prop = linearProperties_(propId_i,propId_j);
|
||||
|
||||
|
||||
real vrn = dot(Vr, Nij);
|
||||
realx3 Vt = Vr - vrn*Nij;
|
||||
|
||||
history.overlap_t_ += Vt*dt;
|
||||
|
||||
real mi = 3*Pi/4*pow(Ri,3.0)*rho_[propId_i];
|
||||
real mj = 3*Pi/4*pow(Rj,3.0)*rho_[propId_j];
|
||||
|
||||
real sqrt_meff = sqrt((mi*mj)/(mi+mj));
|
||||
|
||||
FCn = (-prop.kn_ * ovrlp_n - sqrt_meff * prop.ethan_ * vrn)*Nij;
|
||||
FCt = -prop.kt_ * history.overlap_t_ - sqrt_meff * prop.ethat_*Vt;
|
||||
|
||||
real ft = length(FCt);
|
||||
real ft_fric = prop.mu_ * length(FCn);
|
||||
|
||||
if(ft > ft_fric)
|
||||
{
|
||||
if( length(history.overlap_t_) >static_cast<real>(0.0))
|
||||
{
|
||||
if constexpr (limited)
|
||||
{
|
||||
FCt *= (ft_fric/ft);
|
||||
history.overlap_t_ = - (FCt/prop.kt_);
|
||||
}
|
||||
else
|
||||
{
|
||||
FCt = (FCt/ft)*ft_fric;
|
||||
}
|
||||
//cout<<"friction is applied here \n";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
FCt = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} //pFlow::cfModels
|
||||
|
||||
#endif
|
300
src/Interaction/Models/contactForce/nonLinearCF.H
Normal file
300
src/Interaction/Models/contactForce/nonLinearCF.H
Normal file
@ -0,0 +1,300 @@
|
||||
/*------------------------------- 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 __nonLinearCF_H__
|
||||
#define __nonLinearCF_H__
|
||||
|
||||
#include "types.H"
|
||||
|
||||
namespace pFlow::cfModels
|
||||
{
|
||||
|
||||
template<bool limited=true>
|
||||
class nonLinear
|
||||
{
|
||||
public:
|
||||
|
||||
struct contactForceStorage
|
||||
{
|
||||
realx3 overlap_t_ = 0.0;
|
||||
};
|
||||
|
||||
struct nonLinearProperties
|
||||
{
|
||||
real Yeff_ = 1000000.0;
|
||||
real Geff_ = 8000000.0;
|
||||
real ethan_ = 0.0;
|
||||
real ethat_ = 0.0;
|
||||
real mu_ = 0.00001;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
nonLinearProperties(){}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
nonLinearProperties(real Yeff, real Geff, real etha_n, real etha_t, real mu ):
|
||||
Yeff_(Yeff), Geff_(Geff), ethan_(etha_n),ethat_(etha_t), mu_(mu)
|
||||
{}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
nonLinearProperties(const nonLinearProperties&)=default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
nonLinearProperties& operator=(const nonLinearProperties&)=default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
~nonLinearProperties() = default;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
using NonLinearArrayType = symArray<nonLinearProperties>;
|
||||
|
||||
int32 numMaterial_ = 0;
|
||||
|
||||
ViewType1D<real> rho_;
|
||||
|
||||
NonLinearArrayType nonlinearProperties_;
|
||||
|
||||
bool readNonLinearDictionary(const dictionary& dict)
|
||||
{
|
||||
auto Yeff = dict.getVal<realVector>("Yeff");
|
||||
auto Geff = dict.getVal<realVector>("Geff");
|
||||
auto nu = dict.getVal<realVector>("nu");
|
||||
auto en = dict.getVal<realVector>("en");
|
||||
auto et = dict.getVal<realVector>("et");
|
||||
auto mu = dict.getVal<realVector>("mu");
|
||||
|
||||
auto nElem = Yeff.size();
|
||||
|
||||
if(nElem != nu.size())
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"sizes of Yeff("<<nElem<<") and nu("<<nu.size()<<") do not match.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(nElem != en.size())
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"sizes of Yeff("<<nElem<<") and en("<<en.size()<<") do not match.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(nElem != et.size())
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"sizes of Yeff("<<nElem<<") and et("<<et.size()<<") do not match.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(nElem != mu.size())
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"sizes of Yeff("<<nElem<<") and mu("<<mu.size()<<") do not match.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// check if size of vector matchs a symetric array
|
||||
uint32 nMat;
|
||||
if( !NonLinearArrayType::getN(nElem, nMat) )
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"sizes of properties do not match a symetric array with size ("<<
|
||||
numMaterial_<<"x"<<numMaterial_<<").\n";
|
||||
return false;
|
||||
}
|
||||
else if( numMaterial_ != nMat)
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"size mismatch for porperties. \n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
realVector etha_n(nElem);
|
||||
realVector etha_t(nElem);
|
||||
forAll(i , en)
|
||||
{
|
||||
//K_hertz = 4.0/3.0*Yeff*sqrt(Reff);
|
||||
//-2.2664*log(en)*sqrt(meff*K_hertz)/sqrt( log(en)**2 + 10.1354);
|
||||
|
||||
// we take out sqrt(meff*K_hertz) here and then condier this term
|
||||
// when calculating damping part.
|
||||
etha_n[i] = -2.2664*log(en[i])/
|
||||
sqrt(pow(log(en[i]),2.0)+ pow(Pi,2.0));
|
||||
|
||||
// no damping for tangential part
|
||||
etha_t[i] = 0.0;
|
||||
|
||||
}
|
||||
|
||||
Vector<nonLinearProperties> prop(nElem);
|
||||
forAll(i,Yeff)
|
||||
{
|
||||
prop[i] = {Yeff[i], Geff[i], etha_n[i], etha_t[i], mu[i]};
|
||||
}
|
||||
|
||||
nonlinearProperties_.assign(prop);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
static const char* modelName()
|
||||
{
|
||||
if constexpr (limited)
|
||||
{
|
||||
return "nonLinearLimited";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "nonLinearNonLimited";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
TypeNameNV(modelName());
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
nonLinear(){}
|
||||
|
||||
nonLinear(
|
||||
int32 nMaterial,
|
||||
const ViewType1D<real>& rho,
|
||||
const dictionary& dict)
|
||||
:
|
||||
numMaterial_(nMaterial),
|
||||
rho_("rho",nMaterial),
|
||||
nonlinearProperties_("nonLinearProperties",nMaterial)
|
||||
{
|
||||
|
||||
Kokkos::deep_copy(rho_,rho);
|
||||
if(!readNonLinearDictionary(dict))
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
nonLinear(const nonLinear&) = default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
nonLinear(nonLinear&&) = default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
nonLinear& operator=(const nonLinear&) = default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
nonLinear& operator=(nonLinear&&) = default;
|
||||
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
~nonLinear()=default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
int32 numMaterial()const
|
||||
{
|
||||
return numMaterial_;
|
||||
}
|
||||
|
||||
//// - Methods
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
void contactForce
|
||||
(
|
||||
const real dt,
|
||||
const int32 i,
|
||||
const int32 j,
|
||||
const int32 propId_i,
|
||||
const int32 propId_j,
|
||||
const real Ri,
|
||||
const real Rj,
|
||||
const real ovrlp_n,
|
||||
const realx3& Vr,
|
||||
const realx3& Nij,
|
||||
contactForceStorage& history,
|
||||
realx3& FCn,
|
||||
realx3& FCt
|
||||
)const
|
||||
{
|
||||
|
||||
auto prop = nonlinearProperties_(propId_i,propId_j);
|
||||
|
||||
|
||||
real vrn = dot(Vr, Nij);
|
||||
realx3 Vt = Vr - vrn*Nij;
|
||||
|
||||
history.overlap_t_ += Vt*dt;
|
||||
|
||||
real mi = 3*Pi/4*pow(Ri,static_cast<real>(3))*rho_[propId_i];
|
||||
real mj = 3*Pi/4*pow(Rj,static_cast<real>(3))*rho_[propId_j];
|
||||
real Reff = 1.0/(1/Ri + 1/Rj);
|
||||
|
||||
real K_hertz = 4.0/3.0*prop.Yeff_*sqrt(Reff);
|
||||
real sqrt_meff_K_hertz = sqrt((mi*mj)/(mi+mj) * K_hertz);
|
||||
|
||||
|
||||
//FCn = (-prop.kn_ * ovrlp_n - sqrt_meff * prop.ethan_ * vrn)*Nij;
|
||||
//FCt = -prop.kt_ * history.overlap_t_ - sqrt_meff * prop.ethat_*Vt;
|
||||
|
||||
|
||||
|
||||
FCn = (static_cast<real>(-4.0/3.0) * prop.Yeff_ * sqrt(Reff)* pow(ovrlp_n,static_cast<real>(1.5)) -
|
||||
sqrt_meff_K_hertz*prop.ethan_*pow(ovrlp_n,static_cast<real>(0.25))*vrn)*Nij;
|
||||
|
||||
FCt = (- static_cast<real>(16.0/3.0) * prop.Geff_ * sqrt(Reff*ovrlp_n) ) * history.overlap_t_;
|
||||
|
||||
real ft = length(FCt);
|
||||
real ft_fric = prop.mu_ * length(FCn);
|
||||
|
||||
// apply friction
|
||||
if(ft > ft_fric)
|
||||
{
|
||||
if( length(history.overlap_t_) >0.0)
|
||||
{
|
||||
if constexpr (limited)
|
||||
{
|
||||
real kt = static_cast<real>(16.0/3.0) * prop.Geff_ * sqrt(Reff*ovrlp_n);
|
||||
FCt *= (ft_fric/ft);
|
||||
history.overlap_t_ = - (FCt/kt);
|
||||
}
|
||||
else
|
||||
{
|
||||
FCt = (FCt/ft)*ft_fric;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
FCt = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
} //pFlow::CFModels
|
||||
|
||||
#endif
|
44
src/Interaction/Models/contactForceModels.H
Normal file
44
src/Interaction/Models/contactForceModels.H
Normal file
@ -0,0 +1,44 @@
|
||||
/*------------------------------- 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 __contactForceModels_H__
|
||||
#define __contactForceModels_H__
|
||||
|
||||
|
||||
#include "linearCF.H"
|
||||
#include "nonLinearCF.H"
|
||||
#include "normalRolling.H"
|
||||
|
||||
|
||||
namespace pFlow::cfModels
|
||||
{
|
||||
|
||||
|
||||
using limitedLinearNormalRolling = normalRolling<linear<true>>;
|
||||
using nonLimitedLinearNormalRolling = normalRolling<linear<false>>;
|
||||
|
||||
using limitedNonLinearNormalRolling = normalRolling<nonLinear<true>>;
|
||||
using nonLimitedNonLinearNormalRolling = normalRolling<nonLinear<false>>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif //__contactForceModels_H__
|
117
src/Interaction/Models/rolling/normalRolling.H
Normal file
117
src/Interaction/Models/rolling/normalRolling.H
Normal file
@ -0,0 +1,117 @@
|
||||
/*------------------------------- 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 __normalRolling_H__
|
||||
#define __normalRolling_H__
|
||||
|
||||
|
||||
namespace pFlow::cfModels
|
||||
{
|
||||
|
||||
template<typename contactForceModel>
|
||||
class normalRolling
|
||||
:
|
||||
public contactForceModel
|
||||
{
|
||||
public:
|
||||
|
||||
using contactForceStorage =
|
||||
typename contactForceModel::contactForceStorage;
|
||||
|
||||
|
||||
realSymArray_D mur_;
|
||||
|
||||
bool readNormalDict(const dictionary& dict)
|
||||
{
|
||||
auto mur = dict.getVal<realVector>("mur");
|
||||
|
||||
uint32 nMat;
|
||||
|
||||
if(!realSymArray_D::getN(mur.size(),nMat) || nMat != this->numMaterial())
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"wrong number of values supplied in mur. \n";
|
||||
return false;
|
||||
}
|
||||
|
||||
mur_.assign(mur);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
TypeNameNV(word("normal<"+contactForceModel::TYPENAME()+">"));
|
||||
|
||||
|
||||
normalRolling(int32 nMaterial, const ViewType1D<real>& rho, const dictionary& dict)
|
||||
:
|
||||
contactForceModel(nMaterial, rho, dict),
|
||||
mur_("mur", nMaterial)
|
||||
{
|
||||
if(!readNormalDict(dict))
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
void rollingFriction
|
||||
(
|
||||
const real dt,
|
||||
const int32 i,
|
||||
const int32 j,
|
||||
const int32 propId_i,
|
||||
const int32 propId_j,
|
||||
const real Ri,
|
||||
const real Rj,
|
||||
const realx3& wi,
|
||||
const realx3& wj,
|
||||
const realx3& Nij,
|
||||
const realx3& FCn,
|
||||
realx3& Mri,
|
||||
realx3& Mrj
|
||||
)const
|
||||
{
|
||||
|
||||
realx3 w_hat = wi-wj;
|
||||
real w_hat_mag = length(w_hat);
|
||||
|
||||
if( !equal(w_hat_mag,0.0) )
|
||||
w_hat /= w_hat_mag;
|
||||
else
|
||||
w_hat = 0.0;
|
||||
|
||||
auto Reff = (Ri*Rj)/(Ri+Rj);
|
||||
|
||||
Mri = ( -mur_(propId_i,propId_j) *length(FCn) * Reff ) * w_hat ;
|
||||
|
||||
//removing the normal part
|
||||
// Mri = Mri - ( (Mri .dot. nij)*nij )
|
||||
|
||||
Mrj = -Mri;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user