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 1 commit
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
28 changes: 22 additions & 6 deletions src/simulation/MixingModels.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ template<typename T>
class DiffusionMixingModel : public MixingModel<T> {

private:
int resolution = 10;
int numFourierTerms = 100;
MariaEmmerich marked this conversation as resolved.
Show resolved Hide resolved
std::set<int> mixingNodes;
std::vector<std::vector<RadialPosition<T>>> concatenatedFlows;
std::unordered_map<int, std::vector<FlowSection<T>>> outflowDistributions;
Expand Down Expand Up @@ -309,18 +309,18 @@ 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> 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> getAnalyticalFunction(T channelLength, T channelWidth, int numFourierTerms, 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::function<T(T)> fConstant);
std::tuple<std::function<T(T)>,std::vector<T>, T> getAnalyticalFunction(T channelLength, T channelWidth, int numFourierTerms, T pecletNr, const std::vector<FlowSectionInput<T>>& parameters, std::function<T(T)> fConstant);

std::tuple<std::function<T(T)>,std::vector<T>, T> getAnalyticalSolution(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 numFourierTerms, 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::vector<T> defineConcentrationNodeFieldForCfdInput(int resolutionIntoCfd, int specieId, int channelId, std::unordered_map<int, std::unique_ptr<Mixture<T>>>& Mixtures, int numFourierTerms);

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);
std::tuple<std::function<T(T)>, std::vector<T>, T> getAnalyticalSolutionHybridInput(T channelLength, T channelWidth, int numFourierTerms, T pecletNr, const std::vector<FlowSectionInput<T>>& parameters);

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

Expand All @@ -334,6 +334,22 @@ class DiffusionMixingModel : public MixingModel<T> {

bool isDiffusive() override { return 1; };

/**
* @brief Reset the number of Fourier terms used in the analytical solution. The higher the number the higher the precision, although this is negligible at some point.
* @param[in] newNumFourierTerms The new number of Fourier terms.
*/
void resetNumFourierTerms(int newNumFourierTerms) {
numFourierTerms = newNumFourierTerms;
}

/**
* @brief Return the number of Fourier terms used in the analytical solution.
* @param[out] numFourierTerms The current number of Fourier terms.
*/
int getNumFourierTerms() const {
return numFourierTerms;
}

};

} // namespace sim
Loading
Loading