specify f coefficient in PDE
Show older comments
In my 3-D PDE model,the f coefficient is a spatial function(called by @ffunction),so I need to know the matrix of this coefficient. I have looked up the help manual of PDE coefficient,f=[NxNr],where N is the number of equations,one theory is that Nr is the number of tetrahedrons in the mesh,the other is that Nr is the number of points in the region that the solver passes,i.e. Nr=the number of points. I am confused with that. In previous test of 2-D PDE model,Nr is equal to the number of triangles and it run done. It will go wrong in the 3-D model when Nr is set to the number of tetrahedrons.
Answers (1)
Alan Weiss
on 29 Aug 2016
0 votes
Depending on your MATLAB version, there are different values for the f coefficient. For recent toolbox versions, use this documentation.
For older versions, use this documentation, which specifies that Nr is the number of points that the solver passes to your function. There is a bit more information here.
I hope that this helps,
Alan Weiss
MATLAB mathematical toolbox documentation
3 Comments
Xuejiao Li
on 31 Aug 2016
Alan Weiss
on 31 Aug 2016
Sorry, I don't understand you. Why do you want to plot the f coefficient in 3-D? But, in case this helps you in some way, see Plot 3-D Solutions, which gives some techniques for making 3-D plots. There are pointers in the first section to other MATLAB techniques for making 3-D plots, too.
Alan Weiss
MATLAB mathematical toolbox documentation
ADSW121365
on 4 Mar 2020
In the context of an EM problem, the source coefficient may represent current sources which are useful to visulise as part of a system. Some example code as to how you could do this is given below:
C_n = findNodes(model.Mesh,'region','cell',1); %Find nodes associated with a specific source
location.x = model.Mesh.Nodes(1,C_n); %Manual location test vars
location.y = model.Mesh.Nodes(2,C_n);
location.z = model.Mesh.Nodes(3,C_n);
f_vals = f_coeffunction_2v(location,~) %In my case this is 3x number of elements in location
%Magnitude Plot:
f_mag = sqrt(f_vals(1,:).^2 + f_vals(2,:).^2 + f_vals(3,:).^2);
f_full = zeros(1,length(model.Mesh.Nodes));
f_full(C_n) = f_mag;
figure(); pdeplot3D(model,'ColorMapData',f_full,'FaceAlpha',0.5,'Mesh','off');
Categories
Find more on General PDEs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!