forked from BoGGoG/CriticalPointsq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
findTreeQNMs.wls
executable file
·71 lines (50 loc) · 2.53 KB
/
findTreeQNMs.wls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env wolframscript
(* ::Package:: *)
If[$ScriptCommandLine==={},SetDirectory@NotebookDirectory[],SetDirectory@DirectoryName@ExpandFileName@First[$ScriptCommandLine];];
Get[FileNameJoin[{Directory[],"source","PseudoSpectralUtils.wl"}]]
Get[FileNameJoin[{Directory[],"source","QNMEigenSolver.wl"}]]
Get[FileNameJoin[{Directory[],"source","BulkSolverUtils.wl"}]]
Get[FileNameJoin[{Directory[],"eoms","schwarzschild-black-brane-eoms.wls"}]]
Get[FileNameJoin[{Directory[],"source","RootFindingSolvers.wl"}]]
argv = Rest @ $ScriptCommandLine;
argc = Length @ argv;
Check[eom = ToExpression[argv[[1]]],
Print["Could name read out a symbol for the eom. Quitting..."]; Quit[]]
eomName=ToString[argv[[1]]];
If[Head[eom]==Symbol,Print["There is no eom with the name: "<>eomName<>". Quitting..."]; Quit[]];
eom=eom/.{k->Sqrt[ksqr]};(*Using k^2 as the variable instead of k.*)
wp=4*MachinePrecision;
seedGridOrderLower=40;
seedGridOrderHigher=42;
trunkBranchGridOrder=80;
tol=10^(-5)
maxRootModes=4;
kabsMax=3;
trunkAbsKsqr=Subdivide[0,kabsMax,kabsMax*5];
trunkArgKsqr=Subdivide[0,4\[Pi],200];
Options[findQNMTree]=Options[findQNMsParamSeedK];
findQNMTree[rootModes_,rootFunc_,kAbsList_,kArgList_,secantRootFunc_,opts:OptionsPattern[]]:=
Module[{trunkModes,argFunc,trunkModeK,foundModes},
foundModes=Table[
trunkModes = findQNMsParamSeedK[rootMode,rootFunc,Identity,{Rest@kAbsList},secantRootFunc,opts];
Table[
Check[
trunkModeK=First[trunkMode];
argFunc=Function[th,Evaluate[trunkModeK]*Exp[I th]];
findQNMsParamSeedK[trunkMode,rootFunc,argFunc,{Rest@kArgList},secantRootFunc,opts]//EchoFunction[ToString[eomName]<>": found modes",N@*(Take[#,UpTo[3]]&)]
,Nothing]
,{trunkMode,trunkModes}]
,{rootMode,rootModes}];
foundModes=N[foundModes,OptionValue[WorkingPrecision]];
foundModes
]
seedModeAlphaBeta = funcTable[alphabetamat,
{{eom/.{ksqr->0}},gp,{F},u,w, gridps, derivativemat, WorkingPrecision->wp},
{gp,seedGridOrderLower,seedGridOrderHigher}
];
seedModes = (Take[#, UpTo[maxRootModes]] &)@DeleteDuplicatesBy[Round[#, 1/10] &]@SortBy[Abs@*Last]@Map[{0,#}&]@modespseudo[seedModeAlphaBeta];
Print["Found the seed modes of "<> eomName];
rootFunc=eomToRootFunction[{eom}, trunkBranchGridOrder,{F},u,w,ksqr,gridps, derivativemat,WorkingPrecision->wp];
treeModes=findQNMTree[seedModes,rootFunc,trunkAbsKsqr,trunkArgKsqr,secantRootFind,WorkingPrecision->wp, Tolerance->tol];
Put[treeModes,FileNameJoin[{Directory[],"data",eomName<>"-tree-modes"}]];
Print["Exported out "<>ToString[FileNameJoin[{Directory[],"data",eomName<>"-tree-modes"}]]];