mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
phasicFlow core changes for boundary condition addition.
- Exit boundry condition, checked. - periodic boundary condition added, checked. to be done: - messaging events - reflective - wall-particle interaction for periodic bc.
This commit is contained in:
@ -62,8 +62,8 @@ containers/Field/Fields.cpp
|
||||
containers/symArrayHD/symArrays.cpp
|
||||
containers/List/anyList/anyList.cpp
|
||||
|
||||
structuredData/pointStructure/internalPointsKernels.cpp
|
||||
structuredData/pointStructure/internalPoints.cpp
|
||||
structuredData/pointStructure/internalPoints/internalPointsKernels.cpp
|
||||
structuredData/pointStructure/internalPoints/internalPoints.cpp
|
||||
|
||||
structuredData/zAxis/zAxis.cpp
|
||||
structuredData/box/box.cpp
|
||||
@ -79,28 +79,24 @@ structuredData/boundaries/boundaryExit/boundaryExit.cpp
|
||||
structuredData/boundaries/boundaryNone/boundaryNone.cpp
|
||||
structuredData/boundaries/boundaryPeriodic/boundaryPeriodic.cpp
|
||||
structuredData/boundaries/boundaryList.cpp
|
||||
structuredData/pointStructure/pointStructure.cpp
|
||||
structuredData/pointStructure/pointStructure/pointStructure.cpp
|
||||
structuredData/pointStructure/selectors/pStructSelector/pStructSelector.cpp
|
||||
structuredData/pointStructure/selectors/selectBox/selectBox.cpp
|
||||
structuredData/pointStructure/selectors/selectRange/selectRange.cpp
|
||||
structuredData/pointStructure/selectors/selectRandom/selectRandom.cpp
|
||||
|
||||
|
||||
|
||||
triSurface/subSurface.cpp
|
||||
triSurface/triSurface.cpp
|
||||
triSurface/multiTriSurface.cpp
|
||||
|
||||
containers/pointField/boundaryField/generalBoundary.cpp
|
||||
containers/pointField/pointFields.cpp
|
||||
containers/pointField/boundaryField/generalBoundary/generalBoundary.cpp
|
||||
containers/pointField/pointField/pointFields.cpp
|
||||
containers/triSurfaceField/triSurfaceFields.cpp
|
||||
|
||||
setFieldList/setFieldList.cpp
|
||||
setFieldList/setFieldEntry.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
)
|
||||
|
||||
set(link_libs)
|
||||
|
@ -77,6 +77,19 @@ using hostRPolicyStatic =
|
||||
Kokkos::Schedule<Kokkos::Static>,
|
||||
Kokkos::IndexType<pFlow::uint32> >;
|
||||
|
||||
using deviceRPolicyDynamic =
|
||||
Kokkos::RangePolicy<
|
||||
Kokkos::DefaultExecutionSpace,
|
||||
Kokkos::Schedule<Kokkos::Dynamic>,
|
||||
Kokkos::IndexType<pFlow::uint32> >;
|
||||
|
||||
|
||||
using hostRPolicyDynamic =
|
||||
Kokkos::RangePolicy<
|
||||
Kokkos::DefaultExecutionSpace,
|
||||
Kokkos::Schedule<Kokkos::Dynamic>,
|
||||
Kokkos::IndexType<pFlow::uint32> >;
|
||||
|
||||
|
||||
/// Pair of two variables
|
||||
template<typename T1, typename T2>
|
||||
|
@ -42,21 +42,25 @@ protected:
|
||||
|
||||
using timer = std::chrono::high_resolution_clock;
|
||||
|
||||
// - name for the timer
|
||||
word name_ = "noNameTimer";
|
||||
|
||||
// start time
|
||||
/// start time
|
||||
timer::time_point start_;
|
||||
|
||||
// number of times start() and end() are called
|
||||
/// number of times start() and end() are called
|
||||
int32 numIteration_ = 0;
|
||||
|
||||
// sum of time duratios (in seconds) between all start() and end() calls
|
||||
/// sum of time duratios (in seconds) between all start() and end() calls
|
||||
real accTime_ = 0.0;
|
||||
|
||||
//
|
||||
/// last time duration
|
||||
real lastTime_ = 0.0;
|
||||
|
||||
/// @brief Accumulative duration for multiple steps between start() and end()
|
||||
real stepAccTime_ = 0.0;
|
||||
|
||||
/// name for the timer
|
||||
word name_ = "noNameTimer";
|
||||
|
||||
/// @brief parrent of timer
|
||||
Timers* parrent_ = nullptr;
|
||||
|
||||
public:
|
||||
@ -95,16 +99,28 @@ public:
|
||||
}
|
||||
|
||||
void start()
|
||||
{
|
||||
start_ = timer::now();
|
||||
stepAccTime_ = 0;
|
||||
}
|
||||
|
||||
void pause()
|
||||
{
|
||||
auto end = timer::now();
|
||||
stepAccTime_ += std::chrono::duration_cast
|
||||
< std::chrono::duration<real> >(end - start_).count();
|
||||
}
|
||||
|
||||
void resume()
|
||||
{
|
||||
start_ = timer::now();
|
||||
}
|
||||
|
||||
void end()
|
||||
{
|
||||
auto end = timer::now();
|
||||
lastTime_ = std::chrono::duration_cast
|
||||
< std::chrono::duration<real> >(end - start_).count();
|
||||
|
||||
pause();
|
||||
lastTime_ = stepAccTime_;
|
||||
|
||||
numIteration_++;
|
||||
accTime_ += lastTime_;
|
||||
}
|
||||
|
@ -21,14 +21,12 @@ Licence:
|
||||
#include "Fields.hpp"
|
||||
|
||||
|
||||
template class pFlow::Field<pFlow::int8>;
|
||||
|
||||
template class pFlow::Field<pFlow::uint8>;
|
||||
|
||||
template class pFlow::Field<pFlow::int32>;
|
||||
|
||||
template class pFlow::Field<pFlow::uint32>;
|
||||
|
||||
template class pFlow::Field<pFlow::uint64>;
|
||||
|
||||
template class pFlow::Field<pFlow::real>;
|
||||
|
||||
template class pFlow::Field<pFlow::realx3>;
|
||||
|
@ -74,29 +74,6 @@ using realx3x3Field_H = Field<realx3x3, HostSpace>;
|
||||
using wordField_H = Field<word, HostSpace>;
|
||||
|
||||
|
||||
// host device fields
|
||||
/*using int8Field_HD = Field<VectorDual, int8>;
|
||||
|
||||
using int32Field_HD = Field<VectorDual, int32>;
|
||||
|
||||
using int64Field_HD = Field<VectorDual, int64>;
|
||||
|
||||
using uint32Field_HD = Field<VectorDual, uint32>;
|
||||
|
||||
using labelField_HD = Field<VectorDual, label>;
|
||||
|
||||
using realField_HD = Field<VectorDual, real>;
|
||||
|
||||
using realx3Field_HD = Field<VectorDual, realx3>;
|
||||
|
||||
using uint32x3Field_HD = Field<VectorDual, uint32x3>;
|
||||
|
||||
using int32x3Field_HD = Field<VectorDual, int32x3>;
|
||||
|
||||
using int64x3Field_HD = Field<VectorDual, int64x3>;
|
||||
|
||||
using realx3x3Field_HD = Field<VectorDual, realx3x3>;*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,9 +24,6 @@ Licence:
|
||||
template class Kokkos::View<pFlow::uint8*>;
|
||||
template class pFlow::VectorSingle<pFlow::uint8>;
|
||||
|
||||
template class Kokkos::View<pFlow::int32*>;
|
||||
template class pFlow::VectorSingle<pFlow::int32>;
|
||||
|
||||
template class Kokkos::View<pFlow::uint32*>;
|
||||
template class pFlow::VectorSingle<pFlow::uint32>;
|
||||
|
||||
|
@ -41,6 +41,8 @@ public:
|
||||
|
||||
using execution_space = typename InternalFieldType::execution_space;
|
||||
|
||||
using FieldAccessType = scatteredFieldAccess<T, memory_space>;
|
||||
|
||||
protected:
|
||||
|
||||
/// @brief a ref to the internal field
|
||||
@ -98,6 +100,23 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
FieldAccessType thisField()const
|
||||
{
|
||||
return FieldAccessType(
|
||||
this->size(),
|
||||
this->indexList().deviceViewAll(),
|
||||
internal_.deviceViewAll());
|
||||
}
|
||||
|
||||
FieldAccessType mirrorField()const
|
||||
{
|
||||
return FieldAccessType(
|
||||
this->mirrorBoundary().size(),
|
||||
this->mirrorBoundary().indexList().deviceViewAll(),
|
||||
internal_.deviceViewAll());
|
||||
}
|
||||
|
||||
void fill(const std::any& val)override
|
||||
{
|
||||
return;
|
@ -15,8 +15,8 @@ Licence:
|
||||
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 __boundaryFieldList_hpp__
|
||||
#define __boundaryFieldList_hpp__
|
||||
|
@ -15,9 +15,9 @@ Licence:
|
||||
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 __createBoundaryFields_hpp__
|
||||
#define __createBoundaryFields_hpp__
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
#include "generalBoundary.hpp"
|
||||
#include "pointStructure.hpp"
|
||||
|
||||
pFlow::generalBoundary::generalBoundary
|
||||
(
|
||||
const boundaryBase& boundary,
|
||||
const pointStructure& pStruct,
|
||||
const word& dataType,
|
||||
const word& option
|
||||
)
|
||||
:
|
||||
observer(&boundary, defaultMessage_),
|
||||
boundary_(boundary),
|
||||
pStruct_(pStruct)
|
||||
{}
|
||||
|
||||
|
||||
pFlow::Time const& pFlow::generalBoundary::time() const
|
||||
{
|
||||
return pStruct_.time();
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*------------------------------- 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 "generalBoundary.hpp"
|
||||
#include "pointStructure.hpp"
|
||||
|
||||
pFlow::generalBoundary::generalBoundary
|
||||
(
|
||||
const boundaryBase& boundary,
|
||||
const pointStructure& pStruct,
|
||||
const word& dataType,
|
||||
const word& option
|
||||
)
|
||||
:
|
||||
observer(&boundary, defaultMessage_),
|
||||
boundary_(boundary),
|
||||
pStruct_(pStruct)
|
||||
{}
|
||||
|
||||
|
||||
pFlow::Time const& pFlow::generalBoundary::time() const
|
||||
{
|
||||
return pStruct_.time();
|
||||
}
|
@ -99,6 +99,18 @@ public:
|
||||
return boundary_;
|
||||
}
|
||||
|
||||
inline
|
||||
const auto& indexList()const
|
||||
{
|
||||
return boundary_.indexList();
|
||||
}
|
||||
|
||||
inline
|
||||
const auto& mirrorBoundary()const
|
||||
{
|
||||
return boundary_.mirrorBoundary();
|
||||
}
|
||||
|
||||
inline
|
||||
const word& name()const
|
||||
{
|
||||
@ -122,7 +134,7 @@ public:
|
||||
virtual
|
||||
void fill(const std::any& val)=0;
|
||||
|
||||
template<typename BoundaryFieldType>
|
||||
/*template<typename BoundaryFieldType>
|
||||
BoundaryFieldType& thisField()
|
||||
{
|
||||
return static_cast<BoundaryFieldType&>(*this);
|
||||
@ -132,7 +144,7 @@ public:
|
||||
const BoundaryFieldType& thisField()const
|
||||
{
|
||||
return static_cast<const BoundaryFieldType&>(*this);
|
||||
}
|
||||
}*/
|
||||
|
||||
};
|
||||
|
@ -15,7 +15,6 @@ Licence:
|
||||
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<class T, class MemorySpace>
|
@ -15,8 +15,8 @@ Licence:
|
||||
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 __periodicBoundaryField_hpp__
|
||||
#define __periodicBoundaryField_hpp__
|
||||
|
@ -15,7 +15,6 @@ Licence:
|
||||
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<class T, class MemorySpace>
|
@ -15,8 +15,8 @@ Licence:
|
||||
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 __internalField_hpp__
|
||||
#define __internalField_hpp__
|
||||
|
@ -15,7 +15,6 @@ Licence:
|
||||
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 __internalFieldAlgorithms_hpp__
|
@ -15,7 +15,6 @@ Licence:
|
||||
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<class T, class MemorySpace>
|
@ -15,7 +15,6 @@ Licence:
|
||||
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 __pointField_hpp__
|
||||
@ -102,6 +101,16 @@ public:
|
||||
return static_cast<const InternalFieldType&>(*this);
|
||||
}
|
||||
|
||||
const auto& boundaryFields()const
|
||||
{
|
||||
return boundaryFieldList_;
|
||||
}
|
||||
|
||||
const auto& BoundaryField(uint32 i)const
|
||||
{
|
||||
return boundaryFieldList_[i];
|
||||
}
|
||||
|
||||
// - reference to pointStructure
|
||||
inline const pointStructure& pStruct()const {
|
||||
return pStruct_;
|
@ -15,7 +15,6 @@ Licence:
|
||||
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.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -27,15 +27,9 @@ Licence:
|
||||
template class pFlow::exitBoundaryField<DataType, MemorySpaceType>; \
|
||||
template class pFlow::periodicBoundaryField<DataType, MemorySpaceType>;
|
||||
|
||||
template class pFlow::pointField<pFlow::int8, pFlow::HostSpace>;
|
||||
createBaseBoundary(pFlow::int8, pFlow::HostSpace);
|
||||
createAllBoundary(pFlow::int8, pFlow::HostSpace);
|
||||
|
||||
template class pFlow::pointField<pFlow::int8>;
|
||||
createBaseBoundary(pFlow::int8, void);
|
||||
createAllBoundary(pFlow::int8, void);
|
||||
|
||||
|
||||
// uint8
|
||||
template class pFlow::pointField<pFlow::uint8, pFlow::HostSpace>;
|
||||
createBaseBoundary(pFlow::uint8, pFlow::HostSpace);
|
||||
createAllBoundary(pFlow::uint8, pFlow::HostSpace);
|
||||
@ -44,14 +38,7 @@ template class pFlow::pointField<pFlow::uint8>;
|
||||
createBaseBoundary(pFlow::uint8, void);
|
||||
createAllBoundary(pFlow::uint8, void);
|
||||
|
||||
template class pFlow::pointField<pFlow::int32, pFlow::HostSpace>;
|
||||
createBaseBoundary(pFlow::int32, pFlow::HostSpace);
|
||||
createAllBoundary(pFlow::int32, pFlow::HostSpace);
|
||||
|
||||
template class pFlow::pointField<pFlow::int32>;
|
||||
createBaseBoundary(pFlow::int32, void);
|
||||
createAllBoundary(pFlow::int32, void);
|
||||
|
||||
/// uint32
|
||||
template class pFlow::pointField<pFlow::uint32, pFlow::HostSpace>;
|
||||
createBaseBoundary(pFlow::uint32, pFlow::HostSpace);
|
||||
createAllBoundary(pFlow::uint32, pFlow::HostSpace);
|
||||
@ -60,6 +47,7 @@ template class pFlow::pointField<pFlow::uint32>;
|
||||
createBaseBoundary(pFlow::uint32, void);
|
||||
createAllBoundary(pFlow::uint32, void);
|
||||
|
||||
/// uint64
|
||||
template class pFlow::pointField<pFlow::uint64, pFlow::HostSpace>;
|
||||
createBaseBoundary(pFlow::uint64, pFlow::HostSpace);
|
||||
createAllBoundary(pFlow::uint64, pFlow::HostSpace);
|
||||
@ -68,15 +56,16 @@ template class pFlow::pointField<pFlow::uint64>;
|
||||
createBaseBoundary(pFlow::uint64, void);
|
||||
createAllBoundary(pFlow::uint64, void);
|
||||
|
||||
/// real
|
||||
template class pFlow::pointField<pFlow::real, pFlow::HostSpace>;
|
||||
createBaseBoundary(pFlow::real, pFlow::HostSpace);
|
||||
createAllBoundary(pFlow::real, pFlow::HostSpace);
|
||||
|
||||
|
||||
template class pFlow::pointField<pFlow::real>;
|
||||
createBaseBoundary(pFlow::real, void);
|
||||
createAllBoundary(pFlow::real, void);
|
||||
|
||||
/// realx3
|
||||
template class pFlow::pointField<pFlow::realx3, pFlow::HostSpace>;
|
||||
createBaseBoundary(pFlow::realx3, pFlow::HostSpace);
|
||||
createAllBoundary(pFlow::realx3, pFlow::HostSpace);
|
||||
@ -87,6 +76,7 @@ createBaseBoundary(pFlow::realx3, void);
|
||||
createAllBoundary(pFlow::realx3, void);
|
||||
|
||||
|
||||
/// realx4
|
||||
template class pFlow::pointField<pFlow::realx4, pFlow::HostSpace>;
|
||||
createBaseBoundary(pFlow::realx4, pFlow::HostSpace);
|
||||
createAllBoundary(pFlow::realx4, pFlow::HostSpace);
|
||||
@ -96,6 +86,8 @@ template class pFlow::pointField<pFlow::realx4>;
|
||||
createBaseBoundary(pFlow::realx4, void);
|
||||
createAllBoundary(pFlow::realx4, void);
|
||||
|
||||
|
||||
/// word
|
||||
template class pFlow::pointField<pFlow::word, pFlow::HostSpace>;
|
||||
createBaseBoundary(pFlow::word, pFlow::HostSpace);
|
||||
createAllBoundary(pFlow::word, pFlow::HostSpace);
|
@ -36,21 +36,13 @@ template<typename T>
|
||||
using pointField_D = pointField<T>;
|
||||
|
||||
|
||||
using int8PointField_D = pointField_D<int8>;
|
||||
using int8PointField_H = pointField_H<int8>;
|
||||
|
||||
using uint8PointField_D = pointField_D<uint8>;
|
||||
using uint8PointField_H = pointField_H<uint8>;
|
||||
|
||||
using int32PointField_D = pointField_D<int32>;
|
||||
using int32PointField_H = pointField_H<int32>;
|
||||
|
||||
using uint32PointField_D = pointField_D<uint32>;
|
||||
using uint32PointField_H = pointField_H<uint32>;
|
||||
|
||||
using int64PointField_D = pointField_D<int64>;
|
||||
using int64PointField_H = pointField_H<int64>;
|
||||
|
||||
using uint64PointField_D = pointField_D<uint64>;
|
||||
using uint64PointField_H = pointField_H<uint64>;
|
||||
|
@ -21,14 +21,5 @@ Licence:
|
||||
#include "triSurfaceFields.hpp"
|
||||
|
||||
|
||||
template class pFlow::triSurfaceField<pFlow::real>;
|
||||
template class pFlow::triSurfaceField<pFlow::realx3>;
|
||||
|
||||
/*template class pFlow::triSurfaceField<pFlow::VectorSingle, pFlow::real, pFlow::HostSpace>;
|
||||
|
||||
template class pFlow::triSurfaceField<pFlow::VectorSingle, pFlow::realx3>;
|
||||
|
||||
template class pFlow::triSurfaceField<pFlow::VectorSingle, pFlow::realx3, pFlow::HostSpace>;
|
||||
|
||||
template class pFlow::triSurfaceField<pFlow::VectorDual, pFlow::real>;
|
||||
|
||||
template class pFlow::triSurfaceField<pFlow::VectorDual, pFlow::realx3>;*/
|
@ -208,7 +208,7 @@ const pFlow::boundaryBase &pFlow::boundaryBase::mirrorBoundary() const
|
||||
}
|
||||
|
||||
typename pFlow::boundaryBase::pointFieldAccessType
|
||||
pFlow::boundaryBase::thisPoints()
|
||||
pFlow::boundaryBase::thisPoints()const
|
||||
{
|
||||
|
||||
return pointFieldAccessType
|
||||
@ -221,7 +221,7 @@ pFlow::boundaryBase::thisPoints()
|
||||
}
|
||||
|
||||
typename pFlow::boundaryBase::pointFieldAccessType
|
||||
pFlow::boundaryBase::neighborPoints()
|
||||
pFlow::boundaryBase::neighborPoints()const
|
||||
{
|
||||
notImplementedFunction;
|
||||
return pointFieldAccessType();
|
||||
|
@ -234,13 +234,12 @@ public:
|
||||
|
||||
const boundaryBase& mirrorBoundary()const;
|
||||
|
||||
virtual
|
||||
const plane& boundaryPlane()const
|
||||
{
|
||||
return boundaryPlane_;
|
||||
}
|
||||
|
||||
/// @brief displacement vector that transfers points from
|
||||
/// @brief displacement vector that transfers points
|
||||
/// to a distance that is equal to the distance between
|
||||
/// this plane and the mirror plane, the vector points from
|
||||
/// this plane to mirror plane
|
||||
@ -257,10 +256,10 @@ public:
|
||||
virtual
|
||||
bool afterIteration(uint32 iterNum, real t, real dt) = 0;
|
||||
|
||||
pointFieldAccessType thisPoints();
|
||||
pointFieldAccessType thisPoints()const;
|
||||
|
||||
virtual
|
||||
pointFieldAccessType neighborPoints();
|
||||
pointFieldAccessType neighborPoints()const;
|
||||
|
||||
/// - static create
|
||||
static
|
||||
|
@ -1,3 +1,22 @@
|
||||
/*------------------------------- 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 __scatteredFieldAccess_hpp__
|
||||
#define __scatteredFieldAccess_hpp__
|
||||
@ -39,8 +58,8 @@ public:
|
||||
|
||||
scatteredFieldAccess(
|
||||
uint32 sz,
|
||||
ViewType1D<uint32, memory_space> ind,
|
||||
ViewType1D<T, memory_space> fVals)
|
||||
const ViewType1D<uint32, memory_space>& ind,
|
||||
const ViewType1D<T, memory_space>& fVals)
|
||||
:
|
||||
size_(sz),
|
||||
indices_(ind),
|
||||
@ -74,13 +93,30 @@ public:
|
||||
INLINE_FUNCTION_HD
|
||||
T& operator[](uint32 i)
|
||||
{
|
||||
return fieldVals_(indices_(i));
|
||||
return fieldVals_[indices_[i]];
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
const T& operator[](uint32 i)const
|
||||
{
|
||||
return fieldVals_(indices_(i));
|
||||
return fieldVals_[indices_[i]];
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
const viewType& field()const
|
||||
{
|
||||
return fieldVals_;
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
viewType& field()
|
||||
{
|
||||
return fieldVals_;
|
||||
}
|
||||
|
||||
uint32 index(uint32 i)const
|
||||
{
|
||||
return indices_[i];
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
|
@ -21,6 +21,33 @@ Licence:
|
||||
#include "boundaryList.hpp"
|
||||
#include "pointStructure.hpp"
|
||||
|
||||
void pFlow::boundaryList::setExtendedDomain()
|
||||
{
|
||||
if(!listSet_)
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"boundary list is not set yet and you used the objects."<<endl;
|
||||
fatalExit;
|
||||
}
|
||||
|
||||
realx3 lowerExt =
|
||||
boundary(0).boundaryExtensionLength() +
|
||||
boundary(2).boundaryExtensionLength() +
|
||||
boundary(4).boundaryExtensionLength();
|
||||
|
||||
realx3 upperExt =
|
||||
boundary(1).boundaryExtensionLength()+
|
||||
boundary(3).boundaryExtensionLength()+
|
||||
boundary(5).boundaryExtensionLength();
|
||||
|
||||
extendedDomain_ = pStruct_.simDomain().extendThisDomain
|
||||
(
|
||||
lowerExt,
|
||||
upperExt
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool pFlow::boundaryList::resetLists()
|
||||
{
|
||||
@ -31,7 +58,11 @@ bool pFlow::boundaryList::resetLists()
|
||||
|
||||
bool pFlow::boundaryList::updateLists()
|
||||
{
|
||||
|
||||
if(!listSet_)
|
||||
{
|
||||
setLists();
|
||||
}
|
||||
|
||||
std::array<real,6> dist;
|
||||
dist[0] = boundary(0).neighborLength();
|
||||
dist[1] = boundary(1).neighborLength();
|
||||
@ -40,20 +71,10 @@ bool pFlow::boundaryList::updateLists()
|
||||
dist[4] = boundary(4).neighborLength();
|
||||
dist[5] = boundary(5).neighborLength();
|
||||
|
||||
realx3 lowerExt =
|
||||
boundary(0).boundaryExtensionLength() +
|
||||
boundary(2).boundaryExtensionLength() +
|
||||
boundary(4).boundaryExtensionLength();
|
||||
|
||||
realx3 upperExt =
|
||||
boundary(1).boundaryExtensionLength()+
|
||||
boundary(3).boundaryExtensionLength()+
|
||||
boundary(5).boundaryExtensionLength();
|
||||
|
||||
auto extDomain = pStruct_.simDomain().extendThisDomain(lowerExt, upperExt);
|
||||
pStruct_.updateFlag(
|
||||
extDomain,
|
||||
extendedDomain_,
|
||||
dist);
|
||||
|
||||
const auto& maskD = pStruct_.activePointsMaskDevice();
|
||||
boundary(0).setSize( maskD.leftSize() );
|
||||
boundary(1).setSize( maskD.rightSize() );
|
||||
@ -69,7 +90,8 @@ bool pFlow::boundaryList::updateLists()
|
||||
boundary(3).indexList().deviceViewAll(),
|
||||
boundary(4).indexList().deviceViewAll(),
|
||||
boundary(5).indexList().deviceViewAll());
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -117,7 +139,7 @@ bool pFlow::boundaryList::setLists()
|
||||
);
|
||||
}
|
||||
listSet_ = true;
|
||||
|
||||
setExtendedDomain();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ Licence:
|
||||
#ifndef __boundaryList_hpp__
|
||||
#define __boundaryList_hpp__
|
||||
|
||||
#include "domain.hpp"
|
||||
#include "boundaryBase.hpp"
|
||||
#include "ListPtr.hpp"
|
||||
#include "baseTimeControl.hpp"
|
||||
@ -36,22 +37,26 @@ class boundaryList
|
||||
:
|
||||
public ListPtr<boundaryBase>
|
||||
{
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
||||
//// - data members
|
||||
pointStructure& pStruct_;
|
||||
|
||||
baseTimeControl timeControl_;
|
||||
|
||||
domain extendedDomain_;
|
||||
|
||||
bool listSet_ = false;
|
||||
|
||||
void setExtendedDomain();
|
||||
|
||||
bool resetLists();
|
||||
|
||||
/// @brief update neighbor list of boundaries regardless
|
||||
/// of the time intervals
|
||||
bool updateLists();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/// type info
|
||||
@ -70,26 +75,36 @@ public:
|
||||
|
||||
bool setLists();
|
||||
|
||||
inline
|
||||
const pointStructure& pStruct()const
|
||||
{
|
||||
return pStruct_;
|
||||
}
|
||||
|
||||
inline
|
||||
auto& boundary(size_t i)
|
||||
{
|
||||
return ListPtr<boundaryBase>::operator[](i);
|
||||
}
|
||||
|
||||
inline
|
||||
const auto& boundary(size_t i)const
|
||||
{
|
||||
return ListPtr<boundaryBase>::operator[](i);
|
||||
}
|
||||
|
||||
inline
|
||||
const baseTimeControl& timeControl()const
|
||||
{
|
||||
return timeControl_;
|
||||
}
|
||||
|
||||
inline
|
||||
const auto& extendedDomain()const
|
||||
{
|
||||
return extendedDomain_;
|
||||
}
|
||||
|
||||
bool beforeIteration(uint32 iter, real t, real dt);
|
||||
|
||||
bool iterate(uint32 iter, real t, real dt);
|
||||
|
@ -34,24 +34,18 @@ pFlow::boundaryPeriodic::boundaryPeriodic
|
||||
:
|
||||
boundaryBase(dict, bplane, internal, bndrs, thisIndex),
|
||||
mirrorBoundaryIndex_(dict.getVal<uint32>("mirrorBoundaryIndex"))
|
||||
{
|
||||
extendedPlane_ = boundaryBase::boundaryPlane().parallelPlane(-boundaryBase::neighborLength());
|
||||
}
|
||||
{}
|
||||
|
||||
pFlow::real pFlow::boundaryPeriodic::neighborLength() const
|
||||
{
|
||||
return 2.0*boundaryBase::neighborLength();
|
||||
return (1+extensionLength_)*boundaryBase::neighborLength();
|
||||
}
|
||||
|
||||
pFlow::realx3 pFlow::boundaryPeriodic::boundaryExtensionLength() const
|
||||
{
|
||||
return -neighborLength()*boundaryBase::boundaryPlane().normal();
|
||||
return -extensionLength_*neighborLength()*boundaryBase::boundaryPlane().normal();
|
||||
}
|
||||
|
||||
const pFlow::plane &pFlow::boundaryPeriodic::boundaryPlane() const
|
||||
{
|
||||
return extendedPlane_;
|
||||
}
|
||||
|
||||
bool pFlow::boundaryPeriodic::beforeIteration(
|
||||
uint32 iterNum,
|
||||
@ -63,7 +57,7 @@ bool pFlow::boundaryPeriodic::beforeIteration(
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
uint32 s = size();
|
||||
uint32Vector_D transferFlags("transferFlags",s+1, s+1, RESERVE());
|
||||
transferFlags.fill(0u);
|
||||
@ -71,6 +65,7 @@ bool pFlow::boundaryPeriodic::beforeIteration(
|
||||
auto points = thisPoints();
|
||||
auto p = boundaryPlane().infPlane();
|
||||
const auto & transferD = transferFlags.deviceViewAll();
|
||||
|
||||
uint32 numTransfered = 0;
|
||||
|
||||
Kokkos::parallel_reduce
|
||||
@ -96,7 +91,7 @@ bool pFlow::boundaryPeriodic::beforeIteration(
|
||||
|
||||
// to obtain the transfer vector
|
||||
realx3 transferVec = displacementVectroToMirror();
|
||||
|
||||
|
||||
return transferPoints
|
||||
(
|
||||
numTransfered,
|
||||
|
@ -35,7 +35,8 @@ private:
|
||||
|
||||
uint32 mirrorBoundaryIndex_;
|
||||
|
||||
plane extendedPlane_;
|
||||
static
|
||||
inline const real extensionLength_ = 0.1;
|
||||
|
||||
public:
|
||||
|
||||
@ -62,7 +63,7 @@ public:
|
||||
|
||||
realx3 boundaryExtensionLength()const override;
|
||||
|
||||
const plane& boundaryPlane()const override;
|
||||
//const plane& boundaryPlane()const override;*/
|
||||
|
||||
bool beforeIteration(uint32 iterNum, real t, real dt) override;
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
|
||||
//// - Constructors
|
||||
INLINE_FUNCTION_HD
|
||||
box(){}
|
||||
box() = default;
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
box(const realx3& minP, const realx3& maxP)
|
||||
@ -57,10 +57,10 @@ public:
|
||||
|
||||
|
||||
FUNCTION_H
|
||||
box(const dictionary& dict);
|
||||
explicit box(const dictionary& dict);
|
||||
|
||||
FUNCTION_H
|
||||
box(iIstream& is);
|
||||
explicit box(iIstream& is);
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
box(const box&) = default;
|
||||
@ -129,6 +129,19 @@ iIstream& operator >>(iIstream& is, box& b);
|
||||
FUNCTION_H
|
||||
iOstream& operator << (iOstream& os, const box& b);
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool equal(const box& b1, const box& b2, real tol = smallValue)
|
||||
{
|
||||
return equal(b1.minPoint(), b2.minPoint(), tol) &&
|
||||
equal(b1.maxPoint(), b2.maxPoint(), tol);
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool operator ==(const box& b1, const box& b2)
|
||||
{
|
||||
return equal(b1, b2);
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
box extendBox(const box& b, const realx3& dl)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ namespace pFlow
|
||||
|
||||
class domain
|
||||
{
|
||||
protected:
|
||||
private:
|
||||
|
||||
box domainBox_;
|
||||
|
||||
@ -60,10 +60,10 @@ public:
|
||||
|
||||
//// - Constructors
|
||||
INLINE_FUNCTION_HD
|
||||
domain(){}
|
||||
domain() = default;
|
||||
|
||||
FUNCTION_H
|
||||
domain(const box& db);
|
||||
explicit domain(const box& db);
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
domain(const domain&) = default;
|
||||
@ -127,25 +127,43 @@ public:
|
||||
INLINE_FUNCTION_H
|
||||
const auto& boundaryPlane(uint32 i)const
|
||||
{
|
||||
if(i==0) return left_;
|
||||
if(i==1) return right_;
|
||||
if(i==2) return bottom_;
|
||||
if(i==3) return top_;
|
||||
if(i==4) return rear_;
|
||||
return front_;
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return left_;
|
||||
case 1:
|
||||
return right_;
|
||||
case 2:
|
||||
return bottom_;
|
||||
case 3:
|
||||
return top_;
|
||||
case 4:
|
||||
return rear_;
|
||||
case 5:
|
||||
return front_;
|
||||
default:
|
||||
fatalErrorInFunction;
|
||||
return front_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
const auto& minPoint()const
|
||||
{
|
||||
return domainBox_.minPoint();
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
const auto& maxPoint()const
|
||||
{
|
||||
return domainBox_.maxPoint();
|
||||
}
|
||||
|
||||
}; // domain
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool equal(const domain& d1, const domain& d2)
|
||||
{
|
||||
return equal(d1.domainBox(), d2.domainBox());
|
||||
}
|
||||
|
||||
INLINE_FUNCTION_HD
|
||||
bool equal(const domain& d1, const domain& d2, real tol)
|
||||
bool equal(const domain& d1, const domain& d2, real tol=smallValue)
|
||||
{
|
||||
return equal(d1.domainBox(), d2.domainBox(), tol);
|
||||
}
|
||||
|
@ -1,3 +1,23 @@
|
||||
/*------------------------------- 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 <cstring>
|
||||
|
||||
#include "regularSimulationDomain.hpp"
|
||||
|
@ -1,3 +1,22 @@
|
||||
/*------------------------------- 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 __regularSimulationDomain_hpp__
|
||||
#define __regularSimulationDomain_hpp__
|
||||
|
@ -47,8 +47,8 @@ pFlow::domain pFlow::simulationDomain::extendThisDomain
|
||||
const realx3 &upperPointExtension
|
||||
) const
|
||||
{
|
||||
realx3 minP = thisDomain().domainBox().minPoint() + lowerPointExtension;
|
||||
realx3 maxP = thisDomain().domainBox().maxPoint() + upperPointExtension;
|
||||
realx3 minP = thisDomain().minPoint() + lowerPointExtension;
|
||||
realx3 maxP = thisDomain().maxPoint() + upperPointExtension;
|
||||
return domain({minP, maxP});
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class plane
|
||||
:
|
||||
public infinitePlane
|
||||
{
|
||||
protected:
|
||||
private:
|
||||
|
||||
/// First point
|
||||
realx3 p1_;
|
||||
|
@ -89,6 +89,11 @@ public:
|
||||
return end_-start_;
|
||||
}
|
||||
|
||||
uint32 numPoints()const
|
||||
{
|
||||
return pointEnd_ - pointStart_;
|
||||
}
|
||||
|
||||
friend iOstream& operator<< (iOstream& str, const subSurface & sub);
|
||||
|
||||
/// >> operator
|
||||
|
@ -169,12 +169,12 @@ public:
|
||||
return vertices_.capacity();
|
||||
}
|
||||
|
||||
const auto& points() const
|
||||
const realx3Field_D& points() const
|
||||
{
|
||||
return points_;
|
||||
}
|
||||
|
||||
auto& points()
|
||||
realx3Field_D& points()
|
||||
{
|
||||
return points_;
|
||||
}
|
||||
@ -189,12 +189,12 @@ public:
|
||||
return area_;
|
||||
}
|
||||
|
||||
const auto& vertices() const
|
||||
const uint32x3Field_D& vertices() const
|
||||
{
|
||||
return vertices_;
|
||||
}
|
||||
|
||||
auto& vertices()
|
||||
uint32x3Field_D& vertices()
|
||||
{
|
||||
return vertices_;
|
||||
}
|
||||
|
@ -197,5 +197,12 @@ namespace pFlow
|
||||
} \
|
||||
virtual word typeName() const { return TYPENAME();}
|
||||
|
||||
#define TypeInfoTemplate22(tBase,tName1, Type1, Type2) \
|
||||
inline static word TYPENAME() \
|
||||
{ \
|
||||
return word(tBase)+"<"+word(tName1)+","+getTypeName<Type1>()+","+getTypeName<Type2>()+">"; \
|
||||
} \
|
||||
virtual word typeName() const { return TYPENAME();}
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user