MATLAB Help - Finite Difference Method

Поделиться
HTML-код
  • Опубликовано: 23 авг 2024
  • If you'd like to use RK4 in conjunction with the Finite Difference Method watch this video • MATLAB Help - Finite D...
    Code in this video
    github.com/cmo...
    Textbook on Numerical Methods
    github.com/cmo...

Комментарии • 199

  • @fr3ako4
    @fr3ako4 6 лет назад +3

    I cracked up at the "what does this mean" part! Awesome and helpful video!

    • @96oscarC
      @96oscarC 4 года назад

      for such a serious video that moment of silliness was just perfect

  • @mahyarbokaeeyan43
    @mahyarbokaeeyan43 6 лет назад +2

    Thanks Dr. It is really helpful and I learnt FDM by watching only this video. Appreciate it.

  • @fullychen300
    @fullychen300 8 лет назад

    '△t

  • @NancyMancarious
    @NancyMancarious 5 лет назад +4

    I'm glad that you're an aerospace engineer - me too :'D

  • @trailbleza
    @trailbleza 3 года назад +1

    This helped my tutoring career

  • @dogeness
    @dogeness 4 года назад +3

    Holy shit you came in so clutch with this thanks

  • @Contarius9
    @Contarius9 8 лет назад

    Great vid, looking forward to more. Your vids are awesome.

  • @Pokaachuu
    @Pokaachuu 8 лет назад

    Hey! That helped a lot. I am currently struggling with a question that has been set and I was hoping that you could lend a hand?
    A subterranean structure is to be constructed in the vicinity of a tidal river. For
    simplicity we will assume that the site is at a constant level. Using a finite difference analysis
    you must analyse the underlying groundwater level and propose an appropriate pumping
    network to aid construction. The river through the site can be described parametrically
    with t ∈ [0, 1].
    x = 2000t
    y = 462 ± 15 − 25.4t − 4028t^2 + 7004t^3 − 2763t^4
    The total extent of the site is a rectangle of Lx = 2000 m Ly = 1000 m, with
    K = 6.2 × 10^−4 ms−1. Note that where river intersects the site the groundwater level
    may be assumed to be 0 m. The boundaries of the site may be modelled such that the
    y = 0 m has a head of 3 m and y = 1000 m has a head of 5 m. As the variation along the
    x boundaries are not known we assume that the flow is perpendicular to the boundary. i.e.
    there is no variation in head in the y direction.
    B1. The groundwater level across the site can be approximated using the Laplace equation.
    Following a similar iterative approach to the tutorial examples, solve Laplace’s equation
    and obtain the steady state water level within the site. Once you have obtained the
    hydraulic head determine the flux field to indicate the flow of water.
    B2. An excavation in the site, of size a = 100 m and b = 75 m, located at Px, Py=(950, 500)
    m is required. To ease the process of construction the water level must be lowered in
    the region where construction will proceed. The water level must be lowered to below
    -2 m within the site using a series of pumps, with a pumping rate of −1.3 × 10−3s^−1.
    You may select the position and number of pumps, they do not have to be within the
    site, but they should not be co-located - you can’t have more than one pump within 25
    m of another. There is no restriction on the number of pumps but you should attempt
    to find an efficient design.
    You should design your code so it is possible to trial various pumping schemes and it
    should be clear how you have tested the success of your scheme. Compare the flux
    field with that obtained for a site with no pumping. Indicate clearly the location of
    your pumps.

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад

      +Ph Tang Unfortunately I have never seen a problem like this. This seems like a civil engineering question and I am an Aerospace Engineer. Unfortunately you will have to ask someone else.

  • @AsadKhan-kg5yk
    @AsadKhan-kg5yk 8 лет назад

    Really great videos Sir....fantastic work

  • @sebastiantorres7229
    @sebastiantorres7229 5 лет назад

    Carlos, what a good video and explanation!
    I have a question: Why for the discretization of time (Stability criterion - Carnahan), do you multiply by 0.5 and then divide in two again? It should not be (dx ^ 2)/(2 * k), without the 0.5. I am right?

    • @CarlosMontalvo251
      @CarlosMontalvo251  5 лет назад

      I think I was just messing around with numbers. I believe you have it right. It should just be over 2.

    • @sebastiantorres7229
      @sebastiantorres7229 5 лет назад

      Thank you, Carlos!

  • @ehsanzahoor607
    @ehsanzahoor607 7 лет назад +1

    Hi Carlos... would it be possible for you to make a tutorial on plate bending with different support conditions using finite difference method?

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад

      Unfortunately this is not my immediate area of expertise. I'm an aerospace engineer so I can't help you with this.

  • @SdrumingG
    @SdrumingG 8 лет назад +2

    Thank you so much, this was very helpful to me!! Can I use this very method to solve problems with some others boundary conditions?

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад

      Yes of course. Just change lines 34 and 35. T_mat(1,:) = 200 etc.

    • @SdrumingG
      @SdrumingG 8 лет назад

      I mean, others like Neumann boundary conditions

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад

      If you want to use Neumann boundary conditions the equation on line 7 changes since the boundary condition is now a derivative. I have those equations lying around in my notes somewhere but overall the code is very similar.

    • @SdrumingG
      @SdrumingG 8 лет назад

      Thank you so much, that was clarifying!

  • @chamimsttw2290
    @chamimsttw2290 Год назад

    Interest Video Sir, You are very smart, I have question, how to explain heat transfer on welding use goldaks double elipsoidal formula?

    • @CarlosMontalvo251
      @CarlosMontalvo251  Год назад

      Unfortunately I'm not an expert in that field so I can't help you.

    • @chamimsttw2290
      @chamimsttw2290 Год назад

      @@CarlosMontalvo251 thanks, it's nice to see you

  • @tuncozyer3605
    @tuncozyer3605 2 года назад +1

    Thank you so much for such content, what I would like to ask is what if my initial condition at T(x,0) is a function of x , then how can i insert such a condition to your code also one more thing is that what if i want to analyze such system with Neumann boundrey conditions. Can you please help me with that?

    • @CarlosMontalvo251
      @CarlosMontalvo251  2 года назад

      At 6:45 you'll notice that line 34 says T_mat(1,:) = 200; That means that there is a boundary condition where the left end of the pipe is always 200. On line 35 I have that the right end of the pipe is 150. If you want to set the initial condition of the pipe you'll need to put
      T_mat(2:end-1,1) = 100;
      That line of code says that for the first timestamp from the 2nd point on the pipe to the point right before the end the pipe temp is 100. I hope that helps.

    • @CarlosMontalvo251
      @CarlosMontalvo251  2 года назад

      Oh and for Neumann boundary conditions you need to redo the equations of motion and you'd have to redo a lot of the code. I'd recommend doing it by hand first.

    • @tuncozyer3605
      @tuncozyer3605 2 года назад

      @@CarlosMontalvo251 Thank you so much

  • @sundarrajn1003
    @sundarrajn1003 8 лет назад

    Thanks man.. you have no idea how much this helped me. can you demonstrate neumann / adibatic boundary condition ?

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад +2

      If you want to use Neumann boundary conditions the equation on line 7 changes since the boundary condition is now a derivative. I have those equations lying around in my notes somewhere but overall the code is very similar.

  • @jitinjami
    @jitinjami 7 лет назад

    Hey! How do you implement an implicit method in this? What you have done is an explicit method of solving. Implicit method involves TriDiagonal Matrix, and I'm stuck there. Would be of great help if you could do a video on that? Or just guide me, either ways it's fine.

  • @Razermantis7649
    @Razermantis7649 7 лет назад

    Thank you for saving my life

  • @brianholloway7468
    @brianholloway7468 4 года назад

    Great video and thank you! What is the title of the text you referred to for Carnahan stability condition?

    • @CarlosMontalvo251
      @CarlosMontalvo251  4 года назад +1

      I have my own textbook that I've written open source github.com/cmontalvo251/MATLAB/blob/master/Montalvo_Numerical_Methods_Textbook.pdf but I also use a textbook by Chapra www.amazon.com/Numerical-Methods-Engineers-Steven-Chapra/dp/0073401064

    • @brianholloway7468
      @brianholloway7468 4 года назад

      @@CarlosMontalvo251 wonderful! again, thank you!

  • @96oscarC
    @96oscarC 4 года назад

    Dr Montalvo, if you want to use U values for thermal resistance instead of K values how will this effect your governing equation ?

    • @CarlosMontalvo251
      @CarlosMontalvo251  4 года назад

      The governing equation is on line 7 with k values. This is the only equation I'm familiar with. If you change it to U values you'd have to go look in a thermodynamics textbook to find the answer. If you have the governing equation then you just rederive the equations of motion like I did.

  • @darthmalvado1
    @darthmalvado1 6 лет назад

    Carlos, would this method be possible if Temperature is based on three coordinates, namely x,y,z? Also, the shape I'm working with is a right triangular prism.

  • @dariuszjakubek9758
    @dariuszjakubek9758 2 года назад

    May I ask about the link to the textbook on numerical methods mentioned in this video ?

    • @CarlosMontalvo251
      @CarlosMontalvo251  2 года назад

      Yes my apologies. The link was broken. Here's the link to the code and the book.
      Code in this video
      github.com/cmontalvo251/MATLAB/blob/master/screen_cast_codes/Heat_Equation/finite_difference_example.m
      Textbook on Numerical Methods
      github.com/cmontalvo251/LaTeX/blob/master/Numerical_Methods_Montalvo/Numerical_Methods.pdf

  • @bertinekouekam8648
    @bertinekouekam8648 5 лет назад

    this video really helped me a lot.Please do you could do a little video that explains the variation of temperature over time?

    • @CarlosMontalvo251
      @CarlosMontalvo251  5 лет назад

      Are you talking about the underlying physical phenomena? Because if so that seems more well suited for a different channel.

    • @bertinekouekam8648
      @bertinekouekam8648 5 лет назад

      in fact it is a question of tracing the evolution of the temperature as a function of the time since in the video you did it according to x and the time. I would like to know how to do it on matlab.
      if possible now since I work on it and I am blocked. An explanation on it will help me but a small video will be able to help me even more

    • @bertinekouekam8648
      @bertinekouekam8648 5 лет назад

      in general i just want to know how we can plot the evolution of heat as a function of time

    • @CarlosMontalvo251
      @CarlosMontalvo251  5 лет назад

      @@bertinekouekam8648 I don't understand your question. At 11:08 I show a plot with position of the pipe on the x-axis and time on the y-axis. You're asking how to plot temperature as a function of time but I already did that.

    • @bertinekouekam8648
      @bertinekouekam8648 5 лет назад

      i want to have something in 2D with heat on y axis and time on x axis a thing like that T=f(t).i don't know if you understand me know

  • @jackchaq4838
    @jackchaq4838 7 лет назад

    That was very helpful. Can I apply this idea to T(x,y,z,t)?

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад +2

      Although I've never done it myself I am pretty sure that you can.

  • @paraspatel1818
    @paraspatel1818 7 лет назад

    Hey Dr.,
    I am working on same equation with finite element method and getting negative temperature after 3rd time step can you suggest me a video to solve this same problem with FEM?
    Thank you,
    Paras.

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад +1

      I cannot unfortunately. I myself have never coded an Finite Element Method

  • @swatityagi4358
    @swatityagi4358 3 года назад

    Thanks Dr. Very nice and informative lecture.
    Can you please make a lecture on how to solve (i) nonlinear system of ODE with reaction diffusion term, (ii) solving nonlinear system of coupled ODE; both using finite difference scheme

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад

      Unfortunately this video here is the limit of my knowledge. I am an Aerospace Engineer and just teach Numerical Methods at the UG level.

    • @swatityagi4358
      @swatityagi4358 3 года назад

      @@CarlosMontalvo251 Thanks for the response. I can send you some references, may be it could work out for us.

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад

      @@swatityagi4358 Sure send it over. It might spark some interest.

    • @swatityagi4358
      @swatityagi4358 3 года назад

      @@CarlosMontalvo251 can you give me your email id, so that I can share.

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад

      @@swatityagi4358 Just post them here.

  • @zariqbahrin6170
    @zariqbahrin6170 4 года назад

    which book did you refers for this problem , the book you showed in pdf , may i know the title of the book ? tq

    • @CarlosMontalvo251
      @CarlosMontalvo251  4 года назад

      The pdf itself is notes I've created in Latex but all of those equations came from www.amazon.com/Numerical-Methods-Engineers-Steven-Chapra/dp/0073401064

    • @zariqbahrin6170
      @zariqbahrin6170 4 года назад

      @@CarlosMontalvo251 tq dr carlos

  • @farisandjamilahalsubaie828
    @farisandjamilahalsubaie828 5 лет назад

    Thank you ,,it was helpful,
    How can we do this with source or sink

  • @budapesteBR2012
    @budapesteBR2012 7 лет назад

    Hi i have done some works in my college of mechanical engineering using mathlab i could say i am in a intermediary user. Could u please post the others programs u have used to get this graphic.

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад +1

      I no longer post code to my videos anymore. If you need the code you will just have to watch the video and follow long.

  • @user-pm1qe2of5t
    @user-pm1qe2of5t 7 лет назад +1

    Hi Dr
    Please. I needed an algorithm to solve the equations Telegraphic equations or Propagation equations of transmission line by method FDTD.( for my university project)

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад +1

      I don't know what telegraphic equations or propagation equations are. I am an aerospace engineer. You will have to ask someone else.

    • @ozzyfromspace
      @ozzyfromspace 4 года назад

      Dr. Carlos Montalvo they are bulk matter equations in electrical engineering (edit: and applied physics) that model the propagation of electromagnetic fields along a wire. The model assumes microscopic resistance, capacitance, and inductance of finite elements of the wire. The equations are called the “telegrapher equations” and resemble modified wave equations. Typically, in electrical circuit design we assume that the bulb or whatever turns on immediately after the switch is turned on. However, a tiny amount of time is required to transmit this signal. For high frequency circuits or dimensionally large circuits (relative to the wavelength of the incident radiation in the wire) we need to account for this delay, hence the discretization of the conductor via telegrapher equations. Another approach is to solve the Maxwell equations of electromagnetism, it this requires an understanding of Green’s functions and potential functions (which isn’t too bad once you look at the math). Usually, such math cannot be resolved analytically, which I guess is why the OP was watching this video. I’m a dropout (cashier) so I have limited experience & training with these things lol. I just heard about these equations in the grapevine. Awesome channel btw 100% subbed 😊👏🏽🎊🥇🤓

    • @ozzyfromspace
      @ozzyfromspace 4 года назад

      Dr. Carlos Montalvo just outta curiosity, what do aerospace engineers do?

  • @hoomanros5117
    @hoomanros5117 8 лет назад +2

    That was very helpful! I would really appreciate if you can solve a nonlinear elliptic PDE with FDM method.

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад

      hey no problem. can you give me an example?

    • @hoomanros5117
      @hoomanros5117 8 лет назад

      +Carlos Montalvo
      This is the PDE I was trying to solve:
      U′′x−U′x+U2=cos2(x)−sin(x)+cos(x)
      in which, exact solution is:
      U=cos(x).
      I had problem with applying Neumann BC to it. Dirichlet is working fine but not von Neumann.

    • @hoomanros5117
      @hoomanros5117 8 лет назад

      +Carlos Montalvo
      the equation:
      www.hostmath.com/Show.aspx?Code=U_x%5E%7B%5Cprime%5Cprime%7D-U_x%5E%5Cprime%2BU%5E%7B2%7D%3Dcos%5E%7B2%7D(x)-sin(x)%2Bcos(x)

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад +2

      I'll take a look and get back to you in a few days. Thanks for the problem!

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад +2

      +Carlos Montalvo Hey I got it to work. Give me a day or so to post the solution. I ended up using a blended RK4 FDM approach which has pretty good convergence. Obviously there are other ways but the method I will post does just fine.

  • @nisarmuhammad313
    @nisarmuhammad313 4 года назад

    Thanks for Your efforts. Need the name or link for the documents which You are coding. Looking forward to hear from You. I will be tankful-for this act of kindness

    • @CarlosMontalvo251
      @CarlosMontalvo251  4 года назад

      You're welcome. The following text has been added to the description
      Code in this video
      github.com/cmontalvo251/MATLAB/blob/master/Screen_Cast_Codes/Heat_Equation/finite_difference_example.m
      Textbook on Numerical Methods
      github.com/cmontalvo251/MATLAB/blob/master/Numerical_Methods_Montalvo/Numerical_Methods.pdf

  • @vamsikrishna7194
    @vamsikrishna7194 8 лет назад

    How do I plot the temperature versus the distance(for a particular given time..say at the end of 10min I want a plot of T vs x) in your problem?

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад

      plot(x_vec,T_mat(:,end))

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад

      Let me explain. x_vec is the vector created that contains the x-coordinates. T_mat is a matrix. The number of rows is the same as the length of x_vec and the number of columns contains each temperature profile for each time. So plotting T_mat(:,end) plots the last time slot T_mat(:,2) would plot the second time slot or rather the second timestep.

    • @vamsikrishna7194
      @vamsikrishna7194 8 лет назад

      Thanks a ton!

  • @electronicsthedeep7122
    @electronicsthedeep7122 7 лет назад

    helpful video

  • @football_hanie
    @football_hanie 3 года назад

    why did you write tdx for integration step?

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад

      I typically use idx which is short for index but in this case I decided to use tdx which is short for time index.

  • @bertinekouekam8648
    @bertinekouekam8648 5 лет назад

    please can i have the book that you use in this video?

  • @ernestadisi491
    @ernestadisi491 7 лет назад

    I'm trying to solve 1D laplace heat equation for a plate using the FDM. Do you have any advice as to how i can the code step by step and plot contours as my matlab skills are mediocre.

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад

      Are you looking for something like this?
      purge
      x = 1:3;
      y = 1:3;
      [xx,yy] = meshgrid(x,y);
      T00 = (75+0)/2;
      T44 = (75+50)/2;
      T04 = (100+75)/2;
      T40 = (0+50)/2;
      A = [ 4 -1 0 -1 0 0 0 0 0;
      -1 4 -1 0 -1 0 0 0 0;
      0 -1 4 0 0 -1 0 0 0;
      -1 0 0 4 -1 0 -1 0 0;
      0 -1 0 -1 4 -1 0 -1 0;
      0 0 -1 0 -1 4 0 0 -1;
      0 0 0 -1 0 0 4 -1 0;
      0 0 0 0 -1 0 -1 4 -1;
      0 0 0 0 0 -1 0 -1 4];
      b = [75; 0; 50; 75; 0; 50; 175; 100; 150];
      xans = A\b;
      Tsolution = wrapmatrix(xans)';
      %Tsolution = [43 33.3 33.89;63.21 56.11 52.34;78.59 76.06 69.71];
      plottool(1,'Heat 2D',12,'x (m)','y (m)','Temperacture (Celsius)',['Heat' ...
      ' 2D'])
      %mesh(xx,yy,Tsolution)
      T = [0 0 0 0 0;75 75 60 50 50;75 75 60 50 50;75 75 60 50 50;100 100 100 100 100];
      for iter = 1:10
      for idx = 2:4
      for jdx = 2:4
      T(idx,jdx) = (T(idx+1,jdx) + T(idx-1,jdx) + T(idx,jdx+1) + T(idx,jdx-1))/4;
      end
      end
      end
      plottool(1,'Heat 2D',12,'x (m)','y (m)','Temperacture (Celsius)','Numerical Error')
      mesh(xx,yy,T(2:4,2:4)-Tsolution)
      %%%Iterative Method

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад

      comment out plottool and purge oh and comment out wrap matrix too.

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад

      Hmm. I'm not sure that code will run easily. This seems more complex than I thought.

    • @ernestadisi491
      @ernestadisi491 7 лет назад

      this could be helpful thanks

  • @vamsikrishna7194
    @vamsikrishna7194 8 лет назад

    Hi! Can you please help me on how to solve with finite difference method and ode45 put together (rather than using RK4)?

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад

      I don't think that would work to be honest. ode45 uses an adaptive timestep and finite difference method is a fixed timestep. But maybe it would work? Seems kind of difficult though.

    • @vamsikrishna7194
      @vamsikrishna7194 8 лет назад

      Thanks for the suggestion.If you could help me how to solve simultaneous differential algebraic equations(1st order) where one initial condition is known(It is required as we have to discretize the space not the time)...then I could probably do it myself

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад

      Simultaneous differential algebraic equations? I don't think I've ever heard of those. Can you give me an example?

  • @mahmoudalgarhy7889
    @mahmoudalgarhy7889 4 года назад

    Great

  • @Roberto70ism
    @Roberto70ism 6 лет назад

    I Dr. Montalvo, good video and good work; do you share a file.m? thank you

    • @CarlosMontalvo251
      @CarlosMontalvo251  6 лет назад

      For code see git@gitlab.com:Montalvo/MATLAB_Games.git - Screen_Cast_Codes - Finite_Difference_Method

    • @Roberto70ism
      @Roberto70ism 6 лет назад

      Thank you very much :-)

  • @soroushshokouhi4192
    @soroushshokouhi4192 3 года назад

    what if our boundary conditions wasn't constant?

    • @CarlosMontalvo251
      @CarlosMontalvo251  3 года назад

      You'd have to use Neumann conditions I think and redirve the equations. Unforunately I don't recall how to do that

  • @user-zd3mp5dc3f
    @user-zd3mp5dc3f 3 года назад

    Hi I need cod finite difference method for wave equation

  • @weslylai6621
    @weslylai6621 3 года назад

    12:03 , what book do you use? thanks

  • @lpsoldier8627
    @lpsoldier8627 7 лет назад

    the ordinary differential method can be done in the same way,right??

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад

      Anika Esha not sure what you mean. what is the ordinary differential method? and what is this way?

    • @lpsoldier8627
      @lpsoldier8627 7 лет назад

      Dr. Carlos Montalvo well what you have done it's partial differential equation right?so I was just asking if the ordinary differential equation can be done in the same way...

  • @sauddo7718
    @sauddo7718 6 лет назад

    is this direct way and can apply this direct method on 2-d fisher's equation

    • @cjcar178
      @cjcar178 6 лет назад

      This is the indirect method. Also see this for Fisher equation. www.sciencedirect.com/science/article/pii/S0895717797000150/pdf?md5=0165428fb9a79afade595e3eb72bd48e&pid=1-s2.0-S0895717797000150-main.pdf&_valck=1

  • @bediumang
    @bediumang 5 лет назад

    I am solving four coupled pdes in 1D and want to make one dependent variable value constant after particular time so it cant go below zero and I will use its zero value for further simulation to get desired value of other dependent variables.

    • @CarlosMontalvo251
      @CarlosMontalvo251  5 лет назад

      I would make that variable a global variable so that when you change it in one place it will change it everywhere

    • @bediumang
      @bediumang 5 лет назад

      @@CarlosMontalvo251 ok sir if we want to stop one variable after some time so it can not affect the other one how we can do that in the coupled pdes system

    • @CarlosMontalvo251
      @CarlosMontalvo251  5 лет назад

      @@bediumang if you're using ode45 that may be more difficult. However if you are using RK4, you can set the variable to a constant in your for loop. That might be an interesting video to make.

    • @bediumang
      @bediumang 5 лет назад

      Dr. Carlos Montalvo actually I am using ode45 and ode23tb .please make one Vedio its really helpful

    • @CarlosMontalvo251
      @CarlosMontalvo251  5 лет назад

      @@bediumang i would look at one of my Rk4 videos first to see how to do that.

  • @baacademy1166
    @baacademy1166 4 года назад

    Good day Dr. Carlos, May God bless you for putting off such tutorial. please I still need your help for 2D PDE TUTORIAL (I MWAEN YOU SHOULD EXTEND THE ABOVE TUTORIAL TO 2D). THANKS

    • @CarlosMontalvo251
      @CarlosMontalvo251  4 года назад

      Can you give me an example?

    • @baacademy1166
      @baacademy1166 4 года назад

      @@CarlosMontalvo251
      δT/δt=-u δT/δx+1/ρCp [k_ex (δ^2 T)/(δx^2 )+k_er (1/r δT/δx+(δ^2 T)/〖δx〗^2 )+ ρ_s (1-ε) H n(r_co )]
      The initial conditions for the continuity and energy models are
      at t=0,T=T_0
      The boundary conditions are:
      .At Z=0,,〖-k〗_ez δT/δz=ρuC_p (T_0-T)
      At z=L, δT/δz=0
      At r=0, δT/δr=0
      At r=R, -k_ez δT/δr=h_w (T-T_w)
      u= 0.5; %m/s
      gs=7633.65; %kg/m3
      ef=0.7;
      e=0.3;
      k=0.0454; %W/m.K
      Cp=2639.53; %J/kg K
      g=0.597; %kg/m3
      k2=100000; %mol/m3s.
      E2=16000000; %J/kmol
      R=8.314; %J/K mol
      Pco=0.2;
      Ph20=0.8;
      Pco2=0;
      Ph2=0;
      T=633; %K
      H=-115823; %J/mol
      rco =k2*exp(-E2/(R*T))*((Pco*Ph20-(Pco2*Ph2))/(exp(4577/T)-4.33)); %mol/m3s

    • @baacademy1166
      @baacademy1166 4 года назад

      I wish you find time out of the tight schedule to solve it.

    • @CarlosMontalvo251
      @CarlosMontalvo251  4 года назад

      @@baacademy1166 Are the variables r and z with respect to time?

    • @baacademy1166
      @baacademy1166 4 года назад

      Dr. Carlos Montalvo yes they are, Unsteady state.

  • @darrenpinto902
    @darrenpinto902 7 лет назад

    what happens when the condition is steady state ?

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад

      Darren Pinto nothing. once the condition reaches steady state the simulation won't change

  • @ozzyfromspace
    @ozzyfromspace 4 года назад

    Is the pdf you’re using open access? I’d like to read it please.

    • @CarlosMontalvo251
      @CarlosMontalvo251  4 года назад

      Where would I upload something like that? arXIV? Github?

    • @patcragg7034
      @patcragg7034 4 года назад

      @@CarlosMontalvo251 Could always try google drive, onedrive, or dropbox all free

    • @CarlosMontalvo251
      @CarlosMontalvo251  4 года назад

      @@patcragg7034 Went ahead and just through it on github. github.com/cmontalvo251/MATLAB/blob/master/Montalvo_Numerical_Methods_Textbook.pdf

    • @CarlosMontalvo251
      @CarlosMontalvo251  4 года назад

      Perhaps it will help some of you out

    • @patcragg7034
      @patcragg7034 4 года назад

      @@CarlosMontalvo251 really appreciate it thank you! Often times I find people's personal notes much more comprehensive and useful. Thanks a ton!

  • @saeedkhani5823
    @saeedkhani5823 4 года назад

    clear
    clc
    close all
    %%% Heat Constant - Heat Capacitance
    k=2;
    %%% Length of the pipe
    L = 10;
    %%% Number of Elements
    N = 10;
    %% Discretize our Xspace
    x_vec = linspace(0,L,N);
    dx = x_vec(2)-x_vec(1);
    %% Discretize time
    dt = 0.5*dx^2/(2*k);
    t_vec = 0:dt:10;
    %%% Allocate memory for Temp
    T_mat = zeros (length(x_vec),length(t_vec));
    %%% Initial Conditions for the Temprature
    T_mat(1,:) = 200;
    T_mat(end,:) = 150;
    %%% Integrate using Euler's and FDM put together
    for tdx = 1:length(t_vec)-1
    for idx = 2:length(x_vec)-1
    T_mat (idx,tdx+1)= T_mat(idx,tdx) + k*dt/dx^2 * (T_mat(idx+1,tdx)-2*T_mat(idx,tdx)+T_mat(idx-1,tdx));
    end
    end
    [tt,xx] = meshgrid(t_vec,x_vec);
    mesh(xx,tt,T_mat)
    xlabel('X coordinate (m)')
    ylabel('Time (sec)')
    zlabel('Temperature (F)')

  • @shehnazararahman55
    @shehnazararahman55 8 лет назад

    Sir, i m trying to solve three partial differential equation ,where two is linear and one is non-linear. They have three unknown and these equation are related. Can u pliz help in dealing with 3 unknown variables

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад

      To solve multiple equations simultaneously you just need to stack them in vector format and integrate them simultaneously. In this tutorial I show how to integrate a 2 state system using RK4. PDE's aren't much different. fastlabtutorials.blogspot.com/2015/03/everything-you-need-to-know-to-code.html?view=classic

    • @shehnazararahman55
      @shehnazararahman55 8 лет назад

      Thank you Sir.

    • @shehnazararahman55
      @shehnazararahman55 8 лет назад

      Sir, is it posible in matlab to solve three non-linear PDE which are interlinked together??

    • @CarlosMontalvo251
      @CarlosMontalvo251  8 лет назад

      +Naz Rahman I think so but I've never done it before. my specialty is in ODEs.

    • @shehnazararahman55
      @shehnazararahman55 8 лет назад

      Wil you give a try to solve my non-linear PDE if I send you my equation set?

  • @brahimmebarki363
    @brahimmebarki363 7 лет назад

    Please can you share us the book you are working

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад +6

      “Numerical Methods for Engineers, 7th Ed.”, S. Chapra and R. Canale, McGraw-Hill, ISBN
      9781259318726.
      “Essential MATLAB and Octave” J. Rogel-Salazar, CRC Press, 2015. ISBN 9781482234633

    • @Zach-de3dv
      @Zach-de3dv 6 лет назад

      Never mind about my question. This is the textbook we actually use at my uni. Thanks.

  • @abdo-almonaimalghlam554
    @abdo-almonaimalghlam554 7 лет назад

    Sir, just I am asking how can i write a matlab code for Explicit Finite Difference Method for Parabolic PDEs ..... thanks

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад +1

      I do not know how to do that. This is not my immediate area of expertise.

  • @rubr1337
    @rubr1337 7 лет назад

    Dude, why are you doing 3 commentary signs?

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад +2

      Because 2 signs creates separate cells in the editor which annoys me and one sign by itself isn't good enough for me. Call it a bad habit if you want.

  • @zee9000_
    @zee9000_ 7 лет назад

    do you cover the CN method?

  • @bertinekouekam8648
    @bertinekouekam8648 5 лет назад

    please can i have the book that you use in this video.thanks

  • @sehrishbibi4997
    @sehrishbibi4997 3 года назад

    can i get the code for 2D unsteady flow ?

  • @user-kf1mh1hr2o
    @user-kf1mh1hr2o 7 лет назад

    sir , i m to sovle E field riadition from a dipole antenna in 3D

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад +3

      Hi emad, I am an aerospace engineer. E field radiation is beyond my immediate area of expertise.

  • @Zach-de3dv
    @Zach-de3dv 6 лет назад

    What textbook are you using?

  • @Eulercit0
    @Eulercit0 7 лет назад

    uhmmmm good evening i dont speaks english sry :D
    If you give me initial temperature where would it go in your program?

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад

      Initial conditions are set on line 34 at 6:43

    • @Eulercit0
      @Eulercit0 7 лет назад

      Nono, if it is a bar with 100 F on both sides and the initial temperature is 20F how could it be? uhmmm ty anyway

  • @abdellahcherifi9374
    @abdellahcherifi9374 7 лет назад

    heey dr.. plz help me .. i want the FdTd 2d programing ..10k's

    • @CarlosMontalvo251
      @CarlosMontalvo251  7 лет назад

      abdellah cherifi I have this on my to-do list to complete a 2D finite difference method I just haven't done it yet

    • @abdellahcherifi9374
      @abdellahcherifi9374 7 лет назад

      soo ...

  • @sergiorome48
    @sergiorome48 2 года назад

    well I should probably learn how to use Matlab in the first place...

  • @mexicoball2533
    @mexicoball2533 Год назад

    rola codigo hermano (drop the code bro)

  • @bertinekouekam8648
    @bertinekouekam8648 5 лет назад

    please sir it is very important for me