Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4234702
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:23:35+00:00 2026-05-21T02:23:35+00:00

I try to compare solution of my Finite Volume Method to solution of Mathematica

  • 0

I try to compare solution of my Finite Volume Method to solution of Mathematica for simple Heat Equation U_t = U_xx. For this I have to specify initial and boundary condition for NDSolve function in Mathematica. I would like to have on boundaries U = 90. As initial condition I would like to have 100 in all square domain except boundaries. How can I do this? Obviously my code doesn’t work.

FUNC = NDSolve[{D[T[x, y, t], t] == (D[T[x, y, t], x, x] + D[T[x, y, t], y, y]), 
    T[x, y, 0] == 100, T[0, y, t] == 90, T[9, y, t] == 90, 
    T[x, 0, t] == 90, T[x, 9, t] == 90}, 
   T, {x, 0, 9}, {y, 0, 9}, {t, 0, 6}];

It try to set initial condition at all domain equals to 100.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:23:36+00:00Added an answer on May 21, 2026 at 2:23 am

    Actually, with a small modification your code does work.

    FUNC = T /. 
      NDSolve[{
         D[T[x, y, t], t] == (D[T[x, y, t], x, x] + D[T[x, y, t], y, y]), 
         T[x, y, 0] == 100, T[0, y, t] == 90, T[9, y, t] == 90, 
         T[x, 0, t] == 90, T[x, 9, t] == 90}, 
        T, {x, 0, 9}, {y, 0, 9}, {t, 0, 10}][[1]]
    

    Modifications are the T/. (ReplaceAll) part in front and the [[1]] (Part) at the end; you may want to look these op in the documentation. Thery are necessary to massage the output into the correct shape .

    You get an error message about inconsistency of boundary and initial conditions (which is correct). The result is nevertheless usable.

    Alternatively, you can change the initial condition so as to read

    FUNC = T /. 
      NDSolve[{
         D[T[x, y, t], t] == (D[T[x, y, t], x, x] + D[T[x, y, t], y, y]), 
         T[x, y, 0] == If[x == 0 || x == 9 || y == 0 || y == 9, 90, 100], 
         T[0, y, t] == 90, T[9, y, t] == 90, T[x, 0, t] == 90, 
         T[x, 9, t] == 90}, T, {x, 0, 9}, {y, 0, 9}, {t, 0, 10}][[1]]
    

    You can now do lots of things with this function like e.g. a Manipulate:

    Manipulate[ContourPlot[FUNC[x, y, t], {x, 0, 9}, {y, 0, 9}], {t, 0, 10}]
    

    Manipulate ContourPlot

    or an animated GIF:

    anim = Table[DensityPlot[FUNC[x, y, t], {x, 0, 9}, {y, 0, 9}, 
              ColorFunctionScaling -> False, PlotPoints -> 50,
              ColorFunction -> (Hue[Rescale[#, {50, 100}], 1, 1] &)], 
            {t, 0, 10, .2}];
    Export[ToFileName[$UserDocumentsDirectory, "anim.gif"], anim, "GIF"]
    

    animated gif

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used a stacked bar chart (with coord_flip) to try to compare distributions
For example, I try to do something like this: - (BOOL)compare:(NSDecimal)leftOperand greaterThan:(NSDecimal)rightOperand { BOOL
I have this method called MatchNodes: IEnumerable<bool> MatchNodes<T>(T n1, T n2) Which basically gets
I try to compare Mnesia with more traditional databases. As I understand it tables
i try to compare two lists with each other: ListA (a1,a2,a3,...) ListB (b1,b2,b3,...) I
I try to get some website attribute (colour of the cell) and compare in
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
Try this piece of code - public class WhitespaceTest { public static void main(String[]
HI.I searched this question inform and I found solution to change column property Unique
I'm experimenting a bit with textual comparison/basic plagiarism detection, and want to try this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.