From 9852a7b30458179e46e6006415f4aef4f6b63549 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Tue, 10 Sep 2024 18:03:34 -0400 Subject: [PATCH 001/149] add colsepin= --- man/man1/tabcols.1 | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/man/man1/tabcols.1 b/man/man1/tabcols.1 index 07c6946d0..f27cfca0f 100644 --- a/man/man1/tabcols.1 +++ b/man/man1/tabcols.1 @@ -1,4 +1,4 @@ -.TH TABCOLS 1NEMO "20 November 2022" +.TH TABCOLS 1NEMO "10 September 2024" .SH "NAME" tabcols \- Select columns, and optionally rearrange, from a table @@ -7,13 +7,13 @@ tabcols \- Select columns, and optionally rearrange, from a table \fPtabcols\fP [parameter=value] ... .SH "DESCRIPTION" -\fBtabcols\fP selects columns from a file, and can also re-arrange the +\fBtabcols\fP selects columns from a file, and can thus also re-arrange the output column order. New column separators can be used on output. This way a newline on input can be converted into a space on output and therefore creating a file with one long column from -a table with mulitple columns. +a table with multiple columns. .PP -To select specific lines, use \fItabrows(1NEMO)\fP or \fItabmath(1NEMO)\fP. +To select specific rows/lines, use \fItabrows(1NEMO)\fP or \fItabmath(1NEMO)\fP. .PP To align a table by column, use the \fIcolumn(1)\fP program with the \fB-t\fP option. @@ -22,13 +22,16 @@ option. .so man1/parameters .TP 20 \fBin=\fP -input file name(s). No default. +input file name(s). +.br +No default. .TP \fBselect=\fP list of columns to select. Any \fInemoinp(1NEMO)\fP expression can be used. Columns can be repeated, and in any order. The output will be in exactly the same order as given with this keyword. First column is 1. Column 0 can also be added to the output, which is the row number (first row is 1). +.br [all] .TP \fBcolsep=\fP @@ -36,14 +39,24 @@ Column separator. Valid are: \fBs\fP (space), \fBn\fP (newline), \fBt\fP (tab), \fBr\fP (carriage return), as well as the literal symbols '\fB,\fP' and '\fB:\fP'. +.br [Default: \fBs\fP] + +.TP +\fBcolsepin=\fP +Column separator for input. By default an internal set (space, comma, tab, vertical bar) +is used. A string can be specified here consistent of multiple characters. + + .TP \fBout=-\fP output file name. By default standard output it used. +.br +[-] .SH "CAVEATS" Although this program uses the new table interface, there are -still some internal variables that limits the column count. +still some internal variables that limit the column count. .SH "EXAMPLE" Here is an example of how to reverse the columns from a table with 4 columns: @@ -55,9 +68,13 @@ re-arranges all the numbers in a table in one long column .nf tabcols in.tab all n > out.tab .fi +or in one long row: +.nf + tabcols in.tab all n | tabtranspose - - > out.tab +.fi .SH "SEE ALSO" -tabrows(1NEMO), tabmath(1NEMO), tabs(1NEMO), tabtab(1NEMO), awk(1), column(1) +tabrows(1NEMO), tabtranspos(1NEMO), tabmath(1NEMO), tabs(1NEMO), tabtab(1NEMO), awk(1), column(1) .SH "FILES" src/kernel/tab/tabcols.c source code @@ -71,4 +88,5 @@ Peter Teuben 26-Jan-00 V1.0 Created PJT 9-apr-09 V2.0 out=- now default and last argument PJT 5-may-2022 V2.1 converted to table V2 interface PJT +10-sep-2024 V2.4 added colsepin= PJT .fi From 8a2cbf4fcd565d7a55403ba135fd64716ef0b812 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Tue, 10 Sep 2024 20:00:11 -0400 Subject: [PATCH 002/149] add colsepin= --- src/kernel/tab/tabcols.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/kernel/tab/tabcols.c b/src/kernel/tab/tabcols.c index 0fdc95934..d8a2179dd 100644 --- a/src/kernel/tab/tabcols.c +++ b/src/kernel/tab/tabcols.c @@ -13,9 +13,10 @@ string defv[] = { /* DEFAULT INPUT PARAMETERS */ "in=???\n input file name(s)", "select=all\n columns to select", - "colsep=SP\n Column separator (SP,TAB,NL)", + "colsep=SP\n Column separator for output (SP,TAB,NL)", + "colsepin=\n Optional enforced character to separate columns in input", "out=-\n output file name", - "VERSION=2.3\n 30-mar-2024 PJT", + "VERSION=2.5\n 10-sep-2024 PJT", NULL }; @@ -35,7 +36,8 @@ int ninput; /* number of input files */ int keep[MAX_COL+1]; /* column numbers to keep */ int nkeep; /* actual number of skip columns */ int maxcol = 0; /* largest column number */ -char colsep; /* character to separate columns */ +string colsepin; /* character(s) to separate columns on input */ +char colsep; /* character to separate columns on output */ bool Qall; local void setparams(void); @@ -104,6 +106,10 @@ local void setparams(void) case '/': colsep = separator[0]; break; default: error("Illegal separator: s t n r : ,"); } + dprintf(1,"colsep:'%c'\n", colsep); + + colsepin = getparam("colsepin"); + dprintf(1,"colsepin:'%s'\n", colsepin); } @@ -112,8 +118,13 @@ local void convert(stream instr, stream outstr) char *line; int i, nlines, noutv; string *outv; /* pointer to vector of strings to write */ - char *seps=", |\t"; /* column separators */ - + char *seps; + + if (strlen(colsepin) == 0) + seps = strdup(", |\t"); + else + seps = strdup(colsepin); + nlines=0; /* count lines read so far */ for (;;) { From 69b529be8e89bd0fcfc290b3c3b91195cb8668ea Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Wed, 2 Oct 2024 22:44:02 -0400 Subject: [PATCH 003/149] try aplpy --- src/scripts/python/fitsplot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scripts/python/fitsplot.py b/src/scripts/python/fitsplot.py index c2e45b72c..d471e4e66 100755 --- a/src/scripts/python/fitsplot.py +++ b/src/scripts/python/fitsplot.py @@ -4,11 +4,16 @@ import os import sys -import aplpy import argparse import numpy as np import matplotlib.pyplot as plt from astropy.io import fits +try: + import aplpy +except: + print("sorry, aplpy not working") + sys.exit(1) + help_main = ["Simple color plot of a FITS image", From da9cd41dc053513beca25075bb5264163a2284bc Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 01:28:52 -0400 Subject: [PATCH 004/149] add IDL example --- man/man1/nemoinp.1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/man/man1/nemoinp.1 b/man/man1/nemoinp.1 index 1de9fd8c9..2d9245f20 100644 --- a/man/man1/nemoinp.1 +++ b/man/man1/nemoinp.1 @@ -25,6 +25,8 @@ nemoinp 1:10:2 matlab 1:2:10 seq 1 2 10 numpy.arange 1,10,2 last element (10) is never used +IDL findgen(5)*2+1 + .fi .SH "PARAMETERS" From c6422404f9757a4f86c15c27c2575c1f877701ad Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 11:00:20 -0400 Subject: [PATCH 005/149] try a new compiler inside of NEMO --- src/scripts/mknemo.d/gcc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 src/scripts/mknemo.d/gcc diff --git a/src/scripts/mknemo.d/gcc b/src/scripts/mknemo.d/gcc new file mode 100755 index 000000000..c4259dfad --- /dev/null +++ b/src/scripts/mknemo.d/gcc @@ -0,0 +1,33 @@ +#! /usr/bin/bash +# +# sudo apt install build-essential +# sudo apt install libmpfr-dev libgmp3-dev libmpc-dev -y + +# --enable-checking=release (esp. useful for compile-time tests +# as it disables some consistency checks in the compile), +# --disable-bootstrap (builds faster, but disables some consistency checks). + +v=14.1.0 +a=x86_64-linux-gnu +l=c,c++,fortran +l=c + +tgz=gcc-${v}.tar.gz +if [ ! -e $tgz ]; then + wget http://ftp.gnu.org/gnu/gcc/gcc-${v}/$tgz +fi + +tar -xf $tgz +cd gcc-${v} +./configure -v \ + --build=${a} \ + --host=${a} \ + --target=${a} \ + --prefix=$NEMO/opt/gcc-${v} \ + --enable-checking=release \ + --enable-languages=$l \ + --disable-multilib \ + --program-suffix=-${v} +make +make install + From 58aa53061fc531df2d5ad250c96742137360e4b2 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 11:24:42 -0400 Subject: [PATCH 006/149] note error --- src/scripts/mknemo.d/astromatic | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/scripts/mknemo.d/astromatic b/src/scripts/mknemo.d/astromatic index d8b6c8857..dcfdce89b 100755 --- a/src/scripts/mknemo.d/astromatic +++ b/src/scripts/mknemo.d/astromatic @@ -6,7 +6,10 @@ # Packages covered here: skymaker swarp # Todo: sextractor needs ATLAS or --enable-openblas # --disable-model-fitting bypasses them -# ubuntu pacakes: fftw, libopenblas-dev +# ubuntu packages: fftw, libopenblas-dev +# +# failing with the method here: stiff, stuff, eye, psfex +# # version=git url=https://github.com/astromatic From 5b0c3d8730b0c85e86b2e582c3fdaa258bd830d3 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 12:16:04 -0400 Subject: [PATCH 007/149] add j= --- src/scripts/mknemo.d/gcc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/scripts/mknemo.d/gcc b/src/scripts/mknemo.d/gcc index c4259dfad..0ca1a5f00 100755 --- a/src/scripts/mknemo.d/gcc +++ b/src/scripts/mknemo.d/gcc @@ -6,12 +6,21 @@ # --enable-checking=release (esp. useful for compile-time tests # as it disables some consistency checks in the compile), # --disable-bootstrap (builds faster, but disables some consistency checks). +# +# ~2h dart76 just l=c and j=1 -v=14.1.0 -a=x86_64-linux-gnu -l=c,c++,fortran +v=14.1.0 # version +a=x86_64-linux-gnu # architecture +j=4 # number of processors for makea +l=c,c++,fortran # languages to compile l=c +for arg in $*; do + export $arg +done + +cd $NEMO/local + tgz=gcc-${v}.tar.gz if [ ! -e $tgz ]; then wget http://ftp.gnu.org/gnu/gcc/gcc-${v}/$tgz @@ -28,6 +37,6 @@ cd gcc-${v} --enable-languages=$l \ --disable-multilib \ --program-suffix=-${v} -make +make -j $j make install From 8c7ea9aef67cf6d2d47064d6a5eee49157f4174a Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 13:46:57 -0400 Subject: [PATCH 008/149] refactor bench5 computation using nemo tools added a sleep=0 to see if laptops can cooldown fast enough (didn't see that happen) --- src/scripts/nemo.bench | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/scripts/nemo.bench b/src/scripts/nemo.bench index c6521ee61..ea08ff6f7 100755 --- a/src/scripts/nemo.bench +++ b/src/scripts/nemo.bench @@ -21,6 +21,7 @@ ften=1 f5=1 np=1 + sleep=0 for arg in $*; do\ export $arg @@ -29,7 +30,7 @@ done mkdir $tmp cd $tmp -echo "NEMOBENCH: (2022-09-14) $tmp : nbody0=$nbody0 nbody1=$nbody1 nbody3=$nbody3 size=$size ften=$ften clean=$clean bsf=$bsf tmp=$tmp" +echo "NEMOBENCH: (2024-10-18) $tmp : nbody0=$nbody0 nbody1=$nbody1 nbody3=$nbody3 size=$size ften=$ften clean=$clean bsf=$bsf tmp=$tmp" echo `hostname` echo `uname -a` echo `date` @@ -90,21 +91,26 @@ if [ $mode == 5 ]; then echo "Tstop: $t1 $t2 $t3 $t4 $t5 $t6 [5sec CPU for each on a 11th Gen Intel(R) Core(TM) i5-1135G7 up to 4.2GHz using gcc-11]" echo -n .; echo -n 1;$time directcode nbody=$nbody0 out=. tstop=$t1 seed=123 $help > bench2.directcode.log 2>&1 + sleep $sleep echo -n .;$time mkplummer p0 $nbody2 seed=123 $help > bench0.mkplummer.log 2>&1 echo -n 2;$time gyrfalcON p0 . kmax=6 tstop=$t2 eps=0.05 $help > bench2.gyrfalcon.log 2>&1 + sleep $sleep echo -n 3;$time hackcode1 nbody=$nbody1 out=. seed=123 tstop=$t3 $help > bench2.hackcode1.log 2>&1 + sleep $sleep echo -n .;$time mkorbit o0 x=1 e=1 lz=1 potname=log $help > bench0.mkorbit.log 2>&1 echo -n 4;$time orbint o0 . tstop=$t4 dt=0.01 nsave=\$tstop ndiag=\$tstop/100 $help > bench2.orbint.log 2>&1 + sleep $sleep echo -n 5;$time potcode p0 . freqout=10 freq=1000 tstop=$t5 potname=plummer $help > bench2.potcode.log 2>&1 + sleep $sleep echo -n 6;$time treecode1 nbody=$nbody1 out=. seed=123 tstop=$t6 $help > bench2.treecode1.log 2>&1 echo -n .; echo "" cat bench2.*.log | perl -pe 's/(CPU_USAGE)/\n$1/' | grep CPU_USAGE > cpu_usage.log column -t cpu_usage.log - cpu_mean=$(awk '{print $4}' cpu_usage.log | tabstat - | grep mean: | awk '{print $2}') - score=$(nemoinp 5000/$cpu_mean) - ntest=$(cat cpu_usage.log | wc -l) + _out=($(tabstat cpu_usage.log 4 bad=0 | txtpar - 5000/%1,%2 p0=mean,1,2 p1=npt,1,2)) + score=${_out[0]} + ntest=${_out[1]} echo "NEMOBENCH5 score: $score" echo "$score $ntest $(hostname) $(date)" >> $NEMO/nemobench5.log @@ -113,7 +119,7 @@ if [ $mode == 5 ]; then cd .. rm -rf $tmp else - echo + echo "More detailed results in $tmp" fi exit 0 From a85dc7de8f480d9d2721268b8ed5d776ce812799 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 13:53:53 -0400 Subject: [PATCH 009/149] add a result --- src/tutor/mp/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tutor/mp/Makefile b/src/tutor/mp/Makefile index 1c6864096..14ce94f3d 100644 --- a/src/tutor/mp/Makefile +++ b/src/tutor/mp/Makefile @@ -81,3 +81,4 @@ bench9: scaling2 @echo Long integration, see laptop performance drop, see core swaps $(TIME) ./scaling2 iter=500 > bench9.log 2>&1 grep cputime bench9.log | sed s/###// | tabplot - 6 8 line=1,1 ycoord=0 ymin=0 + @echo "Jansky 0.077 k2 0.090 0.098" From b814c1bdd74b39681d7176b6947dbe99b4d27cb4 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 13:55:10 -0400 Subject: [PATCH 010/149] format --- src/nbody/init/mkplummer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/nbody/init/mkplummer.c b/src/nbody/init/mkplummer.c index 1487e9de9..6bc773668 100644 --- a/src/nbody/init/mkplummer.c +++ b/src/nbody/init/mkplummer.c @@ -66,7 +66,7 @@ string defv[] = { /* DEFAULT INPUT PARAMETERS */ "headline=\n Verbiage for output", "nmodel=1\n number of models to produce", "mode=1\n 0=no data, 1=data, no analysis 2=data, analysis", - "VERSION=3.0b\n 2-sep-2021 PJT", + "VERSION=3.0c\n 6-jun-2024 PJT", NULL, }; @@ -74,7 +74,7 @@ string usage="construct a Plummer model"; /*--------------------------------------------------------------------------- * main -- a tool to make a Plummer model, by invoking mkplummer() - * note: only for 3 dimensions and Carthesian coordinates + * note: only for 3 dimensions and Cartesian coordinates *--------------------------------------------------------------------------- */ void nemo_main(void) @@ -136,8 +136,9 @@ void nemo_main(void) init_xrandom(sseed); } btab[i] = mkplummer(nbody, mlow, mfrac, rfrac, seed, snap_time, zerocm, scale, - quiet,mrange,mfunc); + quiet,mrange,mfunc); } + if (mode > 0) { bits = (MassBit | PhaseSpaceBit | TimeBit); sprintf(hisline,"init_xrandom: seed used %d",seed); From f5b4ff46fc72f7501549997a62019943a58885c9 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 13:56:11 -0400 Subject: [PATCH 011/149] fix rotcurves --- src/orbit/potential/Testfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/orbit/potential/Testfile b/src/orbit/potential/Testfile index 77fe22bbe..158d515f6 100644 --- a/src/orbit/potential/Testfile +++ b/src/orbit/potential/Testfile @@ -25,10 +25,13 @@ potlist: # New style accelleration $(EXEC) potlist Plummer 0,1,1 -rotcurves: +rotcurves_old: $(EXEC) rotcurves isochrone 0,1,1 - halo 0,1,1 - plummer 0,0.15,0.05 \ radii=0:4:0.02 ; nemo.coverage rotcurves.c +rotcurves: + $(EXEC) rotcurves plummer '0,1,3*pi/16' xrange=0,2 yrange=0,1; nemo.coverage rotcurves.c + plummer.ccd: $(EXEC) potccd out=plummer.ccd potname=plummer x=-2:2:0.05 y=-2:2:0.05 ; nemo.coverage potccd.c From b058c6a94d8b276973790048708260d475271dd3 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 13:58:19 -0400 Subject: [PATCH 012/149] more debugging --- src/image/misc/ccdbench.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/image/misc/ccdbench.c b/src/image/misc/ccdbench.c index f9fcd53b1..1637a5841 100644 --- a/src/image/misc/ccdbench.c +++ b/src/image/misc/ccdbench.c @@ -12,13 +12,15 @@ #include #include #include +#include string defv[] = { "in=???\n Input image file", "order=xyz\n Order to loop over cube, where the last axis is innermost loop", "iter=1\n How often to loop", "mode=0\n 0=CubeValue(i,j,k) 1=cube[i][k][k]", - "VERSION=0.2\n 19-mar-2024 PJT", + "test=f\n Show memory addresses for a small 2x3 array", + "VERSION=0.3\n 13-apr-2024 PJT", NULL, }; @@ -27,6 +29,8 @@ string usage = "benchmark taking moments along an axis of an image"; #define LOOP(i,n) for(i=0;i Date: Fri, 18 Oct 2024 13:59:19 -0400 Subject: [PATCH 013/149] add comment= (more code to come) --- src/kernel/io/nemovar.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/kernel/io/nemovar.c b/src/kernel/io/nemovar.c index 134eec114..6a2a4986c 100644 --- a/src/kernel/io/nemovar.c +++ b/src/kernel/io/nemovar.c @@ -11,7 +11,8 @@ string defv[] = { "var=\n Name of variable(s)", "val=\n Optional new value", - "VERSION=0.4\n 25-jun-2024 PJT", + "comment=\n Optional comment when new value was set", + "VERSION=0.5\n 26-jun-2024 PJT", NULL, }; @@ -25,6 +26,8 @@ void nemo_main() bool hasVar = hasvalue("var"); string value = getparam("val"); bool hasVal = hasvalue("val"); + string comment = getparam("comment"); + bool hasComment = hasvalue("comment"); string nemovar = getenv("NEMOVAR"); if (nemovar == NULL) error("$NEMOVAR was not set"); dprintf(1,"nemovar: %s\n", nemovar); From f664a07817abfecace02492b5e8e26faa7464ca8 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 14:00:04 -0400 Subject: [PATCH 014/149] add max of map --- src/image/misc/ccdcross.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/image/misc/ccdcross.c b/src/image/misc/ccdcross.c index a875f7267..b35123d5e 100644 --- a/src/image/misc/ccdcross.c +++ b/src/image/misc/ccdcross.c @@ -23,7 +23,7 @@ string defv[] = { "n=3\n Half size of box inside correlation box to find center", "clip=\n Only use values above this clip level", "bad=0\n bad value to ignore", - "VERSION=0.2\n 4-aug-2023 PJT", + "VERSION=0.3\n 18-apr-2024 PJT", NULL, }; @@ -191,7 +191,7 @@ local void do_cross(int l0, int l, int n) real xcen = ix0-box+sumx; real ycen = iy0-box+sumy; dprintf(0,"Center at: %g %g\n",xcen,ycen); - printf("%g %g %g %g %d %d\n",xcen,ycen,sumx,sumy, ix0,iy0); + printf("%g %g %g %g %d %d %g\n",xcen,ycen,sumx,sumy, ix0,iy0, MapMax(optr)); if (badvalues) warning("There were %d bad operations in dofie",badvalues); From 471350cd26bf9aa7c42c3446d3eaf6b9b55e3f92 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 14:07:07 -0400 Subject: [PATCH 015/149] report center --- src/image/misc/ccdellint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/image/misc/ccdellint.c b/src/image/misc/ccdellint.c index 01e396de5..dff008266 100644 --- a/src/image/misc/ccdellint.c +++ b/src/image/misc/ccdellint.c @@ -24,7 +24,7 @@ string defv[] = { "norm=f\n Normalize RV image to number of pixels in ring", "out=\n RV image", "tab=\n Optional output table", - "rscale=1\n Scale applied ot radii", + "rscale=1\n Scale applied to radii", "iscale=1\n Scale applied to intensities", "metric=2\n radius metric : 2 = circle (2) or boxy (>>2) or pointy (<<1)", "VERSION=0.6\n 6-dec-2022 PJT", @@ -168,6 +168,7 @@ void nemo_main(void) xpos = (Nx(velptr)-1.0)/2.0; ypos = (Ny(velptr)-1.0)/2.0; } + dprintf(0,"Center pixel: %g %g\n",xpos,ypos); pa = getdparam("pa"); inc = getdparam("inc"); vsys = getdparam("vsys"); From 05f3f3c13f5008505b7e61c5e85eec3f3ca4214a Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 14:07:50 -0400 Subject: [PATCH 016/149] add output --- src/image/misc/ccdcross.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/image/misc/ccdcross.c b/src/image/misc/ccdcross.c index a875f7267..df42d7b35 100644 --- a/src/image/misc/ccdcross.c +++ b/src/image/misc/ccdcross.c @@ -23,7 +23,7 @@ string defv[] = { "n=3\n Half size of box inside correlation box to find center", "clip=\n Only use values above this clip level", "bad=0\n bad value to ignore", - "VERSION=0.2\n 4-aug-2023 PJT", + "VERSION=0.3\n 27-mar-2024 PJT", NULL, }; @@ -72,8 +72,8 @@ void nemo_main() instr = stropen(fnames[0],"r"); /* open file */ iptr[0] = NULL; /* make sure to init it right */ read_image (instr, &iptr[0]); - dprintf(0,"Image %d: pixel size %g %g minmax %g %g\n", - 0, Dx(iptr[0]),Dy(iptr[0]),MapMin(iptr[0]),MapMax(iptr[0])); + dprintf(0,"Image %d: pixel size %g %g minmax %g %g [%s]\n", + 0, Dx(iptr[0]),Dy(iptr[0]),MapMin(iptr[0]),MapMax(iptr[0]),fnames[0]); strclose(instr); if (hasvalue("center")) { @@ -101,8 +101,8 @@ void nemo_main() instr = stropen(fnames[ll],"r"); /* open file */ iptr[ll] = NULL; /* make sure to init it right */ read_image (instr, &iptr[ll]); - dprintf(0,"Image %d: pixel size %g %g minmax %g %g\n", - ll, Dx(iptr[ll]),Dy(iptr[ll]),MapMin(iptr[ll]),MapMax(iptr[ll])); + dprintf(0,"Image %d: pixel size %g %g minmax %g %g [%s]\n", + ll, Dx(iptr[ll]),Dy(iptr[ll]),MapMin(iptr[ll]),MapMax(iptr[ll]),fnames[ll]); strclose(instr); /* close input file */ do_cross(0,ll,n); } @@ -191,6 +191,8 @@ local void do_cross(int l0, int l, int n) real xcen = ix0-box+sumx; real ycen = iy0-box+sumy; dprintf(0,"Center at: %g %g\n",xcen,ycen); + // @todo (ix0-xcen-box, iy0-ycen-box) is a value expected to be around (0,0) for no offsets + // printf("%g %g %g %g %d %d\n",xcen,ycen,sumx,sumy, ix0,iy0); if (badvalues) From aa63ced40c54a954c6b8ee5baecd34d7d1853507 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 18 Oct 2024 14:25:49 -0400 Subject: [PATCH 017/149] add references to the latest of previous versions --- src/scripts/mknemo.d/gcc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/scripts/mknemo.d/gcc b/src/scripts/mknemo.d/gcc index 0ca1a5f00..5ab06d5e0 100755 --- a/src/scripts/mknemo.d/gcc +++ b/src/scripts/mknemo.d/gcc @@ -9,7 +9,11 @@ # # ~2h dart76 just l=c and j=1 -v=14.1.0 # version +V=10.5.0 # July 2023 +v=11.5.0 +v=12.4.0 +v=13.3.0 +v=14.2.0 # version (mid 2024) a=x86_64-linux-gnu # architecture j=4 # number of processors for makea l=c,c++,fortran # languages to compile From c8f4b52f29b221321ef59600a6d0f54b8582ff28 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 08:41:11 -0400 Subject: [PATCH 018/149] testing snapcmp --- src/nbody/reduc/Testfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/nbody/reduc/Testfile b/src/nbody/reduc/Testfile index 619d99f95..1cf5526e1 100644 --- a/src/nbody/reduc/Testfile +++ b/src/nbody/reduc/Testfile @@ -21,6 +21,11 @@ snap.in: $(EXEC) mkplummer snap.in $(NBODY) seed=123 @bsf snap.in '0.0140845 0.896875 -4.6523 4.80925 71' +snap2.in: + @echo Creating $@ + $(EXEC) mkplummer snap2.in $(NBODY) seed=1234 + @bsf snap2.in '0.0140845 0.536539 -1.63453 1.89357 71' + cube.in: snap.in @echo Creating $@ $(EXEC) snaprotate snap.in - 30,45,20 zyz | $(EXEC) snapgrid - cube.in nx=32 ny=32 nz=32 zrange=-2:2 @@ -55,6 +60,11 @@ snapmradii: hack2.out @echo Running $@ $(EXEC) snapmradii hack2.out | tabplot - 1 2:9 line=1,1 ; nemo.coverage snapmradii.c +snapcmp: snap.in snap2.in + @echo Running $@ + $(EXEC) snapcmp snap.in snap2.in ; nemo.coverage snapcmp.c + @echo "0 0.548814 0.824836 1.96007 2.14353 5.33402 2.21031 1.5212 expected" + radprof: snap.in @echo Running $@ $(EXEC) radprof snap.in tab=t > /dev/null ; nemo.coverage radprof.c From 14299e907380bce483f9e7612499446c37b6335c Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 08:49:25 -0400 Subject: [PATCH 019/149] fix clean --- src/nbody/reduc/Testfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nbody/reduc/Testfile b/src/nbody/reduc/Testfile index 1cf5526e1..30731177e 100644 --- a/src/nbody/reduc/Testfile +++ b/src/nbody/reduc/Testfile @@ -14,7 +14,7 @@ clean: NBODY = 10 -all: snap.in hack.out $(BIN) +all: snap.in snap2.in hack.out $(BIN) snap.in: @echo Creating $@ From b78e78a150d071ffc12c88ab732432a3ab10919a Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 08:51:54 -0400 Subject: [PATCH 020/149] fix clean --- src/nbody/reduc/Testfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nbody/reduc/Testfile b/src/nbody/reduc/Testfile index 30731177e..ac6dbe6dd 100644 --- a/src/nbody/reduc/Testfile +++ b/src/nbody/reduc/Testfile @@ -10,11 +10,11 @@ need: clean: @echo Cleaning $(DIR) - @rm -f snap.in cube.in hack.out hack2.out + @rm -f snap.in snap2.in cube.in hack.out hack2.out NBODY = 10 -all: snap.in snap2.in hack.out $(BIN) +all: snap.in hack.out $(BIN) snap.in: @echo Creating $@ From 68b72edb8c257e21fea4e2231c6ff4b17257db0e Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 16:10:31 -0400 Subject: [PATCH 021/149] fix function pointers issue#151 --- src/nbody/reduc/snapcmp.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/nbody/reduc/snapcmp.c b/src/nbody/reduc/snapcmp.c index ac576e8d3..98758a021 100644 --- a/src/nbody/reduc/snapcmp.c +++ b/src/nbody/reduc/snapcmp.c @@ -55,7 +55,7 @@ string defv[] = { /* DEFAULT INPUT PARAMETERS */ "headline=\n header", #endif "time0=t\n Also print time=0 ?", - "VERSION=1.7a\n 20-jan-2024 PJT", + "VERSION=1.7b\n 20-oct-2024 PJT", NULL, }; @@ -81,7 +81,7 @@ local bool Qlog, Qtime0; local real *snapcmp(Body*, Body*, int, real); -local int cmpreal(real*, real*); +local int cmpreal(const void*, const void*); local void printquart(real*, int, real); extern rproc btrtrans(string); @@ -217,17 +217,16 @@ local void printquart(real result[], int nbody, real tsnap) } -/* should have prototype :: int (*compar)(const void *, const void *)) */ - -local int cmpreal(real *ap, real *bp) +local int cmpreal(const void *ap, const void *bp) { - return (*ap < *bp ? -1 : *ap > *bp ? 1 : 0); + real *a = (real *) ap; + real *b = (real *) bp; + return (*a < *b ? -1 : *a > *b ? 1 : 0); } - #endif #if HISTOGRAM From d72aadfa76c6c51a0ec571fc8a13c7b4f965c98f Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 16:30:44 -0400 Subject: [PATCH 022/149] add snapmradii --- src/nbody/reduc/Testfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nbody/reduc/Testfile b/src/nbody/reduc/Testfile index ac6dbe6dd..f4c652bcb 100644 --- a/src/nbody/reduc/Testfile +++ b/src/nbody/reduc/Testfile @@ -59,6 +59,9 @@ snapdiagplot: hack.out snapmradii: hack2.out @echo Running $@ $(EXEC) snapmradii hack2.out | tabplot - 1 2:9 line=1,1 ; nemo.coverage snapmradii.c + $(EXEC) snapmradii snap.in + @echo '0 0.276882 0.43351 0.5547 0.715477 0.789928 0.790888 1.05668 1.35295 4.76802' + snapcmp: snap.in snap2.in @echo Running $@ From 7c6b8a231094fcecc68d373b6f9e06d10545af02 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 16:36:29 -0400 Subject: [PATCH 023/149] fix function pointer issue #151 for gcc-14 --- src/nbody/reduc/snapmradii.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nbody/reduc/snapmradii.c b/src/nbody/reduc/snapmradii.c index 470214c42..b261a8e5c 100644 --- a/src/nbody/reduc/snapmradii.c +++ b/src/nbody/reduc/snapmradii.c @@ -32,19 +32,17 @@ string defv[] = { "tab=f\n Full table of r,m(r) ? ", "log=f\n Print radii in log10() ? ", "sort=r\n Observerble to sort masses by", - "VERSION=1.6\n 1-apr-2021 PJT", + "VERSION=1.6a\n 20-oct-2024 PJT", NULL, }; string usage="Langrangian mass-fraction radii of a snapshot"; -string cvsid="$Id$"; - #define MFRACT 256 local void snapsort(Body *, int , real, rproc_body); -local int rank_aux(Body *, Body *); +local int rank_aux(const void *, const void *); void nemo_main() @@ -126,8 +124,10 @@ void snapsort(Body *btab, int nbody, real tsnap, rproc_body sortptr) qsort(btab, nbody, sizeof(Body), rank_aux); } -int rank_aux(Body *a, Body *b) +int rank_aux(const void *ap, const void *bp) { + Body *a = (Body *) ap; + Body *b = (Body *) bp; return (Aux(a) < Aux(b) ? -1 : Aux(a) > Aux(b) ? 1 : 0); } From 9eb0979f25122217d49ae5475bb8133083d3f44d Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 21:07:31 -0400 Subject: [PATCH 024/149] fix function pointer gcc-14 issue#151 --- src/nbody/image/snapgrid.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nbody/image/snapgrid.c b/src/nbody/image/snapgrid.c index 25bbb59bf..2bff053fc 100644 --- a/src/nbody/image/snapgrid.c +++ b/src/nbody/image/snapgrid.c @@ -77,7 +77,7 @@ string defv[] = { /* keywords/default values/help */ "stack=f\n Stack all selected snapshots?", "integrate=f\n Sum or Integrate along 'dvar'?", "proj=\n Sky projection (SIN, TAN, ARC, NCP, GLS, CAR, MER, AIT)", - "VERSION=6.1a\n 9-feb-2024 PJT", + "VERSION=6.1b\n 20-oct-2024 PJT", NULL, }; @@ -461,8 +461,7 @@ typedef struct point { local Point **map =NULL; -local int pcomp(Point **a, Point **b); -//local int pcomp(void *, void *); +local int pcomp(const void *, const void *); void bin_data(int ivar) { @@ -724,9 +723,11 @@ void los_data(void) } -int pcomp(Point **a, Point **b) +int pcomp(const void *app, const void *bpp) { - return (*a)->depth > (*b)->depth; + Point *a = (Point *) app; + Point *b = (Point *) bpp; + return (a)->depth > (b)->depth; } void free_snap() From 15dbd3ad35b0a9536dfe75bf6433bb5e6aa60478 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 21:28:28 -0400 Subject: [PATCH 025/149] add snapmstat --- src/nbody/reduc/Testfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/nbody/reduc/Testfile b/src/nbody/reduc/Testfile index f4c652bcb..c0aa0ef0e 100644 --- a/src/nbody/reduc/Testfile +++ b/src/nbody/reduc/Testfile @@ -1,5 +1,5 @@ DIR = src/nbody/reduc -BIN = snapplot snapplot3 snapdiagplot snapplotv snapmradii radprof real snapfit snapprint +BIN = snapplot snapplot3 snapdiagplot snapplotv snapmradii snapmstat radprof real snapfit snapprint snapcmp NEED = $(BIN) hackcode1 mkplummer tabplot snapfour snapgrid snaprotate help: @@ -62,11 +62,15 @@ snapmradii: hack2.out $(EXEC) snapmradii snap.in @echo '0 0.276882 0.43351 0.5547 0.715477 0.789928 0.790888 1.05668 1.35295 4.76802' +snapmstat: snap.in + @echo Running $@ + $(EXEC) snapmstat snap.in ; nemo.coverage snapmradii.c + snapcmp: snap.in snap2.in @echo Running $@ $(EXEC) snapcmp snap.in snap2.in ; nemo.coverage snapcmp.c - @echo "0 0.548814 0.824836 1.96007 2.14353 5.33402 2.21031 1.5212 expected" +< @echo "0 0.548814 0.824836 1.96007 2.14353 5.33402 2.21031 1.5212 expected" radprof: snap.in @echo Running $@ From f7f00c518e923c6cb5885231e4d1605176a7b6d0 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 21:31:09 -0400 Subject: [PATCH 026/149] fix function point syntax issue#151 --- src/nbody/reduc/snapmstat.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/nbody/reduc/snapmstat.c b/src/nbody/reduc/snapmstat.c index 1df871379..99af7938c 100644 --- a/src/nbody/reduc/snapmstat.c +++ b/src/nbody/reduc/snapmstat.c @@ -28,7 +28,7 @@ string defv[] = { "sort=f\n Sort masses before processing?", "species=100\n Maximum number of species", "show=f\n Show only the select= for glnemo2", - "VERSION=2.1\n 28-nov-2023 PJT", + "VERSION=2.1a\n 20-oct-24 PJT", NULL, }; @@ -36,7 +36,7 @@ string usage="report some statistics of the masses in a snapshot"; local void snapsort(Body *, int); -local int rank_mass(Body *, Body *); +local int rank_mass(const void *, const void *); void nemo_main(void) { @@ -113,8 +113,11 @@ local void snapsort(Body *btab, int nbody) qsort(btab, nbody, sizeof(Body), rank_mass); } -local int rank_mass(Body *a, Body *b) +//local int rank_mass(Body *a, Body *b) +local int rank_mass(const void *ap, const void *bp) { + Body *a = (Body *) ap; + Body *b = (Body *) bp; return (Mass(a) < Mass(b) ? -1 : Mass(a) > Mass(b) ? 1 : 0); } From edf55e705784e4b2368657916f37384106021a72 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 21:48:28 -0400 Subject: [PATCH 027/149] prototype fixes for gcc-14; see also issue#151 on function pointer --- src/nbody/evolve/multicode/quadcode.c | 3 +-- src/nbody/evolve/multicode/quaddefs.h | 4 ++-- src/nbody/evolve/multicode/quadforce.c | 10 +++++++--- src/nbody/evolve/multicode/quadforce_main.c | 10 +++++----- src/nbody/evolve/multicode/quadinter.c | 10 +++++----- src/nbody/evolve/multicode/quadinter_main.c | 2 +- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/nbody/evolve/multicode/quadcode.c b/src/nbody/evolve/multicode/quadcode.c index bfc632a77..26a5651d7 100644 --- a/src/nbody/evolve/multicode/quadcode.c +++ b/src/nbody/evolve/multicode/quadcode.c @@ -24,13 +24,12 @@ string defv[] = { /* DEFAULT INPUT PARAMETERS */ "minor_freqout=32.0\n minor data-output frequency", "options=\n misc options", "headline=\n random mumble for humans", - "VERSION=1.4\n 6-jan-2022 PJT", + "VERSION=1.4a\n 20-oct-2024 PJT", NULL, }; string usage = "Global quadrupole N-body integrator"; -string cvsid="$Id$"; local void force(Body *, int , real); diff --git a/src/nbody/evolve/multicode/quaddefs.h b/src/nbody/evolve/multicode/quaddefs.h index aa31b8a42..5cd62195a 100644 --- a/src/nbody/evolve/multicode/quaddefs.h +++ b/src/nbody/evolve/multicode/quaddefs.h @@ -67,7 +67,7 @@ extern void pcstep(body *btab, int nb, real *tptr, force_proc force, real dt); extern void moveaccel(body *btab, int nb); /* quadforce.c */ -extern int quadforce(body *btab, int nb, real eps1, real eps2); +extern void quadforce(body *btab, int nb, real eps1, real eps2); /* quadinter.c */ -extern int quadinter(Body *btab, int nb, real eps1, real eps2); +extern void quadinter(Body *btab, int nb, real eps1, real eps2); diff --git a/src/nbody/evolve/multicode/quadforce.c b/src/nbody/evolve/multicode/quadforce.c index f092060a9..e9fc76277 100644 --- a/src/nbody/evolve/multicode/quadforce.c +++ b/src/nbody/evolve/multicode/quadforce.c @@ -6,6 +6,7 @@ * 16-mar-90 PJT made GCC happy * 20-may-94 pjt remove allocate() decl. into headers * 25-dec-02 pjt better ANSI C + * 20-oct-24 pjt gcc-14 function pointer syntax fix */ #include "quaddefs.h" @@ -20,13 +21,13 @@ typedef struct { local void init_quad_field(shadow *, int, real); local void int_quad_force(shadow *, int); local void ext_quad_force(shadow *, int); -local int rankrad(shadowptr, shadowptr); +local int rankrad(const void *, const void *); /* * QUADFORCE: compute the force-field of a spheroidal distribution. */ -quadforce(Body *btab, int nb, real eps1, real eps2) +void quadforce(Body *btab, int nb, real eps1, real eps2) { shadowptr shad; Body *b; @@ -52,8 +53,11 @@ quadforce(Body *btab, int nb, real eps1, real eps2) * RANKRAD: ranking function for quicksort. */ -local int rankrad(shadowptr sp1, shadowptr sp2) +//local int rankrad(shadowptr sp1, shadowptr sp2) +local int rankrad(const void *p1, const void *p2) { + shadowptr sp1 = (shadowptr) p1; + shadowptr sp2 = (shadowptr) p2; return (sp1->rad0 < sp2->rad0 ? -1 : 1); /* compare body radii */ } diff --git a/src/nbody/evolve/multicode/quadforce_main.c b/src/nbody/evolve/multicode/quadforce_main.c index e451ba9c5..c88c01b27 100644 --- a/src/nbody/evolve/multicode/quadforce_main.c +++ b/src/nbody/evolve/multicode/quadforce_main.c @@ -22,13 +22,15 @@ string defv[] = { "quad=\n output file with field tables", "eps_r=0.05\n radial softening parameter", "eps_t=0.07\n tangential softening parameter", - "VERSION=1.4\n 6-jan-2022 PJT", + "VERSION=1.4a\n 20-oct-2024 PJT", NULL, }; string usage="quadrupole-order force calculation of an N-body system."; -nemo_main() +void put_quadfield(stream quadstr, real tsnap, real eps1, real eps2); + +void nemo_main() { stream instr, outstr, quadstr; Body *btab = NULL, *bp; @@ -64,9 +66,7 @@ nemo_main() } } -put_quadfield(quadstr, tsnap, eps1, eps2) -stream quadstr; -real tsnap, eps1, eps2; +void put_quadfield(stream quadstr, real tsnap, real eps1, real eps2) { put_set(quadstr, "QuadField"); put_data(quadstr, "Time", RealType, &tsnap, 0); diff --git a/src/nbody/evolve/multicode/quadinter.c b/src/nbody/evolve/multicode/quadinter.c index 7213f86f1..f578bbdc1 100644 --- a/src/nbody/evolve/multicode/quadinter.c +++ b/src/nbody/evolve/multicode/quadinter.c @@ -9,14 +9,14 @@ #include "quaddefs.h" -local inter_field(real r); -local force_eval(Body *b, real eps1, real eps2); +local void inter_field(real r); +local void force_eval(Body *b, real eps1, real eps2); /* * QUADINTER: interpolate field and evaluate force on array of particles. */ -quadinter(Body *btab, int nb, real eps1, real eps2) +void quadinter(Body *btab, int nb, real eps1, real eps2) { Body *b; @@ -59,7 +59,7 @@ local matrix Q22, P22; * INTER_FIELD: interpolate field tables to given radius. */ -local inter_field(real r) +local void inter_field(real r) { int i, j, k; real f; @@ -94,7 +94,7 @@ local inter_field(real r) * FORCE_EVAL: compute force and potential on particle. */ -local force_eval(Body *b, real eps1, real eps2) +local void force_eval(Body *b, real eps1, real eps2) { real rsq, r1i, r2i, r2is, r2iq, q11r, rq22r, tmp; vector q22r, p22r, tmpv; diff --git a/src/nbody/evolve/multicode/quadinter_main.c b/src/nbody/evolve/multicode/quadinter_main.c index b39a446b3..8caa7e5c6 100644 --- a/src/nbody/evolve/multicode/quadinter_main.c +++ b/src/nbody/evolve/multicode/quadinter_main.c @@ -20,7 +20,7 @@ string defv[] = { "quad=???\n input file with field tables", "in=???\n input file with N-body snapshot", "out=\n output file with forces and potentials", - "VERSION=1.4\n 12-nov-91 PJT", + "VERSION=1.4a\n 20-oct-2024 PJT", NULL, }; From 653276216fbdefec4803e413e2439d808ed5ae0b Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 21:54:17 -0400 Subject: [PATCH 028/149] format --- man/man1/quadcode.1 | 39 +++++++++++++++++++++++++-------------- man/man1/quadforce.1 | 34 +++++++++++++++++++++------------- man/man1/quadinter.1 | 31 +++++++++++++++++++------------ 3 files changed, 65 insertions(+), 39 deletions(-) diff --git a/man/man1/quadcode.1 b/man/man1/quadcode.1 index c4cbb9669..0b1f3bef9 100644 --- a/man/man1/quadcode.1 +++ b/man/man1/quadcode.1 @@ -1,9 +1,12 @@ -.TH QUADCODE 1NEMO "6 May 1992" -.SH NAME +.TH QUADCODE 1NEMO "20 Oct 2024" + +.SH "NAME" quadcode \- global quadrupole-order N-body code integrator -.SH SYNOPSIS + +.SH "SYNOPSIS" \fBquadcode\fP \fBin=\fP\fIsnapshot\fP [\fIparameter\fP=\fIvalue\fP] .\|.\|. -.SH DESCRIPTION + +.SH "DESCRIPTION" \fIquadcode\fP is an equal-timestep implementation of an N-body code where the forces and potential are computed from a potential expansion in spherical harmonics @@ -12,8 +15,9 @@ it multipole expansion). See also a followup in Bontekoe & van Albada (MNRAS 224, 349 (1987)) and a rebuttal in Zaritsky & White (MNRAS 235, 289 (1988). See also Hernquist, L. & Barnes, J. \fIAp.J.\fP \fB349\fP, 562 (1990) -.SH PARAMETERS -The following parameters are recognized; they may be given in any order. + +.SH "PARAMETERS" +.so man1/parameters .TP 24 \fBin\fP=\fIin-file\fP Snapshot with initial conditions. No default. @@ -82,25 +86,32 @@ to be recompiled, for example: (Note that all \fIquad*\fP programs need to (should) be recompiled if the maximum allowed number of bodies will be changed. -.SH SEE ALSO -quadforce(1NEMO), quadinter(1NEMO), CSG(1NEMO), octcode(1NEMO) -.SH ADS + +.SH "SEE ALSO" +quadforce(1NEMO), quadinter(1NEMO), CSG(1NEMO), octcode(1NEMO) + +.SH "ADS" @ads 1983ApJ...274...53W closely derived code? or should we link White's 1978MNRAS.184..185W paper -.SH BUGS + +.SH "BUGS" When a \fBrestart\fP is specified, values must be given for \fBALL\fP legal parameters which do not take default values. -.SH AUTHOR + +.SH "AUTHOR" Joshua E. Barnes. -.SH FILES + +.SH "FILES" .nf .ta +2i src/nbody/evolve/multicode/ exported source code usr/josh/nbody/multicode/ Josh' original source code .fi -.SH HISTORY + +.SH "HISTORY" .nf -.ta +1i +4i +.ta +1.25i +4.5i 4-mar-89 V1.2 some formal NEMO version JEB 12-nov-91 V1.3 new NEMO V2. location in $NEMO/src tree PJT 6-may-92 document improved PJT +20-oct-2024 V1.4a gcc-14 prototype fixed PJT .fi diff --git a/man/man1/quadforce.1 b/man/man1/quadforce.1 index 425c2984b..2f87ae3e6 100644 --- a/man/man1/quadforce.1 +++ b/man/man1/quadforce.1 @@ -1,17 +1,20 @@ -.TH QUADFORCE 1NEMO "6 May 1992" -.SH NAME +.TH QUADFORCE 1NEMO "20 Oct 2024" + +.SH "NAME" quadforce \- quadrupole-order force calculation of an N-body system. -.SH SYNOPSIS + +.SH "SYNOPSIS" \fBquadforce\fP \fBin=\fPsnapshot [parameter=value] ... -.SH DESCRIPTION + +.SH "DESCRIPTION" \fIquadforce\fP computes a quadrupole-order force calculation of a snapshot N-body system. (see also \fIquadcode(1NEMO)\fP). The output can be either in the form of the snapshot, or a table, in which case quadrupole-oder forces can be inserted in other snapshots (see \fIquadinter(1NEMO)\fP). -.SH PARAMETERS -The following parameters are recognized in any order if the keyword -is also given: + +.SH "PARAMETERS" +.so man1/parameters .TP 20 \fBin=\fP\fIsnaphot\fP Input file with N-body snapshot. No default. @@ -28,18 +31,23 @@ Radial softening parameter. [Default: \fB0.05\fP] .TP 20 \fBeps_t=\fP Tangential softening parameter. [Default: \fB0.07\fP] -.SH LIMITATIONS + +.SH "LIMITATIONS" The code has a hardcoded maximum number of particles, through the macro \fBMBODY\fP. (currently 4096). If more are needed, it needs to be recompiled. See comments in \fIquadcode(1NEMO)\fP -.SH AUTHOR -Joshue Barnes -.SH SEE ALSO + +.SH "AUTHOR" +Joshua Barnes + +.SH "SEE ALSO" quadcode(1NEMO), quadinter(1NEMO) -.SH UPDATE HISTORY + +.SH "HISTORY" .nf -.ta +1.0i +4.0i +.ta +1.25i +4.5i 4-mar-89 V1.0 Old version JEB 12-nov-91 V1.1 FOr new nemo V2. PJT 6-may-92 V1.1a man page written, added some warnings PJT +20-oct-2024 V1.4a fix various prototypes for modern gcc PJT .fi diff --git a/man/man1/quadinter.1 b/man/man1/quadinter.1 index 67a9158d2..9d8027239 100644 --- a/man/man1/quadinter.1 +++ b/man/man1/quadinter.1 @@ -1,15 +1,18 @@ -.TH QUADINTER 1NEMO "6 May 1992" -.SH NAME +.TH QUADINTER 1NEMO "20 Oct 2024" + +.SH "NAME" quadinter \- quadrupole-order force calculation from tabulated field. -.SH SYNOPSIS + +.SH "SYNOPSIS" \fBquadinter\fP \fBquad=\fIquad_table\fP \fBin=\fIsnapshot\fP [parameter=value] ... -.SH DESCRIPTION + +.SH "DESCRIPTION" \fIquadinter\fP computes quadrupole-order forces and potentials for a set of particules supplies in an N-body snapshot from a quad-table that must have been prepared by \fIquadforce\fP. -.SH PARAMETERS -The following parameters are recognized in any order if the keyword -is also given: + +.SH "PARAMETERS" +.so man1/parameters .TP 20 \fBquad=\fP\fIquad_table\fP Input file with quadrupole-order field tables. No default. @@ -20,18 +23,22 @@ Input file with an N-body snapshot. No default. \fBout=\fP output file with added forces and potentials. This will be a copy of the input \fIsnapshot\fP. Default: none. -.SH LIMITATIONS + +.SH "LIMITATIONS" The code has a hardcoded maximum number of particles, through the macro \fBMBODY\fP. (currently 4096). If more are needed, it needs to be recompiled. See comments in \fIquadcode(1NEMO)\fP -.SH SEE ALSO + +.SH "SEE ALSO" quadcode(1NEMO), quadforce(1NEMO) -.SH AUTHOR + +.SH "AUTHOR" Joshua Barnes -.SH UPDATE HISTORY +.SH "HISTORY" .nf -.ta +1.0i +4.0i +.ta +1.25i +4.5i 4-mar-89 V1.0 Old version JEB 12-nov-91 V1.1 For new nemo V2. PJT 6-may-92 V1.1a man page written PJT +20-oct-2024 V1.4a gcc-14 prototype fixes PJT .fi From b200d1d490e810009543714bead90a99812d916d Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 22:22:14 -0400 Subject: [PATCH 029/149] ansi C fix --- src/nbody/trans/snapdens.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/nbody/trans/snapdens.c b/src/nbody/trans/snapdens.c index ca6f70db5..6498425dd 100644 --- a/src/nbody/trans/snapdens.c +++ b/src/nbody/trans/snapdens.c @@ -39,14 +39,12 @@ string defv[] = { "tfactor=-1.0\n conversion factor v->r [virial=sqrt(2)]", "nn=f\n add NN index to the Key field?", "ndim=3\n 3dim or 2dim densities?", - "VERSION=1.5c\n 5-apr-2006 PJT", + "VERSION=1.5d\n 20-oct-2024 PJT", NULL, }; string usage="density estimator using Kth-nearest neighbor"; -string cvsid="$Id$"; - #define FAC1 4.188790203 /* 4.pi/3 */ #define FAC2 15.74960994 /* (2.pi)^(3/2) */ @@ -73,7 +71,7 @@ local real raddif(Body *, Body *); local void stat_nn(Body *); -nemo_main() +void nemo_main() { stream instr, outstr; real tsnap, dm; From 5f6c34acbee67dc455156cea03f66bd31de15b16 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 22:23:50 -0400 Subject: [PATCH 030/149] ansi c gcc-14 --- src/nbody/trans/snapsplit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nbody/trans/snapsplit.c b/src/nbody/trans/snapsplit.c index 2594e30e7..86d66a363 100644 --- a/src/nbody/trans/snapsplit.c +++ b/src/nbody/trans/snapsplit.c @@ -25,7 +25,7 @@ string defv[] = { "nbody=\n Size of one (or more) snapshot(s)", "nsnap=\n Number of pieces to cut a snapshot into", "times=all\n Series of times-ranges to select", - "VERSION=2.1\n 13-jun-07 PJT/WD", + "VERSION=2.1a\n 20-oct-2024 PJT/WD", NULL, }; @@ -41,7 +41,7 @@ string usage="cut an N-body snapshot in pieces for serial processing"; extern bool within(real, string, real); */ -nemo_main() +void nemo_main() { stream instr, outstr; mstr *mp; From bff85197eef12b3a02d626b2f1524159c2533f2f Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 22:43:34 -0400 Subject: [PATCH 031/149] fix typo --- src/nbody/reduc/Testfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nbody/reduc/Testfile b/src/nbody/reduc/Testfile index c0aa0ef0e..c5d6d9dc9 100644 --- a/src/nbody/reduc/Testfile +++ b/src/nbody/reduc/Testfile @@ -70,7 +70,7 @@ snapmstat: snap.in snapcmp: snap.in snap2.in @echo Running $@ $(EXEC) snapcmp snap.in snap2.in ; nemo.coverage snapcmp.c -< @echo "0 0.548814 0.824836 1.96007 2.14353 5.33402 2.21031 1.5212 expected" + @echo "0 0.548814 0.824836 1.96007 2.14353 5.33402 2.21031 1.5212 expected" radprof: snap.in @echo Running $@ From 79d9ecb7353ee4ab703a6d9eae58bd250e4b7d1c Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 22:44:34 -0400 Subject: [PATCH 032/149] fix for gcc-14 prototypes --- src/nbody/init/mkflowdisk.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/nbody/init/mkflowdisk.c b/src/nbody/init/mkflowdisk.c index 77dc58468..3785070a3 100644 --- a/src/nbody/init/mkflowdisk.c +++ b/src/nbody/init/mkflowdisk.c @@ -46,7 +46,7 @@ string defv[] = { "test=f\n test shape of spiral (all particles at 0 phase offset)", "constant=f\n force vt constant in rotating frame ?", "headline=\n text headline for output ", - "VERSION=1.5\n 1-jan-04 PJT", + "VERSION=1.5a\n 20-oct-2024 PJT", NULL, }; @@ -71,6 +71,11 @@ local real theta[361], dens[361]; local proc potential; +void writegalaxy(stream outstr); +void setdensity(void); +double density(double t); +void testdisk(int n); + void nemo_main() { @@ -123,7 +128,7 @@ void nemo_main() * WRITEGALAXY: write galaxy model to output. */ -writegalaxy(stream outstr) +void writegalaxy(stream outstr) { real tsnap = 0.0; int bits = MassBit | PhaseSpaceBit | TimeBit; @@ -132,7 +137,7 @@ writegalaxy(stream outstr) put_snap(outstr, &disk, &ndisk, &tsnap, &bits); } -setdensity(void) +void setdensity(void) { int i, ndim=NDIM; double pos_d[NDIM], vel_d[NDIM], den_d, time_d = 0.0; @@ -197,10 +202,10 @@ double density(double t) * density test disk. */ -testdisk(int n) +void testdisk(int n) { Body *dp; - real rmin2, rmax2, r_i, theta_i, mass_i, rring; + real rmin2, rmax2, r_i, theta_i, mass_i; real cost, sint; int i, ndim=NDIM; double pos_d[NDIM], vel_d[NDIM], pot_d, time_d = 0.0; @@ -209,7 +214,6 @@ testdisk(int n) if (disk == NULL) disk = (Body *) allocate(ndisk * sizeof(Body)); rmin2 = rmin * rmin; rmax2 = rmax * rmax; - rring = 0.5*(rmin+rmax); mass_i = 1.0 / (real)ndisk; for (dp=disk, i = 0; i < ndisk; dp++, i++) { From 7c989dde87740da66ca68d6d3b0ebba2a0181744 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 23:20:28 -0400 Subject: [PATCH 033/149] fix some gcc-14 prototype strictness --- src/nbody/reduc/snapfit.c | 41 ++++++++++++++------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/src/nbody/reduc/snapfit.c b/src/nbody/reduc/snapfit.c index 8e168085b..19892235b 100644 --- a/src/nbody/reduc/snapfit.c +++ b/src/nbody/reduc/snapfit.c @@ -58,7 +58,7 @@ string defv[] = { "contour=\n Optional Output image file with chi-squared", "iter=0\n number of more iterations after best on matrix", "times=all\n Times selected from snapshot models", - "VERSION=0.7d\n 15-jul-04 PJT", + "VERSION=0.7e\n 20-oct-2024 PJT", NULL, }; @@ -102,8 +102,12 @@ void snap_fit(void); int write_snapshot(stream outstr, int nbody, body *btab, real t1, real t2, real rscale, real vscale); void yrotate(matrix mat, real theta); void zrotate(matrix mat, real theta); -int eigenframe(vector frame[], matrix mat); -int invert(vector frame[]); +void eigenframe(vector frame[], matrix mat); +void invert(vector frame[]); + +extern void eigsrt(); // (d,v,n) +extern void matinv(); // real *, int, int,real *); +extern void jacobi(); // (a,n,d,v,nrot) /* -------------------------------------------------------------------------- */ @@ -381,9 +385,7 @@ real start, incr; return a; } -void printvec(name, vec) -string name; -vector vec; +void printvec(string name, vector vec) { dprintf(my_debug,"%s %10.5f %10.5f %10.5f %10.5f\n", name, absv(vec), vec[0], vec[1], vec[2]); @@ -545,12 +547,8 @@ void snap_fit() rscale/w_rscale, vscale/w_vscale); } - -write_snapshot( outstr, nbody, btab, t1, t2, rscale, vscale) -stream outstr; -int nbody; -Body *btab; -real t1, t2, rscale,vscale; +//outstr, nbody, btab, t1, t2, rscale, vscale) +int write_snapshot(stream outstr, int nbody, Body *btab, real t1, real t2, real rscale, real vscale) { warning("output snapshot not supported yet"); } @@ -564,9 +562,7 @@ real t1, t2, rscale,vscale; * around the y-axis */ -void yrotate(mat,theta) -matrix mat; -real theta; +void yrotate(matrix mat,real theta) { SETMI(mat); /* unit matrix */ mat[2][2] = mat[0][0] = cos(DEG2RAD * theta); @@ -580,9 +576,7 @@ real theta; * around the y-axis */ -void zrotate(mat,theta) -matrix mat; -real theta; +void zrotate(matrix mat, real theta) { SETMI(mat); /* unit matrix */ mat[1][1] = mat[0][0] = cos(DEG2RAD * theta); @@ -595,9 +589,7 @@ real theta; #if 1 -eigenframe(frame, mat) /* float version */ -vector frame[]; -matrix mat; +void eigenframe(vector frame[], matrix mat) { float **q, *d, **v; int i, j, nrot; @@ -617,9 +609,7 @@ matrix mat; #else -eigenframe(frame, mat) /* double version */ -vector frame[]; -matrix mat; +void eigenframe(vector frame[], matrix mat) { double **q, *d, **v; int i, j, nrot; @@ -638,8 +628,7 @@ matrix mat; } #endif -invert(frame) -vector frame[]; +void invert(vector frame[]) { real mat[NDIM*NDIM], det; From da4bfd69b8625452d94ac7449d76061098631af0 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 23:33:50 -0400 Subject: [PATCH 034/149] write an rc file --- src/scripts/mknemo.d/gcc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/scripts/mknemo.d/gcc b/src/scripts/mknemo.d/gcc index 5ab06d5e0..9eb1e6e2f 100755 --- a/src/scripts/mknemo.d/gcc +++ b/src/scripts/mknemo.d/gcc @@ -22,7 +22,7 @@ l=c for arg in $*; do export $arg done - + cd $NEMO/local tgz=gcc-${v}.tar.gz @@ -44,3 +44,14 @@ cd gcc-${v} make -j $j make install + + +rc=$NEMO/opt/gcc-${v}/gcc_start.sh + +echo "_r=$NEMO/opt/gcc-${v}" > $rc +echo 'export PATH=$_r/bin:$PATH' >> $rc +echo 'export LD_LIBRARY_PATH=$_r/lib64:$LD_LIBRARY_PATH' >> $rc + +echo "Wrote $rc" + +echo gcc '"'$v'"' `date` >> $NEMO/opt/mknemo.log From be24dd544a8b131ac125711207f1bee1b38c935a Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 20 Oct 2024 23:50:43 -0400 Subject: [PATCH 035/149] gcc-14 notes --- docs/whatsnew.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/whatsnew.html b/docs/whatsnew.html index decf3c9ea..7eb23485e 100644 --- a/docs/whatsnew.html +++ b/docs/whatsnew.html @@ -24,6 +24,7 @@

What's New in NEMO

4.4.3/4.4.4: in git

    +
  • (Oct 20, 2024) more code-rot fixed for gcc-14
  • (Jun 21, 2024) enhanced tabsmooth with more filters
  • (Apr 20, 2024) experimental falcon program to process falcON style (HDF5) snapshots for falcON2. "mknemo falcon2" has From 0764c888e7ba7f427755e7c13a0bdc17203bcd4b Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Mon, 21 Oct 2024 08:24:30 -0400 Subject: [PATCH 036/149] fix l= --- src/scripts/mknemo.d/gcc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/mknemo.d/gcc b/src/scripts/mknemo.d/gcc index 5ab06d5e0..88a67ee72 100755 --- a/src/scripts/mknemo.d/gcc +++ b/src/scripts/mknemo.d/gcc @@ -17,7 +17,6 @@ v=14.2.0 # version (mid 2024) a=x86_64-linux-gnu # architecture j=4 # number of processors for makea l=c,c++,fortran # languages to compile -l=c for arg in $*; do export $arg @@ -41,6 +40,7 @@ cd gcc-${v} --enable-languages=$l \ --disable-multilib \ --program-suffix=-${v} +make clean make -j $j make install From 8eaf16723a5d2d0ccc8040a632fd014377ad5312 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Mon, 21 Oct 2024 08:27:32 -0400 Subject: [PATCH 037/149] normalize names --- src/scripts/mknemo.d/gcc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/scripts/mknemo.d/gcc b/src/scripts/mknemo.d/gcc index cd06e27f9..ad8eb6631 100755 --- a/src/scripts/mknemo.d/gcc +++ b/src/scripts/mknemo.d/gcc @@ -15,6 +15,7 @@ v=12.4.0 v=13.3.0 v=14.2.0 # version (mid 2024) a=x86_64-linux-gnu # architecture +b=86 # lib name j=4 # number of processors for makea l=c,c++,fortran # languages to compile @@ -24,6 +25,8 @@ done cd $NEMO/local +root=$NEMO/opt/gcc-${v} +lib=lib$b tgz=gcc-${v}.tar.gz if [ ! -e $tgz ]; then wget http://ftp.gnu.org/gnu/gcc/gcc-${v}/$tgz @@ -48,9 +51,9 @@ make install rc=$NEMO/opt/gcc-${v}/gcc_start.sh -echo "_r=$NEMO/opt/gcc-${v}" > $rc +echo "_r=$root" > $rc echo 'export PATH=$_r/bin:$PATH' >> $rc -echo 'export LD_LIBRARY_PATH=$_r/lib64:$LD_LIBRARY_PATH' >> $rc +echo 'export LD_LIBRARY_PATH=$_r/$lib:$LD_LIBRARY_PATH' >> $rc echo "Wrote $rc" From 4e566aabff9e3d9d9cab7795dffbb74c7e7b276a Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Mon, 21 Oct 2024 09:31:19 -0400 Subject: [PATCH 038/149] mac stores bash only in /bin/bash --- src/scripts/mknemo.d/gcc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/mknemo.d/gcc b/src/scripts/mknemo.d/gcc index 0ca1a5f00..d6f5f37fa 100755 --- a/src/scripts/mknemo.d/gcc +++ b/src/scripts/mknemo.d/gcc @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash # # sudo apt install build-essential # sudo apt install libmpfr-dev libgmp3-dev libmpc-dev -y From f5c081bca45954a7999a42006f2952a766606065 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Mon, 21 Oct 2024 09:58:24 -0400 Subject: [PATCH 039/149] extra debug print --- src/nbody/reduc/snapcmp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nbody/reduc/snapcmp.c b/src/nbody/reduc/snapcmp.c index ac576e8d3..662bbf923 100644 --- a/src/nbody/reduc/snapcmp.c +++ b/src/nbody/reduc/snapcmp.c @@ -136,6 +136,8 @@ void nemo_main() if (dt > small_dt) warning("times = %f, %f are different (%g)", tsnap1, tsnap2, dt); } + dprintf(0,"time1,2: %g %g %g %g nout %d\n",time1,time2,tsnap1,tsnap2,nout); + if (!Qtime0 && time1==0 && time2==0) continue; if (!Qtime0 && nout==0) continue; if (bits1 != bits2) @@ -151,7 +153,7 @@ void nemo_main() snapcmpplot(result, btab1, nbody1, tsnap1); #endif nout++; - } + } // for(;;) } local real *snapcmp(Body *btab1, Body *btab2, int nbody, real tsnap) From 5670f0650e1481703211c0acdeeaebe37a23f874 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Mon, 21 Oct 2024 11:55:36 -0400 Subject: [PATCH 040/149] silence compiler warning --- src/kernel/io/nemovar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/kernel/io/nemovar.c b/src/kernel/io/nemovar.c index 6a2a4986c..85ef2b7fd 100644 --- a/src/kernel/io/nemovar.c +++ b/src/kernel/io/nemovar.c @@ -32,6 +32,8 @@ void nemo_main() if (nemovar == NULL) error("$NEMOVAR was not set"); dprintf(1,"nemovar: %s\n", nemovar); + if (hasComment) + warning("comment %s not yet used", comment); // bug or feature, nemovar currently needs to exist if (!fexist(nemovar)) { From 731dba09acff47f632977885f34c405bb926e113 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Mon, 21 Oct 2024 19:48:03 -0400 Subject: [PATCH 041/149] fix FC->F77 for now --- docs/install_nemo.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/install_nemo.sh b/docs/install_nemo.sh index 071fe3178..a48a444ba 100755 --- a/docs/install_nemo.sh +++ b/docs/install_nemo.sh @@ -18,7 +18,7 @@ # opt=1 python=1 14'00" # -echo "install_nemo.sh: Version 1.9 -- 19-feb-2024" +echo "install_nemo.sh: Version 1.10 -- 20-oct-2024" opt=0 # install some optional mknemos= packages nemo=nemo # root directory where NEMO will be installed (. = here) @@ -141,7 +141,7 @@ fi # pick a configure -CC=gcc$v CXX=g++$v FC=gfortran$v ./configure $opt $with_yapp +CC=gcc$v CXX=g++$v F77=gfortran$v ./configure $opt $with_yapp #./configure $opt --enable-debug --with-yapp=pgplot --with-pgplot-prefix=/usr/lib # ok #./configure $opt --enable-debug --with-yapp=pgplot --with-pgplot-prefix=/usr/lib --enable-pedantic #./configure $opt --enable-debug --with-yapp=pgplot From 8e5ff94a0722ce55b6851997f5549e7e09773c73 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Wed, 23 Oct 2024 17:51:59 -0400 Subject: [PATCH 042/149] not tested --- src/scripts/mknemo.d/boost | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/scripts/mknemo.d/boost diff --git a/src/scripts/mknemo.d/boost b/src/scripts/mknemo.d/boost new file mode 100644 index 000000000..eb40f5cbf --- /dev/null +++ b/src/scripts/mknemo.d/boost @@ -0,0 +1,17 @@ +# +# How to Install the Boost Library in C++ on Ubuntu or any other Linux Distribution +# https://trendoceans.com/install-boost-library-for-c/ + +# sudo apt install libboost-all-dev + +wget=https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.bz2 + +# https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2 + +#h ttps://github.com/boostorg/boost/tags + + +tar xvf boost_1_81_0.tar.gz +./bootstrap.sh --prefix=/usr/ +./b2 +sudo ./b2 install From 55db4592303b51bd1c3eccce639e0238ecd1c063 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Wed, 23 Oct 2024 20:14:12 -0400 Subject: [PATCH 043/149] final --- src/scripts/mknemo.d/boost | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) mode change 100644 => 100755 src/scripts/mknemo.d/boost diff --git a/src/scripts/mknemo.d/boost b/src/scripts/mknemo.d/boost old mode 100644 new mode 100755 index eb40f5cbf..a58f87ea3 --- a/src/scripts/mknemo.d/boost +++ b/src/scripts/mknemo.d/boost @@ -1,17 +1,40 @@ +#! /usr/bin/env bash # # How to Install the Boost Library in C++ on Ubuntu or any other Linux Distribution # https://trendoceans.com/install-boost-library-for-c/ # sudo apt install libboost-all-dev -wget=https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.bz2 +# but if you MUST do it from source -# https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2 +v=1_81_0 # dec-2022 +v=1_86_0 # aug-2024 +w=https://boostorg.jfrog.io/artifactory/main/release/%s/source/boost_%s.tar.gz -#h ttps://github.com/boostorg/boost/tags +#https://github.com/boostorg/boost/tags + +cd $NEMO/local + + +vv=$(echo $v | sed s/_/./g) +url=$(printf $w $vv $v) +echo url=$url + +if [ ! -e $url ]; then + wget $url +fi + +tgz=$(basename $url) + + +tar xvf $tgz +cd boost_$v + +# --with-toolset +./bootstrap.sh --prefix=$NEMO/opt/ -tar xvf boost_1_81_0.tar.gz -./bootstrap.sh --prefix=/usr/ ./b2 -sudo ./b2 install +./b2 install + +echo boost $v `date` >> $NEMO/opt/mknemo.log From 80fb5c7239edfd63815eff99f34d8344b204c4f2 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Wed, 23 Oct 2024 20:15:43 -0400 Subject: [PATCH 044/149] cheaper alternative to anaconda3 --- src/scripts/install_miniconda3 | 107 +++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100755 src/scripts/install_miniconda3 diff --git a/src/scripts/install_miniconda3 b/src/scripts/install_miniconda3 new file mode 100755 index 000000000..7dcacc710 --- /dev/null +++ b/src/scripts/install_miniconda3 @@ -0,0 +1,107 @@ +#! /usr/bin/env bash +# +# Install a miniconda3 python . See also install_anaconda3 +# + +#--HELP +# default parameters + url=https://repo.anaconda.com/miniconda/Miniconda3-py%s-%s-%s.sh + url1=https://repo.anaconda.com/miniconda/Miniconda3-latest-%s-%s.sh + # various miniconda versions available: + version=latest # !! special. watch out for caching this file !! +version=37_23.1.0-1 # 3.7.16 +version=38_23.11.0-2 # 3.8.18 +version=39_24.7.1-0 # 3.9.19 +version=310_24.7.1-0 # 3.10.15 +version=311_24.7.1-0 # 3.11.9 +version=312_24.7.1-0 # 3.12.4 + + dir=$(pwd)/miniconda3 # where miniconda will be located + wget=wget # use wgetc is you have my cashing version (wget=curl is also allowed) + os=$(uname -s) # Handles Linux or Darwin, sorry no Windows + cpu=$(uname -m) # Handles Linux or Darwin, sorry no Windows + dry=0 # dry run? + quick=0 # quick install without extra modules + +#--HELP + +# some help? + if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then + set +x + awk 'BEGIN{s=0} {if ($1=="#--HELP") s=1-s; else if(s) print $0; }' $0 + exit 0 +fi + +# override parameters +for arg in "$@"; do + export "$arg" +done + +if [ "$os" = "Darwin" ]; then + os=MacOSX +fi + +if [ $version = "latest" ]; then + mc3=$(printf $url1 $os $cpu) +else + mc3=$(printf $url $version $os $cpu) # @todo to be implemented +fi +msh=$(basename $mc3) + +if [ $dry = 1 ]; then + echo $mc3 + exit 0 +fi + +if [ -d $dir ]; then + echo "$dir already exists" + echo "Remove this directory, or use a new dir=" + exit 1 +fi + +if [ ! -e $msh ]; then + if [ $wget = "curl" ]; then + # curl $mc3 -o $msh + curl -OL $mc3 + else + $wget $mc3 + fi +fi + +if [ ! -e $msh ]; then + echo "File $msh not found. Wrong version=$version ?" + exit 0 +fi + +echo "Using $msh" +bash $msh -b -p $dir + +export PATH="$dir/bin:$PATH" +conda update -y conda +pip3 install --upgrade pip + +# write sourceable shell startup recipes +echo "set path = ($dir/bin "'$path); rehash' > $dir/python_start.csh +echo "export PATH=${dir}/bin:"'$PATH' > $dir/python_start.sh + +if [ $quick = 1 ]; then + echo Done. +fi + +# ensure we have a bash kernel in jupyter notebooks +pip install bash_kernel +python -m bash_kernel.install + +pip freeze > $dir/freeze.log +echo "Created python_start files for $version in $dir ; no modifications were made to your HOME startup files!" +python --version +echo "typically you would need to " +echo " source $dir/python_start.sh" +echo "to add this python to your shell environment." + +# conda install -y ipython numpy scipy matplotlib notebook jupyter astropy + +# pip install astroquery +# conda -c astropy astroquery + +# pip install image_registration radio_beam reproject spectral_cube From 9dfafef4c36c9308cbd458111240a2e5494debdd Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Wed, 23 Oct 2024 20:16:28 -0400 Subject: [PATCH 045/149] fixed for 2024 --- src/scripts/install_anaconda3 | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/scripts/install_anaconda3 b/src/scripts/install_anaconda3 index 2e03c5b67..968388c6a 100755 --- a/src/scripts/install_anaconda3 +++ b/src/scripts/install_anaconda3 @@ -1,7 +1,11 @@ #! /usr/bin/env bash # # install anaconda3, plus a sourceable python_start.$SHELL script -# 18-mar-2024 NEMO/PJT +# +# See also https://repo.anaconda.com/archive for old versions +# +# 18-mar-2024 NEMO/PJT original +# 14-oct-2024 NEMO/PJT - older ones now fail on newer linux versions #--HELP # default parameters @@ -9,12 +13,12 @@ # anaconda3 versions available: version=2020.07 # 3.8.3 version=2020.11 # 3.8.5 -version=2021.04 # 3.8.8 -version=2021.11 # 3.9.8 but sphinx not working? -version=2022.05 # 3.9.12 sphinx +version=2021.04 # 3.8.8 failing on U22+ +version=2021.11 # 3.9.8 failing on U22+ - sphinx not working? +version=2022.05 # 3.9.12 sphinx? version=2022.10 # 3.9.13 sphinx version=2023.03-0 # 3.10.9 -version=2023.03-1 # 3.10.9 +version=2023.03-1 # 3.10.14 ok version=2023.07-2 # 3.11.4 version=2023.09-0 # 3.11.5 version=2024.02-1 # 3.11.7 @@ -57,6 +61,12 @@ if [ $dry = 1 ]; then exit 0 fi +if [ -d $dir ]; then + echo "$dir already exists" + echo "Remove this directory, or use a new dir=" + exit 1 +fi + if [ ! -e $msh ]; then if [ $wget = "curl" ]; then # curl $mc3 -o $msh @@ -71,6 +81,7 @@ if [ ! -e $msh ]; then exit 0 fi +echo "Using $msh" bash $msh -b -p $dir export PATH="$dir/bin:$PATH" @@ -90,4 +101,4 @@ echo "Created python_start files for $version in $dir ; no modifications were ma python --version echo "typically you would need to " echo " source $dir/python_start.sh" -echo "to add this python to your shell environment." +echo "to add this python to your shell environment. A csh version also exists" From b90c824c52f637be96c85e7eeccf58869894044b Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Wed, 23 Oct 2024 20:16:53 -0400 Subject: [PATCH 046/149] add "all" --- src/nbody/evolve/flowcode/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nbody/evolve/flowcode/Makefile b/src/nbody/evolve/flowcode/Makefile index 4cc8bff77..53496a526 100644 --- a/src/nbody/evolve/flowcode/Makefile +++ b/src/nbody/evolve/flowcode/Makefile @@ -72,6 +72,8 @@ clean: tar: tar cvf flowcode.tar $(TARFILES) +all: $(BINFILES) + # $(CC) $(CFLAGS) $(LOCAL_INC) -o $* $*.o $(NEMO_LIBS) $(LOCAL_LIB) $(FORLIBS) $(EL) flowcode: $(OBJFILES) From f50609e22eeaf2de85d4b73a66ee50ae15bb8358 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Wed, 23 Oct 2024 23:33:09 -0400 Subject: [PATCH 047/149] fix logic --- src/scripts/mknemo.d/boost | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/scripts/mknemo.d/boost b/src/scripts/mknemo.d/boost index a58f87ea3..e1ce1680e 100755 --- a/src/scripts/mknemo.d/boost +++ b/src/scripts/mknemo.d/boost @@ -5,7 +5,8 @@ # sudo apt install libboost-all-dev -# but if you MUST do it from source +# but if you MUST do it from source, here's the recipe +# on a fast machine this takes about 2 mins v=1_81_0 # dec-2022 v=1_86_0 # aug-2024 @@ -20,15 +21,17 @@ cd $NEMO/local vv=$(echo $v | sed s/_/./g) url=$(printf $w $vv $v) echo url=$url +tgz=$(basename $url) -if [ ! -e $url ]; then - wget $url +if [ ! -e $tgz ]; then + wget $url +else + echo "Reusing existing $tgz" fi -tgz=$(basename $url) -tar xvf $tgz +tar xf $tgz cd boost_$v # --with-toolset From 4002239ba28616561b89c6d1a2e337954c412161 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 22 Nov 2024 14:43:09 +0100 Subject: [PATCH 048/149] playing with PLEC mass model --- scripts/csh/edge_gbt.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/csh/edge_gbt.sh b/scripts/csh/edge_gbt.sh index 01be2012e..c3eacaba7 100755 --- a/scripts/csh/edge_gbt.sh +++ b/scripts/csh/edge_gbt.sh @@ -4,7 +4,7 @@ # # _script=edge_gbt.sh -_version=19-jun-2024 +_version=22-nov-2024 _pars=nemopars.rc _date=$(date +%Y-%m-%dT%H:%M:%S) @@ -20,6 +20,7 @@ m0=0.5 # brandt power (0=flat) #> SCA r1=0.1 # central unresolved bulge, bar or black hole v1=0 # representative rotation speed at r1 re=20 # exponential scalelength of disk (arcsec) #> SCALE 1:100:1 +n=-1 # n<1 exp disk; n>=0 PLEC disk #> SCALE -1:10:0.1 rmax=60 # edge of disk (arcsec) #> SCALE 1:80:1 inc=60 # INC of disk #> SCALE 0:90:1 z0=0 # scaleheight [@todo buggy] #> SCALE 0:10:0.5 @@ -78,11 +79,20 @@ rm -f $run.* >& /dev/null # keep a log echo "`date` :: $*" > $run.history + +mmode=$(nemoinp "ifge($n,0,1,0)") +if [ $mmode = 0 ]; then + mass="exp(-r/$re)" +else + mass="pow(r/$re*exp(1-r/$re),$n)" +fi +echo MMODE=$mmode MASS=$mass + if [ $m0 != 0 ]; then echo "Creating brandt disk with $nbody particles times" mkdisk out=- nbody=$nbody seed=$seed z0=$z0,$z0 \ potname=brandt potpars=0,$v0,$r0,$m0 mass=1 sign=-1 frac=$sigma abs=t rmax=$rmax |\ - snapmass - - "mass=exp(-r/$re)" norm=1 |\ + snapmass - - "mass=$mass" norm=1 |\ snaprotate - $run.20 "$inc,$pa" yz rotcurves name1=brandt pars1=0,$v0,$r0,$m0 tab=t radii=0:${rmax}:0.01 plot=f |\ tabmath - - "%1,1,%2,$sigma,exp(-%1/$re)" all > $run.tab @@ -92,7 +102,7 @@ elif [ $v1 = 0 ]; then echo "Creating homogeneous disk with $nbody particles times" mkdisk out=- nbody=$nbody seed=$seed z0=$z0,$z0 \ potname=rotcur0 potpars=0,$v0,$r0 mass=1 sign=-1 frac=$sigma abs=t rmax=$rmax |\ - snapmass - - "mass=exp(-r/$re)" |\ + snapmass - - "mass=$mass" |\ snapscale - - mscale=$nbody |\ snaprotate - $run.20 "$inc,$pa" yz rotcurves name1=rotcur0 pars1=0,$v0,$r0 tab=t radii=0:${rmax}:0.01 plot=f |\ @@ -104,7 +114,7 @@ else tabmath - - %1,1,%2,$sigma all > $run.tab mktabdisk $run.tab - nbody=$nbody seed=$seed rmax=$rmax sign=-1 |\ - snapmass - - "mass=exp(-r/$re)" |\ + snapmass - - "mass=$mass" |\ snapscale - - mscale=$nbody |\ snaprotate - $run.20 "$inc,$pa" yz fi From 2c51008a7919180519c14b7c0f9025a328b47cce Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 22 Nov 2024 14:54:27 +0100 Subject: [PATCH 049/149] add AMT model --- scripts/csh/edge_gbt.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/csh/edge_gbt.sh b/scripts/csh/edge_gbt.sh index c3eacaba7..0946c6b1e 100755 --- a/scripts/csh/edge_gbt.sh +++ b/scripts/csh/edge_gbt.sh @@ -21,6 +21,7 @@ r1=0.1 # central unresolved bulge, bar or black hole v1=0 # representative rotation speed at r1 re=20 # exponential scalelength of disk (arcsec) #> SCALE 1:100:1 n=-1 # n<1 exp disk; n>=0 PLEC disk #> SCALE -1:10:0.1 +rm=-1 # if > 0: use it has R_mol^2 (see paper) #> SCALE -1:50:0.1 rmax=60 # edge of disk (arcsec) #> SCALE 1:80:1 inc=60 # INC of disk #> SCALE 0:90:1 z0=0 # scaleheight [@todo buggy] #> SCALE 0:10:0.5 @@ -86,6 +87,10 @@ if [ $mmode = 0 ]; then else mass="pow(r/$re*exp(1-r/$re),$n)" fi +mmode=$(nemoinp "ifge($rm,0,2,$mmode)") +if [ $mmode = 2 ]; then + mass="exp(-r/$re)/(1+$rm*exp(-1.6*r/$re))" +fi echo MMODE=$mmode MASS=$mass if [ $m0 != 0 ]; then From 4737efe3aaf6ade534b9c564b21a3cca88166c91 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Fri, 22 Nov 2024 15:27:42 +0100 Subject: [PATCH 050/149] do the density properly --- scripts/csh/edge_gbt.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/csh/edge_gbt.sh b/scripts/csh/edge_gbt.sh index 0946c6b1e..a275d2494 100755 --- a/scripts/csh/edge_gbt.sh +++ b/scripts/csh/edge_gbt.sh @@ -21,7 +21,7 @@ r1=0.1 # central unresolved bulge, bar or black hole v1=0 # representative rotation speed at r1 re=20 # exponential scalelength of disk (arcsec) #> SCALE 1:100:1 n=-1 # n<1 exp disk; n>=0 PLEC disk #> SCALE -1:10:0.1 -rm=-1 # if > 0: use it has R_mol^2 (see paper) #> SCALE -1:50:0.1 +rm=-1 # if > 0: use it has R_mol^2 - AMT model #> SCALE -1:50:0.1 rmax=60 # edge of disk (arcsec) #> SCALE 1:80:1 inc=60 # INC of disk #> SCALE 0:90:1 z0=0 # scaleheight [@todo buggy] #> SCALE 0:10:0.5 @@ -124,6 +124,8 @@ else snaprotate - $run.20 "$inc,$pa" yz fi +snapsort $run.20 - r | snapshell - radii=0:${rmax}:0.01 pvar=m > $run.shell + echo "Creating velocity moments" snapgrid $run.20 $run.21 $grid_pars moment=0 evar=m snapgrid $run.20 $run.22 $grid_pars moment=1 evar=m @@ -171,6 +173,6 @@ if [[ "$plot" == *"profile"* ]]; then tabplot $run.spec line=1,1 headline="Spectrum around VLSR=$vlsr" yapp=2/xs fi if [[ "$plot" == *"density"* ]]; then - tabplot $run.tab 1 5 line=1,1 ymin=0 headline="Surface Density" yapp=3/xs + tabplot $run.shell 1 4 line=1,1 ymin=0 headline="Surface Density" yapp=3/xs fi From aca5fc3b71a9b6f31e3e41798caac5fde7ad3042 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 23 Nov 2024 10:09:13 +0100 Subject: [PATCH 051/149] fix bash quoting error --- scripts/csh/edge_gbt.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/csh/edge_gbt.sh b/scripts/csh/edge_gbt.sh index a275d2494..6c99c30ab 100755 --- a/scripts/csh/edge_gbt.sh +++ b/scripts/csh/edge_gbt.sh @@ -4,7 +4,7 @@ # # _script=edge_gbt.sh -_version=22-nov-2024 +_version=23-nov-2024 _pars=nemopars.rc _date=$(date +%Y-%m-%dT%H:%M:%S) @@ -36,6 +36,8 @@ sigma=0 # random motion in plane (km/s) #> SCA noise=0 # add optional noise to cube #> ENTRY vlsr=0 # optional VLSR if non-zero #> ENTRY +debug=-1 # add debugging #> SCALE -1:9:1 + plot=profile,rotcur # show which plots can be made #> CHECK rotcur,profile,density #--HELP @@ -53,6 +55,14 @@ for arg in "$@"; do export "$arg" done +# handle debugging +debug=$(nemoinp $debug format=%d) +if [ $debug -gt 0 ]; then + set -x +fi +export DEBUG=$debug +echo DEBUG=$DEBUG + # fixed now compared to edge_aca.sh range=$rmax # gridding size @@ -66,7 +76,7 @@ grid_pars="xrange=-${range}:${range} yrange=-${range}:${range} nx=$nsize ny=$nsi cell=`nemoinp "2*$range/$nsize*60"` cen=`nemoinp $nsize/2-0.5` restfreq=230.53800 # CO(2-1) in GHz -nbody=`nemoinp 10**$logn format=%d` +nbody=`nemoinp "10**$logn" format=%d` # ================================================================================ START @@ -92,6 +102,7 @@ if [ $mmode = 2 ]; then mass="exp(-r/$re)/(1+$rm*exp(-1.6*r/$re))" fi echo MMODE=$mmode MASS=$mass +echo NBODY=$nbody if [ $m0 != 0 ]; then echo "Creating brandt disk with $nbody particles times" From 0ea9047d09133eabd04c8844ed03d5d585947c0d Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 23 Nov 2024 11:11:10 +0100 Subject: [PATCH 052/149] optimized a bit --- scripts/csh/edge_gbt.sh | 48 ++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/scripts/csh/edge_gbt.sh b/scripts/csh/edge_gbt.sh index 6c99c30ab..7a13b524f 100755 --- a/scripts/csh/edge_gbt.sh +++ b/scripts/csh/edge_gbt.sh @@ -2,7 +2,11 @@ # # edge_gbt.sh simulate an EDGE GBT spectrum, derived from edge_aca.sh # +# bench: /usr/bin/time ./edge_gbt.sh logn=7 +# 7.65user 5.29system 0:12.88elapsed 100%CPU orig +# 5.15user 3.21system 0:08.37elapsed 99%CPU skip rotate, no moments # + _script=edge_gbt.sh _version=23-nov-2024 _pars=nemopars.rc @@ -67,7 +71,6 @@ echo DEBUG=$DEBUG # fixed now compared to edge_aca.sh range=$rmax # gridding size nsize=1 # number of spatial pixels (px=py=2*range/nx) -pa=0 # PA of receding side disk (E through N) # derive some parameters that appear common or logically belong together @@ -77,6 +80,7 @@ cell=`nemoinp "2*$range/$nsize*60"` cen=`nemoinp $nsize/2-0.5` restfreq=230.53800 # CO(2-1) in GHz nbody=`nemoinp "10**$logn" format=%d` +sininc=`nemoinp "sind($inc)"` # ================================================================================ START @@ -105,56 +109,40 @@ echo MMODE=$mmode MASS=$mass echo NBODY=$nbody if [ $m0 != 0 ]; then - echo "Creating brandt disk with $nbody particles times" + echo "Creating brandt disk with $nbody particles." mkdisk out=- nbody=$nbody seed=$seed z0=$z0,$z0 \ potname=brandt potpars=0,$v0,$r0,$m0 mass=1 sign=-1 frac=$sigma abs=t rmax=$rmax |\ - snapmass - - "mass=$mass" norm=1 |\ - snaprotate - $run.20 "$inc,$pa" yz + snapmass - $run.20 "mass=$mass" norm=1 rotcurves name1=brandt pars1=0,$v0,$r0,$m0 tab=t radii=0:${rmax}:0.01 plot=f |\ tabmath - - "%1,1,%2,$sigma,exp(-%1/$re)" all > $run.tab vmax=$(tabstat $run.tab 3 | txtpar - p0=max:,1,2) echo "Max rotcur: vmax=$vmax m0=$m0" elif [ $v1 = 0 ]; then - echo "Creating homogeneous disk with $nbody particles times" + echo "Creating homogeneous disk with $nbody particles." mkdisk out=- nbody=$nbody seed=$seed z0=$z0,$z0 \ potname=rotcur0 potpars=0,$v0,$r0 mass=1 sign=-1 frac=$sigma abs=t rmax=$rmax |\ snapmass - - "mass=$mass" |\ snapscale - - mscale=$nbody |\ - snaprotate - $run.20 "$inc,$pa" yz + snaprotate - $run.20 "$inc" y rotcurves name1=rotcur0 pars1=0,$v0,$r0 tab=t radii=0:${rmax}:0.01 plot=f |\ tabmath - - %1,1,%2,$sigma all > $run.tab else m1=`nemoinp "$r1*($v1/0.62)**2"` - echo "Creating homogeneous disk with $nbody particles times and a nuclear component m1=$m1" + echo "Creating homogeneous disk with $nbody particles and a nuclear component m1=$m1" rotcurves name1=rotcur0 pars1=0,$v0,$r0 name2=plummer pars2=0,$m1,$r1 tab=t radii=0:${rmax}:0.01 |\ tabmath - - %1,1,%2,$sigma all > $run.tab mktabdisk $run.tab - nbody=$nbody seed=$seed rmax=$rmax sign=-1 |\ snapmass - - "mass=$mass" |\ snapscale - - mscale=$nbody |\ - snaprotate - $run.20 "$inc,$pa" yz + snaprotate - $run.20 "$inc" y fi snapsort $run.20 - r | snapshell - radii=0:${rmax}:0.01 pvar=m > $run.shell - -echo "Creating velocity moments" -snapgrid $run.20 $run.21 $grid_pars moment=0 evar=m -snapgrid $run.20 $run.22 $grid_pars moment=1 evar=m -snapgrid $run.20 $run.23 $grid_pars moment=2 evar=m -# skip smoothing -ccdmath $run.21,$run.22,$run.23 $run.20d %1 -ccdmath $run.21,$run.22,$run.23 $run.20v "%2/%1" -ccdmath $run.21,$run.22,$run.23 $run.20s "sqrt(%3/%1-%2*%2/(%1*%1))" -# clipping -ccdmath $run.20d,$run.21 $run.21d "ifgt(%2,0,%1,0)" -ccdmath $run.20v,$run.21 $run.21v "ifgt(%2,0,%1,0)" -ccdmath $run.20s,$run.21 $run.21s "ifgt(%2,0,%1,0)" - echo "Creating a velocity field - method 2" -snapgrid $run.20 - $grid_pars \ - zrange=-${vrange}:${vrange} nz=$nvel mean=f evar=m |\ - ccdflip - $run.30 flip=$flip wcs=t +snapgrid $run.20 $run.30 $grid_pars \ + zrange=-${vrange}:${vrange} nz=$nvel mean=f evar=m zvar=vy*$sininc ccdstat $run.30 if [ $vbeam = 0 ]; then ccdmath $run.30 $run.31 "%1+rang(0,$noise)" @@ -163,17 +151,23 @@ else fi # single dish profile +if [ 1 = 1 ]; then ccdmom $run.31 - axis=1 mom=0 |\ ccdmom - - axis=2 mom=0 |\ ccdprint - x= y= z= label=z newline=t |\ tabcomment - - punct=f delete=t > $run.spec - +else + # faster, but normalization is off now + ccdprint $run.31 x= y= z= label=z newline=t |\ + tabcomment - - punct=f delete=t > $run.spec +fi echo -n "Total integral over spectrum: " tabint $run.spec # export for other programs, in decent units # this way the input spatial scale is in arcsec and km/s -ccdfits $run.31 $run.fits radecvel=t scale=1/3600.0,1/3600.0,1.0 crval=$crval restfreq=$restfreq +# SKIP for production +# ccdfits $run.31 $run.fits radecvel=t scale=1/3600.0,1/3600.0,1.0 crval=$crval restfreq=$restfreq echo "PLOT: $plot" From f61f008e6f79973d71ed2960d695417e406fac86 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 23 Nov 2024 11:34:36 +0100 Subject: [PATCH 053/149] skip snapsort since mkdisk already sorted particles in radius --- scripts/csh/edge_gbt.sh | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/scripts/csh/edge_gbt.sh b/scripts/csh/edge_gbt.sh index 7a13b524f..b409c9fb2 100755 --- a/scripts/csh/edge_gbt.sh +++ b/scripts/csh/edge_gbt.sh @@ -5,6 +5,7 @@ # bench: /usr/bin/time ./edge_gbt.sh logn=7 # 7.65user 5.29system 0:12.88elapsed 100%CPU orig # 5.15user 3.21system 0:08.37elapsed 99%CPU skip rotate, no moments +# 3.74user 2.21system 0:05.98elapsed 99%CPU skip snapsort (mkdisk was sorted) # _script=edge_gbt.sh @@ -82,11 +83,18 @@ restfreq=230.53800 # CO(2-1) in GHz nbody=`nemoinp "10**$logn" format=%d` sininc=`nemoinp "sind($inc)"` +function nemo_stamp { + if [ $debug -ge 0 ]; then + echo "$(date +%H:%M:%S.%N) $*" + fi +} + # ================================================================================ START # Announce: echo "$0 version $_version" +nemo_stamp start # Clear old model rm -f $run.* >& /dev/null @@ -107,48 +115,55 @@ if [ $mmode = 2 ]; then fi echo MMODE=$mmode MASS=$mass echo NBODY=$nbody - +nemo_stamp begin if [ $m0 != 0 ]; then echo "Creating brandt disk with $nbody particles." mkdisk out=- nbody=$nbody seed=$seed z0=$z0,$z0 \ potname=brandt potpars=0,$v0,$r0,$m0 mass=1 sign=-1 frac=$sigma abs=t rmax=$rmax |\ - snapmass - $run.20 "mass=$mass" norm=1 + snapmass - $run.20 "mass=$mass" norm=1 + nemo_stamp mkdisk rotcurves name1=brandt pars1=0,$v0,$r0,$m0 tab=t radii=0:${rmax}:0.01 plot=f |\ tabmath - - "%1,1,%2,$sigma,exp(-%1/$re)" all > $run.tab + nemo_stamp rotcurves vmax=$(tabstat $run.tab 3 | txtpar - p0=max:,1,2) echo "Max rotcur: vmax=$vmax m0=$m0" + nemo_stamp tabstat elif [ $v1 = 0 ]; then - echo "Creating homogeneous disk with $nbody particles." + echo "Creating homogeneous disk with $nbody particles. (need optimizing test)" mkdisk out=- nbody=$nbody seed=$seed z0=$z0,$z0 \ potname=rotcur0 potpars=0,$v0,$r0 mass=1 sign=-1 frac=$sigma abs=t rmax=$rmax |\ snapmass - - "mass=$mass" |\ - snapscale - - mscale=$nbody |\ - snaprotate - $run.20 "$inc" y + snapscale - $run.20 mscale=$nbody rotcurves name1=rotcur0 pars1=0,$v0,$r0 tab=t radii=0:${rmax}:0.01 plot=f |\ tabmath - - %1,1,%2,$sigma all > $run.tab else m1=`nemoinp "$r1*($v1/0.62)**2"` - echo "Creating homogeneous disk with $nbody particles and a nuclear component m1=$m1" + echo "Creating homogeneous disk with $nbody particles and a nuclear component m1=$m1 (needs optimizing test)" rotcurves name1=rotcur0 pars1=0,$v0,$r0 name2=plummer pars2=0,$m1,$r1 tab=t radii=0:${rmax}:0.01 |\ tabmath - - %1,1,%2,$sigma all > $run.tab mktabdisk $run.tab - nbody=$nbody seed=$seed rmax=$rmax sign=-1 |\ snapmass - - "mass=$mass" |\ - snapscale - - mscale=$nbody |\ - snaprotate - $run.20 "$inc" y + snapscale - $run.20 mscale=$nbody fi -snapsort $run.20 - r | snapshell - radii=0:${rmax}:0.01 pvar=m > $run.shell +#snapsort $run.20 - r help=c | snapshell - radii=0:${rmax}:0.01 pvar=m help=c > $run.shell +snapshell $run.20 radii=0:${rmax}:0.01 pvar=m help=c > $run.shell +nemo_stamp snapshell echo "Creating a velocity field - method 2" snapgrid $run.20 $run.30 $grid_pars \ zrange=-${vrange}:${vrange} nz=$nvel mean=f evar=m zvar=vy*$sininc +nemo_stamp snapgrid ccdstat $run.30 +nemo_stamp ccdstat + if [ $vbeam = 0 ]; then ccdmath $run.30 $run.31 "%1+rang(0,$noise)" else ccdmath $run.30 - "%1+rang(0,$noise)" | ccdsmooth - $run.31 $vbeam dir=z fi +nemo_stamp ccdmath # single dish profile if [ 1 = 1 ]; then @@ -161,8 +176,11 @@ else ccdprint $run.31 x= y= z= label=z newline=t |\ tabcomment - - punct=f delete=t > $run.spec fi +nemo_stamp ccdprint + echo -n "Total integral over spectrum: " tabint $run.spec +nemo_stamp tabint # export for other programs, in decent units # this way the input spatial scale is in arcsec and km/s @@ -181,3 +199,4 @@ if [[ "$plot" == *"density"* ]]; then tabplot $run.shell 1 4 line=1,1 ymin=0 headline="Surface Density" yapp=3/xs fi +nemo_stamp end From defd3f49ffbf12c1474b14c990004916d1828b90 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 23 Nov 2024 12:36:41 +0100 Subject: [PATCH 054/149] note another speedup --- scripts/csh/edge_gbt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/csh/edge_gbt.sh b/scripts/csh/edge_gbt.sh index b409c9fb2..345f42fdb 100755 --- a/scripts/csh/edge_gbt.sh +++ b/scripts/csh/edge_gbt.sh @@ -6,7 +6,7 @@ # 7.65user 5.29system 0:12.88elapsed 100%CPU orig # 5.15user 3.21system 0:08.37elapsed 99%CPU skip rotate, no moments # 3.74user 2.21system 0:05.98elapsed 99%CPU skip snapsort (mkdisk was sorted) -# +# 3.11user 2.30system 0:05.40elapsed 100%CPU faster mkdisk _script=edge_gbt.sh _version=23-nov-2024 From ff2e0b39b0d97e4fd52d829788e75e567c143cab Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 23 Nov 2024 12:39:04 +0100 Subject: [PATCH 055/149] speed up if no random motions --- src/nbody/init/mkdisk.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/nbody/init/mkdisk.c b/src/nbody/init/mkdisk.c index 02c795a48..ce9be7aaa 100644 --- a/src/nbody/init/mkdisk.c +++ b/src/nbody/init/mkdisk.c @@ -56,7 +56,7 @@ string defv[] = { "z0=0,0\n Vertical scaleheight for density; use 2nd one for velocity dropoff if needed", "vloss=-1\n Fractional loss of orbital speed at the scaleheight (<1 => Burkert)", "headline=\n Text headline for output", - "VERSION=4.9i\n 19-jan-2018 PJT", + "VERSION=4.9j\n 23-nov-2024 PJT", NULL, }; @@ -77,6 +77,7 @@ local proc potential; local real z0_d; /* the old z0 */ local real z0_v; /* dropoff in velocity */ local real vloss; +local bool Qrandom; /* old style */ // #define OLD_BURKERT 1 @@ -166,6 +167,9 @@ void nemo_main() error("%d: bad parsing frac=%s",nfrac,getparam("frac")); } dprintf(1,"frac: %g %g %g\n",frac[0],frac[1],frac[2]); + Qrandom = (frac[0]>0 || frac[1]>0 || frac[2]>0); + if (!Qrandom) + dprintf(0,"No random motions\n"); mass = getdparam("mass") / ndisk; if (mass==0.0) { @@ -266,18 +270,24 @@ void testdisk(void) #if 1 if (Qabs) { - sigma_r = grandom(0.0,frac[0]); - sigma_t = grandom(0.0,frac[1]); - sigma_z = grandom(0.0,frac[2]); + if (Qrandom) { + sigma_r = grandom(0.0,frac[0]); + sigma_t = grandom(0.0,frac[1]); + sigma_z = grandom(0.0,frac[2]); + } else + sigma_r = sigma_t = sigma_z = 0.0; Vel(dp)[0] = -vcir_i * sint * jz_sign; Vel(dp)[1] = vcir_i * cost * jz_sign; Vel(dp)[0] += cost*sigma_r - sint*sigma_t; /* add dispersions */ Vel(dp)[1] += sint*sigma_r + cost*sigma_t; } else { do { /* iterate, if needed, to get vrandom */ - sigma_r = grandom(0.0,frac[0]*vcir_i); - sigma_t = grandom(0.0,frac[1]*vcir_i); - sigma_z = grandom(0.0,frac[2]*vcir_i); + if (Qrandom) { + sigma_r = grandom(0.0,frac[0]*vcir_i); + sigma_t = grandom(0.0,frac[1]*vcir_i); + sigma_z = grandom(0.0,frac[2]*vcir_i); + } else + sigma_r = sigma_t = sigma_z = 0.0; dv_t = sigma_t; dv_r = sigma_r * took(r_i) ; vrandom = sqrt(dv_t*dv_t + dv_r*dv_r); @@ -291,9 +301,12 @@ void testdisk(void) Vel(dp)[1] += sint*dv_r + cost*dv_t; } #else - sigma_r = grandom(0.0,frac[0]*vcir_i); - sigma_t = grandom(0.0,frac[1]*vcir_i); - sigma_z = grandom(0.0,frac[2]*vcir_i); + if (Qrandom) { + sigma_r = grandom(0.0,frac[0]*vcir_i); + sigma_t = grandom(0.0,frac[1]*vcir_i); + sigma_z = grandom(0.0,frac[2]*vcir_i); + } else + sigma_r = sigma_t = sigma_z = 0.0; dv_t = sigma_t; dv_r = sigma_r * took(r_i) ; From 2ca5bc99fafc3e6a3fd23a4e3c7d15cdaf1bae87 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 23 Nov 2024 12:58:59 +0100 Subject: [PATCH 056/149] normalize noise= and report S/N --- scripts/csh/edge_gbt.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/csh/edge_gbt.sh b/scripts/csh/edge_gbt.sh index 345f42fdb..ffb1b450a 100755 --- a/scripts/csh/edge_gbt.sh +++ b/scripts/csh/edge_gbt.sh @@ -2,7 +2,7 @@ # # edge_gbt.sh simulate an EDGE GBT spectrum, derived from edge_aca.sh # -# bench: /usr/bin/time ./edge_gbt.sh logn=7 +# bench: /usr/bin/time ./edge_gbt.sh logn=7 plot=0 debug=0 # 7.65user 5.29system 0:12.88elapsed 100%CPU orig # 5.15user 3.21system 0:08.37elapsed 99%CPU skip rotate, no moments # 3.74user 2.21system 0:05.98elapsed 99%CPU skip snapsort (mkdisk was sorted) @@ -82,6 +82,7 @@ cen=`nemoinp $nsize/2-0.5` restfreq=230.53800 # CO(2-1) in GHz nbody=`nemoinp "10**$logn" format=%d` sininc=`nemoinp "sind($inc)"` +noise=`nemoinp $noise/$nbody` # kludge function nemo_stamp { if [ $debug -ge 0 ]; then @@ -181,6 +182,11 @@ nemo_stamp ccdprint echo -n "Total integral over spectrum: " tabint $run.spec nemo_stamp tabint +echo -n "Estimate of signal/noise in spectrum: " +peak=$(tabstat $run.spec 2 qac=t | txtpar - p0=QAC,1,6) +rms=$(tabtrend $run.spec 2 | tabstat - qac=t robust=t | txtpar - p0=QAC,1,4) +echo "$peak $rms $(nemoinp $peak/$rms)" + # export for other programs, in decent units # this way the input spatial scale is in arcsec and km/s @@ -193,7 +199,7 @@ if [[ "$plot" == *"rotcur"* ]]; then tabplot $run.tab 1 3 headline="Rotation Curve" yapp=1/xs fi if [[ "$plot" == *"profile"* ]]; then - tabplot $run.spec line=1,1 headline="Spectrum around VLSR=$vlsr" yapp=2/xs + tabplot $run.spec line=1,1 ycoord=0 headline="Spectrum around VLSR=$vlsr" yapp=2/xs fi if [[ "$plot" == *"density"* ]]; then tabplot $run.shell 1 4 line=1,1 ymin=0 headline="Surface Density" yapp=3/xs From 65e528db8e9001b4e204d0efc5bc845667e3c7aa Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 23 Nov 2024 13:11:52 +0100 Subject: [PATCH 057/149] fix report S/N with N=0 --- scripts/csh/edge_gbt.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/csh/edge_gbt.sh b/scripts/csh/edge_gbt.sh index ffb1b450a..cee5e7e7f 100755 --- a/scripts/csh/edge_gbt.sh +++ b/scripts/csh/edge_gbt.sh @@ -185,10 +185,14 @@ nemo_stamp tabint echo -n "Estimate of signal/noise in spectrum: " peak=$(tabstat $run.spec 2 qac=t | txtpar - p0=QAC,1,6) rms=$(tabtrend $run.spec 2 | tabstat - qac=t robust=t | txtpar - p0=QAC,1,4) -echo "$peak $rms $(nemoinp $peak/$rms)" +if [ $rms = 0 ]; then + echo "$peak 0 999999" +else + echo "$peak $rms $(nemoinp $peak/$rms)" +fi -# export for other programs, in decent units +# export to FITS, in decent units # this way the input spatial scale is in arcsec and km/s # SKIP for production # ccdfits $run.31 $run.fits radecvel=t scale=1/3600.0,1/3600.0,1.0 crval=$crval restfreq=$restfreq From 00be234277fb6fa65f3e7c9e4c26684392194610 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 23 Nov 2024 13:18:38 +0100 Subject: [PATCH 058/149] docs --- scripts/csh/edge_gbt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/csh/edge_gbt.sh b/scripts/csh/edge_gbt.sh index cee5e7e7f..f573072b0 100755 --- a/scripts/csh/edge_gbt.sh +++ b/scripts/csh/edge_gbt.sh @@ -186,9 +186,9 @@ echo -n "Estimate of signal/noise in spectrum: " peak=$(tabstat $run.spec 2 qac=t | txtpar - p0=QAC,1,6) rms=$(tabtrend $run.spec 2 | tabstat - qac=t robust=t | txtpar - p0=QAC,1,4) if [ $rms = 0 ]; then - echo "$peak 0 999999" + echo "$peak / 0 = 999999" else - echo "$peak $rms $(nemoinp $peak/$rms)" + echo "$peak / $rms = $(nemoinp $peak/$rms)" fi From cc63fa8d29e4339f8601bcda5e95cff07d837669 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Thu, 28 Nov 2024 01:28:42 -0500 Subject: [PATCH 059/149] cloned off mkdisk.c - this bypassed a series of pipes to create just a global spectrum See edge_gbt.sh for the background --- src/nbody/init/diskspectrum.c | 313 ++++++++++++++++++++++++++++++++++ 1 file changed, 313 insertions(+) create mode 100644 src/nbody/init/diskspectrum.c diff --git a/src/nbody/init/diskspectrum.c b/src/nbody/init/diskspectrum.c new file mode 100644 index 000000000..a656d8970 --- /dev/null +++ b/src/nbody/init/diskspectrum.c @@ -0,0 +1,313 @@ +/* + * DISKSPECTRUM.C: combining mkdisk + snapmass + snaprotate + snapgriof + * to create a faster method for edge_gbt.sh + * + * 24-nov-2024 cloned off mkdisk + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +string defv[] = { + "out=???\n Output file name (spectrum)", + "nbody=2048\n Number of disk particles", + + "potname=plummer\n Name of potential(5)", + "potpars=\n Parameters to potential(5); omega needed but not used", + "potfile=\n Optional data file with potential(5)", + + "rmin=0\n Inner disk radius", + "rmax=1\n Outer cutoff radius", + "model=0\n Mass model (0=const 1=exp, 2=f... 3=dac)", + + "frac=0\n Relative vel.disp w.r.t. local rotation speed", + "seed=0\n Usual random number seed", + + "angle=f\n Regular angular distribution?", + "vrad=0\n radial velocity", + "energy=f\n preserve energy if random motions added?", + "abs=f\n Use absolute vel.disp instead of fractional?", + "z0=0,0\n Vertical scaleheight for density; use 2nd one for velocity dropoff if needed", + "vloss=-1\n Fractional loss of orbital speed at the scaleheight (<1 => Burkert)", + + "inc=30\n Inclination to observe the disk at", + + "vbeam=5\n FWHM of smoothing beam in velocity", + "vrange=400\n velocity gridding will be -vrange:vrange", + "nvel=200\n number of spectral pixels", + + "headline=\n Text headline for output", + "VERSION=0.1\n 27-nov-2024 PJT", + NULL, +}; + +string usage="global spectrum of a rotating thin disk"; + +local real rmin, rmax, mass; +local bool Qangle; +local bool Qenergy; +local bool Qabs; + +local int ndisk; +local real frac[NDIM], vrad; +local Body *disk; + +local proc potential; + +local real z0_d; /* the old z0 */ +local real z0_v; /* dropoff in velocity */ +local real vloss; +local bool Qrandom; + +local real sininc = 1.0; + +/* old style */ +// #define OLD_BURKERT 1 + + +extern double xrandom(double,double), grandom(double,double); + +local real took(real); +local void testdisk(void); +local void spectrum(void); + +local real mysech2(real z) +{ + real y = exp(z); + return sqr(2.0/(y+1.0/y)); +} + +local real pick_z(real z0) +{ + real z = frandom(-6.0,6.0,mysech2) * z0; + return z; +} + +local real pick_dv(real r, real z, real z0) +{ +#ifdef OLD_BURKERT + real dv = 1 - (1 + (z/z0) * tanh(z/z0))*(z0/r); +#else + //real dv = tanh(z/z0); + //dv = sqrt(1 - ABS(dv)); + real dv = ABS(z/z0); + //dv = sqrt(exp(-dv)); + dv = exp(-dv); +#endif + dprintf(1,"PJT %g %g %g\n",r,z,dv); + return dv; +} + +void nemo_main() +{ + int nfrac, seed, nz; + real z0[2]; + + potential = get_potential(getparam("potname"), + getparam("potpars"), getparam("potfile")); + rmin = getdparam("rmin"); + rmax = getdparam("rmax"); + vrad = getdparam("vrad"); + ndisk = getiparam("nbody"); + + /* z0= is now split in a density and velocity */ + nz = nemoinpr(getparam("z0"),z0,2); + if (nz == 0) + z0[0] = z0[1] = 0.0; + else if (nz == 1) + z0[1] = 0.0; + z0_d = z0[0]; + z0_v = z0[1]; + + + vloss = getrparam("vloss"); + if (z0_d > 0) { + if (vloss < 0) +#ifdef OLD_BURKERT + dprintf(0,"Burkert et al 2010 streaming(z) model\n"); +#else + dprintf(0,"new style tanh(z) streaming model\n"); +#endif + else + dprintf(0,"Toy streaming(z) model with vloss=%g\n",vloss); + } + nfrac = nemoinpr(getparam("frac"),frac,NDIM); + switch (nfrac) { + case 1: + frac[1] = frac[0]; + frac[2] = 0.0; + break; + case 2: + frac[2] = 0.0; + break; + case 3: + break; + default: + error("%d: bad parsing frac=%s",nfrac,getparam("frac")); + } + dprintf(1,"frac: %g %g %g\n",frac[0],frac[1],frac[2]); + Qrandom = (frac[0]>0 || frac[1]>0 || frac[2]>0); + if (!Qrandom) + dprintf(0,"No random motions\n"); + + mass = 1.0 / ndisk; + seed = init_xrandom(getparam("seed")); + dprintf(1,"Seed=%d\n",seed); + Qangle = getbparam("angle"); + Qenergy = getbparam("energy"); + Qabs = getbparam("abs"); + testdisk(); + spectrum(); +} + +/* + * TESTDISK: use forces due to a potential to make a uniform + * density test disk. + */ + +void testdisk(void) +{ + Body *dp; + real rmin2, rmax2, r_i, theta_i, vcir_i; + real dv_r, dv_t, sint, cost, vrandom; + real sigma_r, sigma_t, sigma_z; + vector acc_i; + int i, ncirc, ndim=NDIM; + double pos_d[NDIM], acc_d[NDIM], pot_d, time_d = 0.0; + + disk = (Body *) allocate(ndisk * sizeof(Body)); + rmin2 = rmin * rmin; + rmax2 = rmax * rmax; + theta_i = xrandom(0.0, TWO_PI); + for (dp=disk, i = 0, ncirc=0; i < ndisk; dp++, i++) { /* loop over all stars */ + Mass(dp) = mass; + if (ndisk == 1) + r_i = rmin; + else + r_i = sqrt(rmin2 + i * (rmax2 - rmin2) / (ndisk - 1.0)); + if (Qangle) { + theta_i += TWO_PI/ndisk; + } else { + theta_i = xrandom(0.0, TWO_PI); + } + cost = cos(theta_i); + sint = sin(theta_i); + Pos(dp)[0] = pos_d[0] = r_i * cost; /* set positions */ + Pos(dp)[1] = pos_d[1] = r_i * sint; + Pos(dp)[2] = pos_d[2] = 0.0; /* it's a DISK ! */ + (*potential)(&ndim,pos_d,acc_d,&pot_d,&time_d); /* get forces */ + SETV(acc_i,acc_d); + vcir_i = sqrt(r_i * absv(acc_i)); /* v^2 / r = force */ + /* now cheat and rotate slower away from the plane */ + if (z0_d > 0) { + if (vloss >= 0.0) { + // toy model (early sep 2017) + Pos(dp)[2] = grandom(0.0, 0.5 * z0_d); + vcir_i *= (1-vloss*ABS(Pos(dp)[2]/z0_d)); + if (vcir_i < 0) vcir_i = 0.0; /* added dec 2017 */ + } else { + // Burkert et al. 2010 model, doesn't need vloss= anymore, triggered when vloss < 0 + Pos(dp)[2] = pick_z(z0_d); + vcir_i = vcir_i*vcir_i; + vcir_i *= pick_dv(r_i,Pos(dp)[2],z0_v); + if (vcir_i > 0) + vcir_i = sqrt(vcir_i); + else + vcir_i = 0.0; + } + } + +#if 1 + if (Qabs) { + if (Qrandom) { + sigma_r = grandom(0.0,frac[0]); + sigma_t = grandom(0.0,frac[1]); + sigma_z = grandom(0.0,frac[2]); + } else + sigma_r = sigma_t = sigma_z = 0.0; + Vel(dp)[0] = -vcir_i * sint ; + Vel(dp)[1] = vcir_i * cost ; + Vel(dp)[0] += cost*sigma_r - sint*sigma_t; /* add dispersions */ + Vel(dp)[1] += sint*sigma_r + cost*sigma_t; + } else { + do { /* iterate, if needed, to get vrandom */ + if (Qrandom) { + sigma_r = grandom(0.0,frac[0]*vcir_i); + sigma_t = grandom(0.0,frac[1]*vcir_i); + sigma_z = grandom(0.0,frac[2]*vcir_i); + } else + sigma_r = sigma_t = sigma_z = 0.0; + dv_t = sigma_t; + dv_r = sigma_r * took(r_i) ; + vrandom = sqrt(dv_t*dv_t + dv_r*dv_r); + if (vrandom > vcir_i) ncirc++; + } while (Qenergy && vrandom > vcir_i); + vcir_i = sqrt((vcir_i-vrandom)*(vcir_i+vrandom)); + dv_r += vrad; + Vel(dp)[0] = -vcir_i * sint ; + Vel(dp)[1] = vcir_i * cost ; + Vel(dp)[0] += cost*dv_r - sint*dv_t; /* add dispersions */ + Vel(dp)[1] += sint*dv_r + cost*dv_t; + } +#else + if (Qrandom) { + sigma_r = grandom(0.0,frac[0]*vcir_i); + sigma_t = grandom(0.0,frac[1]*vcir_i); + sigma_z = grandom(0.0,frac[2]*vcir_i); + } else + sigma_r = sigma_t = sigma_z = 0.0; + dv_t = sigma_t; + dv_r = sigma_r * took(r_i) ; + + /* Qenergy only uses radial motion: thus preserving the + * guiding center for epicycles ?? (Olling 2003) + */ + + if (Qenergy) + vcir_i = sqrt((vcir_i-dv_r)*(vcir_i+dv_r)); + Vel(dp)[0] = -vcir_i * sint ; + Vel(dp)[1] = vcir_i * cost ; + Vel(dp)[0] += cost*dv_r; + Vel(dp)[1] += sint*dv_r; + if (!Qenergy) { + Vel(dp)[0] += -sint*dv_t; + Vel(dp)[1] += cost*dv_t; + } + +#endif + Vel(dp)[2] = sigma_z; + Vel(dp)[1] *= sininc; + } + if (ncirc) dprintf(0,"Had to respin random %d times\n",ncirc); +} + + +/* + * 2*omega/kappa; from spline interpolation..... + */ + +real took(real r) +{ + return 1.0; +} + + +void spectrum(void) +{ + double mtot = 0.0; + Body *dp; + int i; + + for (dp=disk, i = 0; i < ndisk; dp++, i++) { /* loop over all stars */ + mtot += Mass(dp); + } + printf("Total mass: %g ndisk=%d\n", mtot, ndisk); +} From 8fdc1ae44bfdeb5c8085c5097c7bacf237133896 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Thu, 28 Nov 2024 11:43:11 +0100 Subject: [PATCH 060/149] draft --- man/man1/diskspectrum.1 | 121 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 man/man1/diskspectrum.1 diff --git a/man/man1/diskspectrum.1 b/man/man1/diskspectrum.1 new file mode 100644 index 000000000..e161df475 --- /dev/null +++ b/man/man1/diskspectrum.1 @@ -0,0 +1,121 @@ +.TH DISKSPECTRUM 1NEMO "28 November 0024" + +.SH "NAME" +diskspectrum \- global spectrum of a rotating thin disk + +.SH "SYNOPSIS" +\fBdiskspectrum out=\fPsnapshot [parameters=values ...] + +.SH "DESCRIPTION" +\fIdiskspectrum\fP sets up a ``cold'' disk of test particles +in the gravitational potential of a user-supplied potential in +\fIpotential(5NEMO)\fP format. The disk is imagined to be inclined by +a given inclination and a global spectral profile is computed. +.PP +This program was cloned from \fImkdisk(1NEMO)\fP, with which it shares +a number of keywords. Instead of producing a \fIsnapshot(5NEMO)\fP, it + +.SH "PARAMETERS" +The following parameters are recognized in any order if the keyword is also +given: +.TP 25 +\fBout=\fIout_file\fP +The data are written to this file in \fIsnapshot(5NEMO)\fP +format . Currently the potential and total energy are stored in the +Potential and Aux slots of the snapshot. [no default]. +.TP +\fBnbody=\fInum_bodies\fP +Number of bodies particles [default: \fB2048\fP] +.TP +\fBpotname=\fIpotential_name\fP +name of the potential, see \fB$NEMOOBJ/potential\fP for the current +object repository. The user can supply his own, see \fIpotential(5NEMO)\fP. +[no default]. +.TP +\fBpotpars=\fIpot_pars\fP +Paramaters to the user supplied potential. The number of parameters +depends on the potential supplied, the first parameter is reserved +for the pattern speed. +[default: not supplied, parameters as defined by potential(5)]. +.TP +\fBpotfile=\fIpot_data\fP +Optional data file(s) to the user supplied potential. +The number of files depends +on the potential supplied. +[default: not supplied, or datafile(s) defined by potential(5)]. +.TP +\fBrmin=\fImin_disk_radius\fP +Inner cutoff radius of test-particle disk. [Default: \fB0\fP]. +.TP +\fBrmax=\fImax_disk_radius\fP +Outer cutoff radius of test-particle disk. [Default: \fB1\fP]. +.TP +\fBmass=\fItot_mass\fP +Total mass of the disk. The default total mass is 0, since this is a +testdisk. Since there are a few programs that will not like mass-less +particles, this keyword can be used, or \fIsnapmass\fP +will have to be used before further action is taken. +[default: \fB0\fP]. +.TP +\fBfrac=\fIfraction\fP +The fraction that the local velocity dispersion has w.r.t. +the local rotation velocity. If a number is given, radial and tangential velocity are +by default taken to be the same, with no Z-velocities. If two numbers are given, +the first one is the radial dispersion, the second one the tangential +(currently wihtout any 2*Omega/Kappa correction), and the Z dispersion 0. +Finally, when 3 numbers are given, random motions in Z are also added. +[Default: \fB0\fP] +.TP +\fBseed=\fIrandom_seed\fP +Use random number seed. If 0 is given, a random number is generated +from the time of the day. [default: \fB0\fP]. +.TP +\fBsign=-1|1\fP +Sign of the angular momentum. 1 means counter clockwise rotation in the +XY-plane (in case you were wondering, +our galaxy has sign=-1). [Default: \fB1\fP]. +.TP +\fBin=\fIinfile\fP +Input file, in \fIsnapshot(5NEMO)\fP format, of which the positions +are used as initial conditions. [Default: not used]. +*** \fI lost the implementation ** \fP +.TP +\fBangle=t|f\fP +Normally the particles are distributed randomly in phase, but setting this +to true, they will be regularly spread between 0 and TWO_PI. +Default: f +.TP +\fBvrad=\fP +A constant radial velocity (>0 means outward motion) added to all particles. +Default: 0. +.TP +\fBenergy=t|f\fP +If random motions are added (see frac=), the energy of each particle will +change. By setting \fBenergy=t\fP the energy is conserved and the "circular" +speed will be reduced. This way the guiding center for epicyclic orbits +will also be conserved. Note that this only applies to motion in XY. +For stars with too much random motion (if \fBfrac\fP too high), the +random number generator is run again to ensure conserving the planar +motion kinetic energy. Default: false. +.TP +\fBabs=t|f\fP +Use absolute value of velocity dispersion instead of fractional. +Default: f +.TP +\fBz0=z0_d,z0_v\fP +Scaleheight for density dropoff, and circular velocity dropoff. Default: 0,0 +.TP +\fBvloss=\fP +(deprecated) Fractional loss in circular streaming as z increased. Use z0_v now. +.TP +\fBheadline=\fImessage\fP +Text headline for output file [default: not used]. + +.SH "SEE ALSO" +mkdisk(1NEMO) + +.SH "UPDATE HISTORY" +.nf +.ta +1.5i +4.5i +28-nov-2024 V0.1: cloned of mkdisk to check performance PJT +.fi From 3d58b8c85ac2bcf88a70e0effe99eb103acca39e Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Thu, 28 Nov 2024 11:43:38 +0100 Subject: [PATCH 061/149] show spectrum, but still on stdout --- src/nbody/init/diskspectrum.c | 68 +++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/src/nbody/init/diskspectrum.c b/src/nbody/init/diskspectrum.c index a656d8970..8543775c9 100644 --- a/src/nbody/init/diskspectrum.c +++ b/src/nbody/init/diskspectrum.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -26,7 +27,8 @@ string defv[] = { "rmin=0\n Inner disk radius", "rmax=1\n Outer cutoff radius", - "model=0\n Mass model (0=const 1=exp, 2=f... 3=dac)", + "model=0\n Mass model (0=CONST 1=EXP, 2=PLEC... 3=AMT)", + "mpars=\n Parameters for the mass model", "frac=0\n Relative vel.disp w.r.t. local rotation speed", "seed=0\n Usual random number seed", @@ -35,8 +37,8 @@ string defv[] = { "vrad=0\n radial velocity", "energy=f\n preserve energy if random motions added?", "abs=f\n Use absolute vel.disp instead of fractional?", - "z0=0,0\n Vertical scaleheight for density; use 2nd one for velocity dropoff if needed", - "vloss=-1\n Fractional loss of orbital speed at the scaleheight (<1 => Burkert)", + "z0=0,0\n ** Vertical scaleheight for density; use 2nd one for velocity dropoff if needed", + "vloss=-1\n ** Fractional loss of orbital speed at the scaleheight (<1 => Burkert)", "inc=30\n Inclination to observe the disk at", @@ -45,7 +47,7 @@ string defv[] = { "nvel=200\n number of spectral pixels", "headline=\n Text headline for output", - "VERSION=0.1\n 27-nov-2024 PJT", + "VERSION=0.2\n 27-nov-2024 PJT", NULL, }; @@ -67,7 +69,16 @@ local real z0_v; /* dropoff in velocity */ local real vloss; local bool Qrandom; -local real sininc = 1.0; +local real inc, sininc; +local real vbeam; +local real vrange; +local int nvel; + +local int mmodel; +local real mpars[16]; +// 1: EXP: re +// 2: PLEC: rd,n +// 3: AMT: rd,Rm /* old style */ // #define OLD_BURKERT 1 @@ -110,6 +121,8 @@ void nemo_main() { int nfrac, seed, nz; real z0[2]; + + warning("This program is under development"); potential = get_potential(getparam("potname"), getparam("potpars"), getparam("potfile")); @@ -164,6 +177,12 @@ void nemo_main() Qangle = getbparam("angle"); Qenergy = getbparam("energy"); Qabs = getbparam("abs"); + vbeam = getdparam("vbeam"); + vrange = getdparam("vrange"); + nvel = getiparam("nvel"); + inc = getdparam("inc"); + sininc = sin(inc/DR2D); + testdisk(); spectrum(); } @@ -233,9 +252,9 @@ void testdisk(void) sigma_z = grandom(0.0,frac[2]); } else sigma_r = sigma_t = sigma_z = 0.0; - Vel(dp)[0] = -vcir_i * sint ; + //Vel(dp)[0] = -vcir_i * sint ; Vel(dp)[1] = vcir_i * cost ; - Vel(dp)[0] += cost*sigma_r - sint*sigma_t; /* add dispersions */ + //Vel(dp)[0] += cost*sigma_r - sint*sigma_t; /* add dispersions */ Vel(dp)[1] += sint*sigma_r + cost*sigma_t; } else { do { /* iterate, if needed, to get vrandom */ @@ -252,9 +271,9 @@ void testdisk(void) } while (Qenergy && vrandom > vcir_i); vcir_i = sqrt((vcir_i-vrandom)*(vcir_i+vrandom)); dv_r += vrad; - Vel(dp)[0] = -vcir_i * sint ; + //Vel(dp)[0] = -vcir_i * sint ; Vel(dp)[1] = vcir_i * cost ; - Vel(dp)[0] += cost*dv_r - sint*dv_t; /* add dispersions */ + //Vel(dp)[0] += cost*dv_r - sint*dv_t; /* add dispersions */ Vel(dp)[1] += sint*dv_r + cost*dv_t; } #else @@ -273,12 +292,12 @@ void testdisk(void) if (Qenergy) vcir_i = sqrt((vcir_i-dv_r)*(vcir_i+dv_r)); - Vel(dp)[0] = -vcir_i * sint ; + //Vel(dp)[0] = -vcir_i * sint ; Vel(dp)[1] = vcir_i * cost ; - Vel(dp)[0] += cost*dv_r; + //Vel(dp)[0] += cost*dv_r; Vel(dp)[1] += sint*dv_r; if (!Qenergy) { - Vel(dp)[0] += -sint*dv_t; + //Vel(dp)[0] += -sint*dv_t; Vel(dp)[1] += cost*dv_t; } @@ -302,12 +321,31 @@ real took(real r) void spectrum(void) { - double mtot = 0.0; + real mtot = 0.0; + real vrad, vrad_max = -1.0; Body *dp; - int i; + int i, iv; + Grid g; + real *spectrum = (real *) allocate(nvel*sizeof(real)); + // nvel needs to be even for symmetric profiles + + inil_grid(&g, nvel, 0, vrange); for (dp=disk, i = 0; i < ndisk; dp++, i++) { /* loop over all stars */ + vrad = ABS(Vel(dp)[1]); + if (vrad > vrange) continue; + if (vrad > vrad_max) vrad_max = vrad; mtot += Mass(dp); + iv = index_grid(&g, vrad); + spectrum[iv] += Mass(dp); } - printf("Total mass: %g ndisk=%d\n", mtot, ndisk); + printf("# Total mass: %g ndisk=%d vrad_max: %g\n", mtot, ndisk, vrad_max); + for (i=0; i 0) warning("no smoothing done yet"); } From 5d66b1ee1ea7a75b9250604121feb593565b7ab9 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 7 Dec 2024 04:41:26 -0500 Subject: [PATCH 062/149] add a section of falcon2 --- docs/source/codes.rst | 2 ++ docs/source/progr.rst | 35 ++++++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/docs/source/codes.rst b/docs/source/codes.rst index 872200eae..fdc8b14b7 100644 --- a/docs/source/codes.rst +++ b/docs/source/codes.rst @@ -20,6 +20,8 @@ that have a tighter connection to NEMO: .. include:: starlab.rst +.. include:: falcon2.rst + .. include:: rebound.rst .. include:: galpy.rst diff --git a/docs/source/progr.rst b/docs/source/progr.rst index f0f464a8d..ecded0afa 100644 --- a/docs/source/progr.rst +++ b/docs/source/progr.rst @@ -24,17 +24,17 @@ We start by looking at the *Hello Nemo* program: .. code-block:: C - #include /* standard (NEMO) definitions */ + #include /* 1. standard (NEMO) definitions */ - string defv[] = { /* standard keywords and default values and help */ + string defv[] = { /* 2. standard keywords and default values and help */ "n=10\n Number of interations", /* key1 */ "VERSION=1.2\n 25-may-1992 PJT", /* key2 */ NULL, /* standard terminator of defv[] vector */ }; - string usage = "Example NEMO program 'hello'"; /* usage help text */ + string usage = "Example NEMO program 'hello'"; /* 3. usage help text */ - void nemo_main() /* standard start of any NEMO program */ + void nemo_main() /* 4. standard start of any NEMO program */ { int n = getiparam("n"); /* get n */ @@ -42,6 +42,18 @@ We start by looking at the *Hello Nemo* program: if (n < 0) /* deal with fatal */ error("n=%d is now allowed, need >0",n); /* errors */ } + + +Although this looks like C, there are four odd looking ways a typical NEMO program +is structured. + +1. An include file that captures NEMO definitions (such as string) +2. A global string array defv/[] that defines the command line user interface +3. A global string that captures a usage +4. A global function nemo_main() that defines the starting point of the NEMO program + +The standard C main() is present in the NEMO library, with which each program +is linked, but ensures the program is set up for the NEMO environment. @@ -50,20 +62,25 @@ The NEMO Programming Environment The modifications necessary to your UNIX environment in order to access NEMO are extensively described elsewhere. This not only -applies to a user, but also to the application programmer. +applies to a user, but also to developers. In summary, the essential changes to your environment consist of one simple additions to your local shell startup file -or you can do it interactively in your shell (be it sh or csh like). +or you can do it interactively in your shell, viz. .. code-block:: bash % source /opt/nemo/nemo_start.sh - or - % source /opt/nemo/nemo_start.csh where the location of NEMO=/opt/nemo is something that will likely -be different for you. +be different for you. This example is for bash-like shells, there +is a similar file for csh, and there is also an option so use modules, +such that a command like this will work: + +.. code-block:: bash + + % module load nemo + The NEMO Macro Packages From 1fc56ad32384f854c21a2aedaf52b20a9a58bfa9 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 7 Dec 2024 08:29:13 -0500 Subject: [PATCH 063/149] initial examples for falcon2 --- docs/source/falcon2.rst | 96 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 docs/source/falcon2.rst diff --git a/docs/source/falcon2.rst b/docs/source/falcon2.rst new file mode 100644 index 000000000..70e5037e9 --- /dev/null +++ b/docs/source/falcon2.rst @@ -0,0 +1,96 @@ +FALCON2 +------- + + +The falcon V2 package is still under development for a public release. The main +integrator is now called griffin, replacing the old gyrfalcON from falcon V1. + +Installation +~~~~~~~~~~~~ + +Hopefully soon we can use + +.. code-block:: + + mknemo falcON2 + +but unless you are a close collaborator, this will likely not be working. + +This type of install would place the package in ``$NEMO/local/falcon2``. + + + +Examples +~~~~~~~~ + + +For details on a specific program, type + +.. code-block:: + + program --help + + +- Create a Plummer sphere with 100 particlces + +.. code-block:: + + mkplummer p100.in 100 + +- View the contents of this HDF5 dataset + +.. code-block:: + + dump p100.in + +- Convert falcon2 HDF5 files to NEMO snapshot, and recview junk like the dump program + + s2a p100.in | tabcomment - - delete=t | tabtos - p100.bsf block1=m,pos,vel,skip nbody=100 + tsf p100.bsf + + +- Comparing falcon1 with falcon2 + +.. code-block:: + + # some parameters + nbody=10 + eps=0.05 + kmax=8 + tstop=1 + # + rm p1.* + mkplummer p1.in $nbody time=0 + griffin p1.in p1.out step=1 tstop=$tstop eps=$eps tau=2^-$kmax + # 8.7sec + + s2a p1.in | tabcomment - - delete=t | tabtos - p1.bsf block1=m,pos,vel,skip nbody=$nbody + gyrfalcON p1.bsf p1.out2 step=1 tstop=$tstop eps=$eps kmax=$kmax + # 0.6 sec + + # comparing initials (notice p1.out does not contain times=0) + echo "=== Initial conditions ===" + s2a p1.in times=0 | tabcols - 2:7 + snapprint p1.out2 times=0 format=%11.9e + + + # comparing final + echo "=== Final snapshot ===" + s2a p1.out times=$tstop | tabcols - 2:7 + snapprint p1.out2 times=$tstop format=%11.9e + + +but where timescales need to be checked + +- Comparing X and Y + + +Surprises +~~~~~~~~~ + +- dump --help + + does not show the help we usually see, but seems to think --help is a file + + +- griffin does From b4ca1c16ec438ea5a091a04141d9e61cc01a2716 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 7 Dec 2024 08:32:41 -0500 Subject: [PATCH 064/149] reflect the current state of falcon2 --- src/scripts/mknemo.d/falcON2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/scripts/mknemo.d/falcON2 b/src/scripts/mknemo.d/falcON2 index 73c1dcc09..26313f076 100755 --- a/src/scripts/mknemo.d/falcON2 +++ b/src/scripts/mknemo.d/falcON2 @@ -4,15 +4,18 @@ set url=git@bitbucket.org:WalterDehnen/falcon.git set url=git@bitbucket.org:astroteuben/falcon2.git +set url=git@bitbucket.org:peter_teuben/falcon.git set dir=falcon2 +set branch=autoconf cd $NEMO/local if (! -e $dir) then - git clone $url + git clone $url $dir cd $dir else cd $dir git pull endif +git checkout $branch echo "Installation is still manual. See INSTALL.md" From ac8ddc37957c1ea93a78970d96ebc1f472a49772 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sat, 7 Dec 2024 18:34:23 -0500 Subject: [PATCH 065/149] add CLI reminders --- docs/source/falcon2.rst | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/docs/source/falcon2.rst b/docs/source/falcon2.rst index 70e5037e9..594e2c3ad 100644 --- a/docs/source/falcon2.rst +++ b/docs/source/falcon2.rst @@ -3,7 +3,11 @@ FALCON2 The falcon V2 package is still under development for a public release. The main -integrator is now called griffin, replacing the old gyrfalcON from falcon V1. +integrator is now called ``griffin``, replacing the older ``gyrfalcON`` from falcon V1. +Although falcon V1 will be distributed with NEMO, it is not maintained and may eventually +succumb to software rot. + +A paper describing the ``griffin`` code is in *arXiv* ... Installation ~~~~~~~~~~~~ @@ -16,7 +20,22 @@ Hopefully soon we can use but unless you are a close collaborator, this will likely not be working. -This type of install would place the package in ``$NEMO/local/falcon2``. +This type of install would place the package in ``$NEMO/local/falcon2``, the +file ``INSTALL.md`` describes the installation procedure. + + + +Command Line Interface +~~~~~~~~~~~~~~~~~~~~~~ + +Although the CLI will look familiar to NEMO users, there are some salient differents. +Some highlights: + +- the CLI is a set of ``key=val``, like NEMO. If given in order, the ``key=`` portion can be + omitted, leaving just a series of values. This not recommended in scripts. +- ``--help`` describes the keywords and some help, much like the ``help=h`` option in NEMO +- ``help=1`` shows hidden CLI options (NEMO doesn't have hidden options) + @@ -93,4 +112,12 @@ Surprises does not show the help we usually see, but seems to think --help is a file -- griffin does +- griffin does + +- "griffin --help" + + says: "please provide 'out', 'tau', 'eps'" + why complain, we didn't attempt to run. + +- mkplummer has a keyword 'q-ran', but itsn't it better to use q_ran, since that's + a more common one used in all falcon programs. keep it consistent. From a9e264ddc517dc719fa7b1294184009c55030e64 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 8 Dec 2024 02:36:33 -0500 Subject: [PATCH 066/149] recover commit? --- docs/source/falcon2.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/source/falcon2.rst b/docs/source/falcon2.rst index 594e2c3ad..429ea668e 100644 --- a/docs/source/falcon2.rst +++ b/docs/source/falcon2.rst @@ -9,6 +9,10 @@ succumb to software rot. A paper describing the ``griffin`` code is in *arXiv* ... +.. warning:: + Adding FALCON2 to NEMO will result in some programs that have duplicated names, e.g. ``mkplummer`` + + Installation ~~~~~~~~~~~~ @@ -28,13 +32,14 @@ file ``INSTALL.md`` describes the installation procedure. Command Line Interface ~~~~~~~~~~~~~~~~~~~~~~ -Although the CLI will look familiar to NEMO users, there are some salient differents. +Although the CLI will look familiar to NEMO users, there are some salient differences. Some highlights: -- the CLI is a set of ``key=val``, like NEMO. If given in order, the ``key=`` portion can be +- the CLI is a set of ``key=val``, like in NEMO. If given in order, the ``key=`` portion can be omitted, leaving just a series of values. This not recommended in scripts. - ``--help`` describes the keywords and some help, much like the ``help=h`` option in NEMO - ``help=1`` shows hidden CLI options (NEMO doesn't have hidden options) +- ``debug=`` @@ -62,7 +67,7 @@ For details on a specific program, type dump p100.in -- Convert falcon2 HDF5 files to NEMO snapshot, and recview junk like the dump program +- Convert falcon2 HDF5 files to NEMO snapshot, and review like the ``dump`` program s2a p100.in | tabcomment - - delete=t | tabtos - p100.bsf block1=m,pos,vel,skip nbody=100 tsf p100.bsf @@ -121,3 +126,5 @@ Surprises - mkplummer has a keyword 'q-ran', but itsn't it better to use q_ran, since that's a more common one used in all falcon programs. keep it consistent. + +- .. From 320980a75e20704b2c13242645f10104dc183d3b Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 8 Dec 2024 02:36:33 -0500 Subject: [PATCH 067/149] mkplummer comment --- docs/source/falcon2.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/source/falcon2.rst b/docs/source/falcon2.rst index 429ea668e..c31c86730 100644 --- a/docs/source/falcon2.rst +++ b/docs/source/falcon2.rst @@ -127,4 +127,6 @@ Surprises - mkplummer has a keyword 'q-ran', but itsn't it better to use q_ran, since that's a more common one used in all falcon programs. keep it consistent. -- .. +- mkplummer has a default time=1 + + From 3516e6ac1230911c992edefa692b98d2d1d84e0d Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 8 Dec 2024 02:36:33 -0500 Subject: [PATCH 068/149] dot --- docs/source/falcon2.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/falcon2.rst b/docs/source/falcon2.rst index c31c86730..154ecb86e 100644 --- a/docs/source/falcon2.rst +++ b/docs/source/falcon2.rst @@ -129,4 +129,4 @@ Surprises - mkplummer has a default time=1 - +- .. From 7a187ea856e5c4d5dcc98f8ac190a2eebc353976 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 8 Dec 2024 02:36:33 -0500 Subject: [PATCH 069/149] kmax/tau --- docs/source/falcon2.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/source/falcon2.rst b/docs/source/falcon2.rst index 154ecb86e..bf47e1085 100644 --- a/docs/source/falcon2.rst +++ b/docs/source/falcon2.rst @@ -104,7 +104,7 @@ For details on a specific program, type snapprint p1.out2 times=$tstop format=%11.9e -but where timescales need to be checked +but griffin is more accurate and such a direct comparison may not be fair. In particular, is tau=2^-$kmax even fair? - Comparing X and Y @@ -112,6 +112,8 @@ but where timescales need to be checked Surprises ~~~~~~~~~ +to be resolved + - dump --help does not show the help we usually see, but seems to think --help is a file From 0b8a1f74e963055f2c43b503d82981b32c0057e5 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 8 Dec 2024 02:36:33 -0500 Subject: [PATCH 070/149] added falcon2 --- man/man8/programs.8 | 76 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 12 deletions(-) diff --git a/man/man8/programs.8 b/man/man8/programs.8 index 03f12919b..28d56ff5a 100644 --- a/man/man8/programs.8 +++ b/man/man8/programs.8 @@ -1,8 +1,10 @@ .\" pjt -.TH PROGRAMS 8NEMO "6 February 2021" -.SH NAME +.TH "PROGRAMS" 8NEMO "8 December 2024" + +.SH "NAME" programs \- list of currently available nemo(1NEMO) commands, ordered thematically -.SH DESCRIPTION + +.SH "DESCRIPTION" These are some of the tasks currently available under to run under NEMO. If a program name is preceded by a dash (\fB-\fP) they do not have NEMO's \fIgetparam(3NEMO)\fP user interface @@ -19,6 +21,7 @@ yet. Programs we don't have are in \fIother(8NEMO)\fP ... .PP This thematic style was inspired by GIPSY. + .SH "1. GENERAL INFORMATION (only doc/man)" .nf .ta +2.0i @@ -32,15 +35,17 @@ usageeta10 some comments on ETA-10 usage [8] cookbook a quick list of what to do to run (e.g.) treecode on the 205 [8] tricks useful tricks and bug detours [8] .fi + .SH "2. UTILITY" .nf .ta +2.0i mknemo compile NEMO progams, out of directory --nemoshow check environment, show NEMO system variables/keywords +-nemoshow check environment, show NEMO system variables/keywords [deprecated] nemoman create a template man pages from a compiled program -nemoinp test parsing of numbers -units units conversion utility (unix) +nemoinp test parsing of numbers (alias: \fBni\fP) +units units conversion utility (unix) [deprecated] .fi + .SH "3. DATA CONVERSION" .nf .ta +2.0i @@ -68,14 +73,16 @@ unfio access fortran unformatted I/O files units units conversion utility wcs (astronomical) world coordinate system transformations .fi + .SH "4. N-BODY REALIZATIONS" .nf .ta +2.0i -anisot create distribution function table for anistropic spherical models +anisot create distribution function table for anistropic spherical models [deprecated] mkommod anisotropic velocity distribution (Merritt) mkplum plummer model (falcON) -mkplummer plummer model +mkplummer plummer model (falcON2 and ZENO as well) mkdisk uniform disk of test-particles in external potential +mkdisc make a disk (falcON2) mkspiral uniform disk of test-particles with logarithmic spiral mkpolytrope polytrope sphere mkbaredisk almost stable disk... @@ -92,6 +99,7 @@ mkkd95 Kuijken-Dubinski-95 composite disk-bulge-halo model mkgalaxy McMillan/Dehnen composite galaxy models (falcON) magalie Boily et al. composite disk-bulge-halo model .fi + .SH "5. N-BODY INTEGRATORS" .nf .ta +2.0i @@ -108,10 +116,12 @@ nbody4 Hermite N-body code with optional stellar evolution newton0* multi-purpose N-body integrator gravsim0 frontend for the GRAVSIM family of integrators gyrfalcON a superberb N-body tree code +griffin a better gyrfalcON galaxy 3D FFT N-body code scfm N-body integrator using the self-consistent field method -mass99 SPH code .fi + .SH "6. PLOTTING, PRINTING" .nf .ta +2.0i @@ -131,6 +141,7 @@ plarrow_ps plot an arrow in postscript pltext_ps plot text in postscript -movie,movie_sv display screendumps in orderly fashion mkcolor create color table + .SH "7. 2D and 3D IMAGE UTILITIES" .nf .ta +2.0i @@ -151,6 +162,7 @@ ccdsub subset/average of an image snapaxsym Axisymetric image view of a snapshot -ds image display program (suntools) .fi + .SH "8. ORBIT UTILITIES" .nf .ta +2.0i @@ -165,6 +177,7 @@ potlist show potential and forces of \fIpotential(5NEM0)\fP file pspeed Tremaine & Weinberg pattern speed of system perorb search for periodic orbits .fi + .SH "9. MANIPULATION" .nf .ta +2.0i @@ -188,12 +201,14 @@ snapplotedit interactive graphics editor for N-body snapshots snapdens local density estimator using nearest neighbor hackdens local density estimator using nearest neighbor and tree .fi + .SH "10. COMBINATION" .nf .ta +2.0i snapstack add snapshots, optional offset them snapadd .fi + .SH "11. ANALYSIS" .nf .ta +2.0i @@ -211,6 +226,7 @@ unbind unbind stars from a system snapstab report on stability of a stellar system snapfour fourier analyze a snapshot .fi + .SH "13. TABLE MANIPULATIONS" .nf .ta +2.0i @@ -235,6 +251,7 @@ ccdfits write a fits file to disk fitsccd read a (fits) image file from disk sdinfo info and benchmarking SDFITS files .fi + .SH "15. MODEL FITTING and ANALYSIS" .nf .ta +2.0i @@ -247,6 +264,7 @@ ccdvel create theoretical velocity field rotcurves rotation curve of a composite potentials snapfit fit a (6D) snapshot to a (3D) data cube .fi + .SH "16. STARLAB" .nf .ta +2.0i @@ -254,24 +272,58 @@ dtos convert STARLAB dyn to NEMO snapshot stod convert a NEMO snapshot to a STARLAB dyn tabpairs analyze interaction histories of stars in a starlab simulation .fi -.SH "17. ASTRONOMY" + +.SH "17. FALCON2" +.nf +.ta +2.0i +a2s ascii to HDF5 snapshot converter +calc a simple calculator +corerad find core radius & density +dump dump a hdf5 snapshot file to stdout +gravity add gravity to snapshot(s) +griffin N-body code +join join falcON snapshot files +manipulate use manipulators on falcON snapshots +mkdisc make a simple circum-stellar gas disc +mkgrid construct (possibly perturbed) fcc packing +mkparker set up a parker wind +mkplummer construct plummer sphere +mkpolytrope construct a polytropic gas sphere +mksphere initial conditions from an equilibrium distribution function +mkstar make a single or binary star +s2a snapshot to ascii converter +s2s copy and manipulate falcON snapshots +setH adapt SPH smoothing lengths +snapprop evaluates bodies function over snapshot, reports to stdout +sphinx SPH code +symmetrize symmetrizes snapshots; can also be used to reduce N +.fi + +.SH "99. ASTRONOMY" .nf .ta +2.0i wcs (astronomical) world coordinate system transformations +ccdfits convert image to a fits file +ccdsky lazy sky scaling (cosmology) calculator .fi -.SH AUTHOR + +.SH "AUTHOR" Peter Teuben + .SH "SEE ALSO" .nf index(1NEMO), other(8NEMO), software(8NEMO) -\fIThe NEMO Users/Programmers Manual\fP +https://astronemo.readthedocs.io/en/latest/index.html .fi + .SH "UPDATE HISTORY" .nf -.ta +1.0i +4.0i +.ta +1.25i +4.5i 16-Mar-87 created PJT 7-jun-88 ..another update PJT 16-dec-88 .. PJT 10-feb-90 .. PJT 4-mar-92 updated PJT +8-dec-2024 added FALCON2 PJT + .fi From 77e412cb90cd3730cff4cf4d1eedf2e0d670d942 Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Sun, 8 Dec 2024 02:36:33 -0500 Subject: [PATCH 071/149] added falcon2 --- docs/whatsnew.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/whatsnew.html b/docs/whatsnew.html index 7eb23485e..5a702f739 100644 --- a/docs/whatsnew.html +++ b/docs/whatsnew.html @@ -24,11 +24,12 @@

    What's New in NEMO

    4.4.3/4.4.4: in git