mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-22 16:28:30 +00:00
global damping is added to the code
This commit is contained in:
@ -6,6 +6,9 @@ particles/shape/shape.cpp
|
||||
particles/particles.cpp
|
||||
particles/particleIdHandler/particleIdHandler.cpp
|
||||
particles/regularParticleIdHandler/regularParticleIdHandler.cpp
|
||||
|
||||
globalDamping/globalDamping.cpp
|
||||
|
||||
SphereParticles/sphereShape/sphereShape.cpp
|
||||
SphereParticles/sphereParticles/sphereParticles.cpp
|
||||
SphereParticles/sphereParticles/sphereParticlesKernels.cpp
|
||||
|
@ -21,6 +21,7 @@ Licence:
|
||||
#include "dynamicPointStructure.hpp"
|
||||
#include "systemControl.hpp"
|
||||
|
||||
|
||||
pFlow::dynamicPointStructure::dynamicPointStructure
|
||||
(
|
||||
systemControl& control
|
||||
@ -77,6 +78,9 @@ pFlow::dynamicPointStructure::dynamicPointStructure
|
||||
fatalExit;
|
||||
}
|
||||
|
||||
REPORT(1)<<"Reading globalDamping dictionary ..."<<END_REPORT;
|
||||
velDamping_ = makeUnique<globalDamping>(control);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -101,6 +105,16 @@ bool pFlow::dynamicPointStructure::iterate()
|
||||
return correct(dt, acc);*/
|
||||
}
|
||||
|
||||
bool pFlow::dynamicPointStructure::afterIteration()
|
||||
{
|
||||
//const auto ti = TimeInfo();
|
||||
|
||||
auto succs = pointStructure::afterIteration();
|
||||
//velDamping_().applyDamping(ti, velocity_);
|
||||
|
||||
return succs;
|
||||
}
|
||||
|
||||
bool pFlow::dynamicPointStructure::predict(
|
||||
real dt,
|
||||
realx3PointField_D &acceleration)
|
||||
@ -119,10 +133,11 @@ bool pFlow::dynamicPointStructure::correct
|
||||
)
|
||||
{
|
||||
//auto& pos = pStruct().pointPosition();
|
||||
const auto ti = TimeInfo();
|
||||
|
||||
if(!integrationPos_().correctPStruct(dt, *this, velocity_) )return false;
|
||||
|
||||
if(!integrationVel_().correct(dt, velocity_, acceleration))return false;
|
||||
if(!integrationVel_().correct(dt, velocity_, acceleration, velDamping_().dampingFactor(ti)))return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -26,11 +26,13 @@ Licence:
|
||||
#include "pointFields.hpp"
|
||||
#include "integration.hpp"
|
||||
#include "uniquePtr.hpp"
|
||||
#include "globalDamping.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
class systemControl;
|
||||
//class globalDamping;
|
||||
|
||||
class dynamicPointStructure
|
||||
:
|
||||
@ -44,6 +46,8 @@ private:
|
||||
|
||||
uniquePtr<integration> integrationVel_ = nullptr;
|
||||
|
||||
uniquePtr<globalDamping> velDamping_ = nullptr;
|
||||
|
||||
Timer velocityUpdateTimer_;
|
||||
|
||||
/// @brief integration method for velocity and position
|
||||
@ -88,6 +92,8 @@ public:
|
||||
/// @brief This is called in time loop. Perform the main calculations
|
||||
/// when the component should evolve along time.
|
||||
bool iterate() override;
|
||||
|
||||
bool afterIteration()override;
|
||||
|
||||
/// prediction step (if any), is called in beforeIteration
|
||||
bool predict(real dt, realx3PointField_D& acceleration);
|
||||
|
74
src/Particles/globalDamping/globalDamping.cpp
Normal file
74
src/Particles/globalDamping/globalDamping.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
/*------------------------------- 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 "globalDamping.hpp"
|
||||
|
||||
|
||||
pFlow::globalDamping::globalDamping(const systemControl& control)
|
||||
:
|
||||
timeControl_(control.settingsDict().subDict("globalDamping"), control.time().dt(), "damping")
|
||||
{
|
||||
const dictionary& dict = control.settingsDict().subDict("globalDamping");
|
||||
|
||||
dampingFactor_ = dict.getValOrSetMin<real>("dampingFactor", static_cast<real>(1.0));
|
||||
|
||||
dampingFactor_ = max( dampingFactor_ , static_cast<real>(0.01));
|
||||
|
||||
performDamping_ = !equal(dampingFactor_, static_cast<real>(1.0));
|
||||
|
||||
if( performDamping_ )
|
||||
REPORT(2)<<"Global damping "<<Yellow_Text("is active")<<
|
||||
" and damping factor is "<<dampingFactor_<<END_REPORT;
|
||||
else
|
||||
REPORT(2)<<"Global damping "<<Yellow_Text("is not active")<<"."<<END_REPORT;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*void pFlow::globalDamping::applyDamping
|
||||
(
|
||||
const timeInfo& ti,
|
||||
realx3PointField_D& velocity
|
||||
)
|
||||
{
|
||||
if(!performDamping_) return;
|
||||
if(!timeControl_.timeEvent(ti.iter(), ti.t(), ti.dt()) )return;
|
||||
|
||||
auto d_v = velocity.deviceView();
|
||||
auto activeRng = velocity.activeRange();
|
||||
auto dmpng = dampingFactor_;
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"globalDamping::applyDamping",
|
||||
deviceRPolicyStatic(activeRng.start(), activeRng.end()),
|
||||
LAMBDA_HD(uint32 i){
|
||||
d_v[i] *= dmpng;
|
||||
});
|
||||
Kokkos::fence();
|
||||
//REPORT(1)<<"Applied global damping "<<END_REPORT;
|
||||
}*/
|
||||
|
||||
pFlow::real pFlow::globalDamping::dampingFactor(const timeInfo& ti)const
|
||||
{
|
||||
if(!performDamping_) return 1.0;
|
||||
if(!timeControl_.timeEvent(ti.iter(), ti.t(), ti.dt()) )return 1.0;
|
||||
return dampingFactor_;
|
||||
}
|
65
src/Particles/globalDamping/globalDamping.hpp
Normal file
65
src/Particles/globalDamping/globalDamping.hpp
Normal file
@ -0,0 +1,65 @@
|
||||
/*------------------------------- 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 __globalDamping_hpp__
|
||||
#define __globalDamping_hpp__
|
||||
|
||||
#include "systemControl.hpp"
|
||||
#include "pointFields.hpp"
|
||||
#include "baseTimeControl.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
class globalDamping
|
||||
{
|
||||
private:
|
||||
|
||||
bool performDamping_ = false;
|
||||
|
||||
real dampingFactor_;
|
||||
|
||||
baseTimeControl timeControl_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
globalDamping(const systemControl& control);
|
||||
|
||||
~globalDamping()=default;
|
||||
|
||||
//void applyDamping( const timeInfo& ti, realx3PointField_D& velocity);
|
||||
|
||||
bool performDamping()const
|
||||
{
|
||||
return performDamping_;
|
||||
}
|
||||
|
||||
real dampingFactor(const timeInfo& ti)const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user