mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-07-18 03:17:04 +00:00
modify for coupling-cpp and hpp
This commit is contained in:
CMakeLists.txt
DEMSystems
solvers
iterateGeometry
sphereGranFlow
src
Geometry
Integration
AdamsBashforth2
AdamsBashforth3
AdamsBashforth4
AdamsBashforth5
AdamsMoulton3
AdamsMoulton4
AdamsMoulton5
CMakeLists.txtintegration
Interaction
CMakeLists.txt
Models
contactLists
contactSearch
ContactSearch
cells.hppcontactSearch
contactSearchFunctions.hppmethods
NBS.hppNBSCrossLoop.hppNBSLevel.hppNBSLevel0.hppNBSLevels.hppNBSLoop.hppmapperNBS.hppmultiGridNBS.hpp
wallMappings
interaction
sphereInteraction
MotionModel
Particles
CMakeLists.txt
Insertion
Insertion
InsertionRegion
insertion
insertionRegion
shapeMixture
SphereParticles
sphereParticles
sphereShape
dynamicPointStructure
particles
Property
demComponent
phasicFlow
CMakeLists.txt
Kokkos
Timer
algorithms
commandLine
containers
Field
List
Map
Set
Vector
VectorHD
VectorDual.hppVectorDualAlgorithms.hppVectorDuals.hppVectorSingle.hppVectorSingleAlgorithms.hppVectorSingles.hpp
bitsetHD
indexContainer
pointField
span
symArrayHD
triSurfaceField
dictionary
eventSubscriber
fileSystem
globals
random
randomInt32
randomReal
ranges
repository
IOobject
IOfileHeader.cppIOfileHeader.hppIOobject.cppIOobject.hppIOobjectTemplates.cppobjectFile.cppobjectFile.hpp
Time
repository
systemControl
setFieldList
smartPointers
streams
structuredData
box
cylinder
iBox
line
peakableRegion
PeakableRegion
boxRegion
cylinderRegion
peakableRegion
peakableRegionInstantiate.cpppeakableRegions.cpppeakableRegions.hppsphereRegion
pointStructure
pointStructure.cpppointStructure.hpppointStructureKernels.hpp
selectors
pStructSelector
selectBox
selectRandom
selectRange
sphere
trisurfaceStructure
bitTransfer.hppmultiTriSurface.cppmultiTriSurface.hppstlFile.cppstlFile.hpptriSurface.cpptriSurface.hpptriSurfaceKernels.hpptriangleFunctions.hpp
zAxis
typeSelection
types
setHelpers
utilities
Utilities
CMakeLists.txtreadControlDict.cppreadControlDict.hppreadFromTimeFolder.cppreadFromTimeFolder.hpputilityFunctions.hppvtkFile.cppvtkFile.hpp
checkPhasicFlow
geometryPhasicFlow
pFlowToVTK
particlesPhasicFlow
CMakeLists.txt
empty
particlesPhasicFlow.cpppositionOrdered
positionParticles
positionRandom
setFields.hpppostprocessPhasicFlow
CMakeLists.txtIncludeMask.hppIncludeMasks.cppProcessField.hppProcessFields.cppfieldOperations.hppincludeMask.cppincludeMask.hpppointRectCell.hpppostprocess.cpppostprocess.hpppostprocessPhasicFlow.cppprocessField.cppprocessField.hpprectMeshField.hpprectMeshFieldToVTK.hpprectMeshFields.hpprectangleMesh.hpp
123
src/Integration/AdamsBashforth2/AdamsBashforth2.hpp
Normal file
123
src/Integration/AdamsBashforth2/AdamsBashforth2.hpp
Normal file
@ -0,0 +1,123 @@
|
||||
/*------------------------------- 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 __AdamsBashforth2_hpp__
|
||||
#define __AdamsBashforth2_hpp__
|
||||
|
||||
|
||||
#include "integration.hpp"
|
||||
#include "pointFields.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
class AdamsBashforth2
|
||||
:
|
||||
public integration
|
||||
{
|
||||
protected:
|
||||
|
||||
realx3PointField_D& dy1_;
|
||||
|
||||
using rpIntegration = Kokkos::RangePolicy<
|
||||
DefaultExecutionSpace,
|
||||
Kokkos::Schedule<Kokkos::Static>,
|
||||
Kokkos::IndexType<int32>
|
||||
>;
|
||||
public:
|
||||
|
||||
// type info
|
||||
TypeInfo("AdamsBashforth2");
|
||||
|
||||
//// - Constructors
|
||||
AdamsBashforth2(
|
||||
const word& baseName,
|
||||
repository& owner,
|
||||
const pointStructure& pStruct,
|
||||
const word& method);
|
||||
|
||||
virtual ~AdamsBashforth2()=default;
|
||||
|
||||
// - add a virtual constructor
|
||||
add_vCtor(
|
||||
integration,
|
||||
AdamsBashforth2,
|
||||
word);
|
||||
|
||||
|
||||
//// - Methods
|
||||
bool predict(real UNUSED(dt), realx3Vector_D& UNUSED(y), realx3Vector_D& UNUSED(dy)) override;
|
||||
|
||||
bool correct(real dt, realx3Vector_D& y, realx3Vector_D& dy) override;
|
||||
|
||||
bool setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
const realx3Vector& y) override;
|
||||
|
||||
bool needSetInitialVals()const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsBashforth2>(*this);
|
||||
}
|
||||
|
||||
bool intAll(real dt, realx3Vector_D& y, realx3Vector_D& dy, range activeRng);
|
||||
|
||||
template<typename activeFunctor>
|
||||
bool intRange(real dt, realx3Vector_D& y, realx3Vector_D& dy, activeFunctor activeP );
|
||||
|
||||
};
|
||||
|
||||
template<typename activeFunctor>
|
||||
bool pFlow::AdamsBashforth2::intRange(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP )
|
||||
{
|
||||
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
auto d_dy1= dy1_.deviceVectorAll();
|
||||
auto activeRng = activeP.activeRange();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"AdamsBashforth2::correct",
|
||||
rpIntegration (activeRng.first, activeRng.second),
|
||||
LAMBDA_HD(int32 i){
|
||||
if( activeP(i))
|
||||
{
|
||||
d_y[i] += dt*(static_cast<real>(3.0 / 2.0) * d_dy[i] - static_cast<real>(1.0 / 2.0) * d_dy1[i]);
|
||||
d_dy1[i] = d_dy[i];
|
||||
}
|
||||
});
|
||||
Kokkos::fence();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // pFlow
|
||||
|
||||
#endif //__integration_hpp__
|
Reference in New Issue
Block a user