2022-09-04 21:26:29 +00:00
|
|
|
/*------------------------------- 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.
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------*/
|
|
|
|
|
2022-12-09 22:02:54 +00:00
|
|
|
#include "dynamicPointStructure.hpp"
|
2024-01-21 21:26:23 +00:00
|
|
|
#include "systemControl.hpp"
|
2022-09-04 21:26:29 +00:00
|
|
|
|
|
|
|
pFlow::dynamicPointStructure::dynamicPointStructure
|
|
|
|
(
|
2024-01-21 21:26:23 +00:00
|
|
|
systemControl& control
|
2022-09-04 21:26:29 +00:00
|
|
|
)
|
|
|
|
:
|
2024-01-21 21:26:23 +00:00
|
|
|
pointStructure(control),
|
|
|
|
velocity_
|
|
|
|
(
|
|
|
|
objectFile(
|
|
|
|
"velocity",
|
|
|
|
"",
|
|
|
|
objectFile::READ_ALWAYS,
|
|
|
|
objectFile::WRITE_ALWAYS
|
|
|
|
),
|
|
|
|
*this,
|
|
|
|
zero3
|
|
|
|
),
|
|
|
|
integrationMethod_
|
|
|
|
(
|
|
|
|
control.settingsDict().getVal<word>("integrationMethod")
|
|
|
|
)
|
2022-09-04 21:26:29 +00:00
|
|
|
{
|
2022-12-24 11:30:00 +00:00
|
|
|
REPORT(1)<< "Creating integration method "<<
|
2024-01-21 21:26:23 +00:00
|
|
|
Green_Text(integrationMethod_)<<" for dynamicPointStructure."<<END_REPORT;
|
2022-09-04 21:26:29 +00:00
|
|
|
|
2024-01-21 21:26:23 +00:00
|
|
|
integrationPos_ = integration::create
|
|
|
|
(
|
2022-09-04 21:26:29 +00:00
|
|
|
"pStructPosition",
|
2024-01-21 21:26:23 +00:00
|
|
|
*this,
|
|
|
|
integrationMethod_,
|
|
|
|
pointPosition()
|
|
|
|
);
|
2022-09-04 21:26:29 +00:00
|
|
|
|
|
|
|
if( !integrationPos_ )
|
|
|
|
{
|
|
|
|
fatalErrorInFunction<<
|
|
|
|
" error in creating integration object for dynamicPointStructure (position). \n";
|
|
|
|
fatalExit;
|
|
|
|
}
|
2024-01-21 21:26:23 +00:00
|
|
|
|
|
|
|
integrationVel_ = integration::create
|
|
|
|
(
|
|
|
|
"pStructVelocity",
|
|
|
|
*this,
|
|
|
|
integrationMethod_,
|
|
|
|
velocity_.field()
|
|
|
|
);
|
2022-09-04 21:26:29 +00:00
|
|
|
|
|
|
|
if( !integrationVel_ )
|
|
|
|
{
|
|
|
|
fatalErrorInFunction<<
|
|
|
|
" error in creating integration object for dynamicPointStructure (velocity). \n";
|
|
|
|
fatalExit;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-01-29 15:57:19 +00:00
|
|
|
/*bool pFlow::dynamicPointStructure::beforeIteration()
|
2022-09-04 21:26:29 +00:00
|
|
|
{
|
2024-01-29 15:57:19 +00:00
|
|
|
pointStructure::beforeIteration();
|
|
|
|
auto& acc = time().lookupObject<realx3PointField_D>("acceleration");
|
|
|
|
return predict(dt(), acc);
|
|
|
|
}*/
|
2022-09-04 21:26:29 +00:00
|
|
|
|
2024-01-29 15:57:19 +00:00
|
|
|
/*bool pFlow::dynamicPointStructure::iterate()
|
|
|
|
{
|
|
|
|
pointStructure::iterate();
|
|
|
|
auto& acc = time().lookupObject<realx3PointField_D>("acceleration");
|
|
|
|
return correct(dt(), acc);
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
bool pFlow::dynamicPointStructure::predict(
|
|
|
|
real dt,
|
|
|
|
realx3PointField_D &acceleration)
|
|
|
|
{
|
|
|
|
|
|
|
|
if(!integrationPos_().predict(dt, pointPosition(), velocity_ ))return false;
|
|
|
|
if(!integrationVel_().predict(dt, velocity_, acceleration))return false;
|
2022-09-04 21:26:29 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool pFlow::dynamicPointStructure::correct
|
|
|
|
(
|
|
|
|
real dt,
|
|
|
|
realx3PointField_D& acceleration
|
|
|
|
)
|
|
|
|
{
|
2024-01-21 21:26:23 +00:00
|
|
|
//auto& pos = pStruct().pointPosition();
|
2022-09-04 21:26:29 +00:00
|
|
|
|
2024-01-29 15:57:19 +00:00
|
|
|
if(!integrationPos_().correct(dt, pointPosition(), velocity_) )return false;
|
2022-09-04 21:26:29 +00:00
|
|
|
|
2024-01-29 15:57:19 +00:00
|
|
|
if(!integrationVel_().correct(dt, velocity_, acceleration))return false;
|
2022-09-04 21:26:29 +00:00
|
|
|
|
|
|
|
return true;
|
2022-10-25 16:00:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*FUNCTION_H
|
|
|
|
pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::dynamicPointStructure::insertPoints
|
|
|
|
(
|
|
|
|
const realx3Vector& pos,
|
|
|
|
const List<eventObserver*>& exclusionList
|
|
|
|
)
|
|
|
|
{
|
|
|
|
auto newIndicesPtr = pointStructure::insertPoints(pos, exclusionList);
|
|
|
|
|
|
|
|
// no new point is inserted
|
|
|
|
if( !newIndicesPtr ) return newIndicesPtr;
|
|
|
|
|
|
|
|
if(!integrationPos_().needSetInitialVals()) return newIndicesPtr;
|
|
|
|
|
2024-01-29 15:57:19 +00:00
|
|
|
auto hVel = velocity_.hostView();
|
2022-10-25 16:00:57 +00:00
|
|
|
auto n = newIndicesPtr().size();
|
|
|
|
auto index = newIndicesPtr().indicesHost();
|
|
|
|
|
|
|
|
realx3Vector velVec(n, RESERVE());
|
|
|
|
for(auto i=0; i<n; i++)
|
|
|
|
{
|
|
|
|
velVec.push_back( hVel[ index(i) ]);
|
|
|
|
}
|
|
|
|
|
|
|
|
integrationPos_->setInitialVals(newIndicesPtr(), pos );
|
|
|
|
integrationVel_->setInitialVals(newIndicesPtr(), velVec );
|
|
|
|
|
|
|
|
return newIndicesPtr;
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
2024-01-21 21:26:23 +00:00
|
|
|
/*bool pFlow::dynamicPointStructure::update(
|
2022-10-25 16:00:57 +00:00
|
|
|
const eventMessage& msg)
|
|
|
|
{
|
|
|
|
if( msg.isInsert())
|
|
|
|
{
|
|
|
|
|
|
|
|
if(!integrationPos_->needSetInitialVals())return true;
|
|
|
|
|
|
|
|
const auto indexHD = pStruct().insertedPointIndex();
|
|
|
|
|
|
|
|
|
|
|
|
auto n = indexHD.size();
|
|
|
|
|
|
|
|
if(n==0) return true;
|
|
|
|
|
|
|
|
auto index = indexHD.indicesHost();
|
|
|
|
|
|
|
|
realx3Vector pos(n,RESERVE());
|
|
|
|
realx3Vector vel(n,RESERVE());
|
2024-01-29 15:57:19 +00:00
|
|
|
const auto hVel = velocity().hostView();
|
|
|
|
const auto hPos = pStruct().pointPosition().hostView();
|
2022-10-25 16:00:57 +00:00
|
|
|
|
|
|
|
for(auto i=0; i<n; i++)
|
|
|
|
{
|
|
|
|
pos.push_back( hPos[index(i)]);
|
|
|
|
vel.push_back( hVel[index(i)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
integrationPos_->setInitialVals(indexHD, pos);
|
|
|
|
|
|
|
|
integrationVel_->setInitialVals(indexHD, vel);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2024-01-21 21:26:23 +00:00
|
|
|
}*/
|