I have created a square in the PDEtoolbox GUI throughout which the toolbox has solved for diffusion of particles towards the center of the square and for particle flux at any x and y.
To create a function that solves for flux at any x and y in the command window, I have exported the mesh and solution from the PDEtoolbox to the command window, specifically p and u parameters respectively, and used the TriScatteredInterp to create this function F(x,y) in the command window:
F = TriScatteredInterp(p (1,:)', p (2,:)', u);
When I save my work in the PDEtoolbox GUI, it shows up as a “function” in the “current folder” section (which makes me think this function may be used in the command window directly in other manipulations).
I would now like to repeat this process with multiple surface boundary conditions (i.e. different initial fluxes defined in the PDEtoolbox GUI at the surface of the square) and solve for the respective flux profiles (F(x,y)).
Rather than setting this up over and over again in the PDEtoolbox GUI and exporting parameters over and over, is there a way that I can
1. Modify the coding in the “PDEtoolbox function” I have created to contain a variable for the surface flux boundary condition rather than a specific value,
2. Define a value or array of values for this variable in the command window,
3. Call the “PDEtoolbox function” in the command window and pull the mesh values and solution from it for input into the TriScatteredInterp function to create a solution or solutions for F(x,y)? Or perhaps a function F(x,y,a) where “a” is the variable representing the surface flux on the square? (Therefore the need to create a whole new picture in the PDE toolbox GUI and export parameters for each new condition is avoided)
Thanks for any tips!
No products are associated with this question.
The "function" file created by pdetool when you select the "Save As" option is really for the use of pdetool, only. It is generally not recommended that you manually edit that file and it isn't useful for automating a pde solution from the command line.
An alternate approach is this:
You mentioned that you want to change your boundary conditions. The most straightforward way to do this is by writing a "boundary file" which is just a function that you write to define boundary conditions.
There are several examples of using PDE Toolbox from the command line here: http://www.mathworks.com/help/pde/examples/index.html
Play games and win prizes!Learn more