help-octave
[Top][All Lists]
 On 06/22/2011 10:58 AM, И Страшко wrote: So here are my general modelling question. Background.   I am working on a heated mass.  This mass, of course, follows the heat equation, del2(T) = partial(T)/dt + q_e(x) q_e is some heat flux which comes into the system This is all coded in something called a function "heat" Boundary conditions.  For the first (aphysical) model, I've decided that the boundary conditions should simply be that the edges don't change, that is, they are a perfect heat sink. Question- The "core" of my iterator looks like this.  T is a 4-d matrix in (x,y,z,t)...  Tnow and Tlast are (x,y,z)... for itime = 2:size(timeaxis)(2)   disp(itime); % Tnow is the previous temperature.   Tlast = Tnow; % Tnow is now set to the current temperature   [Tnow, fcn, info] = fsolve(@heat,Tlast);  % Force Tnow to not lose boundary conditions   Tnow(1,:,:)=Tzero;   Tnow(end,:,:)=Tzero;   Tnow(:,1,:)=Tzero;   Tnow(:,end,:)=Tzero;   Tnow(:,:,1)=Tzero;   Tnow(:,:,end)=Tzero; % Update the array with the current temperature   T(:,:,:,itime) = Tnow; % Continue if we converged.   if (! (info==1))     disp("info not one:"),disp(info)     break   endif endfor Question 2- This concerns the function "heat."  When I rewrite my model to include thin layers of insulators on some walls and not on others, is it possible to compute the laplacian in segments, that is, so that part of the array has big blocks (dx, dy, dz are big) and the insulating walls have smaller blocks (that is, so that this part of the array has dx, dy, dz being small).  I mean, of course I can WRITE this in octave, the question is what the numeric analysis pitfalls will be when attempting this. Thanks for the help! -John Staško ``` _______________________________________________ Help-octave mailing list address@hidden https://mailman.cae.wisc.edu/listinfo/help-octave ``` Your post is puzzling.  Just what is question 1?  It's impossible to comment on numerical pitfalls of an algorithm that is not described.  I note that in your outline in Question 1, you use the nonlinear solver fsolve.  Yet, the mathematical problem you describe is linear, and sensible discretizations of the PDE should also be linear.  So your use of fsolve is puzzling.  Moreover, a discretization of the PDE would necessarily involve the boundary conditions, so you shouldn't have to "force" Tnow to have them by inserting them.  In fact, it isn't clear what a solution away from and independent of the boundary really means, or how it is related to your problem.  As far as question 2  (varying dx, dy, dz) is concerned, I'm guessing you mean some sort of variable discretization size of derivatives (which is possible, but may inflict loss of order of accuracy if not carefully done), but no one can divine your intent without more details. I suggest you gather a little more information about numerical methods for PDEs.  Wikipedia has a nice start on things.  Search on "numerical methods for pdes".