Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diffusive Mixing (1D <--> CFD) #50

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions src/simulation/MixingModels.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class Simulation;
template<typename T>
class Specie;

template<typename T>
class lbmSimulator;

// Structure to define the mixture inflow into a node
template<typename T>
struct MixtureInFlow {
Expand All @@ -59,6 +62,12 @@ struct FlowSection {
T width;
};

template<typename T> // TODO this is redundant -> remove
MariaEmmerich marked this conversation as resolved.
Show resolved Hide resolved
struct HybridFlowSection : public FlowSection<T> {
T hybridResolution;
std::vector<T> concentrations; // Alternatively we could see this as one flow section that contains all concnetrations across the connection (maybe as a vector)
};

template<typename T>
struct FlowSectionInput {
T startWidth;
Expand Down Expand Up @@ -258,10 +267,20 @@ class DiffusionMixingModel : public MixingModel<T> {
std::unordered_map<int, int> filledEdges; ///< Which edges are currently filled and what mixture is at the front <EdgeID, MixtureID>
void generateInflows();

lbmSimulator<T>* simulator; // Pointer to the lbmSimulator
MariaEmmerich marked this conversation as resolved.
Show resolved Hide resolved
// std::shared_ptr<lbmSimulator<T>> simulator;

public:

DiffusionMixingModel();

// DiffusionMixingModel(lbmSimulator<T>* simulator);
MariaEmmerich marked this conversation as resolved.
Show resolved Hide resolved

// /**
// * @brief Set the simulator for the hybrid mixing simulation.
// */
// void setSimulator(lbmSimulator<T>* simulator_);

/**
* @brief Create and/or propagate mixtures into channels downstream.
* @param[in] timeStep the current timestep size.
Expand Down Expand Up @@ -290,13 +309,19 @@ class DiffusionMixingModel : public MixingModel<T> {

void printTopology();

micheltakken marked this conversation as resolved.
Show resolved Hide resolved
std::tuple<std::function<T(T)>,std::vector<T>, T> getAnalyticalSolutionConstant(T channelLength, T channelWidth, int resolution, T pecletNr, const std::vector<FlowSectionInput<T>>& parameters);
std::tuple<std::function<T(T)>,std::vector<T>, T> getAnalyticalFunction(T channelLength, T channelWidth, int resolution, T pecletNr, const std::vector<FlowSectionInput<T>>& parameters);

std::tuple<std::function<T(T)>,std::vector<T>, T> getAnalyticalSolutionFunction(T channelLength, T channelWidth, int resolution, T pecletNr, const std::vector<FlowSectionInput<T>>& parameters, std::function<T(T)> fConstant);
std::tuple<std::function<T(T)>,std::vector<T>, T> getAnalyticalFunction(T channelLength, T channelWidth, int resolution, T pecletNr, const std::vector<FlowSectionInput<T>>& parameters, std::function<T(T)> fConstant);

std::tuple<std::function<T(T)>,std::vector<T>, T> getAnalyticalSolutionTotal(T channelLength, T currChannelFlowRate, T channelWidth, int resolution, int speciesId, T pecletNr,
std::tuple<std::function<T(T)>,std::vector<T>, T> getAnalyticalSolution(T channelLength, T currChannelFlowRate, T channelWidth, int resolution, int speciesId, T pecletNr,
const std::vector<FlowSection<T>>& flowSections, std::unordered_map<int, std::unique_ptr<Mixture<T>>>& diffusiveMixtures);

std::tuple<std::function<T(T)>,std::vector<T>,T> getAnalyticalSolutionHybrid(T channelLength, T currChannelFlowRate, T channelWidth, int resolution, T pecletNr, std::vector<T> concentrationField, T dx);

std::vector<T> defineConcentrationNodeFieldForCfdInput(int resolutionIntoCfd, int specieId, int channelId, std::unordered_map<int, std::unique_ptr<Mixture<T>>>& Mixtures, int resolution);

std::tuple<std::function<T(T)>, std::vector<T>, T> getAnalyticalSolutionHybridInput(T channelLength, T channelWidth, int resolution, T pecletNr, const std::vector<FlowSectionInput<T>>& parameters);

void clean(arch::Network<T>* network);

void printMixturesInNetwork();
Expand Down
Loading
Loading