Skip to content

Commit

Permalink
🔨 Merge 1D and Hybrid - network architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
micheltakken committed Nov 14, 2023
1 parent 6e038fb commit 3f1076c
Show file tree
Hide file tree
Showing 18 changed files with 840 additions and 104 deletions.
141 changes: 141 additions & 0 deletions examples/1D/Continuous/Network1.JSON
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"network": {
"nodes": [
{
"x": 0.0,
"y": 0.0,
"z": 0.0,
"ground": true
},
{
"x": 1e-3,
"y": 2e-3,
"z": 0.0,
"ground": false
},
{
"x": 1e-3,
"y": 1e-3,
"z": 0.0,
"ground": false
},
{
"x": 1e-3,
"y": 0.0,
"z": 0.0,
"ground": false
},
{
"x": 2e-3,
"y": 2e-3,
"z": 0.0,
"ground": false
},
{
"x": 2e-3,
"y": 1e-3,
"z": 0.0,
"ground": false
},
{
"x": 2e-3,
"y": 0.0,
"z": 0.0,
"ground": false
},
{
"x": 3e-3,
"y": 1e-3,
"z": 0.0,
"ground": true
}
],
"channels": [
{
"node1": 0,
"node2": 1,
"width": 1e-4,
"height": 1e-4
},
{
"node1": 0,
"node2": 2,
"width": 1e-4,
"height": 1e-4
},
{
"node1": 0,
"node2": 3,
"width": 1e-4,
"height": 1e-4
},
{
"node1": 1,
"node2": 4,
"width": 1e-4,
"height": 1e-4
},
{
"node1": 2,
"node2": 5,
"width": 1e-4,
"height": 1e-4
},
{
"node1": 3,
"node2": 5,
"width": 1e-4,
"height": 1e-4
},
{
"node1": 4,
"node2": 5,
"width": 1e-4,
"height": 1e-4
},
{
"node1": 6,
"node2": 5,
"width": 1e-4,
"height": 1e-4
},
{
"node1": 5,
"node2": 7,
"width": 1e-4,
"height": 1e-4
}
]
},
"simulation": {
"platform": "continuous",
"type": "1D",
"fluids": [
{
"name": "Water",
"concentration": 1,
"density": 997,
"viscosity": 0.001
}
],
"pumps": [
{
"channel":0,
"type": "PumpPressure",
"deltaP": 1000
},
{
"channel":1,
"type": "PumpPressure",
"deltaP": 1000
},
{
"channel":2,
"type": "PumpPressure",
"deltaP": 1000
}
],
"settings": {
}
}
}
125 changes: 125 additions & 0 deletions examples/1D/Droplet/Network1.JSON
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"network": {
"nodes": [
{
"x": 0.0,
"y": 0.0,
"z": 0.0,
"ground": true
},
{
"x": 1e-3,
"y": 0.0,
"z": 0.0,
"ground": false
},
{
"x": 2e-3,
"y": 0.0,
"z": 0.0,
"ground": false
},
{
"x": 1e-3,
"y": 5e-4,
"z": 0.0,
"ground": false
},
{
"x": 2e-3,
"y": 5e-4,
"z": 0.0,
"ground": false
},
{
"x": 3e-3,
"y": 0.0,
"z": 0.0,
"ground": true
}
],
"channels": [
{
"node1": 0,
"node2": 1,
"width": 1e-4,
"height": 3e-5
},
{
"node1": 1,
"node2": 2,
"width": 1e-4,
"height": 3e-5
},
{
"node1": 1,
"node2": 3,
"width": 1e-4,
"height": 3e-5
},
{
"node1": 3,
"node2": 4,
"width": 1e-4,
"height": 3e-5
},
{
"node1": 4,
"node2": 2,
"width": 1e-4,
"height": 3e-5
},
{
"node1": 2,
"node2": 5,
"width": 1e-4,
"height": 3e-5
}
]
},
"simulation": {
"platform": "droplet",
"type": "1D",
"fluids": [
{
"name": "Water",
"concentration": 1,
"density": 997,
"viscosity": 0.001
},
{
"name": "Oil",
"concentration": 1,
"density": 997,
"viscosity": 0.003
}
],
"pumps": [
{
"channel":0,
"type": "FlowRate",
"flowRate": 3e-11
}
],
"fixtures": [
{
"name": "Setup #1",
"phase": 0,
"bigDropletInjections": [
{
"fluid": 1,
"volume": 4.5e-13,
"channel": 0,
"pos": 0.5,
"t0": 0,
"deltaT": 0,
"t1": 0
}
]
}
],
"activeFixture": 0,
"settings": {
}
}
}
2 changes: 2 additions & 0 deletions src/architecture/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(SOURCE_LIST
Channel.hh
ChannelPosition.hh
lbmModule.hh
Module.hh
Network.hh
Expand All @@ -11,6 +12,7 @@ set(SOURCE_LIST

set(HEADER_LIST
Channel.h
ChannelPosition.h
lbmModule.h
Module.h
Network.h
Expand Down
42 changes: 32 additions & 10 deletions src/architecture/Channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@

namespace arch{

/**
* @brief An enum to specify the type of channel.
*/
enum class ChannelType {
NORMAL, ///< A normal channel is te regular channel in which flow flows.
BYPASS, ///< A bypass channel allows droplets to bypass another channel, e.g., if a droplet is trapped in that channel.
CLOGGABLE ///< A cloggable channel will be clogged during the time a droplet passes by one of its ends.
};

/**
* @brief An enum to specify the shape of channel.
*/
Expand Down Expand Up @@ -54,20 +63,13 @@ namespace arch{
T area = 0; ///< Area of the channel cross-section in m^2.
T pressure = 0; ///< Pressure of a channel in Pa.
T channelResistance = 0; ///< Resistance of a channel in Pas/L.
ChannelShape shape = ChannelShape::NONE; ///< The cross-section shape of this channel is rectangular
ChannelShape shape = ChannelShape::NONE; ///< The cross-section shape of this channel is rectangular.
ChannelType type = ChannelType::NORMAL; ///< What kind of channel it is.

std::vector<std::unique_ptr<Line_segment<T,2>>> line_segments; ///< Straight line segments in the channel.
std::vector<std::unique_ptr<Arc<T,2>>> arcs; ///< Arcs in the channel.

public:
/**
* @brief Constructor of a channel connecting two-nodes.
* @param[in] id Id of the channel.
* @param[in] nodeA Node at one end of the channel.
* @param[in] nodeB Node at the other end of the channel.
*/
Channel(int id, std::shared_ptr<Node<T>> nodeA, std::shared_ptr<Node<T>> nodeB);

/**
* @brief Constructor of a rectangular channel with line segments and arcs connecting two-nodes.
* @param[in] id Id of the channel.
Expand All @@ -80,6 +82,14 @@ namespace arch{
std::vector<Line_segment<T,2>*> line_segments,
std::vector<Arc<T,2>*> arcs);

/**
* @brief Constructor of a channel connecting two-nodes.
* @param[in] id Id of the channel.
* @param[in] nodeA Node at one end of the channel.
* @param[in] nodeB Node at the other end of the channel.
*/
Channel(int id, std::shared_ptr<Node<T>> nodeA, std::shared_ptr<Node<T>> nodeB);

/**
* @brief Set length of channel.
* @param[in] length New length of this channel in m.
Expand All @@ -99,6 +109,12 @@ namespace arch{
*/
void setResistance(T channelResistance);

/**
* @brief Set which kind of channel it is.
* @param[in] channelType Which kind of channel it is.
*/
void setChannelType(ChannelType channelType);

/**
* @brief Returns the length of this channel.
* @returns Length of channel in m.
Expand Down Expand Up @@ -131,7 +147,7 @@ namespace arch{

/**
* @brief Calculates and returns volume of the channel.
* @returns Volumne of a channel in m^3.
* @returns Volume of a channel in m^3.
*/
T getVolume() const;

Expand All @@ -140,6 +156,12 @@ namespace arch{
* @returns What shape the channel has.
*/
ChannelShape getChannelShape() const;

/**
* @brief Returns the type of channel.
* @returns What kind of channel it is.
*/
ChannelType getChannelType() const;
};

template<typename T>
Expand Down
10 changes: 10 additions & 0 deletions src/architecture/Channel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ namespace arch {
this->channelResistance = channelResistance_;
}

template<typename T>
void Channel<T>::setChannelType(ChannelType type_) {
this->type = type_;
}

template<typename T>
T Channel<T>::getLength() const {
return length;
Expand Down Expand Up @@ -134,6 +139,11 @@ namespace arch {
return shape;
}

template<typename T>
ChannelType Channel<T>::getChannelType() const {
return type;
}

//=====================================================================================
//================================ RectangularChannel ================================
//=====================================================================================
Expand Down
Loading

0 comments on commit 3f1076c

Please sign in to comment.