I try making it short. I got a problem involving numerical simulation of a flow withing a gas pipe. I simulate using different models for the air flow (transport equations) travelling from one boundary to the other (i.e. from right to left). The question is, since I am using different models to represent said gas flow and boundary conditions I got a lot of functions like:
boundary_left_model_1
boundary_right_model_1
boundary_left_model_2
boundary_right_model_2
boundary_left_model_2b
boundary_right_model_2b
....
flux_model_1
flux_model_2
....
source_model_1
source_model_2
.....
I allocate the needed function before the numerical scheme via (e.g.):
boundary_left = @[needed function];
boundary_right=@ [needed function];
flux = @[needed function];
source=@ [needed function];
What follows is something like:
Solution = numerical_scheme_#1(boundary_left,boundary_right,flux,source,parameters);
you get the point.
Now, what is the most efficient way (while being structured) to build the program? As far as I can tell I have three options:
1) I define every function in a matlab function file (will result in a lot of files)
2) I define every function in the script for the numerical scheme (will result in long file, which is less clear to adjust/read)
3) I create a class for boundary conditions with methods containing all the models, one class for fluxes and sources containing corresponding functions. In my function allocation for the numerical scheme I then call the methods I need. (seems complicated and inefficient, not sure about the time needed calling methods in matlab, but is for me the most structured way)
I should probably note that I am relatively new to matlab and numerical simulation (student) and I am also asking on how this kind of problem is generally solved. Thanks in advance! Also as a bonus: if someone is fond of practical simulation of PDE systems with matlab - I got questions like "How do I decide on a numerical scheme - which criteria should I consider?"
Thanks again, I wish all of you a pleasent day!