mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-08-17 03:47:04 +00:00
Compare commits
32 Commits
fd45625ce6
...
c32789f34d
Author | SHA1 | Date | |
---|---|---|---|
c32789f34d | |||
09c303a61e | |||
0820e003fc | |||
c4c6c2fc45 | |||
d5dd7af06e | |||
b03d4825ff | |||
67df8ad206 | |||
2df8133c2d | |||
dc0504d2fa | |||
27dfdfa599 | |||
8b9a9acd0c | |||
c87c9716ef | |||
0ed5b2337c | |||
282d9733fc | |||
cfd188587c | |||
e8e1081345 | |||
099e85cfb1 | |||
1cbeb1c963 | |||
a33ec7d8e0 | |||
05ecf37eee | |||
b44c4de3f6 | |||
05b256ba39 | |||
25b2e37d93 | |||
a2561f0f12 | |||
89896c0d69 | |||
4552d90eac | |||
ef1fa1ddaf | |||
d5b9ca4c43 | |||
9ccc487a51 | |||
ae251598a4 | |||
29d922e3c5 | |||
3aa6be6676 |
@ -29,7 +29,7 @@ pFlow::stationaryWall::stationaryWall
|
||||
:
|
||||
fileDictionary(objf, owner)
|
||||
{
|
||||
|
||||
const auto& dummy = this->subDictOrCreate("stationaryInfo");
|
||||
if(!impl_readDictionary(*this) )
|
||||
{
|
||||
fatalErrorInFunction;
|
||||
@ -46,6 +46,8 @@ pFlow::stationaryWall::stationaryWall
|
||||
:
|
||||
fileDictionary(objf, dict, owner)
|
||||
{
|
||||
const auto& dummy = this->subDictOrCreate("stationaryInfo");
|
||||
|
||||
if(!impl_readDictionary(*this) )
|
||||
{
|
||||
fatalErrorInFunction;
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*------------------------------- 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.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
template<typename T, typename... properties>
|
||||
void
|
||||
insertSetElementH(
|
||||
ViewType1D<T, properties...>& view,
|
||||
hostViewType1D<label>& selected,
|
||||
T val
|
||||
);
|
||||
|
||||
template<typename T, typename... properties>
|
||||
void
|
||||
insertSetElementH(
|
||||
ViewType1D<T, properties...>& view,
|
||||
hostViewType1D<label>& selected,
|
||||
hostViewType1D<T>& vals
|
||||
);
|
||||
|
||||
template<typename T, typename... properties>
|
||||
void
|
||||
insertSetElementD(
|
||||
ViewType1D<T, properties...>& view,
|
||||
deviceViewType1D<label>& selected,
|
||||
T val
|
||||
);
|
||||
|
||||
template<typename T, typename... properties>
|
||||
void
|
||||
insertSetElementD(
|
||||
ViewType1D<T, properties...>& view,
|
||||
deviceViewType1D<label>& selected,
|
||||
deviceViewType1D<T>& vals
|
||||
);
|
@ -1,229 +0,0 @@
|
||||
/*------------------------------- 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 __baseAlgorithms_hpp__
|
||||
#define __baseAlgorithms_hpp__
|
||||
|
||||
#include "KokkosUtilities.hpp"
|
||||
#include "numericConstants.hpp"
|
||||
|
||||
inline const size_t sizeToSerial__ = 64;
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
// counts the number of elements that matches val
|
||||
// the execution space is selected based on the View::execution_spcae
|
||||
/*template<typename T, typename... properties>
|
||||
INLINE_FUNCTION_H
|
||||
size_t count(
|
||||
const ViewType1D<T, properties...>& view,
|
||||
size_t start,
|
||||
size_t end,
|
||||
const T& val
|
||||
)
|
||||
{
|
||||
|
||||
auto RP = Kokkos::RangePolicy<
|
||||
Kokkos::IndexType<size_t>,
|
||||
typename ViewType1D<T, properties...>::execution_space >(start, end);
|
||||
|
||||
size_t totalNum=0;
|
||||
Kokkos::parallel_reduce(
|
||||
"baseAlgorithms-count",
|
||||
RP,
|
||||
LAMBDA_HD(label i, size_t & valueToUpdate){
|
||||
if( equal(view[i], val) ) valueToUpdate += 1;
|
||||
}, totalNum );
|
||||
|
||||
return totalNum;
|
||||
}*/
|
||||
|
||||
template<typename T, typename... properties>
|
||||
INLINE_FUNCTION_H T
|
||||
min(const ViewType1D<T, properties...>& view, size_t start, size_t end)
|
||||
{
|
||||
T minValue = largestPositive<T>();
|
||||
|
||||
auto RP = Kokkos::RangePolicy<
|
||||
Kokkos::IndexType<size_t>,
|
||||
typename ViewType1D<T, properties...>::execution_space>(start, end);
|
||||
|
||||
Kokkos::parallel_reduce(
|
||||
"baseAlgorithms-min",
|
||||
RP,
|
||||
LAMBDA_HD(label i, T & valueToUpdate) {
|
||||
valueToUpdate = min(view[i], valueToUpdate);
|
||||
},
|
||||
Kokkos ::Min<T>(minValue)
|
||||
);
|
||||
return minValue;
|
||||
}
|
||||
|
||||
template<typename T, typename... properties>
|
||||
INLINE_FUNCTION_H T
|
||||
max(const ViewType1D<T, properties...>& view, size_t start, size_t end)
|
||||
{
|
||||
T maxValue = largestNegative<T>();
|
||||
|
||||
auto RP = Kokkos::RangePolicy<
|
||||
Kokkos::IndexType<size_t>,
|
||||
typename ViewType1D<T, properties...>::execution_space>(start, end);
|
||||
|
||||
Kokkos::parallel_reduce(
|
||||
"baseAlgorithms-max",
|
||||
RP,
|
||||
LAMBDA_HD(label i, T & valueToUpdate) {
|
||||
valueToUpdate = max(view[i], valueToUpdate);
|
||||
},
|
||||
Kokkos::Max<T>(maxValue)
|
||||
);
|
||||
return maxValue;
|
||||
}
|
||||
|
||||
template<typename T, typename... properties>
|
||||
INLINE_FUNCTION_H T
|
||||
min_serial(const ViewType1D<T, properties...>& view, size_t start, size_t end)
|
||||
{
|
||||
T minValue = largestPositive<T>();
|
||||
for (label i = start; i < end; ++i)
|
||||
{
|
||||
minValue = min(minValue, view[i]);
|
||||
}
|
||||
return minValue;
|
||||
}
|
||||
|
||||
template<typename T, typename... properties>
|
||||
INLINE_FUNCTION_H T
|
||||
max_serial(const ViewType1D<T, properties...>& view, size_t start, size_t end)
|
||||
{
|
||||
T maxValue = largestNegative<T>();
|
||||
for (label i = start; i < end; ++i)
|
||||
{
|
||||
maxValue = max(maxValue, view[i]);
|
||||
}
|
||||
return maxValue;
|
||||
}
|
||||
|
||||
template<typename UnaryFunction, typename T, typename... properties>
|
||||
void
|
||||
apply_to_each(
|
||||
const ViewType1D<T, properties...>& view,
|
||||
size_t start,
|
||||
size_t end,
|
||||
UnaryFunction func
|
||||
)
|
||||
{
|
||||
auto RP = Kokkos::RangePolicy<
|
||||
Kokkos::IndexType<size_t>,
|
||||
typename ViewType1D<T, properties...>::execution_space>(start, end);
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"baseAlgorithms-for_each", RP, LAMBDA_HD(label i) { view[i] = func(i); }
|
||||
);
|
||||
}
|
||||
|
||||
template<typename T, typename... properties>
|
||||
void
|
||||
insertSetElementH(
|
||||
ViewType1D<T, properties...>& view,
|
||||
hostViewType1D<label>& selected,
|
||||
T val
|
||||
)
|
||||
{
|
||||
for (auto i = 0; i < selected.size(); ++i)
|
||||
{
|
||||
view[selected[i]] = val;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, typename... properties>
|
||||
void
|
||||
insertSetElementH(
|
||||
ViewType1D<T, properties...>& view,
|
||||
hostViewType1D<label>& selected,
|
||||
hostViewType1D<T>& vals
|
||||
)
|
||||
{
|
||||
for (auto i = 0; i < selected.size(); ++i)
|
||||
{
|
||||
view[selected[i]] = static_cast<const T&>(vals[i]);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, typename... properties>
|
||||
void
|
||||
insertSetElementD(
|
||||
ViewType1D<T, properties...>& view,
|
||||
deviceViewType1D<label>& selected,
|
||||
T val
|
||||
)
|
||||
{
|
||||
auto RP = Kokkos::RangePolicy<
|
||||
Kokkos::IndexType<size_t>,
|
||||
typename ViewType1D<T, properties...>::execution_space>(
|
||||
0, selected.size()
|
||||
);
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"baseAlgorithms-insertSetElementD",
|
||||
RP,
|
||||
LAMBDA_D(size_t i) { view[selected[i]] = val; }
|
||||
);
|
||||
}
|
||||
|
||||
template<typename T, typename... properties>
|
||||
void
|
||||
insertSetElementD(
|
||||
ViewType1D<T, properties...>& view,
|
||||
deviceViewType1D<label>& selected,
|
||||
deviceViewType1D<T>& vals
|
||||
)
|
||||
{
|
||||
auto RP = Kokkos::RangePolicy<
|
||||
Kokkos::IndexType<size_t>,
|
||||
typename ViewType1D<T, properties...>::execution_space>(
|
||||
0, selected.size()
|
||||
);
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"baseAlgorithms-insertSetElementD",
|
||||
RP,
|
||||
LAMBDA_D(size_t i) { view[selected[i]] = vals[i]; }
|
||||
);
|
||||
}
|
||||
|
||||
template<typename T, typename... properties>
|
||||
void
|
||||
fill(
|
||||
ViewType3D<T, properties...>& view,
|
||||
range range1,
|
||||
range range2,
|
||||
range range3,
|
||||
T val
|
||||
)
|
||||
{
|
||||
auto subV = Kokkos::subview(view, range1, range2, range3);
|
||||
Kokkos::deep_copy(subV, val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // __VectorSingleMath_hpp__
|
@ -52,7 +52,7 @@ class Vector;
|
||||
|
||||
|
||||
|
||||
template<typename T, typename Allocator = vecAllocator<T> >
|
||||
template<typename T, typename Allocator = std::allocator<T> >
|
||||
class Vector
|
||||
:
|
||||
public std::vector<T, Allocator>
|
||||
|
@ -35,19 +35,6 @@ namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
template <class T>
|
||||
class noConstructAllocator
|
||||
: public std::allocator<T>
|
||||
{
|
||||
public:
|
||||
using std::allocator<T>::allocator;
|
||||
|
||||
template <class U, class... Args> void construct(U*, Args&&...) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
using vecAllocator = std::allocator<T>;
|
||||
|
||||
template<typename T>
|
||||
inline
|
||||
span<T> makeSpan(std::vector<T>& container)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,113 +0,0 @@
|
||||
/*------------------------------- 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 __VectorDualMath_hpp__
|
||||
#define __VectorDualMath_hpp__
|
||||
|
||||
|
||||
|
||||
#include "baseAlgorithms.hpp"
|
||||
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
|
||||
// - select the side (HostSide or DeviceSide)
|
||||
template<typename side, typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
int64 count(const VectorDual<T,MemorySpace>& vec, const T& val)
|
||||
{
|
||||
if constexpr (std::is_same<side,HostSide>::value)
|
||||
{
|
||||
return count( vec.hostViewAll(), static_cast<size_t>(0), vec.size(), val);
|
||||
}
|
||||
else
|
||||
{
|
||||
return count( vec.deviceViewAll(), static_cast<size_t>(0), vec.size(), val);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// default to device side
|
||||
template<typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
int64 count(const VectorDual<T,MemorySpace>& vec, const T& val)
|
||||
{
|
||||
return count<DeviceSide>( vec, val);
|
||||
}
|
||||
|
||||
template<typename side, typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
int64 min(const VectorDual<T,MemorySpace>& vec)
|
||||
{
|
||||
if constexpr (std::is_same<side,HostSide>::value)
|
||||
{
|
||||
return min( vec.hostViewAll(), static_cast<size_t>(0), vec.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
return min( vec.deviceViewAll(), static_cast<size_t>(0), vec.size());
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// default to device side
|
||||
template<typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
int64 min(const VectorDual<T,MemorySpace>& vec)
|
||||
{
|
||||
return min<DeviceSide>( vec);
|
||||
}
|
||||
|
||||
template<typename side, typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
int64 max(const VectorDual<T,MemorySpace>& vec)
|
||||
{
|
||||
if constexpr (std::is_same<side,HostSide>::value)
|
||||
{
|
||||
return max( vec.hostViewAll(), static_cast<size_t>(0), vec.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
return max( vec.deviceViewAll(), static_cast<size_t>(0), vec.size());
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// default to device side
|
||||
template<typename T, typename MemorySpace>
|
||||
INLINE_FUNCTION_H
|
||||
int64 max(const VectorDual<T,MemorySpace>& vec)
|
||||
{
|
||||
return max<DeviceSide>( vec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // pFlow
|
||||
|
||||
|
||||
#endif // __VectorSingleMath_hpp__
|
@ -1,52 +0,0 @@
|
||||
/*------------------------------- 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 __VectorDuals_hpp__
|
||||
#define __VectorDuals_hpp__
|
||||
|
||||
|
||||
#include "types.hpp"
|
||||
#include "VectorDual.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
using int8Vector_HD = VectorDual<int8>;
|
||||
|
||||
using int16Vector_HD = VectorDual<int16>;
|
||||
|
||||
using int32Vector_HD = VectorDual<int32>;
|
||||
|
||||
using int64Vector_HD = VectorDual<int64>;
|
||||
|
||||
using uint32Vector_HD = VectorDual<uint32>;
|
||||
|
||||
using labelVector_HD = VectorDual<label>;
|
||||
|
||||
using realVector_HD = VectorDual<real>;
|
||||
|
||||
using realx3Vector_HD = VectorDual<realx3>;
|
||||
|
||||
using realx3x3Vector_HD = VectorDual<realx3x3>;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -69,7 +69,7 @@ pFlow::ioErrorMessage(
|
||||
)
|
||||
{
|
||||
errorStream << "\n>>> Fatal IO file error\n"
|
||||
<< " IO error at number " << Red_Text(fileLineNumber)
|
||||
<< " IO error at number " << Red_Text(fileLineNumber+1)
|
||||
<< " of file " << Red_Text(fileName) << '\n';
|
||||
errorStream << " IO operation is peformed from function "
|
||||
<< Red_Text(fnName) << " in file " << Red_Text(fName)
|
||||
|
@ -356,7 +356,7 @@ public:
|
||||
/// Token is WORD, DIRECTIVE, STRING, VARIABLE or VERBATIM
|
||||
inline bool isStringType() const;
|
||||
|
||||
|
||||
inline bool isComma()const;
|
||||
//- Access
|
||||
|
||||
/// Return boolean token value.
|
||||
|
@ -673,6 +673,13 @@ inline bool pFlow::token::isStringType() const
|
||||
return (isWord() || isString());
|
||||
}
|
||||
|
||||
inline bool pFlow::token::isComma()const
|
||||
{
|
||||
if( type_ == tokenType::PUNCTUATION &&
|
||||
pToken() == punctuationToken::COMMA) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
inline void pFlow::token::setBad()
|
||||
{
|
||||
reset();
|
||||
|
@ -36,7 +36,15 @@ pFlow::box::box
|
||||
(
|
||||
dict.getVal<realx3>("max")
|
||||
)
|
||||
{}
|
||||
{
|
||||
if( !(min_ < max_))
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"the corenter points of box are not set correctly"<<
|
||||
" (min point is greater than max point). In dictionary "<< dict.globalName()<<endl;
|
||||
fatalExit;
|
||||
}
|
||||
}
|
||||
|
||||
FUNCTION_H
|
||||
pFlow::box::box
|
||||
@ -58,6 +66,13 @@ bool pFlow::box::read(iIstream & is)
|
||||
{
|
||||
if(!is.nextData<realx3>("min", min_)) return false;
|
||||
if(!is.nextData<realx3>("max", max_)) return false;
|
||||
if(!(min_ < max_))
|
||||
{
|
||||
ioErrorInFile(is.name(), is.lineNumber())<<
|
||||
"the corenter points of box are not set correctly"<<
|
||||
" (min point is greater than max point). In dictionary "<<endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace pFlow
|
||||
|
||||
class box
|
||||
{
|
||||
protected:
|
||||
private:
|
||||
|
||||
// - min point
|
||||
realx3 min_{0,0,0};
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Problem Definition
|
||||
# Problem Definition (v-1.0)
|
||||
The problem is to simulate a Rotary Air-Lock Valve. The external diameter of rotor is about 21 cm. There is one type of particle in this simulation. Particles are inserted into the inlet of the valve from t=**0** s.
|
||||
* **28000** particles with **5 mm** diameter are inserted into the valve with the rate of **4000 particles/s**.
|
||||
* The rotor starts its rotation at t = 1.25 s at the rate of 2.1 rad/s.
|
||||
@ -84,13 +84,14 @@ surfaces
|
||||
// motion component name
|
||||
motion none;
|
||||
}
|
||||
}
|
||||
```
|
||||
## Defining particles
|
||||
### Diameter and material of spheres
|
||||
In the `caseSetup/sphereShape` the diameter and the material name of the particles are defined.
|
||||
In the `caseSetup/shapes` the diameter and the material name of the particles are defined.
|
||||
|
||||
<div align="center">
|
||||
in <b>caseSetup/sphereShape</b> file
|
||||
in <b>caseSetup/shapes</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
@ -182,15 +183,9 @@ model
|
||||
// Poisson's ratio [-]
|
||||
nu (0.25 0.25
|
||||
0.25);
|
||||
|
||||
// coefficient of normal restitution
|
||||
en (0.7 0.8
|
||||
1.0);
|
||||
|
||||
// coefficient of tangential restitution
|
||||
et (1.0 1.0
|
||||
1.0);
|
||||
|
||||
// dynamic friction
|
||||
mu (0.3 0.35
|
||||
0.35);
|
||||
@ -203,7 +198,7 @@ model
|
||||
# Performing simulation and seeing the results
|
||||
To perform simulations, enter the following commands one after another in the terminal.
|
||||
|
||||
Enter `$ particlesPhasicFlow` command to create the initial fields for particles (here the simulaiton has no particle at the beginning).
|
||||
Enter `$ geometryPhasicFlow` command to create the geometry.
|
||||
At last, enter `$ sphereGranFlow` command to start the simulation.
|
||||
After finishing the simulation, you can use `$ pFlowtoVTK` to convert the results into vtk format stored in ./VTK folder.
|
||||
Enter `particlesPhasicFlow` command to create the initial fields for particles (here the simulaiton has no particle at the beginning).
|
||||
Enter `geometryPhasicFlow` command to create the geometry.
|
||||
At last, enter `sphereGranFlow` command to start the simulation.
|
||||
After finishing the simulation, you can use `pFlowtoVTK` to convert the results into vtk format stored in ./VTK folder.
|
||||
|
@ -33,7 +33,6 @@ model
|
||||
|
||||
/*
|
||||
Property (sphereMat-sphereMat sphereMat-wallMat
|
||||
|
||||
wallMat-wallMat);
|
||||
*/
|
||||
|
||||
@ -49,9 +48,6 @@ model
|
||||
en (0.70 0.80 // coefficient of normal restitution
|
||||
1.0);
|
||||
|
||||
et (1.0 1.0 // coefficient of tangential restitution
|
||||
1.0);
|
||||
|
||||
mu (0.3 0.35 // dynamic friction
|
||||
0.35);
|
||||
|
||||
|
@ -6,14 +6,9 @@ objectName particleInsertion;
|
||||
objectType dicrionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
active yes; // is insertion active -> yes or no
|
||||
|
||||
checkForCollision No; // is checked -> yes or no
|
||||
|
||||
/*
|
||||
one region is considered for inserting particles.
|
||||
*/
|
||||
|
||||
topRegion
|
||||
{
|
||||
regionType box; // type of insertion region
|
||||
@ -28,10 +23,9 @@ topRegion
|
||||
|
||||
insertionInterval 0.025; // Time Interval between each insertion (s)
|
||||
|
||||
boxInfo // Coordinates of BoxRegion (m,m,m)
|
||||
boxInfo
|
||||
{
|
||||
min ( 0.48 0.58 0.01 ); // (m,m,m)
|
||||
|
||||
max ( 0.64 0.59 0.05 ); // (m,m,m)
|
||||
}
|
||||
|
||||
|
@ -13,25 +13,8 @@ globalBox // Simulation domain: every par
|
||||
max (0.725537 0.600214 0.06);
|
||||
}
|
||||
|
||||
decomposition
|
||||
{
|
||||
direction z;
|
||||
}
|
||||
|
||||
boundaries
|
||||
{
|
||||
|
||||
|
||||
neighborListUpdateInterval 50; /* Determines how often (how many iterations) do you want to
|
||||
|
||||
rebuild the list of particles in the neighbor list
|
||||
|
||||
of all boundaries in the simulation domain */
|
||||
|
||||
updateInterval 10; // Determines how often do you want to update the new changes in the boundary
|
||||
|
||||
neighborLength 0.004; // The distance from the boundary plane within which particles are marked to be in the boundary list
|
||||
|
||||
left
|
||||
{
|
||||
type exit; // other options: periodict, reflective
|
||||
|
@ -6,69 +6,21 @@ objectName particlesDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
setFields
|
||||
{
|
||||
/*
|
||||
Default value for fields defined for particles:
|
||||
|
||||
These fields should always be defined for simulations with spherical particles
|
||||
*/
|
||||
|
||||
defaultValue
|
||||
{
|
||||
velocity realx3 (0 0 0); // linear velocity (m/s)
|
||||
|
||||
acceleration realx3 (0 0 0); // linear acceleration (m/s2)
|
||||
|
||||
rVelocity realx3 (0 0 0); // rotational velocity (rad/s)
|
||||
|
||||
shapeName word sphere; // name of the particle shape
|
||||
}
|
||||
|
||||
selectors
|
||||
{}
|
||||
}
|
||||
|
||||
positionParticles
|
||||
{
|
||||
shapeAssigne
|
||||
{
|
||||
selector stridedRange; // other options: box, cylinder, sphere, randomPoints
|
||||
|
||||
stridedRangeInfo
|
||||
{
|
||||
begin 0; // begin index of points
|
||||
|
||||
end 50000; // end index of points
|
||||
|
||||
stride 3; // stride for selector
|
||||
}
|
||||
|
||||
fieldValue // fields that the selector is applied to
|
||||
{
|
||||
shapeName word sphere; // sets shapeName of the selected points to largeSphere
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
positionParticles // positions particles
|
||||
{
|
||||
method ordered; // other options: random and empty
|
||||
|
||||
orderedInfo
|
||||
{
|
||||
diameter 0.005; // diameter of particles
|
||||
|
||||
numPoints 50000; // number of particles in the simulation
|
||||
|
||||
axisOrder (z x y); // axis order for filling the space with particles
|
||||
}
|
||||
|
||||
regionType cylinder; // other options: box and sphere
|
||||
|
||||
cylinderInfo // cylinder information for positioning particles
|
||||
{
|
||||
p1 (0.0 0.0 0.003); // begin point of cylinder axis
|
||||
|
||||
p2 (0.0 0.0 0.22); // end point of cylinder axis
|
||||
|
||||
radius 0.117; // radius of cylinder
|
||||
}
|
||||
method empty;
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ objectName geometryDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
run rotatingAirLockValve;
|
||||
|
||||
run RotaryAirLockValve;
|
||||
|
||||
dt 0.00001; // time step for integration (s)
|
||||
|
||||
@ -33,4 +34,3 @@ writeFormat ascii; // data writting format (ascii or binary)
|
||||
timersReport Yes; // report timers: Yes or No
|
||||
|
||||
timersReportInterval 0.1; // time interval for reporting timers
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
# Problem definition
|
||||
|
||||
|
||||
# Problem definition (v-1.0)
|
||||
|
||||
A rotating drum is randomly filled with two particle sizes and rotated to observe particle segregation. The focus of this tutorial is to show how to use the preprocessing tool `particlesPhasicFlow` to create the initial mixture of small and large particles.
|
||||
|
||||
@ -15,12 +17,10 @@ a view of the rotating drum with small and large particles after 7 seconds of ro
|
||||
|
||||
# Case setup
|
||||
|
||||
In the file `caseSetup/sphereShape` two particle types with the names `smallSphere` and `largeSphere` and the diameters 3 and 5 mm are defined.
|
||||
|
||||
[Simulation case setup files can be found in tutorials/sphereGranFlow folder.](https://github.com/PhasicFlow/phasicFlow/tree/main/tutorials/sphereGranFlow/binarySystemOfParticles)
|
||||
Simulation case setup files can be found in [tutorials/sphereGranFlow folder.](https://github.com/PhasicFlow/phasicFlow/tree/main/tutorials/sphereGranFlow/binarySystemOfParticles)
|
||||
### Shape definition
|
||||
|
||||
In the file `caseSetup/sphereShape` two particle types with the names `smallSphere` and `largeSphere` and the diameters 3 and 5 mm are defined.
|
||||
In the file `caseSetup/shapes` two particle types with the names `smallSphere` and `largeSphere` and the diameters 3 and 5 mm are defined.
|
||||
|
||||
<div align="center">
|
||||
in <b>caseSetup/sphereShape</b> file
|
||||
@ -62,7 +62,7 @@ positionParticles
|
||||
}
|
||||
}
|
||||
```
|
||||
In the `setFields` dictionary, located in the `settings/particlesDict` file, you define the initial `velocity`, `acceleration`, `rotVelocity` and `shapeName` fields for all 30000 particles in the simulation. In the `selectors' dictionary, you can select subsets of particles and set the field value for those subsets. The `selectRange` selector is defined in the `shapeAssigne` subdictionary. It defines a range with `begin`, `end` and `stride` to select particles. And in the `fieldValue` subdictionary the field values for selected particles are set (any number of field values can be set here).
|
||||
In the `setFields` dictionary, located in the `settings/particlesDict` file, you define the initial `velocity`, `acceleration`, `rotVelocity` and `shapeName` fields for all 30000 particles in the simulation. In the `selectors` dictionary, you can select subsets of particles and set the field value for those subsets. The `selectRange` selector is defined in the `shapeAssigne` subdictionary. It defines a range with `begin`, `end` and `stride` to select particles. And in the `fieldValue` subdictionary the field values for selected particles are set (any number of field values can be set here).
|
||||
|
||||
**Note:** Other selectors are: `selectBox` that selects particles inside a box and `randomSelect` that selects particles randomly from a given index range.
|
||||
|
||||
@ -132,7 +132,7 @@ Each executable in PhasicFlow comes with some command line options that you can
|
||||
Usage: particlesPhasicFlow [OPTIONS]
|
||||
|
||||
Options:
|
||||
-h,--help Help for using createParticles of phasicFlow v-0.1
|
||||
-h,--help Help for using createParticles of phasicFlow v-1.0
|
||||
-v,--version Program version information
|
||||
--discription What does this app do?
|
||||
--positionParticles-only Exectue the positionParticles part only and store the created pointStructure in the time folder.
|
||||
|
@ -42,8 +42,6 @@ model
|
||||
|
||||
en (0.7); // coefficient of normal restitution
|
||||
|
||||
et (1.0); // coefficient of tangential restitution
|
||||
|
||||
mu (0.3); // dynamic friction
|
||||
|
||||
mur (0.1); // rolling friction
|
||||
|
@ -6,6 +6,4 @@ objectName particleInsertion;
|
||||
objectType dicrionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
collisionCheck No; // is checked -> yes or no
|
||||
|
||||
active No; // is insertion active -> yes or no
|
||||
|
0
tutorials/sphereGranFlow/binarySystemOfParticles/runThisCase
Normal file → Executable file
0
tutorials/sphereGranFlow/binarySystemOfParticles/runThisCase
Normal file → Executable file
@ -6,63 +6,44 @@ objectName domainDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
globalBox // Simulation domain: every particles that goes outside this domain will be deleted
|
||||
// Simulation domain: every particles that goes outside this domain will be deleted
|
||||
|
||||
globalBox
|
||||
{
|
||||
min (-0.12 -0.12 0);
|
||||
|
||||
max (0.12 0.12 0.1);
|
||||
}
|
||||
|
||||
decomposition
|
||||
{
|
||||
direction z;
|
||||
}
|
||||
|
||||
boundaries
|
||||
{
|
||||
// Determines how often (how many iterations) do you want to
|
||||
|
||||
// rebuild the list of particles in the neighbor list
|
||||
|
||||
// of all boundaries in the simulation domain
|
||||
|
||||
neighborListUpdateInterval 50;
|
||||
|
||||
// Determines how often do you want to update the new changes in the boundary
|
||||
|
||||
updateInterval 10;
|
||||
|
||||
// The distance from the boundary plane within which particles are marked to be in the boundary list
|
||||
|
||||
neighborLength 0.004;
|
||||
|
||||
left
|
||||
{
|
||||
type exit; // other options: periodict, reflective
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
|
||||
right
|
||||
{
|
||||
type exit; // other options: periodict, reflective
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
|
||||
bottom
|
||||
{
|
||||
type exit; // other options: periodict, reflective
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
|
||||
top
|
||||
{
|
||||
type exit; // other options: periodict, reflective
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
|
||||
rear
|
||||
{
|
||||
type exit; // other options: periodict, reflective
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
|
||||
front
|
||||
{
|
||||
type exit; // other options: periodict, reflective
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
}
|
||||
|
@ -34,5 +34,5 @@ writeFormat ascii; // data writting format (ascii or binary
|
||||
|
||||
timersReport Yes; // report timers
|
||||
|
||||
timersReportInterval 0.01; // time interval for reporting timers
|
||||
timersReportInterval 0.1; // time interval for reporting timers
|
||||
|
86
tutorials/sphereGranFlow/drum-PeriodicBoundary/README.md
Normal file
86
tutorials/sphereGranFlow/drum-PeriodicBoundary/README.md
Normal file
@ -0,0 +1,86 @@
|
||||
# Simulating a Rotating Drum with Periodic Boundary Type (v-1.0)
|
||||
## Problem Definition
|
||||
The problem is to simulate a rotating drum with a diameter of 0.24 m and a length of 0.1 m, rotating at 11.6 rpm. It is filled with 4-mm spherical particles at a rate of 10,000 particles/s for 2 seconds (a total of 20,000 particles). The timestep for integration is 0.00001 s. We use the `periodic` boundary type in the z-direction to replicate the same drum on both sides (a drum with an infinite length).
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<img src="./drumPeriodic.jpeg" alt="Rotating Drum with Periodic Boundary" style="width: 600px;">
|
||||
</b>
|
||||
<b>
|
||||
|
||||
A View of Rotating Drum with Periodic Boundary
|
||||
</b></div>
|
||||
|
||||
***
|
||||
|
||||
## Setting Up the Case
|
||||
Everything is similar to the tutorial on [simulating a small rotating drum](../rotatingDrumSmall), except that the drum does not have the two end plates (it is open from both sides), and we use particle insertion for inserting particles. So, if you don't know how to simulate a rotating drum, first review that tutorial.
|
||||
|
||||
Since the goal here is to show you how to use the periodic boundary type, we only review the `domainDict` here.
|
||||
|
||||
<div align="center">
|
||||
in <b>settings/domainDict</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
// Simulation domain: every particle that goes outside this domain will be deleted
|
||||
globalBox
|
||||
{
|
||||
min (-0.12 -0.12 0.0); // lower corner point of the box
|
||||
|
||||
max (0.12 0.12 0.1); // upper corner point of the box
|
||||
}
|
||||
|
||||
boundaries
|
||||
{
|
||||
|
||||
left // x-
|
||||
{
|
||||
type exit;
|
||||
}
|
||||
|
||||
right // x+
|
||||
{
|
||||
type exit;
|
||||
}
|
||||
|
||||
bottom // y-
|
||||
{
|
||||
type exit;
|
||||
}
|
||||
|
||||
top // y+
|
||||
{
|
||||
type exit;
|
||||
}
|
||||
|
||||
rear // z-
|
||||
{
|
||||
type periodic; // this boundary type should be defined on both z+ and z- sides
|
||||
}
|
||||
|
||||
front // z+
|
||||
{
|
||||
type periodic; // this boundary type should be defined on both z+ and z- sides
|
||||
}
|
||||
}
|
||||
```
|
||||
`globalBox` defines a cuboid with two corner points `min` and `max`. If a particle falls out of this box, it is automatically deleted. So, this box should contain everything in the simulation and should be as small as possible.
|
||||
|
||||
`front` and `rear` boundaries represent the front and rear planes of this `globalBox`. If we want to have a periodic boundary in the z direction, we should set the type of boundary to `periodic` for both `front` and `rear` boundaries.
|
||||
|
||||
## Running the Case
|
||||
The solver for this simulation is `sphereGranFlow`. Enter the following commands in the terminal. Depending on the computational power, it may take a few minutes to a few hours to complete.
|
||||
|
||||
```sh
|
||||
geometryPhasicFlow
|
||||
particlesPhasicFlow
|
||||
sphereGranFlow
|
||||
```
|
||||
|
||||
## Post Processing
|
||||
After finishing the simulation, you can render the results in ParaView. To convert the results to VTK format, just enter the following command in the terminal. This will convert all the results (particles and geometry) to VTK format and store them in the `VTK/` folder.
|
||||
|
||||
```sh
|
||||
pFlowToVTK --binary
|
||||
```
|
49
tutorials/sphereGranFlow/drum-PeriodicBoundary/caseSetup/interaction
Executable file
49
tutorials/sphereGranFlow/drum-PeriodicBoundary/caseSetup/interaction
Executable file
@ -0,0 +1,49 @@
|
||||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName interaction;
|
||||
objectType dicrionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
materials (prop1); // a list of materials names
|
||||
|
||||
densities (1000.0); // density of materials [kg/m3]
|
||||
|
||||
contactListType sortedContactList;
|
||||
|
||||
contactSearch
|
||||
{
|
||||
method NBS; // method for broad search
|
||||
|
||||
updateInterval 10;
|
||||
|
||||
sizeRatio 1.1;
|
||||
|
||||
cellExtent 0.55;
|
||||
|
||||
adjustableBox Yes;
|
||||
}
|
||||
|
||||
model
|
||||
{
|
||||
contactForceModel nonLinearNonLimited;
|
||||
|
||||
rollingFrictionModel normal;
|
||||
|
||||
Yeff (1.0e6); // Young modulus [Pa]
|
||||
|
||||
Geff (0.8e6); // Shear modulus [Pa]
|
||||
|
||||
nu (0.25); // Poisson's ratio [-]
|
||||
|
||||
en (0.7); // coefficient of normal restitution
|
||||
|
||||
mu (0.3); // dynamic friction
|
||||
|
||||
mur (0.1); // rolling friction
|
||||
}
|
||||
|
||||
|
42
tutorials/sphereGranFlow/drum-PeriodicBoundary/caseSetup/particleInsertion
Executable file
42
tutorials/sphereGranFlow/drum-PeriodicBoundary/caseSetup/particleInsertion
Executable file
@ -0,0 +1,42 @@
|
||||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName particleInsertion;
|
||||
objectType dicrionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
active Yes; // is insertion active -> yes or no
|
||||
|
||||
partInsertion
|
||||
{
|
||||
timeControl simulationTime; // Time control method
|
||||
|
||||
rate 10000; // insertion rate (particles/s)
|
||||
|
||||
startTime 0; // Start time for insertion (s)
|
||||
|
||||
endTime 2; // End time for insertion (s)
|
||||
|
||||
insertionInterval 0.025; // Time interval between insertions (s)
|
||||
|
||||
regionType box; // type of insertion region
|
||||
|
||||
boxInfo
|
||||
{
|
||||
min (-0.07 0.05 0.05); // Minimum coordinates of the box (m,m,m)
|
||||
max ( 0.07 0.06 0.09); // Maximum coordinates of the box (m,m,m)
|
||||
}
|
||||
|
||||
setFields
|
||||
{
|
||||
velocity realx3 (0.0 -0.4 -0.3); // initial velocity of inserted particles
|
||||
}
|
||||
|
||||
mixture
|
||||
{
|
||||
sphere1 1; // mixture composition of inserted particles
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ objectName sphereDict;
|
||||
objectType sphereShape;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
names (sphere1); // names of shapes
|
||||
|
||||
diameters (0.004); // diameter of shapes
|
||||
|
||||
materials (prop1); // material names for shapes
|
7
tutorials/sphereGranFlow/drum-PeriodicBoundary/cleanThisCase
Executable file
7
tutorials/sphereGranFlow/drum-PeriodicBoundary/cleanThisCase
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
ls | grep -P "^(([0-9]+\.?[0-9]*)|(\.[0-9]+))$" | xargs -d"\n" rm -rf
|
||||
rm -rf VTK
|
||||
|
||||
#------------------------------------------------------------------------------
|
BIN
tutorials/sphereGranFlow/drum-PeriodicBoundary/drumPeriodic.jpeg
Normal file
BIN
tutorials/sphereGranFlow/drum-PeriodicBoundary/drumPeriodic.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 228 KiB |
24
tutorials/sphereGranFlow/drum-PeriodicBoundary/runThisCase
Executable file
24
tutorials/sphereGranFlow/drum-PeriodicBoundary/runThisCase
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
echo "\n<--------------------------------------------------------------------->"
|
||||
echo "1) Creating particles"
|
||||
echo "<--------------------------------------------------------------------->\n"
|
||||
particlesPhasicFlow
|
||||
|
||||
echo "\n<--------------------------------------------------------------------->"
|
||||
echo "2) Creating geometry"
|
||||
echo "<--------------------------------------------------------------------->\n"
|
||||
geometryPhasicFlow
|
||||
|
||||
echo "\n<--------------------------------------------------------------------->"
|
||||
echo "3) Running the case"
|
||||
echo "<--------------------------------------------------------------------->\n"
|
||||
sphereGranFlow
|
||||
|
||||
echo "\n<--------------------------------------------------------------------->"
|
||||
echo "4) Converting to VTK"
|
||||
echo "<--------------------------------------------------------------------->\n"
|
||||
pFlowToVTK --binary --fields velocity diameter id
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
50
tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/domainDict
Executable file
50
tutorials/sphereGranFlow/drum-PeriodicBoundary/settings/domainDict
Executable file
@ -0,0 +1,50 @@
|
||||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName domainDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
// Simulation domain: every particles that goes outside this domain will be deleted
|
||||
globalBox
|
||||
{
|
||||
min (-0.12 -0.12 0.0); // lower corner point of the box
|
||||
|
||||
max (0.12 0.12 0.1); // upper corner point of the box
|
||||
}
|
||||
|
||||
boundaries
|
||||
{
|
||||
|
||||
left // x-
|
||||
{
|
||||
type exit;
|
||||
}
|
||||
|
||||
right // x+
|
||||
{
|
||||
type exit;
|
||||
}
|
||||
|
||||
bottom // y-
|
||||
{
|
||||
type exit;
|
||||
}
|
||||
|
||||
top // y+
|
||||
{
|
||||
type exit;
|
||||
}
|
||||
|
||||
rear // z-
|
||||
{
|
||||
type periodic; // this boundary type should be defined in both z+ and z- sides
|
||||
}
|
||||
|
||||
front // z+
|
||||
{
|
||||
type periodic; // this boundary type should be defined in both z+ and z- sides
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName geometryDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
motionModel rotatingAxis;
|
||||
|
||||
rotatingAxisInfo // information for rotatingAxisMotion motion model
|
||||
{
|
||||
rotAxis
|
||||
{
|
||||
p1 (0.0 0.0 0.0); // first point for the axis of rotation
|
||||
|
||||
p2 (0.0 0.0 1.0); // second point for the axis of rotation
|
||||
|
||||
omega 1.214; // rotation speed (rad/s)
|
||||
}
|
||||
}
|
||||
|
||||
surfaces
|
||||
{
|
||||
/*
|
||||
A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) and (0 0 0.1)
|
||||
*/
|
||||
cylinder
|
||||
{
|
||||
type cylinderWall; // type of the wall
|
||||
|
||||
p1 (0.0 0.0 0.0); // begin point of cylinder axis
|
||||
|
||||
p2 (0.0 0.0 0.1); // end point of cylinder axis
|
||||
|
||||
radius1 0.12; // radius at p1
|
||||
|
||||
radius2 0.12; // radius at p2
|
||||
|
||||
resolution 24; // number of divisions
|
||||
|
||||
material prop1; // material name of this wall
|
||||
|
||||
motion rotAxis; // motion component name
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName particlesDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
setFields
|
||||
{
|
||||
/*
|
||||
Default value for fields defined for particles
|
||||
These fields should always be defined for simulations with
|
||||
spherical particles.
|
||||
*/
|
||||
defaultValue
|
||||
{
|
||||
velocity realx3 (0 0 0); // linear velocity (m/s)
|
||||
|
||||
acceleration realx3 (0 0 0); // linear acceleration (m/s2)
|
||||
|
||||
rVelocity realx3 (0 0 0); // rotational velocity (rad/s)
|
||||
|
||||
shapeName word sphere1; // name of the particle shape
|
||||
}
|
||||
|
||||
selectors
|
||||
{}
|
||||
}
|
||||
|
||||
positionParticles
|
||||
{
|
||||
method empty; // no particle at the start of simulation
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/* -------------------------------*- C++ -*--------------------------------- *\
|
||||
| phasicFlow File |
|
||||
| copyright: www.cemf.ir |
|
||||
\* ------------------------------------------------------------------------- */
|
||||
objectName settingsDict;
|
||||
objectType dictionary;
|
||||
fileFormat ASCII;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
run drumPeriodic;
|
||||
|
||||
dt 0.00001; // time step for integration (s)
|
||||
|
||||
startTime 0; // start time for simulation
|
||||
|
||||
endTime 5; // end time for simulation
|
||||
|
||||
saveInterval 0.05; // time interval for saving the simulation
|
||||
|
||||
timePrecision 4; // maximum number of digits for time folder
|
||||
|
||||
g (0 -9.8 0); // gravity vector (m/s2)
|
||||
|
||||
includeObjects (diameter); // save necessary (i.e., required) data on disk
|
||||
|
||||
// exclude unnecessary data from saving on disk
|
||||
excludeObjects (rVelocity.dy1
|
||||
rVelocity.dy2
|
||||
rVelocity.dy3
|
||||
pStructPosition.dy1
|
||||
pStructPosition.dy2
|
||||
pStructPosition.dy3
|
||||
pStructVelocity.dy1
|
||||
pStructVelocity.dy2
|
||||
pStructVelocity.dy3);
|
||||
|
||||
integrationMethod AdamsBashforth4; // integration method
|
||||
|
||||
writeFormat ascii; // data writting format (ascii or binary)
|
||||
|
||||
timersReport Yes; // report timers (Yes or No)
|
||||
|
||||
timersReportInterval 0.1; // time interval for reporting timers
|
@ -1,4 +1,4 @@
|
||||
# Simulating a Simple Homogenization Silo Using Periodic Boundary
|
||||
# Simulating a Simple Homogenization Silo Using Periodic Boundary (v-1.0)
|
||||
|
||||
## Problem
|
||||
A homogenization silo is used to mix particles inside a silo using the circulation of particles. A pneumatic conveying system carries particles from the exit and re-enters them from the top. Here, we use a `periodic` boundary to simulate the action of the pneumatic conveyor system for circulating particles. Particles exiting from the bottom are re-entered from the top using this boundary (`periodic`).
|
||||
|
@ -1,10 +1,15 @@
|
||||
# Simulating a small rotating drum {#rotatingDrumSmall}
|
||||
# Simularing a rotating drum (v-1.0)
|
||||
## Problem definition
|
||||
The problem is to simulate a rotating drum with the diameter 0.24 m and the length 0.1 m rotating at 11.6 rpm. It is filled with 30,000 4-mm spherical particles. The timestep for integration is 0.00001 s.
|
||||
<div align="center"><b>
|
||||
a view of rotating drum
|
||||
<div align="center">
|
||||
<b>
|
||||
|
||||
A view of rotating drum
|
||||
</b>
|
||||
<b>
|
||||
|
||||

|
||||
|
||||
</b></div>
|
||||
|
||||
***
|
||||
@ -17,31 +22,36 @@ All the commands should be entered in the terminal while the current working dir
|
||||
### Creating particles
|
||||
|
||||
Open the file `settings/particlesDict`. Two dictionaries, `positionParticles` and `setFields` position particles and set the field values for the particles.
|
||||
In dictionary `positionParticles`, the positioning `method` is `positionOrdered`, which position particles in order in the space defined by `box`. `box` space is defined by two corner points `min` and `max`. In dictionary `positionOrderedInfo`, `numPoints` defines number of particles; `diameter`, the distance between two adjacent particles, and `axisOrder` defines the axis order for filling the space by particles.
|
||||
In dictionary `positionParticles`, the positioning `method` is `ordered`, which position particles in order in the space defined by `box`. `box` space is defined by two corner points `min` and `max`. In dictionary `orderedInfo`, `numPoints` defines number of particles; `diameter`, the distance between two adjacent particles, and `axisOrder` defines the axis order for filling the space by particles.
|
||||
|
||||
<div align="center">
|
||||
in <b>settings/particlesDict</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
positionParticles
|
||||
positionParticles // positions particles
|
||||
{
|
||||
method positionOrdered; // ordered positioning
|
||||
maxNumberOfParticles 40000; // maximum number of particles in the simulation
|
||||
method ordered; // other options: random and empty
|
||||
|
||||
mortonSorting Yes; // perform initial sorting based on morton code?
|
||||
|
||||
box // box for positioning particles
|
||||
{
|
||||
min (-0.08 -0.08 0.015); // lower corner point of the box
|
||||
max ( 0.08 0.08 0.098); // upper corner point of the box
|
||||
}
|
||||
|
||||
positionOrderedInfo
|
||||
orderedInfo
|
||||
{
|
||||
diameter 0.004; // minimum space between centers of particles
|
||||
|
||||
numPoints 30000; // number of particles in the simulation
|
||||
|
||||
axisOrder (z y x); // axis order for filling the space with particles
|
||||
}
|
||||
|
||||
regionType box; // other options: cylinder and sphere
|
||||
|
||||
boxInfo // box information for positioning particles
|
||||
{
|
||||
min (-0.08 -0.08 0.015); // lower corner point of the box
|
||||
|
||||
max ( 0.08 0.08 0.098); // upper corner point of the box
|
||||
}
|
||||
}
|
||||
```
|
||||
In dictionary `setFields`, dictionary `defaultValue` defines the initial value for particle fields (here, `velocity`, `acceleration`, `rotVelocity`, and `shapeName`). Note that `shapeName` field should be consistent with the name of shape that you later set for shapes (here one shape with name `sphere1`).
|
||||
@ -56,12 +66,18 @@ setFields
|
||||
defaultValue
|
||||
{
|
||||
velocity realx3 (0 0 0); // linear velocity (m/s)
|
||||
|
||||
acceleration realx3 (0 0 0); // linear acceleration (m/s2)
|
||||
rotVelocity realx3 (0 0 0); // rotational velocity (rad/s)
|
||||
|
||||
rVelocity realx3 (0 0 0); // rotational velocity (rad/s)
|
||||
|
||||
shapeName word sphere1; // name of the particle shape
|
||||
}
|
||||
|
||||
selectors
|
||||
{}
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -70,23 +86,23 @@ Enter the following command in the terminal to create the particles and store th
|
||||
`> particlesPhasicFlow`
|
||||
|
||||
### Creating geometry
|
||||
In file `settings/geometryDict` , you can provide information for creating geometry. Each simulation should have a `motionModel` that defines a model for moving the surfaces in the simulation. `rotatingAxisMotion` model defines a fixed axis which rotates around itself. The dictionary `rotAxis` defines an motion component with `p1` and `p2` as the end points of the axis and `omega` as the rotation speed in rad/s. You can define more than one motion component in a simulation.
|
||||
In file `settings/geometryDict` , you can provide information for creating geometry. Each simulation should have a `motionModel` that defines a model for moving the surfaces in the simulation. `rotatingAxis` model defines a fixed axis which rotates around itself. The dictionary `rotAxis` defines an motion component with `p1` and `p2` as the end points of the axis and `omega` as the rotation speed in rad/s. You can define more than one motion component in a simulation.
|
||||
|
||||
<div align="center">
|
||||
in <b>settings/geometryDict</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
motionModel rotatingAxisMotion;
|
||||
.
|
||||
.
|
||||
.
|
||||
rotatingAxisMotionInfo
|
||||
motionModel rotatingAxis;
|
||||
|
||||
rotatingAxisInfo // information for rotatingAxisMotion motion model
|
||||
{
|
||||
rotAxis
|
||||
{
|
||||
p1 (0.0 0.0 0.0); // first point for the axis of rotation
|
||||
|
||||
p2 (0.0 0.0 1.0); // second point for the axis of rotation
|
||||
|
||||
omega 1.214; // rotation speed (rad/s)
|
||||
}
|
||||
}
|
||||
@ -100,36 +116,69 @@ in <b>settings/geometryDict</b> file
|
||||
```C++
|
||||
surfaces
|
||||
{
|
||||
/*
|
||||
A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) and (0 0 0.1)
|
||||
*/
|
||||
|
||||
cylinder
|
||||
{
|
||||
type cylinderWall; // type of the wall
|
||||
|
||||
p1 (0.0 0.0 0.0); // begin point of cylinder axis
|
||||
|
||||
p2 (0.0 0.0 0.1); // end point of cylinder axis
|
||||
|
||||
radius1 0.12; // radius at p1
|
||||
|
||||
radius2 0.12; // radius at p2
|
||||
|
||||
resolution 24; // number of divisions
|
||||
|
||||
material prop1; // material name of this wall
|
||||
|
||||
motion rotAxis; // motion component name
|
||||
}
|
||||
|
||||
/*
|
||||
This is a plane wall at the rear end of cylinder
|
||||
*/
|
||||
|
||||
wall1
|
||||
{
|
||||
type planeWall; // type of the wall
|
||||
|
||||
p1 (-0.12 -0.12 0.0); // first point of the wall
|
||||
|
||||
p2 ( 0.12 -0.12 0.0); // second point
|
||||
|
||||
p3 ( 0.12 0.12 0.0); // third point
|
||||
|
||||
p4 (-0.12 0.12 0.0); // fourth point
|
||||
|
||||
material prop1; // material name of the wall
|
||||
|
||||
motion rotAxis; // motion component name
|
||||
}
|
||||
|
||||
/*
|
||||
This is a plane wall at the front end of cylinder
|
||||
*/
|
||||
|
||||
wall2
|
||||
{
|
||||
type planeWall;
|
||||
p1 (-0.12 -0.12 0.1);
|
||||
p2 ( 0.12 -0.12 0.1);
|
||||
p3 ( 0.12 0.12 0.1);
|
||||
p4 (-0.12 0.12 0.1);
|
||||
material prop1;
|
||||
motion rotAxis;
|
||||
type planeWall; // type of the wall
|
||||
|
||||
p1 (-0.12 -0.12 0.1); // first point of the wall
|
||||
|
||||
p2 ( 0.12 -0.12 0.1); // second point
|
||||
|
||||
p3 ( 0.12 0.12 0.1); // third point
|
||||
|
||||
p4 (-0.12 0.12 0.1); // fourth point
|
||||
|
||||
material prop1; // material name of the wall
|
||||
|
||||
motion rotAxis; // motion component name
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -159,43 +208,40 @@ model
|
||||
Geff (0.8e6); // Shear modulus [Pa]
|
||||
nu (0.25); // Poisson's ratio [-]
|
||||
en (0.7); // coefficient of normal restitution
|
||||
et (1.0); // coefficient of tangential restitution
|
||||
mu (0.3); // dynamic friction
|
||||
mur (0.1); // rolling friction
|
||||
}
|
||||
```
|
||||
|
||||
Dictionary `contactSearch` sets the methods for particle-particle and particle-wall contact search. `method` specifies the algorithm for finding neighbor list for particle-particle contacts and `wallMapping` shows how particles are mapped onto walls for finding neighbor list for particle-wall contacts. `updateFrequency` sets the frequency for updating neighbor list and `sizeRatio` sets the size of enlarged cells (with respect to particle diameter) for finding neighbor list. Larger `sizeRatio` include more particles in the neighbor list and you require to update it less frequent.
|
||||
Dictionary `contactSearch` sets the methods for particle-particle and particle-wall contact search. `method` specifies the algorithm for finding neighbor list for particle-particle contacts. `updateInterval` sets the number of iterations between each occurance of updating neighbor list and `sizeRatio` sets the size of enlarged cells (with respect to particle diameter) for finding neighbor list. Larger `sizeRatio` include more particles in the neighbor list and you require to update it less frequent.
|
||||
|
||||
<div align="center">
|
||||
in <b>caseSetup/interaction</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
contactListType sortedContactList;
|
||||
|
||||
contactSearch
|
||||
{
|
||||
method NBS; // method for broad search particle-particle
|
||||
wallMapping cellsSimple; // method for broad search particle-wall
|
||||
|
||||
NBSInfo
|
||||
{
|
||||
updateFrequency 20; // each 20 timesteps, update neighbor list
|
||||
sizeRatio 1.1; // bounding box size to particle diameter (max)
|
||||
method NBS; // method for broad search
|
||||
|
||||
updateInterval 10;
|
||||
|
||||
sizeRatio 1.1;
|
||||
|
||||
cellExtent 0.55;
|
||||
|
||||
adjustableBox Yes;
|
||||
}
|
||||
|
||||
cellsSimpleInfo
|
||||
{
|
||||
updateFrequency 20; // each 20 timesteps, update neighbor list
|
||||
cellExtent 0.7; // bounding box for particle-wall search (> 0.5)
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
In the file `caseSetup/sphereShape`, you can define a list of `names` for shapes (`shapeName` in particle field), a list of diameters for shapes and their `properties` names.
|
||||
In the file `caseSetup/shape`, you can define a list of `names` for shapes (`shapeName` in particle field), a list of diameters for shapes and their `properties` names.
|
||||
|
||||
<div align="center">
|
||||
in <b>caseSetup/sphereShape</b> file
|
||||
in <b>caseSetup/shape</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
@ -204,27 +250,91 @@ diameters (0.004); // diameter of shapes
|
||||
materials (prop1); // material names for shapes
|
||||
```
|
||||
|
||||
Other settings for the simulation can be set in file `settings/settingsDict`. The dictionary `domain` defines the a rectangular bounding box with two corner points for the simulation. Each particle that gets out of this box, will be deleted automatically.
|
||||
Other settings for the simulation can be set in file `settings/settingsDict`.
|
||||
|
||||
<div align="center">
|
||||
in <b>settings/settingsDict</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
run rotatingDrumSmall;
|
||||
|
||||
dt 0.00001; // time step for integration (s)
|
||||
|
||||
startTime 0; // start time for simulation
|
||||
|
||||
endTime 10; // end time for simulation
|
||||
|
||||
saveInterval 0.1; // time interval for saving the simulation
|
||||
|
||||
timePrecision 6; // maximum number of digits for time folder
|
||||
|
||||
g (0 -9.8 0); // gravity vector (m/s2)
|
||||
domain
|
||||
{
|
||||
min (-0.12 -0.12 0);
|
||||
max (0.12 0.12 0.11);
|
||||
}
|
||||
|
||||
includeObjects (diameter); // save necessary (i.e., required) data on disk
|
||||
|
||||
// exclude unnecessary data from saving on disk
|
||||
excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1);
|
||||
|
||||
integrationMethod AdamsBashforth2; // integration method
|
||||
|
||||
writeFormat ascii; // data writting format (ascii or binary)
|
||||
|
||||
timersReport Yes; // report timers (Yes or No)
|
||||
|
||||
timersReportInterval 0.01; // time interval for reporting timers
|
||||
```
|
||||
|
||||
The dictionary `settings/domainDict` defines the a rectangular bounding box with two corner points for the simulation. Each particle that gets out of this box, will be deleted automatically.
|
||||
|
||||
<div align="center">
|
||||
in <b>settings/domainDict</b> file
|
||||
</div>
|
||||
|
||||
```C++
|
||||
// Simulation domain: every particles that goes outside this domain will be deleted
|
||||
globalBox
|
||||
{
|
||||
min (-0.12 -0.12 0.00); // lower corner point of the box
|
||||
|
||||
max (0.12 0.12 0.11); // upper corner point of the box
|
||||
}
|
||||
|
||||
boundaries
|
||||
{
|
||||
left
|
||||
{
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
|
||||
right
|
||||
{
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
|
||||
bottom
|
||||
{
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
|
||||
top
|
||||
{
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
|
||||
rear
|
||||
{
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
|
||||
front
|
||||
{
|
||||
type exit; // other options: periodic, reflective
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Running the case
|
||||
The solver for this simulation is `sphereGranFlow`. Enter the following command in the terminal. Depending on the computational power, it may take a few minutes to a few hours to complete.
|
||||
|
||||
@ -233,4 +343,4 @@ The solver for this simulation is `sphereGranFlow`. Enter the following command
|
||||
## Post processing
|
||||
After finishing the simulation, you can render the results in Paraview. To convert the results to VTK format, just enter the following command in the terminal. This will converts all the results (particles and geometry) to VTK format and store them in folder `VTK/`.
|
||||
|
||||
`> pFlowToVTK`
|
||||
`> pFlowToVTK --binary`
|
||||
|
@ -40,8 +40,6 @@ model
|
||||
|
||||
en (0.7); // coefficient of normal restitution
|
||||
|
||||
et (1.0); // coefficient of tangential restitution
|
||||
|
||||
mu (0.3); // dynamic friction
|
||||
|
||||
mur (0.1); // rolling friction
|
||||
|
@ -13,25 +13,8 @@ globalBox // Simulation domain: every par
|
||||
max (0.12 0.12 0.11); // upper corner point of the box
|
||||
}
|
||||
|
||||
decomposition
|
||||
{
|
||||
direction z;
|
||||
}
|
||||
|
||||
boundaries
|
||||
{
|
||||
|
||||
|
||||
neighborListUpdateInterval 50; /* Determines how often (how many iterations) do you want to
|
||||
|
||||
rebuild the list of particles in the neighbor list
|
||||
|
||||
of all boundaries in the simulation domain */
|
||||
|
||||
updateInterval 10; // Determines how often do you want to update the new changes in the boundary
|
||||
|
||||
neighborLength 0.004; // The distance from the boundary plane within which particles are marked to be in the boundary list
|
||||
|
||||
left
|
||||
{
|
||||
type exit; // other options: periodict, reflective
|
||||
|
@ -29,23 +29,7 @@ setFields
|
||||
|
||||
selectors
|
||||
{
|
||||
shapeAssigne
|
||||
{
|
||||
selector stridedRange; // other options: box, cylinder, sphere, randomPoints
|
||||
|
||||
stridedRangeInfo
|
||||
{
|
||||
begin 0; // begin index of points
|
||||
|
||||
end 30000; // end index of points
|
||||
|
||||
stride 3; // stride for selector
|
||||
}
|
||||
|
||||
fieldValue // fields that the selector is applied to
|
||||
{
|
||||
shapeName word sphere1; // sets shapeName of the selected points to largeSphere
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Simulating a Screw Conveyor
|
||||
# Simulating a Screw Conveyor (v-1.0)
|
||||
|
||||
## Problem Definition
|
||||
|
||||
|
@ -4,6 +4,7 @@ particlesPhasicFlow.cpp
|
||||
positionParticles/positionParticles.cpp
|
||||
positionOrdered/positionOrdered.cpp
|
||||
positionRandom/positionRandom.cpp
|
||||
positionFile/positionFile.cpp
|
||||
empty/empty.cpp
|
||||
)
|
||||
#set(link_lib phasicFlow Kokkos::kokkos Interaction Utilities)
|
||||
|
149
utilities/particlesPhasicFlow/positionFile/positionFile.cpp
Executable file
149
utilities/particlesPhasicFlow/positionFile/positionFile.cpp
Executable file
@ -0,0 +1,149 @@
|
||||
/*------------------------------- 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 "error.hpp"
|
||||
#include "dictionary.hpp"
|
||||
#include "positionFile.hpp"
|
||||
|
||||
|
||||
#include "streams.hpp"
|
||||
// #include "token.hpp"
|
||||
#include "fileSystem.hpp"
|
||||
#include "iFstream.hpp"
|
||||
#include "oFstream.hpp"
|
||||
|
||||
bool pFlow::positionFile::positionPointsFile()
|
||||
{
|
||||
REPORT(0) << "Reading user defined position file....";
|
||||
|
||||
position_.clear();
|
||||
|
||||
// Read position data from file.
|
||||
iFstream is(fileName_);
|
||||
|
||||
realx3 tempPoint;
|
||||
|
||||
token tok;
|
||||
|
||||
while (!is.bad())
|
||||
{
|
||||
// read position x
|
||||
|
||||
is >> tok;
|
||||
if(tok.good()&& tok.isNumber()&& !is.eof())
|
||||
{
|
||||
tempPoint.x() = tok.realToken();
|
||||
}
|
||||
else
|
||||
{
|
||||
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading position x!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(commaSeparated_)
|
||||
{
|
||||
is >> tok;
|
||||
if( !tok.isComma() || is.eof())
|
||||
{
|
||||
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading comma!\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// read position y
|
||||
is >> tok;
|
||||
if(tok.good()&& tok.isNumber()&& !is.eof())
|
||||
{
|
||||
tempPoint.y() = tok.realToken();
|
||||
}
|
||||
else
|
||||
{
|
||||
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading position y!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(commaSeparated_)
|
||||
{
|
||||
is >> tok;
|
||||
if(!tok.isComma() || is.eof())
|
||||
{
|
||||
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading comma!\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// read position z
|
||||
is >> tok;
|
||||
if(tok.good()&& tok.isNumber()&& !is.eof())
|
||||
{
|
||||
tempPoint.z() = tok.realToken();
|
||||
}
|
||||
else
|
||||
{
|
||||
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading position z!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
// insert position data to vector
|
||||
position_.push_back(tempPoint);
|
||||
|
||||
is>>tok;
|
||||
if(is.eof()) break;
|
||||
|
||||
is.putBack(tok);
|
||||
}
|
||||
|
||||
REPORT(0) << "Done!" << END_REPORT;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
pFlow::positionFile::positionFile
|
||||
(
|
||||
systemControl& control,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
positionParticles(control, dict),
|
||||
poDict_
|
||||
(
|
||||
dict.subDict("fileInfo")
|
||||
),
|
||||
fileName_
|
||||
(
|
||||
poDict_.getVal<word>("name")
|
||||
),
|
||||
commaSeparated_
|
||||
(
|
||||
poDict_.getValOrSet("commaSeparated", Logical("Yes"))
|
||||
),
|
||||
position_
|
||||
(
|
||||
"position",
|
||||
1,
|
||||
0,
|
||||
RESERVE()
|
||||
)
|
||||
{
|
||||
if(!positionPointsFile())
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
105
utilities/particlesPhasicFlow/positionFile/positionFile.hpp
Executable file
105
utilities/particlesPhasicFlow/positionFile/positionFile.hpp
Executable file
@ -0,0 +1,105 @@
|
||||
/*------------------------------- 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 __positionFile_hpp__
|
||||
#define __positionFile_hpp__
|
||||
|
||||
#include "positionParticles.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
class positionFile
|
||||
:
|
||||
public positionParticles
|
||||
{
|
||||
private:
|
||||
|
||||
dictionary poDict_;
|
||||
|
||||
// word fileName_;
|
||||
|
||||
fileSystem fileName_;
|
||||
|
||||
realx3Vector position_;
|
||||
|
||||
Logical commaSeparated_;
|
||||
|
||||
bool positionPointsFile();
|
||||
|
||||
public:
|
||||
|
||||
// - type Info
|
||||
TypeInfo("file");
|
||||
|
||||
positionFile(
|
||||
systemControl& control,
|
||||
const dictionary& dict);
|
||||
|
||||
// - add this class to vCtor selection table
|
||||
add_vCtor(
|
||||
positionParticles,
|
||||
positionFile,
|
||||
dictionary);
|
||||
|
||||
~positionFile() final = default;
|
||||
|
||||
//// - Methods
|
||||
|
||||
uint32 numPoints()const final
|
||||
{
|
||||
return static_cast<uint32>(position_.size());
|
||||
}
|
||||
|
||||
uint32 size()const final
|
||||
{
|
||||
return static_cast<uint32>(position_.size());
|
||||
}
|
||||
|
||||
real maxDiameter() const final
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// bool commaSeparated()const
|
||||
// {
|
||||
// return commaSeparated_();
|
||||
// }
|
||||
|
||||
// - const access to position
|
||||
const realx3Vector& position()const final
|
||||
{
|
||||
return position_;
|
||||
}
|
||||
|
||||
// - access to position
|
||||
realx3Vector& position() final
|
||||
{
|
||||
return position_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // __positionFile_hpp__
|
Reference in New Issue
Block a user