3#ifndef HEMOCELL_TESTS_PIPEFLOW_SETUP_H
4#define HEMOCELL_TESTS_PIPEFLOW_SETUP_H
12#include "palabos3D.hh"
21constexpr const char *
pipeflow_config =
"tests/validation/pipeflow/config_pipeflow.xml";
23constexpr const char *
rbc_name =
"tests/validation/pipeflow/RBC";
24constexpr const char *
plt_name =
"tests/validation/pipeflow/PLT";
33 std::unique_ptr<plb::MultiScalarField3D<int>>
flagMatrix;
42template <
class RbcModel = hemo::RbcHighOrderModel>
47 (*cfg)[
"domain"][
"refDirN"].read<int>(), (*cfg)[
"domain"][
"refDir"].read<int>(),
49 (*cfg)[
"domain"][
"particleEnvelope"].read<
int>());
54 const T poiseuilleForce =
56 setup.
drivingForce = plb::Array<T, 3>(poiseuilleForce, 0., 0.);
70 for (
unsigned int i = 0; i < steps; i++) {
72 setExternalVector(*hemocell.
lattice, hemocell.
lattice->getBoundingBox(),
73 DESCRIPTOR<T>::ExternalField::forceBeginsAt, setup.
drivingForce);
91 for (plb::plint bid : field.getLocalInfo().getBlocks()) {
93 for (
const hemo::Array<T, 3> * a : {&p.sv.v, &p.sv.position, &p.sv.force, &p.sv.force_repulsion}) {
96 state.
particles.push_back(
T(p.sv.cellId - idShift));
101 plb::MultiBlockLattice3D<T, DESCRIPTOR> & lattice = *hemocell.
lattice;
102 for (plb::plint bid : lattice.getLocalInfo().getBlocks()) {
103 plb::SmartBulk3D bulk(lattice.getMultiBlockManagement(), bid);
104 const plb::Box3D box = bulk.toLocal(bulk.getBulk());
105 plb::BlockLattice3D<T, DESCRIPTOR> & block = lattice.getComponent(bid);
106 for (plb::plint x = box.x0; x <= box.x1; x++) {
107 for (plb::plint y = box.y0; y <= box.y1; y++) {
108 for (plb::plint z = box.z0; z <= box.z1; z++) {
109 plb::Cell<T, DESCRIPTOR> &
cell = block.get(x, y, z);
110 for (plb::plint i = 0; i < DESCRIPTOR<T>::q; i++) { state.
fluid.push_back(
cell[i]); }
111 const T * force =
cell.getExternal(DESCRIPTOR<T>::ExternalField::forceBeginsAt);
112 state.
fluid.insert(state.
fluid.end(), force, force + 3);
122 if (a.size() != b.size()) {
return long(std::min(a.size(), b.size())); }
123 for (
size_t i = 0; i < a.size(); i++) {
124 if (a[i] != b[i]) {
return long(i); }
plb::MultiParticleField3D< HemoCellParticleField > * immersedParticles
palabos field storing the particles
Definition hemoCellFields.h:235
Definition hemoCellParticle.h:44
void setParticleVelocityUpdateTimeScaleSeparation(unsigned int separation)
Interpolate the fluid velocity to the vertices (and synchronise the particle envelopes) every separat...
Definition hemoCell.cpp:476
void initializeCellfield()
Create the cell fields and the particle field on the current lattice. Collective. Call after the latt...
Definition hemoCell.cpp:179
void addCellType(std::string name, int constructType)
Add a cell type with constitutive model Mechanics.
Definition hemocell.h:126
void initializeLatticeFromFlagMatrix(plb::MultiBlockManagement3D const &management, plb::MultiScalarField3D< int > &flagMatrix)
Create the fluid lattice of a voxelised geometry without a pre-inlet.
Definition hemoCell.cpp:556
HemoCellFields * cellfields
The cellfields contains the particle field and all celltypes.
Definition hemocell.h:349
void setInitialMinimumDistanceFromSolid(std::string name, T distance)
Reject initial vertices of a cell type closer than distance to a solid node: vertices within floor(di...
Definition hemoCell.cpp:510
Config * cfg
Definition hemocell.h:347
plb::MultiBlockLattice3D< T, DESCRIPTOR > * lattice
The fluid lattice.
Definition hemocell.h:343
void iterate()
Advance the coupled fluid and cells by one time step. Collective. The lattice force is reset at the e...
Definition hemoCell.cpp:377
void setMaterialTimeScaleSeparation(std::string name, unsigned int separation)
Evaluate the constitutive model of a cell type every separation iterations (default 1)....
Definition hemoCell.cpp:470
void setSystemPeriodicity(unsigned int axis, bool bePeriodic)
Set periodicity of the fluid and the particle field together. Call after initializeCellfield() and be...
Definition hemoCell.cpp:210
static T u_lbm_max
Definition constantConversion.h:38
static T pipe_radius
Definition constantConversion.h:43
static T nu_lbm
Definition constantConversion.h:38
static void lbm_pipe_parameters(Config &cfg, plb::MultiScalarField3D< int > *sf)
Definition constantConversion.cpp:61
Definition pltSimpleModel.h:33
double T
Definition constant_defaults.h:137
std::string testConfig(const std::string &path, const std::function< void(std::string &)> &edit=nullptr)
A copy of the configuration file path whose output directory lies in outputRoot(),...
Definition test_support.h:36
void getFlagMatrixFromSTL(std::string meshFileName, plb::plint extendedEnvelopeWidth, plb::plint refDirLength, plb::plint refDir, std::unique_ptr< plb::VoxelizedDomain3D< T > > &voxelizedDomain, std::unique_ptr< plb::MultiScalarField3D< int > > &flagMatrix, plint blockSize, int particleEnvelope)
Definition voxelizeDomain.cpp:66
constexpr int RBC_FROM_SPHERE
Definition constant_defaults.h:99
constexpr int ELLIPSOID_FROM_SPHERE
Definition constant_defaults.h:101
Definition pipeflow_setup.h:19
State captureState(hemo::HemoCell &hemocell, plb::plint idShift=0)
Definition pipeflow_setup.h:88
constexpr const char * pipeflow_geometry
Definition pipeflow_setup.h:22
constexpr const char * plt_name
Definition pipeflow_setup.h:24
long firstDifference(const std::vector< T > &a, const std::vector< T > &b)
Definition pipeflow_setup.h:121
std::string pipeflowConfig()
Definition pipeflow_setup.h:28
constexpr const char * pipeflow_config
Definition pipeflow_setup.h:21
void iterate(hemo::HemoCell &hemocell, const PipeflowSetup &setup, unsigned int steps)
Definition pipeflow_setup.h:69
constexpr const char * rbc_name
Definition pipeflow_setup.h:23
void setupPipeflow(hemo::HemoCell &hemocell, PipeflowSetup &setup, T rbcMinimumDistanceFromSolid=0.5, const std::string &rbc=rbc_name, const std::string &plt=plt_name)
Definition pipeflow_setup.h:43
Definition pipeflow_setup.h:32
std::unique_ptr< plb::VoxelizedDomain3D< T > > voxelizedDomain
Definition pipeflow_setup.h:34
plb::Array< T, 3 > drivingForce
Definition pipeflow_setup.h:35
std::unique_ptr< plb::MultiScalarField3D< int > > flagMatrix
Definition pipeflow_setup.h:33
Definition pipeflow_setup.h:79
std::vector< T > fluid
Definition pipeflow_setup.h:85
std::vector< T > particles
Definition pipeflow_setup.h:83