Board index Other Hangar talk

Fictional exoplanet creation

Talk about (almost) anything, as long as it is no serious FlightGear talk and does not fit in the other subforums.
Forum rules
Please refrain from discussing politics.

Fictional exoplanet creation

Postby Thorsten » Thu Dec 02, 2021 7:15 pm

I'm currently dusting off and documenting an old project of mine - a set of simulation tools for conditions on a fictional exoplanet. It can answer the question how climate on Earth changes of you replace the Sun by a White Dwarf, or if you tilt Earth's axis by 60 degrees, or if you put Earth on Mars orbit.

It can even do the last stable orbit around a black hole, and in a simple implementation it allows to compute the Greenhouse effect.

I've used it quite a lot for SciFi story writing to get the physics of my worlds right and to assess how close to a black hole a spaceship could possibly go without running out of fuel.

The code is now public, it's GPL and a tutorial series is growing.

http://www.science-and-fiction.org/scie ... ilder.html

Enjoy!
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Fictional exoplanet creation

Postby Hooray » Fri Dec 03, 2021 7:05 pm

Hi,

just wondering: this being C++ and GPL'ed, have you considered getting this committed/contributed to SimGear or FlightGear respectively ?
The point being, a number of folks have been contemplating reaching for the stars

So, maybe getting this commited to FlightGear would allow our FDM folks to tinker with different world models some day ?
Besides, your work also being committed to the official repos would mean that you don't have to bother about hosting etc
There already is a growing number of 3rd party utiltis (src/utils) in $FG_SRC, so this could probably be added "as is" ?

The code itself being in C++ also means that we could expose this to scripting space easily to allow people to tinker with this right inside fgfs (possiby via the Nasal console).

Adding support for other planets/celestial bodies is a recurring idea in both, the JSBSim and FGFS communities - so maybe growing a suite of related tooling could help pave the way for this in the time to come (I do remember folks asking for a configurable/different atmosphere model, too)?

Again, this isn't asking for any specific work other than getting this committed to $FG_SRC/utils, in addition to your current hosting - which could be considered in line with efforts like the space shuttle, but also the Earthview project ...
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Fictional exoplanet creation

Postby Thorsten » Fri Dec 03, 2021 7:19 pm

this being C++ and GPL'ed, have you considered getting this committed/contributed to SimGear or FlightGear respectively ?


No, as I see no useful application or overlap.

I'm not sure you realize what the package does - generally it is a good sandbox if you have a background in astrophysics/orbital mechanics/... and want to explore a few ideas, but it has a massive GIGO potential if you 'just' go ahead.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Fictional exoplanet creation

Postby Hooray » Fri Dec 03, 2021 7:52 pm

nope, I'd say it's safe to say I probably understand between 0.1% and 1% :lol:
Seriously though, you are undoubtedly in a better position to judge if any of your code could be of interest to people wanting to reach for the stars in FlightGear, so no need for a pointless discussion :wink:
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Fictional exoplanet creation

Postby omega13a » Tue Dec 21, 2021 9:05 am

I got it to compile on linux but everytime I run it I get this warning:
Code: Select all
Segmentation fault (core dumped)

If it helps, there were some warnings when I went to compile.
Code: Select all
[omega13a@localhost-live src]$ make worldbuilder
g++ -o worldbuilder.o -c worldbuilder.cxx
In file included from worldbuilder.cxx:16:
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_x(int, double)’:
orbital_solver.hxx:68:81: warning: no return statement in function returning non-void [-Wreturn-type]
   68 |           double set_x(int index, double set_x) {x[index] = (long double) set_x;}
      |                                                                                 ^
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_y(int, double)’:
orbital_solver.hxx:69:81: warning: no return statement in function returning non-void [-Wreturn-type]
   69 |           double set_y(int index, double set_y) {y[index] = (long double) set_y;}
      |                                                                                 ^
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_z(int, double)’:
orbital_solver.hxx:70:81: warning: no return statement in function returning non-void [-Wreturn-type]
   70 |           double set_z(int index, double set_z) {z[index] = (long double) set_z;}
      |                                                                                 ^
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_vx(int, double)’:
orbital_solver.hxx:71:85: warning: no return statement in function returning non-void [-Wreturn-type]
   71 |           double set_vx(int index, double set_vx) {vx[index] = (long double) set_vx;}
      |                                                                                     ^
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_vy(int, double)’:
orbital_solver.hxx:72:85: warning: no return statement in function returning non-void [-Wreturn-type]
   72 |           double set_vy(int index, double set_vy) {vy[index] = (long double) set_vy;}
      |                                                                                     ^
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_vz(int, double)’:
orbital_solver.hxx:73:85: warning: no return statement in function returning non-void [-Wreturn-type]
   73 |           double set_vz(int index, double set_vz) {vz[index] = (long double) set_vz;}
      |                                                                                     ^
g++ -o star.o -c star.cxx
g++ -o planet.o -c planet.cxx
g++ -o orbital_solver.o -c orbital_solver.cxx
In file included from orbital_solver.cxx:29:
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_x(int, double)’:
orbital_solver.hxx:68:81: warning: no return statement in function returning non-void [-Wreturn-type]
   68 |           double set_x(int index, double set_x) {x[index] = (long double) set_x;}
      |                                                                                 ^
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_y(int, double)’:
orbital_solver.hxx:69:81: warning: no return statement in function returning non-void [-Wreturn-type]
   69 |           double set_y(int index, double set_y) {y[index] = (long double) set_y;}
      |                                                                                 ^
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_z(int, double)’:
orbital_solver.hxx:70:81: warning: no return statement in function returning non-void [-Wreturn-type]
   70 |           double set_z(int index, double set_z) {z[index] = (long double) set_z;}
      |                                                                                 ^
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_vx(int, double)’:
orbital_solver.hxx:71:85: warning: no return statement in function returning non-void [-Wreturn-type]
   71 |           double set_vx(int index, double set_vx) {vx[index] = (long double) set_vx;}
      |                                                                                     ^
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_vy(int, double)’:
orbital_solver.hxx:72:85: warning: no return statement in function returning non-void [-Wreturn-type]
   72 |           double set_vy(int index, double set_vy) {vy[index] = (long double) set_vy;}
      |                                                                                     ^
orbital_solver.hxx: In member function ‘double OrbitalSystem::set_vz(int, double)’:
orbital_solver.hxx:73:85: warning: no return statement in function returning non-void [-Wreturn-type]
   73 |           double set_vz(int index, double set_vz) {vz[index] = (long double) set_vz;}
      |                                                                                     ^
g++ -o surface.o -c surface.cxx
g++ -o material.o -c material.cxx
g++ -o gases.o -c gases.cxx
g++ -o atmosphere.o -c atmosphere.cxx
g++ -o utilities.o -c utilities.cxx
g++ -o world worldbuilder.o star.o planet.o orbital_solver.o surface.o material.o gases.o atmosphere.o utilities.o -lm


I'm using Fedora 35 with all the latest updates as of today.
Fish need Bicycles!
User avatar
omega13a
 
Posts: 246
Joined: Thu Apr 13, 2017 9:07 am
Location: California

Re: Fictional exoplanet creation

Postby Thorsten » Tue Dec 21, 2021 10:56 am

What happens if you fix those (aka simply make the functions return void as they should)?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Fictional exoplanet creation

Postby omega13a » Tue Dec 21, 2021 10:59 am

Thorsten wrote in Tue Dec 21, 2021 10:56 am:What happens if you fix those (aka simply make the functions return void as they should)?

I tried that, it still gives me the Segmentation fault message.
Fish need Bicycles!
User avatar
omega13a
 
Posts: 246
Joined: Thu Apr 13, 2017 9:07 am
Location: California

Re: Fictional exoplanet creation

Postby omega13a » Tue Dec 21, 2021 11:06 am

Sorry for the double post but here's a backtrace if it helps:
Code: Select all
[omega13a@localhost-live src]$ gdb --args ./world ./example02.cfg 2>&1
GNU gdb (GDB) Fedora 11.1-5.fc35
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./world...
(gdb) handle SIGPIPE nostop noprint
Signal        Stop   Print   Pass to program   Description
SIGPIPE       No   No   Yes      Broken pipe
(gdb) run
Starting program: /home/omega13a/worldbuilder/src/world ./example02.cfg
Downloading 0.01 MB separate debug info for /home/omega13a/worldbuilder/src/system-supplied DSO at 0x7ffff7fc8000...
Downloading -0.00 MB separate debug info for /lib64/libstdc++.so.6...
Downloading -0.00 MB separate debug info for /home/omega13a/.cache/debuginfod_client/64dc8524cb0109c7f3d3c0ef3d4d6ec9979db75c/debuginfo...
Downloading -0.00 MB separate debug info for /lib64/libm.so.6...
Downloading -0.00 MB separate debug info for /lib64/libgcc_s.so.1...
Downloading -0.00 MB separate debug info for /lib64/libc.so.6...
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000415516 in read_array (name="data/co2.dat", array=array@entry=0x5435c8 <planet+601416>, normalization=normalization@entry=5) at utilities.cxx:71
71         array[counter][1] = normalization * data;
(gdb) bt full
#0  0x0000000000415516 in read_array (name="data/co2.dat", array=array@entry=0x5435c8 <planet+601416>, normalization=normalization@entry=5) at utilities.cxx:71
        counter = 9123
        data = 0
        fin = {<std::basic_istream<char, std::char_traits<char> >> = {<std::basic_ios<char, std::char_traits<char> >> = {<std::ios_base> = {
                _vptr.ios_base = 0x41acf0 <vtable for std::basic_ifstream<char, std::char_traits<char> >@GLIBCXX_3.4+64>, static boolalpha = std::_S_boolalpha, static dec = std::_S_dec, static fixed = std::_S_fixed,
                static hex = std::_S_hex, static internal = std::_S_internal, static left = std::_S_left, static oct = std::_S_oct, static right = std::_S_right, static scientific = std::_S_scientific,
                static showbase = std::_S_showbase, static showpoint = std::_S_showpoint, static showpos = std::_S_showpos, static skipws = std::_S_skipws, static unitbuf = std::_S_unitbuf, static uppercase = std::_S_uppercase,
                static adjustfield = std::_S_adjustfield, static basefield = std::_S_basefield, static floatfield = std::_S_floatfield, static badbit = std::_S_badbit, static eofbit = std::_S_eofbit, static failbit = std::_S_failbit,
                static goodbit = std::_S_goodbit, static app = std::_S_app, static ate = std::_S_ate, static binary = std::_S_bin, static in = std::_S_in, static out = std::_S_out, static trunc = std::_S_trunc, static beg = std::_S_beg,
                static cur = std::_S_cur, static end = std::_S_end, _M_precision = 6, _M_width = 0, _M_flags = 4098, _M_exception = std::_S_goodbit, _M_streambuf_state = std::_S_failbit, _M_callbacks = 0x0, _M_word_zero = {
                  _M_pword = 0x0, _M_iword = 0}, _M_local_word = {{_M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {
                    _M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}}, _M_word_size = 8, _M_word = 0x7fffffffdb10, _M_ios_locale = {static none = 0, static ctype = 1, static numeric = 2,
                  static collate = 4, static time = 8, static monetary = 16, static messages = 32, static all = 63, _M_impl = 0x7ffff7fa8ce0 <(anonymous namespace)::c_locale_impl>}}, _M_tie = 0x0, _M_fill = 0 '\000',
              _M_fill_init = false, _M_streambuf = 0x7fffffffd9e0, _M_ctype = 0x7ffff7fa8700 <(anonymous namespace)::ctype_c>, _M_num_put = 0x7ffff7fa8690 <(anonymous namespace)::num_put_c>,
              _M_num_get = 0x7ffff7fa86a0 <(anonymous namespace)::num_get_c>}, _vptr.basic_istream = 0x41acc8 <vtable for std::basic_ifstream<char, std::char_traits<char> >@GLIBCXX_3.4+24>, _M_gcount = 0},
          _M_filebuf = {<std::basic_streambuf<char, std::char_traits<char> >> = {_vptr.basic_streambuf = 0x41ad10 <vtable for std::basic_filebuf<char, std::char_traits<char> >@GLIBCXX_3.4+16>, _M_in_beg = 0x0, _M_in_cur = 0x0,
              _M_in_end = 0x0, _M_out_beg = 0x0, _M_out_cur = 0x0, _M_out_end = 0x0, _M_buf_locale = {static none = 0, static ctype = 1, static numeric = 2, static collate = 4, static time = 8, static monetary = 16,
                static messages = 32, static all = 63, _M_impl = 0x7ffff7fa8ce0 <(anonymous namespace)::c_locale_impl>}}, _M_lock = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0,
                __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}, _M_file = {_M_cfile = 0x0, _M_cfile_created = false}, _M_mode = 0, _M_state_beg = {__count = 0, __value = {__wch = 0,
                __wchb = "\000\000\000"}}, _M_state_cur = {__count = 0, __value = {__wch = 0, __wchb = "\000\000\000"}}, _M_state_last = {__count = 0, __value = {__wch = 0, __wchb = "\000\000\000"}}, _M_buf = 0x0, _M_buf_size = 8192,
            _M_buf_allocated = false, _M_reading = false, _M_writing = false, _M_pback = 0 '\000', _M_pback_cur_save = 0x0, _M_pback_end_save = 0x0, _M_pback_init = false, _M_codecvt = 0x7ffff7fa8670 <(anonymous namespace)::codecvt_c>,
            _M_ext_buf = 0x0, _M_ext_buf_size = 0, _M_ext_next = 0x0, _M_ext_end = 0x0}}
#1  0x0000000000413deb in Gases::Gases (this=this@entry=0x5435b8 <planet+601400>) at gases.cxx:35
No locals.
#2  0x000000000040dca2 in Atmosphere::Atmosphere (this=0x5432d8 <planet+600664>) at /home/omega13a/worldbuilder/src/atmosphere.hxx:34
No locals.
#3  Planet::Planet (this=this@entry=0x4b0880 <planet>) at planet.cxx:33
No locals.
#4  0x0000000000403e78 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at worldbuilder.cxx:24
No locals.
#5  _GLOBAL__sub_I_central_sun () at worldbuilder.cxx:534
No locals.
#6  0x00007ffff7ab768d in call_init (env=<optimized out>, argv=0x7fffffffdd28, argc=2) at ../csu/libc-start.c:145
        j = 0
        jm = <optimized out>
        addrs = <optimized out>
        l = <optimized out>
        init_array = <optimized out>
#7  __libc_start_main_impl (main=0x402c60 <main(int, char**)>, argc=2, argv=0x7fffffffdd28, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdd18) at ../csu/libc-start.c:379
No locals.
#8  0x00000000004041a5 in _start ()
No symbol table info available.
Fish need Bicycles!
User avatar
omega13a
 
Posts: 246
Joined: Thu Apr 13, 2017 9:07 am
Location: California

Re: Fictional exoplanet creation

Postby Thorsten » Tue Dec 21, 2021 11:28 am

What kind of config file do you run?

(This is generally odd, as the whole thing is self-contained and compiles and runs happily here - on older Fedora-, but of course with the wrong set of options it could be thrown). I do work with an older C++ compiler, but I started this on an even older compiler and it transited problem-free.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Fictional exoplanet creation

Postby omega13a » Wed Dec 22, 2021 9:44 am

*grown* I found what was wrong. I was running the executable in the src directory where it was built and it could find the data directory...

Anyways, just out of curiosity, have you made a repo on github for the source code?
Fish need Bicycles!
User avatar
omega13a
 
Posts: 246
Joined: Thu Apr 13, 2017 9:07 am
Location: California

Re: Fictional exoplanet creation

Postby Thorsten » Wed Dec 22, 2021 10:21 am

Anyways, just out of curiosity, have you made a repo on github for the source code?


No. If I do that, it comes with expectations that I maintain it in a certain way - and I really don't have the time to do that. Right now it's my pet project, I dust it off when I find the time, tinker a bit, put it back into the drawer when something else comes up...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am


Return to Hangar talk

Who is online

Users browsing this forum: No registered users and 2 guests