⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mathematicsoftsunamis-source.nb

📁 simulate Tsunamis using mathematica
💻 NB
📖 第 1 页 / 共 4 页
字号:
(* Content-type: application/mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 6.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       145,          7]
NotebookDataLength[     52738,       1266]
NotebookOptionsPosition[     51592,       1223]
NotebookOutlinePosition[     52204,       1247]
CellTagsIndexPosition[     52161,       1244]
WindowFrame->Normal
ContainsDynamic->True *)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell["Mathematics of Tsunamis", "Section",
 CellFrameColor->RGBColor[
  0.6449835965514611, 0.758632791638056, 0.2516823071641108],
 FontColor->RGBColor[
  0.6449835965514611, 0.758632791638056, 0.2516823071641108]],

Cell[BoxData[
 RowBox[{"Manipulate", "[", 
  RowBox[{
   RowBox[{"If", "[", 
    RowBox[{
     RowBox[{"plottype", "\[Equal]", "\"\<3D\>\""}], ",", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"Show", "[", 
      RowBox[{
       RowBox[{"ListPlot3D", "[", 
        RowBox[{
         RowBox[{"Table", "[", 
          RowBox[{
           RowBox[{"sol", "[", 
            RowBox[{"\[Lambda]", ",", "\[Phi]", ",", "tt"}], "]"}], ",", 
           RowBox[{"{", 
            RowBox[{"\[Lambda]", ",", 
             SubscriptBox["\[Lambda]", "min"], ",", 
             SubscriptBox["\[Lambda]", "max"], ",", 
             FractionBox[
              RowBox[{
               SubscriptBox["\[Lambda]", "max"], "-", 
               SubscriptBox["\[Lambda]", "min"]}], "nxy"]}], "}"}], ",", 
           RowBox[{"{", 
            RowBox[{"\[Phi]", ",", 
             SubscriptBox["\[Phi]", "min"], ",", 
             SubscriptBox["\[Phi]", "max"], ",", 
             FractionBox[
              RowBox[{
               SubscriptBox["\[Phi]", "max"], "-", 
               SubscriptBox["\[Phi]", "min"]}], "nxy"]}], "}"}]}], "]"}], ",",
          
         RowBox[{"DataRange", "\[Rule]", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"{", 
             RowBox[{
              SubscriptBox["\[Phi]", "min"], ",", 
              SubscriptBox["\[Phi]", "max"]}], "}"}], ",", 
            RowBox[{"{", 
             RowBox[{
              SubscriptBox["\[Lambda]", "min"], ",", 
              SubscriptBox["\[Lambda]", "max"]}], "}"}]}], "}"}]}], ",", 
         RowBox[{"PlotRange", "\[Rule]", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"-", "4"}], ",", "1.2"}], "}"}]}], ",", 
         RowBox[{"PlotStyle", "\[Rule]", 
          RowBox[{"Directive", "[", 
           RowBox[{
            RowBox[{"RGBColor", "[", 
             RowBox[{".8", ",", ".8", ",", "1"}], "]"}], ",", 
            RowBox[{"Specularity", "[", 
             RowBox[{"White", ",", "20"}], "]"}]}], "]"}]}], ",", 
         RowBox[{"MaxPlotPoints", "\[Rule]", "\[Infinity]"}], ",", 
         RowBox[{"InterpolationOrder", "\[Rule]", "io"}], ",", 
         RowBox[{"Mesh", "\[Rule]", "None"}], ",", 
         RowBox[{"PerformanceGoal", "\[Rule]", "\"\<Speed\>\""}]}], "]"}], 
       ",", 
       RowBox[{"If", "[", 
        RowBox[{"sb", ",", "seabed", ",", 
         RowBox[{"{", "}"}]}], "]"}], ",", 
       RowBox[{"Lighting", "\[Rule]", "Automatic"}], ",", 
       RowBox[{"BoxRatios", "\[Rule]", 
        RowBox[{"{", 
         RowBox[{
          RowBox[{
           SubscriptBox["\[Phi]", "max"], "-", 
           SubscriptBox["\[Phi]", "min"]}], ",", 
          RowBox[{
           SubscriptBox["\[Lambda]", "max"], "-", 
           SubscriptBox["\[Lambda]", "min"]}], ",", 
          FractionBox["1", "4"]}], "}"}]}], ",", 
       RowBox[{"ImageSize", "\[Rule]", 
        RowBox[{"{", 
         RowBox[{"450", ",", "325"}], "}"}]}], ",", 
       RowBox[{"Ticks", "\[Rule]", 
        RowBox[{"{", 
         RowBox[{"None", ",", "None", ",", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"{", 
             RowBox[{
              RowBox[{"-", "4"}], ",", "4000"}], "}"}], ",", 
            RowBox[{"{", 
             RowBox[{
              RowBox[{"-", "3"}], ",", "3000"}], "}"}], ",", 
            RowBox[{"{", 
             RowBox[{
              RowBox[{"-", "2"}], ",", "2000"}], "}"}], ",", 
            RowBox[{"{", 
             RowBox[{
              RowBox[{"-", "1"}], ",", "1000"}], "}"}], ",", 
            RowBox[{"{", 
             RowBox[{"0", ",", "0"}], "}"}]}], "}"}]}], "}"}]}]}], "]"}], ",",
      "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"Show", "[", 
      RowBox[{
       RowBox[{"ListDensityPlot", "[", 
        RowBox[{
         RowBox[{"Table", "[", 
          RowBox[{
           RowBox[{"sol", "[", 
            RowBox[{"\[Lambda]", ",", "\[Phi]", ",", "tt"}], "]"}], ",", 
           RowBox[{"{", 
            RowBox[{"\[Lambda]", ",", 
             SubscriptBox["\[Lambda]", "min"], ",", 
             SubscriptBox["\[Lambda]", "max"], ",", 
             FractionBox[
              RowBox[{
               SubscriptBox["\[Lambda]", "max"], "-", 
               SubscriptBox["\[Lambda]", "min"]}], "nxy"]}], "}"}], ",", 
           RowBox[{"{", 
            RowBox[{"\[Phi]", ",", 
             SubscriptBox["\[Phi]", "min"], ",", 
             SubscriptBox["\[Phi]", "max"], ",", 
             FractionBox[
              RowBox[{
               SubscriptBox["\[Phi]", "max"], "-", 
               SubscriptBox["\[Phi]", "min"]}], "nxy"]}], "}"}]}], "]"}], ",",
          
         RowBox[{"DataRange", "\[Rule]", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"{", 
             RowBox[{
              SubscriptBox["\[Phi]", "min"], ",", 
              SubscriptBox["\[Phi]", "max"]}], "}"}], ",", 
            RowBox[{"{", 
             RowBox[{
              SubscriptBox["\[Lambda]", "min"], ",", 
              SubscriptBox["\[Lambda]", "max"]}], "}"}]}], "}"}]}], ",", 
         RowBox[{"ColorFunction", "\[Rule]", 
          RowBox[{"(", 
           RowBox[{
            RowBox[{
             RowBox[{"ColorData", "[", "\"\<TemperatureMap\>\"", "]"}], "[", 
             RowBox[{".8", " ", 
              RowBox[{"(", 
               RowBox[{"#1", "+", ".5"}], ")"}]}], "]"}], "&"}], ")"}]}], ",",
          
         RowBox[{"ColorFunctionScaling", "\[Rule]", "False"}], ",", 
         RowBox[{"PlotRange", "\[Rule]", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"-", "1"}], ",", "1.2"}], "}"}]}], ",", 
         RowBox[{"MaxPlotPoints", "\[Rule]", "\[Infinity]"}], ",", 
         RowBox[{"InterpolationOrder", "\[Rule]", "io"}], ",", 
         RowBox[{"Mesh", "\[Rule]", "None"}]}], "]"}], ",", 
       RowBox[{"If", "[", 
        RowBox[{"sb", ",", "seabedcontour", ",", 
         RowBox[{"{", "}"}]}], "]"}], ",", 
       RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", 
       RowBox[{"ImageSize", "\[Rule]", 
        RowBox[{"{", 
         RowBox[{"450", ",", "325"}], "}"}]}], ",", 
       RowBox[{"FrameTicks", "\[Rule]", "None"}]}], "]"}]}], "]"}], ",", 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{"tt", ",", "0", ",", "\"\<time\>\""}], "}"}], ",", "0", ",", 
     RowBox[{"2", " ", "3600"}], ",", "360"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{"plottype", ",", "\"\<3D\>\"", ",", "\"\<plot type\>\""}], 
      "}"}], ",", 
     RowBox[{"{", 
      RowBox[{"\"\<3D\>\"", ",", "\"\<density\>\""}], "}"}], ",", 
     RowBox[{"ControlType", "\[Rule]", "RadioButton"}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{"io", ",", "None", ",", "\"\<interpolation\>\""}], "}"}], ",", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"None", "\[Rule]", "\"\<none\>\""}], ",", 
       RowBox[{"2", "\[Rule]", "\"\<order 2\>\""}]}], "}"}], ",", 
     RowBox[{"ControlType", "\[Rule]", "RadioButton"}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{"sb", ",", "True", ",", "\"\<show seabed\>\""}], "}"}], ",", 
     RowBox[{"{", 
      RowBox[{"True", ",", "False"}], "}"}]}], "}"}], ",", 
   RowBox[{"AutorunSequencing", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{"1", ",", "2"}], "}"}]}], ",", 
   RowBox[{"SynchronousInitialization", "\[Rule]", "False"}], ",", 
   "\[IndentingNewLine]", 
   RowBox[{"Initialization", "\[RuleDelayed]", 
    RowBox[{"(", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"ldist", "[", 
         RowBox[{"p1_", ",", "p2_"}], "]"}], "[", 
        RowBox[{"p_", "?", 
         RowBox[{"(", 
          RowBox[{
           RowBox[{"VectorQ", "[", 
            RowBox[{"#1", ",", "NumberQ"}], "]"}], "&"}], ")"}]}], "]"}], ":=",
        
       RowBox[{"If", "[", 
        RowBox[{
         RowBox[{"p1", "\[Equal]", "p2"}], ",", 
         RowBox[{"Norm", "[", 
          RowBox[{"p", "-", "p1"}], "]"}], ",", 
         RowBox[{"Module", "[", 
          RowBox[{
           RowBox[{"{", 
            RowBox[{"pp1", ",", "pp2", ",", "p12"}], "}"}], ",", 
           RowBox[{
            RowBox[{"pp1", "=", 
             RowBox[{"p", "-", "p1"}]}], ";", 
            RowBox[{"pp2", "=", 
             RowBox[{"p", "-", "p2"}]}], ";", 
            RowBox[{"p12", "=", 
             FractionBox[
              RowBox[{"p1", "-", "p2"}], 
              RowBox[{"Norm", "[", 
               RowBox[{"p1", "-", "p2"}], "]"}]]}], ";", 
            RowBox[{"If", "[", 
             RowBox[{
              RowBox[{
               RowBox[{"Sign", "[", 
                RowBox[{"p12", ".", "pp1"}], "]"}], "\[NotEqual]", 
               RowBox[{"Sign", "[", 
                RowBox[{"p12", ".", "pp2"}], "]"}]}], ",", 
              RowBox[{"Norm", "[", 
               RowBox[{"pp1", "-", 
                RowBox[{
                 RowBox[{"pp1", ".", "p12"}], " ", "p12"}]}], "]"}], ",", 
              RowBox[{"Min", "[", 
               RowBox[{
                RowBox[{"Norm", "[", "pp1", "]"}], ",", 
                RowBox[{"Norm", "[", "pp2", "]"}]}], "]"}]}], "]"}]}]}], 
          "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{
        RowBox[{"seamount", "[", 
         RowBox[{"s_", ",", "w_", ",", 
          RowBox[{"{", 
           RowBox[{"\[Lambda]_", ",", "\[Phi]_"}], "}"}]}], "]"}], "[", 
        RowBox[{"l_", ",", "p_"}], "]"}], ":=", 
       RowBox[{"s", " ", 
        SuperscriptBox["\[ExponentialE]", 
         RowBox[{
          RowBox[{"-", "w"}], " ", 
          RowBox[{"(", 
           RowBox[{
            SuperscriptBox[
             RowBox[{"(", 
              RowBox[{"l", "-", "\[Lambda]"}], ")"}], "2"], "+", 
            SuperscriptBox[
             RowBox[{"(", 
              RowBox[{"p", "-", "\[Phi]"}], ")"}], "2"]}], ")"}]}]]}]}], ";", 
      "\[IndentingNewLine]", 
      RowBox[{
       SubscriptBox["\[Lambda]", "min"], "=", 
       RowBox[{
        RowBox[{"-", "15"}], " ", "\[Degree]"}]}], ";", 
      RowBox[{
       SubscriptBox["\[Lambda]", "max"], "=", 
       RowBox[{"15", " ", "\[Degree]"}]}], ";", 
      RowBox[{
       SubscriptBox["\[Lambda]", "e"], "=", "0"}], ";", 
      RowBox[{
       SubscriptBox["\[Lambda]", "i"], "=", 
       RowBox[{"2.5", " ", "\[Degree]"}]}], ";", 
      RowBox[{
       SubscriptBox["\[Phi]", "min"], "=", 
       RowBox[{
        RowBox[{"-", "35"}], " ", "\[Degree]"}]}], ";", 
      RowBox[{
       SubscriptBox["\[Phi]", "max"], "=", 
       RowBox[{"5", " ", "\[Degree]"}]}], ";", 
      RowBox[{
       SubscriptBox["\[Phi]", "1"], "=", 
       RowBox[{
        RowBox[{"-", "10"}], " ", "\[Degree]"}]}], ";", 
      RowBox[{
       SubscriptBox["\[Phi]", "2"], "=", 
       RowBox[{
        RowBox[{"-", "20"}], " ", "\[Degree]"}]}], ";", 
      RowBox[{
       SubscriptBox["\[Phi]", "i"], "=", 
       RowBox[{
        RowBox[{"-", "25"}], " ", "\[Degree]"}]}], ";", 
      RowBox[{"T", "=", 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -