From 37b7d12f0b24df4ecaafa9261a985f02b20fbc57 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 25 Jan 2022 11:29:47 +0100 Subject: [PATCH 01/72] Add initial interface for GENEC --- src/amuse/community/genec/Makefile | 102 ++++++ src/amuse/community/genec/__init__.py | 2 + src/amuse/community/genec/interface.f90 | 451 ++++++++++++++++++++++++ src/amuse/community/genec/interface.py | 312 ++++++++++++++++ 4 files changed, 867 insertions(+) create mode 100644 src/amuse/community/genec/Makefile create mode 100644 src/amuse/community/genec/__init__.py create mode 100644 src/amuse/community/genec/interface.f90 create mode 100644 src/amuse/community/genec/interface.py diff --git a/src/amuse/community/genec/Makefile b/src/amuse/community/genec/Makefile new file mode 100644 index 0000000000..2071b9d7ab --- /dev/null +++ b/src/amuse/community/genec/Makefile @@ -0,0 +1,102 @@ +# standard amuse configuration include +# config.mk will be made after ./configure has run +ifeq ($(origin AMUSE_DIR), undefined) + AMUSE_DIR := $(shell amusifier --get-amuse-dir) +endif +-include $(AMUSE_DIR)/config.mk + +MPIFC ?= mpif90 +FC = $(MPIFC) + +LDFLAGS += -lm $(MUSE_LD_FLAGS) + +# FCFLAGS += -std=f95 + +OBJS = interface.o + +CODEDIR = src/GENEC/code +INI_CODEDIR = src/GENEC/tools/makeini + +CODELIB = src/libgenec.a + +MODULES_F90_BASE = $(CODEDIR)/evol.f90 \ + $(CODEDIR)/const.f90 \ + $(CODEDIR)/caramodele.f90 \ + $(CODEDIR)/inputparam.f90 \ + $(CODEDIR)/interpolation.f90 \ + $(CODEDIR)/nagmod.f90 \ + $(CODEDIR)/SmallFunc.f90 \ + $(CODEDIR)/abundmod.f90 \ + $(CODEDIR)/diffadvmod.f90 \ + $(CODEDIR)/equadiffmod.f90 \ + $(CODEDIR)/geomod.f90 \ + $(CODEDIR)/magmod.f90 \ + $(CODEDIR)/rotmod.f90 \ + $(CODEDIR)/strucmod.f90 \ + $(CODEDIR)/ionisation.f90 \ + $(CODEDIR)/convection.f90 \ + $(CODEDIR)/timestep.f90 \ + $(CODEDIR)/PrintAll.f90 \ + $(CODEDIR)/omegamod.f90 \ + $(CODEDIR)/EOS.f90 \ + $(CODEDIR)/nablas.f90 \ + $(CODEDIR)/energy.f90 \ + $(CODEDIR)/opacity.f90 \ + $(CODEDIR)/envelope.f90 \ + $(CODEDIR)/LayersShift.f90 \ + $(CODEDIR)/advection.f90 \ + $(CODEDIR)/diffusion.f90 \ + $(CODEDIR)/chemicals.f90 \ + $(CODEDIR)/bintidemod.f90 \ + $(CODEDIR)/winds.f90 \ + $(INI_CODEDIR)/inichemmod-amuse.f90 \ + $(INI_CODEDIR)/interpolmod.f90 \ + $(INI_CODEDIR)/modinimod.f90 + +MODULES_F90 = $(MODULES_F90_BASE) \ + $(CODEDIR)/PGPlotModule_Null.f90 \ + $(CODEDIR)/henyey_solver.f90 \ + $(CODEDIR)/WriteSaveClose.f90 \ + $(CODEDIR)/genec.f90 +# SOURCES_F90 = $(CODEDIR)/main.f90 + + +MODULES_F90_ALL = $(MODULES_F90) \ + $(MODULES_F90_MAKEINI) \ + $(CODEDIR)/amuse.f90 + +MODULES=$(MODULES_F90_ALL:%.f90=%.o) +# SOURCES=$(SOURCES_F90:%.f90=%.o) + +OBJECTS=$(MODULES) # $(SOURCES) + +all: genec_worker + +clean: + $(RM) -rf __pycache__ + $(RM) -f *.so *.o *.pyc worker_code.cc worker_code.h + $(RM) *~ genec_worker worker_code.f90 + $(RM) $(CODELIB) + $(RM) $(CODEDIR)/*.o + $(RM) $(INI_CODEDIR)/*.o + $(RM) *.mod + # make -C $(CODEDIR) -f make_amuse clean + +distclean: clean + make -C src distclean + +$(CODELIB): $(OBJECTS) + @echo "==========LINKING=========" + @echo "Fortran options: $(FFLAGS) $(LDFLAGS) --> $(CODELIB)" + ar rc $(CODELIB) $(OBJECTS) + # @$(COMPILER) -shared $(FFLAGS) $(OBJECTS) $(LDFLAGS) -o $(CODELIB) + + +worker_code.f90: interface.py + $(CODE_GENERATOR) --type=f90 interface.py GenecInterface -o $@ + +genec_worker: worker_code.f90 $(CODELIB) $(OBJS) + $(MPIFC) $(FCFLAGS) $(FS_FLAGS) $< $(OBJS) $(CODELIB) $(FS_LIBS) -o $@ + +%.o: %.f90 + $(FC) $(FCFLAGS) -c -o $@ $< diff --git a/src/amuse/community/genec/__init__.py b/src/amuse/community/genec/__init__.py new file mode 100644 index 0000000000..fac883d30b --- /dev/null +++ b/src/amuse/community/genec/__init__.py @@ -0,0 +1,2 @@ +# generated file +from .interface import Genec diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 new file mode 100644 index 0000000000..af94333002 --- /dev/null +++ b/src/amuse/community/genec/interface.f90 @@ -0,0 +1,451 @@ +function initialize_code() + use WriteSaveClose, only: quitafterclosing + use genec, only: initialise_genec, amuseinterface + use amuse_helpers, only: set_defaults + use amuse_helpers, only: mstar, zini, starname + use evol, only: input_dir + implicit none + integer:: initialize_code + + amuseinterface = .true. + input_dir = "./src/GENEC/code" + call initialise_genec() + call set_defaults() + starname = "AmuseDefaultStar" + mstar = 7.0 + zini = 0.014 + quitafterclosing = .false. + + initialize_code = 0 +end function + +function cleanup_code() + implicit none + integer:: cleanup_code + cleanup_code = 0 +end function + +function commit_parameters() + implicit none + integer:: commit_parameters + commit_parameters = 0 +end function + +function commit_particles() + use amuse_helpers, only: initialise_star, makeini + use WriteSaveClose, only: OpenAll + implicit none + integer:: commit_particles + call makeini() + !write(*,*) 'makeini done' + call OpenAll() + !write(*,*) 'OpenAll done' + call initialise_star() + !write(*,*) 'initialise_star done' + commit_particles = 0 +end function + +function delete_star() + implicit none + integer:: index_of_the_star + integer:: delete_star + delete_star = -1 ! not supported +end function + +function evolve_model(end_time) + use timestep, only: alter + use WriteSaveClose, only: OpenAll + use genec, only: evolve, modell, finalise, initialise_star + implicit none + double precision:: end_time + integer:: evolve_model + do while (alter < end_time) + write(*,*) "Current time: ", alter, ", evolving to: ", end_time + modell = 1 + call evolve() + call finalise() + call OpenAll() + call initialise_star() + end do + evolve_model = 0 +end function + +function evolve_for(index_of_the_star, time) + ! get current time + ! set max time to current time plus argument + ! evolve + use timestep, only: alter + use WriteSaveClose, only: OpenAll + use genec, only: evolve, modell, finalise, initialise_star + implicit none + integer:: index_of_the_star + double precision:: time, end_time + integer:: evolve_for + !if (alter == 0.) then + ! call initialise_star() + !endif + end_time = alter+time + do while (alter < end_time) + write(*,*) "Current time: ", alter, ", evolving to: ", end_time + modell = 1 + call evolve() + call finalise() + call OpenAll() + call initialise_star() + end do + + evolve_for = 0 +end function + +function evolve_one_step(index_of_the_star) + use timestep, only: alter + use WriteSaveClose, only: OpenAll + use genec, only: evolve, modell, finalise, initialise_star + implicit none + integer:: index_of_the_star + integer:: evolve_one_step + write(*,*) "Evolving one step, current time: ", alter + modell = 1 + call evolve() + call finalise() + call OpenAll() + call initialise_star() + write(*,*) "Evolved one step, current time: ", alter + evolve_one_step = 0 +end function + +function get_age(index_of_the_star, age) + use timestep, only: alter + implicit none + integer:: index_of_the_star + double precision:: age + integer:: get_age + age = alter + get_age = 0 +end function + +function get_density_at_zone(index_of_the_star, zone, rho_i) + use strucmod, only: rho, m + implicit none + integer:: index_of_the_star + integer:: zone + double precision:: rho_i + integer:: get_density_at_zone + if (zone <= m) then + rho_i = exp(rho(m-zone)) + end if + get_density_at_zone = 0 +end function + +function get_luminosity(index_of_the_star, luminosity) + !use strucmod, only: s, m + use caramodele, only: gls + implicit none + integer:: index_of_the_star + double precision:: luminosity + integer:: get_luminosity + !luminosity = exp(s(m)) ! in cgs units, so erg/s? + luminosity = gls + get_luminosity = 0 +end function + +function get_luminosity_at_zone(index_of_the_star, zone, lum_i) + use strucmod, only: s, m + implicit none + integer:: index_of_the_star + integer:: zone, i + double precision:: lum_i + integer:: get_luminosity_at_zone + i = m - zone + if (zone <= m) then + !lum_i = exp(s(zone+1)) + lum_i = exp(s(m-zone)) + end if + get_luminosity_at_zone = 0 +end function + +function get_mass_fraction_at_zone(index_of_the_star, zone, dq_i) + use strucmod, only: q, m + implicit none + integer:: index_of_the_star + integer:: zone, i + double precision:: dq_i + integer:: get_mass_fraction_at_zone + i = m - zone + if (i == 1) then + dq_i = exp(q(i)) + else if (i <= m) then + !dq_i = 1-exp(q(zone+1)) + dq_i = (exp(q(i)) - exp(q(i-1))) + end if + get_mass_fraction_at_zone = 0 +end function + +function get_mass(index_of_the_star, mass) + use inputparam, only: starname + use caramodele, only: gms + implicit none + double precision:: mass + integer:: get_mass, index_of_the_star + mass = gms + get_mass = 0 +end function + +function get_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) + implicit none + integer:: index_of_the_star + integer:: species, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + get_mass_fraction_of_species_at_zone = 0 +end function + +function get_metallicity(metallicity) + implicit none + double precision:: metallicity + integer:: get_metallicity + get_metallicity = 0 +end function + +function get_mu_at_zone(index_of_the_star, zone, mu_i) + implicit none + integer:: index_of_the_star + integer:: zone + double precision:: mu_i + integer:: get_mu_at_zone + get_mu_at_zone = 0 +end function + +function get_name_of_species(index_of_the_star, species, species_name) + implicit none + integer:: index_of_the_star + integer:: species + character(len = :), allocatable:: species_name + integer:: get_name_of_species + get_name_of_species = 0 +end function + +function get_number_of_particles() + implicit none + integer:: get_number_of_particles + get_number_of_particles = 0 +end function + +function get_number_of_species(index_of_the_star, n_species) + implicit none + integer:: index_of_the_star + integer:: n_species + integer:: get_number_of_species + get_number_of_species = 0 +end function + +function get_number_of_zones(index_of_the_star, n_zones) + use inputparam, only: starname + use strucmod, only: m + implicit none + integer:: index_of_the_star + integer:: n_zones + integer:: get_number_of_zones + !if (char(index_of_the_star) /= starname) then + ! get_number_of_zones = -1 + ! return + !end if + n_zones = m + get_number_of_zones = 0 +end function + +function get_pressure_at_zone(index_of_the_star, zone, P_i) + use strucmod, only: p, m + implicit none + integer:: index_of_the_star + integer:: zone, i + double precision:: P_i + integer:: get_pressure_at_zone + if (zone <= m) then + i = m - zone + P_i = exp(p(i)) + end if + get_pressure_at_zone = 0 +end function + +function get_radius(index_of_the_star, radius) + use strucmod, only: r, m + implicit none + integer:: index_of_the_star + double precision:: radius + integer:: get_radius + radius = exp(r(1)) ! in cm + get_radius = 0 +end function + +function get_radius_at_zone(index_of_the_star, zone, R_i) + use strucmod, only: r, m + implicit none + integer:: index_of_the_star + integer:: zone + double precision:: R_i + integer:: get_radius_at_zone + if (zone <= m) then + !R_i = exp(r(zone+1)) ! in cm + R_i = exp(r(m-zone)) ! in cm + end if + get_radius_at_zone = 0 +end function + +function get_stellar_type(index_of_the_star, stellar_type) + implicit none + integer:: index_of_the_star + integer:: stellar_type + integer:: get_stellar_type + get_stellar_type = -1 +end function + +function get_temperature(index_of_the_star, temperature) + use caramodele, only: teff + implicit none + integer:: index_of_the_star + double precision:: temperature + integer:: get_temperature + temperature = teff + get_temperature = 0 +end function + +function get_temperature_at_zone(index_of_the_star, zone, T_i) + use strucmod, only: t, m + implicit none + integer:: index_of_the_star + integer:: zone + double precision:: T_i + integer:: get_temperature_at_zone + if (zone <= m) then + T_i = exp(t(m-zone)) + else + get_temperature_at_zone = -2 + return + end if + get_temperature_at_zone = 0 +end function + +function get_time_step(index_of_the_star, time_step) + use timestep, only: dzeit + implicit none + integer:: index_of_the_star + double precision:: time_step + integer:: get_time_step + time_step = dzeit + get_time_step = 0 +end function + +function get_time(time) + use timestep, only: alter + implicit none + double precision:: time + integer:: get_time + time = alter + get_time = 0 +end function + +function new_particle(index_of_the_star, mass, metallicity, key) + use amuse_helpers, only: starname, mstar, zini + implicit none + integer:: index_of_the_star, key + double precision:: mass, metallicity + integer:: new_particle + starname = 'AmuseStar'!write(starname, '(i10.10)') key + index_of_the_star = 1 + mstar = mass + zini = metallicity + + new_particle = 0 +end function + +function recommit_parameters() + implicit none + integer:: recommit_parameters + recommit_parameters = 0 +end function + +function recommit_particles() + use genec, only: finalise, initialise_star + use WriteSaveClose, only: OpenAll + implicit none + integer:: recommit_particles + call finalise() + call OpenAll() + call initialise_star() + recommit_particles = 0 +end function + +function set_density_at_zone(index_of_the_star, zone, rho_i) + implicit none + integer:: index_of_the_star + integer:: zone + double precision:: rho_i + integer:: set_density_at_zone + set_density_at_zone = 0 +end function + +function set_genec_path(path) + use evol, only: input_dir + implicit none + character(len = :), allocatable:: path + integer:: set_genec_path + + input_dir = path + set_genec_path = 0 +end function + +function set_starname(index_of_the_star) + use amuse_helpers, only:starname + implicit none + integer:: set_starname, index_of_the_star + ! Only allow this at the initialisation time! + starname = 'AmuseStar' + write(starname, '(i10.10)') index_of_the_star + set_starname = 0 +end function + +function set_mass(index_of_the_star, mass) + use amuse_helpers, only:mstar ! this is initial mass only? + implicit none + integer:: set_mass, index_of_the_star + double precision:: mass + mstar = mass + set_mass = 0 +end function + +function set_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) + implicit none + integer:: index_of_the_star + integer:: species, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + set_mass_fraction_of_species_at_zone = 0 +end function + +function set_metallicity(metallicity) + use amuse_helpers, only: zini + implicit none + double precision:: metallicity + integer:: set_metallicity + zini = metallicity + set_metallicity = 0 +end function + +function set_radius_at_zone(index_of_the_star, zone, R_i) + implicit none + integer:: index_of_the_star + integer:: zone + double precision:: R_i + integer:: set_radius_at_zone + set_radius_at_zone = 0 +end function + +function set_temperature_at_zone(index_of_the_star, zone, T_i) + implicit none + integer:: index_of_the_star + integer:: zone + double precision:: T_i + integer:: set_temperature_at_zone + set_temperature_at_zone = 0 +end function diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py new file mode 100644 index 0000000000..c18593a504 --- /dev/null +++ b/src/amuse/community/genec/interface.py @@ -0,0 +1,312 @@ +from amuse.community import CodeInterface +from amuse.community import LegacyFunctionSpecification +from amuse.community import legacy_function +from amuse.community import LiteratureReferencesMixIn +from amuse.community import CodeWithDataDirectories +from amuse.community import InCodeComponentImplementation +from amuse.community.interface.se import StellarEvolution +from amuse.community.interface.se import StellarEvolutionInterface +from amuse.community.interface.se import InternalStellarStructure +from amuse.community.interface.se import InternalStellarStructureInterface +from amuse.units import units + + +class GenecInterface( + CodeInterface, + LiteratureReferencesMixIn, + StellarEvolutionInterface, + InternalStellarStructureInterface, + CodeWithDataDirectories, +): + """ + GENEC is the Geneva Stellar Evolution Code + + References: + .. [#] The Geneva Stellar Evolution Group + """ + + def __init__(self, **keyword_arguments): + CodeInterface.__init__( + self, name_of_the_worker="genec_worker", **keyword_arguments) + LiteratureReferencesMixIn.__init__(self) + CodeWithDataDirectories.__init__(self) + + @legacy_function + def set_genec_path(): + """ + set path to Genec data directories + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'genec_path', dtype='string', direction=function.IN, + description="Path to Genec", + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + Current value was set + -1 - ERROR + Directory does not exist + """ + return function + + @legacy_function + def commit_parameters(): + function = LegacyFunctionSpecification() + function.result_type = 'int32' + return function + + @legacy_function + def set_starname(): + """ + Set the star name (identical to AMUSE particle key?) + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'index_of_the_star', dtype='int32', + direction=function.IN, + description="The star's key" + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + """ + return function + + @legacy_function + def new_particle(): + """ + Define a new star in the code. The star will start with the given mass. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = False + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.OUT, + description=( + "The new index for the star. This index can be used to refer " + "to this star in other functions" + ) + ) + function.addParameter( + 'mass', dtype='float64', direction=function.IN, + description="The initial mass of the star") + function.addParameter( + 'metallicity', dtype='float64', direction=function.IN, + description="The initial metallicity of the star") + function.addParameter( + 'key', dtype='float64', direction=function.IN, + description="The identifying key of the star") + # function.addParameter( + # 'age_tag', dtype='float64', direction=function.IN, + # description="Starting age of the star *to be specified exactly*") + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + New star was loaded and the index_of_the_star parameter set. + -1 - ERROR + New star could not be created. + """ + return function + + @legacy_function + def get_luminosity_at_zone(): + """ + Retrieve the luminosity at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of" + ) + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of" + ) + function.addParameter( + 'lum_i', dtype='float64', direction=function.OUT, + description=( + "The luminosity at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + @legacy_function + def get_mass_fraction_at_zone(): + """ + Retrieve the mass fraction at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'dq_i', dtype='float64', direction=function.OUT, + description=( + "The mass fraction at the specified zone/mesh-cell of " + "the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + +class Genec(StellarEvolution, InternalStellarStructure): + + def __init__(self, **options): + InCodeComponentImplementation.__init__( + self, GenecInterface(**options), **options) + self.model_time = 0.0 | units.yr + + def define_parameters(self, handler): + handler.add_method_parameter( + None, + "set_genec_path", + "path_to_data", + "Path to the data directory", + default_value=self.data_directory + ) + + def define_particle_sets(self, handler): + handler.define_set('particles', 'index_of_the_star') + handler.set_new('particles', 'new_particle') + + handler.add_getter('particles', 'get_radius') + handler.add_getter('particles', 'get_mass') + handler.add_getter('particles', 'get_age') + handler.add_getter('particles', 'get_luminosity') + handler.add_getter('particles', 'get_temperature') + # handler.add_method('particles', 'get_number_of_zones') + # handler.add_method('particles', 'get_radius_profile') + # handler.add_method('particles', 'get_temperature_profile') + handler.add_method('particles', 'get_luminosity_profile') + handler.add_method('particles', 'get_cumulative_mass_profile') + + handler.add_method('particles', 'evolve_one_step') + handler.add_method('particles', 'evolve_for') + InternalStellarStructure.define_particle_sets( + self, handler, set_name='particles' + ) + + handler.set_delete('particles', 'delete_star') + + def define_state(self, handler): + StellarEvolution.define_state(self, handler) + # InternalStellarStructure.define_state(self, handler) + + # Only allow setting of starname in EDIT or UPDATE states + # I.e. must do initialize_code and commit_parameters FIRST! + + # Initialized (initialize_code) + + # -> Edit (commit_parameters) + handler.add_method('EDIT', 'set_starname') + # handler.add_method('EDIT', 'new_particle') + + # -> Run (commit_particles) + + # -> Update + + # -> Run (recommit_particles) + + handler.add_method('UPDATE', 'set_starname') + # handler.add_method('UPDATE', 'new_particle') + + def define_methods(self, handler): + InternalStellarStructure.define_methods(self, handler) + StellarEvolution.define_methods(self, handler) + handler.add_method( + "new_particle", + (units.MSun, handler.NO_UNIT), + (handler.INDEX, handler.ERROR_CODE) + ) + handler.add_method( + "get_radius", + (handler.INDEX,), + (units.cm, handler.ERROR_CODE,) + ) + handler.add_method( + "get_number_of_zones", + (handler.INDEX,), + (handler.NO_UNIT, handler.ERROR_CODE,) + ) + handler.add_method( + "get_radius_at_zone", + (handler.INDEX, handler.NO_UNIT,), + (units.cm, handler.ERROR_CODE,) + ) + handler.add_method( + "get_temperature_at_zone", + (handler.INDEX, handler.NO_UNIT,), + (units.K, handler.ERROR_CODE,) + ) + handler.add_method( + "get_luminosity_at_zone", + (handler.INDEX, handler.NO_UNIT,), + (units.erg/units.s, handler.ERROR_CODE,) + ) + # def define_parameters(self, handler): + + def get_luminosity_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying luminosity profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_number_of_zones(indices_of_the_stars) + return self.get_luminosity_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + + def get_mass_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying mass profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_number_of_zones(indices_of_the_stars) + return self.get_mass_fraction_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + + def get_cumulative_mass_profile( + self, indices_of_the_stars, number_of_zones=None): + frac_profile = self.get_mass_profile( + indices_of_the_stars, number_of_zones=number_of_zones) + return frac_profile.cumsum() From 74d2cf9b20a6aa15f8e7a13491153afebd0fb300 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 25 Jan 2022 20:39:38 +0100 Subject: [PATCH 02/72] updates --- src/amuse/community/genec/Makefile | 2 +- src/amuse/community/genec/interface.f90 | 65 ++++++++++++++++++++++++- src/amuse/community/genec/interface.py | 2 +- 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/src/amuse/community/genec/Makefile b/src/amuse/community/genec/Makefile index 2071b9d7ab..d875281a05 100644 --- a/src/amuse/community/genec/Makefile +++ b/src/amuse/community/genec/Makefile @@ -49,7 +49,7 @@ MODULES_F90_BASE = $(CODEDIR)/evol.f90 \ $(CODEDIR)/chemicals.f90 \ $(CODEDIR)/bintidemod.f90 \ $(CODEDIR)/winds.f90 \ - $(INI_CODEDIR)/inichemmod-amuse.f90 \ + $(INI_CODEDIR)/inichemmod.f90 \ $(INI_CODEDIR)/interpolmod.f90 \ $(INI_CODEDIR)/modinimod.f90 diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index af94333002..14c3c5b562 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -192,11 +192,29 @@ function get_mass(index_of_the_star, mass) end function function get_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) + use abundmod, only: & + x,y3,y,xc12,xc13,xc14,xn14,xn15,xo16,xo17,xo18,xf18,xf19,xne20,xne21,xne22,xna23,xmg24,& + xmg25,xmg26,xal26,xal27,xsi28,xprot,xneut,xbid,xbid1 implicit none integer:: index_of_the_star integer:: species, zone double precision:: Xj_i integer:: get_mass_fraction_of_species_at_zone + select case(species) + case(1) + Xj_i = x(zone) + case(2) + Xj_i = y3(zone) + case(3) + Xj_i = y(zone) + case(4) + Xj_i = xc12(zone) + case(5) + Xj_i = xc13(zone) + case default + Xj_i = 0 + end select + get_mass_fraction_of_species_at_zone = 0 end function @@ -220,8 +238,47 @@ function get_name_of_species(index_of_the_star, species, species_name) implicit none integer:: index_of_the_star integer:: species - character(len = :), allocatable:: species_name + character(len = 6):: species_name integer:: get_name_of_species + + character(len = 6), dimension(27):: species_names + + species_names(1) = 'h' + species_names(2) = 'he3' + species_names(3) = 'he' + species_names(4) = 'c12' + species_names(5) = 'c13' + species_names(6) = 'n14' + species_names(7) = 'n15' + species_names(8) = 'o16' + species_names(9) = 'o17' + species_names(10) = 'o18' + species_names(11) = 'ne20' + species_names(12) = 'ne22' + species_names(13) = 'mg24' + species_names(14) = 'mg25' + species_names(15) = 'mg26' + species_names(16) = 'c14' + species_names(17) = 'f18' + species_names(18) = 'f19' + species_names(19) = 'ne21' + species_names(20) = 'na23' + species_names(21) = 'al26' + species_names(22) = 'al27' + species_names(23) = 'si28' + species_names(24) = 'neut' + species_names(25) = 'prot' + species_names(26) = 'bid' + species_names(27) = 'bid1' + species_name = species_names(species) + !x: H1 + !y: He4 + !y3: He3 + !xneut: neutron + !xprot: proton + !xc12: C12 + !xXYY: XYY - X element YY mass number + !xXXYY: as above get_name_of_species = 0 end function @@ -232,10 +289,16 @@ function get_number_of_particles() end function function get_number_of_species(index_of_the_star, n_species) + use inputparam,only: ialflu implicit none integer:: index_of_the_star integer:: n_species integer:: get_number_of_species + if (ialflu==1) then + n_species = 27 + else + n_species = 15 + end if get_number_of_species = 0 end function diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index c18593a504..e6cc48dc17 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -243,7 +243,7 @@ def define_methods(self, handler): StellarEvolution.define_methods(self, handler) handler.add_method( "new_particle", - (units.MSun, handler.NO_UNIT), + (units.MSun, handler.NO_UNIT, handler.NO_UNIT), (handler.INDEX, handler.ERROR_CODE) ) handler.add_method( From 60bab5e44d20a102d31258d0ba73eb79ddd76096 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Fri, 4 Feb 2022 11:36:05 +0100 Subject: [PATCH 03/72] updates to GENEC interface --- src/amuse/community/genec/interface.f90 | 261 ++++++++++++++++++++---- src/amuse/community/genec/interface.py | 20 +- 2 files changed, 242 insertions(+), 39 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 14c3c5b562..ecca70e266 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1,6 +1,7 @@ function initialize_code() use WriteSaveClose, only: quitafterclosing - use genec, only: initialise_genec, amuseinterface + use inputparam, only: amuseinterface, writetofiles + use genec, only: initialise_genec use amuse_helpers, only: set_defaults use amuse_helpers, only: mstar, zini, starname use evol, only: input_dir @@ -8,6 +9,7 @@ function initialize_code() integer:: initialize_code amuseinterface = .true. + writetofiles = .false. input_dir = "./src/GENEC/code" call initialise_genec() call set_defaults() @@ -19,6 +21,43 @@ function initialize_code() initialize_code = 0 end function +!function read_genec_model() +! ! This should only be called if no star has been initialised yet! +! use genec, only: amuseinterface +! use amuse_helpers, only: starname +! use inputparam, only:CharacteristicsParams,PhysicsParams,CompositionParams,RotationParams,& +! SurfaceParams,ConvectionParams,ConvergenceParams,TimeControle,VariousSettings +! implicit none +! character(*):: inputfilename +! integer:: read_genec_model +! +! amuseinterface = .false. ! This will make initialise_star read the b file +! write(inputfilename, *) starname +! write(inputfilename, *) ".input" +! open(unit=4242, file=inputfilename) +! ! * Parse the CharacteristicsParams namelist * +! read(*,nml=CharacteristicsParams) +! ! * Parse the PhysicsParams namelist * +! read(*,nml=PhysicsParams) +! ! * Parse the CompositionParams namelist * +! read(*,nml=CompositionParams) +! ! * Parse the RotationParams namelist * +! read(*,nml=RotationParams) +! ! * Parse the SurfaceParams namelist * +! read(*,nml=SurfaceParams) +! ! * Parse the ConvectionParams namelist * +! read(*,nml=ConvectionParams) +! ! * Parse the ConvergenceParams namelist * +! read(*,nml=ConvergenceParams) +! ! * Parse the TimeControle namelist * +! read(*,nml=TimeControle) +! ! * Parse the VariousSettings namelist * +! read(*,nml=VariousSettings) +! +! close(4242) +! read_genec_model = 0 +!end function + function cleanup_code() implicit none integer:: cleanup_code @@ -32,16 +71,20 @@ function commit_parameters() end function function commit_particles() + use genec, only: amuseinterface use amuse_helpers, only: initialise_star, makeini use WriteSaveClose, only: OpenAll + use inputparam, only: nzmod implicit none integer:: commit_particles - call makeini() + call makeini() ! this will actually override some things from set_defaults now! FIXME !write(*,*) 'makeini done' call OpenAll() !write(*,*) 'OpenAll done' call initialise_star() + nzmod = 1 !write(*,*) 'initialise_star done' + amuseinterface = .true. ! If we just read a b file, disable this again for continuing commit_particles = 0 end function @@ -61,11 +104,12 @@ function evolve_model(end_time) integer:: evolve_model do while (alter < end_time) write(*,*) "Current time: ", alter, ", evolving to: ", end_time - modell = 1 + !modell = 1 call evolve() call finalise() call OpenAll() call initialise_star() + write(*,*) "*****Modell: ", modell end do evolve_model = 0 end function @@ -87,11 +131,12 @@ function evolve_for(index_of_the_star, time) end_time = alter+time do while (alter < end_time) write(*,*) "Current time: ", alter, ", evolving to: ", end_time - modell = 1 + !modell = 1 call evolve() call finalise() call OpenAll() call initialise_star() + write(*,*) "*****Modell: ", modell end do evolve_for = 0 @@ -101,16 +146,22 @@ function evolve_one_step(index_of_the_star) use timestep, only: alter use WriteSaveClose, only: OpenAll use genec, only: evolve, modell, finalise, initialise_star + use inputparam,only: modanf,nwseq,nzmod implicit none integer:: index_of_the_star integer:: evolve_one_step + integer:: original_nzmod + original_nzmod = nzmod + nzmod = 1 write(*,*) "Evolving one step, current time: ", alter - modell = 1 + !modell = 1 call evolve() call finalise() call OpenAll() - call initialise_star() + call initialise_star() ! will set modell to 1 write(*,*) "Evolved one step, current time: ", alter + nzmod = original_nzmod + write(*,*) "*****modanf, nwseq, nzmod: ", modanf, nwseq, nzmod evolve_one_step = 0 end function @@ -128,11 +179,12 @@ function get_density_at_zone(index_of_the_star, zone, rho_i) use strucmod, only: rho, m implicit none integer:: index_of_the_star - integer:: zone + integer:: zone, i double precision:: rho_i integer:: get_density_at_zone + i = m - zone if (zone <= m) then - rho_i = exp(rho(m-zone)) + rho_i = exp(rho(i)) end if get_density_at_zone = 0 end function @@ -159,7 +211,7 @@ function get_luminosity_at_zone(index_of_the_star, zone, lum_i) i = m - zone if (zone <= m) then !lum_i = exp(s(zone+1)) - lum_i = exp(s(m-zone)) + lum_i = exp(s(i)) - 1 end if get_luminosity_at_zone = 0 end function @@ -192,28 +244,76 @@ function get_mass(index_of_the_star, mass) end function function get_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) + use strucmod, only: m use abundmod, only: & x,y3,y,xc12,xc13,xc14,xn14,xn15,xo16,xo17,xo18,xf18,xf19,xne20,xne21,xne22,xna23,xmg24,& xmg25,xmg26,xal26,xal27,xsi28,xprot,xneut,xbid,xbid1 implicit none integer:: index_of_the_star - integer:: species, zone + integer:: species, zone, i double precision:: Xj_i integer:: get_mass_fraction_of_species_at_zone - select case(species) - case(1) - Xj_i = x(zone) - case(2) - Xj_i = y3(zone) - case(3) - Xj_i = y(zone) - case(4) - Xj_i = xc12(zone) - case(5) - Xj_i = xc13(zone) - case default - Xj_i = 0 - end select + i = m-zone + if (zone <= m) then + select case(species) + case(1) + Xj_i = x(i) + case(2) + Xj_i = y3(i) + case(3) + Xj_i = y(i) + case(4) + Xj_i = xc12(i) + case(5) + Xj_i = xc13(i) + case(6) + Xj_i = xn14(i) + case(7) + Xj_i = xn15(i) + case(8) + Xj_i = xo16(i) + case(9) + Xj_i = xo17(i) + case(10) + Xj_i = xo18(i) + case(11) + Xj_i = xne20(i) + case(12) + Xj_i = xne22(i) + case(13) + Xj_i = xmg24(i) + case(14) + Xj_i = xmg25(i) + case(15) + Xj_i = xmg26(i) + case(16) + Xj_i = xc14(i) + case(17) + Xj_i = xf18(i) + case(18) + Xj_i = xf19(i) + case(19) + Xj_i = xne21(i) + case(20) + Xj_i = xna23(i) + case(21) + Xj_i = xal26(i) + case(22) + Xj_i = xal27(i) + case(23) + Xj_i = xsi28(i) + case(24) + Xj_i = xneut(i) + case(25) + Xj_i = xprot(i) + case(26) + Xj_i = xbid(i) + case(27) + Xj_i = xbid1(i) + case default + Xj_i = 0 + end select + end if get_mass_fraction_of_species_at_zone = 0 end function @@ -226,11 +326,15 @@ function get_metallicity(metallicity) end function function get_mu_at_zone(index_of_the_star, zone, mu_i) + use strucmod, only: m implicit none integer:: index_of_the_star integer:: zone double precision:: mu_i integer:: get_mu_at_zone + if (zone <= m) then + mu_i = 0 + endif get_mu_at_zone = 0 end function @@ -345,12 +449,12 @@ function get_radius_at_zone(index_of_the_star, zone, R_i) use strucmod, only: r, m implicit none integer:: index_of_the_star - integer:: zone + integer:: zone, i double precision:: R_i integer:: get_radius_at_zone + i = m - zone if (zone <= m) then - !R_i = exp(r(zone+1)) ! in cm - R_i = exp(r(m-zone)) ! in cm + R_i = exp(r(i)) ! in cm end if get_radius_at_zone = 0 end function @@ -377,11 +481,12 @@ function get_temperature_at_zone(index_of_the_star, zone, T_i) use strucmod, only: t, m implicit none integer:: index_of_the_star - integer:: zone + integer:: zone, i double precision:: T_i integer:: get_temperature_at_zone + i = m - zone if (zone <= m) then - T_i = exp(t(m-zone)) + T_i = exp(t(i)) else get_temperature_at_zone = -2 return @@ -390,12 +495,12 @@ function get_temperature_at_zone(index_of_the_star, zone, T_i) end function function get_time_step(index_of_the_star, time_step) - use timestep, only: dzeit + use timestep, only: dzeitj implicit none integer:: index_of_the_star double precision:: time_step integer:: get_time_step - time_step = dzeit + time_step = dzeitj get_time_step = 0 end function @@ -408,13 +513,14 @@ function get_time(time) get_time = 0 end function -function new_particle(index_of_the_star, mass, metallicity, key) +function new_particle(index_of_the_star, mass, metallicity, am_starname) use amuse_helpers, only: starname, mstar, zini implicit none integer:: index_of_the_star, key double precision:: mass, metallicity integer:: new_particle - starname = 'AmuseStar'!write(starname, '(i10.10)') key + character(len=12):: am_starname + starname = am_starname !'AmuseStar'!write(starname, '(i10.10)') key index_of_the_star = 1 mstar = mass zini = metallicity @@ -440,11 +546,16 @@ function recommit_particles() end function function set_density_at_zone(index_of_the_star, zone, rho_i) + use strucmod, only: rho, m implicit none integer:: index_of_the_star - integer:: zone + integer:: zone, i double precision:: rho_i integer:: set_density_at_zone + i = m - zone + if (zone <= m) then + rho(i) = log(rho_i) + end if set_density_at_zone = 0 end function @@ -478,11 +589,76 @@ function set_mass(index_of_the_star, mass) end function function set_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) + use strucmod, only: m + use abundmod, only: & + x,y3,y,xc12,xc13,xc14,xn14,xn15,xo16,xo17,xo18,xf18,xf19,xne20,xne21,xne22,xna23,xmg24,& + xmg25,xmg26,xal26,xal27,xsi28,xprot,xneut,xbid,xbid1 implicit none integer:: index_of_the_star - integer:: species, zone + integer:: species, zone, i double precision:: Xj_i integer:: set_mass_fraction_of_species_at_zone + i = m - zone + if (zone <= m) then + select case(species) + case(1) + x(i) = Xj_i + case(2) + y3(i) = Xj_i + case(3) + y(i) = Xj_i + case(4) + xc12(i) = Xj_i + case(5) + xc13(i) = Xj_i + case(6) + xn14(i) = Xj_i + case(7) + xn14(i) = Xj_i + case(8) + xo16(i) = Xj_i + case(9) + xo17(i) = Xj_i + case(10) + xo18(i) = Xj_i + case(11) + xne20(i) = Xj_i + case(12) + xne22(i) = Xj_i + case(13) + xmg24(i) = Xj_i + case(14) + xmg25(i) = Xj_i + case(15) + xmg26(i) = Xj_i + case(16) + xc14(i) = Xj_i + case(17) + xf18(i) = Xj_i + case(18) + xf19(i) = Xj_i + case(19) + xne21(i) = Xj_i + case(20) + xna23(i) = Xj_i + case(21) + xal26(i) = Xj_i + case(22) + xal27(i) = Xj_i + case(23) + xsi28(i) = Xj_i + case(24) + xneut(i) = Xj_i + case(25) + xprot(i) = Xj_i + case(26) + xbid(i) = Xj_i + case(27) + xbid1(i) = Xj_i + !case default + end select + end if + set_mass_fraction_of_species_at_zone = 0 end function @@ -496,19 +672,30 @@ function set_metallicity(metallicity) end function function set_radius_at_zone(index_of_the_star, zone, R_i) + use strucmod, only: r, m implicit none integer:: index_of_the_star - integer:: zone + integer:: zone, i double precision:: R_i integer:: set_radius_at_zone + i = m - zone + if (zone <= m) then + r(i) = log(R_i) + end if set_radius_at_zone = 0 end function function set_temperature_at_zone(index_of_the_star, zone, T_i) + use strucmod, only: t, m implicit none integer:: index_of_the_star - integer:: zone + integer:: zone, i double precision:: T_i integer:: set_temperature_at_zone + i = m - zone + if (zone <= m) then + t(i) = log(T_i) + end if + set_temperature_at_zone = 0 end function diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index e6cc48dc17..f31eb97f7d 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -99,8 +99,8 @@ def new_particle(): 'metallicity', dtype='float64', direction=function.IN, description="The initial metallicity of the star") function.addParameter( - 'key', dtype='float64', direction=function.IN, - description="The identifying key of the star") + 'starname', dtype='string', direction=function.IN, + default='AmuseStar', description="The star's name") # function.addParameter( # 'age_tag', dtype='float64', direction=function.IN, # description="Starting age of the star *to be specified exactly*") @@ -202,6 +202,7 @@ def define_particle_sets(self, handler): handler.add_getter('particles', 'get_age') handler.add_getter('particles', 'get_luminosity') handler.add_getter('particles', 'get_temperature') + handler.add_getter('particles', 'get_time_step', names=('time_step',)) # handler.add_method('particles', 'get_number_of_zones') # handler.add_method('particles', 'get_radius_profile') # handler.add_method('particles', 'get_temperature_profile') @@ -230,6 +231,21 @@ def define_state(self, handler): # handler.add_method('EDIT', 'new_particle') # -> Run (commit_particles) + handler.add_transition('EDIT', 'RUN', 'commit_particles') + + handler.add_method('RUN', 'get_chemical_abundance_profiles') + handler.add_method('RUN', 'get_mass_fraction_of_species_at_zone') + handler.add_method('RUN', 'get_mu_at_zone') + handler.add_method('RUN', 'get_number_of_species') + handler.add_method('RUN', 'get_number_of_zones') + handler.add_method('RUN', 'get_pressure_at_zone') + handler.add_method('RUN', 'get_radius') + handler.add_method('RUN', 'get_radius_at_zone') + handler.add_method('RUN', 'get_temperature_at_zone') + handler.add_method('RUN', 'get_density_at_zone') + handler.add_method('RUN', 'get_luminosity_at_zone') + handler.add_method('RUN', 'get_mass_fraction_at_zone') + handler.add_method('RUN', 'get_time_step') # -> Update From 9ca06baa764d33ee8386f437ff4f39c288bb3f0b Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 8 Feb 2022 11:28:39 +0100 Subject: [PATCH 04/72] add more methods --- src/amuse/community/genec/interface.f90 | 83 +++++++++++++++++++++++-- src/amuse/community/genec/interface.py | 31 +++++++++ 2 files changed, 110 insertions(+), 4 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index ecca70e266..d6b0f8b64a 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -243,6 +243,73 @@ function get_mass(index_of_the_star, mass) get_mass = 0 end function +function get_mass_of_species(index_of_the_star, species, species_mass) + implicit none + integer:: index_of_the_star + integer:: species + double precision:: species_mass + integer:: get_mass_of_species + get_mass_of_species = 0 + select case(species) + case(1) + species_mass = 1. + case(2) + species_mass = 3. + case(3) + species_mass = 4. + case(4) + species_mass = 12. + case(5) + species_mass = 13. + case(6) + species_mass = 14. + case(7) + species_mass = 15. + case(8) + species_mass = 16. + case(9) + species_mass = 17. + case(10) + species_mass = 18. + case(11) + species_mass = 20. + case(12) + species_mass = 22. + case(13) + species_mass = 24. + case(14) + species_mass = 25. + case(15) + species_mass = 26. + case(16) + species_mass = 14. + case(17) + species_mass = 18. + case(18) + species_mass = 19. + case(19) + species_mass = 21. + case(20) + species_mass = 23. + case(21) + species_mass = 26. + case(22) + species_mass = 27. + case(23) + species_mass = 28. + case(24) + species_mass = 1. !neut(i) + case(25) + species_mass = 1. !prot(i) +! case(26) +! species_mass = bid(i) +! case(27) +! species_mass = bid1(i) + case default + species_mass = 0. + end select +end function + function get_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) use strucmod, only: m use abundmod, only: & @@ -329,12 +396,20 @@ function get_mu_at_zone(index_of_the_star, zone, mu_i) use strucmod, only: m implicit none integer:: index_of_the_star - integer:: zone - double precision:: mu_i + integer:: zone, i + integer:: get_mass_fraction_of_species_at_zone + double precision:: mu_i, X, Y3, Y + integer:: err integer:: get_mu_at_zone + i = (m - zone) if (zone <= m) then - mu_i = 0 - endif + mu_i = 0.0d0 + err = get_mass_fraction_of_species_at_zone(index_of_the_star, 1, zone, X) + err = get_mass_fraction_of_species_at_zone(index_of_the_star, 2, zone, Y3) + err = get_mass_fraction_of_species_at_zone(index_of_the_star, 3, zone, Y) + + mu_i = (4.0 / (2.0 + 6 * X - (Y+Y3))) + end if get_mu_at_zone = 0 end function diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index f31eb97f7d..b36cdaa492 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -145,6 +145,36 @@ def get_luminosity_at_zone(): """ return function + @legacy_function + def get_mass_of_species(): + """ + Retrieve the mass number of the chemical abundance variable of the + star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'species', dtype='int32', direction=function.IN, + description="The species of the star to get the mass number of") + function.addParameter( + 'species_mass', dtype='float64', direction=function.OUT, + description=( + "The mass number of the chemical abundance variable of " + "the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + @legacy_function def get_mass_fraction_at_zone(): """ @@ -207,6 +237,7 @@ def define_particle_sets(self, handler): # handler.add_method('particles', 'get_radius_profile') # handler.add_method('particles', 'get_temperature_profile') handler.add_method('particles', 'get_luminosity_profile') + handler.add_method('particles', 'get_mass_profile') handler.add_method('particles', 'get_cumulative_mass_profile') handler.add_method('particles', 'evolve_one_step') From 9dccb91e8808062b862825ac1d942fea72117d60 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Thu, 24 Feb 2022 16:47:26 +0100 Subject: [PATCH 05/72] add firstlast functions --- src/amuse/community/genec/interface.f90 | 28 ++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index d6b0f8b64a..5496966329 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -468,7 +468,7 @@ function get_number_of_particles() end function function get_number_of_species(index_of_the_star, n_species) - use inputparam,only: ialflu + use inputparam, only: ialflu implicit none integer:: index_of_the_star integer:: n_species @@ -481,6 +481,21 @@ function get_number_of_species(index_of_the_star, n_species) get_number_of_species = 0 end function +function get_firstlast_species_number(first, last) + use inputparam, only: ialflu + implicit none + !integer:: index_of_the_star + integer:: first, last + integer:: get_firstlast_species_number + first = 1 + if (ialflu==1) then + last = 27 + else + last = 15 + end if + get_firstlast_species_number = 0 +end function + function get_number_of_zones(index_of_the_star, n_zones) use inputparam, only: starname use strucmod, only: m @@ -496,6 +511,17 @@ function get_number_of_zones(index_of_the_star, n_zones) get_number_of_zones = 0 end function +function get_firstlast_zone(first, last) + use strucmod, only: m + implicit none + !integer:: index_of_the_star + integer:: first, last + integer:: get_firstlast_zone + first = 1 + last = m + get_firstlast_zone = 0 +end function + function get_pressure_at_zone(index_of_the_star, zone, P_i) use strucmod, only: p, m implicit none From 3ef03db98c90eb0ae4214ac27d2d7edb562597f6 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 7 Mar 2022 14:42:50 +0100 Subject: [PATCH 06/72] small fix --- src/amuse/community/genec/interface.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 5496966329..5c97bbb5b4 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -517,8 +517,8 @@ function get_firstlast_zone(first, last) !integer:: index_of_the_star integer:: first, last integer:: get_firstlast_zone - first = 1 - last = m + first = 0 + last = m-1 get_firstlast_zone = 0 end function From 047effefc0cd24b9ee58f4f1915175f3f5251b48 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 7 Mar 2022 14:43:27 +0100 Subject: [PATCH 07/72] Add setters/getters for input parameters --- src/amuse/community/genec/interface.f90 | 1605 +++++++++++++++++++++++ 1 file changed, 1605 insertions(+) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 5c97bbb5b4..77ad158fa5 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -64,6 +64,1611 @@ function cleanup_code() cleanup_code = 0 end function +! **** Parameters + +function get_par_nwseq(par_nwseq) + use inputparam, only: nwseq + implicit none + integer:: par_nwseq + integer:: get_par_nwseq + par_nwseq = nwseq + get_par_nwseq = 0 +end function + +function set_par_nwseq(par_nwseq) + use inputparam, only: nwseq + implicit none + integer:: par_nwseq + integer:: set_par_nwseq + nwseq = par_nwseq + set_par_nwseq = 0 +end function + +function get_par_modanf(par_modanf) + use inputparam, only: modanf + implicit none + integer:: par_modanf + integer:: get_par_modanf + par_modanf = modanf + get_par_modanf = 0 +end function + +function set_par_modanf(par_modanf) + use inputparam, only: modanf + implicit none + integer:: par_modanf + integer:: set_par_modanf + modanf = par_modanf + set_par_modanf = 0 +end function + +function get_par_nzmod(par_nzmod) + use inputparam, only: nzmod + implicit none + integer:: par_nzmod + integer:: get_par_nzmod + par_nzmod = nzmod + get_par_nzmod = 0 +end function + +function set_par_nzmod(par_nzmod) + use inputparam, only: nzmod + implicit none + integer:: par_nzmod + integer:: set_par_nzmod + nzmod = par_nzmod + set_par_nzmod = 0 +end function + +function get_par_irot(par_irot) + use inputparam, only: irot + implicit none + integer:: par_irot + integer:: get_par_irot + par_irot = irot + get_par_irot = 0 +end function + +function set_par_irot(par_irot) + use inputparam, only: irot + implicit none + integer:: par_irot + integer:: set_par_irot + irot = par_irot + set_par_irot = 0 +end function + +function get_par_isol(par_isol) + use inputparam, only: isol + implicit none + integer:: par_isol + integer:: get_par_isol + par_isol = isol + get_par_isol = 0 +end function + +function set_par_isol(par_isol) + use inputparam, only: isol + implicit none + integer:: par_isol + integer:: set_par_isol + isol = par_isol + set_par_isol = 0 +end function + +function get_par_imagn(par_imagn) + use inputparam, only: imagn + implicit none + integer:: par_imagn + integer:: get_par_imagn + par_imagn = imagn + get_par_imagn = 0 +end function + +function set_par_imagn(par_imagn) + use inputparam, only: imagn + implicit none + integer:: par_imagn + integer:: set_par_imagn + imagn = par_imagn + set_par_imagn = 0 +end function + +function get_par_ialflu(par_ialflu) + use inputparam, only: ialflu + implicit none + integer:: par_ialflu + integer:: get_par_ialflu + par_ialflu = ialflu + get_par_ialflu = 0 +end function + +function set_par_ialflu(par_ialflu) + use inputparam, only: ialflu + implicit none + integer:: par_ialflu + integer:: set_par_ialflu + ialflu = par_ialflu + set_par_ialflu = 0 +end function + +function get_par_ianiso(par_ianiso) + use inputparam, only: ianiso + implicit none + integer:: par_ianiso + integer:: get_par_ianiso + par_ianiso = ianiso + get_par_ianiso = 0 +end function + +function set_par_ianiso(par_ianiso) + use inputparam, only: ianiso + implicit none + integer:: par_ianiso + integer:: set_par_ianiso + ianiso = par_ianiso + set_par_ianiso = 0 +end function + +function get_par_ipop3(par_ipop3) + use inputparam, only: ipop3 + implicit none + integer:: par_ipop3 + integer:: get_par_ipop3 + par_ipop3 = ipop3 + get_par_ipop3 = 0 +end function + +function set_par_ipop3(par_ipop3) + use inputparam, only: ipop3 + implicit none + integer:: par_ipop3 + integer:: set_par_ipop3 + ipop3 = par_ipop3 + set_par_ipop3 = 0 +end function + +function get_par_ibasnet(par_ibasnet) + use inputparam, only: ibasnet + implicit none + integer:: par_ibasnet + integer:: get_par_ibasnet + par_ibasnet = ibasnet + get_par_ibasnet = 0 +end function + +function set_par_ibasnet(par_ibasnet) + use inputparam, only: ibasnet + implicit none + integer:: par_ibasnet + integer:: set_par_ibasnet + ibasnet = par_ibasnet + set_par_ibasnet = 0 +end function + +function get_par_phase(par_phase) + use inputparam, only: phase + implicit none + integer:: par_phase + integer:: get_par_phase + par_phase = phase + get_par_phase = 0 +end function + +function set_par_phase(par_phase) + use inputparam, only: phase + implicit none + integer:: par_phase + integer:: set_par_phase + phase = par_phase + set_par_phase = 0 +end function + +function get_par_iopac(par_iopac) + use inputparam, only: iopac + implicit none + integer:: par_iopac + integer:: get_par_iopac + par_iopac = iopac + get_par_iopac = 0 +end function + +function set_par_iopac(par_iopac) + use inputparam, only: iopac + implicit none + integer:: par_iopac + integer:: set_par_iopac + iopac = par_iopac + set_par_iopac = 0 +end function + +function get_par_ikappa(par_ikappa) + use inputparam, only: ikappa + implicit none + integer:: par_ikappa + integer:: get_par_ikappa + par_ikappa = ikappa + get_par_ikappa = 0 +end function + +function set_par_ikappa(par_ikappa) + use inputparam, only: ikappa + implicit none + integer:: par_ikappa + integer:: set_par_ikappa + ikappa = par_ikappa + set_par_ikappa = 0 +end function + +function get_par_idiff(par_idiff) + use inputparam, only: idiff + implicit none + integer:: par_idiff + integer:: get_par_idiff + par_idiff = idiff + get_par_idiff = 0 +end function + +function set_par_idiff(par_idiff) + use inputparam, only: idiff + implicit none + integer:: par_idiff + integer:: set_par_idiff + idiff = par_idiff + set_par_idiff = 0 +end function + +function get_par_iadvec(par_iadvec) + use inputparam, only: iadvec + implicit none + integer:: par_iadvec + integer:: get_par_iadvec + par_iadvec = iadvec + get_par_iadvec = 0 +end function + +function set_par_iadvec(par_iadvec) + use inputparam, only: iadvec + implicit none + integer:: par_iadvec + integer:: set_par_iadvec + iadvec = par_iadvec + set_par_iadvec = 0 +end function + +function get_par_istati(par_istati) + use inputparam, only: istati + implicit none + integer:: par_istati + integer:: get_par_istati + par_istati = istati + get_par_istati = 0 +end function + +function set_par_istati(par_istati) + use inputparam, only: istati + implicit none + integer:: par_istati + integer:: set_par_istati + istati = par_istati + set_par_istati = 0 +end function + +function get_par_icoeff(par_icoeff) + use inputparam, only: icoeff + implicit none + integer:: par_icoeff + integer:: get_par_icoeff + par_icoeff = icoeff + get_par_icoeff = 0 +end function + +function set_par_icoeff(par_icoeff) + use inputparam, only: icoeff + implicit none + integer:: par_icoeff + integer:: set_par_icoeff + icoeff = par_icoeff + set_par_icoeff = 0 +end function + +function get_par_igamma(par_igamma) + use inputparam, only: igamma + implicit none + integer:: par_igamma + integer:: get_par_igamma + par_igamma = igamma + get_par_igamma = 0 +end function + +function set_par_igamma(par_igamma) + use inputparam, only: igamma + implicit none + integer:: par_igamma + integer:: set_par_igamma + igamma = par_igamma + set_par_igamma = 0 +end function + +function get_par_idialo(par_idialo) + use inputparam, only: idialo + implicit none + integer:: par_idialo + integer:: get_par_idialo + par_idialo = idialo + get_par_idialo = 0 +end function + +function set_par_idialo(par_idialo) + use inputparam, only: idialo + implicit none + integer:: par_idialo + integer:: set_par_idialo + idialo = par_idialo + set_par_idialo = 0 +end function + +function get_par_idialu(par_idialu) + use inputparam, only: idialu + implicit none + integer:: par_idialu + integer:: get_par_idialu + par_idialu = idialu + get_par_idialu = 0 +end function + +function set_par_idialu(par_idialu) + use inputparam, only: idialu + implicit none + integer:: par_idialu + integer:: set_par_idialu + idialu = par_idialu + set_par_idialu = 0 +end function + +function get_par_imloss(par_imloss) + use inputparam, only: imloss + implicit none + integer:: par_imloss + integer:: get_par_imloss + par_imloss = imloss + get_par_imloss = 0 +end function + +function set_par_imloss(par_imloss) + use inputparam, only: imloss + implicit none + integer:: par_imloss + integer:: set_par_imloss + imloss = par_imloss + set_par_imloss = 0 +end function + +function get_par_ifitm(par_ifitm) + use inputparam, only: ifitm + implicit none + integer:: par_ifitm + integer:: get_par_ifitm + par_ifitm = ifitm + get_par_ifitm = 0 +end function + +function set_par_ifitm(par_ifitm) + use inputparam, only: ifitm + implicit none + integer:: par_ifitm + integer:: set_par_ifitm + ifitm = par_ifitm + set_par_ifitm = 0 +end function + +function get_par_nndr(par_nndr) + use inputparam, only: nndr + implicit none + integer:: par_nndr + integer:: get_par_nndr + par_nndr = nndr + get_par_nndr = 0 +end function + +function set_par_nndr(par_nndr) + use inputparam, only: nndr + implicit none + integer:: par_nndr + integer:: set_par_nndr + nndr = par_nndr + set_par_nndr = 0 +end function + +function get_par_iledou(par_iledou) + use inputparam, only: iledou + implicit none + integer:: par_iledou + integer:: get_par_iledou + par_iledou = iledou + get_par_iledou = 0 +end function + +function set_par_iledou(par_iledou) + use inputparam, only: iledou + implicit none + integer:: par_iledou + integer:: set_par_iledou + iledou = par_iledou + set_par_iledou = 0 +end function + +function get_par_idifcon(par_idifcon) + use inputparam, only: idifcon + implicit none + integer:: par_idifcon + integer:: get_par_idifcon + par_idifcon = idifcon + get_par_idifcon = 0 +end function + +function set_par_idifcon(par_idifcon) + use inputparam, only: idifcon + implicit none + integer:: par_idifcon + integer:: set_par_idifcon + idifcon = par_idifcon + set_par_idifcon = 0 +end function + +function get_par_my(par_my) + use inputparam, only: my + implicit none + integer:: par_my + integer:: get_par_my + par_my = my + get_par_my = 0 +end function + +function set_par_my(par_my) + use inputparam, only: my + implicit none + integer:: par_my + integer:: set_par_my + my = par_my + set_par_my = 0 +end function + +function get_par_iover(par_iover) + use inputparam, only: iover + implicit none + integer:: par_iover + integer:: get_par_iover + par_iover = iover + get_par_iover = 0 +end function + +function set_par_iover(par_iover) + use inputparam, only: iover + implicit none + integer:: par_iover + integer:: set_par_iover + iover = par_iover + set_par_iover = 0 +end function + +function get_par_iunder(par_iunder) + use inputparam, only: iunder + implicit none + integer:: par_iunder + integer:: get_par_iunder + par_iunder = iunder + get_par_iunder = 0 +end function + +function set_par_iunder(par_iunder) + use inputparam, only: iunder + implicit none + integer:: par_iunder + integer:: set_par_iunder + iunder = par_iunder + set_par_iunder = 0 +end function + +function get_par_nbchx(par_nbchx) + use inputparam, only: nbchx + implicit none + integer:: par_nbchx + integer:: get_par_nbchx + par_nbchx = nbchx + get_par_nbchx = 0 +end function + +function set_par_nbchx(par_nbchx) + use inputparam, only: nbchx + implicit none + integer:: par_nbchx + integer:: set_par_nbchx + nbchx = par_nbchx + set_par_nbchx = 0 +end function + +function get_par_nrband(par_nrband) + use inputparam, only: nrband + implicit none + integer:: par_nrband + integer:: get_par_nrband + par_nrband = nrband + get_par_nrband = 0 +end function + +function set_par_nrband(par_nrband) + use inputparam, only: nrband + implicit none + integer:: par_nrband + integer:: set_par_nrband + nrband = par_nrband + set_par_nrband = 0 +end function + +function get_par_islow(par_islow) + use inputparam, only: islow + implicit none + integer:: par_islow + integer:: get_par_islow + par_islow = islow + get_par_islow = 0 +end function + +function set_par_islow(par_islow) + use inputparam, only: islow + implicit none + integer:: par_islow + integer:: set_par_islow + islow = par_islow + set_par_islow = 0 +end function + +function get_par_icncst(par_icncst) + use inputparam, only: icncst + implicit none + integer:: par_icncst + integer:: get_par_icncst + par_icncst = icncst + get_par_icncst = 0 +end function + +function set_par_icncst(par_icncst) + use inputparam, only: icncst + implicit none + integer:: par_icncst + integer:: set_par_icncst + icncst = par_icncst + set_par_icncst = 0 +end function + +function get_par_tauH_fit(par_tauH_fit) + use inputparam, only: tauH_fit + implicit none + integer:: par_tauH_fit + integer:: get_par_tauH_fit + par_tauH_fit = tauH_fit + get_par_tauH_fit = 0 +end function + +function set_par_tauH_fit(par_tauH_fit) + use inputparam, only: tauH_fit + implicit none + integer:: par_tauH_fit + integer:: set_par_tauH_fit + tauH_fit = par_tauH_fit + set_par_tauH_fit = 0 +end function + +function get_par_iauto(par_iauto) + use inputparam, only: iauto + implicit none + integer:: par_iauto + integer:: get_par_iauto + par_iauto = iauto + get_par_iauto = 0 +end function + +function set_par_iauto(par_iauto) + use inputparam, only: iauto + implicit none + integer:: par_iauto + integer:: set_par_iauto + iauto = par_iauto + set_par_iauto = 0 +end function + +function get_par_iprn(par_iprn) + use inputparam, only: iprn + implicit none + integer:: par_iprn + integer:: get_par_iprn + par_iprn = iprn + get_par_iprn = 0 +end function + +function set_par_iprn(par_iprn) + use inputparam, only: iprn + implicit none + integer:: par_iprn + integer:: set_par_iprn + iprn = par_iprn + set_par_iprn = 0 +end function + +function get_par_iout(par_iout) + use inputparam, only: iout + implicit none + integer:: par_iout + integer:: get_par_iout + par_iout = iout + get_par_iout = 0 +end function + +function set_par_iout(par_iout) + use inputparam, only: iout + implicit none + integer:: par_iout + integer:: set_par_iout + iout = par_iout + set_par_iout = 0 +end function + +function get_par_itmin(par_itmin) + use inputparam, only: itmin + implicit none + integer:: par_itmin + integer:: get_par_itmin + par_itmin = itmin + get_par_itmin = 0 +end function + +function set_par_itmin(par_itmin) + use inputparam, only: itmin + implicit none + integer:: par_itmin + integer:: set_par_itmin + itmin = par_itmin + set_par_itmin = 0 +end function + +function get_par_idebug(par_idebug) + use inputparam, only: idebug + implicit none + integer:: par_idebug + integer:: get_par_idebug + par_idebug = idebug + get_par_idebug = 0 +end function + +function set_par_idebug(par_idebug) + use inputparam, only: idebug + implicit none + integer:: par_idebug + integer:: set_par_idebug + idebug = par_idebug + set_par_idebug = 0 +end function + +function get_par_itests(par_itests) + use inputparam, only: itests + implicit none + integer:: par_itests + integer:: get_par_itests + par_itests = itests + get_par_itests = 0 +end function + +function set_par_itests(par_itests) + use inputparam, only: itests + implicit none + integer:: par_itests + integer:: set_par_itests + itests = par_itests + set_par_itests = 0 +end function + +function get_par_amuseinterface(par_amuseinterface) + use inputparam, only: amuseinterface + implicit none + logical:: par_amuseinterface + integer:: get_par_amuseinterface + par_amuseinterface = amuseinterface + get_par_amuseinterface = 0 +end function + +function set_par_amuseinterface(par_amuseinterface) + use inputparam, only: amuseinterface + implicit none + logical:: par_amuseinterface + integer:: set_par_amuseinterface + amuseinterface = par_amuseinterface + set_par_amuseinterface = 0 +end function + +function get_par_var_rates(par_var_rates) + use inputparam, only: var_rates + implicit none + logical:: par_var_rates + integer:: get_par_var_rates + par_var_rates = var_rates + get_par_var_rates = 0 +end function + +function set_par_var_rates(par_var_rates) + use inputparam, only: var_rates + implicit none + logical:: par_var_rates + integer:: set_par_var_rates + var_rates = par_var_rates + set_par_var_rates = 0 +end function + +function get_par_bintide(par_bintide) + use inputparam, only: bintide + implicit none + logical:: par_bintide + integer:: get_par_bintide + par_bintide = bintide + get_par_bintide = 0 +end function + +function set_par_bintide(par_bintide) + use inputparam, only: bintide + implicit none + logical:: par_bintide + integer:: set_par_bintide + bintide = par_bintide + set_par_bintide = 0 +end function + +function get_par_const_per(par_const_per) + use inputparam, only: const_per + implicit none + logical:: par_const_per + integer:: get_par_const_per + par_const_per = const_per + get_par_const_per = 0 +end function + +function set_par_const_per(par_const_per) + use inputparam, only: const_per + implicit none + logical:: par_const_per + integer:: set_par_const_per + const_per = par_const_per + set_par_const_per = 0 +end function + +function get_par_Add_Flux(par_Add_Flux) + use inputparam, only: Add_Flux + implicit none + logical:: par_Add_Flux + integer:: get_par_Add_Flux + par_Add_Flux = Add_Flux + get_par_Add_Flux = 0 +end function + +function set_par_Add_Flux(par_Add_Flux) + use inputparam, only: Add_Flux + implicit none + logical:: par_Add_Flux + integer:: set_par_Add_Flux + Add_Flux = par_Add_Flux + set_par_Add_Flux = 0 +end function + +function get_par_diff_only(par_diff_only) + use inputparam, only: diff_only + implicit none + logical:: par_diff_only + integer:: get_par_diff_only + par_diff_only = diff_only + get_par_diff_only = 0 +end function + +function set_par_diff_only(par_diff_only) + use inputparam, only: diff_only + implicit none + logical:: par_diff_only + integer:: set_par_diff_only + diff_only = par_diff_only + set_par_diff_only = 0 +end function + +function get_par_lowRSGMdot(par_lowRSGMdot) + use inputparam, only: lowRSGMdot + implicit none + logical:: par_lowRSGMdot + integer:: get_par_lowRSGMdot + par_lowRSGMdot = lowRSGMdot + get_par_lowRSGMdot = 0 +end function + +function set_par_lowRSGMdot(par_lowRSGMdot) + use inputparam, only: lowRSGMdot + implicit none + logical:: par_lowRSGMdot + integer:: set_par_lowRSGMdot + lowRSGMdot = par_lowRSGMdot + set_par_lowRSGMdot = 0 +end function + +function get_par_plot(par_plot) + use inputparam, only: plot + implicit none + logical:: par_plot + integer:: get_par_plot + par_plot = plot + get_par_plot = 0 +end function + +function set_par_plot(par_plot) + use inputparam, only: plot + implicit none + logical:: par_plot + integer:: set_par_plot + plot = par_plot + set_par_plot = 0 +end function + +function get_par_refresh(par_refresh) + use inputparam, only: refresh + implicit none + logical:: par_refresh + integer:: get_par_refresh + par_refresh = refresh + get_par_refresh = 0 +end function + +function set_par_refresh(par_refresh) + use inputparam, only: refresh + implicit none + logical:: par_refresh + integer:: set_par_refresh + refresh = par_refresh + set_par_refresh = 0 +end function + +function get_par_xyfiles(par_xyfiles) + use inputparam, only: xyfiles + implicit none + logical:: par_xyfiles + integer:: get_par_xyfiles + par_xyfiles = xyfiles + get_par_xyfiles = 0 +end function + +function set_par_xyfiles(par_xyfiles) + use inputparam, only: xyfiles + implicit none + logical:: par_xyfiles + integer:: set_par_xyfiles + xyfiles = par_xyfiles + set_par_xyfiles = 0 +end function + +function get_par_verbose(par_verbose) + use inputparam, only: verbose + implicit none + logical:: par_verbose + integer:: get_par_verbose + par_verbose = verbose + get_par_verbose = 0 +end function + +function set_par_verbose(par_verbose) + use inputparam, only: verbose + implicit none + logical:: par_verbose + integer:: set_par_verbose + verbose = par_verbose + set_par_verbose = 0 +end function + +function get_par_stop_deg(par_stop_deg) + use inputparam, only: stop_deg + implicit none + logical:: par_stop_deg + integer:: get_par_stop_deg + par_stop_deg = stop_deg + get_par_stop_deg = 0 +end function + +function set_par_stop_deg(par_stop_deg) + use inputparam, only: stop_deg + implicit none + logical:: par_stop_deg + integer:: set_par_stop_deg + stop_deg = par_stop_deg + set_par_stop_deg = 0 +end function + +function get_par_binm2(par_binm2) + use inputparam, only: binm2 + implicit none + double precision:: par_binm2 + integer:: get_par_binm2 + par_binm2 = binm2 + get_par_binm2 = 0 +end function + +function set_par_binm2(par_binm2) + use inputparam, only: binm2 + implicit none + double precision:: par_binm2 + integer:: set_par_binm2 + binm2 = par_binm2 + set_par_binm2 = 0 +end function + +function get_par_periodini(par_periodini) + use inputparam, only: periodini + implicit none + double precision:: par_periodini + integer:: get_par_periodini + par_periodini = periodini + get_par_periodini = 0 +end function + +function set_par_periodini(par_periodini) + use inputparam, only: periodini + implicit none + double precision:: par_periodini + integer:: set_par_periodini + periodini = par_periodini + set_par_periodini = 0 +end function + +function get_par_zinit(par_zinit) + use inputparam, only: zinit + implicit none + double precision:: par_zinit + integer:: get_par_zinit + par_zinit = zinit + get_par_zinit = 0 +end function + +function set_par_zinit(par_zinit) + use inputparam, only: zinit + implicit none + double precision:: par_zinit + integer:: set_par_zinit + zinit = par_zinit + set_par_zinit = 0 +end function + +function get_par_zsol(par_zsol) + use inputparam, only: zsol + implicit none + double precision:: par_zsol + integer:: get_par_zsol + par_zsol = zsol + get_par_zsol = 0 +end function + +function set_par_zsol(par_zsol) + use inputparam, only: zsol + implicit none + double precision:: par_zsol + integer:: set_par_zsol + zsol = par_zsol + set_par_zsol = 0 +end function + +function get_par_z(par_z) + use inputparam, only: z + implicit none + double precision:: par_z + integer:: get_par_z + par_z = z + get_par_z = 0 +end function + +function set_par_z(par_z) + use inputparam, only: z + implicit none + double precision:: par_z + integer:: set_par_z + z = par_z + set_par_z = 0 +end function + +function get_par_fenerg(par_fenerg) + use inputparam, only: fenerg + implicit none + double precision:: par_fenerg + integer:: get_par_fenerg + par_fenerg = fenerg + get_par_fenerg = 0 +end function + +function set_par_fenerg(par_fenerg) + use inputparam, only: fenerg + implicit none + double precision:: par_fenerg + integer:: set_par_fenerg + fenerg = par_fenerg + set_par_fenerg = 0 +end function + +function get_par_richac(par_richac) + use inputparam, only: richac + implicit none + double precision:: par_richac + integer:: get_par_richac + par_richac = richac + get_par_richac = 0 +end function + +function set_par_richac(par_richac) + use inputparam, only: richac + implicit none + double precision:: par_richac + integer:: set_par_richac + richac = par_richac + set_par_richac = 0 +end function + +function get_par_frein(par_frein) + use inputparam, only: frein + implicit none + double precision:: par_frein + integer:: get_par_frein + par_frein = frein + get_par_frein = 0 +end function + +function set_par_frein(par_frein) + use inputparam, only: frein + implicit none + double precision:: par_frein + integer:: set_par_frein + frein = par_frein + set_par_frein = 0 +end function + +function get_par_K_Kawaler(par_K_Kawaler) + use inputparam, only: K_Kawaler + implicit none + double precision:: par_K_Kawaler + integer:: get_par_K_Kawaler + par_K_Kawaler = K_Kawaler + get_par_K_Kawaler = 0 +end function + +function set_par_K_Kawaler(par_K_Kawaler) + use inputparam, only: K_Kawaler + implicit none + double precision:: par_K_Kawaler + integer:: set_par_K_Kawaler + K_Kawaler = par_K_Kawaler + set_par_K_Kawaler = 0 +end function + +function get_par_Omega_saturation(par_Omega_saturation) + use inputparam, only: Omega_saturation + implicit none + double precision:: par_Omega_saturation + integer:: get_par_Omega_saturation + par_Omega_saturation = Omega_saturation + get_par_Omega_saturation = 0 +end function + +function set_par_Omega_saturation(par_Omega_saturation) + use inputparam, only: Omega_saturation + implicit none + double precision:: par_Omega_saturation + integer:: set_par_Omega_saturation + Omega_saturation = par_Omega_saturation + set_par_Omega_saturation = 0 +end function + +function get_par_rapcrilim(par_rapcrilim) + use inputparam, only: rapcrilim + implicit none + double precision:: par_rapcrilim + integer:: get_par_rapcrilim + par_rapcrilim = rapcrilim + get_par_rapcrilim = 0 +end function + +function set_par_rapcrilim(par_rapcrilim) + use inputparam, only: rapcrilim + implicit none + double precision:: par_rapcrilim + integer:: set_par_rapcrilim + rapcrilim = par_rapcrilim + set_par_rapcrilim = 0 +end function + +function get_par_vwant(par_vwant) + use inputparam, only: vwant + implicit none + double precision:: par_vwant + integer:: get_par_vwant + par_vwant = vwant + get_par_vwant = 0 +end function + +function set_par_vwant(par_vwant) + use inputparam, only: vwant + implicit none + double precision:: par_vwant + integer:: set_par_vwant + vwant = par_vwant + set_par_vwant = 0 +end function + +function get_par_xfom(par_xfom) + use inputparam, only: xfom + implicit none + double precision:: par_xfom + integer:: get_par_xfom + par_xfom = xfom + get_par_xfom = 0 +end function + +function set_par_xfom(par_xfom) + use inputparam, only: xfom + implicit none + double precision:: par_xfom + integer:: set_par_xfom + xfom = par_xfom + set_par_xfom = 0 +end function + +function get_par_omega(par_omega) + use inputparam, only: omega + implicit none + double precision:: par_omega + integer:: get_par_omega + par_omega = omega + get_par_omega = 0 +end function + +function set_par_omega(par_omega) + use inputparam, only: omega + implicit none + double precision:: par_omega + integer:: set_par_omega + omega = par_omega + set_par_omega = 0 +end function + +function get_par_xdial(par_xdial) + use inputparam, only: xdial + implicit none + double precision:: par_xdial + integer:: get_par_xdial + par_xdial = xdial + get_par_xdial = 0 +end function + +function set_par_xdial(par_xdial) + use inputparam, only: xdial + implicit none + double precision:: par_xdial + integer:: set_par_xdial + xdial = par_xdial + set_par_xdial = 0 +end function + +function get_par_B_initial(par_B_initial) + use inputparam, only: B_initial + implicit none + double precision:: par_B_initial + integer:: get_par_B_initial + par_B_initial = B_initial + get_par_B_initial = 0 +end function + +function set_par_B_initial(par_B_initial) + use inputparam, only: B_initial + implicit none + double precision:: par_B_initial + integer:: set_par_B_initial + B_initial = par_B_initial + set_par_B_initial = 0 +end function + +function get_par_add_diff(par_add_diff) + use inputparam, only: add_diff + implicit none + double precision:: par_add_diff + integer:: get_par_add_diff + par_add_diff = add_diff + get_par_add_diff = 0 +end function + +function set_par_add_diff(par_add_diff) + use inputparam, only: add_diff + implicit none + double precision:: par_add_diff + integer:: set_par_add_diff + add_diff = par_add_diff + set_par_add_diff = 0 +end function + +function get_par_fmlos(par_fmlos) + use inputparam, only: fmlos + implicit none + double precision:: par_fmlos + integer:: get_par_fmlos + par_fmlos = fmlos + get_par_fmlos = 0 +end function + +function set_par_fmlos(par_fmlos) + use inputparam, only: fmlos + implicit none + double precision:: par_fmlos + integer:: set_par_fmlos + fmlos = par_fmlos + set_par_fmlos = 0 +end function + +function get_par_fitm(par_fitm) + use inputparam, only: fitm + implicit none + double precision:: par_fitm + integer:: get_par_fitm + par_fitm = fitm + get_par_fitm = 0 +end function + +function set_par_fitm(par_fitm) + use inputparam, only: fitm + implicit none + double precision:: par_fitm + integer:: set_par_fitm + fitm = par_fitm + set_par_fitm = 0 +end function + +function get_par_fitmi(par_fitmi) + use inputparam, only: fitmi + implicit none + double precision:: par_fitmi + integer:: get_par_fitmi + par_fitmi = fitmi + get_par_fitmi = 0 +end function + +function set_par_fitmi(par_fitmi) + use inputparam, only: fitmi + implicit none + double precision:: par_fitmi + integer:: set_par_fitmi + fitmi = par_fitmi + set_par_fitmi = 0 +end function + +function get_par_fitmi_default(par_fitmi_default) + use inputparam, only: fitmi_default + implicit none + double precision:: par_fitmi_default + integer:: get_par_fitmi_default + par_fitmi_default = fitmi_default + get_par_fitmi_default = 0 +end function + +function set_par_fitmi_default(par_fitmi_default) + use inputparam, only: fitmi_default + implicit none + double precision:: par_fitmi_default + integer:: set_par_fitmi_default + fitmi_default = par_fitmi_default + set_par_fitmi_default = 0 +end function + +function get_par_deltal(par_deltal) + use inputparam, only: deltal + implicit none + double precision:: par_deltal + integer:: get_par_deltal + par_deltal = deltal + get_par_deltal = 0 +end function + +function set_par_deltal(par_deltal) + use inputparam, only: deltal + implicit none + double precision:: par_deltal + integer:: set_par_deltal + deltal = par_deltal + set_par_deltal = 0 +end function + +function get_par_deltat(par_deltat) + use inputparam, only: deltat + implicit none + double precision:: par_deltat + integer:: get_par_deltat + par_deltat = deltat + get_par_deltat = 0 +end function + +function set_par_deltat(par_deltat) + use inputparam, only: deltat + implicit none + double precision:: par_deltat + integer:: set_par_deltat + deltat = par_deltat + set_par_deltat = 0 +end function + +function get_par_elph(par_elph) + use inputparam, only: elph + implicit none + double precision:: par_elph + integer:: get_par_elph + par_elph = elph + get_par_elph = 0 +end function + +function set_par_elph(par_elph) + use inputparam, only: elph + implicit none + double precision:: par_elph + integer:: set_par_elph + elph = par_elph + set_par_elph = 0 +end function + +function get_par_dovhp(par_dovhp) + use inputparam, only: dovhp + implicit none + double precision:: par_dovhp + integer:: get_par_dovhp + par_dovhp = dovhp + get_par_dovhp = 0 +end function + +function set_par_dovhp(par_dovhp) + use inputparam, only: dovhp + implicit none + double precision:: par_dovhp + integer:: set_par_dovhp + dovhp = par_dovhp + set_par_dovhp = 0 +end function + +function get_par_dunder(par_dunder) + use inputparam, only: dunder + implicit none + double precision:: par_dunder + integer:: get_par_dunder + par_dunder = dunder + get_par_dunder = 0 +end function + +function set_par_dunder(par_dunder) + use inputparam, only: dunder + implicit none + double precision:: par_dunder + integer:: set_par_dunder + dunder = par_dunder + set_par_dunder = 0 +end function + +function get_par_gkorm(par_gkorm) + use inputparam, only: gkorm + implicit none + double precision:: par_gkorm + integer:: get_par_gkorm + par_gkorm = gkorm + get_par_gkorm = 0 +end function + +function set_par_gkorm(par_gkorm) + use inputparam, only: gkorm + implicit none + double precision:: par_gkorm + integer:: set_par_gkorm + gkorm = par_gkorm + set_par_gkorm = 0 +end function + +function get_par_alph(par_alph) + use inputparam, only: alph + implicit none + double precision:: par_alph + integer:: get_par_alph + par_alph = alph + get_par_alph = 0 +end function + +function set_par_alph(par_alph) + use inputparam, only: alph + implicit none + double precision:: par_alph + integer:: set_par_alph + alph = par_alph + set_par_alph = 0 +end function + +function get_par_agdr(par_agdr) + use inputparam, only: agdr + implicit none + double precision:: par_agdr + integer:: get_par_agdr + par_agdr = agdr + get_par_agdr = 0 +end function + +function set_par_agdr(par_agdr) + use inputparam, only: agdr + implicit none + double precision:: par_agdr + integer:: set_par_agdr + agdr = par_agdr + set_par_agdr = 0 +end function + +function get_par_faktor(par_faktor) + use inputparam, only: faktor + implicit none + double precision:: par_faktor + integer:: get_par_faktor + par_faktor = faktor + get_par_faktor = 0 +end function + +function set_par_faktor(par_faktor) + use inputparam, only: faktor + implicit none + double precision:: par_faktor + integer:: set_par_faktor + faktor = par_faktor + set_par_faktor = 0 +end function + +function get_par_dgrp(par_dgrp) + use inputparam, only: dgrp + implicit none + double precision:: par_dgrp + integer:: get_par_dgrp + par_dgrp = dgrp + get_par_dgrp = 0 +end function + +function set_par_dgrp(par_dgrp) + use inputparam, only: dgrp + implicit none + double precision:: par_dgrp + integer:: set_par_dgrp + dgrp = par_dgrp + set_par_dgrp = 0 +end function + +function get_par_dgrl(par_dgrl) + use inputparam, only: dgrl + implicit none + double precision:: par_dgrl + integer:: get_par_dgrl + par_dgrl = dgrl + get_par_dgrl = 0 +end function + +function set_par_dgrl(par_dgrl) + use inputparam, only: dgrl + implicit none + double precision:: par_dgrl + integer:: set_par_dgrl + dgrl = par_dgrl + set_par_dgrl = 0 +end function + +function get_par_dgry(par_dgry) + use inputparam, only: dgry + implicit none + double precision:: par_dgry + integer:: get_par_dgry + par_dgry = dgry + get_par_dgry = 0 +end function + +function set_par_dgry(par_dgry) + use inputparam, only: dgry + implicit none + double precision:: par_dgry + integer:: set_par_dgry + dgry = par_dgry + set_par_dgry = 0 +end function + +function get_par_dgrc(par_dgrc) + use inputparam, only: dgrc + implicit none + double precision:: par_dgrc + integer:: get_par_dgrc + par_dgrc = dgrc + get_par_dgrc = 0 +end function + +function set_par_dgrc(par_dgrc) + use inputparam, only: dgrc + implicit none + double precision:: par_dgrc + integer:: set_par_dgrc + dgrc = par_dgrc + set_par_dgrc = 0 +end function + +function get_par_dgro(par_dgro) + use inputparam, only: dgro + implicit none + double precision:: par_dgro + integer:: get_par_dgro + par_dgro = dgro + get_par_dgro = 0 +end function + +function set_par_dgro(par_dgro) + use inputparam, only: dgro + implicit none + double precision:: par_dgro + integer:: set_par_dgro + dgro = par_dgro + set_par_dgro = 0 +end function + +function get_par_dgr20(par_dgr20) + use inputparam, only: dgr20 + implicit none + double precision:: par_dgr20 + integer:: get_par_dgr20 + par_dgr20 = dgr20 + get_par_dgr20 = 0 +end function + +function set_par_dgr20(par_dgr20) + use inputparam, only: dgr20 + implicit none + double precision:: par_dgr20 + integer:: set_par_dgr20 + dgr20 = par_dgr20 + set_par_dgr20 = 0 +end function + +function get_par_xcn(par_xcn) + use inputparam, only: xcn + implicit none + double precision:: par_xcn + integer:: get_par_xcn + par_xcn = xcn + get_par_xcn = 0 +end function + +function set_par_xcn(par_xcn) + use inputparam, only: xcn + implicit none + double precision:: par_xcn + integer:: set_par_xcn + xcn = par_xcn + set_par_xcn = 0 +end function + +function get_par_starname(par_starname) + use inputparam, only: starname + implicit none + character(256):: par_starname + integer:: get_par_starname + par_starname = starname + get_par_starname = 0 +end function + +function set_par_starname(par_starname) + use inputparam, only: starname + implicit none + character(256):: par_starname + integer:: set_par_starname + starname = par_starname + set_par_starname = 0 +end function +! **** End Parameters + function commit_parameters() implicit none integer:: commit_parameters From 0715e51dfc5c63bc910a061b6d16d3b3352a9a43 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 7 Mar 2022 14:45:26 +0100 Subject: [PATCH 08/72] Add setters --- src/amuse/community/genec/interface.f90 | 317 ++++++++++++++---------- 1 file changed, 191 insertions(+), 126 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 77ad158fa5..6a0ed98d8b 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1780,6 +1780,16 @@ function get_age(index_of_the_star, age) get_age = 0 end function +function set_age(index_of_the_star, age) + use timestep, only: alter + implicit none + integer:: index_of_the_star + double precision:: age + integer:: set_age + alter = age + set_age = 0 +end function + function get_density_at_zone(index_of_the_star, zone, rho_i) use strucmod, only: rho, m implicit none @@ -1794,6 +1804,20 @@ function get_density_at_zone(index_of_the_star, zone, rho_i) get_density_at_zone = 0 end function +function set_density_at_zone(index_of_the_star, zone, rho_i) + use strucmod, only: rho, m + implicit none + integer:: index_of_the_star + integer:: zone, i + double precision:: rho_i + integer:: set_density_at_zone + i = m - zone + if (zone <= m) then + rho(i) = log(rho_i) + end if + set_density_at_zone = 0 +end function + function get_luminosity(index_of_the_star, luminosity) !use strucmod, only: s, m use caramodele, only: gls @@ -1806,6 +1830,18 @@ function get_luminosity(index_of_the_star, luminosity) get_luminosity = 0 end function +function set_luminosity(index_of_the_star, luminosity) + !use strucmod, only: s, m + use caramodele, only: gls + implicit none + integer:: index_of_the_star + double precision:: luminosity + integer:: set_luminosity + !luminosity = exp(s(m)) ! in cgs units, so erg/s? + gls = luminosity + set_luminosity = 0 +end function + function get_luminosity_at_zone(index_of_the_star, zone, lum_i) use strucmod, only: s, m implicit none @@ -1821,6 +1857,20 @@ function get_luminosity_at_zone(index_of_the_star, zone, lum_i) get_luminosity_at_zone = 0 end function +function set_luminosity_at_zone(index_of_the_star, zone, lum_i) + use strucmod, only: s, m + implicit none + integer:: index_of_the_star + integer:: zone, i + double precision:: lum_i + integer:: set_luminosity_at_zone + i = m - zone + if (zone <= m) then + s(i) = log(lum_i + 1) + end if + set_luminosity_at_zone = 0 +end function + function get_mass_fraction_at_zone(index_of_the_star, zone, dq_i) use strucmod, only: q, m implicit none @@ -1848,6 +1898,15 @@ function get_mass(index_of_the_star, mass) get_mass = 0 end function +function set_mass(index_of_the_star, mass) + use amuse_helpers, only:mstar ! this is initial mass only? + implicit none + integer:: set_mass, index_of_the_star + double precision:: mass + mstar = mass + set_mass = 0 +end function + function get_mass_of_species(index_of_the_star, species, species_mass) implicit none integer:: index_of_the_star @@ -1990,13 +2049,98 @@ function get_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, get_mass_fraction_of_species_at_zone = 0 end function +function set_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) + use strucmod, only: m + use abundmod, only: & + x,y3,y,xc12,xc13,xc14,xn14,xn15,xo16,xo17,xo18,xf18,xf19,xne20,xne21,xne22,xna23,xmg24,& + xmg25,xmg26,xal26,xal27,xsi28,xprot,xneut,xbid,xbid1 + implicit none + integer:: index_of_the_star + integer:: species, zone, i + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + i = m - zone + if (zone <= m) then + select case(species) + case(1) + x(i) = Xj_i + case(2) + y3(i) = Xj_i + case(3) + y(i) = Xj_i + case(4) + xc12(i) = Xj_i + case(5) + xc13(i) = Xj_i + case(6) + xn14(i) = Xj_i + case(7) + xn14(i) = Xj_i + case(8) + xo16(i) = Xj_i + case(9) + xo17(i) = Xj_i + case(10) + xo18(i) = Xj_i + case(11) + xne20(i) = Xj_i + case(12) + xne22(i) = Xj_i + case(13) + xmg24(i) = Xj_i + case(14) + xmg25(i) = Xj_i + case(15) + xmg26(i) = Xj_i + case(16) + xc14(i) = Xj_i + case(17) + xf18(i) = Xj_i + case(18) + xf19(i) = Xj_i + case(19) + xne21(i) = Xj_i + case(20) + xna23(i) = Xj_i + case(21) + xal26(i) = Xj_i + case(22) + xal27(i) = Xj_i + case(23) + xsi28(i) = Xj_i + case(24) + xneut(i) = Xj_i + case(25) + xprot(i) = Xj_i + case(26) + xbid(i) = Xj_i + case(27) + xbid1(i) = Xj_i + !case default + end select + end if + + set_mass_fraction_of_species_at_zone = 0 +end function + function get_metallicity(metallicity) + use amuse_helpers, only: zini implicit none double precision:: metallicity integer:: get_metallicity + metallicity = zini get_metallicity = 0 end function +function set_metallicity(metallicity) + use amuse_helpers, only: zini + implicit none + double precision:: metallicity + integer:: set_metallicity + zini = metallicity + set_metallicity = 0 +end function + function get_mu_at_zone(index_of_the_star, zone, mu_i) use strucmod, only: m implicit none @@ -2065,11 +2209,11 @@ function get_name_of_species(index_of_the_star, species, species_name) !xXXYY: as above get_name_of_species = 0 end function - +! function get_number_of_particles() implicit none integer:: get_number_of_particles - get_number_of_particles = 0 + get_number_of_particles = -1 end function function get_number_of_species(index_of_the_star, n_species) @@ -2141,16 +2285,43 @@ function get_pressure_at_zone(index_of_the_star, zone, P_i) get_pressure_at_zone = 0 end function -function get_radius(index_of_the_star, radius) - use strucmod, only: r, m +function set_pressure_at_zone(index_of_the_star, zone, P_i) + use strucmod, only: p, m implicit none integer:: index_of_the_star - double precision:: radius + integer:: zone, i + double precision:: P_i + integer:: set_pressure_at_zone + if (zone <= m) then + i = m - zone + p(i) = log(P_i) + end if + set_pressure_at_zone = 0 +end function + +function get_radius(index_of_the_star, am_radius) + use caramodele, only: radius + !use strucmod, only: r, m + implicit none + integer:: index_of_the_star + double precision:: am_radius integer:: get_radius - radius = exp(r(1)) ! in cm + am_radius = 10**radius + !radius = exp(r(1)) ! in cm get_radius = 0 end function +function set_radius(index_of_the_star, am_radius) + use caramodele, only: radius + !use strucmod, only: r, m + implicit none + integer:: index_of_the_star + double precision:: am_radius + integer:: set_radius + radius = log10(am_radius) + set_radius = 0 +end function + function get_radius_at_zone(index_of_the_star, zone, R_i) use strucmod, only: r, m implicit none @@ -2165,6 +2336,20 @@ function get_radius_at_zone(index_of_the_star, zone, R_i) get_radius_at_zone = 0 end function +function set_radius_at_zone(index_of_the_star, zone, R_i) + use strucmod, only: r, m + implicit none + integer:: index_of_the_star + integer:: zone, i + double precision:: R_i + integer:: set_radius_at_zone + i = m - zone + if (zone <= m) then + r(i) = log(R_i) + end if + set_radius_at_zone = 0 +end function + function get_stellar_type(index_of_the_star, stellar_type) implicit none integer:: index_of_the_star @@ -2251,20 +2436,6 @@ function recommit_particles() recommit_particles = 0 end function -function set_density_at_zone(index_of_the_star, zone, rho_i) - use strucmod, only: rho, m - implicit none - integer:: index_of_the_star - integer:: zone, i - double precision:: rho_i - integer:: set_density_at_zone - i = m - zone - if (zone <= m) then - rho(i) = log(rho_i) - end if - set_density_at_zone = 0 -end function - function set_genec_path(path) use evol, only: input_dir implicit none @@ -2285,112 +2456,6 @@ function set_starname(index_of_the_star) set_starname = 0 end function -function set_mass(index_of_the_star, mass) - use amuse_helpers, only:mstar ! this is initial mass only? - implicit none - integer:: set_mass, index_of_the_star - double precision:: mass - mstar = mass - set_mass = 0 -end function - -function set_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) - use strucmod, only: m - use abundmod, only: & - x,y3,y,xc12,xc13,xc14,xn14,xn15,xo16,xo17,xo18,xf18,xf19,xne20,xne21,xne22,xna23,xmg24,& - xmg25,xmg26,xal26,xal27,xsi28,xprot,xneut,xbid,xbid1 - implicit none - integer:: index_of_the_star - integer:: species, zone, i - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone - i = m - zone - if (zone <= m) then - select case(species) - case(1) - x(i) = Xj_i - case(2) - y3(i) = Xj_i - case(3) - y(i) = Xj_i - case(4) - xc12(i) = Xj_i - case(5) - xc13(i) = Xj_i - case(6) - xn14(i) = Xj_i - case(7) - xn14(i) = Xj_i - case(8) - xo16(i) = Xj_i - case(9) - xo17(i) = Xj_i - case(10) - xo18(i) = Xj_i - case(11) - xne20(i) = Xj_i - case(12) - xne22(i) = Xj_i - case(13) - xmg24(i) = Xj_i - case(14) - xmg25(i) = Xj_i - case(15) - xmg26(i) = Xj_i - case(16) - xc14(i) = Xj_i - case(17) - xf18(i) = Xj_i - case(18) - xf19(i) = Xj_i - case(19) - xne21(i) = Xj_i - case(20) - xna23(i) = Xj_i - case(21) - xal26(i) = Xj_i - case(22) - xal27(i) = Xj_i - case(23) - xsi28(i) = Xj_i - case(24) - xneut(i) = Xj_i - case(25) - xprot(i) = Xj_i - case(26) - xbid(i) = Xj_i - case(27) - xbid1(i) = Xj_i - !case default - end select - end if - - set_mass_fraction_of_species_at_zone = 0 -end function - -function set_metallicity(metallicity) - use amuse_helpers, only: zini - implicit none - double precision:: metallicity - integer:: set_metallicity - zini = metallicity - set_metallicity = 0 -end function - -function set_radius_at_zone(index_of_the_star, zone, R_i) - use strucmod, only: r, m - implicit none - integer:: index_of_the_star - integer:: zone, i - double precision:: R_i - integer:: set_radius_at_zone - i = m - zone - if (zone <= m) then - r(i) = log(R_i) - end if - set_radius_at_zone = 0 -end function - function set_temperature_at_zone(index_of_the_star, zone, T_i) use strucmod, only: t, m implicit none From 12ba3c7218677883280531c36a36cc866bb10eef Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 7 Mar 2022 14:46:11 +0100 Subject: [PATCH 09/72] Add parameter setters/getters --- src/amuse/community/genec/interface.py | 4149 +++++++++++++++++++++++- 1 file changed, 4023 insertions(+), 126 deletions(-) diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index b36cdaa492..7a0d68be6f 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -1,3 +1,5 @@ +import numpy +from amuse.datamodel import ParticlesWithFilteredAttributes from amuse.community import CodeInterface from amuse.community import LegacyFunctionSpecification from amuse.community import legacy_function @@ -50,203 +52,4097 @@ def set_genec_path(): """ return function + # Parameters + @legacy_function - def commit_parameters(): + def get_par_nwseq(): + 'get parameter nwseq' function = LegacyFunctionSpecification() + function.addParameter( + 'nwseq', dtype='int32', + direction=function.OUT, + ) function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' return function @legacy_function - def set_starname(): - """ - Set the star name (identical to AMUSE particle key?) - """ + def set_par_nwseq(): + 'set parameter nwseq' function = LegacyFunctionSpecification() function.addParameter( - 'index_of_the_star', dtype='int32', + 'nwseq', dtype='int32', direction=function.IN, - description="The star's key" ) function.result_type = 'int32' - function.result_doc = """ + function.result_doc = ''' 0 - OK The value has been set. -1 - ERROR Unable to set. -2 - ERROR Cannot set at this point, already running. - """ + ''' return function @legacy_function - def new_particle(): - """ - Define a new star in the code. The star will start with the given mass. - """ + def get_par_modanf(): + 'get parameter modanf' function = LegacyFunctionSpecification() - function.can_handle_array = False function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.OUT, - description=( - "The new index for the star. This index can be used to refer " - "to this star in other functions" - ) + 'modanf', dtype='int32', + direction=function.OUT, ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_modanf(): + 'set parameter modanf' + function = LegacyFunctionSpecification() function.addParameter( - 'mass', dtype='float64', direction=function.IN, - description="The initial mass of the star") - function.addParameter( - 'metallicity', dtype='float64', direction=function.IN, - description="The initial metallicity of the star") + 'modanf', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_nzmod(): + 'get parameter nzmod' + function = LegacyFunctionSpecification() function.addParameter( - 'starname', dtype='string', direction=function.IN, - default='AmuseStar', description="The star's name") - # function.addParameter( - # 'age_tag', dtype='float64', direction=function.IN, - # description="Starting age of the star *to be specified exactly*") + 'nzmod', dtype='int32', + direction=function.OUT, + ) function.result_type = 'int32' - function.result_doc = """ + function.result_doc = ''' 0 - OK - New star was loaded and the index_of_the_star parameter set. + Got the value. -1 - ERROR - New star could not be created. - """ + Unable to get. + ''' return function @legacy_function - def get_luminosity_at_zone(): - """ - Retrieve the luminosity at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True + def set_par_nzmod(): + 'set parameter nzmod' + function = LegacyFunctionSpecification() function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of" + 'nzmod', dtype='int32', + direction=function.IN, ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_irot(): + 'get parameter irot' + function = LegacyFunctionSpecification() function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of" + 'irot', dtype='int32', + direction=function.OUT, ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_irot(): + 'set parameter irot' + function = LegacyFunctionSpecification() function.addParameter( - 'lum_i', dtype='float64', direction=function.OUT, - description=( - "The luminosity at the specified zone/mesh-cell of the star." - ) + 'irot', dtype='int32', + direction=function.IN, ) function.result_type = 'int32' - function.result_doc = """ + function.result_doc = ''' 0 - OK - The value was retrieved. + The value has been set. -1 - ERROR - A star with the given index was not found. + Unable to set. -2 - ERROR - A zone with the given index was not found. - """ + Cannot set at this point, already running. + ''' return function @legacy_function - def get_mass_of_species(): - """ - Retrieve the mass number of the chemical abundance variable of the - star. - """ + def get_par_isol(): + 'get parameter isol' function = LegacyFunctionSpecification() - function.can_handle_array = True function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") + 'isol', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_isol(): + 'set parameter isol' + function = LegacyFunctionSpecification() function.addParameter( - 'species', dtype='int32', direction=function.IN, - description="The species of the star to get the mass number of") + 'isol', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_imagn(): + 'get parameter imagn' + function = LegacyFunctionSpecification() function.addParameter( - 'species_mass', dtype='float64', direction=function.OUT, - description=( - "The mass number of the chemical abundance variable of " - "the star." - ) + 'imagn', dtype='int32', + direction=function.OUT, ) function.result_type = 'int32' - function.result_doc = """ + function.result_doc = ''' 0 - OK - The value was retrieved. + Got the value. -1 - ERROR - A star with the given index was not found. - """ + Unable to get. + ''' return function @legacy_function - def get_mass_fraction_at_zone(): - """ - Retrieve the mass fraction at the specified zone/mesh-cell of the star. - """ + def set_par_imagn(): + 'set parameter imagn' function = LegacyFunctionSpecification() - function.can_handle_array = True function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") + 'imagn', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_ialflu(): + 'get parameter ialflu' + function = LegacyFunctionSpecification() function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") + 'ialflu', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_ialflu(): + 'set parameter ialflu' + function = LegacyFunctionSpecification() function.addParameter( - 'dq_i', dtype='float64', direction=function.OUT, - description=( - "The mass fraction at the specified zone/mesh-cell of " - "the star." - ) + 'ialflu', dtype='int32', + direction=function.IN, ) function.result_type = 'int32' - function.result_doc = """ + function.result_doc = ''' 0 - OK - The value was retrieved. + The value has been set. -1 - ERROR - A star with the given index was not found. + Unable to set. -2 - ERROR - A zone with the given index was not found. - """ + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_ianiso(): + 'get parameter ianiso' + function = LegacyFunctionSpecification() + function.addParameter( + 'ianiso', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' return function + @legacy_function + def set_par_ianiso(): + 'set parameter ianiso' + function = LegacyFunctionSpecification() + function.addParameter( + 'ianiso', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function -class Genec(StellarEvolution, InternalStellarStructure): + @legacy_function + def get_par_ipop3(): + 'get parameter ipop3' + function = LegacyFunctionSpecification() + function.addParameter( + 'ipop3', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function - def __init__(self, **options): - InCodeComponentImplementation.__init__( - self, GenecInterface(**options), **options) - self.model_time = 0.0 | units.yr + @legacy_function + def set_par_ipop3(): + 'set parameter ipop3' + function = LegacyFunctionSpecification() + function.addParameter( + 'ipop3', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function - def define_parameters(self, handler): - handler.add_method_parameter( - None, - "set_genec_path", - "path_to_data", - "Path to the data directory", - default_value=self.data_directory + @legacy_function + def get_par_ibasnet(): + 'get parameter ibasnet' + function = LegacyFunctionSpecification() + function.addParameter( + 'ibasnet', dtype='int32', + direction=function.OUT, ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function - def define_particle_sets(self, handler): - handler.define_set('particles', 'index_of_the_star') - handler.set_new('particles', 'new_particle') - - handler.add_getter('particles', 'get_radius') - handler.add_getter('particles', 'get_mass') - handler.add_getter('particles', 'get_age') - handler.add_getter('particles', 'get_luminosity') - handler.add_getter('particles', 'get_temperature') - handler.add_getter('particles', 'get_time_step', names=('time_step',)) - # handler.add_method('particles', 'get_number_of_zones') - # handler.add_method('particles', 'get_radius_profile') - # handler.add_method('particles', 'get_temperature_profile') - handler.add_method('particles', 'get_luminosity_profile') - handler.add_method('particles', 'get_mass_profile') - handler.add_method('particles', 'get_cumulative_mass_profile') - - handler.add_method('particles', 'evolve_one_step') - handler.add_method('particles', 'evolve_for') - InternalStellarStructure.define_particle_sets( - self, handler, set_name='particles' - ) - - handler.set_delete('particles', 'delete_star') + @legacy_function + def set_par_ibasnet(): + 'set parameter ibasnet' + function = LegacyFunctionSpecification() + function.addParameter( + 'ibasnet', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_phase(): + 'get parameter phase' + function = LegacyFunctionSpecification() + function.addParameter( + 'phase', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_phase(): + 'set parameter phase' + function = LegacyFunctionSpecification() + function.addParameter( + 'phase', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_iopac(): + 'get parameter iopac' + function = LegacyFunctionSpecification() + function.addParameter( + 'iopac', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_iopac(): + 'set parameter iopac' + function = LegacyFunctionSpecification() + function.addParameter( + 'iopac', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_ikappa(): + 'get parameter ikappa' + function = LegacyFunctionSpecification() + function.addParameter( + 'ikappa', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_ikappa(): + 'set parameter ikappa' + function = LegacyFunctionSpecification() + function.addParameter( + 'ikappa', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_idiff(): + 'get parameter idiff' + function = LegacyFunctionSpecification() + function.addParameter( + 'idiff', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_idiff(): + 'set parameter idiff' + function = LegacyFunctionSpecification() + function.addParameter( + 'idiff', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_iadvec(): + 'get parameter iadvec' + function = LegacyFunctionSpecification() + function.addParameter( + 'iadvec', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_iadvec(): + 'set parameter iadvec' + function = LegacyFunctionSpecification() + function.addParameter( + 'iadvec', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_istati(): + 'get parameter istati' + function = LegacyFunctionSpecification() + function.addParameter( + 'istati', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_istati(): + 'set parameter istati' + function = LegacyFunctionSpecification() + function.addParameter( + 'istati', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_icoeff(): + 'get parameter icoeff' + function = LegacyFunctionSpecification() + function.addParameter( + 'icoeff', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_icoeff(): + 'set parameter icoeff' + function = LegacyFunctionSpecification() + function.addParameter( + 'icoeff', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_igamma(): + 'get parameter igamma' + function = LegacyFunctionSpecification() + function.addParameter( + 'igamma', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_igamma(): + 'set parameter igamma' + function = LegacyFunctionSpecification() + function.addParameter( + 'igamma', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_idialo(): + 'get parameter idialo' + function = LegacyFunctionSpecification() + function.addParameter( + 'idialo', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_idialo(): + 'set parameter idialo' + function = LegacyFunctionSpecification() + function.addParameter( + 'idialo', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_idialu(): + 'get parameter idialu' + function = LegacyFunctionSpecification() + function.addParameter( + 'idialu', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_idialu(): + 'set parameter idialu' + function = LegacyFunctionSpecification() + function.addParameter( + 'idialu', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_imloss(): + 'get parameter imloss' + function = LegacyFunctionSpecification() + function.addParameter( + 'imloss', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_imloss(): + 'set parameter imloss' + function = LegacyFunctionSpecification() + function.addParameter( + 'imloss', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_ifitm(): + 'get parameter ifitm' + function = LegacyFunctionSpecification() + function.addParameter( + 'ifitm', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_ifitm(): + 'set parameter ifitm' + function = LegacyFunctionSpecification() + function.addParameter( + 'ifitm', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_nndr(): + 'get parameter nndr' + function = LegacyFunctionSpecification() + function.addParameter( + 'nndr', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_nndr(): + 'set parameter nndr' + function = LegacyFunctionSpecification() + function.addParameter( + 'nndr', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_iledou(): + 'get parameter iledou' + function = LegacyFunctionSpecification() + function.addParameter( + 'iledou', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_iledou(): + 'set parameter iledou' + function = LegacyFunctionSpecification() + function.addParameter( + 'iledou', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_idifcon(): + 'get parameter idifcon' + function = LegacyFunctionSpecification() + function.addParameter( + 'idifcon', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_idifcon(): + 'set parameter idifcon' + function = LegacyFunctionSpecification() + function.addParameter( + 'idifcon', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_my(): + 'get parameter my' + function = LegacyFunctionSpecification() + function.addParameter( + 'my', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_my(): + 'set parameter my' + function = LegacyFunctionSpecification() + function.addParameter( + 'my', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_iover(): + 'get parameter iover' + function = LegacyFunctionSpecification() + function.addParameter( + 'iover', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_iover(): + 'set parameter iover' + function = LegacyFunctionSpecification() + function.addParameter( + 'iover', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_iunder(): + 'get parameter iunder' + function = LegacyFunctionSpecification() + function.addParameter( + 'iunder', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_iunder(): + 'set parameter iunder' + function = LegacyFunctionSpecification() + function.addParameter( + 'iunder', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_nbchx(): + 'get parameter nbchx' + function = LegacyFunctionSpecification() + function.addParameter( + 'nbchx', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_nbchx(): + 'set parameter nbchx' + function = LegacyFunctionSpecification() + function.addParameter( + 'nbchx', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_nrband(): + 'get parameter nrband' + function = LegacyFunctionSpecification() + function.addParameter( + 'nrband', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_nrband(): + 'set parameter nrband' + function = LegacyFunctionSpecification() + function.addParameter( + 'nrband', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_islow(): + 'get parameter islow' + function = LegacyFunctionSpecification() + function.addParameter( + 'islow', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_islow(): + 'set parameter islow' + function = LegacyFunctionSpecification() + function.addParameter( + 'islow', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_icncst(): + 'get parameter icncst' + function = LegacyFunctionSpecification() + function.addParameter( + 'icncst', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_icncst(): + 'set parameter icncst' + function = LegacyFunctionSpecification() + function.addParameter( + 'icncst', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_tauH_fit(): + 'get parameter tauH_fit' + function = LegacyFunctionSpecification() + function.addParameter( + 'tauH_fit', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_tauH_fit(): + 'set parameter tauH_fit' + function = LegacyFunctionSpecification() + function.addParameter( + 'tauH_fit', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_iauto(): + 'get parameter iauto' + function = LegacyFunctionSpecification() + function.addParameter( + 'iauto', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_iauto(): + 'set parameter iauto' + function = LegacyFunctionSpecification() + function.addParameter( + 'iauto', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_iprn(): + 'get parameter iprn' + function = LegacyFunctionSpecification() + function.addParameter( + 'iprn', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_iprn(): + 'set parameter iprn' + function = LegacyFunctionSpecification() + function.addParameter( + 'iprn', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_iout(): + 'get parameter iout' + function = LegacyFunctionSpecification() + function.addParameter( + 'iout', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_iout(): + 'set parameter iout' + function = LegacyFunctionSpecification() + function.addParameter( + 'iout', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_itmin(): + 'get parameter itmin' + function = LegacyFunctionSpecification() + function.addParameter( + 'itmin', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_itmin(): + 'set parameter itmin' + function = LegacyFunctionSpecification() + function.addParameter( + 'itmin', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_idebug(): + 'get parameter idebug' + function = LegacyFunctionSpecification() + function.addParameter( + 'idebug', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_idebug(): + 'set parameter idebug' + function = LegacyFunctionSpecification() + function.addParameter( + 'idebug', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_itests(): + 'get parameter itests' + function = LegacyFunctionSpecification() + function.addParameter( + 'itests', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_itests(): + 'set parameter itests' + function = LegacyFunctionSpecification() + function.addParameter( + 'itests', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_amuseinterface(): + 'get parameter amuseinterface' + function = LegacyFunctionSpecification() + function.addParameter( + 'amuseinterface', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_amuseinterface(): + 'set parameter amuseinterface' + function = LegacyFunctionSpecification() + function.addParameter( + 'amuseinterface', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_var_rates(): + 'get parameter var_rates' + function = LegacyFunctionSpecification() + function.addParameter( + 'var_rates', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_var_rates(): + 'set parameter var_rates' + function = LegacyFunctionSpecification() + function.addParameter( + 'var_rates', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_bintide(): + 'get parameter bintide' + function = LegacyFunctionSpecification() + function.addParameter( + 'bintide', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_bintide(): + 'set parameter bintide' + function = LegacyFunctionSpecification() + function.addParameter( + 'bintide', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_const_per(): + 'get parameter const_per' + function = LegacyFunctionSpecification() + function.addParameter( + 'const_per', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_const_per(): + 'set parameter const_per' + function = LegacyFunctionSpecification() + function.addParameter( + 'const_per', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_Add_Flux(): + 'get parameter Add_Flux' + function = LegacyFunctionSpecification() + function.addParameter( + 'Add_Flux', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_Add_Flux(): + 'set parameter Add_Flux' + function = LegacyFunctionSpecification() + function.addParameter( + 'Add_Flux', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_diff_only(): + 'get parameter diff_only' + function = LegacyFunctionSpecification() + function.addParameter( + 'diff_only', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_diff_only(): + 'set parameter diff_only' + function = LegacyFunctionSpecification() + function.addParameter( + 'diff_only', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_lowRSGMdot(): + 'get parameter lowRSGMdot' + function = LegacyFunctionSpecification() + function.addParameter( + 'lowRSGMdot', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_lowRSGMdot(): + 'set parameter lowRSGMdot' + function = LegacyFunctionSpecification() + function.addParameter( + 'lowRSGMdot', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_plot(): + 'get parameter plot' + function = LegacyFunctionSpecification() + function.addParameter( + 'plot', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_plot(): + 'set parameter plot' + function = LegacyFunctionSpecification() + function.addParameter( + 'plot', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_refresh(): + 'get parameter refresh' + function = LegacyFunctionSpecification() + function.addParameter( + 'refresh', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_refresh(): + 'set parameter refresh' + function = LegacyFunctionSpecification() + function.addParameter( + 'refresh', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_xyfiles(): + 'get parameter xyfiles' + function = LegacyFunctionSpecification() + function.addParameter( + 'xyfiles', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_xyfiles(): + 'set parameter xyfiles' + function = LegacyFunctionSpecification() + function.addParameter( + 'xyfiles', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_verbose(): + 'get parameter verbose' + function = LegacyFunctionSpecification() + function.addParameter( + 'verbose', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_verbose(): + 'set parameter verbose' + function = LegacyFunctionSpecification() + function.addParameter( + 'verbose', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_stop_deg(): + 'get parameter stop_deg' + function = LegacyFunctionSpecification() + function.addParameter( + 'stop_deg', dtype='bool', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_stop_deg(): + 'set parameter stop_deg' + function = LegacyFunctionSpecification() + function.addParameter( + 'stop_deg', dtype='bool', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_binm2(): + 'get parameter binm2' + function = LegacyFunctionSpecification() + function.addParameter( + 'binm2', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_binm2(): + 'set parameter binm2' + function = LegacyFunctionSpecification() + function.addParameter( + 'binm2', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_periodini(): + 'get parameter periodini' + function = LegacyFunctionSpecification() + function.addParameter( + 'periodini', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_periodini(): + 'set parameter periodini' + function = LegacyFunctionSpecification() + function.addParameter( + 'periodini', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_zinit(): + 'get parameter zinit' + function = LegacyFunctionSpecification() + function.addParameter( + 'zinit', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_zinit(): + 'set parameter zinit' + function = LegacyFunctionSpecification() + function.addParameter( + 'zinit', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_zsol(): + 'get parameter zsol' + function = LegacyFunctionSpecification() + function.addParameter( + 'zsol', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_zsol(): + 'set parameter zsol' + function = LegacyFunctionSpecification() + function.addParameter( + 'zsol', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_z(): + 'get parameter z' + function = LegacyFunctionSpecification() + function.addParameter( + 'z', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_z(): + 'set parameter z' + function = LegacyFunctionSpecification() + function.addParameter( + 'z', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_fenerg(): + 'get parameter fenerg' + function = LegacyFunctionSpecification() + function.addParameter( + 'fenerg', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_fenerg(): + 'set parameter fenerg' + function = LegacyFunctionSpecification() + function.addParameter( + 'fenerg', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_richac(): + 'get parameter richac' + function = LegacyFunctionSpecification() + function.addParameter( + 'richac', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_richac(): + 'set parameter richac' + function = LegacyFunctionSpecification() + function.addParameter( + 'richac', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_frein(): + 'get parameter frein' + function = LegacyFunctionSpecification() + function.addParameter( + 'frein', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_frein(): + 'set parameter frein' + function = LegacyFunctionSpecification() + function.addParameter( + 'frein', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_K_Kawaler(): + 'get parameter K_Kawaler' + function = LegacyFunctionSpecification() + function.addParameter( + 'K_Kawaler', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_K_Kawaler(): + 'set parameter K_Kawaler' + function = LegacyFunctionSpecification() + function.addParameter( + 'K_Kawaler', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_Omega_saturation(): + 'get parameter Omega_saturation' + function = LegacyFunctionSpecification() + function.addParameter( + 'Omega_saturation', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_Omega_saturation(): + 'set parameter Omega_saturation' + function = LegacyFunctionSpecification() + function.addParameter( + 'Omega_saturation', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_rapcrilim(): + 'get parameter rapcrilim' + function = LegacyFunctionSpecification() + function.addParameter( + 'rapcrilim', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_rapcrilim(): + 'set parameter rapcrilim' + function = LegacyFunctionSpecification() + function.addParameter( + 'rapcrilim', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_vwant(): + 'get parameter vwant' + function = LegacyFunctionSpecification() + function.addParameter( + 'vwant', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_vwant(): + 'set parameter vwant' + function = LegacyFunctionSpecification() + function.addParameter( + 'vwant', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_xfom(): + 'get parameter xfom' + function = LegacyFunctionSpecification() + function.addParameter( + 'xfom', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_xfom(): + 'set parameter xfom' + function = LegacyFunctionSpecification() + function.addParameter( + 'xfom', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_omega(): + 'get parameter omega' + function = LegacyFunctionSpecification() + function.addParameter( + 'omega', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_omega(): + 'set parameter omega' + function = LegacyFunctionSpecification() + function.addParameter( + 'omega', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_xdial(): + 'get parameter xdial' + function = LegacyFunctionSpecification() + function.addParameter( + 'xdial', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_xdial(): + 'set parameter xdial' + function = LegacyFunctionSpecification() + function.addParameter( + 'xdial', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_B_initial(): + 'get parameter B_initial' + function = LegacyFunctionSpecification() + function.addParameter( + 'B_initial', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_B_initial(): + 'set parameter B_initial' + function = LegacyFunctionSpecification() + function.addParameter( + 'B_initial', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_add_diff(): + 'get parameter add_diff' + function = LegacyFunctionSpecification() + function.addParameter( + 'add_diff', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_add_diff(): + 'set parameter add_diff' + function = LegacyFunctionSpecification() + function.addParameter( + 'add_diff', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_fmlos(): + 'get parameter fmlos' + function = LegacyFunctionSpecification() + function.addParameter( + 'fmlos', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_fmlos(): + 'set parameter fmlos' + function = LegacyFunctionSpecification() + function.addParameter( + 'fmlos', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_fitm(): + 'get parameter fitm' + function = LegacyFunctionSpecification() + function.addParameter( + 'fitm', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_fitm(): + 'set parameter fitm' + function = LegacyFunctionSpecification() + function.addParameter( + 'fitm', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_fitmi(): + 'get parameter fitmi' + function = LegacyFunctionSpecification() + function.addParameter( + 'fitmi', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_fitmi(): + 'set parameter fitmi' + function = LegacyFunctionSpecification() + function.addParameter( + 'fitmi', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_fitmi_default(): + 'get parameter fitmi_default' + function = LegacyFunctionSpecification() + function.addParameter( + 'fitmi_default', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_fitmi_default(): + 'set parameter fitmi_default' + function = LegacyFunctionSpecification() + function.addParameter( + 'fitmi_default', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_deltal(): + 'get parameter deltal' + function = LegacyFunctionSpecification() + function.addParameter( + 'deltal', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_deltal(): + 'set parameter deltal' + function = LegacyFunctionSpecification() + function.addParameter( + 'deltal', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_deltat(): + 'get parameter deltat' + function = LegacyFunctionSpecification() + function.addParameter( + 'deltat', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_deltat(): + 'set parameter deltat' + function = LegacyFunctionSpecification() + function.addParameter( + 'deltat', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_elph(): + 'get parameter elph' + function = LegacyFunctionSpecification() + function.addParameter( + 'elph', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_elph(): + 'set parameter elph' + function = LegacyFunctionSpecification() + function.addParameter( + 'elph', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_dovhp(): + 'get parameter dovhp' + function = LegacyFunctionSpecification() + function.addParameter( + 'dovhp', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_dovhp(): + 'set parameter dovhp' + function = LegacyFunctionSpecification() + function.addParameter( + 'dovhp', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_dunder(): + 'get parameter dunder' + function = LegacyFunctionSpecification() + function.addParameter( + 'dunder', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_dunder(): + 'set parameter dunder' + function = LegacyFunctionSpecification() + function.addParameter( + 'dunder', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_gkorm(): + 'get parameter gkorm' + function = LegacyFunctionSpecification() + function.addParameter( + 'gkorm', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_gkorm(): + 'set parameter gkorm' + function = LegacyFunctionSpecification() + function.addParameter( + 'gkorm', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_alph(): + 'get parameter alph' + function = LegacyFunctionSpecification() + function.addParameter( + 'alph', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_alph(): + 'set parameter alph' + function = LegacyFunctionSpecification() + function.addParameter( + 'alph', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_agdr(): + 'get parameter agdr' + function = LegacyFunctionSpecification() + function.addParameter( + 'agdr', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_agdr(): + 'set parameter agdr' + function = LegacyFunctionSpecification() + function.addParameter( + 'agdr', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_faktor(): + 'get parameter faktor' + function = LegacyFunctionSpecification() + function.addParameter( + 'faktor', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_faktor(): + 'set parameter faktor' + function = LegacyFunctionSpecification() + function.addParameter( + 'faktor', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_dgrp(): + 'get parameter dgrp' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgrp', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_dgrp(): + 'set parameter dgrp' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgrp', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_dgrl(): + 'get parameter dgrl' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgrl', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_dgrl(): + 'set parameter dgrl' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgrl', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_dgry(): + 'get parameter dgry' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgry', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_dgry(): + 'set parameter dgry' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgry', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_dgrc(): + 'get parameter dgrc' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgrc', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_dgrc(): + 'set parameter dgrc' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgrc', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_dgro(): + 'get parameter dgro' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgro', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_dgro(): + 'set parameter dgro' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgro', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_dgr20(): + 'get parameter dgr20' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgr20', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_dgr20(): + 'set parameter dgr20' + function = LegacyFunctionSpecification() + function.addParameter( + 'dgr20', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_xcn(): + 'get parameter xcn' + function = LegacyFunctionSpecification() + function.addParameter( + 'xcn', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_xcn(): + 'set parameter xcn' + function = LegacyFunctionSpecification() + function.addParameter( + 'xcn', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function + def get_par_starname(): + 'get parameter starname' + function = LegacyFunctionSpecification() + function.addParameter( + 'starname', dtype='string', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_starname(): + 'set parameter starname' + function = LegacyFunctionSpecification() + function.addParameter( + 'starname', dtype='string', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + # End parameters + + @legacy_function + def commit_parameters(): + function = LegacyFunctionSpecification() + function.result_type = 'int32' + return function + + @legacy_function + def set_starname(): + """ + Set the star name (identical to AMUSE particle key?) + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'index_of_the_star', dtype='int32', + direction=function.IN, + description="The star's key" + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + """ + return function + + @legacy_function + def new_particle(): + """ + Define a new star in the code. The star will start with the given mass. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = False + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.OUT, + description=( + "The new index for the star. This index can be used to refer " + "to this star in other functions" + ) + ) + function.addParameter( + 'mass', dtype='float64', direction=function.IN, + description="The initial mass of the star") + function.addParameter( + 'metallicity', dtype='float64', direction=function.IN, + default=0.014, + description="The initial metallicity of the star (default: 0.014)") + function.addParameter( + 'starname', dtype='string', direction=function.IN, + default='AmuseStar', description="The star's name") + # function.addParameter( + # 'age_tag', dtype='float64', direction=function.IN, + # description="Starting age of the star *to be specified exactly*") + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + New star was loaded and the index_of_the_star parameter set. + -1 - ERROR + New star could not be created. + """ + return function + + @legacy_function + def get_firstlast_zone(): + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter('first', dtype='int32', direction=function.OUT) + function.addParameter('last', dtype='int32', direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def get_luminosity_at_zone(): + """ + Retrieve the luminosity at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of" + ) + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of" + ) + function.addParameter( + 'lum_i', dtype='float64', direction=function.OUT, + description=( + "The luminosity at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + @legacy_function + def get_mass_of_species(): + """ + Retrieve the mass number of the chemical abundance variable of the + star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'species', dtype='int32', direction=function.IN, + description="The species of the star to get the mass number of") + function.addParameter( + 'species_mass', dtype='float64', direction=function.OUT, + description=( + "The mass number of the chemical abundance variable of " + "the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + @legacy_function + def get_mass_fraction_at_zone(): + """ + Retrieve the mass fraction at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'dq_i', dtype='float64', direction=function.OUT, + description=( + "The mass fraction at the specified zone/mesh-cell of " + "the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + +class Genec(StellarEvolution, InternalStellarStructure): + + def __init__(self, **options): + InCodeComponentImplementation.__init__( + self, GenecInterface(**options), **options) + self.model_time = 0.0 | units.yr + + def define_parameters(self, handler): + handler.add_method_parameter( + None, + "set_genec_path", + "path_to_data", + "Path to the data directory", + default_value=self.data_directory + ) + + handler.add_method_parameter( + "get_par_nwseq", + "set_par_nwseq", + "nwseq", + "GENEC parameter nwseq", + ) + + handler.add_method_parameter( + "get_par_modanf", + "set_par_modanf", + "modanf", + "GENEC parameter modanf", + ) + + handler.add_method_parameter( + "get_par_nzmod", + "set_par_nzmod", + "nzmod", + "GENEC parameter nzmod", + ) + + handler.add_method_parameter( + "get_par_irot", + "set_par_irot", + "irot", + "GENEC parameter irot", + ) + + handler.add_method_parameter( + "get_par_isol", + "set_par_isol", + "isol", + "GENEC parameter isol", + ) + + handler.add_method_parameter( + "get_par_imagn", + "set_par_imagn", + "imagn", + "GENEC parameter imagn", + ) + + handler.add_method_parameter( + "get_par_ialflu", + "set_par_ialflu", + "ialflu", + "GENEC parameter ialflu", + ) + + handler.add_method_parameter( + "get_par_ianiso", + "set_par_ianiso", + "ianiso", + "GENEC parameter ianiso", + ) + + handler.add_method_parameter( + "get_par_ipop3", + "set_par_ipop3", + "ipop3", + "GENEC parameter ipop3", + ) + + handler.add_method_parameter( + "get_par_ibasnet", + "set_par_ibasnet", + "ibasnet", + "GENEC parameter ibasnet", + ) + + handler.add_method_parameter( + "get_par_phase", + "set_par_phase", + "phase", + "GENEC parameter phase", + ) + + handler.add_method_parameter( + "get_par_iopac", + "set_par_iopac", + "iopac", + "GENEC parameter iopac", + ) + + handler.add_method_parameter( + "get_par_ikappa", + "set_par_ikappa", + "ikappa", + "GENEC parameter ikappa", + ) + + handler.add_method_parameter( + "get_par_idiff", + "set_par_idiff", + "idiff", + "GENEC parameter idiff", + ) + + handler.add_method_parameter( + "get_par_iadvec", + "set_par_iadvec", + "iadvec", + "GENEC parameter iadvec", + ) + + handler.add_method_parameter( + "get_par_istati", + "set_par_istati", + "istati", + "GENEC parameter istati", + ) + + handler.add_method_parameter( + "get_par_icoeff", + "set_par_icoeff", + "icoeff", + "GENEC parameter icoeff", + ) + + handler.add_method_parameter( + "get_par_igamma", + "set_par_igamma", + "igamma", + "GENEC parameter igamma", + ) + + handler.add_method_parameter( + "get_par_idialo", + "set_par_idialo", + "idialo", + "GENEC parameter idialo", + ) + + handler.add_method_parameter( + "get_par_idialu", + "set_par_idialu", + "idialu", + "GENEC parameter idialu", + ) + + handler.add_method_parameter( + "get_par_imloss", + "set_par_imloss", + "imloss", + "GENEC parameter imloss", + ) + + handler.add_method_parameter( + "get_par_ifitm", + "set_par_ifitm", + "ifitm", + "GENEC parameter ifitm", + ) + + handler.add_method_parameter( + "get_par_nndr", + "set_par_nndr", + "nndr", + "GENEC parameter nndr", + ) + + handler.add_method_parameter( + "get_par_iledou", + "set_par_iledou", + "iledou", + "GENEC parameter iledou", + ) + + handler.add_method_parameter( + "get_par_idifcon", + "set_par_idifcon", + "idifcon", + "GENEC parameter idifcon", + ) + + handler.add_method_parameter( + "get_par_my", + "set_par_my", + "my", + "GENEC parameter my", + ) + + handler.add_method_parameter( + "get_par_iover", + "set_par_iover", + "iover", + "GENEC parameter iover", + ) + + handler.add_method_parameter( + "get_par_iunder", + "set_par_iunder", + "iunder", + "GENEC parameter iunder", + ) + + handler.add_method_parameter( + "get_par_nbchx", + "set_par_nbchx", + "nbchx", + "GENEC parameter nbchx", + ) + + handler.add_method_parameter( + "get_par_nrband", + "set_par_nrband", + "nrband", + "GENEC parameter nrband", + ) + + handler.add_method_parameter( + "get_par_islow", + "set_par_islow", + "islow", + "GENEC parameter islow", + ) + + handler.add_method_parameter( + "get_par_icncst", + "set_par_icncst", + "icncst", + "GENEC parameter icncst", + ) + + handler.add_method_parameter( + "get_par_tauH_fit", + "set_par_tauH_fit", + "tauH_fit", + "GENEC parameter tauH_fit", + ) + + handler.add_method_parameter( + "get_par_iauto", + "set_par_iauto", + "iauto", + "GENEC parameter iauto", + ) + + handler.add_method_parameter( + "get_par_iprn", + "set_par_iprn", + "iprn", + "GENEC parameter iprn", + ) + + handler.add_method_parameter( + "get_par_iout", + "set_par_iout", + "iout", + "GENEC parameter iout", + ) + + handler.add_method_parameter( + "get_par_itmin", + "set_par_itmin", + "itmin", + "GENEC parameter itmin", + ) + + handler.add_method_parameter( + "get_par_idebug", + "set_par_idebug", + "idebug", + "GENEC parameter idebug", + ) + + handler.add_method_parameter( + "get_par_itests", + "set_par_itests", + "itests", + "GENEC parameter itests", + ) + + handler.add_method_parameter( + "get_par_amuseinterface", + "set_par_amuseinterface", + "amuseinterface", + "GENEC parameter amuseinterface", + ) + + handler.add_method_parameter( + "get_par_var_rates", + "set_par_var_rates", + "var_rates", + "GENEC parameter var_rates", + ) + + handler.add_method_parameter( + "get_par_bintide", + "set_par_bintide", + "bintide", + "GENEC parameter bintide", + ) + + handler.add_method_parameter( + "get_par_const_per", + "set_par_const_per", + "const_per", + "GENEC parameter const_per", + ) + + handler.add_method_parameter( + "get_par_Add_Flux", + "set_par_Add_Flux", + "Add_Flux", + "GENEC parameter Add_Flux", + ) + + handler.add_method_parameter( + "get_par_diff_only", + "set_par_diff_only", + "diff_only", + "GENEC parameter diff_only", + ) + + handler.add_method_parameter( + "get_par_lowRSGMdot", + "set_par_lowRSGMdot", + "lowRSGMdot", + "GENEC parameter lowRSGMdot", + ) + + handler.add_method_parameter( + "get_par_plot", + "set_par_plot", + "plot", + "GENEC parameter plot", + ) + + handler.add_method_parameter( + "get_par_refresh", + "set_par_refresh", + "refresh", + "GENEC parameter refresh", + ) + + handler.add_method_parameter( + "get_par_xyfiles", + "set_par_xyfiles", + "xyfiles", + "GENEC parameter xyfiles", + ) + + handler.add_method_parameter( + "get_par_verbose", + "set_par_verbose", + "verbose", + "GENEC parameter verbose", + ) + + handler.add_method_parameter( + "get_par_stop_deg", + "set_par_stop_deg", + "stop_deg", + "GENEC parameter stop_deg", + ) + + handler.add_method_parameter( + "get_par_binm2", + "set_par_binm2", + "binm2", + "GENEC parameter binm2", + ) + + handler.add_method_parameter( + "get_par_periodini", + "set_par_periodini", + "periodini", + "GENEC parameter periodini", + ) + + handler.add_method_parameter( + "get_par_zinit", + "set_par_zinit", + "zinit", + "GENEC parameter zinit", + ) + + handler.add_method_parameter( + "get_par_zsol", + "set_par_zsol", + "zsol", + "GENEC parameter zsol", + ) + + handler.add_method_parameter( + "get_par_z", + "set_par_z", + "z", + "GENEC parameter z", + ) + + handler.add_method_parameter( + "get_par_fenerg", + "set_par_fenerg", + "fenerg", + "GENEC parameter fenerg", + ) + + handler.add_method_parameter( + "get_par_richac", + "set_par_richac", + "richac", + "GENEC parameter richac", + ) + + handler.add_method_parameter( + "get_par_frein", + "set_par_frein", + "frein", + "GENEC parameter frein", + ) + + handler.add_method_parameter( + "get_par_K_Kawaler", + "set_par_K_Kawaler", + "K_Kawaler", + "GENEC parameter K_Kawaler", + ) + + handler.add_method_parameter( + "get_par_Omega_saturation", + "set_par_Omega_saturation", + "Omega_saturation", + "GENEC parameter Omega_saturation", + ) + + handler.add_method_parameter( + "get_par_rapcrilim", + "set_par_rapcrilim", + "rapcrilim", + "GENEC parameter rapcrilim", + ) + + handler.add_method_parameter( + "get_par_vwant", + "set_par_vwant", + "vwant", + "GENEC parameter vwant", + ) + + handler.add_method_parameter( + "get_par_xfom", + "set_par_xfom", + "xfom", + "GENEC parameter xfom", + ) + + handler.add_method_parameter( + "get_par_omega", + "set_par_omega", + "omega", + "GENEC parameter omega", + ) + + handler.add_method_parameter( + "get_par_xdial", + "set_par_xdial", + "xdial", + "GENEC parameter xdial", + ) + + handler.add_method_parameter( + "get_par_B_initial", + "set_par_B_initial", + "B_initial", + "GENEC parameter B_initial", + ) + + handler.add_method_parameter( + "get_par_add_diff", + "set_par_add_diff", + "add_diff", + "GENEC parameter add_diff", + ) + + handler.add_method_parameter( + "get_par_fmlos", + "set_par_fmlos", + "fmlos", + "GENEC parameter fmlos", + ) + + handler.add_method_parameter( + "get_par_fitm", + "set_par_fitm", + "fitm", + "GENEC parameter fitm", + ) + + handler.add_method_parameter( + "get_par_fitmi", + "set_par_fitmi", + "fitmi", + "GENEC parameter fitmi", + ) + + handler.add_method_parameter( + "get_par_fitmi_default", + "set_par_fitmi_default", + "fitmi_default", + "GENEC parameter fitmi_default", + ) + + handler.add_method_parameter( + "get_par_deltal", + "set_par_deltal", + "deltal", + "GENEC parameter deltal", + ) + + handler.add_method_parameter( + "get_par_deltat", + "set_par_deltat", + "deltat", + "GENEC parameter deltat", + ) + + handler.add_method_parameter( + "get_par_elph", + "set_par_elph", + "elph", + "GENEC parameter elph", + ) + + handler.add_method_parameter( + "get_par_dovhp", + "set_par_dovhp", + "dovhp", + "GENEC parameter dovhp", + ) + + handler.add_method_parameter( + "get_par_dunder", + "set_par_dunder", + "dunder", + "GENEC parameter dunder", + ) + + handler.add_method_parameter( + "get_par_gkorm", + "set_par_gkorm", + "gkorm", + "GENEC parameter gkorm", + ) + + handler.add_method_parameter( + "get_par_alph", + "set_par_alph", + "alph", + "GENEC parameter alph", + ) + + handler.add_method_parameter( + "get_par_agdr", + "set_par_agdr", + "agdr", + "GENEC parameter agdr", + ) + + handler.add_method_parameter( + "get_par_faktor", + "set_par_faktor", + "faktor", + "GENEC parameter faktor", + ) + + handler.add_method_parameter( + "get_par_dgrp", + "set_par_dgrp", + "dgrp", + "GENEC parameter dgrp", + ) + + handler.add_method_parameter( + "get_par_dgrl", + "set_par_dgrl", + "dgrl", + "GENEC parameter dgrl", + ) + + handler.add_method_parameter( + "get_par_dgry", + "set_par_dgry", + "dgry", + "GENEC parameter dgry", + ) + + handler.add_method_parameter( + "get_par_dgrc", + "set_par_dgrc", + "dgrc", + "GENEC parameter dgrc", + ) + + handler.add_method_parameter( + "get_par_dgro", + "set_par_dgro", + "dgro", + "GENEC parameter dgro", + ) + + handler.add_method_parameter( + "get_par_dgr20", + "set_par_dgr20", + "dgr20", + "GENEC parameter dgr20", + ) + + handler.add_method_parameter( + "get_par_xcn", + "set_par_xcn", + "xcn", + "GENEC parameter xcn", + ) + + handler.add_method_parameter( + "get_par_starname", + "set_par_starname", + "starname", + "GENEC parameter starname", + ) + + def define_particle_sets(self, handler): + + # for particle_set in ['particles', 'fullparticles']: + for set_name in ['fullparticles']: + handler.define_set(set_name, 'index_of_the_star') + InternalStellarStructure.define_particle_sets( + self, handler, set_name=set_name + ) + handler.set_new(set_name, 'new_particle') + + handler.add_getter(set_name, 'get_radius') + handler.add_getter(set_name, 'get_mass') + handler.add_getter(set_name, 'get_age') + handler.add_getter(set_name, 'get_luminosity') + handler.add_getter(set_name, 'get_temperature') + handler.add_getter(set_name, 'get_time_step', names=('time_step',)) + + # handler.add_method(set_name, 'get_number_of_zones') + handler.add_method(set_name, 'get_number_of_zones') + + # handler.add_method(set_name, 'get_radius_profile') + # handler.add_method(set_name, 'get_temperature_profile') + handler.add_method(set_name, 'get_luminosity_profile') + handler.add_method(set_name, 'get_mass_profile') + handler.add_method(set_name, 'get_cumulative_mass_profile') + + handler.add_method(set_name, 'evolve_one_step') + handler.add_method(set_name, 'evolve_for') + handler.set_delete(set_name, 'delete_star') + + for particle_set in ["fullparticles",]: + handler.add_gridded_getter( + particle_set, + 'get_radius_at_zone', 'get_firstlast_zone', + names=('radius_profile',) + ) + handler.add_gridded_setter( + particle_set, + 'set_radius_at_zone', 'get_firstlast_zone', + names=('radius_profile',) + ) + handler.add_gridded_getter( + particle_set, + 'get_temperature_at_zone', 'get_firstlast_zone', + names=('temperature_profile',) + ) + handler.add_gridded_getter( + particle_set, + 'get_density_at_zone', 'get_firstlast_zone', + names=('density_profile',) + ) + handler.add_gridded_getter( + particle_set, + 'get_luminosity_at_zone', 'get_firstlast_zone', + names=('luminosity_profile',) + ) + handler.add_gridded_getter( + particle_set, + 'get_pressure_at_zone', 'get_firstlast_zone', + names=('pressure_profile',) + ) + # for species in species_name: + # handler.add_gridded_getter( + # particle_set, + # 'get_species_at_zone', 'get_firstlast_zone', + # ) + # handler.add_gridded_getter( + # 'particle' + # ) + + @property + def particles(self): + basic_attributes = ["age", "mass", "radius", "temperature", "luminosity",] + return ParticlesWithFilteredAttributes( + self.fullparticles, + basic_attributes, + ) def define_state(self, handler): StellarEvolution.define_state(self, handler) @@ -256,6 +4152,7 @@ def define_state(self, handler): # I.e. must do initialize_code and commit_parameters FIRST! # Initialized (initialize_code) + handler.add_method # -> Edit (commit_parameters) handler.add_method('EDIT', 'set_starname') From b4cfd702db84ac7837de59d049a8719b15098fee Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 7 Mar 2022 14:47:40 +0100 Subject: [PATCH 10/72] remove methods already defined in se.py, add others --- src/amuse/community/genec/interface.py | 56 +++++++++++++++++--------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 7a0d68be6f..13c4a629cc 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -4169,6 +4169,7 @@ def define_state(self, handler): handler.add_method('RUN', 'get_pressure_at_zone') handler.add_method('RUN', 'get_radius') handler.add_method('RUN', 'get_radius_at_zone') + handler.add_method('RUN', 'set_radius_at_zone') handler.add_method('RUN', 'get_temperature_at_zone') handler.add_method('RUN', 'get_density_at_zone') handler.add_method('RUN', 'get_luminosity_at_zone') @@ -4190,31 +4191,46 @@ def define_methods(self, handler): (units.MSun, handler.NO_UNIT, handler.NO_UNIT), (handler.INDEX, handler.ERROR_CODE) ) - handler.add_method( - "get_radius", - (handler.INDEX,), - (units.cm, handler.ERROR_CODE,) - ) - handler.add_method( - "get_number_of_zones", - (handler.INDEX,), - (handler.NO_UNIT, handler.ERROR_CODE,) - ) - handler.add_method( - "get_radius_at_zone", - (handler.INDEX, handler.NO_UNIT,), - (units.cm, handler.ERROR_CODE,) - ) - handler.add_method( - "get_temperature_at_zone", - (handler.INDEX, handler.NO_UNIT,), - (units.K, handler.ERROR_CODE,) - ) + # handler.add_method( + # "get_radius", + # (handler.INDEX,), + # (units.RSun, handler.ERROR_CODE,) + # ) + # handler.add_method( + # "get_number_of_zones", + # (handler.INDEX,), + # (handler.NO_UNIT, handler.ERROR_CODE,) + # ) + # handler.add_method( + # "get_radius_at_zone", + # (handler.INDEX, handler.NO_UNIT,), + # (units.cm, handler.ERROR_CODE,) + # ) + # handler.add_method( + # "set_radius_at_zone", + # (handler.INDEX, handler.NO_UNIT, units.cm), + # (handler.ERROR_CODE,) + # ) + # handler.add_method( + # "get_temperature_at_zone", + # (handler.INDEX, handler.NO_UNIT,), + # (units.K, handler.ERROR_CODE,) + # ) + # handler.add_method( + # "set_temperature_at_zone", + # (handler.INDEX, handler.NO_UNIT, units.K), + # (handler.ERROR_CODE,) + # ) handler.add_method( "get_luminosity_at_zone", (handler.INDEX, handler.NO_UNIT,), (units.erg/units.s, handler.ERROR_CODE,) ) + handler.add_method( + "set_luminosity_at_zone", + (handler.INDEX, handler.NO_UNIT,units.erg/units.s), + (handler.ERROR_CODE,) + ) # def define_parameters(self, handler): def get_luminosity_profile( From 79e755b9c2298ac35f83b1f6e3c5e25760f4268f Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 7 Mar 2022 14:49:36 +0100 Subject: [PATCH 11/72] remove setters/getters for 'amuseinterface' This must always be True! --- src/amuse/community/genec/interface.py | 43 -------------------------- 1 file changed, 43 deletions(-) diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 13c4a629cc..1032949c01 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -1458,42 +1458,6 @@ def set_par_itests(): ''' return function - @legacy_function - def get_par_amuseinterface(): - 'get parameter amuseinterface' - function = LegacyFunctionSpecification() - function.addParameter( - 'amuseinterface', dtype='bool', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function - - @legacy_function - def set_par_amuseinterface(): - 'set parameter amuseinterface' - function = LegacyFunctionSpecification() - function.addParameter( - 'amuseinterface', dtype='bool', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function - @legacy_function def get_par_var_rates(): 'get parameter var_rates' @@ -3716,13 +3680,6 @@ def define_parameters(self, handler): "GENEC parameter itests", ) - handler.add_method_parameter( - "get_par_amuseinterface", - "set_par_amuseinterface", - "amuseinterface", - "GENEC parameter amuseinterface", - ) - handler.add_method_parameter( "get_par_var_rates", "set_par_var_rates", From 489460564851805a989fdd13e05d1dccc16553e2 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 7 Mar 2022 15:40:53 +0100 Subject: [PATCH 12/72] Also support polytropic index --- src/amuse/community/genec/interface.f90 | 36 +++++++++++ src/amuse/community/genec/interface.py | 85 +++++++++++++++++++++++++ 2 files changed, 121 insertions(+) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 6a0ed98d8b..04a9144b67 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -66,6 +66,24 @@ function cleanup_code() ! **** Parameters +function get_par_ipoly(par_ipoly) + use inputparam, only: ipoly + implicit none + integer:: par_ipoly + integer:: get_par_ipoly + par_ipoly = ipoly + get_par_ipoly = 0 +end function + +function set_par_ipoly(par_ipoly) + use inputparam, only: ipoly + implicit none + integer:: par_ipoly + integer:: set_par_ipoly + ipoly = par_ipoly + set_par_ipoly = 0 +end function + function get_par_nwseq(par_nwseq) use inputparam, only: nwseq implicit none @@ -984,6 +1002,24 @@ function set_par_stop_deg(par_stop_deg) set_par_stop_deg = 0 end function +function get_par_index_poly(par_index_poly) + use inputparam, only: index_poly + implicit none + double precision:: par_index_poly + integer:: get_par_index_poly + par_index_poly = index_poly + get_par_index_poly = 0 +end function + +function set_par_index_poly(par_index_poly) + use inputparam, only: index_poly + implicit none + double precision:: par_index_poly + integer:: set_par_index_poly + index_poly = par_index_poly + set_par_index_poly = 0 +end function + function get_par_binm2(par_binm2) use inputparam, only: binm2 implicit none diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 1032949c01..fc5d1732c0 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -54,6 +54,42 @@ def set_genec_path(): # Parameters + @legacy_function + def get_par_ipoly(): + 'get parameter ipoly' + function = LegacyFunctionSpecification() + function.addParameter( + 'ipoly', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_ipoly(): + 'set parameter ipoly' + function = LegacyFunctionSpecification() + function.addParameter( + 'ipoly', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + @legacy_function def get_par_nwseq(): 'get parameter nwseq' @@ -1855,6 +1891,41 @@ def set_par_stop_deg(): return function @legacy_function + def get_par_index_poly(): + 'get parameter index_poly' + function = LegacyFunctionSpecification() + function.addParameter( + 'index_poly', dtype='float64', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_index_poly(): + 'set parameter index_poly' + function = LegacyFunctionSpecification() + function.addParameter( + 'index_poly', dtype='float64', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + @legacy_function def get_par_binm2(): 'get parameter binm2' function = LegacyFunctionSpecification() @@ -3407,6 +3478,13 @@ def define_parameters(self, handler): default_value=self.data_directory ) + handler.add_method_parameter( + "get_par_ipoly", + "set_par_ipoly", + "ipoly", + "GENEC parameter ipoly", + ) + handler.add_method_parameter( "get_par_nwseq", "set_par_nwseq", @@ -3757,6 +3835,13 @@ def define_parameters(self, handler): "GENEC parameter stop_deg", ) + handler.add_method_parameter( + "get_par_index_poly", + "set_par_index_poly", + "index_poly", + "GENEC parameter index_poly", + ) + handler.add_method_parameter( "get_par_binm2", "set_par_binm2", From 6f312962a4a55bb70d40a837b9be7dfa726299b5 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 8 Mar 2022 12:37:57 +0100 Subject: [PATCH 13/72] work in progress --- src/amuse/community/genec/interface.f90 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 04a9144b67..a7186705dd 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1924,6 +1924,23 @@ function get_mass_fraction_at_zone(index_of_the_star, zone, dq_i) get_mass_fraction_at_zone = 0 end function +function set_mass_fraction_at_zone(index_of_the_star, zone, dq_i) + use strucmod, only: q, m + implicit none + integer:: index_of_the_star + integer:: zone, i + double precision:: dq_i + integer:: set_mass_fraction_at_zone + i = m - zone + if (i == 1) then + q(i) = log(dq_i) + else if (i <= m) then + !dq_i = 1-exp(q(zone+1)) + q(i) = log(exp(q(i-1)) + dq_i) ! this won't do + end if + set_mass_fraction_at_zone = -1 ! This function is incomplete! +end function + function get_mass(index_of_the_star, mass) use inputparam, only: starname use caramodele, only: gms From 0122f308fc4351e8265d3b855da7b93ce27526a4 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Thu, 10 Mar 2022 15:39:47 +0100 Subject: [PATCH 14/72] add unit to vwant --- src/amuse/community/genec/interface.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index fc5d1732c0..0cfae6cea3 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -2328,6 +2328,7 @@ def get_par_vwant(): function.addParameter( 'vwant', dtype='float64', direction=function.OUT, + unit=units.kms ) function.result_type = 'int32' function.result_doc = ''' From e5096c2f62ff4932aa4448d794c089b2ed136292 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Sun, 13 Mar 2022 08:22:05 +0100 Subject: [PATCH 15/72] add test script --- .../genec/test_integrate_default_star.py | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 src/amuse/community/genec/test_integrate_default_star.py diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py new file mode 100644 index 0000000000..73c2965f9b --- /dev/null +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -0,0 +1,100 @@ +import numpy + +from amuse.datamodel import Particle +from amuse.units import units +from amuse.community.genec import Genec +from amuse.io import write_set_to_file + + +def write_backup( + step, + star, + # density, + # radius, + # temperature, + # luminosity, + # pressure, + abundances, +): + # GENEC reads the following on a restore/resume: + # gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,ab,dm_lost,m,(q(i),p(i),t(i),r(i),s(i),x(i),y(i),& + # xc12(i),vp(i),vt(i),vr(i),vs(i),xo16(i),vx(i),vy(i),vxc12(i),vxo16(i),i=1,m),drl,drte,dk,drp,drt,drr,rlp,& + # rlt,rlc,rrp,rrt,rrc,rtp,rtt,rtc,tdiff,vsuminenv,(CorrOmega(i),i=1,npondcouche),xLtotbeg,dlelexprev,& + # zams_radius + # + # read (51) (y3(i),xc13(i),xn14(i),xn15(i),xo17(i),xo18(i),vy3(i),vxc13(i),vxn14(i),vxn15(i),vxo17(i),vxo18(i),xne20(i), & + # xne22(i),xmg24(i),xmg25(i),xmg26(i),vxne20(i),vxne22(i),vxmg24(i),vxmg25(i),vxmg26(i),omegi(i),vomegi(i),i=1,m) + # + # read(51) (xf19(i),xne21(i),xna23(i),xal26(i),xal27(i),xsi28(i),vxf19(i),vxne21(i),vxna23(i),vxal26g(i),vxal27(i), & + # vxsi28(i),xneut(i),xprot(i),xc14(i),xf18(i),xbid(i),xbid1(i),vxneut(i),vxprot(i),vxc14(i),vxf18(i),vxbid(i), & + # vxbid1(i),i=1,m) + + # do ii=1,nbelx + # read(51) (abelx(ii,i),vabelx(ii,i),i=1,m) + # enddo + # + # if (isugi >= 1) then + # read(51) nsugi + # endif + # + # if (bintide) then + # read(51) period,r_core,vna,vnr + # endif + + write_set_to_file( + star.as_set(), + f'star-{star.key}-{step}.amuse' + ) + # units = dict() + # units['density'] = f'{density.unit}' + # units['radius'] = f'{radius.unit}' + # units['temperature'] = f'{temperature.unit}' + # units['luminosity'] = f'{luminosity.unit}' + # units['pressure'] = f'{pressure.unit}' + + numpy.savez_compressed( + f'star-abundances-{star.key}-{step}.npz', + # units=units, + # density=density.value_in(density.unit), + # radius=radius.value_in(radius.unit), + # temperature=temperature.value_in(temperature.unit), + # luminosity=luminosity.value_in(luminosity.unit), + # pressure=pressure.value_in(pressure.unit), + abundances=abundances, + ) + return + +star = Particle(mass=7 | units.MSun, metallicity=0.014) +evo = Genec() +star_in_evo = evo.fullparticles.add_particle(star) + +plot_every = -1 +save_every = 100 +step = 0 + +while True: + star = star_in_evo.copy() + # number_of_zones = star_in_evo.get_number_of_zones() + # density_profile = star_in_evo.get_density_profile() + # radius_profile = star_in_evo.get_radius_profile() + # temperature_profile = star_in_evo.get_temperature_profile() + # luminosity_profile = star_in_evo.get_luminosity_profile() + # pressure_profile = star_in_evo.get_pressure_profile() + chemical_abundance_profile = star_in_evo.get_chemical_abundance_profiles() + + print(evo.particles[0]) + print(star.age.in_(units.Myr), star.mass.in_(units.MSun)) + if step%save_every == 0: + write_backup( + step, + star, + # density_profile, + # radius_profile, + # temperature_profile, + # luminosity_profile, + # pressure_profile, + chemical_abundance_profile, + ) + + star_in_evo.evolve_one_step() + step += 1 From e9b490c431223cf9c4e8e2d9e33b3d241973eb65 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 15 Mar 2022 21:03:47 +0100 Subject: [PATCH 16/72] Add script with plotting class --- src/amuse/community/genec/plot_models.py | 278 ++++++++++++++++++ .../genec/test_integrate_default_star.py | 75 ++++- 2 files changed, 348 insertions(+), 5 deletions(-) create mode 100644 src/amuse/community/genec/plot_models.py diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py new file mode 100644 index 0000000000..099d954694 --- /dev/null +++ b/src/amuse/community/genec/plot_models.py @@ -0,0 +1,278 @@ +import numpy +import matplotlib +import matplotlib.pyplot as plt +from amuse.units import units + +class StellarModelPlot: + def __init__(self, star): + self.default_units = { + 'temperature': units.K, + 'luminosity': units.LSun, + 'radius': units.RSun, + 'mass': units.MSun, + 'age': units.Myr, + 'density': units.g * units.cm**-3, + } + self.star = star + self.__age = [] | self.default_units['age'] + self.__mass = [] | self.default_units['mass'] + self.__radius = [] | self.default_units['radius'] + self.__luminosity = [] | self.default_units['luminosity'] + self.__temperature = [] | self.default_units['temperature'] + self.__central_density = [] | self.default_units['density'] + self.__central_temperature = [] | self.default_units['temperature'] + self.__central_abundance = {} + self.__species = star.get_names_of_species() + # self.__zones = star.get_number_of_zones() + for species in self.__species: + self.__central_abundance[species] = [] + + self.__figures = { + "1": plt.figure(figsize=(12, 8)), + # "2": plt.figure(), + } + + self.__initialised_hr = False + self.__initialised_temp_dens = False + self.__initialised_central_abundance = False + self.__initialised_kippenhahn = False + + self.__axes = { + "HR": self.__figures["1"].add_subplot(2, 2, 1), + "temp_dens": self.__figures["1"].add_subplot(2, 2, 2), + "central abundance": self.__figures["1"].add_subplot(2, 2, 3), + "Kippenhahn diagram": self.__figures["1"].add_subplot(2, 2, 4), + } + # self.__ax_hr = fig.add_subplot(2, 2, 1) + self.update(star) + self.plot_all(initialise=True) + + def update(self, star): + self.star = star + self.__age.append(star.age) + self.__mass.append(star.mass) + self.__radius.append(star.radius) + self.__luminosity.append(star.luminosity) + self.__temperature.append(star.temperature) + self.__central_density.append(star.central_density) + self.__central_temperature.append(star.central_temperature) + # self.__zones = star.get_number_of_zones() + abundances = star.get_chemical_abundance_profiles() + for i, species in enumerate(self.__species): + self.__central_abundance[species].append( + abundances[i, 0] + ) + + def draw(self, verbose=False, speed=0 | units.Myr / units.minute): + for i, fig in self.__figures.items(): + if verbose: + print(f"drawing figure {i}") + + fig.suptitle( + f"star age = {self.star.age.in_(units.Myr)}, " + f"radius = {self.star.radius.in_(units.RSun)}, " + # f"log(speedup) = {numpy.log10(speed):.2f}" + f"speedup = {speed.in_(units.Myr / units.minute)}" + ) + fig.canvas.draw_idle() + fig.canvas.flush_events() + + def initialise_hr(self): + unit_temp = self.default_units['temperature'] + unit_lum = self.default_units['luminosity'] + ax = self.__axes['HR'] + log_tstar = numpy.log10( + self.star.temperature.value_in(unit_temp) + ) + ax.set_xlim( + log_tstar + 0.1, + log_tstar - 0.1, + ) + log_lstar = numpy.log10( + self.star.luminosity.value_in(unit_lum) + ) + ax.set_ylim(log_lstar - 0.1, log_lstar + 0.1) + ax.set_xlabel(f'log (temperature / {unit_temp})') + ax.set_ylabel(f'log (luminosity / {unit_lum})') + ax.ticklabel_format(style='sci',scilimits=(-3,4),axis='both') + self.__hr_plot, = ax.plot( + [numpy.log10(self.star.temperature.value_in(unit_temp))], + [numpy.log10(self.star.luminosity.value_in(unit_lum))], + # color='red', + # linewidth=2, + ) + self.__hr_star = ax.scatter( + [numpy.log10(self.star.temperature.value_in(unit_temp))], + [numpy.log10(self.star.luminosity.value_in(unit_lum))], + facecolor='red', + s=40, + edgecolor=None, + alpha=0.5, + ) + ax.set_title('HR') + self.__initialised_hr = True + + def plot_hr(self): + if not self.__initialised_hr: + self.initialise_hr() + unit_temp = self.default_units['temperature'] + unit_lum = self.default_units['luminosity'] + ax = self.__axes['HR'] + log_temperature = numpy.log10( + self.__temperature.value_in(unit_temp) + ) + log_luminosity = numpy.log10( + self.__luminosity.value_in(unit_lum) + ) + ax.set_xlim( + max(log_temperature) + 0.1, + min(log_temperature) - 0.1, + ) + ax.set_ylim( + min(log_luminosity) - 0.1, + max(log_luminosity) + 0.1, + ) + self.__hr_plot.set_xdata(log_temperature) + self.__hr_plot.set_ydata(log_luminosity) + offsets = self.__hr_star.get_offsets() + offsets[:, 0] = [numpy.log10(self.star.temperature.value_in(unit_temp))] + offsets[:, 1] = [numpy.log10(self.star.luminosity.value_in(unit_lum))] + self.__hr_star.set_offsets(offsets) + + def initialise_temp_dens(self): + unit_temp = self.default_units['temperature'] + unit_dens = self.default_units['density'] + ax = self.__axes['temp_dens'] + log_central_density_star = numpy.log10( + self.star.central_density.value_in(unit_dens) + ) + ax.set_xlim( + log_central_density_star - 0.1, + log_central_density_star + 0.1 + ) + log_central_temperature_star = numpy.log10( + self.star.central_temperature.value_in(unit_temp) + ) + ax.set_ylim( + log_central_temperature_star - 0.1, + log_central_temperature_star + 0.1 + ) + ax.set_xlabel(f'log (rho$_c$ / {unit_dens})') + ax.set_ylabel(f'log (temp$_c$ / {unit_temp})') + ax.ticklabel_format(style='sci',scilimits=(-3,4),axis='both') + self.__temp_dens_plot, = ax.plot( + [], + [], + ) + self.__temp_dens_star = ax.scatter( + [log_central_density_star], + [log_central_temperature_star], + facecolor='red', + s=40, + edgecolor=None, + alpha=0.5, + ) + ax.set_title('temp/dens') + self.__initialised_temp_dens = True + + def plot_temp_dens(self): + if not self.__initialised_temp_dens: + self.initialise_temp_dens() + unit_temp = self.default_units['temperature'] + unit_dens = self.default_units['density'] + ax = self.__axes['temp_dens'] + log_central_density = numpy.log10( + self.__central_density.value_in(unit_dens) + ) + log_central_temperature = numpy.log10( + self.__central_temperature.value_in(unit_temp) + ) + ax.set_xlim( + min(log_central_density) - 0.1, + max(log_central_density) + 0.1, + ) + ax.set_ylim( + min(log_central_temperature) - 0.1, + max(log_central_temperature) + 0.1, + ) + self.__temp_dens_plot.set_xdata(log_central_density) + self.__temp_dens_plot.set_ydata(log_central_temperature) + offsets = self.__temp_dens_star.get_offsets() + offsets[:, 0] = [numpy.log10(self.star.central_density.value_in(unit_dens))] + offsets[:, 1] = [numpy.log10(self.star.central_temperature.value_in(unit_temp))] + self.__temp_dens_star.set_offsets(offsets) + + def initialise_central_abundance(self): + unit_age = self.default_units['age'] + ax = self.__axes['central abundance'] + + ax.set_xlim( + -0.05, + 0.05, + ) + ax.set_ylim(-0.05, 1.05) + ax.set_xlabel(f'age {unit_age})') + ax.set_ylabel(f'abundance fraction') + ax.ticklabel_format( + style='sci', + scilimits=(-3, 4), + axis='both', + ) + self.__central_abundance_plots = [] + for i, species in enumerate(self.__species): + plot, = ax.plot( + [self.star.age.value_in(unit_age)], + [self.__central_abundance[species]], + label=species, + # color='red', + # linewidth=2, + ) + self.__central_abundance_plots.append(plot) + ax.set_title('central abundance') + self.__initialised_central_abundance = True + + def plot_central_abundance(self): + if not self.__initialised_central_abundance: + self.initialise_central_abundance() + unit_age = self.default_units['age'] + ax = self.__axes['central abundance'] + xmax = self.star.age.value_in(unit_age) * 1.05 + xmin = (self.star.age.value_in(unit_age) - xmax) + ax.set_xlim(xmin, xmax) + for i, species in enumerate(self.__species): + self.__central_abundance_plots[i].set_xdata( + self.__age.value_in(unit_age) + ) + self.__central_abundance_plots[i].set_ydata( + self.__central_abundance[species] + ) + + def initialise_kippenhahn(self): + unit_age = self.default_units['age'] + ax = self.__axes['Kippenhahn diagram'] + ax.set_title('Kippenhahn diagram') + ax.set_xlim( + -0.05, + 0.05, + ) + ax.set_xlabel(f'age {unit_age})') + self.__initialised_kippenhahn = True + + def plot_kippenhahn(self): + if not self.__initialised_kippenhahn: + self.initialise_kippenhahn() + unit_age = self.default_units['age'] + ax = self.__axes['Kippenhahn diagram'] + xmax = self.star.age.value_in(unit_age) * 1.05 + xmin = (self.star.age.value_in(unit_age) - xmax) + ax.set_xlim(xmin, xmax) + + def plot_all(self, initialise=False, speed=0 | units.Myr / units.minute): + self.plot_hr() + self.plot_temp_dens() + self.plot_central_abundance() + self.plot_kippenhahn() + + self.draw(speed=speed) + plt.tight_layout() + plt.pause(0.01) diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index 73c2965f9b..1029c9bfaf 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -1,9 +1,14 @@ import numpy +import time from amuse.datamodel import Particle from amuse.units import units from amuse.community.genec import Genec from amuse.io import write_set_to_file +from amuse.support.console import set_printing_strategy + +import matplotlib.pyplot as plt +from plot_models import StellarModelPlot def write_backup( @@ -64,15 +69,51 @@ def write_backup( ) return + +MASS_UNIT = units.MSun +LENGTH_UNIT = units.RSun +TIME_UNIT = units.Myr +MASSLOSS_UNIT = units.MSun / units.yr +TEMPERATURE_UNIT = units.K +LUMINOSITY_UNIT = units.LSun +SPEEDUP_UNIT = units.Myr / units.minute +set_printing_strategy( + "custom", + preferred_units=[ + MASS_UNIT, LENGTH_UNIT, TIME_UNIT, MASSLOSS_UNIT, TEMPERATURE_UNIT, + LUMINOSITY_UNIT, SPEEDUP_UNIT + ], + precision=4, + prefix="", + separator=" [", + suffix="]", +) + + star = Particle(mass=7 | units.MSun, metallicity=0.014) -evo = Genec() +evo = Genec(redirection="none") +# evo = Genec() star_in_evo = evo.fullparticles.add_particle(star) +plt.ion() + plot_every = -1 -save_every = 100 +save_every = 1000 +store_every = 10 +plot_time = 2 | units.s +plot_models = 20 step = 0 +model_of_last_save = 0 +model_of_last_plot = 0 +time_start = time.time() | units.s +time_of_last_plot = 0 | units.s +age_of_last_plot = star_in_evo.age + +plotting = StellarModelPlot(star_in_evo) + while True: + time_elapsed = (time.time() | units.s) - time_start star = star_in_evo.copy() # number_of_zones = star_in_evo.get_number_of_zones() # density_profile = star_in_evo.get_density_profile() @@ -82,9 +123,33 @@ def write_backup( # pressure_profile = star_in_evo.get_pressure_profile() chemical_abundance_profile = star_in_evo.get_chemical_abundance_profiles() - print(evo.particles[0]) - print(star.age.in_(units.Myr), star.mass.in_(units.MSun)) - if step%save_every == 0: + # print(evo.fullparticles[0]) + # print(evo.fullparticles[0].get_number_of_species()) + # print(evo.fullparticles[0].get_names_of_species()) + # exit() + print( + star.age.in_(units.Myr), + star.mass.in_(units.MSun), + star.radius.in_(units.RSun), + star.temperature.in_(units.K), + star.luminosity.in_(units.LSun), + ) + if step % store_every == 0: + plotting.update(star_in_evo) + if ( + (time_elapsed - time_of_last_plot) > plot_time + or step - model_of_last_plot > plot_models + ): + speed = ( + (star.age - age_of_last_plot).value_in(units.Myr) + / (time_elapsed - time_of_last_plot).value_in(units.minute) + ) | units.Myr / units.minute + plotting.plot_all(speed=speed) + model_of_last_plot = step + time_of_last_plot = time_elapsed + age_of_last_plot = star.age + + if step % save_every == 0: write_backup( step, star, From 2b72e7ef204d850a80f2b187a27cb5cd61039d48 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 16 Mar 2022 21:20:39 +0100 Subject: [PATCH 17/72] Start work on stellar structure plots --- src/amuse/community/genec/plot_models.py | 166 ++++++++++++++++++----- 1 file changed, 132 insertions(+), 34 deletions(-) diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 099d954694..2b62b9d226 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -3,6 +3,7 @@ import matplotlib.pyplot as plt from amuse.units import units + class StellarModelPlot: def __init__(self, star): self.default_units = { @@ -24,28 +25,32 @@ def __init__(self, star): self.__central_abundance = {} self.__species = star.get_names_of_species() # self.__zones = star.get_number_of_zones() + self.__abundances = star.get_chemical_abundance_profiles() for species in self.__species: self.__central_abundance[species] = [] self.__figures = { - "1": plt.figure(figsize=(12, 8)), - # "2": plt.figure(), + "1": plt.figure(num="Evolution", figsize=(8, 6)), + "2": plt.figure(num="Structure", figsize=(8, 6)), } + for figure in self.__figures.values(): + figure.set_tight_layout(True) - self.__initialised_hr = False - self.__initialised_temp_dens = False - self.__initialised_central_abundance = False - self.__initialised_kippenhahn = False + self.__initialised = [] self.__axes = { "HR": self.__figures["1"].add_subplot(2, 2, 1), "temp_dens": self.__figures["1"].add_subplot(2, 2, 2), "central abundance": self.__figures["1"].add_subplot(2, 2, 3), "Kippenhahn diagram": self.__figures["1"].add_subplot(2, 2, 4), + "Abundance profile": self.__figures["2"].add_subplot(2, 2, 1), + "gradient": self.__figures["2"].add_subplot(2, 2, 2), + "Luminosity and energy production": self.__figures["2"].add_subplot(2, 2, 3), + "Temperature and pressure": self.__figures["2"].add_subplot(2, 2, 4), } # self.__ax_hr = fig.add_subplot(2, 2, 1) self.update(star) - self.plot_all(initialise=True) + self.plot_all() def update(self, star): self.star = star @@ -57,10 +62,10 @@ def update(self, star): self.__central_density.append(star.central_density) self.__central_temperature.append(star.central_temperature) # self.__zones = star.get_number_of_zones() - abundances = star.get_chemical_abundance_profiles() + self.__abundances = star.get_chemical_abundance_profiles() for i, species in enumerate(self.__species): self.__central_abundance[species].append( - abundances[i, 0] + self.__abundances[i, 0] ) def draw(self, verbose=False, speed=0 | units.Myr / units.minute): @@ -69,18 +74,21 @@ def draw(self, verbose=False, speed=0 | units.Myr / units.minute): print(f"drawing figure {i}") fig.suptitle( - f"star age = {self.star.age.in_(units.Myr)}, " - f"radius = {self.star.radius.in_(units.RSun)}, " + f"age: {self.star.age.in_(units.Myr)}, " + f"mass: {self.star.mass.in_(units.MSun)}, " + f"radius: {self.star.radius.in_(units.RSun)}, " # f"log(speedup) = {numpy.log10(speed):.2f}" - f"speedup = {speed.in_(units.Myr / units.minute)}" + f"speed: {speed.in_(units.Myr / units.minute)}" ) fig.canvas.draw_idle() fig.canvas.flush_events() def initialise_hr(self): + title = 'HR' unit_temp = self.default_units['temperature'] unit_lum = self.default_units['luminosity'] - ax = self.__axes['HR'] + ax = self.__axes[title] + ax.set_title(title) log_tstar = numpy.log10( self.star.temperature.value_in(unit_temp) ) @@ -109,15 +117,15 @@ def initialise_hr(self): edgecolor=None, alpha=0.5, ) - ax.set_title('HR') - self.__initialised_hr = True + self.__initialised.append(title) def plot_hr(self): - if not self.__initialised_hr: + title = 'HR' + if title not in self.__initialised: self.initialise_hr() unit_temp = self.default_units['temperature'] unit_lum = self.default_units['luminosity'] - ax = self.__axes['HR'] + ax = self.__axes[title] log_temperature = numpy.log10( self.__temperature.value_in(unit_temp) ) @@ -140,9 +148,11 @@ def plot_hr(self): self.__hr_star.set_offsets(offsets) def initialise_temp_dens(self): + title = 'temp_dens' unit_temp = self.default_units['temperature'] unit_dens = self.default_units['density'] - ax = self.__axes['temp_dens'] + ax = self.__axes[title] + ax.set_title(title) log_central_density_star = numpy.log10( self.star.central_density.value_in(unit_dens) ) @@ -172,15 +182,15 @@ def initialise_temp_dens(self): edgecolor=None, alpha=0.5, ) - ax.set_title('temp/dens') - self.__initialised_temp_dens = True + self.__initialised.append(title) def plot_temp_dens(self): - if not self.__initialised_temp_dens: + title = 'temp_dens' + if title not in self.__initialised: self.initialise_temp_dens() unit_temp = self.default_units['temperature'] unit_dens = self.default_units['density'] - ax = self.__axes['temp_dens'] + ax = self.__axes[title] log_central_density = numpy.log10( self.__central_density.value_in(unit_dens) ) @@ -203,15 +213,17 @@ def plot_temp_dens(self): self.__temp_dens_star.set_offsets(offsets) def initialise_central_abundance(self): + title = 'central abundance' unit_age = self.default_units['age'] - ax = self.__axes['central abundance'] + ax = self.__axes[title] + ax.set_title(title) ax.set_xlim( -0.05, 0.05, ) ax.set_ylim(-0.05, 1.05) - ax.set_xlabel(f'age {unit_age})') + ax.set_xlabel(f'age ({unit_age})') ax.set_ylabel(f'abundance fraction') ax.ticklabel_format( style='sci', @@ -228,14 +240,14 @@ def initialise_central_abundance(self): # linewidth=2, ) self.__central_abundance_plots.append(plot) - ax.set_title('central abundance') - self.__initialised_central_abundance = True + self.__initialised.append(title) def plot_central_abundance(self): - if not self.__initialised_central_abundance: + title = 'central abundance' + if title not in self.__initialised: self.initialise_central_abundance() unit_age = self.default_units['age'] - ax = self.__axes['central abundance'] + ax = self.__axes[title] xmax = self.star.age.value_in(unit_age) * 1.05 xmin = (self.star.age.value_in(unit_age) - xmax) ax.set_xlim(xmin, xmax) @@ -248,18 +260,20 @@ def plot_central_abundance(self): ) def initialise_kippenhahn(self): + title = 'Kippenhahn diagram' unit_age = self.default_units['age'] - ax = self.__axes['Kippenhahn diagram'] - ax.set_title('Kippenhahn diagram') + ax = self.__axes[title] + ax.set_title(title) ax.set_xlim( -0.05, 0.05, ) - ax.set_xlabel(f'age {unit_age})') - self.__initialised_kippenhahn = True + ax.set_xlabel(f'age ({unit_age})') + self.__initialised.append(title) def plot_kippenhahn(self): - if not self.__initialised_kippenhahn: + title = 'Kippenhahn diagram' + if title not in self.__initialised: self.initialise_kippenhahn() unit_age = self.default_units['age'] ax = self.__axes['Kippenhahn diagram'] @@ -267,12 +281,96 @@ def plot_kippenhahn(self): xmin = (self.star.age.value_in(unit_age) - xmax) ax.set_xlim(xmin, xmax) - def plot_all(self, initialise=False, speed=0 | units.Myr / units.minute): + def initialise_abundance_profile(self): + title = "Abundance profile" + ax = self.__axes[title] + ax.set_title(title) + ax.set_xlim(0, 1) + ax.set_ylim(-4, 0) + ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') + self.__initialised.append(title) + self.__abundance_plots = [] + radius_profile = self.star.radius_profile + relative_radius_profile = radius_profile / radius_profile[-1] + for i, species in enumerate(self.__species): + plot, = ax.plot( + relative_radius_profile, + numpy.log10(self.__abundances[i]), + label=species, + ) + self.__abundance_plots.append(plot) + self.__initialised.append(title) + + def plot_abundance_profile(self): + title = "Abundance profile" + if title not in self.__initialised: + self.initialise_abundance_profile() + radius_profile = self.star.radius_profile + relative_radius_profile = radius_profile / radius_profile[-1] + for i, species in enumerate(self.__species): + self.__abundance_plots[i].set_xdata( + relative_radius_profile + ) + self.__abundance_plots[i].set_ydata( + numpy.log10(self.__abundances[i]) + ) + + def initialise_gradient(self): + title = "gradient" + ax = self.__axes[title] + ax.set_title(title) + ax.set_xlim(0, 1) + ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') + self.__initialised.append(title) + + def plot_gradient(self): + title = "gradient" + if title not in self.__initialised: + self.initialise_gradient() + + def initialise_luminosity_energy_production(self): + title = "Luminosity and energy production" + ax = self.__axes[title] + ax.set_title(title) + ax.set_xlim(0, 1) + ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') + self.__initialised.append(title) + + def plot_luminosity_energy_production(self): + title = "Luminosity and energy production" + if title not in self.__initialised: + self.initialise_luminosity_energy_production() + + def initialise_temperature_pressure(self): + title = "Temperature and pressure" + ax = self.__axes[title] + ax.set_title(title) + ax.set_xlim(0, 1) + ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') + self.__initialised.append(title) + + def plot_temperature_pressure(self): + title = "Temperature and pressure" + if title not in self.__initialised: + self.initialise_temperature_pressure() + + def plot_figure_evolution(self): self.plot_hr() self.plot_temp_dens() self.plot_central_abundance() self.plot_kippenhahn() + def plot_figure_structure(self): + self.plot_abundance_profile() + self.plot_gradient() + self.plot_luminosity_energy_production() + self.plot_temperature_pressure() + + def plot_all(self, speed=0 | units.Myr / units.minute): + self.plot_figure_evolution() + self.plot_figure_structure() + self.draw(speed=speed) plt.tight_layout() plt.pause(0.01) + # plt.show(block=False) From 7b0a69f606b8251cd41dc202ff6f6f3246f30c31 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 16 Mar 2022 21:21:14 +0100 Subject: [PATCH 18/72] update test script --- .../genec/test_integrate_default_star.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index 1029c9bfaf..ded7fabfa6 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -85,22 +85,27 @@ def write_backup( ], precision=4, prefix="", - separator=" [", - suffix="]", + separator=" ", + # separator=" [", + suffix="", + # suffix="]", ) -star = Particle(mass=7 | units.MSun, metallicity=0.014) +star = Particle(mass=7.0 | units.MSun, metallicity=0.014) evo = Genec(redirection="none") # evo = Genec() star_in_evo = evo.fullparticles.add_particle(star) +font = { + 'size': 8, +} +plt.rc('font', **font) plt.ion() -plot_every = -1 save_every = 1000 -store_every = 10 -plot_time = 2 | units.s +store_every = 1 +plot_time = 1 | units.s plot_models = 20 step = 0 From 2ecf15c1561d990c13f96ed841a8e9fd4182415f Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 16 Mar 2022 21:40:13 +0100 Subject: [PATCH 19/72] use mass profile, not radius profile --- src/amuse/community/genec/plot_models.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 2b62b9d226..3c6bd311f9 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -290,11 +290,10 @@ def initialise_abundance_profile(self): ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') self.__initialised.append(title) self.__abundance_plots = [] - radius_profile = self.star.radius_profile - relative_radius_profile = radius_profile / radius_profile[-1] + mass_profile = self.star.get_cumulative_mass_profile() for i, species in enumerate(self.__species): plot, = ax.plot( - relative_radius_profile, + mass_profile, numpy.log10(self.__abundances[i]), label=species, ) @@ -305,11 +304,10 @@ def plot_abundance_profile(self): title = "Abundance profile" if title not in self.__initialised: self.initialise_abundance_profile() - radius_profile = self.star.radius_profile - relative_radius_profile = radius_profile / radius_profile[-1] + mass_profile = self.star.get_cumulative_mass_profile() for i, species in enumerate(self.__species): self.__abundance_plots[i].set_xdata( - relative_radius_profile + mass_profile ) self.__abundance_plots[i].set_ydata( numpy.log10(self.__abundances[i]) @@ -321,6 +319,7 @@ def initialise_gradient(self): ax.set_title(title) ax.set_xlim(0, 1) ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') + mass_profile = self.star.get_cumulative_mass_profile() self.__initialised.append(title) def plot_gradient(self): @@ -334,6 +333,7 @@ def initialise_luminosity_energy_production(self): ax.set_title(title) ax.set_xlim(0, 1) ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') + mass_profile = self.star.get_cumulative_mass_profile() self.__initialised.append(title) def plot_luminosity_energy_production(self): @@ -347,6 +347,7 @@ def initialise_temperature_pressure(self): ax.set_title(title) ax.set_xlim(0, 1) ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') + mass_profile = self.star.get_cumulative_mass_profile() self.__initialised.append(title) def plot_temperature_pressure(self): From 3bd7173f0591576634b5be878ea915cf32477f5a Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Thu, 24 Mar 2022 14:28:04 +0100 Subject: [PATCH 20/72] changes --- src/amuse/community/genec/interface.f90 | 62 ++++++++++++++----- src/amuse/community/genec/plot_models.py | 22 +++++-- .../genec/test_integrate_default_star.py | 3 +- 3 files changed, 66 insertions(+), 21 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index a7186705dd..96e4e9bf23 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1,6 +1,6 @@ function initialize_code() use WriteSaveClose, only: quitafterclosing - use inputparam, only: amuseinterface, writetofiles + use inputparam, only: amuseinterface, writetofiles, readfromfiles use genec, only: initialise_genec use amuse_helpers, only: set_defaults use amuse_helpers, only: mstar, zini, starname @@ -10,6 +10,7 @@ function initialize_code() amuseinterface = .true. writetofiles = .false. + readfromfiles = .false. input_dir = "./src/GENEC/code" call initialise_genec() call set_defaults() @@ -66,6 +67,14 @@ function cleanup_code() ! **** Parameters +function get_min_timestep_stop_condition(min_timestep_stop_condition) + use inputparam, only: dzeitj_min + implicit none + double precision:: min_timestep_stop_condition + integer:: get_min_timestep_stop_condition + get_min_timestep_stop_condition = 0 +end function + function get_par_ipoly(par_ipoly) use inputparam, only: ipoly implicit none @@ -1806,6 +1815,31 @@ function evolve_one_step(index_of_the_star) evolve_one_step = 0 end function +function finalize_stellar_model() + implicit none + integer:: finalize_stellar_model + finalize_stellar_model = 0 +end function + +function write_genec_model() + use inputparam, only: modanf + use WriteSaveClose, only: OpenAll + use genec, only: finalise, initialise_star + use inputparam, only: writetofiles + implicit none + integer:: write_genec_model + call finalise() + ! modanf = 0 + writetofiles = .true. + call OpenAll() + call initialise_star() + !call finalise() + writetofiles = .false. + !call OpenAll() + !call initialise_star() + write_genec_model = 0 +end function + function get_age(index_of_the_star, age) use timestep, only: alter implicit none @@ -2224,15 +2258,15 @@ function get_name_of_species(index_of_the_star, species, species_name) character(len = 6), dimension(27):: species_names - species_names(1) = 'h' - species_names(2) = 'he3' - species_names(3) = 'he' - species_names(4) = 'c12' - species_names(5) = 'c13' - species_names(6) = 'n14' - species_names(7) = 'n15' - species_names(8) = 'o16' - species_names(9) = 'o17' + species_names(1) = 'h' + species_names(2) = 'he3' + species_names(3) = 'he' + species_names(4) = 'c12' + species_names(5) = 'c13' + species_names(6) = 'n14' + species_names(7) = 'n15' + species_names(8) = 'o16' + species_names(9) = 'o17' species_names(10) = 'o18' species_names(11) = 'ne20' species_names(12) = 'ne22' @@ -2275,11 +2309,11 @@ function get_number_of_species(index_of_the_star, n_species) integer:: index_of_the_star integer:: n_species integer:: get_number_of_species - if (ialflu==1) then + !if (ialflu==1) then n_species = 27 - else - n_species = 15 - end if + !else + ! n_species = 15 + !end if get_number_of_species = 0 end function diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 3c6bd311f9..926ac47268 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -68,7 +68,7 @@ def update(self, star): self.__abundances[i, 0] ) - def draw(self, verbose=False, speed=0 | units.Myr / units.minute): + def draw(self, verbose=False, speed=0 | units.Myr / units.minute, step=None): for i, fig in self.__figures.items(): if verbose: print(f"drawing figure {i}") @@ -77,6 +77,7 @@ def draw(self, verbose=False, speed=0 | units.Myr / units.minute): f"age: {self.star.age.in_(units.Myr)}, " f"mass: {self.star.mass.in_(units.MSun)}, " f"radius: {self.star.radius.in_(units.RSun)}, " + f"step: {step}, " # f"log(speedup) = {numpy.log10(speed):.2f}" f"speed: {speed.in_(units.Myr / units.minute)}" ) @@ -208,8 +209,12 @@ def plot_temp_dens(self): self.__temp_dens_plot.set_xdata(log_central_density) self.__temp_dens_plot.set_ydata(log_central_temperature) offsets = self.__temp_dens_star.get_offsets() - offsets[:, 0] = [numpy.log10(self.star.central_density.value_in(unit_dens))] - offsets[:, 1] = [numpy.log10(self.star.central_temperature.value_in(unit_temp))] + offsets[:, 0] = [ + numpy.log10(self.star.central_density.value_in(unit_dens)) + ] + offsets[:, 1] = [ + numpy.log10(self.star.central_temperature.value_in(unit_temp)) + ] self.__temp_dens_star.set_offsets(offsets) def initialise_central_abundance(self): @@ -224,7 +229,7 @@ def initialise_central_abundance(self): ) ax.set_ylim(-0.05, 1.05) ax.set_xlabel(f'age ({unit_age})') - ax.set_ylabel(f'abundance fraction') + ax.set_ylabel('abundance fraction') ax.ticklabel_format( style='sci', scilimits=(-3, 4), @@ -258,6 +263,11 @@ def plot_central_abundance(self): self.__central_abundance_plots[i].set_ydata( self.__central_abundance[species] ) + if self.__central_abundance[0] < 1e-4: + ax.set_xscale('log') + ax.set_xlim(1, xmax) + else: + ax.set_xscale('linear') def initialise_kippenhahn(self): title = 'Kippenhahn diagram' @@ -367,11 +377,11 @@ def plot_figure_structure(self): self.plot_luminosity_energy_production() self.plot_temperature_pressure() - def plot_all(self, speed=0 | units.Myr / units.minute): + def plot_all(self, speed=0 | units.Myr / units.minute, step=None): self.plot_figure_evolution() self.plot_figure_structure() - self.draw(speed=speed) + self.draw(speed=speed, step=step) plt.tight_layout() plt.pause(0.01) # plt.show(block=False) diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index ded7fabfa6..63ec088b4f 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -131,6 +131,7 @@ def write_backup( # print(evo.fullparticles[0]) # print(evo.fullparticles[0].get_number_of_species()) # print(evo.fullparticles[0].get_names_of_species()) + # print(evo.fullparticles[0].get_mass_profile()) # exit() print( star.age.in_(units.Myr), @@ -149,7 +150,7 @@ def write_backup( (star.age - age_of_last_plot).value_in(units.Myr) / (time_elapsed - time_of_last_plot).value_in(units.minute) ) | units.Myr / units.minute - plotting.plot_all(speed=speed) + plotting.plot_all(speed=speed, step=step) model_of_last_plot = step time_of_last_plot = time_elapsed age_of_last_plot = star.age From 60d7e13071f98211f8f0b7613543b893e2be0b8a Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Thu, 24 Mar 2022 14:30:54 +0100 Subject: [PATCH 21/72] fix error --- src/amuse/community/genec/plot_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 926ac47268..8388987663 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -263,7 +263,7 @@ def plot_central_abundance(self): self.__central_abundance_plots[i].set_ydata( self.__central_abundance[species] ) - if self.__central_abundance[0] < 1e-4: + if self.__central_abundance[species[0]] < 1e-4: ax.set_xscale('log') ax.set_xlim(1, xmax) else: From 95d8688668fe553002d5b2caca251388f18754f8 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Thu, 24 Mar 2022 14:32:34 +0100 Subject: [PATCH 22/72] one more fix --- src/amuse/community/genec/plot_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 8388987663..6a3bdbf635 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -263,7 +263,7 @@ def plot_central_abundance(self): self.__central_abundance_plots[i].set_ydata( self.__central_abundance[species] ) - if self.__central_abundance[species[0]] < 1e-4: + if self.__central_abundance[self.__species[0]] < 1e-4: ax.set_xscale('log') ax.set_xlim(1, xmax) else: From cf93d5ad14ce006d02f8791ed13cb8687dd81ba0 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Thu, 24 Mar 2022 14:33:22 +0100 Subject: [PATCH 23/72] disable for now --- src/amuse/community/genec/plot_models.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 6a3bdbf635..741e2c4986 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -263,11 +263,11 @@ def plot_central_abundance(self): self.__central_abundance_plots[i].set_ydata( self.__central_abundance[species] ) - if self.__central_abundance[self.__species[0]] < 1e-4: - ax.set_xscale('log') - ax.set_xlim(1, xmax) - else: - ax.set_xscale('linear') + # if self.__central_abundance[self.__species[0]] < 1e-4: + # ax.set_xscale('log') + # ax.set_xlim(1, xmax) + # else: + # ax.set_xscale('linear') def initialise_kippenhahn(self): title = 'Kippenhahn diagram' From ccd573e8c50fe9fef1aaf8b7d4ccc987b9f84928 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Fri, 25 Mar 2022 10:18:21 +0100 Subject: [PATCH 24/72] save star to a single file --- .../genec/test_integrate_default_star.py | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index 63ec088b4f..efcd812ec4 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -4,7 +4,7 @@ from amuse.datamodel import Particle from amuse.units import units from amuse.community.genec import Genec -from amuse.io import write_set_to_file +from amuse.io import write_set_to_file, read_set_from_file from amuse.support.console import set_printing_strategy import matplotlib.pyplot as plt @@ -14,12 +14,8 @@ def write_backup( step, star, - # density, - # radius, - # temperature, - # luminosity, - # pressure, abundances, + append=True, ): # GENEC reads the following on a restore/resume: # gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,ab,dm_lost,m,(q(i),p(i),t(i),r(i),s(i),x(i),y(i),& @@ -46,27 +42,22 @@ def write_backup( # read(51) period,r_core,vna,vnr # endif + if append: + filename = f'star-{star.key}.amuse' + else: + filename = f'star-{star.key}-{step}.amuse' write_set_to_file( star.as_set(), - f'star-{star.key}-{step}.amuse' - ) - # units = dict() - # units['density'] = f'{density.unit}' - # units['radius'] = f'{radius.unit}' - # units['temperature'] = f'{temperature.unit}' - # units['luminosity'] = f'{luminosity.unit}' - # units['pressure'] = f'{pressure.unit}' - - numpy.savez_compressed( - f'star-abundances-{star.key}-{step}.npz', - # units=units, - # density=density.value_in(density.unit), - # radius=radius.value_in(radius.unit), - # temperature=temperature.value_in(temperature.unit), - # luminosity=luminosity.value_in(luminosity.unit), - # pressure=pressure.value_in(pressure.unit), - abundances=abundances, + filename, + timestamp=star.age if append else None, + append_to_file=append, ) + + # For now, abundances aren't part of the single star particle + # numpy.savez_compressed( + # f'star-abundances-{star.key}-{step}.npz', + # abundances=abundances, + # ) return @@ -103,10 +94,10 @@ def write_backup( plt.rc('font', **font) plt.ion() -save_every = 1000 -store_every = 1 -plot_time = 1 | units.s -plot_models = 20 +save_every = 10 +store_every = 10 +plot_time = 5 | units.s +plot_models = 100 step = 0 model_of_last_save = 0 @@ -139,6 +130,7 @@ def write_backup( star.radius.in_(units.RSun), star.temperature.in_(units.K), star.luminosity.in_(units.LSun), + evo.parameters.phase, ) if step % store_every == 0: plotting.update(star_in_evo) @@ -169,3 +161,10 @@ def write_backup( star_in_evo.evolve_one_step() step += 1 + + +def read_saved_star_timeline(star_key): + star = read_set_from_file(f'star-{star_key}.amuse')[0] + age, radius = star.get_timeline_of_attribute_as_vector('radius') + print(age.in_(units.yr)) + print(radius.in_(units.RSun)) From b9e61a9fc6fb424344667291aea8d1ee857496b3 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Fri, 25 Mar 2022 15:15:43 +0100 Subject: [PATCH 25/72] Interface updates - now also store abundances in the star particle --- src/amuse/community/genec/interface.f90 | 271 ++++- src/amuse/community/genec/interface.py | 1279 +++++++++++++++++++++-- 2 files changed, 1447 insertions(+), 103 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 96e4e9bf23..b61370ce3d 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -2296,7 +2296,276 @@ function get_name_of_species(index_of_the_star, species, species_name) !xXXYY: as above get_name_of_species = 0 end function -! + +function get_mass_fraction_of_h_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_h_at_zone + get_mass_fraction_of_h_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 1, zone, Xj_i) +end function + + +function get_mass_fraction_of_he3_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_he3_at_zone + get_mass_fraction_of_he3_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 2, zone, Xj_i) +end function + + +function get_mass_fraction_of_he_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_he_at_zone + get_mass_fraction_of_he_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 3, zone, Xj_i) +end function + + +function get_mass_fraction_of_c12_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_c12_at_zone + get_mass_fraction_of_c12_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 4, zone, Xj_i) +end function + + +function get_mass_fraction_of_c13_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_c13_at_zone + get_mass_fraction_of_c13_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 5, zone, Xj_i) +end function + + +function get_mass_fraction_of_n14_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_n14_at_zone + get_mass_fraction_of_n14_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 6, zone, Xj_i) +end function + + +function get_mass_fraction_of_n15_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_n15_at_zone + get_mass_fraction_of_n15_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 7, zone, Xj_i) +end function + + +function get_mass_fraction_of_o16_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_o16_at_zone + get_mass_fraction_of_o16_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 8, zone, Xj_i) +end function + + +function get_mass_fraction_of_o17_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_o17_at_zone + get_mass_fraction_of_o17_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 9, zone, Xj_i) +end function + + +function get_mass_fraction_of_o18_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_o18_at_zone + get_mass_fraction_of_o18_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 10, zone, Xj_i) +end function + + +function get_mass_fraction_of_ne20_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_ne20_at_zone + get_mass_fraction_of_ne20_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 11, zone, Xj_i) +end function + + +function get_mass_fraction_of_ne22_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_ne22_at_zone + get_mass_fraction_of_ne22_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 12, zone, Xj_i) +end function + + +function get_mass_fraction_of_mg24_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_mg24_at_zone + get_mass_fraction_of_mg24_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 13, zone, Xj_i) +end function + + +function get_mass_fraction_of_mg25_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_mg25_at_zone + get_mass_fraction_of_mg25_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 14, zone, Xj_i) +end function + + +function get_mass_fraction_of_mg26_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_mg26_at_zone + get_mass_fraction_of_mg26_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 15, zone, Xj_i) +end function + + +function get_mass_fraction_of_c14_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_c14_at_zone + get_mass_fraction_of_c14_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 16, zone, Xj_i) +end function + + +function get_mass_fraction_of_f18_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_f18_at_zone + get_mass_fraction_of_f18_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 17, zone, Xj_i) +end function + + +function get_mass_fraction_of_f19_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_f19_at_zone + get_mass_fraction_of_f19_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 18, zone, Xj_i) +end function + + +function get_mass_fraction_of_ne21_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_ne21_at_zone + get_mass_fraction_of_ne21_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 19, zone, Xj_i) +end function + + +function get_mass_fraction_of_na23_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_na23_at_zone + get_mass_fraction_of_na23_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 20, zone, Xj_i) +end function + + +function get_mass_fraction_of_al26_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_al26_at_zone + get_mass_fraction_of_al26_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 21, zone, Xj_i) +end function + + +function get_mass_fraction_of_al27_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_al27_at_zone + get_mass_fraction_of_al27_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 22, zone, Xj_i) +end function + + +function get_mass_fraction_of_si28_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_si28_at_zone + get_mass_fraction_of_si28_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 23, zone, Xj_i) +end function + + +function get_mass_fraction_of_neut_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_neut_at_zone + get_mass_fraction_of_neut_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 24, zone, Xj_i) +end function + + +function get_mass_fraction_of_prot_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_prot_at_zone + get_mass_fraction_of_prot_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 25, zone, Xj_i) +end function + + +function get_mass_fraction_of_bid_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_bid_at_zone + get_mass_fraction_of_bid_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 26, zone, Xj_i) +end function + + +function get_mass_fraction_of_bid1_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: get_mass_fraction_of_species_at_zone + integer:: get_mass_fraction_of_bid1_at_zone + get_mass_fraction_of_bid1_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 27, zone, Xj_i) +end function + function get_number_of_particles() implicit none integer:: get_number_of_particles diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 0cfae6cea3..eaa1eb0c63 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -10,6 +10,9 @@ from amuse.community.interface.se import StellarEvolutionInterface from amuse.community.interface.se import InternalStellarStructure from amuse.community.interface.se import InternalStellarStructureInterface +from amuse.community.interface.stopping_conditions import ( + StoppingConditionInterface, StoppingConditions +) from amuse.units import units @@ -19,6 +22,7 @@ class GenecInterface( StellarEvolutionInterface, InternalStellarStructureInterface, CodeWithDataDirectories, + # StoppingConditionInterface, ): """ GENEC is the Geneva Stellar Evolution Code @@ -33,6 +37,18 @@ def __init__(self, **keyword_arguments): LiteratureReferencesMixIn.__init__(self) CodeWithDataDirectories.__init__(self) + @legacy_function + def finalize_stellar_model(): + function = LegacyFunctionSpecification() + function.result_type = 'int32' + return function + + @legacy_function + def write_genec_model(): + function = LegacyFunctionSpecification() + function.result_type = 'int32' + return function + @legacy_function def set_genec_path(): """ @@ -3463,119 +3479,957 @@ def get_mass_fraction_at_zone(): return function -class Genec(StellarEvolution, InternalStellarStructure): - - def __init__(self, **options): - InCodeComponentImplementation.__init__( - self, GenecInterface(**options), **options) - self.model_time = 0.0 | units.yr - - def define_parameters(self, handler): - handler.add_method_parameter( - None, - "set_genec_path", - "path_to_data", - "Path to the data directory", - default_value=self.data_directory + @legacy_function + def get_mass_fraction_of_h_at_zone(): + """ + Retrieve the fractional abundance of h at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_ipoly", - "set_par_ipoly", - "ipoly", - "GENEC parameter ipoly", - ) - handler.add_method_parameter( - "get_par_nwseq", - "set_par_nwseq", - "nwseq", - "GENEC parameter nwseq", + @legacy_function + def get_mass_fraction_of_he3_at_zone(): + """ + Retrieve the fractional abundance of he3 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_modanf", - "set_par_modanf", - "modanf", - "GENEC parameter modanf", - ) - handler.add_method_parameter( - "get_par_nzmod", - "set_par_nzmod", - "nzmod", - "GENEC parameter nzmod", + @legacy_function + def get_mass_fraction_of_he_at_zone(): + """ + Retrieve the fractional abundance of he at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_irot", - "set_par_irot", - "irot", - "GENEC parameter irot", - ) - handler.add_method_parameter( - "get_par_isol", - "set_par_isol", - "isol", - "GENEC parameter isol", + @legacy_function + def get_mass_fraction_of_c12_at_zone(): + """ + Retrieve the fractional abundance of c12 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_imagn", - "set_par_imagn", - "imagn", - "GENEC parameter imagn", - ) - handler.add_method_parameter( - "get_par_ialflu", - "set_par_ialflu", - "ialflu", - "GENEC parameter ialflu", + @legacy_function + def get_mass_fraction_of_c13_at_zone(): + """ + Retrieve the fractional abundance of c13 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_ianiso", - "set_par_ianiso", - "ianiso", - "GENEC parameter ianiso", - ) - handler.add_method_parameter( - "get_par_ipop3", - "set_par_ipop3", - "ipop3", - "GENEC parameter ipop3", + @legacy_function + def get_mass_fraction_of_n14_at_zone(): + """ + Retrieve the fractional abundance of n14 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_ibasnet", - "set_par_ibasnet", - "ibasnet", - "GENEC parameter ibasnet", - ) - handler.add_method_parameter( - "get_par_phase", - "set_par_phase", - "phase", - "GENEC parameter phase", + @legacy_function + def get_mass_fraction_of_n15_at_zone(): + """ + Retrieve the fractional abundance of n15 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_iopac", - "set_par_iopac", - "iopac", - "GENEC parameter iopac", - ) - handler.add_method_parameter( - "get_par_ikappa", - "set_par_ikappa", - "ikappa", - "GENEC parameter ikappa", - ) + @legacy_function + def get_mass_fraction_of_o16_at_zone(): + """ + Retrieve the fractional abundance of o16 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_o17_at_zone(): + """ + Retrieve the fractional abundance of o17 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_o18_at_zone(): + """ + Retrieve the fractional abundance of o18 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_ne20_at_zone(): + """ + Retrieve the fractional abundance of ne20 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_ne22_at_zone(): + """ + Retrieve the fractional abundance of ne22 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_mg24_at_zone(): + """ + Retrieve the fractional abundance of mg24 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_mg25_at_zone(): + """ + Retrieve the fractional abundance of mg25 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_mg26_at_zone(): + """ + Retrieve the fractional abundance of mg26 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_c14_at_zone(): + """ + Retrieve the fractional abundance of c14 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_f18_at_zone(): + """ + Retrieve the fractional abundance of f18 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_f19_at_zone(): + """ + Retrieve the fractional abundance of f19 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_ne21_at_zone(): + """ + Retrieve the fractional abundance of ne21 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_na23_at_zone(): + """ + Retrieve the fractional abundance of na23 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_al26_at_zone(): + """ + Retrieve the fractional abundance of al26 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_al27_at_zone(): + """ + Retrieve the fractional abundance of al27 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_si28_at_zone(): + """ + Retrieve the fractional abundance of si28 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_neut_at_zone(): + """ + Retrieve the fractional abundance of neut at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_prot_at_zone(): + """ + Retrieve the fractional abundance of prot at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_bid_at_zone(): + """ + Retrieve the fractional abundance of bid at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def get_mass_fraction_of_bid1_at_zone(): + """ + Retrieve the fractional abundance of bid1 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.OUT, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function + + +class Genec(StellarEvolution, InternalStellarStructure): + + def __init__(self, **options): + InCodeComponentImplementation.__init__( + self, GenecInterface(**options), **options) + # self.stopping_conditions = StoppingConditions(self) + self.model_time = 0.0 | units.yr + + def define_parameters(self, handler): + handler.add_method_parameter( + None, + "set_genec_path", + "path_to_data", + "Path to the data directory", + default_value=self.data_directory + ) + + handler.add_method_parameter( + "get_par_ipoly", + "set_par_ipoly", + "ipoly", + "GENEC parameter ipoly", + ) + + handler.add_method_parameter( + "get_par_nwseq", + "set_par_nwseq", + "nwseq", + "GENEC parameter nwseq", + ) + + handler.add_method_parameter( + "get_par_modanf", + "set_par_modanf", + "modanf", + "GENEC parameter modanf", + ) + + handler.add_method_parameter( + "get_par_nzmod", + "set_par_nzmod", + "nzmod", + "GENEC parameter nzmod", + ) + + handler.add_method_parameter( + "get_par_irot", + "set_par_irot", + "irot", + "GENEC parameter irot", + ) + + handler.add_method_parameter( + "get_par_isol", + "set_par_isol", + "isol", + "GENEC parameter isol", + ) + + handler.add_method_parameter( + "get_par_imagn", + "set_par_imagn", + "imagn", + "GENEC parameter imagn", + ) + + handler.add_method_parameter( + "get_par_ialflu", + "set_par_ialflu", + "ialflu", + "GENEC parameter ialflu", + ) + + handler.add_method_parameter( + "get_par_ianiso", + "set_par_ianiso", + "ianiso", + "GENEC parameter ianiso", + ) + + handler.add_method_parameter( + "get_par_ipop3", + "set_par_ipop3", + "ipop3", + "GENEC parameter ipop3", + ) + + handler.add_method_parameter( + "get_par_ibasnet", + "set_par_ibasnet", + "ibasnet", + "GENEC parameter ibasnet", + ) + + handler.add_method_parameter( + "get_par_phase", + "set_par_phase", + "phase", + "GENEC parameter phase", + ) + + handler.add_method_parameter( + "get_par_iopac", + "set_par_iopac", + "iopac", + "GENEC parameter iopac", + ) + + handler.add_method_parameter( + "get_par_ikappa", + "set_par_ikappa", + "ikappa", + "GENEC parameter ikappa", + ) handler.add_method_parameter( "get_par_idiff", @@ -4109,6 +4963,14 @@ def define_parameters(self, handler): "GENEC parameter starname", ) + handler.add_method_parameter( + "get_min_timestep_stop_condition", + "set_min_timestep_stop_condition", + "min_timestep_stop_condition", + "The minimum timestep stop condition", + default_value=1e-4 | units.julianyr + ) + def define_particle_sets(self, handler): # for particle_set in ['particles', 'fullparticles']: @@ -4125,10 +4987,16 @@ def define_particle_sets(self, handler): handler.add_getter(set_name, 'get_luminosity') handler.add_getter(set_name, 'get_temperature') handler.add_getter(set_name, 'get_time_step', names=('time_step',)) + handler.add_getter( + set_name, 'get_number_of_zones', names=('n_zones',) + ) + handler.add_getter( + set_name, 'get_number_of_species', names=('n_species',) + ) # handler.add_method(set_name, 'get_number_of_zones') handler.add_method(set_name, 'get_number_of_zones') - + # handler.add_method(set_name, 'get_radius_profile') # handler.add_method(set_name, 'get_temperature_profile') handler.add_method(set_name, 'get_luminosity_profile') @@ -4139,37 +5007,234 @@ def define_particle_sets(self, handler): handler.add_method(set_name, 'evolve_for') handler.set_delete(set_name, 'delete_star') - for particle_set in ["fullparticles",]: handler.add_gridded_getter( - particle_set, + set_name, 'get_radius_at_zone', 'get_firstlast_zone', names=('radius_profile',) ) handler.add_gridded_setter( - particle_set, + set_name, 'set_radius_at_zone', 'get_firstlast_zone', names=('radius_profile',) ) handler.add_gridded_getter( - particle_set, + set_name, 'get_temperature_at_zone', 'get_firstlast_zone', names=('temperature_profile',) ) handler.add_gridded_getter( - particle_set, + set_name, 'get_density_at_zone', 'get_firstlast_zone', names=('density_profile',) ) handler.add_gridded_getter( - particle_set, + set_name, 'get_luminosity_at_zone', 'get_firstlast_zone', names=('luminosity_profile',) ) handler.add_gridded_getter( - particle_set, + set_name, 'get_pressure_at_zone', 'get_firstlast_zone', names=('pressure_profile',) ) + + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_h_at_zone', + 'get_firstlast_zone', + names=('abundance_h',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_he3_at_zone', + 'get_firstlast_zone', + names=('abundance_he3',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_he_at_zone', + 'get_firstlast_zone', + names=('abundance_he',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_c12_at_zone', + 'get_firstlast_zone', + names=('abundance_c12',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_c13_at_zone', + 'get_firstlast_zone', + names=('abundance_c13',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_n14_at_zone', + 'get_firstlast_zone', + names=('abundance_n14',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_n15_at_zone', + 'get_firstlast_zone', + names=('abundance_n15',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_o16_at_zone', + 'get_firstlast_zone', + names=('abundance_o16',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_o17_at_zone', + 'get_firstlast_zone', + names=('abundance_o17',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_o18_at_zone', + 'get_firstlast_zone', + names=('abundance_o18',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_ne20_at_zone', + 'get_firstlast_zone', + names=('abundance_ne20',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_ne22_at_zone', + 'get_firstlast_zone', + names=('abundance_ne22',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_mg24_at_zone', + 'get_firstlast_zone', + names=('abundance_mg24',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_mg25_at_zone', + 'get_firstlast_zone', + names=('abundance_mg25',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_mg26_at_zone', + 'get_firstlast_zone', + names=('abundance_mg26',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_c14_at_zone', + 'get_firstlast_zone', + names=('abundance_c14',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_f18_at_zone', + 'get_firstlast_zone', + names=('abundance_f18',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_f19_at_zone', + 'get_firstlast_zone', + names=('abundance_f19',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_ne21_at_zone', + 'get_firstlast_zone', + names=('abundance_ne21',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_na23_at_zone', + 'get_firstlast_zone', + names=('abundance_na23',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_al26_at_zone', + 'get_firstlast_zone', + names=('abundance_al26',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_al27_at_zone', + 'get_firstlast_zone', + names=('abundance_al27',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_si28_at_zone', + 'get_firstlast_zone', + names=('abundance_si28',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_neut_at_zone', + 'get_firstlast_zone', + names=('abundance_neut',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_prot_at_zone', + 'get_firstlast_zone', + names=('abundance_prot',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_bid_at_zone', + 'get_firstlast_zone', + names=('abundance_bid',) + ) + + handler.add_gridded_getter( + set_name, + 'get_mass_fraction_of_bid1_at_zone', + 'get_firstlast_zone', + names=('abundance_bid1',) + ) + + # for species in self.SPECIES_NAMES: + # getter = f'get_{species}_at_zone' + # handler.add_gridded_getter( + # particle_set, + # getter, + # 'get_firstlast_zone', + # ) # for species in species_name: # handler.add_gridded_getter( # particle_set, @@ -4212,7 +5277,6 @@ def define_state(self, handler): handler.add_method('RUN', 'get_pressure_at_zone') handler.add_method('RUN', 'get_radius') handler.add_method('RUN', 'get_radius_at_zone') - handler.add_method('RUN', 'set_radius_at_zone') handler.add_method('RUN', 'get_temperature_at_zone') handler.add_method('RUN', 'get_density_at_zone') handler.add_method('RUN', 'get_luminosity_at_zone') @@ -4220,7 +5284,18 @@ def define_state(self, handler): handler.add_method('RUN', 'get_time_step') # -> Update - + handler.add_transition('RUN', 'UPDATE', 'finalize_stellar_model') + handler.add_method('UPDATE', 'set_chemical_abundance_profiles') + handler.add_method('UPDATE', 'set_mass_fraction_of_species_at_zone') + handler.add_method('UPDATE', 'set_number_of_zones') + # handler.add_method('UPDATE', 'set_radius') + handler.add_method('UPDATE', 'set_radius_at_zone') + handler.add_method('UPDATE', 'set_temperature_at_zone') + handler.add_method('UPDATE', 'set_density_at_zone') + handler.add_method('UPDATE', 'set_luminosity_at_zone') + handler.add_method('UPDATE', 'set_mass_fraction_at_zone') + # handler.add_method('UPDATE', 'set_time_step') + handler.add_transition('UPDATE', 'RUN', 'recommit_particles') # -> Run (recommit_particles) handler.add_method('UPDATE', 'set_starname') From 93c3644464ff85acb2e74de102bbf5249d8949e3 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Fri, 25 Mar 2022 15:16:25 +0100 Subject: [PATCH 26/72] store phase in plotting --- src/amuse/community/genec/plot_models.py | 4 +++- src/amuse/community/genec/test_integrate_default_star.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 741e2c4986..9e66d1ee5c 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -15,6 +15,7 @@ def __init__(self, star): 'density': units.g * units.cm**-3, } self.star = star + self.__phase = 1 self.__age = [] | self.default_units['age'] self.__mass = [] | self.default_units['mass'] self.__radius = [] | self.default_units['radius'] @@ -52,8 +53,9 @@ def __init__(self, star): self.update(star) self.plot_all() - def update(self, star): + def update(self, star, phase=1): self.star = star + self.__phase = phase self.__age.append(star.age) self.__mass.append(star.mass) self.__radius.append(star.radius) diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index efcd812ec4..52f64b9a2a 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -94,8 +94,8 @@ def write_backup( plt.rc('font', **font) plt.ion() -save_every = 10 -store_every = 10 +save_every = 1 +store_every = 1 plot_time = 5 | units.s plot_models = 100 step = 0 @@ -133,7 +133,7 @@ def write_backup( evo.parameters.phase, ) if step % store_every == 0: - plotting.update(star_in_evo) + plotting.update(star_in_evo, phase=evo.parameters.phase) if ( (time_elapsed - time_of_last_plot) > plot_time or step - model_of_last_plot > plot_models From 3cb494c8664121a08f908c85f8142ff2fbfdcb04 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Fri, 25 Mar 2022 16:16:15 +0100 Subject: [PATCH 27/72] WIP --- src/amuse/community/genec/plot_models.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 9e66d1ee5c..44efe5bc48 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -262,10 +262,19 @@ def plot_central_abundance(self): self.__central_abundance_plots[i].set_xdata( self.__age.value_in(unit_age) ) + # if self.__phase == 1: + # self.__central_abundance_plots[i].set_xdata( + # self.__age.value_in(unit_age) + # ) + # else: + # self.__central_abundance_plots[i].set_xdata( + # # self.__age.value_in(unit_age) + # (self.__star.age - self.__age).value_in(unit_age) + # ) self.__central_abundance_plots[i].set_ydata( self.__central_abundance[species] ) - # if self.__central_abundance[self.__species[0]] < 1e-4: + # if self.__phase > 1: # central_abundance[self.__species[0]] < 1e-4: # ax.set_xscale('log') # ax.set_xlim(1, xmax) # else: From 152be905c6c2829a682f63b9ff8cd29b3821f89d Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Fri, 25 Mar 2022 16:19:53 +0100 Subject: [PATCH 28/72] Support HDF5 compression of AMUSE files use with 'compression=True' or 'compression="hdf5", compression_opts=compression_level' (compression level is a number up to 9) --- src/amuse/io/store.py | 38 +++++--- src/amuse/io/store_v2.py | 194 +++++++++++++++++++++++++++++++++------ 2 files changed, 193 insertions(+), 39 deletions(-) diff --git a/src/amuse/io/store.py b/src/amuse/io/store.py index d4b5cd9af9..f298bf563a 100644 --- a/src/amuse/io/store.py +++ b/src/amuse/io/store.py @@ -37,7 +37,7 @@ class HDF5FileFormatProcessor(base.FileFormatProcessor): provided_formats = ['hdf5', 'amuse'] - def __init__(self, filename = None, set = None, format = None): + def __init__(self, filename=None, set=None, format=None): base.FileFormatProcessor.__init__(self, filename, set, format) def load(self): @@ -49,12 +49,15 @@ def load(self): def load_base(self): processor = store_v2.StoreHDF( - self.filename, - open_for_writing = False, - append_to_file = self.append_to_file or self.allow_writing, - copy_history = self.copy_history, - overwrite_file = self.overwrite_file ) - if not processor.is_correct_version(): + self.filename, + open_for_writing=False, + append_to_file=self.append_to_file or self.allow_writing, + copy_history=self.copy_history, + overwrite_file=self.overwrite_file, + compression=False, + compression_opts=None, + ) + if not processor.is_correct_version(): processor.close() processor = store_v1.StoreHDF( self.filename, @@ -94,10 +97,12 @@ def store(self): raise Exception("You are trying to append to a file that was not written in version 1.0 format") else: processor = store_v2.StoreHDF( - self.filename, - append_to_file = self.append_to_file, - open_for_writing = True, - overwrite_file = self.overwrite_file + self.filename, + append_to_file=self.append_to_file, + open_for_writing=True, + overwrite_file=self.overwrite_file, + compression=self.compression, + compression_opts=self.compression_opts ) if not processor.is_correct_version(): @@ -170,3 +175,14 @@ def overwrite_file(self): """If set to True, overwrite file if it exists, otherwise writing an existing file generates an exception""" return False + + @base.format_option + def compression(self): + """If set to False, don't use compression, otherwise use specified compression + mode (defaults to False, True means 'gzip')""" + return False + + @base.format_option + def compression_opts(self): + "Compression level to use if using compression (0-9, defaults to None)" + return None diff --git a/src/amuse/io/store_v2.py b/src/amuse/io/store_v2.py index a9bb388ce0..2da719f813 100644 --- a/src/amuse/io/store_v2.py +++ b/src/amuse/io/store_v2.py @@ -38,6 +38,8 @@ def unpickle_from_string(value): return pickle.loads(value, encoding='bytes') class HDF5Attribute(object): + compression = False + compression_opts = None def __init__(self, name): self.name = name @@ -66,26 +68,56 @@ def new_attribute(cls, name, shape, input, group): if not hasattr(shape, '__iter__'): shape = shape, dtype = numpy.asanyarray(input.number).dtype - dataset = group.create_dataset(name, shape=shape, dtype=dtype) + dataset = group.create_dataset( + name, + shape=shape, + dtype=dtype, + compression=cls.compression, + compression_opts=cls.compression_opts, + ) dataset.attrs["units"] = input.unit.to_simple_form().reference_string().encode('ascii') return HDF5VectorQuantityAttribute(name, dataset, input.unit) elif hasattr(input, 'as_set'): raise Exception("adding a linked attribute to a set stored in a HDF file is not supported, alternative is to copy the set and save it") subgroup = group.create_group(name) - group.create_dataset('keys', shape=shape, dtype=input.key.dtype) - group.create_dataset('masked', shape=shape, dtype=numpy.bool) + group.create_dataset( + 'keys', + shape=shape, + dtype=input.key.dtype, + compression=cls.compression, + compression_opts=cls.compression_opts, + ) + group.create_dataset( + 'masked', + shape=shape, + dtype=numpy.bool, + compression=cls.compression, + compression_opts=cls.compression_opts, + ) return HDF5LinkedAttribute(name, subgroup) else: dtype = numpy.asanyarray(input).dtype if dtype.kind == 'U': new_dtype = numpy.dtype('S' + dtype.itemsize * 4) - dataset = group.create_dataset(name, shape=shape, dtype=dtype) + dataset = group.create_dataset( + name, + shape=shape, + dtype=dtype, # FIXME new_dtype? + compression=cls.compression, + compression_opts=cls.compression_opts, + ) dataset.attrs["units"] = "UNICODE".encode('ascii') return HDF5UnicodeAttribute(name, dataset) else: - if not hasattr(shape, '__iter__'): + if not hasattr(shape, '__iter__'): shape = shape, - dataset = group.create_dataset(name, shape=shape, dtype=dtype) + dataset = group.create_dataset( + name, + shape=shape, + dtype=dtype, + compression=cls.compression, + compression_opts=cls.compression_opts, + ) dataset.attrs["units"] = "none".encode('ascii') return HDF5UnitlessAttribute(name, dataset) @@ -131,6 +163,8 @@ def remove_indices(self, indices): pass class HDF5VectorQuantityAttribute(HDF5Attribute): + compression = False + compression_opts = None def __init__(self, name, dataset, unit): HDF5Attribute.__init__(self, name) @@ -173,7 +207,13 @@ def increase_to_length(self, newlength): parent = self.dataset.parent del parent[self.name] - self.dataset = parent.create_dataset(self.name, shape=newshape, dtype=values.dtype) + self.dataset = parent.create_dataset( + self.name, + shape=newshape, + dtype=values.dtype, + compression=self.compression, + compression_opts=self.compression_opts, + ) self.dataset[:oldlength] = values[:] def get_length(self): @@ -197,7 +237,13 @@ def remove_indices(self, indices): parent = self.dataset.parent del parent[self.name] - self.dataset = parent.create_dataset(self.name, shape=values.shape, dtype=values.dtype) + self.dataset = parent.create_dataset( + self.name, + shape=values.shape, + dtype=values.dtype, + compression=self.compression, + compression_opts=self.compression_opts, + ) self.dataset[:] = values[:] @@ -206,6 +252,8 @@ def has_units(self): return True class HDF5UnitlessAttribute(HDF5Attribute): + compression = False + compression_opts = None def __init__(self, name, dataset): HDF5Attribute.__init__(self, name) @@ -240,7 +288,13 @@ def increase_to_length(self, newlength): parent = self.dataset.parent del parent[self.name] - self.dataset = parent.create_dataset(self.name, shape=newshape, dtype=values.dtype) + self.dataset = parent.create_dataset( + self.name, + shape=newshape, + dtype=values.dtype, + compression=self.compression, + compression_opts=self.compression_opts, + ) self.dataset[:oldlength] = values[:] def get_length(self): @@ -264,7 +318,13 @@ def remove_indices(self, indices): parent = self.dataset.parent del parent[self.name] - self.dataset = parent.create_dataset(self.name, shape=values.shape, dtype=values.dtype) + self.dataset = parent.create_dataset( + self.name, + shape=values.shape, + dtype=values.dtype, + compression=self.compression, + compression_opts=self.compression_opts, + ) self.dataset[:] = values[:] def has_units(self): @@ -384,14 +444,26 @@ def increase_to_length(self, newlength): parent = self.group del parent['keys'] - self.keys = parent.create_dataset('keys', shape=newshape, dtype=values.dtype) + self.keys = parent.create_dataset( + 'keys', + shape=newshape, + dtype=values.dtype, + compression=self.compression, + compression_opts=self.compression_opts, + ) self.keys[:oldlength] = values[:] values = numpy.empty(shape=self.masked.shape, dtype=self.masked.dtype) values[:] = self.masked[:] parent = self.group del parent['masked'] - self.masked = parent.create_dataset('masked', shape=newshape, dtype=values.dtype) + self.masked = parent.create_dataset( + 'masked', + shape=newshape, + dtype=values.dtype, + compression=self.compression, + compression_opts=self.compression_opts, + ) self.masked[:oldlength] = values[:] @@ -424,7 +496,13 @@ def remove_indices(self, indices): parent = self.dataset.parent del parent[self.name] - self.dataset = parent.create_dataset(self.name, shape=values.shape, dtype=values.dtype) + self.dataset = parent.create_dataset( + self.name, + shape=values.shape, + dtype=values.dtype, + compression=self.compression, + compression_opts=self.compression_opts, + ) self.dataset[:] = values[:] def has_units(self): @@ -628,13 +706,28 @@ def is_resolved(self): class StoreHDF(object): INFO_GROUP_NAME = 'AMUSE_INF' DATA_GROUP_NAME = 'data' - - def __init__(self, filename, append_to_file=True, open_for_writing = True, copy_history = False, overwrite_file=False): + + def __init__( + self, + filename, + append_to_file=True, + open_for_writing=True, + copy_history=False, + overwrite_file=False, + compression=False, + compression_opts=None, + ): + self.compression = compression + self.compression_opts = compression_opts if h5py is None: - raise exceptions.AmuseException("h5py module not available, cannot use hdf5 files") - - logger.info("opening {0} with options {1} {2} {3} {4}".format(filename, append_to_file, open_for_writing, copy_history,overwrite_file)) - + raise exceptions.AmuseException( + "h5py module not available, cannot use hdf5 files") + + logger.info( + f"opening {filename} with options {append_to_file} " + f"{open_for_writing} {copy_history} {overwrite_file}" + ) + if not append_to_file and open_for_writing: if os.path.exists(filename): if overwrite_file: @@ -745,7 +838,12 @@ def store_particles(self, particles, extra_attributes = {}, parent=None, mapping group.attrs["class_of_the_particles"] = pickle_to_string(particles._factory_for_new_collection()) keys = particles.get_all_keys_in_store() - dataset = group.create_dataset("keys", data=keys) + dataset = group.create_dataset( + "keys", + data=keys, + compression=self.compression, + compression_opts=self.compression_opts, + ) self.hdf5file.flush() self.store_collection_attributes(particles, group, extra_attributes, links) self.store_values(particles, group, links) @@ -763,7 +861,12 @@ def store_grid(self, grid, extra_attributes = {}, parent=None, mapping_from_seti group.attrs["type"] = 'grid'.encode("ascii") group.attrs["class_of_the_container"] = pickle_to_string(grid._factory_for_new_collection()) - group.create_dataset("shape", data=numpy.asarray(grid.shape)) + group.create_dataset( + "shape", + data=numpy.asarray(grid.shape), + compression=self.compression, + compression_opts=self.compression_opts, + ) self.store_collection_attributes(grid, group, extra_attributes, links) self.store_values(grid, group, links) @@ -793,17 +896,32 @@ def store_values(self, container, group, links = []): for attribute, quantity in zip(container.get_attribute_names_defined_in_store(), all_values): if is_quantity(quantity): value = quantity.value_in(quantity.unit) - dataset = attributes_group.create_dataset(attribute, data=value) + dataset = attributes_group.create_dataset( + attribute, + data=value, + compression=self.compression, + compression_opts=self.compression_opts, + ) dataset.attrs["units"] = quantity.unit.to_simple_form().reference_string().encode("ascii") elif isinstance(quantity, LinkedArray): self.store_linked_array(attribute, attributes_group, quantity, group, links) else: dtype = numpy.asanyarray(quantity).dtype if dtype.kind == 'U': - dataset = attributes_group.create_dataset(attribute, data=numpy.char.encode(quantity, 'UTF-32BE')) + dataset = attributes_group.create_dataset( + attribute, + data=numpy.char.encode(quantity, 'UTF-32BE'), + compression=self.compression, + compression_opts=self.compression_opts, + ) dataset.attrs["units"] = "UNICODE".encode('ascii') else: - dataset = attributes_group.create_dataset(attribute, data=quantity) + dataset = attributes_group.create_dataset( + attribute, + data=quantity, + compression=self.compression, + compression_opts=self.compression_opts, + ) dataset.attrs["units"] = "none".encode('ascii') @@ -814,7 +932,12 @@ def store_linked_array(self, attribute, attributes_group, quantity, group, links kind_array = numpy.zeros(shape, dtype = numpy.int16) ref_dtype = h5py.special_dtype(ref=h5py.Reference) ref_array = numpy.empty(shape, dtype = ref_dtype) - ref_dataset = subgroup.create_dataset('ref', data=ref_array) + ref_dataset = subgroup.create_dataset( + 'ref', + data=ref_array, + compression=self.compression, + compression_opts=self.compression_opts, + ) key_array = numpy.zeros(shape, dtype = numpy.uint64) max_len_grid_indices = 0 @@ -870,10 +993,25 @@ def store_linked_array(self, attribute, attributes_group, quantity, group, links else: raise Exception("unsupported type {0}".format(type(object))) if max_len_grid_indices > 0: - subgroup.create_dataset('indices', data=indices_array) + subgroup.create_dataset( + 'indices', + data=indices_array, + compression=self.compression, + compression_opts=self.compression_opts, + ) - subgroup.create_dataset('keys', data=key_array) - subgroup.create_dataset('kind', data=kind_array) + subgroup.create_dataset( + 'keys', + data=key_array, + compression=self.compression, + compression_opts=self.compression_opts, + ) + subgroup.create_dataset( + 'kind', + data=kind_array, + compression=self.compression, + compression_opts=self.compression_opts, + ) subgroup.attrs["units"] = "link".encode("ascii") From 9afb2164f768ed0344b46aae8c5dbb1cf4001e8b Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Fri, 25 Mar 2022 16:43:09 +0100 Subject: [PATCH 29/72] updates --- .../genec/test_integrate_default_star.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index 52f64b9a2a..7df71a6d45 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -11,6 +11,13 @@ from plot_models import StellarModelPlot +def read_saved_star_timeline(star_key): + star = read_set_from_file(f'star-{star_key}.amuse')[0] + age, radius = star.get_timeline_of_attribute_as_vector('radius') + print(age.in_(units.yr)) + print(radius.in_(units.RSun)) + + def write_backup( step, star, @@ -51,6 +58,7 @@ def write_backup( filename, timestamp=star.age if append else None, append_to_file=append, + compression=True, ) # For now, abundances aren't part of the single star particle @@ -108,7 +116,7 @@ def write_backup( plotting = StellarModelPlot(star_in_evo) -while True: +while step < 500: time_elapsed = (time.time() | units.s) - time_start star = star_in_evo.copy() # number_of_zones = star_in_evo.get_number_of_zones() @@ -163,8 +171,4 @@ def write_backup( step += 1 -def read_saved_star_timeline(star_key): - star = read_set_from_file(f'star-{star_key}.amuse')[0] - age, radius = star.get_timeline_of_attribute_as_vector('radius') - print(age.in_(units.yr)) - print(radius.in_(units.RSun)) +print(f"Running {step} models took {(time.time() | units.s) - time_start}") From fbf5be7fda3d943cefadddb14ccd313179daf7b5 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Fri, 25 Mar 2022 16:53:13 +0100 Subject: [PATCH 30/72] add test for compressed AMUSE file (v 2.0 only) --- src/amuse/test/suite/core_tests/test_io.py | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/amuse/test/suite/core_tests/test_io.py b/src/amuse/test/suite/core_tests/test_io.py index db3b9d92b1..a75ffa9a3f 100644 --- a/src/amuse/test/suite/core_tests/test_io.py +++ b/src/amuse/test/suite/core_tests/test_io.py @@ -2,6 +2,7 @@ from amuse.support.exceptions import AmuseException import os +import tempfile from amuse import io from amuse.io import base from amuse.units import nbody_system @@ -402,3 +403,28 @@ def test12(self): options = base.get_options_for_format('txt') self.assertTrue(len(options) >= 0) + def test_hdf5_compressed(self): + options = { + "version": "2.0", + "compression": "gzip", + "compression_opts": 5, + } + with tempfile.NamedTemporaryFile() as tmp: + filename = tmp.name + x = datamodel.Particles(2) + x.mass = [1.0, 2.0] | units.kg + io.write_set_to_file(x, filename, "hdf5", **options, overwrite_file=True) + x.mass = [10.0, 20.0] | units.kg + io.write_set_to_file(x, filename, "hdf5", append_to_file=True, **options) + x.mass = [100.0, 200.0] | units.kg + io.write_set_to_file(x, filename, "hdf5", append_to_file=True, **options) + y = io.read_set_from_file(filename, "hdf5", copy_history=False, close_file=False) + self.assertAlmostEqual(x.mass, y.mass, 8) + self.assertAlmostEqual([10.0, 20.0] | units.kg, y.previous_state().mass, 8) + self.assertAlmostEqual([1.0, 2.0] | units.kg, y.previous_state().previous_state().mass, 8) + self.assertEqual(y.previous_state().previous_state().previous_state(), None) + + io.write_set_to_file(x, filename, "hdf5", append_to_file=False, overwrite_file=True, **options) + y = io.read_set_from_file(filename, "hdf5") + self.assertAlmostEqual(x.mass, y.mass, 8) + self.assertEqual(y.previous_state().previous_state(), None) From 7f9e97830db638513235ab7bc0c4ae2a075f308a Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 30 Mar 2022 13:20:13 +0200 Subject: [PATCH 31/72] Add getters/setters --- src/amuse/community/genec/interface.f90 | 348 +++++- src/amuse/community/genec/interface.py | 1372 +++++++++++++++++------ 2 files changed, 1389 insertions(+), 331 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index b61370ce3d..b1f78ca5b7 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1748,7 +1748,8 @@ function delete_star() function evolve_model(end_time) use timestep, only: alter use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise, initialise_star + use genec, only: evolve, modell, finalise + use amuse_helpers, only: initialise_star implicit none double precision:: end_time integer:: evolve_model @@ -1770,7 +1771,8 @@ function evolve_for(index_of_the_star, time) ! evolve use timestep, only: alter use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise, initialise_star + use genec, only: evolve, modell, finalise + use amuse_helpers, only: initialise_star implicit none integer:: index_of_the_star double precision:: time, end_time @@ -1795,7 +1797,8 @@ function evolve_for(index_of_the_star, time) function evolve_one_step(index_of_the_star) use timestep, only: alter use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise, initialise_star + use genec, only: evolve, modell, finalise + use amuse_helpers, only: initialise_star use inputparam,only: modanf,nwseq,nzmod implicit none integer:: index_of_the_star @@ -1824,7 +1827,8 @@ function finalize_stellar_model() function write_genec_model() use inputparam, only: modanf use WriteSaveClose, only: OpenAll - use genec, only: finalise, initialise_star + use genec, only: finalise + use amuse_helpers, only: initialise_star use inputparam, only: writetofiles implicit none integer:: write_genec_model @@ -1860,6 +1864,31 @@ function set_age(index_of_the_star, age) set_age = 0 end function +function get_surface_velocity(index_of_the_star, surface_velocity) + use genec, only: vequat + implicit none + integer:: index_of_the_star + double precision:: surface_velocity + integer:: get_surface_velocity + surface_velocity = vequat + get_surface_velocity = 0 +end function + +function get_omegi_at_zone(index_of_the_star, zone, omegi_i) + use rotmod, only: omegi + use strucmod, only: m + implicit none + integer:: index_of_the_star + integer:: get_omegi_at_zone + double precision:: omegi_i + integer:: zone, i + i = m - zone + if (zone <= m) then + omegi_i = omegi(i) + end if + get_omegi_at_zone = 0 +end function + function get_density_at_zone(index_of_the_star, zone, rho_i) use strucmod, only: rho, m implicit none @@ -2566,6 +2595,276 @@ function get_mass_fraction_of_bid1_at_zone(index_of_the_star, zone, Xj_i) get_mass_fraction_of_bid1_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 27, zone, Xj_i) end function + +function set_mass_fraction_of_h_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_h_at_zone + set_mass_fraction_of_h_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 1, zone, Xj_i) +end function + + +function set_mass_fraction_of_he3_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_he3_at_zone + set_mass_fraction_of_he3_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 2, zone, Xj_i) +end function + + +function set_mass_fraction_of_he_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_he_at_zone + set_mass_fraction_of_he_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 3, zone, Xj_i) +end function + + +function set_mass_fraction_of_c12_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_c12_at_zone + set_mass_fraction_of_c12_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 4, zone, Xj_i) +end function + + +function set_mass_fraction_of_c13_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_c13_at_zone + set_mass_fraction_of_c13_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 5, zone, Xj_i) +end function + + +function set_mass_fraction_of_n14_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_n14_at_zone + set_mass_fraction_of_n14_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 6, zone, Xj_i) +end function + + +function set_mass_fraction_of_n15_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_n15_at_zone + set_mass_fraction_of_n15_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 7, zone, Xj_i) +end function + + +function set_mass_fraction_of_o16_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_o16_at_zone + set_mass_fraction_of_o16_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 8, zone, Xj_i) +end function + + +function set_mass_fraction_of_o17_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_o17_at_zone + set_mass_fraction_of_o17_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 9, zone, Xj_i) +end function + + +function set_mass_fraction_of_o18_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_o18_at_zone + set_mass_fraction_of_o18_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 10, zone, Xj_i) +end function + + +function set_mass_fraction_of_ne20_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_ne20_at_zone + set_mass_fraction_of_ne20_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 11, zone, Xj_i) +end function + + +function set_mass_fraction_of_ne22_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_ne22_at_zone + set_mass_fraction_of_ne22_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 12, zone, Xj_i) +end function + + +function set_mass_fraction_of_mg24_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_mg24_at_zone + set_mass_fraction_of_mg24_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 13, zone, Xj_i) +end function + + +function set_mass_fraction_of_mg25_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_mg25_at_zone + set_mass_fraction_of_mg25_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 14, zone, Xj_i) +end function + + +function set_mass_fraction_of_mg26_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_mg26_at_zone + set_mass_fraction_of_mg26_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 15, zone, Xj_i) +end function + + +function set_mass_fraction_of_c14_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_c14_at_zone + set_mass_fraction_of_c14_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 16, zone, Xj_i) +end function + + +function set_mass_fraction_of_f18_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_f18_at_zone + set_mass_fraction_of_f18_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 17, zone, Xj_i) +end function + + +function set_mass_fraction_of_f19_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_f19_at_zone + set_mass_fraction_of_f19_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 18, zone, Xj_i) +end function + + +function set_mass_fraction_of_ne21_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_ne21_at_zone + set_mass_fraction_of_ne21_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 19, zone, Xj_i) +end function + + +function set_mass_fraction_of_na23_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_na23_at_zone + set_mass_fraction_of_na23_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 20, zone, Xj_i) +end function + + +function set_mass_fraction_of_al26_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_al26_at_zone + set_mass_fraction_of_al26_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 21, zone, Xj_i) +end function + + +function set_mass_fraction_of_al27_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_al27_at_zone + set_mass_fraction_of_al27_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 22, zone, Xj_i) +end function + + +function set_mass_fraction_of_si28_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_si28_at_zone + set_mass_fraction_of_si28_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 23, zone, Xj_i) +end function + + +function set_mass_fraction_of_neut_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_neut_at_zone + set_mass_fraction_of_neut_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 24, zone, Xj_i) +end function + + +function set_mass_fraction_of_prot_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_prot_at_zone + set_mass_fraction_of_prot_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 25, zone, Xj_i) +end function + + +function set_mass_fraction_of_bid_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_bid_at_zone + set_mass_fraction_of_bid_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 26, zone, Xj_i) +end function + + +function set_mass_fraction_of_bid1_at_zone(index_of_the_star, zone, Xj_i) + implicit none + integer:: index_of_the_star, zone + double precision:: Xj_i + integer:: set_mass_fraction_of_species_at_zone + integer:: set_mass_fraction_of_bid1_at_zone + set_mass_fraction_of_bid1_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 27, zone, Xj_i) +end function + function get_number_of_particles() implicit none integer:: get_number_of_particles @@ -2616,6 +2915,21 @@ function get_number_of_zones(index_of_the_star, n_zones) get_number_of_zones = 0 end function +function set_number_of_zones(index_of_the_star, n_zones) + use inputparam, only: starname + use strucmod, only: m + implicit none + integer:: index_of_the_star + integer:: n_zones + integer:: set_number_of_zones + !if (char(index_of_the_star) /= starname) then + ! get_number_of_zones = -1 + ! return + !end if + m = n_zones + set_number_of_zones = 0 +end function + function get_firstlast_zone(first, last) use strucmod, only: m implicit none @@ -2641,19 +2955,19 @@ function get_pressure_at_zone(index_of_the_star, zone, P_i) get_pressure_at_zone = 0 end function -function set_pressure_at_zone(index_of_the_star, zone, P_i) - use strucmod, only: p, m - implicit none - integer:: index_of_the_star - integer:: zone, i - double precision:: P_i - integer:: set_pressure_at_zone - if (zone <= m) then - i = m - zone - p(i) = log(P_i) - end if - set_pressure_at_zone = 0 -end function +!function set_pressure_at_zone(index_of_the_star, zone, P_i) +! use strucmod, only: p, m +! implicit none +! integer:: index_of_the_star +! integer:: zone, i +! double precision:: P_i +! integer:: set_pressure_at_zone +! if (zone <= m) then +! i = m - zone +! p(i) = log(P_i) +! end if +! set_pressure_at_zone = 0 +!end function function get_radius(index_of_the_star, am_radius) use caramodele, only: radius diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index eaa1eb0c63..901ea4f893 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -15,6 +15,36 @@ ) from amuse.units import units +SPECIES_NAMES = { + 'h': 1, + 'he3': 2, + 'he': 3, + 'c12': 4, + 'c13': 5, + 'n14': 6, + 'n15': 7, + 'o16': 8, + 'o17': 9, + 'o18': 10, + 'ne20': 11, + 'ne22': 12, + 'mg24': 13, + 'mg25': 14, + 'mg26': 15, + 'c14': 16, + 'f18': 17, + 'f19': 18, + 'ne21': 19, + 'na23': 20, + 'al26': 21, + 'al27': 22, + 'si28': 23, + 'neut': 24, + 'prot': 25, + 'bid': 26, + 'bid1': 27, +} + class GenecInterface( CodeInterface, @@ -2344,7 +2374,6 @@ def get_par_vwant(): function.addParameter( 'vwant', dtype='float64', direction=function.OUT, - unit=units.kms ) function.result_type = 'int32' function.result_doc = ''' @@ -3385,13 +3414,28 @@ def get_firstlast_zone(): function.result_type = 'int32' return function + @legacy_function + def get_surface_velocity(): + "Retrieve the surface velocity of the star." + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of" + ) + function.addParameter( + 'surface_velocity', dtype='float64', direction=function.OUT + ) + function.result_type = 'int32' + return function + @legacy_function def get_luminosity_at_zone(): """ Retrieve the luminosity at the specified zone/mesh-cell of the star. """ - function = LegacyFunctionSpecification() - function.can_handle_array = True + function = LegacyFunctionSpecification() + function.can_handle_array = True function.addParameter( 'index_of_the_star', dtype='int32', direction=function.IN, description="The index of the star to get the value of" @@ -4316,113 +4360,951 @@ def get_mass_fraction_of_bid1_at_zone(): return function -class Genec(StellarEvolution, InternalStellarStructure): - - def __init__(self, **options): - InCodeComponentImplementation.__init__( - self, GenecInterface(**options), **options) - # self.stopping_conditions = StoppingConditions(self) - self.model_time = 0.0 | units.yr - - def define_parameters(self, handler): - handler.add_method_parameter( - None, - "set_genec_path", - "path_to_data", - "Path to the data directory", - default_value=self.data_directory + @legacy_function + def set_mass_fraction_of_h_at_zone(): + """ + Set the fractional abundance of h at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_ipoly", - "set_par_ipoly", - "ipoly", - "GENEC parameter ipoly", - ) - handler.add_method_parameter( - "get_par_nwseq", - "set_par_nwseq", - "nwseq", - "GENEC parameter nwseq", + @legacy_function + def set_mass_fraction_of_he3_at_zone(): + """ + Set the fractional abundance of he3 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_modanf", - "set_par_modanf", - "modanf", - "GENEC parameter modanf", - ) - handler.add_method_parameter( - "get_par_nzmod", - "set_par_nzmod", - "nzmod", - "GENEC parameter nzmod", + @legacy_function + def set_mass_fraction_of_he_at_zone(): + """ + Set the fractional abundance of he at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_irot", - "set_par_irot", - "irot", - "GENEC parameter irot", - ) - handler.add_method_parameter( - "get_par_isol", - "set_par_isol", - "isol", - "GENEC parameter isol", + @legacy_function + def set_mass_fraction_of_c12_at_zone(): + """ + Set the fractional abundance of c12 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_imagn", - "set_par_imagn", - "imagn", - "GENEC parameter imagn", - ) - handler.add_method_parameter( - "get_par_ialflu", - "set_par_ialflu", - "ialflu", - "GENEC parameter ialflu", + @legacy_function + def set_mass_fraction_of_c13_at_zone(): + """ + Set the fractional abundance of c13 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_ianiso", - "set_par_ianiso", - "ianiso", - "GENEC parameter ianiso", - ) - handler.add_method_parameter( - "get_par_ipop3", - "set_par_ipop3", - "ipop3", - "GENEC parameter ipop3", + @legacy_function + def set_mass_fraction_of_n14_at_zone(): + """ + Set the fractional abundance of n14 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_ibasnet", - "set_par_ibasnet", - "ibasnet", - "GENEC parameter ibasnet", - ) - handler.add_method_parameter( - "get_par_phase", - "set_par_phase", - "phase", - "GENEC parameter phase", + @legacy_function + def set_mass_fraction_of_n15_at_zone(): + """ + Set the fractional abundance of n15 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_iopac", - "set_par_iopac", - "iopac", - "GENEC parameter iopac", - ) + + @legacy_function + def set_mass_fraction_of_o16_at_zone(): + """ + Set the fractional abundance of o16 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_o17_at_zone(): + """ + Set the fractional abundance of o17 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_o18_at_zone(): + """ + Set the fractional abundance of o18 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_ne20_at_zone(): + """ + Set the fractional abundance of ne20 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_ne22_at_zone(): + """ + Set the fractional abundance of ne22 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_mg24_at_zone(): + """ + Set the fractional abundance of mg24 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_mg25_at_zone(): + """ + Set the fractional abundance of mg25 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_mg26_at_zone(): + """ + Set the fractional abundance of mg26 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_c14_at_zone(): + """ + Set the fractional abundance of c14 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_f18_at_zone(): + """ + Set the fractional abundance of f18 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_f19_at_zone(): + """ + Set the fractional abundance of f19 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_ne21_at_zone(): + """ + Set the fractional abundance of ne21 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_na23_at_zone(): + """ + Set the fractional abundance of na23 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_al26_at_zone(): + """ + Set the fractional abundance of al26 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_al27_at_zone(): + """ + Set the fractional abundance of al27 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_si28_at_zone(): + """ + Set the fractional abundance of si28 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_neut_at_zone(): + """ + Set the fractional abundance of neut at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_prot_at_zone(): + """ + Set the fractional abundance of prot at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_bid_at_zone(): + """ + Set the fractional abundance of bid at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + @legacy_function + def set_mass_fraction_of_bid1_at_zone(): + """ + Set the fractional abundance of bid1 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + + + +class Genec(StellarEvolution, InternalStellarStructure): + + def __init__(self, **options): + InCodeComponentImplementation.__init__( + self, GenecInterface(**options), **options) + # self.stopping_conditions = StoppingConditions(self) + self.model_time = 0.0 | units.yr + + def define_parameters(self, handler): + handler.add_method_parameter( + None, + "set_genec_path", + "path_to_data", + "Path to the data directory", + default_value=self.data_directory + ) + + handler.add_method_parameter( + "get_par_ipoly", + "set_par_ipoly", + "ipoly", + "GENEC parameter ipoly", + ) + + handler.add_method_parameter( + "get_par_nwseq", + "set_par_nwseq", + "nwseq", + "GENEC parameter nwseq", + ) + + handler.add_method_parameter( + "get_par_modanf", + "set_par_modanf", + "modanf", + "GENEC parameter modanf", + ) + + handler.add_method_parameter( + "get_par_nzmod", + "set_par_nzmod", + "nzmod", + "GENEC parameter nzmod", + ) + + handler.add_method_parameter( + "get_par_irot", + "set_par_irot", + "irot", + "GENEC parameter irot", + ) + + handler.add_method_parameter( + "get_par_isol", + "set_par_isol", + "isol", + "GENEC parameter isol", + ) + + handler.add_method_parameter( + "get_par_imagn", + "set_par_imagn", + "imagn", + "GENEC parameter imagn", + ) + + handler.add_method_parameter( + "get_par_ialflu", + "set_par_ialflu", + "ialflu", + "GENEC parameter ialflu", + ) + + handler.add_method_parameter( + "get_par_ianiso", + "set_par_ianiso", + "ianiso", + "GENEC parameter ianiso", + ) + + handler.add_method_parameter( + "get_par_ipop3", + "set_par_ipop3", + "ipop3", + "GENEC parameter ipop3", + ) + + handler.add_method_parameter( + "get_par_ibasnet", + "set_par_ibasnet", + "ibasnet", + "GENEC parameter ibasnet", + ) + + handler.add_method_parameter( + "get_par_phase", + "set_par_phase", + "phase", + "GENEC parameter phase", + ) + + handler.add_method_parameter( + "get_par_iopac", + "set_par_iopac", + "iopac", + "GENEC parameter iopac", + ) handler.add_method_parameter( "get_par_ikappa", @@ -4963,13 +5845,13 @@ def define_parameters(self, handler): "GENEC parameter starname", ) - handler.add_method_parameter( - "get_min_timestep_stop_condition", - "set_min_timestep_stop_condition", - "min_timestep_stop_condition", - "The minimum timestep stop condition", - default_value=1e-4 | units.julianyr - ) + # handler.add_method_parameter( + # "get_min_timestep_stop_condition", + # "set_min_timestep_stop_condition", + # "min_timestep_stop_condition", + # "The minimum timestep stop condition", + # default_value=1e-4 | units.julianyr + # ) def define_particle_sets(self, handler): @@ -4990,18 +5872,25 @@ def define_particle_sets(self, handler): handler.add_getter( set_name, 'get_number_of_zones', names=('n_zones',) ) + handler.add_setter( + set_name, 'set_number_of_zones', names=('n_zones',) + ) handler.add_getter( set_name, 'get_number_of_species', names=('n_species',) ) # handler.add_method(set_name, 'get_number_of_zones') handler.add_method(set_name, 'get_number_of_zones') + handler.add_method(set_name, 'set_number_of_zones') # handler.add_method(set_name, 'get_radius_profile') # handler.add_method(set_name, 'get_temperature_profile') handler.add_method(set_name, 'get_luminosity_profile') handler.add_method(set_name, 'get_mass_profile') handler.add_method(set_name, 'get_cumulative_mass_profile') + handler.add_getter( + set_name, 'get_surface_velocity', names=('surface_velocity',) + ) handler.add_method(set_name, 'evolve_one_step') handler.add_method(set_name, 'evolve_for') @@ -5017,236 +5906,70 @@ def define_particle_sets(self, handler): 'set_radius_at_zone', 'get_firstlast_zone', names=('radius_profile',) ) + handler.add_gridded_getter( set_name, 'get_temperature_at_zone', 'get_firstlast_zone', names=('temperature_profile',) ) - handler.add_gridded_getter( - set_name, - 'get_density_at_zone', 'get_firstlast_zone', - names=('density_profile',) - ) - handler.add_gridded_getter( - set_name, - 'get_luminosity_at_zone', 'get_firstlast_zone', - names=('luminosity_profile',) - ) - handler.add_gridded_getter( - set_name, - 'get_pressure_at_zone', 'get_firstlast_zone', - names=('pressure_profile',) - ) - - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_h_at_zone', - 'get_firstlast_zone', - names=('abundance_h',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_he3_at_zone', - 'get_firstlast_zone', - names=('abundance_he3',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_he_at_zone', - 'get_firstlast_zone', - names=('abundance_he',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_c12_at_zone', - 'get_firstlast_zone', - names=('abundance_c12',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_c13_at_zone', - 'get_firstlast_zone', - names=('abundance_c13',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_n14_at_zone', - 'get_firstlast_zone', - names=('abundance_n14',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_n15_at_zone', - 'get_firstlast_zone', - names=('abundance_n15',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_o16_at_zone', - 'get_firstlast_zone', - names=('abundance_o16',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_o17_at_zone', - 'get_firstlast_zone', - names=('abundance_o17',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_o18_at_zone', - 'get_firstlast_zone', - names=('abundance_o18',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_ne20_at_zone', - 'get_firstlast_zone', - names=('abundance_ne20',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_ne22_at_zone', - 'get_firstlast_zone', - names=('abundance_ne22',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_mg24_at_zone', - 'get_firstlast_zone', - names=('abundance_mg24',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_mg25_at_zone', - 'get_firstlast_zone', - names=('abundance_mg25',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_mg26_at_zone', - 'get_firstlast_zone', - names=('abundance_mg26',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_c14_at_zone', - 'get_firstlast_zone', - names=('abundance_c14',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_f18_at_zone', - 'get_firstlast_zone', - names=('abundance_f18',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_f19_at_zone', - 'get_firstlast_zone', - names=('abundance_f19',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_ne21_at_zone', - 'get_firstlast_zone', - names=('abundance_ne21',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_na23_at_zone', - 'get_firstlast_zone', - names=('abundance_na23',) - ) - - handler.add_gridded_getter( - set_name, - 'get_mass_fraction_of_al26_at_zone', - 'get_firstlast_zone', - names=('abundance_al26',) - ) - - handler.add_gridded_getter( + handler.add_gridded_setter( set_name, - 'get_mass_fraction_of_al27_at_zone', - 'get_firstlast_zone', - names=('abundance_al27',) + 'set_temperature_at_zone', 'get_firstlast_zone', + names=('temperature_profile',) ) handler.add_gridded_getter( set_name, - 'get_mass_fraction_of_si28_at_zone', - 'get_firstlast_zone', - names=('abundance_si28',) + 'get_density_at_zone', 'get_firstlast_zone', + names=('density_profile',) ) - handler.add_gridded_getter( set_name, - 'get_mass_fraction_of_neut_at_zone', - 'get_firstlast_zone', - names=('abundance_neut',) + 'set_density_at_zone', 'get_firstlast_zone', + names=('density_profile',) ) - handler.add_gridded_getter( set_name, - 'get_mass_fraction_of_prot_at_zone', - 'get_firstlast_zone', - names=('abundance_prot',) + 'get_luminosity_at_zone', 'get_firstlast_zone', + names=('luminosity_profile',) ) - handler.add_gridded_getter( set_name, - 'get_mass_fraction_of_bid_at_zone', - 'get_firstlast_zone', - names=('abundance_bid',) + 'set_luminosity_at_zone', 'get_firstlast_zone', + names=('luminosity_profile',) ) handler.add_gridded_getter( set_name, - 'get_mass_fraction_of_bid1_at_zone', - 'get_firstlast_zone', - names=('abundance_bid1',) + 'get_pressure_at_zone', 'get_firstlast_zone', + names=('pressure_profile',) ) - - # for species in self.SPECIES_NAMES: - # getter = f'get_{species}_at_zone' - # handler.add_gridded_getter( - # particle_set, - # getter, - # 'get_firstlast_zone', - # ) - # for species in species_name: - # handler.add_gridded_getter( - # particle_set, - # 'get_species_at_zone', 'get_firstlast_zone', - # ) - # handler.add_gridded_getter( - # 'particle' - # ) + # handler.add_gridded_setter( + # set_name, + # 'set_pressure_at_zone', 'get_firstlast_zone', + # names=('pressure_profile',) + # ) + + for species in SPECIES_NAMES: + handler.add_gridded_getter( + set_name, + f'get_mass_fraction_of_{species}_at_zone', + 'get_firstlast_zone', + names=(f'abundance_{species}',) + ) + + handler.add_gridded_setter( + set_name, + f'set_mass_fraction_of_{species}_at_zone', + 'get_firstlast_zone', + names=(f'abundance_{species}',) + ) @property def particles(self): - basic_attributes = ["age", "mass", "radius", "temperature", "luminosity",] + basic_attributes = [ + "age", "mass", "radius", "temperature", "luminosity", + ] return ParticlesWithFilteredAttributes( self.fullparticles, basic_attributes, @@ -5269,19 +5992,29 @@ def define_state(self, handler): # -> Run (commit_particles) handler.add_transition('EDIT', 'RUN', 'commit_particles') - handler.add_method('RUN', 'get_chemical_abundance_profiles') - handler.add_method('RUN', 'get_mass_fraction_of_species_at_zone') - handler.add_method('RUN', 'get_mu_at_zone') - handler.add_method('RUN', 'get_number_of_species') - handler.add_method('RUN', 'get_number_of_zones') - handler.add_method('RUN', 'get_pressure_at_zone') - handler.add_method('RUN', 'get_radius') - handler.add_method('RUN', 'get_radius_at_zone') - handler.add_method('RUN', 'get_temperature_at_zone') - handler.add_method('RUN', 'get_density_at_zone') - handler.add_method('RUN', 'get_luminosity_at_zone') - handler.add_method('RUN', 'get_mass_fraction_at_zone') - handler.add_method('RUN', 'get_time_step') + for state in ["RUN", "UPDATE"]: + handler.add_method(state, 'get_chemical_abundance_profiles') + handler.add_method(state, 'get_mass_fraction_of_species_at_zone') + handler.add_method(state, 'get_mu_at_zone') + handler.add_method(state, 'get_number_of_species') + handler.add_method(state, 'get_number_of_zones') + handler.add_method(state, 'get_pressure_at_zone') + handler.add_method(state, 'get_radius') + handler.add_method(state, 'get_radius_at_zone') + handler.add_method(state, 'get_surface_velocity') + handler.add_method(state, 'get_temperature') + handler.add_method(state, 'get_temperature_at_zone') + handler.add_method(state, 'get_density_at_zone') + handler.add_method(state, 'get_luminosity') + handler.add_method(state, 'get_luminosity_at_zone') + handler.add_method(state, 'get_time_step') + handler.add_method(state, 'get_mass') + handler.add_method(state, 'get_age') + handler.add_method(state, 'get_mass_fraction_at_zone') + for species in SPECIES_NAMES: + handler.add_method( + state, f'get_mass_fraction_of_{species}_at_zone' + ) # -> Update handler.add_transition('RUN', 'UPDATE', 'finalize_stellar_model') @@ -5289,6 +6022,7 @@ def define_state(self, handler): handler.add_method('UPDATE', 'set_mass_fraction_of_species_at_zone') handler.add_method('UPDATE', 'set_number_of_zones') # handler.add_method('UPDATE', 'set_radius') + # handler.add_method('UPDATE', 'set_pressure_at_zone') handler.add_method('UPDATE', 'set_radius_at_zone') handler.add_method('UPDATE', 'set_temperature_at_zone') handler.add_method('UPDATE', 'set_density_at_zone') @@ -5296,6 +6030,11 @@ def define_state(self, handler): handler.add_method('UPDATE', 'set_mass_fraction_at_zone') # handler.add_method('UPDATE', 'set_time_step') handler.add_transition('UPDATE', 'RUN', 'recommit_particles') + for state in ["UPDATE"]: + for species in SPECIES_NAMES: + handler.add_method( + state, f'set_mass_fraction_of_{species}_at_zone' + ) # -> Run (recommit_particles) handler.add_method('UPDATE', 'set_starname') @@ -5346,9 +6085,14 @@ def define_methods(self, handler): ) handler.add_method( "set_luminosity_at_zone", - (handler.INDEX, handler.NO_UNIT,units.erg/units.s), + (handler.INDEX, handler.NO_UNIT, units.erg/units.s), (handler.ERROR_CODE,) ) + handler.add_method( + "get_surface_velocity", + (handler.INDEX), + (units.km/units.s, handler.ERROR_CODE,) + ) # def define_parameters(self, handler): def get_luminosity_profile( From 8c3badbb136e7467df840aaf8882ac2809e05f9a Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 30 Mar 2022 13:21:53 +0200 Subject: [PATCH 32/72] Updates to test script (WIP) --- src/amuse/community/genec/plot_models.py | 7 ++ .../genec/test_integrate_default_star.py | 114 +++++++++++++++++- 2 files changed, 116 insertions(+), 5 deletions(-) diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 44efe5bc48..5d6a4359e9 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -1,3 +1,4 @@ +import time import numpy import matplotlib import matplotlib.pyplot as plt @@ -52,6 +53,7 @@ def __init__(self, star): # self.__ax_hr = fig.add_subplot(2, 2, 1) self.update(star) self.plot_all() + plt.pause(0.01) def update(self, star, phase=1): self.star = star @@ -149,6 +151,8 @@ def plot_hr(self): offsets[:, 0] = [numpy.log10(self.star.temperature.value_in(unit_temp))] offsets[:, 1] = [numpy.log10(self.star.luminosity.value_in(unit_lum))] self.__hr_star.set_offsets(offsets) + # fig = self.__figures + # fig.canvas.draw_idle() def initialise_temp_dens(self): title = 'temp_dens' @@ -394,5 +398,8 @@ def plot_all(self, speed=0 | units.Myr / units.minute, step=None): self.draw(speed=speed, step=step) plt.tight_layout() + + for fig in self.__figures.values(): + fig.canvas.flush_events() plt.pause(0.01) # plt.show(block=False) diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index 7df71a6d45..2ce8924975 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -8,6 +8,7 @@ from amuse.support.console import set_printing_strategy import matplotlib.pyplot as plt +import matplotlib.animation as animation from plot_models import StellarModelPlot @@ -68,7 +69,7 @@ def write_backup( # ) return - +ROTATING_STAR = True MASS_UNIT = units.MSun LENGTH_UNIT = units.RSun TIME_UNIT = units.Myr @@ -94,12 +95,113 @@ def write_backup( star = Particle(mass=7.0 | units.MSun, metallicity=0.014) evo = Genec(redirection="none") # evo = Genec() +if ROTATING_STAR: + params = { + 'vwant': 0.4, + 'irot': 1, + 'isol': 1, + 'icoeff': 11, + 'omega': 1e-5, + 'fitm': 0.999, + 'fitmi': 0.999, + 'ifitm': 3, + # PhysicsParams + 'irot': 1, + 'isol': 1, + 'imagn': 0, + 'ialflu': 0, + 'ianiso': 0, + 'ipop3': 0, + 'ibasnet': 0, + 'phase': 1, + 'var_rates': False, + 'bintide': False, + # 'binM2': 0.00E+00, + 'periodini': 0.00E+00, + 'const_per': True, + # CompositionParams + 'zinit': 1.40E-02, + 'zsol': 0.140e-01, + 'z': 0.261956006494962e-02, + 'iopac': 3, + 'ikappa': 5, + # RotationParams + 'idiff': 0, + 'iadvec': 0, + 'istati': 0, + 'icoeff': 11, + 'fenerg': 0.100e+01, + 'richac': 0.100e+01, + 'igamma': 0, + 'frein': 0.000e+00, + 'K_Kawaler': 0.000e+00, + 'Omega_saturation': 0.140e+02, + 'rapcrilim': 0.99000, + 'vwant': 0.400e+00, + 'xfom': 0.100e+01, + 'omega': 1.000000000000000E-05, + 'xdial': 0.000, + 'idialo': 0, + 'idialu': 0, + 'Add_Flux': True, + 'diff_only': False, + 'B_initial': 0.000e+00, + 'add_diff': 0.000e+00, + # SurfaceParams + 'imloss': 6, + 'fmlos': 0.850e+00, + # 'RSG_Mdot': 0, + # 'noSupraEddMdot': False, + # 'Be_mdotfrac': 0.00, + # 'start_mdot': 0.80, + 'ifitm': 3, + 'fitmi': 0.999000000, + 'fitm': 0.999000000, + 'deltal': 0.02000, + 'deltat': 0.02000, + 'nndr': 1, + # ConvectionParams + 'iledou': 0, + 'idifcon': 0, + 'elph': 1.600, + 'my': 0, + 'iover': 1, + 'dovhp': 0.100, + 'iunder': 0, + 'dunder': 0.000, + # ConvergenceParams + 'gkorm': 9.000, + 'alph': 0.300, + 'agdr': 0.10e-04, + 'faktor': 1.00E+00, + 'dgrp': 0.0100, + 'dgrl': 0.0100, + 'dgry': 0.00300, + 'dgrc': 0.01000, + 'dgro': 0.01000, + 'dgr20': 0.100e-01, + 'nbchx': 200, + 'nrband': 1, + # TimeControle + 'islow': 2, + 'xcn': 1.000, + 'icncst': 0, + 'tauH_fit': 1, + } +evo.parameters.vwant = 0.4 +print(evo.parameters.irot) star_in_evo = evo.fullparticles.add_particle(star) - +# for p in params.items(): +# setattr(evo.parameters, p[0], p[1]) +evo.commit_particles() +print(evo.parameters) +# print(star_in_evo) +#exit() font = { 'size': 8, } plt.rc('font', **font) +# iplt.switch_backend('macosx') plt.ion() save_every = 1 @@ -116,7 +218,7 @@ def write_backup( plotting = StellarModelPlot(star_in_evo) -while step < 500: +while True: time_elapsed = (time.time() | units.s) - time_start star = star_in_evo.copy() # number_of_zones = star_in_evo.get_number_of_zones() @@ -170,5 +272,7 @@ def write_backup( star_in_evo.evolve_one_step() step += 1 - -print(f"Running {step} models took {(time.time() | units.s) - time_start}") +runtime = (time.time() | units.s) - time_start +print( + f"Running {step} models took {runtime.value_in(units.minute)} minutes" +) From 51009d07d77016acbe0d1c8d8df193e019303f8d Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 11 Apr 2022 16:39:14 +0200 Subject: [PATCH 33/72] interface updates --- src/amuse/community/genec/Makefile | 1 + src/amuse/community/genec/interface.f90 | 250 +++++++++++------- src/amuse/community/genec/interface.py | 201 +++++++++----- .../genec/test_integrate_default_star.py | 14 +- 4 files changed, 310 insertions(+), 156 deletions(-) diff --git a/src/amuse/community/genec/Makefile b/src/amuse/community/genec/Makefile index d875281a05..8cccc988c8 100644 --- a/src/amuse/community/genec/Makefile +++ b/src/amuse/community/genec/Makefile @@ -23,6 +23,7 @@ MODULES_F90_BASE = $(CODEDIR)/evol.f90 \ $(CODEDIR)/const.f90 \ $(CODEDIR)/caramodele.f90 \ $(CODEDIR)/inputparam.f90 \ + $(CODEDIR)/state.f90 \ $(CODEDIR)/interpolation.f90 \ $(CODEDIR)/nagmod.f90 \ $(CODEDIR)/SmallFunc.f90 \ diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index b1f78ca5b7..c3d123d573 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -22,42 +22,97 @@ function initialize_code() initialize_code = 0 end function -!function read_genec_model() -! ! This should only be called if no star has been initialised yet! -! use genec, only: amuseinterface -! use amuse_helpers, only: starname -! use inputparam, only:CharacteristicsParams,PhysicsParams,CompositionParams,RotationParams,& -! SurfaceParams,ConvectionParams,ConvergenceParams,TimeControle,VariousSettings -! implicit none -! character(*):: inputfilename -! integer:: read_genec_model -! -! amuseinterface = .false. ! This will make initialise_star read the b file -! write(inputfilename, *) starname -! write(inputfilename, *) ".input" -! open(unit=4242, file=inputfilename) -! ! * Parse the CharacteristicsParams namelist * -! read(*,nml=CharacteristicsParams) -! ! * Parse the PhysicsParams namelist * -! read(*,nml=PhysicsParams) -! ! * Parse the CompositionParams namelist * -! read(*,nml=CompositionParams) -! ! * Parse the RotationParams namelist * -! read(*,nml=RotationParams) -! ! * Parse the SurfaceParams namelist * -! read(*,nml=SurfaceParams) -! ! * Parse the ConvectionParams namelist * -! read(*,nml=ConvectionParams) -! ! * Parse the ConvergenceParams namelist * -! read(*,nml=ConvergenceParams) -! ! * Parse the TimeControle namelist * -! read(*,nml=TimeControle) -! ! * Parse the VariousSettings namelist * -! read(*,nml=VariousSettings) -! -! close(4242) -! read_genec_model = 0 -!end function +function read_genec_model(index_of_the_star, cardfilename) + ! This should only be called if no star has been initialised yet! + use genec, only: amuseinterface + use amuse_helpers, only: starname + use inputparam, only:CharacteristicsParams,PhysicsParams,CompositionParams, & + RotationParams,SurfaceParams,ConvectionParams,ConvergenceParams, & + TimeControle,VariousSettings, & + isugi,bintide, & + modanf + use caramodele, only:gms,gls,teff,glsv,teffv,xmini,ab,dm_lost,xLtotbeg,zams_radius + use timestep, only:alter,dzeitj,dzeit,dzeitv + use strucmod, only:m,q,p,t,r,s,drl,drte,dk,drp,drt,drr,rlp,rlt,rlc,rrp,rrt,rrc,rtp, & + rtt,rtc, vp,vt,vr,vs, vna,vnr + use abundmod, only:x,y3,y,xc12,xc13,xc14,xn14,xn15,xo16,xo17,xo18,xf18,xf19,xne20,xne21, & + xne22,xna23,xmg24,xmg25,xmg26,xal26,xal27,xsi28,xprot,xneut,xbid,xbid1,vx, & + vy3,vy,vxc12,vxc13,vxc14,vxn14,vxn15,vxo16,vxo17,vxo18,vxf18,vxf19,vxne20, & + vxne21,vxne22,vxna23,vxmg24,vxmg25,vxmg26,vxal26g,vxal27,vxsi28,vxprot, & + vxneut,vxbid,vxbid1, & + nbelx,abelx,vabelx,mbelx,maxCNO, & + abundCheck + use rotmod, only: CorrOmega,vsuminenv,omegi,vomegi + use evol, only: npondcouche,kindreal + use diffadvmod, only: tdiff + use henyey_solver, only: nsugi + use bintidemod, only: period + use convection, only: r_core + implicit none + integer:: index_of_the_star + character(256):: cardfilename + character(5):: fnamein + character(256):: fname51 + integer:: read_genec_model + integer:: i,ii + real(kindreal):: dlelexprev + + amuseinterface = .false. ! This will make initialise_star read the b file + open(unit=42, file=cardfilename) + ! * Parse the CharacteristicsParams namelist * + read(42,nml=CharacteristicsParams) + ! * Parse the PhysicsParams namelist * + read(42,nml=PhysicsParams) + ! * Parse the CompositionParams namelist * + read(42,nml=CompositionParams) + ! * Parse the RotationParams namelist * + read(42,nml=RotationParams) + ! * Parse the SurfaceParams namelist * + read(42,nml=SurfaceParams) + ! * Parse the ConvectionParams namelist * + read(42,nml=ConvectionParams) + ! * Parse the ConvergenceParams namelist * + read(42,nml=ConvergenceParams) + ! * Parse the TimeControle namelist * + read(42,nml=TimeControle) + ! * Parse the VariousSettings namelist * + read(42,nml=VariousSettings) + + close(42) + amuseinterface = .true. ! this will be false in a savefile, so set it to .true. again! + + write(fnamein, '(i5.5)') modanf + fname51 = trim(starname)//'.b'//fnamein + + open(unit=51, file=fname51, status='unknown',form='unformatted') + read(51)gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,ab,dm_lost,m, & + (q(i),p(i),t(i),r(i),s(i),x(i),y(i),xc12(i), & + vp(i),vt(i),vr(i),vs(i),xo16(i),vx(i),vy(i),vxc12(i),vxo16(i),i=1,m), & + drl,drte,dk,drp,drt,drr,rlp,rlt,rlc,rrp,rrt,rrc,rtp, & + rtt,rtc,tdiff,vsuminenv,(CorrOmega(i),i=1,npondcouche), & + xLtotbeg,dlelexprev,zams_radius + + read(51) (y3(i),xc13(i),xn14(i),xn15(i),xo17(i),xo18(i),vy3(i),vxc13(i),vxn14(i),vxn15(i),vxo17(i),vxo18(i),xne20(i), & + xne22(i),xmg24(i),xmg25(i),xmg26(i),vxne20(i),vxne22(i),vxmg24(i),vxmg25(i),vxmg26(i),omegi(i),vomegi(i),i=1,m) + read(51) (xf19(i),xne21(i),xna23(i),xal26(i),xal27(i),xsi28(i),vxf19(i),vxne21(i),vxna23(i),vxal26g(i),vxal27(i),vxsi28(i), & + xneut(i),xprot(i),xc14(i),xf18(i),xbid(i),xbid1(i),vxneut(i),vxprot(i),vxc14(i),vxf18(i),vxbid(i),vxbid1(i),i=1,m) + + do ii=1,nbelx + read(51) (abelx(ii,i),vabelx(ii,i),i=1,m) + enddo + + if (isugi >= 1) then + read(51) nsugi + endif + + if (bintide) then + read(51) period,r_core,vna,vnr + endif + close(51) + + index_of_the_star = 1 + read_genec_model = 0 +end function function cleanup_code() implicit none @@ -903,58 +958,40 @@ function set_par_diff_only(par_diff_only) set_par_diff_only = 0 end function -function get_par_lowRSGMdot(par_lowRSGMdot) - use inputparam, only: lowRSGMdot - implicit none - logical:: par_lowRSGMdot - integer:: get_par_lowRSGMdot - par_lowRSGMdot = lowRSGMdot - get_par_lowRSGMdot = 0 -end function - -function set_par_lowRSGMdot(par_lowRSGMdot) - use inputparam, only: lowRSGMdot +function get_par_RSG_Mdot(par_RSG_Mdot) + use inputparam, only: RSG_Mdot implicit none - logical:: par_lowRSGMdot - integer:: set_par_lowRSGMdot - lowRSGMdot = par_lowRSGMdot - set_par_lowRSGMdot = 0 + integer:: par_RSG_Mdot + integer:: get_par_RSG_Mdot + par_RSG_Mdot = RSG_Mdot + get_par_RSG_Mdot = 0 end function -function get_par_plot(par_plot) - use inputparam, only: plot +function set_par_RSG_Mdot(par_RSG_Mdot) + use inputparam, only: RSG_Mdot implicit none - logical:: par_plot - integer:: get_par_plot - par_plot = plot - get_par_plot = 0 + integer:: par_RSG_Mdot + integer:: set_par_RSG_Mdot + RSG_Mdot = par_RSG_Mdot + set_par_RSG_Mdot = 0 end function -function set_par_plot(par_plot) - use inputparam, only: plot +function get_par_display_plot(par_display_plot) + use inputparam, only: display_plot implicit none - logical:: par_plot - integer:: set_par_plot - plot = par_plot - set_par_plot = 0 + logical:: par_display_plot + integer:: get_par_display_plot + par_display_plot = display_plot + get_par_display_plot = 0 end function -function get_par_refresh(par_refresh) - use inputparam, only: refresh +function set_par_display_plot(par_display_plot) + use inputparam, only: display_plot implicit none - logical:: par_refresh - integer:: get_par_refresh - par_refresh = refresh - get_par_refresh = 0 -end function - -function set_par_refresh(par_refresh) - use inputparam, only: refresh - implicit none - logical:: par_refresh - integer:: set_par_refresh - refresh = par_refresh - set_par_refresh = 0 + logical:: par_display_plot + integer:: set_par_display_plot + display_plot = par_display_plot + set_par_display_plot = 0 end function function get_par_xyfiles(par_xyfiles) @@ -1712,11 +1749,31 @@ function set_par_starname(par_starname) starname = par_starname set_par_starname = 0 end function + +function get_par_stopping_condition(par_stopping_condition) + use State, only: stopping_condition + implicit none + character(15):: par_stopping_condition + integer:: get_par_stopping_condition + par_stopping_condition = stopping_condition + get_par_stopping_condition = 0 +end function + +function set_par_stopping_condition(par_stopping_condition) + use State, only: stopping_condition + implicit none + character(15):: par_stopping_condition + integer:: set_par_stopping_condition + stopping_condition = par_stopping_condition + set_par_stopping_condition = 0 +end function ! **** End Parameters function commit_parameters() + use State, only: stopping_condition implicit none integer:: commit_parameters + stopping_condition = "" commit_parameters = 0 end function @@ -1732,7 +1789,7 @@ function commit_particles() call OpenAll() !write(*,*) 'OpenAll done' call initialise_star() - nzmod = 1 + ! nzmod = 10 !write(*,*) 'initialise_star done' amuseinterface = .true. ! If we just read a b file, disable this again for continuing commit_particles = 0 @@ -1750,17 +1807,24 @@ function evolve_model(end_time) use WriteSaveClose, only: OpenAll use genec, only: evolve, modell, finalise use amuse_helpers, only: initialise_star + use State, only: stopping_condition implicit none double precision:: end_time integer:: evolve_model + stopping_condition = "" do while (alter < end_time) + if (stopping_condition == "") then write(*,*) "Current time: ", alter, ", evolving to: ", end_time !modell = 1 call evolve() call finalise() call OpenAll() call initialise_star() - write(*,*) "*****Modell: ", modell + !write(*,*) "*****Modell: ", modell + else + write(*,*) "stopped: ", stopping_condition + exit + endif end do evolve_model = 0 end function @@ -1788,7 +1852,7 @@ function evolve_for(index_of_the_star, time) call finalise() call OpenAll() call initialise_star() - write(*,*) "*****Modell: ", modell + !write(*,*) "*****Modell: ", modell end do evolve_for = 0 @@ -1799,22 +1863,28 @@ function evolve_one_step(index_of_the_star) use WriteSaveClose, only: OpenAll use genec, only: evolve, modell, finalise use amuse_helpers, only: initialise_star + use State, only: stopping_condition use inputparam,only: modanf,nwseq,nzmod implicit none integer:: index_of_the_star integer:: evolve_one_step integer:: original_nzmod - original_nzmod = nzmod - nzmod = 1 + !original_nzmod = nzmod + nzmod = 1000000 write(*,*) "Evolving one step, current time: ", alter !modell = 1 - call evolve() - call finalise() - call OpenAll() - call initialise_star() ! will set modell to 1 - write(*,*) "Evolved one step, current time: ", alter - nzmod = original_nzmod - write(*,*) "*****modanf, nwseq, nzmod: ", modanf, nwseq, nzmod + if (stopping_condition == "") then + call evolve() + if (stopping_condition /= "") return + call finalise() + call OpenAll() + call initialise_star() ! will set modell to 1 + write(*,*) "Evolved one step, current time: ", alter + !nzmod = original_nzmod + !write(*,*) "*****modanf, nwseq, nzmod: ", modanf, nwseq, nzmod + else + write(*,*) "stopped: ", stopping_condition + endif evolve_one_step = 0 end function diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 901ea4f893..eaa0ce8332 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -98,6 +98,23 @@ def set_genec_path(): """ return function + @legacy_function + def read_genec_model(): + """ + Read a previously saved GENEC model + """ + function = LegacyFunctionSpecification() + function.can_handle_array = False + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.OUT, + description="index of the star", + ) + function.addParameter( + 'cardfilename', dtype='string', direction=function.IN, + description="GENEC input card", + ) + function.result_type = 'int32' + return function # Parameters @legacy_function @@ -1721,11 +1738,11 @@ def set_par_diff_only(): return function @legacy_function - def get_par_lowRSGMdot(): - 'get parameter lowRSGMdot' + def get_par_RSG_Mdot(): + 'get parameter RSG_Mdot' function = LegacyFunctionSpecification() function.addParameter( - 'lowRSGMdot', dtype='bool', + 'RSG_Mdot', dtype='int32', direction=function.OUT, ) function.result_type = 'int32' @@ -1738,11 +1755,11 @@ def get_par_lowRSGMdot(): return function @legacy_function - def set_par_lowRSGMdot(): - 'set parameter lowRSGMdot' + def set_par_RSG_Mdot(): + 'set parameter RSG_Mdot' function = LegacyFunctionSpecification() function.addParameter( - 'lowRSGMdot', dtype='bool', + 'RSG_Mdot', dtype='int32', direction=function.IN, ) function.result_type = 'int32' @@ -1757,11 +1774,11 @@ def set_par_lowRSGMdot(): return function @legacy_function - def get_par_plot(): - 'get parameter plot' + def get_par_display_plot(): + 'get parameter display_plot' function = LegacyFunctionSpecification() function.addParameter( - 'plot', dtype='bool', + 'display_plot', dtype='bool', direction=function.OUT, ) function.result_type = 'int32' @@ -1774,47 +1791,11 @@ def get_par_plot(): return function @legacy_function - def set_par_plot(): - 'set parameter plot' + def set_par_display_plot(): + 'set parameter display_plot' function = LegacyFunctionSpecification() function.addParameter( - 'plot', dtype='bool', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function - - @legacy_function - def get_par_refresh(): - 'get parameter refresh' - function = LegacyFunctionSpecification() - function.addParameter( - 'refresh', dtype='bool', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function - - @legacy_function - def set_par_refresh(): - 'set parameter refresh' - function = LegacyFunctionSpecification() - function.addParameter( - 'refresh', dtype='bool', + 'display_plot', dtype='bool', direction=function.IN, ) function.result_type = 'int32' @@ -3339,8 +3320,67 @@ def set_par_starname(): ''' return function + @legacy_function + def get_par_stopping_condition(): + 'get parameter stopping_condition' + function = LegacyFunctionSpecification() + function.addParameter( + 'stopping_condition', dtype='string', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_stopping_condition(): + 'set parameter stopping_condition' + function = LegacyFunctionSpecification() + function.addParameter( + 'stopping_condition', dtype='string', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + # End parameters + @legacy_function + def set_number_of_zones(): + """ + Set the current number of zones/mesh-cells of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'n_zones', dtype='int32', direction=function.IN, + description="The current number of zones/mesh-cells of the star." + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function + @legacy_function def commit_parameters(): function = LegacyFunctionSpecification() @@ -3522,6 +3562,35 @@ def get_mass_fraction_at_zone(): """ return function + @legacy_function + def get_omegi_at_zone(): + """ + Retrieve the rotation rate at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'omegi_i', dtype='float64', direction=function.OUT, + description=( + "The rotation rate at the specified " + "zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + """ + return function @legacy_function def get_mass_fraction_of_h_at_zone(): @@ -5531,24 +5600,17 @@ def define_parameters(self, handler): ) handler.add_method_parameter( - "get_par_lowRSGMdot", - "set_par_lowRSGMdot", - "lowRSGMdot", - "GENEC parameter lowRSGMdot", + "get_par_RSG_Mdot", + "set_par_RSG_Mdot", + "RSG_Mdot", + "GENEC parameter RSG_Mdot", ) handler.add_method_parameter( - "get_par_plot", - "set_par_plot", - "plot", - "GENEC parameter plot", - ) - - handler.add_method_parameter( - "get_par_refresh", - "set_par_refresh", - "refresh", - "GENEC parameter refresh", + "get_par_display_plot", + "set_par_display_plot", + "display_plot", + "GENEC parameter display_plot", ) handler.add_method_parameter( @@ -5845,6 +5907,13 @@ def define_parameters(self, handler): "GENEC parameter starname", ) + handler.add_method_parameter( + "get_par_stopping_condition", + "set_par_stopping_condition", + "stopping_condition", + "GENEC parameter stopping_condition", + ) + # handler.add_method_parameter( # "get_min_timestep_stop_condition", # "set_min_timestep_stop_condition", @@ -6048,7 +6117,11 @@ def define_methods(self, handler): (units.MSun, handler.NO_UNIT, handler.NO_UNIT), (handler.INDEX, handler.ERROR_CODE) ) - # handler.add_method( + handler.add_method( + "read_genec_model", + (handler.NO_UNIT), + (handler.INDEX, handler.ERROR_CODE) + ) # handler.add_method( # "get_radius", # (handler.INDEX,), # (units.RSun, handler.ERROR_CODE,) diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index 2ce8924975..76cf9fbc1b 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -72,6 +72,7 @@ def write_backup( ROTATING_STAR = True MASS_UNIT = units.MSun LENGTH_UNIT = units.RSun +SPEED_UNIT = units.kms TIME_UNIT = units.Myr MASSLOSS_UNIT = units.MSun / units.yr TEMPERATURE_UNIT = units.K @@ -80,8 +81,8 @@ def write_backup( set_printing_strategy( "custom", preferred_units=[ - MASS_UNIT, LENGTH_UNIT, TIME_UNIT, MASSLOSS_UNIT, TEMPERATURE_UNIT, - LUMINOSITY_UNIT, SPEEDUP_UNIT + MASS_UNIT, LENGTH_UNIT, TIME_UNIT, SPEED_UNIT, MASSLOSS_UNIT, + TEMPERATURE_UNIT, LUMINOSITY_UNIT, SPEEDUP_UNIT ], precision=4, prefix="", @@ -241,6 +242,9 @@ def write_backup( star.temperature.in_(units.K), star.luminosity.in_(units.LSun), evo.parameters.phase, + star.surface_velocity, + star.abundance_h[0], + evo.parameters.vwant, ) if step % store_every == 0: plotting.update(star_in_evo, phase=evo.parameters.phase) @@ -270,6 +274,12 @@ def write_backup( ) star_in_evo.evolve_one_step() + if evo.parameters.stopping_condition != "none": + # star_in_evo.age == age_previous: + if step > 1: + print("Stopping - not evolving!") + print(f"Condition: {evo.parameters.stopping_condition}") + break step += 1 runtime = (time.time() | units.s) - time_start From e6e746418b66729fcd7e54b0c52f4fea2fae9438 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Thu, 12 May 2022 13:10:18 +0200 Subject: [PATCH 34/72] updates --- src/amuse/community/genec/Makefile | 1 + .../genec/test_integrate_default_star.py | 71 ++++++++++++++----- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/src/amuse/community/genec/Makefile b/src/amuse/community/genec/Makefile index 8cccc988c8..652c9e3721 100644 --- a/src/amuse/community/genec/Makefile +++ b/src/amuse/community/genec/Makefile @@ -11,6 +11,7 @@ FC = $(MPIFC) LDFLAGS += -lm $(MUSE_LD_FLAGS) # FCFLAGS += -std=f95 +# FCFLAGS += -O0 OBJS = interface.o diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index 76cf9fbc1b..34636265da 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -11,6 +11,40 @@ import matplotlib.animation as animation from plot_models import StellarModelPlot +from amuse.community.genec.interface import SPECIES_NAMES + +class NeedToSave: + def __init__(self): + self.model = 0 + self.current = { + 'luminosity': 0 | units.LSun, + 'temperature': 0 | units.K, + 'central_temperature': 0 | units.K, + 'central_density': 0 | units.g * units.cm**-3, + 'surface_velocity': 0 | units.kms, + 'mass': 0 | units.MSun, + 'time_step': 0 | units.s, + } + for species in SPECIES_NAMES.keys(): + self.current[species] = [] + self.previous = self.current.copy() + self.derivs = {} + for key in self.current.keys(): + self.derivs[key] = 1 + return + + def get_values(self): + return self.current + + @property + def save_next(self): + return True + + def update(self, star): + self.previous = self.current.copy() + for key in self.current.keys(): + self.current[key] = getattr(star, key) + def read_saved_star_timeline(star_key): star = read_set_from_file(f'star-{star_key}.amuse')[0] @@ -98,14 +132,6 @@ def write_backup( # evo = Genec() if ROTATING_STAR: params = { - 'vwant': 0.4, - 'irot': 1, - 'isol': 1, - 'icoeff': 11, - 'omega': 1e-5, - 'fitm': 0.999, - 'fitmi': 0.999, - 'ifitm': 3, # PhysicsParams 'irot': 1, 'isol': 1, @@ -189,15 +215,16 @@ def write_backup( 'icncst': 0, 'tauH_fit': 1, } -evo.parameters.vwant = 0.4 -print(evo.parameters.irot) +# evo.parameters.vwant = 0.4 +evo.parameters.ipoly = 0 +# evo.parameters.idebug = 1 star_in_evo = evo.fullparticles.add_particle(star) + # for p in params.items(): # setattr(evo.parameters, p[0], p[1]) evo.commit_particles() -print(evo.parameters) # print(star_in_evo) -#exit() +# exit() font = { 'size': 8, } @@ -205,10 +232,10 @@ def write_backup( # iplt.switch_backend('macosx') plt.ion() -save_every = 1 -store_every = 1 +save_every = 10 +store_every = 10 plot_time = 5 | units.s -plot_models = 100 +plot_models = 200 step = 0 model_of_last_save = 0 @@ -217,9 +244,12 @@ def write_backup( time_of_last_plot = 0 | units.s age_of_last_plot = star_in_evo.age -plotting = StellarModelPlot(star_in_evo) +#plotting = StellarModelPlot(star_in_evo) + +evo.parameters.nzmod = 100 -while True: +print("age mass radius temp lum phase vequat h0 vwant") +while step < 2: time_elapsed = (time.time() | units.s) - time_start star = star_in_evo.copy() # number_of_zones = star_in_evo.get_number_of_zones() @@ -247,7 +277,8 @@ def write_backup( evo.parameters.vwant, ) if step % store_every == 0: - plotting.update(star_in_evo, phase=evo.parameters.phase) + pass + #plotting.update(star_in_evo, phase=evo.parameters.phase) if ( (time_elapsed - time_of_last_plot) > plot_time or step - model_of_last_plot > plot_models @@ -256,7 +287,7 @@ def write_backup( (star.age - age_of_last_plot).value_in(units.Myr) / (time_elapsed - time_of_last_plot).value_in(units.minute) ) | units.Myr / units.minute - plotting.plot_all(speed=speed, step=step) + #plotting.plot_all(speed=speed, step=step) model_of_last_plot = step time_of_last_plot = time_elapsed age_of_last_plot = star.age @@ -273,7 +304,9 @@ def write_backup( chemical_abundance_profile, ) + age_previous = star_in_evo.age star_in_evo.evolve_one_step() + print(f"Condition: {evo.parameters.stopping_condition}") if evo.parameters.stopping_condition != "none": # star_in_evo.age == age_previous: if step > 1: From 23a42f3884557f2979b6cf8b7e53a6215b294c6f Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 31 Oct 2022 15:03:05 +0100 Subject: [PATCH 35/72] small update to Makefile --- src/amuse/community/genec/Makefile | 86 ++++++++++++++++-------------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/src/amuse/community/genec/Makefile b/src/amuse/community/genec/Makefile index 652c9e3721..e66d6d8ba5 100644 --- a/src/amuse/community/genec/Makefile +++ b/src/amuse/community/genec/Makefile @@ -6,7 +6,7 @@ endif -include $(AMUSE_DIR)/config.mk MPIFC ?= mpif90 -FC = $(MPIFC) +FC = $(MPIFC) LDFLAGS += -lm $(MUSE_LD_FLAGS) @@ -20,52 +20,56 @@ INI_CODEDIR = src/GENEC/tools/makeini CODELIB = src/libgenec.a -MODULES_F90_BASE = $(CODEDIR)/evol.f90 \ - $(CODEDIR)/const.f90 \ - $(CODEDIR)/caramodele.f90 \ - $(CODEDIR)/inputparam.f90 \ - $(CODEDIR)/state.f90 \ - $(CODEDIR)/interpolation.f90 \ - $(CODEDIR)/nagmod.f90 \ - $(CODEDIR)/SmallFunc.f90 \ - $(CODEDIR)/abundmod.f90 \ - $(CODEDIR)/diffadvmod.f90 \ - $(CODEDIR)/equadiffmod.f90 \ - $(CODEDIR)/geomod.f90 \ - $(CODEDIR)/magmod.f90 \ - $(CODEDIR)/rotmod.f90 \ - $(CODEDIR)/strucmod.f90 \ - $(CODEDIR)/ionisation.f90 \ - $(CODEDIR)/convection.f90 \ - $(CODEDIR)/timestep.f90 \ - $(CODEDIR)/PrintAll.f90 \ - $(CODEDIR)/omegamod.f90 \ - $(CODEDIR)/EOS.f90 \ - $(CODEDIR)/nablas.f90 \ - $(CODEDIR)/energy.f90 \ - $(CODEDIR)/opacity.f90 \ - $(CODEDIR)/envelope.f90 \ - $(CODEDIR)/LayersShift.f90 \ - $(CODEDIR)/advection.f90 \ - $(CODEDIR)/diffusion.f90 \ - $(CODEDIR)/chemicals.f90 \ - $(CODEDIR)/bintidemod.f90 \ - $(CODEDIR)/winds.f90 \ - $(INI_CODEDIR)/inichemmod.f90 \ - $(INI_CODEDIR)/interpolmod.f90 \ - $(INI_CODEDIR)/modinimod.f90 - -MODULES_F90 = $(MODULES_F90_BASE) \ +MODULES_F90_BASE = \ + $(CODEDIR)/io_definitions.f90 \ + $(CODEDIR)/evol.f90 \ + $(CODEDIR)/const.f90 \ + $(CODEDIR)/caramodele.f90 \ + $(CODEDIR)/inputparam.f90 \ + $(CODEDIR)/state.f90 \ + $(CODEDIR)/interpolation.f90 \ + $(CODEDIR)/nagmod.f90 \ + $(CODEDIR)/SmallFunc.f90 \ + $(CODEDIR)/abundmod.f90 \ + $(CODEDIR)/diffadvmod.f90 \ + $(CODEDIR)/equadiffmod.f90 \ + $(CODEDIR)/geomod.f90 \ + $(CODEDIR)/magmod.f90 \ + $(CODEDIR)/rotmod.f90 \ + $(CODEDIR)/strucmod.f90 \ + $(CODEDIR)/ionisation.f90 \ + $(CODEDIR)/convection.f90 \ + $(CODEDIR)/timestep.f90 \ + $(CODEDIR)/PrintAll.f90 \ + $(CODEDIR)/omegamod.f90 \ + $(CODEDIR)/EOS.f90 \ + $(CODEDIR)/nablas.f90 \ + $(CODEDIR)/energy.f90 \ + $(CODEDIR)/opacity.f90 \ + $(CODEDIR)/envelope.f90 \ + $(CODEDIR)/LayersShift.f90 \ + $(CODEDIR)/advection.f90 \ + $(CODEDIR)/diffusion.f90 \ + $(CODEDIR)/chemicals.f90 \ + $(CODEDIR)/bintidemod.f90 \ + $(CODEDIR)/winds.f90 \ + $(INI_CODEDIR)/inichemmod.f90 \ + $(INI_CODEDIR)/interpolmod.f90 \ + $(INI_CODEDIR)/modinimod.f90 + +MODULES_F90 = \ + $(MODULES_F90_BASE) \ $(CODEDIR)/PGPlotModule_Null.f90 \ $(CODEDIR)/henyey_solver.f90 \ $(CODEDIR)/WriteSaveClose.f90 \ - $(CODEDIR)/genec.f90 + $(CODEDIR)/genec.f90 # SOURCES_F90 = $(CODEDIR)/main.f90 -MODULES_F90_ALL = $(MODULES_F90) \ - $(MODULES_F90_MAKEINI) \ - $(CODEDIR)/amuse.f90 +MODULES_F90_ALL = \ + $(MODULES_F90) \ + $(MODULES_F90_MAKEINI) \ + $(CODEDIR)/amuse.f90 MODULES=$(MODULES_F90_ALL:%.f90=%.o) # SOURCES=$(SOURCES_F90:%.f90=%.o) From 30f57cf56dda67c04315742a5cff83a644521bb1 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 31 Oct 2022 15:03:50 +0100 Subject: [PATCH 36/72] interface updates --- src/amuse/community/genec/interface.f90 | 47 ++++++++++++++++--------- src/amuse/community/genec/interface.py | 43 ++++++++++++++++++++++ 2 files changed, 73 insertions(+), 17 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index c3d123d573..36349f6e35 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1,6 +1,6 @@ function initialize_code() - use WriteSaveClose, only: quitafterclosing - use inputparam, only: amuseinterface, writetofiles, readfromfiles + !use WriteSaveClose, only: quitafterclosing + use inputparam, only: amuseinterface use genec, only: initialise_genec use amuse_helpers, only: set_defaults use amuse_helpers, only: mstar, zini, starname @@ -9,15 +9,13 @@ function initialize_code() integer:: initialize_code amuseinterface = .true. - writetofiles = .false. - readfromfiles = .false. input_dir = "./src/GENEC/code" call initialise_genec() call set_defaults() starname = "AmuseDefaultStar" mstar = 7.0 zini = 0.014 - quitafterclosing = .false. + !quitafterclosing = .false. initialize_code = 0 end function @@ -130,6 +128,24 @@ function get_min_timestep_stop_condition(min_timestep_stop_condition) get_min_timestep_stop_condition = 0 end function +function get_par_n_snap(n_snap_out) + use inputparam, only: n_snap + implicit none + integer:: n_snap_out + integer:: get_par_n_snap + n_snap_out = n_snap + get_par_n_snap = 0 +end function + +function set_par_n_snap(n_snap_in) + use inputparam, only: n_snap + implicit none + integer:: n_snap_in + integer:: set_par_n_snap + n_snap = n_snap_in + set_par_n_snap= 0 +end function + function get_par_ipoly(par_ipoly) use inputparam, only: ipoly implicit none @@ -1817,9 +1833,9 @@ function evolve_model(end_time) write(*,*) "Current time: ", alter, ", evolving to: ", end_time !modell = 1 call evolve() - call finalise() - call OpenAll() - call initialise_star() + !call finalise() + !call OpenAll() + !call initialise_star() !write(*,*) "*****Modell: ", modell else write(*,*) "stopped: ", stopping_condition @@ -1849,9 +1865,9 @@ function evolve_for(index_of_the_star, time) write(*,*) "Current time: ", alter, ", evolving to: ", end_time !modell = 1 call evolve() - call finalise() - call OpenAll() - call initialise_star() + !call finalise() + !call OpenAll() + !call initialise_star() !write(*,*) "*****Modell: ", modell end do @@ -1876,9 +1892,9 @@ function evolve_one_step(index_of_the_star) if (stopping_condition == "") then call evolve() if (stopping_condition /= "") return - call finalise() - call OpenAll() - call initialise_star() ! will set modell to 1 + !call finalise() + !call OpenAll() + !call initialise_star() ! will set modell to 1 write(*,*) "Evolved one step, current time: ", alter !nzmod = original_nzmod !write(*,*) "*****modanf, nwseq, nzmod: ", modanf, nwseq, nzmod @@ -1899,16 +1915,13 @@ function write_genec_model() use WriteSaveClose, only: OpenAll use genec, only: finalise use amuse_helpers, only: initialise_star - use inputparam, only: writetofiles implicit none integer:: write_genec_model call finalise() ! modanf = 0 - writetofiles = .true. call OpenAll() call initialise_star() !call finalise() - writetofiles = .false. !call OpenAll() !call initialise_star() write_genec_model = 0 diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index eaa0ce8332..3dc7fa9068 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -117,6 +117,42 @@ def read_genec_model(): return function # Parameters + @legacy_function + def get_par_n_snap(): + 'get parameter n_snap' + function = LegacyFunctionSpecification() + function.addParameter( + 'n_snap', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_par_n_snap(): + 'set parameter n_snap' + function = LegacyFunctionSpecification() + function.addParameter( + 'n_snap', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + @legacy_function def get_par_ipoly(): 'get parameter ipoly' @@ -5914,6 +5950,13 @@ def define_parameters(self, handler): "GENEC parameter stopping_condition", ) + handler.add_method_parameter( + "get_par_n_snap", + "set_par_n_snap", + "n_snap", + "GENEC snapshot writing", + ) + # handler.add_method_parameter( # "get_min_timestep_stop_condition", # "set_min_timestep_stop_condition", From 9906e600f33cee5a5b483840bf77cb1f95799ff5 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 31 Oct 2022 15:04:22 +0100 Subject: [PATCH 37/72] update test script --- .../genec/test_integrate_default_star.py | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index 34636265da..5a07fb9beb 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -215,7 +215,7 @@ def write_backup( 'icncst': 0, 'tauH_fit': 1, } -# evo.parameters.vwant = 0.4 +evo.parameters.vwant = 0.4 evo.parameters.ipoly = 0 # evo.parameters.idebug = 1 star_in_evo = evo.fullparticles.add_particle(star) @@ -244,12 +244,13 @@ def write_backup( time_of_last_plot = 0 | units.s age_of_last_plot = star_in_evo.age -#plotting = StellarModelPlot(star_in_evo) +plotting = StellarModelPlot(star_in_evo) -evo.parameters.nzmod = 100 +# evo.parameters.nzmod = 100 +evo.parameters.n_snap = 0 print("age mass radius temp lum phase vequat h0 vwant") -while step < 2: +while step < 10000: time_elapsed = (time.time() | units.s) - time_start star = star_in_evo.copy() # number_of_zones = star_in_evo.get_number_of_zones() @@ -277,8 +278,8 @@ def write_backup( evo.parameters.vwant, ) if step % store_every == 0: - pass - #plotting.update(star_in_evo, phase=evo.parameters.phase) + # pass + plotting.update(star_in_evo, phase=evo.parameters.phase) if ( (time_elapsed - time_of_last_plot) > plot_time or step - model_of_last_plot > plot_models @@ -287,7 +288,7 @@ def write_backup( (star.age - age_of_last_plot).value_in(units.Myr) / (time_elapsed - time_of_last_plot).value_in(units.minute) ) | units.Myr / units.minute - #plotting.plot_all(speed=speed, step=step) + plotting.plot_all(speed=speed, step=step) model_of_last_plot = step time_of_last_plot = time_elapsed age_of_last_plot = star.age @@ -306,13 +307,13 @@ def write_backup( age_previous = star_in_evo.age star_in_evo.evolve_one_step() - print(f"Condition: {evo.parameters.stopping_condition}") - if evo.parameters.stopping_condition != "none": - # star_in_evo.age == age_previous: - if step > 1: - print("Stopping - not evolving!") - print(f"Condition: {evo.parameters.stopping_condition}") - break + # print(f"Condition: {evo.parameters.stopping_condition}") + # if evo.parameters.stopping_condition != "none": + # # star_in_evo.age == age_previous: + # if step > 1: + # print("Stopping - not evolving!") + # print(f"Condition: {evo.parameters.stopping_condition}") + # break step += 1 runtime = (time.time() | units.s) - time_start From 9233cbecca5de19ac71036ddee2e8c6dfc558efd Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 31 Oct 2022 16:15:30 +0100 Subject: [PATCH 38/72] simplify Makefile for GENEC (wip) --- src/amuse/community/genec/Makefile | 71 +++--------------------------- 1 file changed, 6 insertions(+), 65 deletions(-) diff --git a/src/amuse/community/genec/Makefile b/src/amuse/community/genec/Makefile index e66d6d8ba5..a99ce4ae0a 100644 --- a/src/amuse/community/genec/Makefile +++ b/src/amuse/community/genec/Makefile @@ -10,7 +10,7 @@ FC = $(MPIFC) LDFLAGS += -lm $(MUSE_LD_FLAGS) -# FCFLAGS += -std=f95 +FCFLAGS += -std=f95 # FCFLAGS += -O0 OBJS = interface.o @@ -18,63 +18,7 @@ OBJS = interface.o CODEDIR = src/GENEC/code INI_CODEDIR = src/GENEC/tools/makeini -CODELIB = src/libgenec.a - -MODULES_F90_BASE = \ - $(CODEDIR)/io_definitions.f90 \ - $(CODEDIR)/evol.f90 \ - $(CODEDIR)/const.f90 \ - $(CODEDIR)/caramodele.f90 \ - $(CODEDIR)/inputparam.f90 \ - $(CODEDIR)/state.f90 \ - $(CODEDIR)/interpolation.f90 \ - $(CODEDIR)/nagmod.f90 \ - $(CODEDIR)/SmallFunc.f90 \ - $(CODEDIR)/abundmod.f90 \ - $(CODEDIR)/diffadvmod.f90 \ - $(CODEDIR)/equadiffmod.f90 \ - $(CODEDIR)/geomod.f90 \ - $(CODEDIR)/magmod.f90 \ - $(CODEDIR)/rotmod.f90 \ - $(CODEDIR)/strucmod.f90 \ - $(CODEDIR)/ionisation.f90 \ - $(CODEDIR)/convection.f90 \ - $(CODEDIR)/timestep.f90 \ - $(CODEDIR)/PrintAll.f90 \ - $(CODEDIR)/omegamod.f90 \ - $(CODEDIR)/EOS.f90 \ - $(CODEDIR)/nablas.f90 \ - $(CODEDIR)/energy.f90 \ - $(CODEDIR)/opacity.f90 \ - $(CODEDIR)/envelope.f90 \ - $(CODEDIR)/LayersShift.f90 \ - $(CODEDIR)/advection.f90 \ - $(CODEDIR)/diffusion.f90 \ - $(CODEDIR)/chemicals.f90 \ - $(CODEDIR)/bintidemod.f90 \ - $(CODEDIR)/winds.f90 \ - $(INI_CODEDIR)/inichemmod.f90 \ - $(INI_CODEDIR)/interpolmod.f90 \ - $(INI_CODEDIR)/modinimod.f90 - -MODULES_F90 = \ - $(MODULES_F90_BASE) \ - $(CODEDIR)/PGPlotModule_Null.f90 \ - $(CODEDIR)/henyey_solver.f90 \ - $(CODEDIR)/WriteSaveClose.f90 \ - $(CODEDIR)/genec.f90 -# SOURCES_F90 = $(CODEDIR)/main.f90 - - -MODULES_F90_ALL = \ - $(MODULES_F90) \ - $(MODULES_F90_MAKEINI) \ - $(CODEDIR)/amuse.f90 - -MODULES=$(MODULES_F90_ALL:%.f90=%.o) -# SOURCES=$(SOURCES_F90:%.f90=%.o) - -OBJECTS=$(MODULES) # $(SOURCES) +CODELIB = $(CODEDIR)/libgenec.a all: genec_worker @@ -86,23 +30,20 @@ clean: $(RM) $(CODEDIR)/*.o $(RM) $(INI_CODEDIR)/*.o $(RM) *.mod - # make -C $(CODEDIR) -f make_amuse clean + make -C $(CODEDIR) -f make_genec clean distclean: clean make -C src distclean -$(CODELIB): $(OBJECTS) - @echo "==========LINKING=========" - @echo "Fortran options: $(FFLAGS) $(LDFLAGS) --> $(CODELIB)" - ar rc $(CODELIB) $(OBJECTS) +$(CODELIB): #$(OBJECTS) + make -C $(CODEDIR) -f make_genec libgenec.a # @$(COMPILER) -shared $(FFLAGS) $(OBJECTS) $(LDFLAGS) -o $(CODELIB) - worker_code.f90: interface.py $(CODE_GENERATOR) --type=f90 interface.py GenecInterface -o $@ genec_worker: worker_code.f90 $(CODELIB) $(OBJS) - $(MPIFC) $(FCFLAGS) $(FS_FLAGS) $< $(OBJS) $(CODELIB) $(FS_LIBS) -o $@ + $(MPIFC) $(FCFLAGS) $(FS_FLAGS) $< $(OBJS) -l$(CODELIB) $(FS_LIBS) -o $@ %.o: %.f90 $(FC) $(FCFLAGS) -c -o $@ $< From 45b5d420e5e9705c6dce4b3c1f1105209f24e733 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 31 Oct 2022 16:29:17 +0100 Subject: [PATCH 39/72] small update (wip) --- src/amuse/community/genec/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse/community/genec/Makefile b/src/amuse/community/genec/Makefile index a99ce4ae0a..da502e4f61 100644 --- a/src/amuse/community/genec/Makefile +++ b/src/amuse/community/genec/Makefile @@ -43,7 +43,7 @@ worker_code.f90: interface.py $(CODE_GENERATOR) --type=f90 interface.py GenecInterface -o $@ genec_worker: worker_code.f90 $(CODELIB) $(OBJS) - $(MPIFC) $(FCFLAGS) $(FS_FLAGS) $< $(OBJS) -l$(CODELIB) $(FS_LIBS) -o $@ + $(MPIFC) $(FCFLAGS) $(FS_FLAGS) $< $(OBJS) -o $@ -l$(CODELIB) $(FS_LIBS) %.o: %.f90 $(FC) $(FCFLAGS) -c -o $@ $< From 11b7f438146007bf838e732a3663bc52dd925ae1 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 8 Nov 2022 18:41:53 +0100 Subject: [PATCH 40/72] fix plotting bug --- src/amuse/community/genec/plot_models.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 5d6a4359e9..0d1cb5a6e3 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -16,6 +16,8 @@ def __init__(self, star): 'density': units.g * units.cm**-3, } self.star = star + self.__n_zones = 0 + self.__redraw = True self.__phase = 1 self.__age = [] | self.default_units['age'] self.__mass = [] | self.default_units['mass'] @@ -57,6 +59,9 @@ def __init__(self, star): def update(self, star, phase=1): self.star = star + if self.__n_zones != star.n_zones: + self.__redraw = True + self.__n_zones = star.n_zones self.__phase = phase self.__age.append(star.age) self.__mass.append(star.mass) @@ -72,7 +77,9 @@ def update(self, star, phase=1): self.__abundances[i, 0] ) - def draw(self, verbose=False, speed=0 | units.Myr / units.minute, step=None): + def draw( + self, verbose=False, speed=0 | units.Myr / units.minute, step=None + ): for i, fig in self.__figures.items(): if verbose: print(f"drawing figure {i}") @@ -327,9 +334,20 @@ def initialise_abundance_profile(self): def plot_abundance_profile(self): title = "Abundance profile" - if title not in self.__initialised: + if self.__redraw: + title = "Abundance profile" + ax = self.__axes[title] + ax.clear() + if ( + title not in self.__initialised + or self.__redraw + ): self.initialise_abundance_profile() mass_profile = self.star.get_cumulative_mass_profile() + # Must reinitialise in some way if the number of zones has changed! + # if len(mass_profile) != len(self.__abundance_plots[0].get_xdata()): + # self.initialise_abundance_profile() + for i, species in enumerate(self.__species): self.__abundance_plots[i].set_xdata( mass_profile @@ -401,5 +419,6 @@ def plot_all(self, speed=0 | units.Myr / units.minute, step=None): for fig in self.__figures.values(): fig.canvas.flush_events() + self.__redraw = False plt.pause(0.01) # plt.show(block=False) From 57af834430920c624442709069bfc5b4a9fa1474 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Thu, 24 Nov 2022 10:45:22 +0100 Subject: [PATCH 41/72] Updates to AMUSE-Genec --- src/amuse/community/genec/Makefile | 4 +- src/amuse/community/genec/interface.f90 | 155 ++++------- src/amuse/community/genec/interface.py | 82 +++--- .../genec/test_integrate_default_star.py | 58 ++-- .../genec/test_integrate_difficult_star.py | 248 ++++++++++++++++++ 5 files changed, 371 insertions(+), 176 deletions(-) create mode 100644 src/amuse/community/genec/test_integrate_difficult_star.py diff --git a/src/amuse/community/genec/Makefile b/src/amuse/community/genec/Makefile index da502e4f61..4f27ba950f 100644 --- a/src/amuse/community/genec/Makefile +++ b/src/amuse/community/genec/Makefile @@ -10,7 +10,7 @@ FC = $(MPIFC) LDFLAGS += -lm $(MUSE_LD_FLAGS) -FCFLAGS += -std=f95 +FCFLAGS += -Isrc/GENEC/code # FCFLAGS += -O0 OBJS = interface.o @@ -43,7 +43,7 @@ worker_code.f90: interface.py $(CODE_GENERATOR) --type=f90 interface.py GenecInterface -o $@ genec_worker: worker_code.f90 $(CODELIB) $(OBJS) - $(MPIFC) $(FCFLAGS) $(FS_FLAGS) $< $(OBJS) -o $@ -l$(CODELIB) $(FS_LIBS) + $(MPIFC) $(FCFLAGS) $(FS_FLAGS) $< $(OBJS) -o $@ $(CODELIB) $(FS_LIBS) %.o: %.f90 $(FC) $(FCFLAGS) -c -o $@ $< diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 36349f6e35..c02956c328 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1,14 +1,14 @@ function initialize_code() !use WriteSaveClose, only: quitafterclosing - use inputparam, only: amuseinterface use genec, only: initialise_genec - use amuse_helpers, only: set_defaults - use amuse_helpers, only: mstar, zini, starname + use helpers, only: set_defaults + use helpers, only: mstar, zini, starname use evol, only: input_dir + use inputparam, only: libgenec implicit none integer:: initialize_code - amuseinterface = .true. + libgenec = .true. input_dir = "./src/GENEC/code" call initialise_genec() call set_defaults() @@ -22,8 +22,7 @@ function initialize_code() function read_genec_model(index_of_the_star, cardfilename) ! This should only be called if no star has been initialised yet! - use genec, only: amuseinterface - use amuse_helpers, only: starname + use helpers, only: starname use inputparam, only:CharacteristicsParams,PhysicsParams,CompositionParams, & RotationParams,SurfaceParams,ConvectionParams,ConvergenceParams, & TimeControle,VariousSettings, & @@ -55,7 +54,6 @@ function read_genec_model(index_of_the_star, cardfilename) integer:: i,ii real(kindreal):: dlelexprev - amuseinterface = .false. ! This will make initialise_star read the b file open(unit=42, file=cardfilename) ! * Parse the CharacteristicsParams namelist * read(42,nml=CharacteristicsParams) @@ -77,7 +75,6 @@ function read_genec_model(index_of_the_star, cardfilename) read(42,nml=VariousSettings) close(42) - amuseinterface = .true. ! this will be false in a savefile, so set it to .true. again! write(fnamein, '(i5.5)') modanf fname51 = trim(starname)//'.b'//fnamein @@ -866,24 +863,6 @@ function set_par_itests(par_itests) set_par_itests = 0 end function -function get_par_amuseinterface(par_amuseinterface) - use inputparam, only: amuseinterface - implicit none - logical:: par_amuseinterface - integer:: get_par_amuseinterface - par_amuseinterface = amuseinterface - get_par_amuseinterface = 0 -end function - -function set_par_amuseinterface(par_amuseinterface) - use inputparam, only: amuseinterface - implicit none - logical:: par_amuseinterface - integer:: set_par_amuseinterface - amuseinterface = par_amuseinterface - set_par_amuseinterface = 0 -end function - function get_par_var_rates(par_var_rates) use inputparam, only: var_rates implicit none @@ -1766,48 +1745,28 @@ function set_par_starname(par_starname) set_par_starname = 0 end function -function get_par_stopping_condition(par_stopping_condition) - use State, only: stopping_condition - implicit none - character(15):: par_stopping_condition - integer:: get_par_stopping_condition - par_stopping_condition = stopping_condition - get_par_stopping_condition = 0 -end function - -function set_par_stopping_condition(par_stopping_condition) - use State, only: stopping_condition - implicit none - character(15):: par_stopping_condition - integer:: set_par_stopping_condition - stopping_condition = par_stopping_condition - set_par_stopping_condition = 0 -end function ! **** End Parameters function commit_parameters() - use State, only: stopping_condition implicit none integer:: commit_parameters - stopping_condition = "" commit_parameters = 0 end function function commit_particles() - use genec, only: amuseinterface - use amuse_helpers, only: initialise_star, makeini + use helpers, only: makeini + use genec, only: initialise_star use WriteSaveClose, only: OpenAll use inputparam, only: nzmod implicit none integer:: commit_particles call makeini() ! this will actually override some things from set_defaults now! FIXME + nzmod = 1 !write(*,*) 'makeini done' - call OpenAll() + !call OpenAll() !write(*,*) 'OpenAll done' call initialise_star() - ! nzmod = 10 !write(*,*) 'initialise_star done' - amuseinterface = .true. ! If we just read a b file, disable this again for continuing commit_particles = 0 end function @@ -1820,27 +1779,15 @@ function delete_star() function evolve_model(end_time) use timestep, only: alter - use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise - use amuse_helpers, only: initialise_star - use State, only: stopping_condition implicit none double precision:: end_time + integer:: evolve_one_step integer:: evolve_model - stopping_condition = "" + !stopping_condition = "" do while (alter < end_time) - if (stopping_condition == "") then + !if (stopping_condition == "") then write(*,*) "Current time: ", alter, ", evolving to: ", end_time - !modell = 1 - call evolve() - !call finalise() - !call OpenAll() - !call initialise_star() - !write(*,*) "*****Modell: ", modell - else - write(*,*) "stopped: ", stopping_condition - exit - endif + evolve_model = evolve_one_step(0) end do evolve_model = 0 end function @@ -1850,25 +1797,15 @@ function evolve_for(index_of_the_star, time) ! set max time to current time plus argument ! evolve use timestep, only: alter - use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise - use amuse_helpers, only: initialise_star implicit none integer:: index_of_the_star + integer:: evolve_one_step double precision:: time, end_time integer:: evolve_for - !if (alter == 0.) then - ! call initialise_star() - !endif end_time = alter+time do while (alter < end_time) write(*,*) "Current time: ", alter, ", evolving to: ", end_time - !modell = 1 - call evolve() - !call finalise() - !call OpenAll() - !call initialise_star() - !write(*,*) "*****Modell: ", modell + evolve_for = evolve_one_step(index_of_the_star) end do evolve_for = 0 @@ -1877,30 +1814,32 @@ function evolve_for(index_of_the_star, time) function evolve_one_step(index_of_the_star) use timestep, only: alter use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise - use amuse_helpers, only: initialise_star - use State, only: stopping_condition - use inputparam,only: modanf,nwseq,nzmod + use genec, only: evolve, modell, finalise, veryFirst + use inputparam,only: modanf,nwseq,nzmod,end_at_phase,end_at_model + use genec, only: n_snap implicit none integer:: index_of_the_star integer:: evolve_one_step integer:: original_nzmod !original_nzmod = nzmod - nzmod = 1000000 - write(*,*) "Evolving one step, current time: ", alter - !modell = 1 - if (stopping_condition == "") then + nzmod = 1 + n_snap = 0 + end_at_phase=4 + end_at_model=0 + !write(*,*) "Evolving one step, current time: ", alter + !if (stopping_condition == "") then call evolve() - if (stopping_condition /= "") return - !call finalise() + !if (stopping_condition /= "") return + call finalise() !call OpenAll() !call initialise_star() ! will set modell to 1 - write(*,*) "Evolved one step, current time: ", alter + !write(*,*) "Evolved one step, current time: ", alter !nzmod = original_nzmod !write(*,*) "*****modanf, nwseq, nzmod: ", modanf, nwseq, nzmod - else - write(*,*) "stopped: ", stopping_condition - endif + !else + ! write(*,*) "stopped: ", stopping_condition + !endif + veryFirst = .false. evolve_one_step = 0 end function @@ -1911,20 +1850,20 @@ function finalize_stellar_model() end function function write_genec_model() - use inputparam, only: modanf - use WriteSaveClose, only: OpenAll - use genec, only: finalise - use amuse_helpers, only: initialise_star + !use inputparam, only: modanf + !use WriteSaveClose, only: OpenAll + !use genec, only: finalise + !use helpers, only: initialise_star implicit none integer:: write_genec_model - call finalise() + !call finalise() ! modanf = 0 - call OpenAll() - call initialise_star() + !call OpenAll() + !call initialise_star() !call finalise() !call OpenAll() !call initialise_star() - write_genec_model = 0 + write_genec_model = -1 end function function get_age(index_of_the_star, age) @@ -2098,7 +2037,7 @@ function get_mass(index_of_the_star, mass) end function function set_mass(index_of_the_star, mass) - use amuse_helpers, only:mstar ! this is initial mass only? + use helpers, only:mstar ! this is initial mass only? implicit none integer:: set_mass, index_of_the_star double precision:: mass @@ -2323,7 +2262,7 @@ function set_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, end function function get_metallicity(metallicity) - use amuse_helpers, only: zini + use helpers, only: zini implicit none double precision:: metallicity integer:: get_metallicity @@ -2332,7 +2271,7 @@ function get_metallicity(metallicity) end function function set_metallicity(metallicity) - use amuse_helpers, only: zini + use helpers, only: zini implicit none double precision:: metallicity integer:: set_metallicity @@ -3158,7 +3097,7 @@ function get_time(time) end function function new_particle(index_of_the_star, mass, metallicity, am_starname) - use amuse_helpers, only: starname, mstar, zini + use helpers, only: starname, mstar, zini implicit none integer:: index_of_the_star, key double precision:: mass, metallicity @@ -3183,9 +3122,9 @@ function recommit_particles() use WriteSaveClose, only: OpenAll implicit none integer:: recommit_particles - call finalise() - call OpenAll() - call initialise_star() + !call finalise() + !call OpenAll() + !call initialise_star() recommit_particles = 0 end function @@ -3200,7 +3139,7 @@ function set_genec_path(path) end function function set_starname(index_of_the_star) - use amuse_helpers, only:starname + use helpers, only:starname implicit none integer:: set_starname, index_of_the_star ! Only allow this at the initialisation time! diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 3dc7fa9068..3d10536346 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -3356,41 +3356,41 @@ def set_par_starname(): ''' return function - @legacy_function - def get_par_stopping_condition(): - 'get parameter stopping_condition' - function = LegacyFunctionSpecification() - function.addParameter( - 'stopping_condition', dtype='string', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function - - @legacy_function - def set_par_stopping_condition(): - 'set parameter stopping_condition' - function = LegacyFunctionSpecification() - function.addParameter( - 'stopping_condition', dtype='string', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + # @legacy_function + # def get_par_stopping_condition(): + # 'get parameter stopping_condition' + # function = LegacyFunctionSpecification() + # function.addParameter( + # 'stopping_condition', dtype='string', + # direction=function.OUT, + # ) + # function.result_type = 'int32' + # function.result_doc = ''' + # 0 - OK + # Got the value. + # -1 - ERROR + # Unable to get. + # ''' + # return function + + # @legacy_function + # def set_par_stopping_condition(): + # 'set parameter stopping_condition' + # function = LegacyFunctionSpecification() + # function.addParameter( + # 'stopping_condition', dtype='string', + # direction=function.IN, + # ) + # function.result_type = 'int32' + # function.result_doc = ''' + # 0 - OK + # The value has been set. + # -1 - ERROR + # Unable to set. + # -2 - ERROR + # Cannot set at this point, already running. + # ''' + # return function # End parameters @@ -5943,12 +5943,12 @@ def define_parameters(self, handler): "GENEC parameter starname", ) - handler.add_method_parameter( - "get_par_stopping_condition", - "set_par_stopping_condition", - "stopping_condition", - "GENEC parameter stopping_condition", - ) + # handler.add_method_parameter( + # "get_par_stopping_condition", + # "set_par_stopping_condition", + # "stopping_condition", + # "GENEC parameter stopping_condition", + # ) handler.add_method_parameter( "get_par_n_snap", diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index 5a07fb9beb..dcff4217b0 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -103,7 +103,7 @@ def write_backup( # ) return -ROTATING_STAR = True +ROTATING_STAR = False MASS_UNIT = units.MSun LENGTH_UNIT = units.RSun SPEED_UNIT = units.kms @@ -118,7 +118,7 @@ def write_backup( MASS_UNIT, LENGTH_UNIT, TIME_UNIT, SPEED_UNIT, MASSLOSS_UNIT, TEMPERATURE_UNIT, LUMINOSITY_UNIT, SPEEDUP_UNIT ], - precision=4, + precision=6, prefix="", separator=" ", # separator=" [", @@ -126,9 +126,13 @@ def write_backup( # suffix="]", ) - +star_difficult = Particle( + mass=60 | units.MSun, + metallicity=0.014, +) star = Particle(mass=7.0 | units.MSun, metallicity=0.014) evo = Genec(redirection="none") +# evo.parameters.idebug = 2 # evo = Genec() if ROTATING_STAR: params = { @@ -137,7 +141,7 @@ def write_backup( 'isol': 1, 'imagn': 0, 'ialflu': 0, - 'ianiso': 0, + 'ianiso': 1, 'ipop3': 0, 'ibasnet': 0, 'phase': 1, @@ -210,12 +214,14 @@ def write_backup( 'nbchx': 200, 'nrband': 1, # TimeControle - 'islow': 2, + 'islow': 0, 'xcn': 1.000, 'icncst': 0, 'tauH_fit': 1, } -evo.parameters.vwant = 0.4 + evo.parameters.vwant = 0.7 +else: + evo.parameters.vwant = 0.0 evo.parameters.ipoly = 0 # evo.parameters.idebug = 1 star_in_evo = evo.fullparticles.add_particle(star) @@ -233,9 +239,9 @@ def write_backup( plt.ion() save_every = 10 -store_every = 10 -plot_time = 5 | units.s -plot_models = 200 +store_every = 1 +plot_time = 10 | units.s +plot_models = 20 step = 0 model_of_last_save = 0 @@ -244,13 +250,14 @@ def write_backup( time_of_last_plot = 0 | units.s age_of_last_plot = star_in_evo.age +plotting = None plotting = StellarModelPlot(star_in_evo) # evo.parameters.nzmod = 100 evo.parameters.n_snap = 0 -print("age mass radius temp lum phase vequat h0 vwant") -while step < 10000: +print("age mass radius temp lum phase vequat h0 vwant xcn") +while True: time_elapsed = (time.time() | units.s) - time_start star = star_in_evo.copy() # number_of_zones = star_in_evo.get_number_of_zones() @@ -276,22 +283,23 @@ def write_backup( star.surface_velocity, star.abundance_h[0], evo.parameters.vwant, + evo.parameters.xcn, ) - if step % store_every == 0: - # pass + print(f"step: {step} time: {star.age} timestep: {star.time_step} xcn: {evo.parameters.xcn}") + if (step % store_every == 0) and plotting is not None: plotting.update(star_in_evo, phase=evo.parameters.phase) - if ( - (time_elapsed - time_of_last_plot) > plot_time - or step - model_of_last_plot > plot_models - ): - speed = ( - (star.age - age_of_last_plot).value_in(units.Myr) - / (time_elapsed - time_of_last_plot).value_in(units.minute) - ) | units.Myr / units.minute - plotting.plot_all(speed=speed, step=step) - model_of_last_plot = step - time_of_last_plot = time_elapsed - age_of_last_plot = star.age + if ( + (time_elapsed - time_of_last_plot) > plot_time + or step - model_of_last_plot > plot_models + ): + speed = ( + (star.age - age_of_last_plot).value_in(units.Myr) + / (time_elapsed - time_of_last_plot).value_in(units.minute) + ) | units.Myr / units.minute + plotting.plot_all(speed=speed, step=step) + model_of_last_plot = step + time_of_last_plot = time_elapsed + age_of_last_plot = star.age if step % save_every == 0: write_backup( diff --git a/src/amuse/community/genec/test_integrate_difficult_star.py b/src/amuse/community/genec/test_integrate_difficult_star.py new file mode 100644 index 0000000000..76a79c69cc --- /dev/null +++ b/src/amuse/community/genec/test_integrate_difficult_star.py @@ -0,0 +1,248 @@ +import numpy +import time + +from amuse.datamodel import Particle +from amuse.units import units +from amuse.community.genec import Genec +from amuse.io import write_set_to_file, read_set_from_file +from amuse.support.console import set_printing_strategy + +import matplotlib.pyplot as plt +import matplotlib.animation as animation +from plot_models import StellarModelPlot + +from amuse.community.genec.interface import SPECIES_NAMES + +class NeedToSave: + def __init__(self): + self.model = 0 + self.current = { + 'luminosity': 0 | units.LSun, + 'temperature': 0 | units.K, + 'central_temperature': 0 | units.K, + 'central_density': 0 | units.g * units.cm**-3, + 'surface_velocity': 0 | units.kms, + 'mass': 0 | units.MSun, + 'time_step': 0 | units.s, + } + for species in SPECIES_NAMES.keys(): + self.current[species] = [] + self.previous = self.current.copy() + self.derivs = {} + for key in self.current.keys(): + self.derivs[key] = 1 + return + + def get_values(self): + return self.current + + @property + def save_next(self): + return True + + def update(self, star): + self.previous = self.current.copy() + for key in self.current.keys(): + self.current[key] = getattr(star, key) + + +def read_saved_star_timeline(star_key): + star = read_set_from_file(f'star-{star_key}.amuse')[0] + age, radius = star.get_timeline_of_attribute_as_vector('radius') + print(age.in_(units.yr)) + print(radius.in_(units.RSun)) + + +def write_backup( + step, + star, + abundances, + append=True, +): + # GENEC reads the following on a restore/resume: + # gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,ab,dm_lost,m,(q(i),p(i),t(i),r(i),s(i),x(i),y(i),& + # xc12(i),vp(i),vt(i),vr(i),vs(i),xo16(i),vx(i),vy(i),vxc12(i),vxo16(i),i=1,m),drl,drte,dk,drp,drt,drr,rlp,& + # rlt,rlc,rrp,rrt,rrc,rtp,rtt,rtc,tdiff,vsuminenv,(CorrOmega(i),i=1,npondcouche),xLtotbeg,dlelexprev,& + # zams_radius + # + # read (51) (y3(i),xc13(i),xn14(i),xn15(i),xo17(i),xo18(i),vy3(i),vxc13(i),vxn14(i),vxn15(i),vxo17(i),vxo18(i),xne20(i), & + # xne22(i),xmg24(i),xmg25(i),xmg26(i),vxne20(i),vxne22(i),vxmg24(i),vxmg25(i),vxmg26(i),omegi(i),vomegi(i),i=1,m) + # + # read(51) (xf19(i),xne21(i),xna23(i),xal26(i),xal27(i),xsi28(i),vxf19(i),vxne21(i),vxna23(i),vxal26g(i),vxal27(i), & + # vxsi28(i),xneut(i),xprot(i),xc14(i),xf18(i),xbid(i),xbid1(i),vxneut(i),vxprot(i),vxc14(i),vxf18(i),vxbid(i), & + # vxbid1(i),i=1,m) + + # do ii=1,nbelx + # read(51) (abelx(ii,i),vabelx(ii,i),i=1,m) + # enddo + # + # if (isugi >= 1) then + # read(51) nsugi + # endif + # + # if (bintide) then + # read(51) period,r_core,vna,vnr + # endif + + if append: + filename = f'star-{star.key}.amuse' + else: + filename = f'star-{star.key}-{step}.amuse' + write_set_to_file( + star.as_set(), + filename, + timestamp=star.age if append else None, + append_to_file=append, + compression=True, + ) + + # For now, abundances aren't part of the single star particle + # numpy.savez_compressed( + # f'star-abundances-{star.key}-{step}.npz', + # abundances=abundances, + # ) + return + +ROTATING_STAR = True +MASS_UNIT = units.MSun +LENGTH_UNIT = units.RSun +SPEED_UNIT = units.kms +TIME_UNIT = units.Myr +MASSLOSS_UNIT = units.MSun / units.yr +TEMPERATURE_UNIT = units.K +LUMINOSITY_UNIT = units.LSun +SPEEDUP_UNIT = units.Myr / units.minute +set_printing_strategy( + "custom", + preferred_units=[ + MASS_UNIT, LENGTH_UNIT, TIME_UNIT, SPEED_UNIT, MASSLOSS_UNIT, + TEMPERATURE_UNIT, LUMINOSITY_UNIT, SPEEDUP_UNIT + ], + precision=6, + prefix="", + separator=" ", + # separator=" [", + suffix="", + # suffix="]", +) + +star_difficult = Particle( + mass=60 | units.MSun, + metallicity=0.014, +) +star = Particle(mass=60.0 | units.MSun, metallicity=0.014) +evo = Genec(redirection="none") +# evo = Genec() +if ROTATING_STAR: + evo.parameters.vwant = 0.7 + evo.parameters.ianiso = 1 + # evo.parameters.irot = 1 + # evo.parameters.starname = "AmuseDifficultStar" +else: + evo.parameters.vwant = 0.0 +evo.parameters.ipoly = 0 +# evo.parameters.idebug = 1 +star_in_evo = evo.fullparticles.add_particle(star) + +# for p in params.items(): +# setattr(evo.parameters, p[0], p[1]) +evo.commit_particles() +print(evo.parameters) +# print(star_in_evo) +font = { + 'size': 8, +} +plt.rc('font', **font) +# iplt.switch_backend('macosx') +plt.ion() + +save_every = 10 +store_every = 1 +plot_time = 10 | units.s +plot_models = 20 +step = 0 + +model_of_last_save = 0 +model_of_last_plot = 0 +time_start = time.time() | units.s +time_of_last_plot = 0 | units.s +age_of_last_plot = star_in_evo.age + +plotting = None +plotting = StellarModelPlot(star_in_evo) + +# evo.parameters.nzmod = 100 +evo.parameters.n_snap = 0 + +print("age mass radius temp lum phase vequat h0 vwant xcn") +while True: + time_elapsed = (time.time() | units.s) - time_start + star = star_in_evo.copy() + # number_of_zones = star_in_evo.get_number_of_zones() + # density_profile = star_in_evo.get_density_profile() + # radius_profile = star_in_evo.get_radius_profile() + # temperature_profile = star_in_evo.get_temperature_profile() + # luminosity_profile = star_in_evo.get_luminosity_profile() + # pressure_profile = star_in_evo.get_pressure_profile() + chemical_abundance_profile = star_in_evo.get_chemical_abundance_profiles() + + # print(evo.fullparticles[0]) + # print(evo.fullparticles[0].get_number_of_species()) + # print(evo.fullparticles[0].get_names_of_species()) + # print(evo.fullparticles[0].get_mass_profile()) + # exit() + print( + star.age.in_(units.Myr), + star.mass.in_(units.MSun), + star.radius.in_(units.RSun), + star.temperature.in_(units.K), + star.luminosity.in_(units.LSun), + evo.parameters.phase, + star.surface_velocity, + star.abundance_h[0], + evo.parameters.vwant, + evo.parameters.xcn, + ) + print(f"step: {step} time: {star.age} timestep: {star.time_step} xcn: {evo.parameters.xcn}") + if (step % store_every == 0) and plotting is not None: + plotting.update(star_in_evo, phase=evo.parameters.phase) + if ( + (time_elapsed - time_of_last_plot) > plot_time + or step - model_of_last_plot > plot_models + ): + speed = ( + (star.age - age_of_last_plot).value_in(units.Myr) + / (time_elapsed - time_of_last_plot).value_in(units.minute) + ) | units.Myr / units.minute + plotting.plot_all(speed=speed, step=step) + model_of_last_plot = step + time_of_last_plot = time_elapsed + age_of_last_plot = star.age + + if step % save_every == 0: + write_backup( + step, + star, + # density_profile, + # radius_profile, + # temperature_profile, + # luminosity_profile, + # pressure_profile, + chemical_abundance_profile, + ) + + age_previous = star_in_evo.age + star_in_evo.evolve_one_step() + # print(f"Condition: {evo.parameters.stopping_condition}") + # if evo.parameters.stopping_condition != "none": + # # star_in_evo.age == age_previous: + # if step > 1: + # print("Stopping - not evolving!") + # print(f"Condition: {evo.parameters.stopping_condition}") + # break + step += 1 + +runtime = (time.time() | units.s) - time_start +print( + f"Running {step} models took {runtime.value_in(units.minute)} minutes" +) From c6ff309bfa2747027125f1786c33fa45999e49fa Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 6 Dec 2022 21:21:11 +0100 Subject: [PATCH 42/72] Interface updates --- src/amuse/community/genec/Makefile | 4 +- src/amuse/community/genec/interface.f90 | 581 ++++++++++-------------- src/amuse/community/genec/interface.py | 36 +- 3 files changed, 258 insertions(+), 363 deletions(-) diff --git a/src/amuse/community/genec/Makefile b/src/amuse/community/genec/Makefile index 4f27ba950f..55608866b9 100644 --- a/src/amuse/community/genec/Makefile +++ b/src/amuse/community/genec/Makefile @@ -30,13 +30,13 @@ clean: $(RM) $(CODEDIR)/*.o $(RM) $(INI_CODEDIR)/*.o $(RM) *.mod - make -C $(CODEDIR) -f make_genec clean + make -C $(CODEDIR) clean distclean: clean make -C src distclean $(CODELIB): #$(OBJECTS) - make -C $(CODEDIR) -f make_genec libgenec.a + make -C $(CODEDIR) libgenec.a # @$(COMPILER) -shared $(FFLAGS) $(OBJECTS) $(LDFLAGS) -o $(CODELIB) worker_code.f90: interface.py diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index c02956c328..390cb53a79 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1,8 +1,22 @@ +module AmuseInterface + use helpers, only: InitialGenecStar,GenecStar,genec_star + use evol, only: kindreal,ldi,npondcouche + + type(genec_star) :: StarInGenec + type(genec_star) :: BackupStarInGenec + integer :: number_of_stars = 0 + public:: StarInGenec,BackupStarInGenec,number_of_stars +contains + +function restore_star() + implicit none + integer:: restore_star + restore_star = 0 +end function + function initialize_code() !use WriteSaveClose, only: quitafterclosing use genec, only: initialise_genec - use helpers, only: set_defaults - use helpers, only: mstar, zini, starname use evol, only: input_dir use inputparam, only: libgenec implicit none @@ -11,101 +25,16 @@ function initialize_code() libgenec = .true. input_dir = "./src/GENEC/code" call initialise_genec() - call set_defaults() - starname = "AmuseDefaultStar" - mstar = 7.0 - zini = 0.014 - !quitafterclosing = .false. initialize_code = 0 end function function read_genec_model(index_of_the_star, cardfilename) ! This should only be called if no star has been initialised yet! - use helpers, only: starname - use inputparam, only:CharacteristicsParams,PhysicsParams,CompositionParams, & - RotationParams,SurfaceParams,ConvectionParams,ConvergenceParams, & - TimeControle,VariousSettings, & - isugi,bintide, & - modanf - use caramodele, only:gms,gls,teff,glsv,teffv,xmini,ab,dm_lost,xLtotbeg,zams_radius - use timestep, only:alter,dzeitj,dzeit,dzeitv - use strucmod, only:m,q,p,t,r,s,drl,drte,dk,drp,drt,drr,rlp,rlt,rlc,rrp,rrt,rrc,rtp, & - rtt,rtc, vp,vt,vr,vs, vna,vnr - use abundmod, only:x,y3,y,xc12,xc13,xc14,xn14,xn15,xo16,xo17,xo18,xf18,xf19,xne20,xne21, & - xne22,xna23,xmg24,xmg25,xmg26,xal26,xal27,xsi28,xprot,xneut,xbid,xbid1,vx, & - vy3,vy,vxc12,vxc13,vxc14,vxn14,vxn15,vxo16,vxo17,vxo18,vxf18,vxf19,vxne20, & - vxne21,vxne22,vxna23,vxmg24,vxmg25,vxmg26,vxal26g,vxal27,vxsi28,vxprot, & - vxneut,vxbid,vxbid1, & - nbelx,abelx,vabelx,mbelx,maxCNO, & - abundCheck - use rotmod, only: CorrOmega,vsuminenv,omegi,vomegi - use evol, only: npondcouche,kindreal - use diffadvmod, only: tdiff - use henyey_solver, only: nsugi - use bintidemod, only: period - use convection, only: r_core implicit none integer:: index_of_the_star character(256):: cardfilename - character(5):: fnamein - character(256):: fname51 integer:: read_genec_model - integer:: i,ii - real(kindreal):: dlelexprev - - open(unit=42, file=cardfilename) - ! * Parse the CharacteristicsParams namelist * - read(42,nml=CharacteristicsParams) - ! * Parse the PhysicsParams namelist * - read(42,nml=PhysicsParams) - ! * Parse the CompositionParams namelist * - read(42,nml=CompositionParams) - ! * Parse the RotationParams namelist * - read(42,nml=RotationParams) - ! * Parse the SurfaceParams namelist * - read(42,nml=SurfaceParams) - ! * Parse the ConvectionParams namelist * - read(42,nml=ConvectionParams) - ! * Parse the ConvergenceParams namelist * - read(42,nml=ConvergenceParams) - ! * Parse the TimeControle namelist * - read(42,nml=TimeControle) - ! * Parse the VariousSettings namelist * - read(42,nml=VariousSettings) - - close(42) - - write(fnamein, '(i5.5)') modanf - fname51 = trim(starname)//'.b'//fnamein - - open(unit=51, file=fname51, status='unknown',form='unformatted') - read(51)gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,ab,dm_lost,m, & - (q(i),p(i),t(i),r(i),s(i),x(i),y(i),xc12(i), & - vp(i),vt(i),vr(i),vs(i),xo16(i),vx(i),vy(i),vxc12(i),vxo16(i),i=1,m), & - drl,drte,dk,drp,drt,drr,rlp,rlt,rlc,rrp,rrt,rrc,rtp, & - rtt,rtc,tdiff,vsuminenv,(CorrOmega(i),i=1,npondcouche), & - xLtotbeg,dlelexprev,zams_radius - - read(51) (y3(i),xc13(i),xn14(i),xn15(i),xo17(i),xo18(i),vy3(i),vxc13(i),vxn14(i),vxn15(i),vxo17(i),vxo18(i),xne20(i), & - xne22(i),xmg24(i),xmg25(i),xmg26(i),vxne20(i),vxne22(i),vxmg24(i),vxmg25(i),vxmg26(i),omegi(i),vomegi(i),i=1,m) - read(51) (xf19(i),xne21(i),xna23(i),xal26(i),xal27(i),xsi28(i),vxf19(i),vxne21(i),vxna23(i),vxal26g(i),vxal27(i),vxsi28(i), & - xneut(i),xprot(i),xc14(i),xf18(i),xbid(i),xbid1(i),vxneut(i),vxprot(i),vxc14(i),vxf18(i),vxbid(i),vxbid1(i),i=1,m) - - do ii=1,nbelx - read(51) (abelx(ii,i),vabelx(ii,i),i=1,m) - enddo - - if (isugi >= 1) then - read(51) nsugi - endif - - if (bintide) then - read(51) period,r_core,vna,vnr - endif - close(51) - - index_of_the_star = 1 read_genec_model = 0 end function @@ -117,10 +46,27 @@ function cleanup_code() ! **** Parameters +function get_model_number(model_number) + use genec, only: nwmd + implicit none + integer:: model_number + integer:: get_model_number + model_number = nwmd + get_model_number = 0 +end function + +function set_model_number(model_number) + use genec, only: nwmd + implicit none + integer:: model_number + integer:: set_model_number + nwmd = model_number + set_model_number = 0 +end function + function get_min_timestep_stop_condition(min_timestep_stop_condition) - use inputparam, only: dzeitj_min implicit none - double precision:: min_timestep_stop_condition + real(kindreal):: min_timestep_stop_condition integer:: get_min_timestep_stop_condition get_min_timestep_stop_condition = 0 end function @@ -1046,7 +992,7 @@ function set_par_stop_deg(par_stop_deg) function get_par_index_poly(par_index_poly) use inputparam, only: index_poly implicit none - double precision:: par_index_poly + real(kindreal):: par_index_poly integer:: get_par_index_poly par_index_poly = index_poly get_par_index_poly = 0 @@ -1055,7 +1001,7 @@ function get_par_index_poly(par_index_poly) function set_par_index_poly(par_index_poly) use inputparam, only: index_poly implicit none - double precision:: par_index_poly + real(kindreal):: par_index_poly integer:: set_par_index_poly index_poly = par_index_poly set_par_index_poly = 0 @@ -1064,7 +1010,7 @@ function set_par_index_poly(par_index_poly) function get_par_binm2(par_binm2) use inputparam, only: binm2 implicit none - double precision:: par_binm2 + real(kindreal):: par_binm2 integer:: get_par_binm2 par_binm2 = binm2 get_par_binm2 = 0 @@ -1073,7 +1019,7 @@ function get_par_binm2(par_binm2) function set_par_binm2(par_binm2) use inputparam, only: binm2 implicit none - double precision:: par_binm2 + real(kindreal):: par_binm2 integer:: set_par_binm2 binm2 = par_binm2 set_par_binm2 = 0 @@ -1082,7 +1028,7 @@ function set_par_binm2(par_binm2) function get_par_periodini(par_periodini) use inputparam, only: periodini implicit none - double precision:: par_periodini + real(kindreal):: par_periodini integer:: get_par_periodini par_periodini = periodini get_par_periodini = 0 @@ -1091,7 +1037,7 @@ function get_par_periodini(par_periodini) function set_par_periodini(par_periodini) use inputparam, only: periodini implicit none - double precision:: par_periodini + real(kindreal):: par_periodini integer:: set_par_periodini periodini = par_periodini set_par_periodini = 0 @@ -1100,7 +1046,7 @@ function set_par_periodini(par_periodini) function get_par_zinit(par_zinit) use inputparam, only: zinit implicit none - double precision:: par_zinit + real(kindreal):: par_zinit integer:: get_par_zinit par_zinit = zinit get_par_zinit = 0 @@ -1109,7 +1055,7 @@ function get_par_zinit(par_zinit) function set_par_zinit(par_zinit) use inputparam, only: zinit implicit none - double precision:: par_zinit + real(kindreal):: par_zinit integer:: set_par_zinit zinit = par_zinit set_par_zinit = 0 @@ -1118,7 +1064,7 @@ function set_par_zinit(par_zinit) function get_par_zsol(par_zsol) use inputparam, only: zsol implicit none - double precision:: par_zsol + real(kindreal):: par_zsol integer:: get_par_zsol par_zsol = zsol get_par_zsol = 0 @@ -1127,7 +1073,7 @@ function get_par_zsol(par_zsol) function set_par_zsol(par_zsol) use inputparam, only: zsol implicit none - double precision:: par_zsol + real(kindreal):: par_zsol integer:: set_par_zsol zsol = par_zsol set_par_zsol = 0 @@ -1136,7 +1082,7 @@ function set_par_zsol(par_zsol) function get_par_z(par_z) use inputparam, only: z implicit none - double precision:: par_z + real(kindreal):: par_z integer:: get_par_z par_z = z get_par_z = 0 @@ -1145,7 +1091,7 @@ function get_par_z(par_z) function set_par_z(par_z) use inputparam, only: z implicit none - double precision:: par_z + real(kindreal):: par_z integer:: set_par_z z = par_z set_par_z = 0 @@ -1154,7 +1100,7 @@ function set_par_z(par_z) function get_par_fenerg(par_fenerg) use inputparam, only: fenerg implicit none - double precision:: par_fenerg + real(kindreal):: par_fenerg integer:: get_par_fenerg par_fenerg = fenerg get_par_fenerg = 0 @@ -1163,7 +1109,7 @@ function get_par_fenerg(par_fenerg) function set_par_fenerg(par_fenerg) use inputparam, only: fenerg implicit none - double precision:: par_fenerg + real(kindreal):: par_fenerg integer:: set_par_fenerg fenerg = par_fenerg set_par_fenerg = 0 @@ -1172,7 +1118,7 @@ function set_par_fenerg(par_fenerg) function get_par_richac(par_richac) use inputparam, only: richac implicit none - double precision:: par_richac + real(kindreal):: par_richac integer:: get_par_richac par_richac = richac get_par_richac = 0 @@ -1181,7 +1127,7 @@ function get_par_richac(par_richac) function set_par_richac(par_richac) use inputparam, only: richac implicit none - double precision:: par_richac + real(kindreal):: par_richac integer:: set_par_richac richac = par_richac set_par_richac = 0 @@ -1190,7 +1136,7 @@ function set_par_richac(par_richac) function get_par_frein(par_frein) use inputparam, only: frein implicit none - double precision:: par_frein + real(kindreal):: par_frein integer:: get_par_frein par_frein = frein get_par_frein = 0 @@ -1199,7 +1145,7 @@ function get_par_frein(par_frein) function set_par_frein(par_frein) use inputparam, only: frein implicit none - double precision:: par_frein + real(kindreal):: par_frein integer:: set_par_frein frein = par_frein set_par_frein = 0 @@ -1208,7 +1154,7 @@ function set_par_frein(par_frein) function get_par_K_Kawaler(par_K_Kawaler) use inputparam, only: K_Kawaler implicit none - double precision:: par_K_Kawaler + real(kindreal):: par_K_Kawaler integer:: get_par_K_Kawaler par_K_Kawaler = K_Kawaler get_par_K_Kawaler = 0 @@ -1217,7 +1163,7 @@ function get_par_K_Kawaler(par_K_Kawaler) function set_par_K_Kawaler(par_K_Kawaler) use inputparam, only: K_Kawaler implicit none - double precision:: par_K_Kawaler + real(kindreal):: par_K_Kawaler integer:: set_par_K_Kawaler K_Kawaler = par_K_Kawaler set_par_K_Kawaler = 0 @@ -1226,7 +1172,7 @@ function set_par_K_Kawaler(par_K_Kawaler) function get_par_Omega_saturation(par_Omega_saturation) use inputparam, only: Omega_saturation implicit none - double precision:: par_Omega_saturation + real(kindreal):: par_Omega_saturation integer:: get_par_Omega_saturation par_Omega_saturation = Omega_saturation get_par_Omega_saturation = 0 @@ -1235,7 +1181,7 @@ function get_par_Omega_saturation(par_Omega_saturation) function set_par_Omega_saturation(par_Omega_saturation) use inputparam, only: Omega_saturation implicit none - double precision:: par_Omega_saturation + real(kindreal):: par_Omega_saturation integer:: set_par_Omega_saturation Omega_saturation = par_Omega_saturation set_par_Omega_saturation = 0 @@ -1244,7 +1190,7 @@ function set_par_Omega_saturation(par_Omega_saturation) function get_par_rapcrilim(par_rapcrilim) use inputparam, only: rapcrilim implicit none - double precision:: par_rapcrilim + real(kindreal):: par_rapcrilim integer:: get_par_rapcrilim par_rapcrilim = rapcrilim get_par_rapcrilim = 0 @@ -1253,7 +1199,7 @@ function get_par_rapcrilim(par_rapcrilim) function set_par_rapcrilim(par_rapcrilim) use inputparam, only: rapcrilim implicit none - double precision:: par_rapcrilim + real(kindreal):: par_rapcrilim integer:: set_par_rapcrilim rapcrilim = par_rapcrilim set_par_rapcrilim = 0 @@ -1262,7 +1208,7 @@ function set_par_rapcrilim(par_rapcrilim) function get_par_vwant(par_vwant) use inputparam, only: vwant implicit none - double precision:: par_vwant + real(kindreal):: par_vwant integer:: get_par_vwant par_vwant = vwant get_par_vwant = 0 @@ -1271,7 +1217,7 @@ function get_par_vwant(par_vwant) function set_par_vwant(par_vwant) use inputparam, only: vwant implicit none - double precision:: par_vwant + real(kindreal):: par_vwant integer:: set_par_vwant vwant = par_vwant set_par_vwant = 0 @@ -1280,7 +1226,7 @@ function set_par_vwant(par_vwant) function get_par_xfom(par_xfom) use inputparam, only: xfom implicit none - double precision:: par_xfom + real(kindreal):: par_xfom integer:: get_par_xfom par_xfom = xfom get_par_xfom = 0 @@ -1289,7 +1235,7 @@ function get_par_xfom(par_xfom) function set_par_xfom(par_xfom) use inputparam, only: xfom implicit none - double precision:: par_xfom + real(kindreal):: par_xfom integer:: set_par_xfom xfom = par_xfom set_par_xfom = 0 @@ -1298,7 +1244,7 @@ function set_par_xfom(par_xfom) function get_par_omega(par_omega) use inputparam, only: omega implicit none - double precision:: par_omega + real(kindreal):: par_omega integer:: get_par_omega par_omega = omega get_par_omega = 0 @@ -1307,7 +1253,7 @@ function get_par_omega(par_omega) function set_par_omega(par_omega) use inputparam, only: omega implicit none - double precision:: par_omega + real(kindreal):: par_omega integer:: set_par_omega omega = par_omega set_par_omega = 0 @@ -1316,7 +1262,7 @@ function set_par_omega(par_omega) function get_par_xdial(par_xdial) use inputparam, only: xdial implicit none - double precision:: par_xdial + real(kindreal):: par_xdial integer:: get_par_xdial par_xdial = xdial get_par_xdial = 0 @@ -1325,7 +1271,7 @@ function get_par_xdial(par_xdial) function set_par_xdial(par_xdial) use inputparam, only: xdial implicit none - double precision:: par_xdial + real(kindreal):: par_xdial integer:: set_par_xdial xdial = par_xdial set_par_xdial = 0 @@ -1334,7 +1280,7 @@ function set_par_xdial(par_xdial) function get_par_B_initial(par_B_initial) use inputparam, only: B_initial implicit none - double precision:: par_B_initial + real(kindreal):: par_B_initial integer:: get_par_B_initial par_B_initial = B_initial get_par_B_initial = 0 @@ -1343,7 +1289,7 @@ function get_par_B_initial(par_B_initial) function set_par_B_initial(par_B_initial) use inputparam, only: B_initial implicit none - double precision:: par_B_initial + real(kindreal):: par_B_initial integer:: set_par_B_initial B_initial = par_B_initial set_par_B_initial = 0 @@ -1352,7 +1298,7 @@ function set_par_B_initial(par_B_initial) function get_par_add_diff(par_add_diff) use inputparam, only: add_diff implicit none - double precision:: par_add_diff + real(kindreal):: par_add_diff integer:: get_par_add_diff par_add_diff = add_diff get_par_add_diff = 0 @@ -1361,7 +1307,7 @@ function get_par_add_diff(par_add_diff) function set_par_add_diff(par_add_diff) use inputparam, only: add_diff implicit none - double precision:: par_add_diff + real(kindreal):: par_add_diff integer:: set_par_add_diff add_diff = par_add_diff set_par_add_diff = 0 @@ -1370,7 +1316,7 @@ function set_par_add_diff(par_add_diff) function get_par_fmlos(par_fmlos) use inputparam, only: fmlos implicit none - double precision:: par_fmlos + real(kindreal):: par_fmlos integer:: get_par_fmlos par_fmlos = fmlos get_par_fmlos = 0 @@ -1379,7 +1325,7 @@ function get_par_fmlos(par_fmlos) function set_par_fmlos(par_fmlos) use inputparam, only: fmlos implicit none - double precision:: par_fmlos + real(kindreal):: par_fmlos integer:: set_par_fmlos fmlos = par_fmlos set_par_fmlos = 0 @@ -1388,7 +1334,7 @@ function set_par_fmlos(par_fmlos) function get_par_fitm(par_fitm) use inputparam, only: fitm implicit none - double precision:: par_fitm + real(kindreal):: par_fitm integer:: get_par_fitm par_fitm = fitm get_par_fitm = 0 @@ -1397,7 +1343,7 @@ function get_par_fitm(par_fitm) function set_par_fitm(par_fitm) use inputparam, only: fitm implicit none - double precision:: par_fitm + real(kindreal):: par_fitm integer:: set_par_fitm fitm = par_fitm set_par_fitm = 0 @@ -1406,7 +1352,7 @@ function set_par_fitm(par_fitm) function get_par_fitmi(par_fitmi) use inputparam, only: fitmi implicit none - double precision:: par_fitmi + real(kindreal):: par_fitmi integer:: get_par_fitmi par_fitmi = fitmi get_par_fitmi = 0 @@ -1415,7 +1361,7 @@ function get_par_fitmi(par_fitmi) function set_par_fitmi(par_fitmi) use inputparam, only: fitmi implicit none - double precision:: par_fitmi + real(kindreal):: par_fitmi integer:: set_par_fitmi fitmi = par_fitmi set_par_fitmi = 0 @@ -1424,7 +1370,7 @@ function set_par_fitmi(par_fitmi) function get_par_fitmi_default(par_fitmi_default) use inputparam, only: fitmi_default implicit none - double precision:: par_fitmi_default + real(kindreal):: par_fitmi_default integer:: get_par_fitmi_default par_fitmi_default = fitmi_default get_par_fitmi_default = 0 @@ -1433,7 +1379,7 @@ function get_par_fitmi_default(par_fitmi_default) function set_par_fitmi_default(par_fitmi_default) use inputparam, only: fitmi_default implicit none - double precision:: par_fitmi_default + real(kindreal):: par_fitmi_default integer:: set_par_fitmi_default fitmi_default = par_fitmi_default set_par_fitmi_default = 0 @@ -1442,7 +1388,7 @@ function set_par_fitmi_default(par_fitmi_default) function get_par_deltal(par_deltal) use inputparam, only: deltal implicit none - double precision:: par_deltal + real(kindreal):: par_deltal integer:: get_par_deltal par_deltal = deltal get_par_deltal = 0 @@ -1451,7 +1397,7 @@ function get_par_deltal(par_deltal) function set_par_deltal(par_deltal) use inputparam, only: deltal implicit none - double precision:: par_deltal + real(kindreal):: par_deltal integer:: set_par_deltal deltal = par_deltal set_par_deltal = 0 @@ -1460,7 +1406,7 @@ function set_par_deltal(par_deltal) function get_par_deltat(par_deltat) use inputparam, only: deltat implicit none - double precision:: par_deltat + real(kindreal):: par_deltat integer:: get_par_deltat par_deltat = deltat get_par_deltat = 0 @@ -1469,7 +1415,7 @@ function get_par_deltat(par_deltat) function set_par_deltat(par_deltat) use inputparam, only: deltat implicit none - double precision:: par_deltat + real(kindreal):: par_deltat integer:: set_par_deltat deltat = par_deltat set_par_deltat = 0 @@ -1478,7 +1424,7 @@ function set_par_deltat(par_deltat) function get_par_elph(par_elph) use inputparam, only: elph implicit none - double precision:: par_elph + real(kindreal):: par_elph integer:: get_par_elph par_elph = elph get_par_elph = 0 @@ -1487,7 +1433,7 @@ function get_par_elph(par_elph) function set_par_elph(par_elph) use inputparam, only: elph implicit none - double precision:: par_elph + real(kindreal):: par_elph integer:: set_par_elph elph = par_elph set_par_elph = 0 @@ -1496,7 +1442,7 @@ function set_par_elph(par_elph) function get_par_dovhp(par_dovhp) use inputparam, only: dovhp implicit none - double precision:: par_dovhp + real(kindreal):: par_dovhp integer:: get_par_dovhp par_dovhp = dovhp get_par_dovhp = 0 @@ -1505,7 +1451,7 @@ function get_par_dovhp(par_dovhp) function set_par_dovhp(par_dovhp) use inputparam, only: dovhp implicit none - double precision:: par_dovhp + real(kindreal):: par_dovhp integer:: set_par_dovhp dovhp = par_dovhp set_par_dovhp = 0 @@ -1514,7 +1460,7 @@ function set_par_dovhp(par_dovhp) function get_par_dunder(par_dunder) use inputparam, only: dunder implicit none - double precision:: par_dunder + real(kindreal):: par_dunder integer:: get_par_dunder par_dunder = dunder get_par_dunder = 0 @@ -1523,7 +1469,7 @@ function get_par_dunder(par_dunder) function set_par_dunder(par_dunder) use inputparam, only: dunder implicit none - double precision:: par_dunder + real(kindreal):: par_dunder integer:: set_par_dunder dunder = par_dunder set_par_dunder = 0 @@ -1532,7 +1478,7 @@ function set_par_dunder(par_dunder) function get_par_gkorm(par_gkorm) use inputparam, only: gkorm implicit none - double precision:: par_gkorm + real(kindreal):: par_gkorm integer:: get_par_gkorm par_gkorm = gkorm get_par_gkorm = 0 @@ -1541,7 +1487,7 @@ function get_par_gkorm(par_gkorm) function set_par_gkorm(par_gkorm) use inputparam, only: gkorm implicit none - double precision:: par_gkorm + real(kindreal):: par_gkorm integer:: set_par_gkorm gkorm = par_gkorm set_par_gkorm = 0 @@ -1550,7 +1496,7 @@ function set_par_gkorm(par_gkorm) function get_par_alph(par_alph) use inputparam, only: alph implicit none - double precision:: par_alph + real(kindreal):: par_alph integer:: get_par_alph par_alph = alph get_par_alph = 0 @@ -1559,7 +1505,7 @@ function get_par_alph(par_alph) function set_par_alph(par_alph) use inputparam, only: alph implicit none - double precision:: par_alph + real(kindreal):: par_alph integer:: set_par_alph alph = par_alph set_par_alph = 0 @@ -1568,7 +1514,7 @@ function set_par_alph(par_alph) function get_par_agdr(par_agdr) use inputparam, only: agdr implicit none - double precision:: par_agdr + real(kindreal):: par_agdr integer:: get_par_agdr par_agdr = agdr get_par_agdr = 0 @@ -1577,7 +1523,7 @@ function get_par_agdr(par_agdr) function set_par_agdr(par_agdr) use inputparam, only: agdr implicit none - double precision:: par_agdr + real(kindreal):: par_agdr integer:: set_par_agdr agdr = par_agdr set_par_agdr = 0 @@ -1586,7 +1532,7 @@ function set_par_agdr(par_agdr) function get_par_faktor(par_faktor) use inputparam, only: faktor implicit none - double precision:: par_faktor + real(kindreal):: par_faktor integer:: get_par_faktor par_faktor = faktor get_par_faktor = 0 @@ -1595,7 +1541,7 @@ function get_par_faktor(par_faktor) function set_par_faktor(par_faktor) use inputparam, only: faktor implicit none - double precision:: par_faktor + real(kindreal):: par_faktor integer:: set_par_faktor faktor = par_faktor set_par_faktor = 0 @@ -1604,7 +1550,7 @@ function set_par_faktor(par_faktor) function get_par_dgrp(par_dgrp) use inputparam, only: dgrp implicit none - double precision:: par_dgrp + real(kindreal):: par_dgrp integer:: get_par_dgrp par_dgrp = dgrp get_par_dgrp = 0 @@ -1613,7 +1559,7 @@ function get_par_dgrp(par_dgrp) function set_par_dgrp(par_dgrp) use inputparam, only: dgrp implicit none - double precision:: par_dgrp + real(kindreal):: par_dgrp integer:: set_par_dgrp dgrp = par_dgrp set_par_dgrp = 0 @@ -1622,7 +1568,7 @@ function set_par_dgrp(par_dgrp) function get_par_dgrl(par_dgrl) use inputparam, only: dgrl implicit none - double precision:: par_dgrl + real(kindreal):: par_dgrl integer:: get_par_dgrl par_dgrl = dgrl get_par_dgrl = 0 @@ -1631,7 +1577,7 @@ function get_par_dgrl(par_dgrl) function set_par_dgrl(par_dgrl) use inputparam, only: dgrl implicit none - double precision:: par_dgrl + real(kindreal):: par_dgrl integer:: set_par_dgrl dgrl = par_dgrl set_par_dgrl = 0 @@ -1640,7 +1586,7 @@ function set_par_dgrl(par_dgrl) function get_par_dgry(par_dgry) use inputparam, only: dgry implicit none - double precision:: par_dgry + real(kindreal):: par_dgry integer:: get_par_dgry par_dgry = dgry get_par_dgry = 0 @@ -1649,7 +1595,7 @@ function get_par_dgry(par_dgry) function set_par_dgry(par_dgry) use inputparam, only: dgry implicit none - double precision:: par_dgry + real(kindreal):: par_dgry integer:: set_par_dgry dgry = par_dgry set_par_dgry = 0 @@ -1658,7 +1604,7 @@ function set_par_dgry(par_dgry) function get_par_dgrc(par_dgrc) use inputparam, only: dgrc implicit none - double precision:: par_dgrc + real(kindreal):: par_dgrc integer:: get_par_dgrc par_dgrc = dgrc get_par_dgrc = 0 @@ -1667,7 +1613,7 @@ function get_par_dgrc(par_dgrc) function set_par_dgrc(par_dgrc) use inputparam, only: dgrc implicit none - double precision:: par_dgrc + real(kindreal):: par_dgrc integer:: set_par_dgrc dgrc = par_dgrc set_par_dgrc = 0 @@ -1676,7 +1622,7 @@ function set_par_dgrc(par_dgrc) function get_par_dgro(par_dgro) use inputparam, only: dgro implicit none - double precision:: par_dgro + real(kindreal):: par_dgro integer:: get_par_dgro par_dgro = dgro get_par_dgro = 0 @@ -1685,7 +1631,7 @@ function get_par_dgro(par_dgro) function set_par_dgro(par_dgro) use inputparam, only: dgro implicit none - double precision:: par_dgro + real(kindreal):: par_dgro integer:: set_par_dgro dgro = par_dgro set_par_dgro = 0 @@ -1694,7 +1640,7 @@ function set_par_dgro(par_dgro) function get_par_dgr20(par_dgr20) use inputparam, only: dgr20 implicit none - double precision:: par_dgr20 + real(kindreal):: par_dgr20 integer:: get_par_dgr20 par_dgr20 = dgr20 get_par_dgr20 = 0 @@ -1703,7 +1649,7 @@ function get_par_dgr20(par_dgr20) function set_par_dgr20(par_dgr20) use inputparam, only: dgr20 implicit none - double precision:: par_dgr20 + real(kindreal):: par_dgr20 integer:: set_par_dgr20 dgr20 = par_dgr20 set_par_dgr20 = 0 @@ -1712,7 +1658,7 @@ function set_par_dgr20(par_dgr20) function get_par_xcn(par_xcn) use inputparam, only: xcn implicit none - double precision:: par_xcn + real(kindreal):: par_xcn integer:: get_par_xcn par_xcn = xcn get_par_xcn = 0 @@ -1721,7 +1667,7 @@ function get_par_xcn(par_xcn) function set_par_xcn(par_xcn) use inputparam, only: xcn implicit none - double precision:: par_xcn + real(kindreal):: par_xcn integer:: set_par_xcn xcn = par_xcn set_par_xcn = 0 @@ -1732,7 +1678,11 @@ function get_par_starname(par_starname) implicit none character(256):: par_starname integer:: get_par_starname - par_starname = starname + if (StarInGenec%initialised) then + par_starname = StarInGenec%starname + else + par_starname = InitialGenecStar%starname + endif get_par_starname = 0 end function @@ -1741,7 +1691,7 @@ function set_par_starname(par_starname) implicit none character(256):: par_starname integer:: set_par_starname - starname = par_starname + InitialGenecStar%starname = par_starname set_par_starname = 0 end function @@ -1754,13 +1704,14 @@ function commit_parameters() end function function commit_particles() - use helpers, only: makeini + use makeini, only: make_initial_star use genec, only: initialise_star use WriteSaveClose, only: OpenAll use inputparam, only: nzmod implicit none integer:: commit_particles - call makeini() ! this will actually override some things from set_defaults now! FIXME + ! makeini will actually override some things from set_defaults now! FIXME + call make_initial_star() nzmod = 1 !write(*,*) 'makeini done' !call OpenAll() @@ -1770,7 +1721,7 @@ function commit_particles() commit_particles = 0 end function -function delete_star() +function delete_star(index_of_the_star) implicit none integer:: index_of_the_star integer:: delete_star @@ -1780,10 +1731,11 @@ function delete_star() function evolve_model(end_time) use timestep, only: alter implicit none - double precision:: end_time - integer:: evolve_one_step + real(kindreal):: end_time integer:: evolve_model !stopping_condition = "" + type(genec_star) :: PreviousStarInGenec + PreviousStarInGenec = StarInGenec do while (alter < end_time) !if (stopping_condition == "") then write(*,*) "Current time: ", alter, ", evolving to: ", end_time @@ -1799,8 +1751,7 @@ function evolve_for(index_of_the_star, time) use timestep, only: alter implicit none integer:: index_of_the_star - integer:: evolve_one_step - double precision:: time, end_time + real(kindreal):: time, end_time integer:: evolve_for end_time = alter+time do while (alter < end_time) @@ -1826,6 +1777,7 @@ function evolve_one_step(index_of_the_star) n_snap = 0 end_at_phase=4 end_at_model=0 + !write(*,*) "Evolving one step, current time: ", alter !if (stopping_condition == "") then call evolve() @@ -1870,7 +1822,7 @@ function get_age(index_of_the_star, age) use timestep, only: alter implicit none integer:: index_of_the_star - double precision:: age + real(kindreal):: age integer:: get_age age = alter get_age = 0 @@ -1880,7 +1832,7 @@ function set_age(index_of_the_star, age) use timestep, only: alter implicit none integer:: index_of_the_star - double precision:: age + real(kindreal):: age integer:: set_age alter = age set_age = 0 @@ -1890,7 +1842,7 @@ function get_surface_velocity(index_of_the_star, surface_velocity) use genec, only: vequat implicit none integer:: index_of_the_star - double precision:: surface_velocity + real(kindreal):: surface_velocity integer:: get_surface_velocity surface_velocity = vequat get_surface_velocity = 0 @@ -1902,7 +1854,7 @@ function get_omegi_at_zone(index_of_the_star, zone, omegi_i) implicit none integer:: index_of_the_star integer:: get_omegi_at_zone - double precision:: omegi_i + real(kindreal):: omegi_i integer:: zone, i i = m - zone if (zone <= m) then @@ -1916,7 +1868,7 @@ function get_density_at_zone(index_of_the_star, zone, rho_i) implicit none integer:: index_of_the_star integer:: zone, i - double precision:: rho_i + real(kindreal):: rho_i integer:: get_density_at_zone i = m - zone if (zone <= m) then @@ -1930,7 +1882,7 @@ function set_density_at_zone(index_of_the_star, zone, rho_i) implicit none integer:: index_of_the_star integer:: zone, i - double precision:: rho_i + real(kindreal):: rho_i integer:: set_density_at_zone i = m - zone if (zone <= m) then @@ -1944,7 +1896,7 @@ function get_luminosity(index_of_the_star, luminosity) use caramodele, only: gls implicit none integer:: index_of_the_star - double precision:: luminosity + real(kindreal):: luminosity integer:: get_luminosity !luminosity = exp(s(m)) ! in cgs units, so erg/s? luminosity = gls @@ -1956,7 +1908,7 @@ function set_luminosity(index_of_the_star, luminosity) use caramodele, only: gls implicit none integer:: index_of_the_star - double precision:: luminosity + real(kindreal):: luminosity integer:: set_luminosity !luminosity = exp(s(m)) ! in cgs units, so erg/s? gls = luminosity @@ -1968,7 +1920,7 @@ function get_luminosity_at_zone(index_of_the_star, zone, lum_i) implicit none integer:: index_of_the_star integer:: zone, i - double precision:: lum_i + real(kindreal):: lum_i integer:: get_luminosity_at_zone i = m - zone if (zone <= m) then @@ -1983,7 +1935,7 @@ function set_luminosity_at_zone(index_of_the_star, zone, lum_i) implicit none integer:: index_of_the_star integer:: zone, i - double precision:: lum_i + real(kindreal):: lum_i integer:: set_luminosity_at_zone i = m - zone if (zone <= m) then @@ -1997,7 +1949,7 @@ function get_mass_fraction_at_zone(index_of_the_star, zone, dq_i) implicit none integer:: index_of_the_star integer:: zone, i - double precision:: dq_i + real(kindreal):: dq_i integer:: get_mass_fraction_at_zone i = m - zone if (i == 1) then @@ -2014,7 +1966,7 @@ function set_mass_fraction_at_zone(index_of_the_star, zone, dq_i) implicit none integer:: index_of_the_star integer:: zone, i - double precision:: dq_i + real(kindreal):: dq_i integer:: set_mass_fraction_at_zone i = m - zone if (i == 1) then @@ -2027,21 +1979,19 @@ function set_mass_fraction_at_zone(index_of_the_star, zone, dq_i) end function function get_mass(index_of_the_star, mass) - use inputparam, only: starname use caramodele, only: gms implicit none - double precision:: mass + real(kindreal):: mass integer:: get_mass, index_of_the_star mass = gms get_mass = 0 end function function set_mass(index_of_the_star, mass) - use helpers, only:mstar ! this is initial mass only? implicit none integer:: set_mass, index_of_the_star - double precision:: mass - mstar = mass + real(kindreal):: mass + InitialGenecStar%mstar = mass set_mass = 0 end function @@ -2049,7 +1999,7 @@ function get_mass_of_species(index_of_the_star, species, species_mass) implicit none integer:: index_of_the_star integer:: species - double precision:: species_mass + real(kindreal):: species_mass integer:: get_mass_of_species get_mass_of_species = 0 select case(species) @@ -2120,7 +2070,7 @@ function get_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, implicit none integer:: index_of_the_star integer:: species, zone, i - double precision:: Xj_i + real(kindreal):: Xj_i integer:: get_mass_fraction_of_species_at_zone i = m-zone if (zone <= m) then @@ -2195,7 +2145,7 @@ function set_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, implicit none integer:: index_of_the_star integer:: species, zone, i - double precision:: Xj_i + real(kindreal):: Xj_i integer:: set_mass_fraction_of_species_at_zone i = m - zone if (zone <= m) then @@ -2262,20 +2212,18 @@ function set_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, end function function get_metallicity(metallicity) - use helpers, only: zini implicit none - double precision:: metallicity + real(kindreal):: metallicity integer:: get_metallicity - metallicity = zini + metallicity = InitialGenecStar%zini get_metallicity = 0 end function function set_metallicity(metallicity) - use helpers, only: zini implicit none - double precision:: metallicity + real(kindreal):: metallicity integer:: set_metallicity - zini = metallicity + InitialGenecStar%zini = metallicity set_metallicity = 0 end function @@ -2284,8 +2232,7 @@ function get_mu_at_zone(index_of_the_star, zone, mu_i) implicit none integer:: index_of_the_star integer:: zone, i - integer:: get_mass_fraction_of_species_at_zone - double precision:: mu_i, X, Y3, Y + real(kindreal):: mu_i, X, Y3, Y integer:: err integer:: get_mu_at_zone i = (m - zone) @@ -2351,8 +2298,7 @@ function get_name_of_species(index_of_the_star, species, species_name) function get_mass_fraction_of_h_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_h_at_zone get_mass_fraction_of_h_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 1, zone, Xj_i) end function @@ -2361,8 +2307,7 @@ function get_mass_fraction_of_h_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_he3_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_he3_at_zone get_mass_fraction_of_he3_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 2, zone, Xj_i) end function @@ -2371,8 +2316,7 @@ function get_mass_fraction_of_he3_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_he_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_he_at_zone get_mass_fraction_of_he_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 3, zone, Xj_i) end function @@ -2381,8 +2325,7 @@ function get_mass_fraction_of_he_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_c12_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_c12_at_zone get_mass_fraction_of_c12_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 4, zone, Xj_i) end function @@ -2391,8 +2334,7 @@ function get_mass_fraction_of_c12_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_c13_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_c13_at_zone get_mass_fraction_of_c13_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 5, zone, Xj_i) end function @@ -2401,8 +2343,7 @@ function get_mass_fraction_of_c13_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_n14_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_n14_at_zone get_mass_fraction_of_n14_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 6, zone, Xj_i) end function @@ -2411,8 +2352,7 @@ function get_mass_fraction_of_n14_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_n15_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_n15_at_zone get_mass_fraction_of_n15_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 7, zone, Xj_i) end function @@ -2421,8 +2361,7 @@ function get_mass_fraction_of_n15_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_o16_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_o16_at_zone get_mass_fraction_of_o16_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 8, zone, Xj_i) end function @@ -2431,8 +2370,7 @@ function get_mass_fraction_of_o16_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_o17_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_o17_at_zone get_mass_fraction_of_o17_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 9, zone, Xj_i) end function @@ -2441,8 +2379,7 @@ function get_mass_fraction_of_o17_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_o18_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_o18_at_zone get_mass_fraction_of_o18_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 10, zone, Xj_i) end function @@ -2451,8 +2388,7 @@ function get_mass_fraction_of_o18_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_ne20_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_ne20_at_zone get_mass_fraction_of_ne20_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 11, zone, Xj_i) end function @@ -2461,8 +2397,7 @@ function get_mass_fraction_of_ne20_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_ne22_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_ne22_at_zone get_mass_fraction_of_ne22_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 12, zone, Xj_i) end function @@ -2471,8 +2406,7 @@ function get_mass_fraction_of_ne22_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_mg24_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_mg24_at_zone get_mass_fraction_of_mg24_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 13, zone, Xj_i) end function @@ -2481,8 +2415,7 @@ function get_mass_fraction_of_mg24_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_mg25_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_mg25_at_zone get_mass_fraction_of_mg25_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 14, zone, Xj_i) end function @@ -2491,8 +2424,7 @@ function get_mass_fraction_of_mg25_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_mg26_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_mg26_at_zone get_mass_fraction_of_mg26_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 15, zone, Xj_i) end function @@ -2501,8 +2433,7 @@ function get_mass_fraction_of_mg26_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_c14_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_c14_at_zone get_mass_fraction_of_c14_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 16, zone, Xj_i) end function @@ -2511,8 +2442,7 @@ function get_mass_fraction_of_c14_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_f18_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_f18_at_zone get_mass_fraction_of_f18_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 17, zone, Xj_i) end function @@ -2521,8 +2451,7 @@ function get_mass_fraction_of_f18_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_f19_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_f19_at_zone get_mass_fraction_of_f19_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 18, zone, Xj_i) end function @@ -2531,8 +2460,7 @@ function get_mass_fraction_of_f19_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_ne21_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_ne21_at_zone get_mass_fraction_of_ne21_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 19, zone, Xj_i) end function @@ -2541,8 +2469,7 @@ function get_mass_fraction_of_ne21_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_na23_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_na23_at_zone get_mass_fraction_of_na23_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 20, zone, Xj_i) end function @@ -2551,8 +2478,7 @@ function get_mass_fraction_of_na23_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_al26_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_al26_at_zone get_mass_fraction_of_al26_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 21, zone, Xj_i) end function @@ -2561,8 +2487,7 @@ function get_mass_fraction_of_al26_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_al27_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_al27_at_zone get_mass_fraction_of_al27_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 22, zone, Xj_i) end function @@ -2571,8 +2496,7 @@ function get_mass_fraction_of_al27_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_si28_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_si28_at_zone get_mass_fraction_of_si28_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 23, zone, Xj_i) end function @@ -2581,8 +2505,7 @@ function get_mass_fraction_of_si28_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_neut_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_neut_at_zone get_mass_fraction_of_neut_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 24, zone, Xj_i) end function @@ -2591,8 +2514,7 @@ function get_mass_fraction_of_neut_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_prot_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_prot_at_zone get_mass_fraction_of_prot_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 25, zone, Xj_i) end function @@ -2601,8 +2523,7 @@ function get_mass_fraction_of_prot_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_bid_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_bid_at_zone get_mass_fraction_of_bid_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 26, zone, Xj_i) end function @@ -2611,8 +2532,7 @@ function get_mass_fraction_of_bid_at_zone(index_of_the_star, zone, Xj_i) function get_mass_fraction_of_bid1_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: get_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: get_mass_fraction_of_bid1_at_zone get_mass_fraction_of_bid1_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 27, zone, Xj_i) end function @@ -2621,8 +2541,7 @@ function get_mass_fraction_of_bid1_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_h_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_h_at_zone set_mass_fraction_of_h_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 1, zone, Xj_i) end function @@ -2631,8 +2550,7 @@ function set_mass_fraction_of_h_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_he3_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_he3_at_zone set_mass_fraction_of_he3_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 2, zone, Xj_i) end function @@ -2641,8 +2559,7 @@ function set_mass_fraction_of_he3_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_he_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_he_at_zone set_mass_fraction_of_he_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 3, zone, Xj_i) end function @@ -2651,8 +2568,7 @@ function set_mass_fraction_of_he_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_c12_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_c12_at_zone set_mass_fraction_of_c12_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 4, zone, Xj_i) end function @@ -2661,8 +2577,7 @@ function set_mass_fraction_of_c12_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_c13_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_c13_at_zone set_mass_fraction_of_c13_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 5, zone, Xj_i) end function @@ -2671,8 +2586,7 @@ function set_mass_fraction_of_c13_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_n14_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_n14_at_zone set_mass_fraction_of_n14_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 6, zone, Xj_i) end function @@ -2681,8 +2595,7 @@ function set_mass_fraction_of_n14_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_n15_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_n15_at_zone set_mass_fraction_of_n15_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 7, zone, Xj_i) end function @@ -2691,8 +2604,7 @@ function set_mass_fraction_of_n15_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_o16_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_o16_at_zone set_mass_fraction_of_o16_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 8, zone, Xj_i) end function @@ -2701,8 +2613,7 @@ function set_mass_fraction_of_o16_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_o17_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_o17_at_zone set_mass_fraction_of_o17_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 9, zone, Xj_i) end function @@ -2711,8 +2622,7 @@ function set_mass_fraction_of_o17_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_o18_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_o18_at_zone set_mass_fraction_of_o18_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 10, zone, Xj_i) end function @@ -2721,8 +2631,7 @@ function set_mass_fraction_of_o18_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_ne20_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_ne20_at_zone set_mass_fraction_of_ne20_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 11, zone, Xj_i) end function @@ -2731,8 +2640,7 @@ function set_mass_fraction_of_ne20_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_ne22_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_ne22_at_zone set_mass_fraction_of_ne22_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 12, zone, Xj_i) end function @@ -2741,8 +2649,7 @@ function set_mass_fraction_of_ne22_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_mg24_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_mg24_at_zone set_mass_fraction_of_mg24_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 13, zone, Xj_i) end function @@ -2751,8 +2658,7 @@ function set_mass_fraction_of_mg24_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_mg25_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_mg25_at_zone set_mass_fraction_of_mg25_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 14, zone, Xj_i) end function @@ -2761,8 +2667,7 @@ function set_mass_fraction_of_mg25_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_mg26_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_mg26_at_zone set_mass_fraction_of_mg26_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 15, zone, Xj_i) end function @@ -2771,8 +2676,7 @@ function set_mass_fraction_of_mg26_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_c14_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_c14_at_zone set_mass_fraction_of_c14_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 16, zone, Xj_i) end function @@ -2781,8 +2685,7 @@ function set_mass_fraction_of_c14_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_f18_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_f18_at_zone set_mass_fraction_of_f18_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 17, zone, Xj_i) end function @@ -2791,8 +2694,7 @@ function set_mass_fraction_of_f18_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_f19_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_f19_at_zone set_mass_fraction_of_f19_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 18, zone, Xj_i) end function @@ -2801,8 +2703,7 @@ function set_mass_fraction_of_f19_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_ne21_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_ne21_at_zone set_mass_fraction_of_ne21_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 19, zone, Xj_i) end function @@ -2811,8 +2712,7 @@ function set_mass_fraction_of_ne21_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_na23_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_na23_at_zone set_mass_fraction_of_na23_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 20, zone, Xj_i) end function @@ -2821,8 +2721,7 @@ function set_mass_fraction_of_na23_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_al26_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_al26_at_zone set_mass_fraction_of_al26_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 21, zone, Xj_i) end function @@ -2831,8 +2730,7 @@ function set_mass_fraction_of_al26_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_al27_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_al27_at_zone set_mass_fraction_of_al27_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 22, zone, Xj_i) end function @@ -2841,8 +2739,7 @@ function set_mass_fraction_of_al27_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_si28_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_si28_at_zone set_mass_fraction_of_si28_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 23, zone, Xj_i) end function @@ -2851,8 +2748,7 @@ function set_mass_fraction_of_si28_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_neut_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_neut_at_zone set_mass_fraction_of_neut_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 24, zone, Xj_i) end function @@ -2861,8 +2757,7 @@ function set_mass_fraction_of_neut_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_prot_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_prot_at_zone set_mass_fraction_of_prot_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 25, zone, Xj_i) end function @@ -2871,8 +2766,7 @@ function set_mass_fraction_of_prot_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_bid_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_bid_at_zone set_mass_fraction_of_bid_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 26, zone, Xj_i) end function @@ -2881,16 +2775,17 @@ function set_mass_fraction_of_bid_at_zone(index_of_the_star, zone, Xj_i) function set_mass_fraction_of_bid1_at_zone(index_of_the_star, zone, Xj_i) implicit none integer:: index_of_the_star, zone - double precision:: Xj_i - integer:: set_mass_fraction_of_species_at_zone + real(kindreal):: Xj_i integer:: set_mass_fraction_of_bid1_at_zone set_mass_fraction_of_bid1_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 27, zone, Xj_i) end function -function get_number_of_particles() +function get_number_of_particles(n) implicit none + integer:: n integer:: get_number_of_particles - get_number_of_particles = -1 + n = 1 + get_number_of_particles = 0 end function function get_number_of_species(index_of_the_star, n_species) @@ -2923,31 +2818,21 @@ function get_firstlast_species_number(first, last) end function function get_number_of_zones(index_of_the_star, n_zones) - use inputparam, only: starname use strucmod, only: m implicit none integer:: index_of_the_star integer:: n_zones integer:: get_number_of_zones - !if (char(index_of_the_star) /= starname) then - ! get_number_of_zones = -1 - ! return - !end if n_zones = m get_number_of_zones = 0 end function function set_number_of_zones(index_of_the_star, n_zones) - use inputparam, only: starname use strucmod, only: m implicit none integer:: index_of_the_star integer:: n_zones integer:: set_number_of_zones - !if (char(index_of_the_star) /= starname) then - ! get_number_of_zones = -1 - ! return - !end if m = n_zones set_number_of_zones = 0 end function @@ -2968,7 +2853,7 @@ function get_pressure_at_zone(index_of_the_star, zone, P_i) implicit none integer:: index_of_the_star integer:: zone, i - double precision:: P_i + real(kindreal):: P_i integer:: get_pressure_at_zone if (zone <= m) then i = m - zone @@ -2982,7 +2867,7 @@ function get_pressure_at_zone(index_of_the_star, zone, P_i) ! implicit none ! integer:: index_of_the_star ! integer:: zone, i -! double precision:: P_i +! real(kindreal):: P_i ! integer:: set_pressure_at_zone ! if (zone <= m) then ! i = m - zone @@ -2996,7 +2881,7 @@ function get_radius(index_of_the_star, am_radius) !use strucmod, only: r, m implicit none integer:: index_of_the_star - double precision:: am_radius + real(kindreal):: am_radius integer:: get_radius am_radius = 10**radius !radius = exp(r(1)) ! in cm @@ -3008,7 +2893,7 @@ function set_radius(index_of_the_star, am_radius) !use strucmod, only: r, m implicit none integer:: index_of_the_star - double precision:: am_radius + real(kindreal):: am_radius integer:: set_radius radius = log10(am_radius) set_radius = 0 @@ -3019,7 +2904,7 @@ function get_radius_at_zone(index_of_the_star, zone, R_i) implicit none integer:: index_of_the_star integer:: zone, i - double precision:: R_i + real(kindreal):: R_i integer:: get_radius_at_zone i = m - zone if (zone <= m) then @@ -3033,7 +2918,7 @@ function set_radius_at_zone(index_of_the_star, zone, R_i) implicit none integer:: index_of_the_star integer:: zone, i - double precision:: R_i + real(kindreal):: R_i integer:: set_radius_at_zone i = m - zone if (zone <= m) then @@ -3054,7 +2939,7 @@ function get_temperature(index_of_the_star, temperature) use caramodele, only: teff implicit none integer:: index_of_the_star - double precision:: temperature + real(kindreal):: temperature integer:: get_temperature temperature = teff get_temperature = 0 @@ -3065,7 +2950,7 @@ function get_temperature_at_zone(index_of_the_star, zone, T_i) implicit none integer:: index_of_the_star integer:: zone, i - double precision:: T_i + real(kindreal):: T_i integer:: get_temperature_at_zone i = m - zone if (zone <= m) then @@ -3081,7 +2966,7 @@ function get_time_step(index_of_the_star, time_step) use timestep, only: dzeitj implicit none integer:: index_of_the_star - double precision:: time_step + real(kindreal):: time_step integer:: get_time_step time_step = dzeitj get_time_step = 0 @@ -3090,23 +2975,32 @@ function get_time_step(index_of_the_star, time_step) function get_time(time) use timestep, only: alter implicit none - double precision:: time + real(kindreal):: time integer:: get_time time = alter get_time = 0 end function +function star_to_genec() + ! copy values from StarInGenec to Genec +end function + +function star_from_genec() + ! copy values to StarInGenec from Genec +end function + function new_particle(index_of_the_star, mass, metallicity, am_starname) - use helpers, only: starname, mstar, zini implicit none integer:: index_of_the_star, key - double precision:: mass, metallicity + real(kindreal):: mass, metallicity integer:: new_particle character(len=12):: am_starname - starname = am_starname !'AmuseStar'!write(starname, '(i10.10)') key - index_of_the_star = 1 - mstar = mass - zini = metallicity + number_of_stars = number_of_stars + 1 + InitialGenecStar%starname = am_starname + InitialGenecStar%index_of_the_star = number_of_stars + InitialGenecStar%mstar = mass + InitialGenecStar%zini = metallicity + InitialGenecStar%idefaut = 1 new_particle = 0 end function @@ -3131,7 +3025,7 @@ function recommit_particles() function set_genec_path(path) use evol, only: input_dir implicit none - character(len = :), allocatable:: path + character(len=200):: path integer:: set_genec_path input_dir = path @@ -3139,12 +3033,9 @@ function set_genec_path(path) end function function set_starname(index_of_the_star) - use helpers, only:starname implicit none integer:: set_starname, index_of_the_star - ! Only allow this at the initialisation time! - starname = 'AmuseStar' - write(starname, '(i10.10)') index_of_the_star + InitialGenecStar%starname = 'AmuseStar' set_starname = 0 end function @@ -3153,7 +3044,7 @@ function set_temperature_at_zone(index_of_the_star, zone, T_i) implicit none integer:: index_of_the_star integer:: zone, i - double precision:: T_i + real(kindreal):: T_i integer:: set_temperature_at_zone i = m - zone if (zone <= m) then @@ -3162,3 +3053,5 @@ function set_temperature_at_zone(index_of_the_star, zone, T_i) set_temperature_at_zone = 0 end function + +end module AmuseInterface diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 3d10536346..af169ae330 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -61,6 +61,8 @@ class GenecInterface( .. [#] The Geneva Stellar Evolution Group """ + use_modules = ['AmuseInterface', ] + def __init__(self, **keyword_arguments): CodeInterface.__init__( self, name_of_the_worker="genec_worker", **keyword_arguments) @@ -98,23 +100,23 @@ def set_genec_path(): """ return function - @legacy_function - def read_genec_model(): - """ - Read a previously saved GENEC model - """ - function = LegacyFunctionSpecification() - function.can_handle_array = False - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.OUT, - description="index of the star", - ) - function.addParameter( - 'cardfilename', dtype='string', direction=function.IN, - description="GENEC input card", - ) - function.result_type = 'int32' - return function + # @legacy_function + # def read_genec_model(): + # """ + # Read a previously saved GENEC model + # """ + # function = LegacyFunctionSpecification() + # function.can_handle_array = False + # function.addParameter( + # 'index_of_the_star', dtype='int32', direction=function.OUT, + # description="index of the star", + # ) + # function.addParameter( + # 'cardfilename', dtype='string', direction=function.IN, + # description="GENEC input card", + # ) + # function.result_type = 'int32' + # return function # Parameters @legacy_function From 77e25fe5cd6309d21f98b334554c4af8a13bc9d8 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 14 Dec 2022 09:08:14 +0100 Subject: [PATCH 43/72] Interface updates --- src/amuse/community/genec/Makefile | 2 +- src/amuse/community/genec/interface.f90 | 337 +++++++++++++----------- src/amuse/community/genec/interface.py | 299 +++++++++++++++------ 3 files changed, 409 insertions(+), 229 deletions(-) diff --git a/src/amuse/community/genec/Makefile b/src/amuse/community/genec/Makefile index 55608866b9..47dc7a4bf2 100644 --- a/src/amuse/community/genec/Makefile +++ b/src/amuse/community/genec/Makefile @@ -11,7 +11,7 @@ FC = $(MPIFC) LDFLAGS += -lm $(MUSE_LD_FLAGS) FCFLAGS += -Isrc/GENEC/code -# FCFLAGS += -O0 +FCFLAGS += -O0 OBJS = interface.o diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 390cb53a79..5e8f86f557 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1,11 +1,16 @@ module AmuseInterface - use helpers, only: InitialGenecStar,GenecStar,genec_star + use storage, only:& + InitialGenecStar,InitialNetwork,& + GenecStar,genec_star + use helpers, only:& + copy_to_genec_star,copy_from_genec_star use evol, only: kindreal,ldi,npondcouche - type(genec_star) :: StarInGenec - type(genec_star) :: BackupStarInGenec + type(genec_star) :: BackupBackupGenecStar + type(genec_star) :: BackupGenecStar integer :: number_of_stars = 0 - public:: StarInGenec,BackupStarInGenec,number_of_stars + integer :: evolve_steps + public:: BackupGenecStar,number_of_stars contains function restore_star() @@ -19,10 +24,12 @@ function initialize_code() use genec, only: initialise_genec use evol, only: input_dir use inputparam, only: libgenec + use io_definitions implicit none integer:: initialize_code libgenec = .true. + !io_logs = 6 input_dir = "./src/GENEC/code" call initialise_genec() @@ -72,11 +79,10 @@ function get_min_timestep_stop_condition(min_timestep_stop_condition) end function function get_par_n_snap(n_snap_out) - use inputparam, only: n_snap implicit none integer:: n_snap_out integer:: get_par_n_snap - n_snap_out = n_snap + n_snap_out = GenecStar%n_snap get_par_n_snap = 0 end function @@ -90,29 +96,26 @@ function set_par_n_snap(n_snap_in) end function function get_par_ipoly(par_ipoly) - use inputparam, only: ipoly implicit none integer:: par_ipoly integer:: get_par_ipoly - par_ipoly = ipoly + par_ipoly = InitialGenecStar%ipoly get_par_ipoly = 0 end function function set_par_ipoly(par_ipoly) - use inputparam, only: ipoly implicit none integer:: par_ipoly integer:: set_par_ipoly - ipoly = par_ipoly + InitialGenecStar%ipoly = par_ipoly set_par_ipoly = 0 end function function get_par_nwseq(par_nwseq) - use inputparam, only: nwseq implicit none integer:: par_nwseq integer:: get_par_nwseq - par_nwseq = nwseq + par_nwseq = GenecStar%nwseq get_par_nwseq = 0 end function @@ -126,11 +129,10 @@ function set_par_nwseq(par_nwseq) end function function get_par_modanf(par_modanf) - use inputparam, only: modanf implicit none integer:: par_modanf integer:: get_par_modanf - par_modanf = modanf + par_modanf = GenecStar%modanf get_par_modanf = 0 end function @@ -144,11 +146,10 @@ function set_par_modanf(par_modanf) end function function get_par_nzmod(par_nzmod) - use inputparam, only: nzmod implicit none integer:: par_nzmod integer:: get_par_nzmod - par_nzmod = nzmod + par_nzmod = GenecStar%nzmod get_par_nzmod = 0 end function @@ -162,11 +163,10 @@ function set_par_nzmod(par_nzmod) end function function get_par_irot(par_irot) - use inputparam, only: irot implicit none integer:: par_irot integer:: get_par_irot - par_irot = irot + par_irot = GenecStar%irot get_par_irot = 0 end function @@ -180,11 +180,10 @@ function set_par_irot(par_irot) end function function get_par_isol(par_isol) - use inputparam, only: isol implicit none integer:: par_isol integer:: get_par_isol - par_isol = isol + par_isol = GenecStar%isol get_par_isol = 0 end function @@ -198,11 +197,10 @@ function set_par_isol(par_isol) end function function get_par_imagn(par_imagn) - use inputparam, only: imagn implicit none integer:: par_imagn integer:: get_par_imagn - par_imagn = imagn + par_imagn = GenecStar%imagn get_par_imagn = 0 end function @@ -216,11 +214,10 @@ function set_par_imagn(par_imagn) end function function get_par_ialflu(par_ialflu) - use inputparam, only: ialflu implicit none integer:: par_ialflu integer:: get_par_ialflu - par_ialflu = ialflu + par_ialflu = GenecStar%ialflu get_par_ialflu = 0 end function @@ -234,11 +231,10 @@ function set_par_ialflu(par_ialflu) end function function get_par_ianiso(par_ianiso) - use inputparam, only: ianiso implicit none integer:: par_ianiso integer:: get_par_ianiso - par_ianiso = ianiso + par_ianiso = GenecStar%ianiso get_par_ianiso = 0 end function @@ -252,11 +248,10 @@ function set_par_ianiso(par_ianiso) end function function get_par_ipop3(par_ipop3) - use inputparam, only: ipop3 implicit none integer:: par_ipop3 integer:: get_par_ipop3 - par_ipop3 = ipop3 + par_ipop3 = GenecStar%ipop3 get_par_ipop3 = 0 end function @@ -270,11 +265,10 @@ function set_par_ipop3(par_ipop3) end function function get_par_ibasnet(par_ibasnet) - use inputparam, only: ibasnet implicit none integer:: par_ibasnet integer:: get_par_ibasnet - par_ibasnet = ibasnet + par_ibasnet = GenecStar%ibasnet get_par_ibasnet = 0 end function @@ -287,30 +281,11 @@ function set_par_ibasnet(par_ibasnet) set_par_ibasnet = 0 end function -function get_par_phase(par_phase) - use inputparam, only: phase - implicit none - integer:: par_phase - integer:: get_par_phase - par_phase = phase - get_par_phase = 0 -end function - -function set_par_phase(par_phase) - use inputparam, only: phase - implicit none - integer:: par_phase - integer:: set_par_phase - phase = par_phase - set_par_phase = 0 -end function - function get_par_iopac(par_iopac) - use inputparam, only: iopac implicit none integer:: par_iopac integer:: get_par_iopac - par_iopac = iopac + par_iopac = GenecStar%iopac get_par_iopac = 0 end function @@ -324,11 +299,10 @@ function set_par_iopac(par_iopac) end function function get_par_ikappa(par_ikappa) - use inputparam, only: ikappa implicit none integer:: par_ikappa integer:: get_par_ikappa - par_ikappa = ikappa + par_ikappa = GenecStar%ikappa get_par_ikappa = 0 end function @@ -783,11 +757,10 @@ function get_par_idebug(par_idebug) end function function set_par_idebug(par_idebug) - use inputparam, only: idebug implicit none integer:: par_idebug integer:: set_par_idebug - idebug = par_idebug + GenecStar%idebug = par_idebug set_par_idebug = 0 end function @@ -990,20 +963,18 @@ function set_par_stop_deg(par_stop_deg) end function function get_par_index_poly(par_index_poly) - use inputparam, only: index_poly implicit none real(kindreal):: par_index_poly integer:: get_par_index_poly - par_index_poly = index_poly + par_index_poly = InitialGenecStar%n get_par_index_poly = 0 end function function set_par_index_poly(par_index_poly) - use inputparam, only: index_poly implicit none real(kindreal):: par_index_poly integer:: set_par_index_poly - index_poly = par_index_poly + InitialGenecStar%n = par_index_poly set_par_index_poly = 0 end function @@ -1678,8 +1649,8 @@ function get_par_starname(par_starname) implicit none character(256):: par_starname integer:: get_par_starname - if (StarInGenec%initialised) then - par_starname = StarInGenec%starname + if (GenecStar%initialised) then + par_starname = GenecStar%starname else par_starname = InitialGenecStar%starname endif @@ -1697,6 +1668,13 @@ function set_par_starname(par_starname) ! **** End Parameters +function finalize_stellar_model() + implicit none + integer:: finalize_stellar_model + call copy_to_genec_star(GenecStar) + finalize_stellar_model = 0 +end function + function commit_parameters() implicit none integer:: commit_parameters @@ -1712,11 +1690,15 @@ function commit_particles() integer:: commit_particles ! makeini will actually override some things from set_defaults now! FIXME call make_initial_star() - nzmod = 1 + call copy_from_genec_star(GenecStar) + + !nzmod = 1 !write(*,*) 'makeini done' !call OpenAll() !write(*,*) 'OpenAll done' call initialise_star() + !call copy_network_to_star(InitialNetwork, GenecStar) + call copy_to_genec_star(GenecStar) !write(*,*) 'initialise_star done' commit_particles = 0 end function @@ -1734,10 +1716,9 @@ function evolve_model(end_time) real(kindreal):: end_time integer:: evolve_model !stopping_condition = "" - type(genec_star) :: PreviousStarInGenec - PreviousStarInGenec = StarInGenec + do while (alter < end_time) - !if (stopping_condition == "") then + !if (stopping_condition == "") then write(*,*) "Current time: ", alter, ", evolving to: ", end_time evolve_model = evolve_one_step(0) end do @@ -1775,14 +1756,28 @@ function evolve_one_step(index_of_the_star) !original_nzmod = nzmod nzmod = 1 n_snap = 0 - end_at_phase=4 - end_at_model=0 + !end_at_phase=4 + !end_at_model=0 !write(*,*) "Evolving one step, current time: ", alter !if (stopping_condition == "") then call evolve() !if (stopping_condition /= "") return call finalise() + if (GenecStar%stopped .and. mod(GenecStar%nwmd,10) <= 5) then + ! rollback and don't increase timestep + GenecStar = BackupGenecStar + GenecStar%xcn = 1.0 + elseif (GenecStar%stopped) then + GenecStar = BackupBackupGenecStar + BackupGenecStar = BackupBackupGenecStar + GenecStar%xcn = 1.0 + endif + if (mod(GenecStar%nwmd, 10)==0) then + ! move backups along + BackupBackupGenecStar = BackupGenecStar + BackupGenecStar = GenecStar + endif !call OpenAll() !call initialise_star() ! will set modell to 1 !write(*,*) "Evolved one step, current time: ", alter @@ -1795,12 +1790,6 @@ function evolve_one_step(index_of_the_star) evolve_one_step = 0 end function -function finalize_stellar_model() - implicit none - integer:: finalize_stellar_model - finalize_stellar_model = 0 -end function - function write_genec_model() !use inputparam, only: modanf !use WriteSaveClose, only: OpenAll @@ -1819,12 +1808,11 @@ function write_genec_model() end function function get_age(index_of_the_star, age) - use timestep, only: alter implicit none integer:: index_of_the_star real(kindreal):: age integer:: get_age - age = alter + age = GenecStar%alter get_age = 0 end function @@ -1849,29 +1837,27 @@ function get_surface_velocity(index_of_the_star, surface_velocity) end function function get_omegi_at_zone(index_of_the_star, zone, omegi_i) - use rotmod, only: omegi - use strucmod, only: m implicit none integer:: index_of_the_star integer:: get_omegi_at_zone real(kindreal):: omegi_i integer:: zone, i - i = m - zone - if (zone <= m) then - omegi_i = omegi(i) + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + omegi_i = GenecStar%omegi(i) end if get_omegi_at_zone = 0 end function function get_density_at_zone(index_of_the_star, zone, rho_i) - use strucmod, only: rho, m + use strucmod, only: rho implicit none integer:: index_of_the_star integer:: zone, i real(kindreal):: rho_i integer:: get_density_at_zone - i = m - zone - if (zone <= m) then + i = GenecStar%m - zone + if (zone <= GenecStar%m) then rho_i = exp(rho(i)) end if get_density_at_zone = 0 @@ -1892,14 +1878,12 @@ function set_density_at_zone(index_of_the_star, zone, rho_i) end function function get_luminosity(index_of_the_star, luminosity) - !use strucmod, only: s, m - use caramodele, only: gls implicit none integer:: index_of_the_star real(kindreal):: luminosity integer:: get_luminosity !luminosity = exp(s(m)) ! in cgs units, so erg/s? - luminosity = gls + luminosity = GenecStar%gls get_luminosity = 0 end function @@ -1922,10 +1906,10 @@ function get_luminosity_at_zone(index_of_the_star, zone, lum_i) integer:: zone, i real(kindreal):: lum_i integer:: get_luminosity_at_zone - i = m - zone - if (zone <= m) then + i = GenecStar%m - zone + if (zone <= GenecStar%m) then !lum_i = exp(s(zone+1)) - lum_i = exp(s(i)) - 1 + lum_i = exp(GenecStar%s(i)) - 1 end if get_luminosity_at_zone = 0 end function @@ -1945,18 +1929,17 @@ function set_luminosity_at_zone(index_of_the_star, zone, lum_i) end function function get_mass_fraction_at_zone(index_of_the_star, zone, dq_i) - use strucmod, only: q, m implicit none integer:: index_of_the_star integer:: zone, i real(kindreal):: dq_i integer:: get_mass_fraction_at_zone - i = m - zone + i = GenecStar%m - zone if (i == 1) then - dq_i = exp(q(i)) - else if (i <= m) then + dq_i = exp(GenecStar%q(i)) + else if (i <= GenecStar%m) then !dq_i = 1-exp(q(zone+1)) - dq_i = (exp(q(i)) - exp(q(i-1))) + dq_i = (exp(GenecStar%q(i)) - exp(GenecStar%q(i-1))) end if get_mass_fraction_at_zone = 0 end function @@ -1983,7 +1966,7 @@ function get_mass(index_of_the_star, mass) implicit none real(kindreal):: mass integer:: get_mass, index_of_the_star - mass = gms + mass = GenecStar%gms get_mass = 0 end function @@ -2063,72 +2046,68 @@ function get_mass_of_species(index_of_the_star, species, species_mass) end function function get_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) - use strucmod, only: m - use abundmod, only: & - x,y3,y,xc12,xc13,xc14,xn14,xn15,xo16,xo17,xo18,xf18,xf19,xne20,xne21,xne22,xna23,xmg24,& - xmg25,xmg26,xal26,xal27,xsi28,xprot,xneut,xbid,xbid1 implicit none integer:: index_of_the_star integer:: species, zone, i real(kindreal):: Xj_i integer:: get_mass_fraction_of_species_at_zone - i = m-zone - if (zone <= m) then + i = GenecStar%m-zone + if (zone <= GenecStar%m) then select case(species) case(1) - Xj_i = x(i) + Xj_i = GenecStar%x(i) case(2) - Xj_i = y3(i) + Xj_i = GenecStar%y3(i) case(3) - Xj_i = y(i) + Xj_i = GenecStar%y(i) case(4) - Xj_i = xc12(i) + Xj_i = GenecStar%xc12(i) case(5) - Xj_i = xc13(i) + Xj_i = GenecStar%xc13(i) case(6) - Xj_i = xn14(i) + Xj_i = GenecStar%xn14(i) case(7) - Xj_i = xn15(i) + Xj_i = GenecStar%xn15(i) case(8) - Xj_i = xo16(i) + Xj_i = GenecStar%xo16(i) case(9) - Xj_i = xo17(i) + Xj_i = GenecStar%xo17(i) case(10) - Xj_i = xo18(i) + Xj_i = GenecStar%xo18(i) case(11) - Xj_i = xne20(i) + Xj_i = GenecStar%xne20(i) case(12) - Xj_i = xne22(i) + Xj_i = GenecStar%xne22(i) case(13) - Xj_i = xmg24(i) + Xj_i = GenecStar%xmg24(i) case(14) - Xj_i = xmg25(i) + Xj_i = GenecStar%xmg25(i) case(15) - Xj_i = xmg26(i) + Xj_i = GenecStar%xmg26(i) case(16) - Xj_i = xc14(i) + Xj_i = GenecStar%xc14(i) case(17) - Xj_i = xf18(i) + Xj_i = GenecStar%xf18(i) case(18) - Xj_i = xf19(i) + Xj_i = GenecStar%xf19(i) case(19) - Xj_i = xne21(i) + Xj_i = GenecStar%xne21(i) case(20) - Xj_i = xna23(i) + Xj_i = GenecStar%xna23(i) case(21) - Xj_i = xal26(i) + Xj_i = GenecStar%xal26(i) case(22) - Xj_i = xal27(i) + Xj_i = GenecStar%xal27(i) case(23) - Xj_i = xsi28(i) + Xj_i = GenecStar%xsi28(i) case(24) - Xj_i = xneut(i) + Xj_i = GenecStar%xneut(i) case(25) - Xj_i = xprot(i) + Xj_i = GenecStar%xprot(i) case(26) - Xj_i = xbid(i) + Xj_i = GenecStar%xbid(i) case(27) - Xj_i = xbid1(i) + Xj_i = GenecStar%xbid1(i) case default Xj_i = 0 end select @@ -2235,8 +2214,8 @@ function get_mu_at_zone(index_of_the_star, zone, mu_i) real(kindreal):: mu_i, X, Y3, Y integer:: err integer:: get_mu_at_zone - i = (m - zone) - if (zone <= m) then + i = (GenecStar%m - zone) + if (zone <= GenecStar%m) then mu_i = 0.0d0 err = get_mass_fraction_of_species_at_zone(index_of_the_star, 1, zone, X) err = get_mass_fraction_of_species_at_zone(index_of_the_star, 2, zone, Y3) @@ -2818,12 +2797,11 @@ function get_firstlast_species_number(first, last) end function function get_number_of_zones(index_of_the_star, n_zones) - use strucmod, only: m implicit none integer:: index_of_the_star integer:: n_zones integer:: get_number_of_zones - n_zones = m + n_zones = GenecStar%m get_number_of_zones = 0 end function @@ -2838,26 +2816,24 @@ function set_number_of_zones(index_of_the_star, n_zones) end function function get_firstlast_zone(first, last) - use strucmod, only: m implicit none !integer:: index_of_the_star integer:: first, last integer:: get_firstlast_zone first = 0 - last = m-1 + last = GenecStar%m-1 get_firstlast_zone = 0 end function function get_pressure_at_zone(index_of_the_star, zone, P_i) - use strucmod, only: p, m implicit none integer:: index_of_the_star integer:: zone, i real(kindreal):: P_i integer:: get_pressure_at_zone - if (zone <= m) then - i = m - zone - P_i = exp(p(i)) + if (zone <= GenecStar%m) then + i = GenecStar%m - zone + P_i = exp(GenecStar%p(i)) end if get_pressure_at_zone = 0 end function @@ -2883,7 +2859,7 @@ function get_radius(index_of_the_star, am_radius) integer:: index_of_the_star real(kindreal):: am_radius integer:: get_radius - am_radius = 10**radius + am_radius = 10**GenecStar%radius !radius = exp(r(1)) ! in cm get_radius = 0 end function @@ -2899,16 +2875,54 @@ function set_radius(index_of_the_star, am_radius) set_radius = 0 end function +function get_nabla_rad_at_zone(index_of_the_star, zone, nabla_rad) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: nabla_rad + integer:: get_nabla_rad_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + nabla_rad = GenecStar%Nabla_rad(i) + end if + get_nabla_rad_at_zone = 0 +end function + +function get_nabla_ad_at_zone(index_of_the_star, zone, nabla_ad) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: nabla_ad + integer:: get_nabla_ad_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + nabla_ad = GenecStar%Nabla_ad(i) + end if + get_nabla_ad_at_zone = 0 +end function + +function get_nabla_mu_at_zone(index_of_the_star, zone, nabla_mu) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: nabla_mu + integer:: get_nabla_mu_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + nabla_mu = GenecStar%Nabla_mu(i) + end if + get_nabla_mu_at_zone = 0 +end function + function get_radius_at_zone(index_of_the_star, zone, R_i) - use strucmod, only: r, m implicit none integer:: index_of_the_star integer:: zone, i real(kindreal):: R_i integer:: get_radius_at_zone - i = m - zone - if (zone <= m) then - R_i = exp(r(i)) ! in cm + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + R_i = exp(GenecStar%r(i)) ! in cm end if get_radius_at_zone = 0 end function @@ -2941,7 +2955,7 @@ function get_temperature(index_of_the_star, temperature) integer:: index_of_the_star real(kindreal):: temperature integer:: get_temperature - temperature = teff + temperature = GenecStar%teff get_temperature = 0 end function @@ -2968,7 +2982,7 @@ function get_time_step(index_of_the_star, time_step) integer:: index_of_the_star real(kindreal):: time_step integer:: get_time_step - time_step = dzeitj + time_step = GenecStar%dzeitj get_time_step = 0 end function @@ -2982,11 +2996,11 @@ function get_time(time) end function function star_to_genec() - ! copy values from StarInGenec to Genec + ! copy values from GenecStar to Genec end function function star_from_genec() - ! copy values to StarInGenec from Genec + ! copy values to GenecStar from Genec end function function new_particle(index_of_the_star, mass, metallicity, am_starname) @@ -3012,8 +3026,6 @@ function recommit_parameters() end function function recommit_particles() - use genec, only: finalise, initialise_star - use WriteSaveClose, only: OpenAll implicit none integer:: recommit_particles !call finalise() @@ -3032,13 +3044,38 @@ function set_genec_path(path) set_genec_path = 0 end function -function set_starname(index_of_the_star) +function get_starname(index_of_the_star, am_starname) + implicit none + integer:: get_starname, index_of_the_star + character(len=200):: am_starname + am_starname = InitialGenecStar%starname + get_starname = 0 +end function + +function set_starname(index_of_the_star, am_starname) implicit none integer:: set_starname, index_of_the_star - InitialGenecStar%starname = 'AmuseStar' + character(len=200):: am_starname + InitialGenecStar%starname = am_starname set_starname = 0 end function +function get_phase(index_of_the_star, phase) + implicit none + integer:: index_of_the_star, phase + integer:: get_phase + phase = GenecStar%phase + get_phase = 0 +end function + +function set_phase(index_of_the_star, phase) + implicit none + integer:: index_of_the_star, phase + integer:: set_phase + GenecStar%phase = phase + set_phase = 0 +end function + function set_temperature_at_zone(index_of_the_star, zone, T_i) use strucmod, only: t, m implicit none diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index af169ae330..4a4a666d8e 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -551,42 +551,6 @@ def set_par_ibasnet(): ''' return function - @legacy_function - def get_par_phase(): - 'get parameter phase' - function = LegacyFunctionSpecification() - function.addParameter( - 'phase', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function - - @legacy_function - def set_par_phase(): - 'set parameter phase' - function = LegacyFunctionSpecification() - function.addParameter( - 'phase', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function - @legacy_function def get_par_iopac(): 'get parameter iopac' @@ -3425,17 +3389,49 @@ def commit_parameters(): function.result_type = 'int32' return function + @legacy_function + def get_starname(): + """ + Get the star name (identical to AMUSE particle key?) + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', + direction=function.OUT, + description="The star's key" + ) + function.addParameter( + 'starname', dtype='string', direction=function.IN, + description="star name", + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + """ + return function + @legacy_function def set_starname(): """ Set the star name (identical to AMUSE particle key?) """ function = LegacyFunctionSpecification() + function.can_handle_array = True function.addParameter( 'index_of_the_star', dtype='int32', direction=function.IN, description="The star's key" ) + function.addParameter( + 'starname', dtype='string', direction=function.OUT, + description="star name", + ) function.result_type = 'int32' function.result_doc = """ 0 - OK @@ -3447,6 +3443,55 @@ def set_starname(): """ return function + @legacy_function + def get_phase(): + 'get phase' + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', + direction=function.IN, + description="The star's key" + ) + function.addParameter( + 'phase', dtype='int32', + direction=function.OUT, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + Got the value. + -1 - ERROR + Unable to get. + ''' + return function + + @legacy_function + def set_phase(): + 'set phase' + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', + direction=function.IN, + description="The star's key" + ) + function.addParameter( + 'phase', dtype='int32', + direction=function.IN, + ) + function.result_type = 'int32' + function.result_doc = ''' + 0 - OK + The value has been set. + -1 - ERROR + Unable to set. + -2 - ERROR + Cannot set at this point, already running. + ''' + return function + + @legacy_function def new_particle(): """ @@ -3524,6 +3569,7 @@ def get_luminosity_at_zone(): ) function.addParameter( 'lum_i', dtype='float64', direction=function.OUT, + unit=units.LSun, description=( "The luminosity at the specified zone/mesh-cell of the star." ) @@ -3569,6 +3615,96 @@ def get_mass_of_species(): """ return function + @legacy_function + def get_nabla_rad_at_zone(): + """ + Retrieve nabla_rad at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'nabla_rad', dtype='float64', direction=function.OUT, + description=( + "nabla_rad at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + @legacy_function + def get_nabla_ad_at_zone(): + """ + Retrieve nabla_rad at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'nabla_ad', dtype='float64', direction=function.OUT, + description=( + "nabla_ad at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + @legacy_function + def get_nabla_mu_at_zone(): + """ + Retrieve nabla_rad at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'nabla_mu', dtype='float64', direction=function.OUT, + description=( + "nabla_mu at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + @legacy_function def get_mass_fraction_at_zone(): """ @@ -5399,13 +5535,6 @@ def define_parameters(self, handler): "GENEC parameter ibasnet", ) - handler.add_method_parameter( - "get_par_phase", - "set_par_phase", - "phase", - "GENEC parameter phase", - ) - handler.add_method_parameter( "get_par_iopac", "set_par_iopac", @@ -5977,6 +6106,7 @@ def define_particle_sets(self, handler): ) handler.set_new(set_name, 'new_particle') + handler.add_getter(set_name, 'get_phase', names=('phase',)) handler.add_getter(set_name, 'get_radius') handler.add_getter(set_name, 'get_mass') handler.add_getter(set_name, 'get_age') @@ -5999,7 +6129,7 @@ def define_particle_sets(self, handler): # handler.add_method(set_name, 'get_radius_profile') # handler.add_method(set_name, 'get_temperature_profile') - handler.add_method(set_name, 'get_luminosity_profile') + # handler.add_method(set_name, 'get_luminosity_profile') handler.add_method(set_name, 'get_mass_profile') handler.add_method(set_name, 'get_cumulative_mass_profile') handler.add_getter( @@ -6010,6 +6140,24 @@ def define_particle_sets(self, handler): handler.add_method(set_name, 'evolve_for') handler.set_delete(set_name, 'delete_star') + handler.add_gridded_getter( + set_name, + 'get_nabla_rad_at_zone', 'get_firstlast_zone', + names=('nabla_rad_profile',) + ) + + handler.add_gridded_getter( + set_name, + 'get_nabla_ad_at_zone', 'get_firstlast_zone', + names=('nabla_ad_profile',) + ) + + handler.add_gridded_getter( + set_name, + 'get_nabla_mu_at_zone', 'get_firstlast_zone', + names=('nabla_mu_profile',) + ) + handler.add_gridded_getter( set_name, 'get_radius_at_zone', 'get_firstlast_zone', @@ -6045,12 +6193,7 @@ def define_particle_sets(self, handler): handler.add_gridded_getter( set_name, 'get_luminosity_at_zone', 'get_firstlast_zone', - names=('luminosity_profile',) - ) - handler.add_gridded_getter( - set_name, - 'set_luminosity_at_zone', 'get_firstlast_zone', - names=('luminosity_profile',) + names=('luminosity_profile',), ) handler.add_gridded_getter( @@ -6106,7 +6249,7 @@ def define_state(self, handler): # -> Run (commit_particles) handler.add_transition('EDIT', 'RUN', 'commit_particles') - for state in ["RUN", "UPDATE"]: + for state in ["UPDATE"]: handler.add_method(state, 'get_chemical_abundance_profiles') handler.add_method(state, 'get_mass_fraction_of_species_at_zone') handler.add_method(state, 'get_mu_at_zone') @@ -6120,7 +6263,7 @@ def define_state(self, handler): handler.add_method(state, 'get_temperature_at_zone') handler.add_method(state, 'get_density_at_zone') handler.add_method(state, 'get_luminosity') - handler.add_method(state, 'get_luminosity_at_zone') + # handler.add_method(state, 'get_luminosity_at_zone') handler.add_method(state, 'get_time_step') handler.add_method(state, 'get_mass') handler.add_method(state, 'get_age') @@ -6140,7 +6283,7 @@ def define_state(self, handler): handler.add_method('UPDATE', 'set_radius_at_zone') handler.add_method('UPDATE', 'set_temperature_at_zone') handler.add_method('UPDATE', 'set_density_at_zone') - handler.add_method('UPDATE', 'set_luminosity_at_zone') + # handler.add_method('UPDATE', 'set_luminosity_at_zone') handler.add_method('UPDATE', 'set_mass_fraction_at_zone') # handler.add_method('UPDATE', 'set_time_step') handler.add_transition('UPDATE', 'RUN', 'recommit_particles') @@ -6196,16 +6339,16 @@ def define_methods(self, handler): # (handler.INDEX, handler.NO_UNIT, units.K), # (handler.ERROR_CODE,) # ) - handler.add_method( - "get_luminosity_at_zone", - (handler.INDEX, handler.NO_UNIT,), - (units.erg/units.s, handler.ERROR_CODE,) - ) - handler.add_method( - "set_luminosity_at_zone", - (handler.INDEX, handler.NO_UNIT, units.erg/units.s), - (handler.ERROR_CODE,) - ) + # handler.add_method( + # "get_luminosity_at_zone", + # (handler.INDEX, handler.NO_UNIT,), + # (units.erg/units.s, handler.ERROR_CODE,) + # ) + # handler.add_method( + # "set_luminosity_at_zone", + # (handler.INDEX, handler.NO_UNIT, units.erg/units.s), + # (handler.ERROR_CODE,) + # ) handler.add_method( "get_surface_velocity", (handler.INDEX), @@ -6213,21 +6356,21 @@ def define_methods(self, handler): ) # def define_parameters(self, handler): - def get_luminosity_profile( - self, - indices_of_the_stars, - number_of_zones=None, - ): - indices_of_the_stars = self._check_number_of_indices( - indices_of_the_stars, - action_string="Querying luminosity profiles" - ) - if number_of_zones is None: - number_of_zones = self.get_number_of_zones(indices_of_the_stars) - return self.get_luminosity_at_zone( - [indices_of_the_stars]*number_of_zones, - list(range(number_of_zones)) | units.none - ) + # def get_luminosity_profile( + # self, + # indices_of_the_stars, + # number_of_zones=None, + # ): + # indices_of_the_stars = self._check_number_of_indices( + # indices_of_the_stars, + # action_string="Querying luminosity profiles" + # ) + # if number_of_zones is None: + # number_of_zones = self.get_number_of_zones(indices_of_the_stars) + # return self.get_luminosity_at_zone( + # [indices_of_the_stars]*number_of_zones, + # list(range(number_of_zones)) | units.none + # ) def get_mass_profile( self, From e5c7f76d7234d83f4b00a61e970726522b4f0d03 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 14 Dec 2022 09:08:41 +0100 Subject: [PATCH 44/72] Test script updates --- src/amuse/community/genec/plot_models.py | 203 ++++++++++++++++-- .../genec/test_integrate_default_star.py | 29 ++- .../genec/test_integrate_difficult_star.py | 23 +- 3 files changed, 226 insertions(+), 29 deletions(-) diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 0d1cb5a6e3..971186934b 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -18,7 +18,7 @@ def __init__(self, star): self.star = star self.__n_zones = 0 self.__redraw = True - self.__phase = 1 + # self.__phase = 1 self.__age = [] | self.default_units['age'] self.__mass = [] | self.default_units['mass'] self.__radius = [] | self.default_units['radius'] @@ -42,6 +42,8 @@ def __init__(self, star): self.__initialised = [] + ax_temp = self.__figures["2"].add_subplot(2, 2, 4) + ax_pres = ax_temp.twinx() self.__axes = { "HR": self.__figures["1"].add_subplot(2, 2, 1), "temp_dens": self.__figures["1"].add_subplot(2, 2, 2), @@ -50,19 +52,21 @@ def __init__(self, star): "Abundance profile": self.__figures["2"].add_subplot(2, 2, 1), "gradient": self.__figures["2"].add_subplot(2, 2, 2), "Luminosity and energy production": self.__figures["2"].add_subplot(2, 2, 3), - "Temperature and pressure": self.__figures["2"].add_subplot(2, 2, 4), + "Temperature and pressure": ( + ax_temp, + ax_pres, + ), } # self.__ax_hr = fig.add_subplot(2, 2, 1) self.update(star) self.plot_all() plt.pause(0.01) - def update(self, star, phase=1): + def update(self, star): self.star = star if self.__n_zones != star.n_zones: self.__redraw = True self.__n_zones = star.n_zones - self.__phase = phase self.__age.append(star.age) self.__mass.append(star.mass) self.__radius.append(star.radius) @@ -241,7 +245,19 @@ def initialise_central_abundance(self): 0.05, ) ax.set_ylim(-0.05, 1.05) - ax.set_xlabel(f'age ({unit_age})') + if (self.star.phase > 0 and len(self.__age) > 2): + ax.set_xlabel(f'log age/{unit_age}') + time_xdata = numpy.log10( + 0.01 + + ( + 1.0 * self.__age[-1].value_in(unit_age) + # - self.__age[-2].value_in(unit_age) + ) + - self.__age.value_in(unit_age) + ) + else: + ax.set_xlabel(f'age ({unit_age})') + time_xdata = self.__age.value_in(unit_age) ax.set_ylabel('abundance fraction') ax.ticklabel_format( style='sci', @@ -251,7 +267,7 @@ def initialise_central_abundance(self): self.__central_abundance_plots = [] for i, species in enumerate(self.__species): plot, = ax.plot( - [self.star.age.value_in(unit_age)], + [time_xdata], [self.__central_abundance[species]], label=species, # color='red', @@ -266,12 +282,26 @@ def plot_central_abundance(self): self.initialise_central_abundance() unit_age = self.default_units['age'] ax = self.__axes[title] - xmax = self.star.age.value_in(unit_age) * 1.05 - xmin = (self.star.age.value_in(unit_age) - xmax) + if (self.star.phase > 0 and len(self.__age) > 2): + ax.set_xlabel(f'log age/{unit_age}') + time_xdata = numpy.log10( + 0.01 + + ( + 1.0 * self.__age[-1].value_in(unit_age) + # - self.__age[-2].value_in(unit_age) + ) + - self.__age.value_in(unit_age) + ) + else: + ax.set_xlabel(f'age ({unit_age})') + time_xdata = self.__age.value_in(unit_age) + + xmax = max(time_xdata) + 0.05 + xmin = min(time_xdata) ax.set_xlim(xmin, xmax) for i, species in enumerate(self.__species): self.__central_abundance_plots[i].set_xdata( - self.__age.value_in(unit_age) + time_xdata ) # if self.__phase == 1: # self.__central_abundance_plots[i].set_xdata( @@ -335,7 +365,6 @@ def initialise_abundance_profile(self): def plot_abundance_profile(self): title = "Abundance profile" if self.__redraw: - title = "Abundance profile" ax = self.__axes[title] ax.clear() if ( @@ -359,44 +388,190 @@ def plot_abundance_profile(self): def initialise_gradient(self): title = "gradient" ax = self.__axes[title] + self.__gradient_plots = [] ax.set_title(title) ax.set_xlim(0, 1) ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') + ax.set_ylabel('Nabla_(rad-ad-mu)') mass_profile = self.star.get_cumulative_mass_profile() + nabla_rad = self.star.nabla_rad_profile + nabla_ad = self.star.nabla_ad_profile + nabla_mu = self.star.nabla_mu_profile + min_nabla = min( + min(nabla_ad), + min(nabla_rad), + min(nabla_mu), + 0 + ) + max_nabla = max( + max(nabla_ad), + max(nabla_rad), + # max(nabla_mu), + 0 + ) + plot_1, = ax.plot(mass_profile, nabla_ad, label='Nabla_ad') + plot_2, = ax.plot(mass_profile, nabla_rad, label='Nabla_rad') + plot_3, = ax.plot(mass_profile, nabla_mu, label='Nabla_mu') + ax.plot(mass_profile, 0*mass_profile, linestyle='--', color='black') + ax.set_ylim((min_nabla, max_nabla)) + self.__gradient_plots.append(plot_1) + self.__gradient_plots.append(plot_2) + self.__gradient_plots.append(plot_3) self.__initialised.append(title) def plot_gradient(self): title = "gradient" - if title not in self.__initialised: + if self.__redraw: + ax = self.__axes[title] + ax.clear() + if ( + title not in self.__initialised + or self.__redraw + ): self.initialise_gradient() + return + ax = self.__axes[title] + mass_profile = self.star.get_cumulative_mass_profile() + nabla_rad = self.star.nabla_rad_profile + nabla_ad = self.star.nabla_ad_profile + nabla_mu = self.star.nabla_mu_profile + min_nabla = min( + min(nabla_ad), + min(nabla_rad) + ) + max_nabla = max( + max(nabla_ad), + max(nabla_rad) + ) + ax.set_ylim((min_nabla, max_nabla)) + for i in range(3): + self.__gradient_plots[i].set_xdata( + mass_profile + ) + self.__gradient_plots[0].set_ydata(nabla_ad) + self.__gradient_plots[1].set_ydata(nabla_rad) + self.__gradient_plots[2].set_ydata(nabla_mu) + def initialise_luminosity_energy_production(self): title = "Luminosity and energy production" ax = self.__axes[title] + self.__lum_en_plots = [] ax.set_title(title) ax.set_xlim(0, 1) ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') mass_profile = self.star.get_cumulative_mass_profile() + luminosity_profile = self.star.luminosity_profile.value_in( + units.LSun + ) + luminosity_profile = luminosity_profile / max(luminosity_profile) + plot_lum, = ax.plot( + mass_profile, luminosity_profile, label="lum", + ) + ax.set_ylim( + ( + min(luminosity_profile)-0.1, + max(luminosity_profile)+0.1, + ) + ) + self.__lum_en_plots.append(plot_lum) self.__initialised.append(title) def plot_luminosity_energy_production(self): title = "Luminosity and energy production" - if title not in self.__initialised: + if self.__redraw: + ax = self.__axes[title] + ax.clear() + if ( + title not in self.__initialised + or self.__redraw + ): self.initialise_luminosity_energy_production() + return + ax = self.__axes[title] + mass_profile = self.star.get_cumulative_mass_profile() + luminosity_profile = self.star.luminosity_profile.value_in( + units.LSun + ) + luminosity_profile = luminosity_profile / max(luminosity_profile) + + self.__lum_en_plots[0].set_xdata( + mass_profile + ) + self.__lum_en_plots[0].set_ydata( + luminosity_profile + ) + ax.set_ylim( + ( + min(luminosity_profile)-0.1, + max(luminosity_profile)+0.1, + ) + ) def initialise_temperature_pressure(self): title = "Temperature and pressure" - ax = self.__axes[title] + ax = self.__axes[title][0] + self.__temp_pres_plots = [] ax.set_title(title) ax.set_xlim(0, 1) ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') + ax.set_ylabel('log(T)') + ax_pres = self.__axes[title][1] + ax_pres.set_ylabel('log(P)') mass_profile = self.star.get_cumulative_mass_profile() + temperature_profile = numpy.log10( + self.star.temperature_profile.value_in(units.K) + ) + pressure_profile = numpy.log10( + self.star.pressure_profile.number + ) + plot_temp, = ax.plot( + mass_profile, temperature_profile, label="temp", + ) + plot_pres, = ax_pres.plot( + mass_profile, pressure_profile, label="pres", + color='black' + ) + self.__temp_pres_plots.append( + plot_temp + ) + self.__temp_pres_plots.append( + plot_pres + ) self.__initialised.append(title) def plot_temperature_pressure(self): title = "Temperature and pressure" - if title not in self.__initialised: + if self.__redraw: + for i in (0, 1): + ax = self.__axes[title][i] + ax.clear() + if ( + title not in self.__initialised + or self.__redraw + ): self.initialise_temperature_pressure() + return + ax = self.__axes[title][0] + ax_pres = self.__axes[title][1] + mass_profile = self.star.get_cumulative_mass_profile() + temperature_profile = numpy.log10( + self.star.temperature_profile.value_in(units.K) + ) + pressure_profile = numpy.log10( + self.star.pressure_profile.number + ) + for i in (0, 1): + self.__temp_pres_plots[i].set_xdata( + mass_profile + ) + self.__temp_pres_plots[0].set_ydata( + temperature_profile + ) + self.__temp_pres_plots[1].set_ydata( + pressure_profile + ) + def plot_figure_evolution(self): self.plot_hr() diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index dcff4217b0..25f5c02b2c 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -12,6 +12,15 @@ from plot_models import StellarModelPlot from amuse.community.genec.interface import SPECIES_NAMES +import logging + +logging.basicConfig( + level=logging.INFO, + format='%(asctime)s - %(name)s - %(levelname)s: %(message)s', + datefmt='%Y%m%d %H:%M:%S' +) +logger = logging.getLogger(__name__) +# logger.setLevel(logging.DEBUG) class NeedToSave: def __init__(self): @@ -130,7 +139,7 @@ def write_backup( mass=60 | units.MSun, metallicity=0.014, ) -star = Particle(mass=7.0 | units.MSun, metallicity=0.014) +star = Particle(mass=7.0 | units.MSun, metallicity=0.014, starname="AmuseStar") evo = Genec(redirection="none") # evo.parameters.idebug = 2 # evo = Genec() @@ -223,14 +232,18 @@ def write_backup( else: evo.parameters.vwant = 0.0 evo.parameters.ipoly = 0 -# evo.parameters.idebug = 1 -star_in_evo = evo.fullparticles.add_particle(star) +star_in_evo = evo.fullparticles.add_particle(star) # NOTE: this will now reset parameters... +# evo.parameters.idebug = 2 +# print(star_in_evo) +star_in_evo.evolve_one_step() +star_in_evo.evolve_one_step() +exit() # for p in params.items(): # setattr(evo.parameters, p[0], p[1]) -evo.commit_particles() -# print(star_in_evo) -# exit() +# evo.commit_particles() +# print(evo.parameters) +#print(star_in_evo.get_radius_at_zone(0)) font = { 'size': 8, } @@ -279,7 +292,7 @@ def write_backup( star.radius.in_(units.RSun), star.temperature.in_(units.K), star.luminosity.in_(units.LSun), - evo.parameters.phase, + star.phase, star.surface_velocity, star.abundance_h[0], evo.parameters.vwant, @@ -287,7 +300,7 @@ def write_backup( ) print(f"step: {step} time: {star.age} timestep: {star.time_step} xcn: {evo.parameters.xcn}") if (step % store_every == 0) and plotting is not None: - plotting.update(star_in_evo, phase=evo.parameters.phase) + plotting.update(star_in_evo) if ( (time_elapsed - time_of_last_plot) > plot_time or step - model_of_last_plot > plot_models diff --git a/src/amuse/community/genec/test_integrate_difficult_star.py b/src/amuse/community/genec/test_integrate_difficult_star.py index 76a79c69cc..dc0a62667c 100644 --- a/src/amuse/community/genec/test_integrate_difficult_star.py +++ b/src/amuse/community/genec/test_integrate_difficult_star.py @@ -12,6 +12,15 @@ from plot_models import StellarModelPlot from amuse.community.genec.interface import SPECIES_NAMES +import logging + +logging.basicConfig( + level=logging.INFO, + format='%(asctime)s - %(name)s - %(levelname)s: %(message)s', + datefmt='%Y%m%d %H:%M:%S' +) +logger = logging.getLogger(__name__) +# logger.setLevel(logging.DEBUG) class NeedToSave: def __init__(self): @@ -130,7 +139,7 @@ def write_backup( mass=60 | units.MSun, metallicity=0.014, ) -star = Particle(mass=60.0 | units.MSun, metallicity=0.014) +star = Particle(mass=60.0 | units.MSun, metallicity=0.014, starname="RotatingStar") evo = Genec(redirection="none") # evo = Genec() if ROTATING_STAR: @@ -141,13 +150,13 @@ def write_backup( else: evo.parameters.vwant = 0.0 evo.parameters.ipoly = 0 -# evo.parameters.idebug = 1 star_in_evo = evo.fullparticles.add_particle(star) +# evo.parameters.idebug = 2 # for p in params.items(): # setattr(evo.parameters, p[0], p[1]) -evo.commit_particles() -print(evo.parameters) +# evo.commit_particles() +# print(evo.parameters) # print(star_in_evo) font = { 'size': 8, @@ -197,15 +206,15 @@ def write_backup( star.radius.in_(units.RSun), star.temperature.in_(units.K), star.luminosity.in_(units.LSun), - evo.parameters.phase, + star.phase, star.surface_velocity, star.abundance_h[0], evo.parameters.vwant, evo.parameters.xcn, ) - print(f"step: {step} time: {star.age} timestep: {star.time_step} xcn: {evo.parameters.xcn}") + print(f"step: {step} time: {star.age} timestep: {star.time_step} xcn: {evo.parameters.xcn}") if (step % store_every == 0) and plotting is not None: - plotting.update(star_in_evo, phase=evo.parameters.phase) + plotting.update(star_in_evo) if ( (time_elapsed - time_of_last_plot) > plot_time or step - model_of_last_plot > plot_models From e3c82156e7da670c3dda43a36157658332ae8d03 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 14 Dec 2022 14:39:41 +0100 Subject: [PATCH 45/72] cleanup --- src/amuse/community/genec/interface.f90 | 34 +++---------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 5e8f86f557..c0a7feee56 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1753,39 +1753,11 @@ function evolve_one_step(index_of_the_star) integer:: index_of_the_star integer:: evolve_one_step integer:: original_nzmod - !original_nzmod = nzmod nzmod = 1 n_snap = 0 - !end_at_phase=4 - !end_at_model=0 - - !write(*,*) "Evolving one step, current time: ", alter - !if (stopping_condition == "") then - call evolve() - !if (stopping_condition /= "") return - call finalise() - if (GenecStar%stopped .and. mod(GenecStar%nwmd,10) <= 5) then - ! rollback and don't increase timestep - GenecStar = BackupGenecStar - GenecStar%xcn = 1.0 - elseif (GenecStar%stopped) then - GenecStar = BackupBackupGenecStar - BackupGenecStar = BackupBackupGenecStar - GenecStar%xcn = 1.0 - endif - if (mod(GenecStar%nwmd, 10)==0) then - ! move backups along - BackupBackupGenecStar = BackupGenecStar - BackupGenecStar = GenecStar - endif - !call OpenAll() - !call initialise_star() ! will set modell to 1 - !write(*,*) "Evolved one step, current time: ", alter - !nzmod = original_nzmod - !write(*,*) "*****modanf, nwseq, nzmod: ", modanf, nwseq, nzmod - !else - ! write(*,*) "stopped: ", stopping_condition - !endif + + call evolve() + call finalise() veryFirst = .false. evolve_one_step = 0 end function From f2796356d8383f9b11799a0a861b9ed7cccbc647 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 20 Dec 2022 11:00:32 +0100 Subject: [PATCH 46/72] updates --- src/amuse/community/genec/interface.f90 | 415 ++++++++--------------- src/amuse/community/genec/plot_models.py | 24 +- 2 files changed, 165 insertions(+), 274 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index c0a7feee56..abeea3e9cf 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -54,20 +54,18 @@ function cleanup_code() ! **** Parameters function get_model_number(model_number) - use genec, only: nwmd implicit none integer:: model_number integer:: get_model_number - model_number = nwmd + model_number = GenecStar%nwmd get_model_number = 0 end function function set_model_number(model_number) - use genec, only: nwmd implicit none integer:: model_number integer:: set_model_number - nwmd = model_number + GenecStar%nwmd = model_number set_model_number = 0 end function @@ -87,11 +85,10 @@ function get_par_n_snap(n_snap_out) end function function set_par_n_snap(n_snap_in) - use inputparam, only: n_snap implicit none integer:: n_snap_in integer:: set_par_n_snap - n_snap = n_snap_in + GenecStar%n_snap = n_snap_in set_par_n_snap= 0 end function @@ -120,11 +117,10 @@ function get_par_nwseq(par_nwseq) end function function set_par_nwseq(par_nwseq) - use inputparam, only: nwseq implicit none integer:: par_nwseq integer:: set_par_nwseq - nwseq = par_nwseq + GenecStar%nwseq = par_nwseq set_par_nwseq = 0 end function @@ -137,11 +133,10 @@ function get_par_modanf(par_modanf) end function function set_par_modanf(par_modanf) - use inputparam, only: modanf implicit none integer:: par_modanf integer:: set_par_modanf - modanf = par_modanf + GenecStar%modanf = par_modanf set_par_modanf = 0 end function @@ -154,11 +149,10 @@ function get_par_nzmod(par_nzmod) end function function set_par_nzmod(par_nzmod) - use inputparam, only: nzmod implicit none integer:: par_nzmod integer:: set_par_nzmod - nzmod = par_nzmod + GenecStar%nzmod = par_nzmod set_par_nzmod = 0 end function @@ -171,11 +165,10 @@ function get_par_irot(par_irot) end function function set_par_irot(par_irot) - use inputparam, only: irot implicit none integer:: par_irot integer:: set_par_irot - irot = par_irot + GenecStar%irot = par_irot set_par_irot = 0 end function @@ -188,11 +181,10 @@ function get_par_isol(par_isol) end function function set_par_isol(par_isol) - use inputparam, only: isol implicit none integer:: par_isol integer:: set_par_isol - isol = par_isol + GenecStar%isol = par_isol set_par_isol = 0 end function @@ -205,11 +197,10 @@ function get_par_imagn(par_imagn) end function function set_par_imagn(par_imagn) - use inputparam, only: imagn implicit none integer:: par_imagn integer:: set_par_imagn - imagn = par_imagn + GenecStar%imagn = par_imagn set_par_imagn = 0 end function @@ -222,11 +213,10 @@ function get_par_ialflu(par_ialflu) end function function set_par_ialflu(par_ialflu) - use inputparam, only: ialflu implicit none integer:: par_ialflu integer:: set_par_ialflu - ialflu = par_ialflu + GenecStar%ialflu = par_ialflu set_par_ialflu = 0 end function @@ -239,11 +229,10 @@ function get_par_ianiso(par_ianiso) end function function set_par_ianiso(par_ianiso) - use inputparam, only: ianiso implicit none integer:: par_ianiso integer:: set_par_ianiso - ianiso = par_ianiso + GenecStar%ianiso = par_ianiso set_par_ianiso = 0 end function @@ -256,11 +245,10 @@ function get_par_ipop3(par_ipop3) end function function set_par_ipop3(par_ipop3) - use inputparam, only: ipop3 implicit none integer:: par_ipop3 integer:: set_par_ipop3 - ipop3 = par_ipop3 + GenecStar%ipop3 = par_ipop3 set_par_ipop3 = 0 end function @@ -273,11 +261,10 @@ function get_par_ibasnet(par_ibasnet) end function function set_par_ibasnet(par_ibasnet) - use inputparam, only: ibasnet implicit none integer:: par_ibasnet integer:: set_par_ibasnet - ibasnet = par_ibasnet + GenecStar%ibasnet = par_ibasnet set_par_ibasnet = 0 end function @@ -290,11 +277,10 @@ function get_par_iopac(par_iopac) end function function set_par_iopac(par_iopac) - use inputparam, only: iopac implicit none integer:: par_iopac integer:: set_par_iopac - iopac = par_iopac + GenecStar%iopac = par_iopac set_par_iopac = 0 end function @@ -307,452 +293,402 @@ function get_par_ikappa(par_ikappa) end function function set_par_ikappa(par_ikappa) - use inputparam, only: ikappa implicit none integer:: par_ikappa integer:: set_par_ikappa - ikappa = par_ikappa + GenecStar%ikappa = par_ikappa set_par_ikappa = 0 end function function get_par_idiff(par_idiff) - use inputparam, only: idiff implicit none integer:: par_idiff integer:: get_par_idiff - par_idiff = idiff + par_idiff = GenecStar%idiff get_par_idiff = 0 end function function set_par_idiff(par_idiff) - use inputparam, only: idiff implicit none integer:: par_idiff integer:: set_par_idiff - idiff = par_idiff + GenecStar%idiff = par_idiff set_par_idiff = 0 end function function get_par_iadvec(par_iadvec) - use inputparam, only: iadvec implicit none integer:: par_iadvec integer:: get_par_iadvec - par_iadvec = iadvec + par_iadvec = GenecStar%iadvec get_par_iadvec = 0 end function function set_par_iadvec(par_iadvec) - use inputparam, only: iadvec implicit none integer:: par_iadvec integer:: set_par_iadvec - iadvec = par_iadvec + GenecStar%iadvec = par_iadvec set_par_iadvec = 0 end function function get_par_istati(par_istati) - use inputparam, only: istati implicit none integer:: par_istati integer:: get_par_istati - par_istati = istati + par_istati = GenecStar%istati get_par_istati = 0 end function function set_par_istati(par_istati) - use inputparam, only: istati implicit none integer:: par_istati integer:: set_par_istati - istati = par_istati + GenecStar%istati = par_istati set_par_istati = 0 end function function get_par_icoeff(par_icoeff) - use inputparam, only: icoeff implicit none integer:: par_icoeff integer:: get_par_icoeff - par_icoeff = icoeff + par_icoeff = GenecStar%icoeff get_par_icoeff = 0 end function function set_par_icoeff(par_icoeff) - use inputparam, only: icoeff implicit none integer:: par_icoeff integer:: set_par_icoeff - icoeff = par_icoeff + GenecStar%icoeff = par_icoeff set_par_icoeff = 0 end function function get_par_igamma(par_igamma) - use inputparam, only: igamma implicit none integer:: par_igamma integer:: get_par_igamma - par_igamma = igamma + par_igamma = GenecStar%igamma get_par_igamma = 0 end function function set_par_igamma(par_igamma) - use inputparam, only: igamma implicit none integer:: par_igamma integer:: set_par_igamma - igamma = par_igamma + GenecStar%igamma = par_igamma set_par_igamma = 0 end function function get_par_idialo(par_idialo) - use inputparam, only: idialo implicit none integer:: par_idialo integer:: get_par_idialo - par_idialo = idialo + par_idialo = GenecStar%idialo get_par_idialo = 0 end function function set_par_idialo(par_idialo) - use inputparam, only: idialo implicit none integer:: par_idialo integer:: set_par_idialo - idialo = par_idialo + GenecStar%idialo = par_idialo set_par_idialo = 0 end function function get_par_idialu(par_idialu) - use inputparam, only: idialu implicit none integer:: par_idialu integer:: get_par_idialu - par_idialu = idialu + par_idialu = GenecStar%idialu get_par_idialu = 0 end function function set_par_idialu(par_idialu) - use inputparam, only: idialu implicit none integer:: par_idialu integer:: set_par_idialu - idialu = par_idialu + GenecStar%idialu = par_idialu set_par_idialu = 0 end function function get_par_imloss(par_imloss) - use inputparam, only: imloss implicit none integer:: par_imloss integer:: get_par_imloss - par_imloss = imloss + par_imloss = GenecStar%imloss get_par_imloss = 0 end function function set_par_imloss(par_imloss) - use inputparam, only: imloss implicit none integer:: par_imloss integer:: set_par_imloss - imloss = par_imloss + GenecStar%imloss = par_imloss set_par_imloss = 0 end function function get_par_ifitm(par_ifitm) - use inputparam, only: ifitm implicit none integer:: par_ifitm integer:: get_par_ifitm - par_ifitm = ifitm + par_ifitm = GenecStar%ifitm get_par_ifitm = 0 end function function set_par_ifitm(par_ifitm) - use inputparam, only: ifitm implicit none integer:: par_ifitm integer:: set_par_ifitm - ifitm = par_ifitm + GenecStar%ifitm = par_ifitm set_par_ifitm = 0 end function function get_par_nndr(par_nndr) - use inputparam, only: nndr implicit none integer:: par_nndr integer:: get_par_nndr - par_nndr = nndr + par_nndr = GenecStar%nndr get_par_nndr = 0 end function function set_par_nndr(par_nndr) - use inputparam, only: nndr implicit none integer:: par_nndr integer:: set_par_nndr - nndr = par_nndr + GenecStar%nndr = par_nndr set_par_nndr = 0 end function function get_par_iledou(par_iledou) - use inputparam, only: iledou implicit none integer:: par_iledou integer:: get_par_iledou - par_iledou = iledou + par_iledou = GenecStar%iledou get_par_iledou = 0 end function function set_par_iledou(par_iledou) - use inputparam, only: iledou implicit none integer:: par_iledou integer:: set_par_iledou - iledou = par_iledou + GenecStar%iledou = par_iledou set_par_iledou = 0 end function function get_par_idifcon(par_idifcon) - use inputparam, only: idifcon implicit none integer:: par_idifcon integer:: get_par_idifcon - par_idifcon = idifcon + par_idifcon = GenecStar%idifcon get_par_idifcon = 0 end function function set_par_idifcon(par_idifcon) - use inputparam, only: idifcon implicit none integer:: par_idifcon integer:: set_par_idifcon - idifcon = par_idifcon + GenecStar%idifcon = par_idifcon set_par_idifcon = 0 end function function get_par_my(par_my) - use inputparam, only: my implicit none integer:: par_my integer:: get_par_my - par_my = my + par_my = GenecStar%my get_par_my = 0 end function function set_par_my(par_my) - use inputparam, only: my implicit none integer:: par_my integer:: set_par_my - my = par_my + GenecStar%my = par_my set_par_my = 0 end function function get_par_iover(par_iover) - use inputparam, only: iover implicit none integer:: par_iover integer:: get_par_iover - par_iover = iover + par_iover = GenecStar%iover get_par_iover = 0 end function function set_par_iover(par_iover) - use inputparam, only: iover implicit none integer:: par_iover integer:: set_par_iover - iover = par_iover + GenecStar%iover = par_iover set_par_iover = 0 end function function get_par_iunder(par_iunder) - use inputparam, only: iunder implicit none integer:: par_iunder integer:: get_par_iunder - par_iunder = iunder + par_iunder = GenecStar%iunder get_par_iunder = 0 end function function set_par_iunder(par_iunder) - use inputparam, only: iunder implicit none integer:: par_iunder integer:: set_par_iunder - iunder = par_iunder + GenecStar%iunder = par_iunder set_par_iunder = 0 end function function get_par_nbchx(par_nbchx) - use inputparam, only: nbchx implicit none integer:: par_nbchx integer:: get_par_nbchx - par_nbchx = nbchx + par_nbchx = GenecStar%nbchx get_par_nbchx = 0 end function function set_par_nbchx(par_nbchx) - use inputparam, only: nbchx implicit none integer:: par_nbchx integer:: set_par_nbchx - nbchx = par_nbchx + GenecStar%nbchx = par_nbchx set_par_nbchx = 0 end function function get_par_nrband(par_nrband) - use inputparam, only: nrband implicit none integer:: par_nrband integer:: get_par_nrband - par_nrband = nrband + par_nrband = GenecStar%nrband get_par_nrband = 0 end function function set_par_nrband(par_nrband) - use inputparam, only: nrband implicit none integer:: par_nrband integer:: set_par_nrband - nrband = par_nrband + GenecStar%nrband = par_nrband set_par_nrband = 0 end function function get_par_islow(par_islow) - use inputparam, only: islow implicit none integer:: par_islow integer:: get_par_islow - par_islow = islow + par_islow = GenecStar%islow get_par_islow = 0 end function function set_par_islow(par_islow) - use inputparam, only: islow implicit none integer:: par_islow integer:: set_par_islow - islow = par_islow + GenecStar%islow = par_islow set_par_islow = 0 end function function get_par_icncst(par_icncst) - use inputparam, only: icncst implicit none integer:: par_icncst integer:: get_par_icncst - par_icncst = icncst + par_icncst = GenecStar%icncst get_par_icncst = 0 end function function set_par_icncst(par_icncst) - use inputparam, only: icncst implicit none integer:: par_icncst integer:: set_par_icncst - icncst = par_icncst + GenecStar%icncst = par_icncst set_par_icncst = 0 end function function get_par_tauH_fit(par_tauH_fit) - use inputparam, only: tauH_fit implicit none integer:: par_tauH_fit integer:: get_par_tauH_fit - par_tauH_fit = tauH_fit + par_tauH_fit = GenecStar%tauH_fit get_par_tauH_fit = 0 end function function set_par_tauH_fit(par_tauH_fit) - use inputparam, only: tauH_fit implicit none integer:: par_tauH_fit integer:: set_par_tauH_fit - tauH_fit = par_tauH_fit + GenecStar%tauH_fit = par_tauH_fit set_par_tauH_fit = 0 end function function get_par_iauto(par_iauto) - use inputparam, only: iauto implicit none integer:: par_iauto integer:: get_par_iauto - par_iauto = iauto + par_iauto = GenecStar%iauto get_par_iauto = 0 end function function set_par_iauto(par_iauto) - use inputparam, only: iauto implicit none integer:: par_iauto integer:: set_par_iauto - iauto = par_iauto + GenecStar%iauto = par_iauto set_par_iauto = 0 end function function get_par_iprn(par_iprn) - use inputparam, only: iprn implicit none integer:: par_iprn integer:: get_par_iprn - par_iprn = iprn + par_iprn = GenecStar%iprn get_par_iprn = 0 end function function set_par_iprn(par_iprn) - use inputparam, only: iprn implicit none integer:: par_iprn integer:: set_par_iprn - iprn = par_iprn + GenecStar%iprn = par_iprn set_par_iprn = 0 end function function get_par_iout(par_iout) - use inputparam, only: iout implicit none integer:: par_iout integer:: get_par_iout - par_iout = iout + par_iout = GenecStar%iout get_par_iout = 0 end function function set_par_iout(par_iout) - use inputparam, only: iout implicit none integer:: par_iout integer:: set_par_iout - iout = par_iout + GenecStar%iout = par_iout set_par_iout = 0 end function function get_par_itmin(par_itmin) - use inputparam, only: itmin implicit none integer:: par_itmin integer:: get_par_itmin - par_itmin = itmin + par_itmin = GenecStar%itmin get_par_itmin = 0 end function function set_par_itmin(par_itmin) - use inputparam, only: itmin implicit none integer:: par_itmin integer:: set_par_itmin - itmin = par_itmin + GenecStar%itmin = par_itmin set_par_itmin = 0 end function function get_par_idebug(par_idebug) - use inputparam, only: idebug implicit none integer:: par_idebug integer:: get_par_idebug - par_idebug = idebug + par_idebug = GenecStar%idebug get_par_idebug = 0 end function @@ -765,200 +701,178 @@ function set_par_idebug(par_idebug) end function function get_par_itests(par_itests) - use inputparam, only: itests implicit none integer:: par_itests integer:: get_par_itests - par_itests = itests + par_itests = GenecStar%itests get_par_itests = 0 end function function set_par_itests(par_itests) - use inputparam, only: itests implicit none integer:: par_itests integer:: set_par_itests - itests = par_itests + GenecStar%itests = par_itests set_par_itests = 0 end function function get_par_var_rates(par_var_rates) - use inputparam, only: var_rates implicit none logical:: par_var_rates integer:: get_par_var_rates - par_var_rates = var_rates + par_var_rates = GenecStar%var_rates get_par_var_rates = 0 end function function set_par_var_rates(par_var_rates) - use inputparam, only: var_rates implicit none logical:: par_var_rates integer:: set_par_var_rates - var_rates = par_var_rates + GenecStar%var_rates = par_var_rates set_par_var_rates = 0 end function function get_par_bintide(par_bintide) - use inputparam, only: bintide implicit none logical:: par_bintide integer:: get_par_bintide - par_bintide = bintide + par_bintide = GenecStar%bintide get_par_bintide = 0 end function function set_par_bintide(par_bintide) - use inputparam, only: bintide implicit none logical:: par_bintide integer:: set_par_bintide - bintide = par_bintide + GenecStar%bintide = par_bintide set_par_bintide = 0 end function function get_par_const_per(par_const_per) - use inputparam, only: const_per implicit none logical:: par_const_per integer:: get_par_const_per - par_const_per = const_per + par_const_per = GenecStar%const_per get_par_const_per = 0 end function function set_par_const_per(par_const_per) - use inputparam, only: const_per implicit none logical:: par_const_per integer:: set_par_const_per - const_per = par_const_per + GenecStar%const_per = par_const_per set_par_const_per = 0 end function function get_par_Add_Flux(par_Add_Flux) - use inputparam, only: Add_Flux implicit none logical:: par_Add_Flux integer:: get_par_Add_Flux - par_Add_Flux = Add_Flux + par_Add_Flux = GenecStar%Add_Flux get_par_Add_Flux = 0 end function function set_par_Add_Flux(par_Add_Flux) - use inputparam, only: Add_Flux implicit none logical:: par_Add_Flux integer:: set_par_Add_Flux - Add_Flux = par_Add_Flux + GenecStar%Add_Flux = par_Add_Flux set_par_Add_Flux = 0 end function function get_par_diff_only(par_diff_only) - use inputparam, only: diff_only implicit none logical:: par_diff_only integer:: get_par_diff_only - par_diff_only = diff_only + par_diff_only = GenecStar%diff_only get_par_diff_only = 0 end function function set_par_diff_only(par_diff_only) - use inputparam, only: diff_only implicit none logical:: par_diff_only integer:: set_par_diff_only - diff_only = par_diff_only + GenecStar%diff_only = par_diff_only set_par_diff_only = 0 end function function get_par_RSG_Mdot(par_RSG_Mdot) - use inputparam, only: RSG_Mdot implicit none integer:: par_RSG_Mdot integer:: get_par_RSG_Mdot - par_RSG_Mdot = RSG_Mdot + par_RSG_Mdot = GenecStar%RSG_Mdot get_par_RSG_Mdot = 0 end function function set_par_RSG_Mdot(par_RSG_Mdot) - use inputparam, only: RSG_Mdot implicit none integer:: par_RSG_Mdot integer:: set_par_RSG_Mdot - RSG_Mdot = par_RSG_Mdot + GenecStar%RSG_Mdot = par_RSG_Mdot set_par_RSG_Mdot = 0 end function function get_par_display_plot(par_display_plot) - use inputparam, only: display_plot implicit none logical:: par_display_plot integer:: get_par_display_plot - par_display_plot = display_plot + par_display_plot = GenecStar%display_plot get_par_display_plot = 0 end function function set_par_display_plot(par_display_plot) - use inputparam, only: display_plot implicit none logical:: par_display_plot integer:: set_par_display_plot - display_plot = par_display_plot + GenecStar%display_plot = par_display_plot set_par_display_plot = 0 end function function get_par_xyfiles(par_xyfiles) - use inputparam, only: xyfiles implicit none logical:: par_xyfiles integer:: get_par_xyfiles - par_xyfiles = xyfiles + par_xyfiles = GenecStar%xyfiles get_par_xyfiles = 0 end function function set_par_xyfiles(par_xyfiles) - use inputparam, only: xyfiles implicit none logical:: par_xyfiles integer:: set_par_xyfiles - xyfiles = par_xyfiles + GenecStar%xyfiles = par_xyfiles set_par_xyfiles = 0 end function function get_par_verbose(par_verbose) - use inputparam, only: verbose implicit none logical:: par_verbose integer:: get_par_verbose - par_verbose = verbose + par_verbose = GenecStar%verbose get_par_verbose = 0 end function function set_par_verbose(par_verbose) - use inputparam, only: verbose implicit none logical:: par_verbose integer:: set_par_verbose - verbose = par_verbose + GenecStar%verbose = par_verbose set_par_verbose = 0 end function function get_par_stop_deg(par_stop_deg) - use inputparam, only: stop_deg implicit none logical:: par_stop_deg integer:: get_par_stop_deg - par_stop_deg = stop_deg + par_stop_deg = GenecStar%stop_deg get_par_stop_deg = 0 end function function set_par_stop_deg(par_stop_deg) - use inputparam, only: stop_deg implicit none logical:: par_stop_deg integer:: set_par_stop_deg - stop_deg = par_stop_deg + GenecStar%stop_deg = par_stop_deg set_par_stop_deg = 0 end function @@ -1177,20 +1091,18 @@ function set_par_rapcrilim(par_rapcrilim) end function function get_par_vwant(par_vwant) - use inputparam, only: vwant implicit none real(kindreal):: par_vwant integer:: get_par_vwant - par_vwant = vwant + par_vwant = InitialGenecStar%vwant get_par_vwant = 0 end function function set_par_vwant(par_vwant) - use inputparam, only: vwant implicit none real(kindreal):: par_vwant integer:: set_par_vwant - vwant = par_vwant + InitialGenecStar%vwant = par_vwant set_par_vwant = 0 end function @@ -1789,12 +1701,11 @@ function get_age(index_of_the_star, age) end function function set_age(index_of_the_star, age) - use timestep, only: alter implicit none integer:: index_of_the_star real(kindreal):: age integer:: set_age - alter = age + GenecStar%alter = age set_age = 0 end function @@ -1836,14 +1747,14 @@ function get_density_at_zone(index_of_the_star, zone, rho_i) end function function set_density_at_zone(index_of_the_star, zone, rho_i) - use strucmod, only: rho, m + use strucmod, only: rho implicit none integer:: index_of_the_star integer:: zone, i real(kindreal):: rho_i integer:: set_density_at_zone - i = m - zone - if (zone <= m) then + i = GenecStar%m - zone + if (zone <= GenecStar%m) then rho(i) = log(rho_i) end if set_density_at_zone = 0 @@ -1860,19 +1771,16 @@ function get_luminosity(index_of_the_star, luminosity) end function function set_luminosity(index_of_the_star, luminosity) - !use strucmod, only: s, m - use caramodele, only: gls implicit none integer:: index_of_the_star real(kindreal):: luminosity integer:: set_luminosity !luminosity = exp(s(m)) ! in cgs units, so erg/s? - gls = luminosity + GenecStar%gls = luminosity set_luminosity = 0 end function function get_luminosity_at_zone(index_of_the_star, zone, lum_i) - use strucmod, only: s, m implicit none integer:: index_of_the_star integer:: zone, i @@ -1887,15 +1795,14 @@ function get_luminosity_at_zone(index_of_the_star, zone, lum_i) end function function set_luminosity_at_zone(index_of_the_star, zone, lum_i) - use strucmod, only: s, m implicit none integer:: index_of_the_star integer:: zone, i real(kindreal):: lum_i integer:: set_luminosity_at_zone - i = m - zone - if (zone <= m) then - s(i) = log(lum_i + 1) + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + GenecStar%s(i) = log(lum_i + 1) end if set_luminosity_at_zone = 0 end function @@ -1917,24 +1824,22 @@ function get_mass_fraction_at_zone(index_of_the_star, zone, dq_i) end function function set_mass_fraction_at_zone(index_of_the_star, zone, dq_i) - use strucmod, only: q, m implicit none integer:: index_of_the_star integer:: zone, i real(kindreal):: dq_i integer:: set_mass_fraction_at_zone - i = m - zone + i = GenecStar%m - zone if (i == 1) then - q(i) = log(dq_i) - else if (i <= m) then + GenecStar%q(i) = log(dq_i) + else if (i <= GenecStar%m) then !dq_i = 1-exp(q(zone+1)) - q(i) = log(exp(q(i-1)) + dq_i) ! this won't do + GenecStar%q(i) = log(exp(GenecStar%q(i-1)) + dq_i) ! this won't do end if set_mass_fraction_at_zone = -1 ! This function is incomplete! end function function get_mass(index_of_the_star, mass) - use caramodele, only: gms implicit none real(kindreal):: mass integer:: get_mass, index_of_the_star @@ -2089,72 +1994,68 @@ function get_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, end function function set_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) - use strucmod, only: m - use abundmod, only: & - x,y3,y,xc12,xc13,xc14,xn14,xn15,xo16,xo17,xo18,xf18,xf19,xne20,xne21,xne22,xna23,xmg24,& - xmg25,xmg26,xal26,xal27,xsi28,xprot,xneut,xbid,xbid1 implicit none integer:: index_of_the_star integer:: species, zone, i real(kindreal):: Xj_i integer:: set_mass_fraction_of_species_at_zone - i = m - zone - if (zone <= m) then + i = GenecStar%m - zone + if (zone <= GenecStar%m) then select case(species) case(1) - x(i) = Xj_i + GenecStar%x(i) = Xj_i case(2) - y3(i) = Xj_i + GenecStar%y3(i) = Xj_i case(3) - y(i) = Xj_i + GenecStar%y(i) = Xj_i case(4) - xc12(i) = Xj_i + GenecStar%xc12(i) = Xj_i case(5) - xc13(i) = Xj_i + GenecStar%xc13(i) = Xj_i case(6) - xn14(i) = Xj_i + GenecStar%xn14(i) = Xj_i case(7) - xn14(i) = Xj_i + GenecStar%xn14(i) = Xj_i case(8) - xo16(i) = Xj_i + GenecStar%xo16(i) = Xj_i case(9) - xo17(i) = Xj_i + GenecStar%xo17(i) = Xj_i case(10) - xo18(i) = Xj_i + GenecStar%xo18(i) = Xj_i case(11) - xne20(i) = Xj_i + GenecStar%xne20(i) = Xj_i case(12) - xne22(i) = Xj_i + GenecStar%xne22(i) = Xj_i case(13) - xmg24(i) = Xj_i + GenecStar%xmg24(i) = Xj_i case(14) - xmg25(i) = Xj_i + GenecStar%xmg25(i) = Xj_i case(15) - xmg26(i) = Xj_i + GenecStar%xmg26(i) = Xj_i case(16) - xc14(i) = Xj_i + GenecStar%xc14(i) = Xj_i case(17) - xf18(i) = Xj_i + GenecStar%xf18(i) = Xj_i case(18) - xf19(i) = Xj_i + GenecStar%xf19(i) = Xj_i case(19) - xne21(i) = Xj_i + GenecStar%xne21(i) = Xj_i case(20) - xna23(i) = Xj_i + GenecStar%xna23(i) = Xj_i case(21) - xal26(i) = Xj_i + GenecStar%xal26(i) = Xj_i case(22) - xal27(i) = Xj_i + GenecStar%xal27(i) = Xj_i case(23) - xsi28(i) = Xj_i + GenecStar%xsi28(i) = Xj_i case(24) - xneut(i) = Xj_i + GenecStar%xneut(i) = Xj_i case(25) - xprot(i) = Xj_i + GenecStar%xprot(i) = Xj_i case(26) - xbid(i) = Xj_i + GenecStar%xbid(i) = Xj_i case(27) - xbid1(i) = Xj_i + GenecStar%xbid1(i) = Xj_i !case default end select end if @@ -2179,7 +2080,6 @@ function set_metallicity(metallicity) end function function get_mu_at_zone(index_of_the_star, zone, mu_i) - use strucmod, only: m implicit none integer:: index_of_the_star integer:: zone, i @@ -2740,27 +2640,25 @@ function get_number_of_particles(n) end function function get_number_of_species(index_of_the_star, n_species) - use inputparam, only: ialflu implicit none integer:: index_of_the_star integer:: n_species integer:: get_number_of_species - !if (ialflu==1) then - n_species = 27 - !else - ! n_species = 15 - !end if + if (GenecStar%ialflu==1) then + n_species = 27 + else + n_species = 15 + end if get_number_of_species = 0 end function function get_firstlast_species_number(first, last) - use inputparam, only: ialflu implicit none !integer:: index_of_the_star integer:: first, last integer:: get_firstlast_species_number first = 1 - if (ialflu==1) then + if (GenecStar%ialflu==1) then last = 27 else last = 15 @@ -2778,12 +2676,11 @@ function get_number_of_zones(index_of_the_star, n_zones) end function function set_number_of_zones(index_of_the_star, n_zones) - use strucmod, only: m implicit none integer:: index_of_the_star integer:: n_zones integer:: set_number_of_zones - m = n_zones + GenecStar%m = n_zones set_number_of_zones = 0 end function @@ -2825,8 +2722,6 @@ function get_pressure_at_zone(index_of_the_star, zone, P_i) !end function function get_radius(index_of_the_star, am_radius) - use caramodele, only: radius - !use strucmod, only: r, m implicit none integer:: index_of_the_star real(kindreal):: am_radius @@ -2837,13 +2732,11 @@ function get_radius(index_of_the_star, am_radius) end function function set_radius(index_of_the_star, am_radius) - use caramodele, only: radius - !use strucmod, only: r, m implicit none integer:: index_of_the_star real(kindreal):: am_radius integer:: set_radius - radius = log10(am_radius) + GenecStar%radius = log10(am_radius) set_radius = 0 end function @@ -2900,15 +2793,14 @@ function get_radius_at_zone(index_of_the_star, zone, R_i) end function function set_radius_at_zone(index_of_the_star, zone, R_i) - use strucmod, only: r, m implicit none integer:: index_of_the_star integer:: zone, i real(kindreal):: R_i integer:: set_radius_at_zone - i = m - zone - if (zone <= m) then - r(i) = log(R_i) + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + GenecStar%r(i) = log(R_i) end if set_radius_at_zone = 0 end function @@ -2922,7 +2814,6 @@ function get_stellar_type(index_of_the_star, stellar_type) end function function get_temperature(index_of_the_star, temperature) - use caramodele, only: teff implicit none integer:: index_of_the_star real(kindreal):: temperature @@ -2932,15 +2823,14 @@ function get_temperature(index_of_the_star, temperature) end function function get_temperature_at_zone(index_of_the_star, zone, T_i) - use strucmod, only: t, m implicit none integer:: index_of_the_star integer:: zone, i real(kindreal):: T_i integer:: get_temperature_at_zone - i = m - zone - if (zone <= m) then - T_i = exp(t(i)) + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + T_i = exp(GenecStar%t(i)) else get_temperature_at_zone = -2 return @@ -2949,7 +2839,6 @@ function get_temperature_at_zone(index_of_the_star, zone, T_i) end function function get_time_step(index_of_the_star, time_step) - use timestep, only: dzeitj implicit none integer:: index_of_the_star real(kindreal):: time_step @@ -2959,22 +2848,13 @@ function get_time_step(index_of_the_star, time_step) end function function get_time(time) - use timestep, only: alter implicit none real(kindreal):: time integer:: get_time - time = alter + time = GenecStar%alter get_time = 0 end function -function star_to_genec() - ! copy values from GenecStar to Genec -end function - -function star_from_genec() - ! copy values to GenecStar from Genec -end function - function new_particle(index_of_the_star, mass, metallicity, am_starname) implicit none integer:: index_of_the_star, key @@ -3049,15 +2929,14 @@ function set_phase(index_of_the_star, phase) end function function set_temperature_at_zone(index_of_the_star, zone, T_i) - use strucmod, only: t, m implicit none integer:: index_of_the_star integer:: zone, i real(kindreal):: T_i integer:: set_temperature_at_zone - i = m - zone - if (zone <= m) then - t(i) = log(T_i) + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + GenecStar%t(i) = log(T_i) end if set_temperature_at_zone = 0 diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 971186934b..34746a29f6 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -1,3 +1,4 @@ +import sys import time import numpy import matplotlib @@ -245,7 +246,7 @@ def initialise_central_abundance(self): 0.05, ) ax.set_ylim(-0.05, 1.05) - if (self.star.phase > 0 and len(self.__age) > 2): + if (self.star.phase > 1 and len(self.__age) > 2): ax.set_xlabel(f'log age/{unit_age}') time_xdata = numpy.log10( 0.01 + @@ -267,7 +268,7 @@ def initialise_central_abundance(self): self.__central_abundance_plots = [] for i, species in enumerate(self.__species): plot, = ax.plot( - [time_xdata], + [-time_xdata], [self.__central_abundance[species]], label=species, # color='red', @@ -282,7 +283,7 @@ def plot_central_abundance(self): self.initialise_central_abundance() unit_age = self.default_units['age'] ax = self.__axes[title] - if (self.star.phase > 0 and len(self.__age) > 2): + if (self.star.phase > 1 and len(self.__age) > 2): ax.set_xlabel(f'log age/{unit_age}') time_xdata = numpy.log10( 0.01 + @@ -301,7 +302,7 @@ def plot_central_abundance(self): ax.set_xlim(xmin, xmax) for i, species in enumerate(self.__species): self.__central_abundance_plots[i].set_xdata( - time_xdata + -time_xdata ) # if self.__phase == 1: # self.__central_abundance_plots[i].set_xdata( @@ -348,7 +349,7 @@ def initialise_abundance_profile(self): ax = self.__axes[title] ax.set_title(title) ax.set_xlim(0, 1) - ax.set_ylim(-4, 0) + ax.set_ylim(-4.05, 0.05) ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') self.__initialised.append(title) self.__abundance_plots = [] @@ -413,7 +414,7 @@ def initialise_gradient(self): plot_2, = ax.plot(mass_profile, nabla_rad, label='Nabla_rad') plot_3, = ax.plot(mass_profile, nabla_mu, label='Nabla_mu') ax.plot(mass_profile, 0*mass_profile, linestyle='--', color='black') - ax.set_ylim((min_nabla, max_nabla)) + ax.set_ylim((min_nabla, min(max_nabla, 10))) self.__gradient_plots.append(plot_1) self.__gradient_plots.append(plot_2) self.__gradient_plots.append(plot_3) @@ -597,3 +598,14 @@ def plot_all(self, speed=0 | units.Myr / units.minute, step=None): self.__redraw = False plt.pause(0.01) # plt.show(block=False) + + +def main(): + # star = read_set_from_file(sys.argv[1])[0] + # plotting = StellarModelPlot() + + return + + +if __name__ == "__main__": + main() From a1346a97ef52a06cc08ecd786dc5f53b3b2eae6f Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 20 Dec 2022 15:57:04 +0100 Subject: [PATCH 47/72] Updates to plots (add some energies, fix some bugs) --- src/amuse/community/genec/interface.f90 | 39 +++++ src/amuse/community/genec/interface.py | 191 +++++++++++++++++++++-- src/amuse/community/genec/plot_models.py | 177 ++++++++++++++------- 3 files changed, 331 insertions(+), 76 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index abeea3e9cf..188189f842 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -2740,6 +2740,45 @@ function set_radius(index_of_the_star, am_radius) set_radius = 0 end function +function get_eps_at_zone(index_of_the_star, zone, eps) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: eps + integer:: get_eps_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + eps = GenecStar%eps(i) + end if + get_eps_at_zone = 0 +end function + +function get_epsy_at_zone(index_of_the_star, zone, epsy) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: epsy + integer:: get_epsy_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + epsy = GenecStar%epsy(i) + end if + get_epsy_at_zone = 0 +end function + +function get_eps_c_adv_at_zone(index_of_the_star, zone, eps_c_adv) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: eps_c_adv + integer:: get_eps_c_adv_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + eps_c_adv = GenecStar%eps_c_adv(i) + end if + get_eps_c_adv_at_zone = 0 +end function + function get_nabla_rad_at_zone(index_of_the_star, zone, nabla_rad) implicit none integer:: index_of_the_star diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 4a4a666d8e..dec30f417e 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -3615,6 +3615,96 @@ def get_mass_of_species(): """ return function + @legacy_function + def get_eps_at_zone(): + """ + Retrieve eps at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'eps', dtype='float64', direction=function.OUT, + description=( + "eps at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + @legacy_function + def get_epsy_at_zone(): + """ + Retrieve epsy at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'epsy', dtype='float64', direction=function.OUT, + description=( + "epsy at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + @legacy_function + def get_eps_c_adv_at_zone(): + """ + Retrieve eps at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'eps_c_adv', dtype='float64', direction=function.OUT, + description=( + "eps_c_adv at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + @legacy_function def get_nabla_rad_at_zone(): """ @@ -6098,8 +6188,8 @@ def define_parameters(self, handler): def define_particle_sets(self, handler): - # for particle_set in ['particles', 'fullparticles']: - for set_name in ['fullparticles']: + # for set_name in ['fullparticles']: + for set_name in ['particles', 'fullparticles']: handler.define_set(set_name, 'index_of_the_star') InternalStellarStructure.define_particle_sets( self, handler, set_name=set_name @@ -6131,6 +6221,9 @@ def define_particle_sets(self, handler): # handler.add_method(set_name, 'get_temperature_profile') # handler.add_method(set_name, 'get_luminosity_profile') handler.add_method(set_name, 'get_mass_profile') + handler.add_method(set_name, 'get_eps_profile') + handler.add_method(set_name, 'get_epsy_profile') + handler.add_method(set_name, 'get_eps_c_adv_profile') handler.add_method(set_name, 'get_cumulative_mass_profile') handler.add_getter( set_name, 'get_surface_velocity', names=('surface_velocity',) @@ -6158,6 +6251,21 @@ def define_particle_sets(self, handler): names=('nabla_mu_profile',) ) + handler.add_gridded_getter( + set_name, + 'get_eps_at_zone', 'get_firstlast_zone', + names=('eps_profile',) + ) + handler.add_gridded_getter( + set_name, + 'get_epsy_at_zone', 'get_firstlast_zone', + names=('epsy_profile',) + ) + handler.add_gridded_getter( + set_name, + 'get_eps_c_adv_at_zone', 'get_firstlast_zone', + names=('eps_c_adv_profile',) + ) handler.add_gridded_getter( set_name, 'get_radius_at_zone', 'get_firstlast_zone', @@ -6222,15 +6330,15 @@ def define_particle_sets(self, handler): names=(f'abundance_{species}',) ) - @property - def particles(self): - basic_attributes = [ - "age", "mass", "radius", "temperature", "luminosity", - ] - return ParticlesWithFilteredAttributes( - self.fullparticles, - basic_attributes, - ) + # @property + # def particles(self): + # basic_attributes = [ + # "age", "mass", "radius", "temperature", "luminosity", + # ] + # return ParticlesWithFilteredAttributes( + # self.fullparticles, + # basic_attributes, + # ) def define_state(self, handler): StellarEvolution.define_state(self, handler) @@ -6258,6 +6366,9 @@ def define_state(self, handler): handler.add_method(state, 'get_pressure_at_zone') handler.add_method(state, 'get_radius') handler.add_method(state, 'get_radius_at_zone') + handler.add_method(state, 'get_eps_at_zone') + handler.add_method(state, 'get_epsy_at_zone') + handler.add_method(state, 'get_eps_c_adv_at_zone') handler.add_method(state, 'get_surface_velocity') handler.add_method(state, 'get_temperature') handler.add_method(state, 'get_temperature_at_zone') @@ -6314,11 +6425,11 @@ def define_methods(self, handler): # (handler.INDEX,), # (units.RSun, handler.ERROR_CODE,) # ) - # handler.add_method( - # "get_number_of_zones", - # (handler.INDEX,), - # (handler.NO_UNIT, handler.ERROR_CODE,) - # ) + handler.add_method( + "get_number_of_zones", + (handler.INDEX,), + (handler.NO_UNIT, handler.ERROR_CODE,) + ) # handler.add_method( # "get_radius_at_zone", # (handler.INDEX, handler.NO_UNIT,), @@ -6372,6 +6483,54 @@ def define_methods(self, handler): # list(range(number_of_zones)) | units.none # ) + def get_eps_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying eps profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_number_of_zones(indices_of_the_stars) + return self.get_eps_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + + def get_epsy_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying epsy profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_number_of_zones(indices_of_the_stars) + return self.get_epsy_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + + def get_eps_c_adv_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying eps_c_adv profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_number_of_zones(indices_of_the_stars) + return self.get_eps_c_adv_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + def get_mass_profile( self, indices_of_the_stars, diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index 34746a29f6..a063f89dc1 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -1,6 +1,6 @@ import sys import time -import numpy +import numpy as np import matplotlib import matplotlib.pyplot as plt from amuse.units import units @@ -28,11 +28,13 @@ def __init__(self, star): self.__central_density = [] | self.default_units['density'] self.__central_temperature = [] | self.default_units['temperature'] self.__central_abundance = {} - self.__species = star.get_names_of_species() + self.__species = np.array(star.get_names_of_species()) + self.__mainspecies = ["H", "He", "C12", "N14", "O16", "Ne20"] + # , "Si", "Ni", "Fe"] # self.__zones = star.get_number_of_zones() self.__abundances = star.get_chemical_abundance_profiles() for species in self.__species: - self.__central_abundance[species] = [] + self.__central_abundance[species.capitalize()] = [] self.__figures = { "1": plt.figure(num="Evolution", figsize=(8, 6)), @@ -45,6 +47,8 @@ def __init__(self, star): ax_temp = self.__figures["2"].add_subplot(2, 2, 4) ax_pres = ax_temp.twinx() + ax_lum = self.__figures["2"].add_subplot(2, 2, 3) + ax_energy = ax_lum.twinx() self.__axes = { "HR": self.__figures["1"].add_subplot(2, 2, 1), "temp_dens": self.__figures["1"].add_subplot(2, 2, 2), @@ -52,7 +56,10 @@ def __init__(self, star): "Kippenhahn diagram": self.__figures["1"].add_subplot(2, 2, 4), "Abundance profile": self.__figures["2"].add_subplot(2, 2, 1), "gradient": self.__figures["2"].add_subplot(2, 2, 2), - "Luminosity and energy production": self.__figures["2"].add_subplot(2, 2, 3), + "Luminosity and energy production": ( + ax_lum, + ax_energy, + ), "Temperature and pressure": ( ax_temp, ax_pres, @@ -78,7 +85,7 @@ def update(self, star): # self.__zones = star.get_number_of_zones() self.__abundances = star.get_chemical_abundance_profiles() for i, species in enumerate(self.__species): - self.__central_abundance[species].append( + self.__central_abundance[species.capitalize()].append( self.__abundances[i, 0] ) @@ -94,7 +101,7 @@ def draw( f"mass: {self.star.mass.in_(units.MSun)}, " f"radius: {self.star.radius.in_(units.RSun)}, " f"step: {step}, " - # f"log(speedup) = {numpy.log10(speed):.2f}" + # f"log(speedup) = {np.log10(speed):.2f}" f"speed: {speed.in_(units.Myr / units.minute)}" ) fig.canvas.draw_idle() @@ -106,29 +113,29 @@ def initialise_hr(self): unit_lum = self.default_units['luminosity'] ax = self.__axes[title] ax.set_title(title) - log_tstar = numpy.log10( + log_tstar = np.log10( self.star.temperature.value_in(unit_temp) ) ax.set_xlim( log_tstar + 0.1, log_tstar - 0.1, ) - log_lstar = numpy.log10( + log_lstar = np.log10( self.star.luminosity.value_in(unit_lum) ) ax.set_ylim(log_lstar - 0.1, log_lstar + 0.1) ax.set_xlabel(f'log (temperature / {unit_temp})') ax.set_ylabel(f'log (luminosity / {unit_lum})') - ax.ticklabel_format(style='sci',scilimits=(-3,4),axis='both') + ax.ticklabel_format(style='sci', scilimits=(-3, 4), axis='both') self.__hr_plot, = ax.plot( - [numpy.log10(self.star.temperature.value_in(unit_temp))], - [numpy.log10(self.star.luminosity.value_in(unit_lum))], + [np.log10(self.star.temperature.value_in(unit_temp))], + [np.log10(self.star.luminosity.value_in(unit_lum))], # color='red', # linewidth=2, ) self.__hr_star = ax.scatter( - [numpy.log10(self.star.temperature.value_in(unit_temp))], - [numpy.log10(self.star.luminosity.value_in(unit_lum))], + [np.log10(self.star.temperature.value_in(unit_temp))], + [np.log10(self.star.luminosity.value_in(unit_lum))], facecolor='red', s=40, edgecolor=None, @@ -143,10 +150,10 @@ def plot_hr(self): unit_temp = self.default_units['temperature'] unit_lum = self.default_units['luminosity'] ax = self.__axes[title] - log_temperature = numpy.log10( + log_temperature = np.log10( self.__temperature.value_in(unit_temp) ) - log_luminosity = numpy.log10( + log_luminosity = np.log10( self.__luminosity.value_in(unit_lum) ) ax.set_xlim( @@ -160,8 +167,8 @@ def plot_hr(self): self.__hr_plot.set_xdata(log_temperature) self.__hr_plot.set_ydata(log_luminosity) offsets = self.__hr_star.get_offsets() - offsets[:, 0] = [numpy.log10(self.star.temperature.value_in(unit_temp))] - offsets[:, 1] = [numpy.log10(self.star.luminosity.value_in(unit_lum))] + offsets[:, 0] = [np.log10(self.star.temperature.value_in(unit_temp))] + offsets[:, 1] = [np.log10(self.star.luminosity.value_in(unit_lum))] self.__hr_star.set_offsets(offsets) # fig = self.__figures # fig.canvas.draw_idle() @@ -172,14 +179,14 @@ def initialise_temp_dens(self): unit_dens = self.default_units['density'] ax = self.__axes[title] ax.set_title(title) - log_central_density_star = numpy.log10( + log_central_density_star = np.log10( self.star.central_density.value_in(unit_dens) ) ax.set_xlim( log_central_density_star - 0.1, log_central_density_star + 0.1 ) - log_central_temperature_star = numpy.log10( + log_central_temperature_star = np.log10( self.star.central_temperature.value_in(unit_temp) ) ax.set_ylim( @@ -188,7 +195,7 @@ def initialise_temp_dens(self): ) ax.set_xlabel(f'log (rho$_c$ / {unit_dens})') ax.set_ylabel(f'log (temp$_c$ / {unit_temp})') - ax.ticklabel_format(style='sci',scilimits=(-3,4),axis='both') + ax.ticklabel_format(style='sci', scilimits=(-3, 4), axis='both') self.__temp_dens_plot, = ax.plot( [], [], @@ -210,10 +217,10 @@ def plot_temp_dens(self): unit_temp = self.default_units['temperature'] unit_dens = self.default_units['density'] ax = self.__axes[title] - log_central_density = numpy.log10( + log_central_density = np.log10( self.__central_density.value_in(unit_dens) ) - log_central_temperature = numpy.log10( + log_central_temperature = np.log10( self.__central_temperature.value_in(unit_temp) ) ax.set_xlim( @@ -228,10 +235,10 @@ def plot_temp_dens(self): self.__temp_dens_plot.set_ydata(log_central_temperature) offsets = self.__temp_dens_star.get_offsets() offsets[:, 0] = [ - numpy.log10(self.star.central_density.value_in(unit_dens)) + np.log10(self.star.central_density.value_in(unit_dens)) ] offsets[:, 1] = [ - numpy.log10(self.star.central_temperature.value_in(unit_temp)) + np.log10(self.star.central_temperature.value_in(unit_temp)) ] self.__temp_dens_star.set_offsets(offsets) @@ -248,7 +255,7 @@ def initialise_central_abundance(self): ax.set_ylim(-0.05, 1.05) if (self.star.phase > 1 and len(self.__age) > 2): ax.set_xlabel(f'log age/{unit_age}') - time_xdata = numpy.log10( + time_xdata = np.log10( 0.01 + ( 1.0 * self.__age[-1].value_in(unit_age) @@ -266,7 +273,7 @@ def initialise_central_abundance(self): axis='both', ) self.__central_abundance_plots = [] - for i, species in enumerate(self.__species): + for i, species in enumerate(self.__mainspecies): plot, = ax.plot( [-time_xdata], [self.__central_abundance[species]], @@ -285,7 +292,7 @@ def plot_central_abundance(self): ax = self.__axes[title] if (self.star.phase > 1 and len(self.__age) > 2): ax.set_xlabel(f'log age/{unit_age}') - time_xdata = numpy.log10( + time_xdata = -np.log10( 0.01 + ( 1.0 * self.__age[-1].value_in(unit_age) @@ -297,12 +304,9 @@ def plot_central_abundance(self): ax.set_xlabel(f'age ({unit_age})') time_xdata = self.__age.value_in(unit_age) - xmax = max(time_xdata) + 0.05 - xmin = min(time_xdata) - ax.set_xlim(xmin, xmax) - for i, species in enumerate(self.__species): + for i, species in enumerate(self.__mainspecies): self.__central_abundance_plots[i].set_xdata( - -time_xdata + time_xdata ) # if self.__phase == 1: # self.__central_abundance_plots[i].set_xdata( @@ -314,7 +318,7 @@ def plot_central_abundance(self): # (self.__star.age - self.__age).value_in(unit_age) # ) self.__central_abundance_plots[i].set_ydata( - self.__central_abundance[species] + self.__central_abundance[species.capitalize()] ) # if self.__phase > 1: # central_abundance[self.__species[0]] < 1e-4: # ax.set_xscale('log') @@ -354,13 +358,15 @@ def initialise_abundance_profile(self): self.__initialised.append(title) self.__abundance_plots = [] mass_profile = self.star.get_cumulative_mass_profile() - for i, species in enumerate(self.__species): + for i, species in enumerate(self.__mainspecies): + j = np.argmax(species.lower() == self.__species) plot, = ax.plot( mass_profile, - numpy.log10(self.__abundances[i]), + np.log10(self.__abundances[j]), label=species, ) self.__abundance_plots.append(plot) + # ax.legend() self.__initialised.append(title) def plot_abundance_profile(self): @@ -378,12 +384,13 @@ def plot_abundance_profile(self): # if len(mass_profile) != len(self.__abundance_plots[0].get_xdata()): # self.initialise_abundance_profile() - for i, species in enumerate(self.__species): + for i, species in enumerate(self.__mainspecies): + j = np.argmax(species.lower() == self.__species) self.__abundance_plots[i].set_xdata( mass_profile ) self.__abundance_plots[i].set_ydata( - numpy.log10(self.__abundances[i]) + np.log10(self.__abundances[j]) ) def initialise_gradient(self): @@ -402,7 +409,7 @@ def initialise_gradient(self): min(nabla_ad), min(nabla_rad), min(nabla_mu), - 0 + -0.05 ) max_nabla = max( max(nabla_ad), @@ -412,7 +419,7 @@ def initialise_gradient(self): ) plot_1, = ax.plot(mass_profile, nabla_ad, label='Nabla_ad') plot_2, = ax.plot(mass_profile, nabla_rad, label='Nabla_rad') - plot_3, = ax.plot(mass_profile, nabla_mu, label='Nabla_mu') + plot_3, = ax.plot(mass_profile, nabla_mu, label='Nabla_mu', alpha=0.5) ax.plot(mass_profile, 0*mass_profile, linestyle='--', color='black') ax.set_ylim((min_nabla, min(max_nabla, 10))) self.__gradient_plots.append(plot_1) @@ -438,13 +445,16 @@ def plot_gradient(self): nabla_mu = self.star.nabla_mu_profile min_nabla = min( min(nabla_ad), - min(nabla_rad) + min(nabla_rad), + min(nabla_mu), + -0.05 ) max_nabla = max( max(nabla_ad), - max(nabla_rad) + max(nabla_rad), + 0 ) - ax.set_ylim((min_nabla, max_nabla)) + ax.set_ylim((min_nabla, min(max_nabla, 10))) for i in range(3): self.__gradient_plots[i].set_xdata( mass_profile @@ -456,58 +466,105 @@ def plot_gradient(self): def initialise_luminosity_energy_production(self): title = "Luminosity and energy production" - ax = self.__axes[title] + ax_lum = self.__axes[title][0] + ax_energy = self.__axes[title][1] self.__lum_en_plots = [] - ax.set_title(title) - ax.set_xlim(0, 1) - ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') + ax_lum.set_title(title) + ax_lum.set_xlim(0, 1) + ax_energy.set_xlim(0, 1) + ax_lum.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') mass_profile = self.star.get_cumulative_mass_profile() luminosity_profile = self.star.luminosity_profile.value_in( units.LSun ) luminosity_profile = luminosity_profile / max(luminosity_profile) - plot_lum, = ax.plot( - mass_profile, luminosity_profile, label="lum", + plot_lum, = ax_lum.plot( + mass_profile, luminosity_profile, label="lum", color="black" ) - ax.set_ylim( + ax_lum.set_ylim( ( min(luminosity_profile)-0.1, max(luminosity_profile)+0.1, ) ) + + eps = self.star.get_eps_profile() + eps[eps <= 0.] = 1e-32 + eps_H_log = np.log10(eps) + epsy = self.star.get_epsy_profile() + epsy[epsy <= 0.] = 1e-32 + eps_He_log = np.log10(epsy) + max_eps = max(max(eps_H_log), max(eps_He_log)) + min_eps = max(min(eps_H_log), 2) + + ax_energy.set_ylim( + (min_eps, max_eps) + ) + plot_eps, = ax_energy.plot( + mass_profile, + eps_H_log, label="eps_H", + ) + plot_epsy, = ax_energy.plot( + mass_profile, + eps_He_log, label="eps_He", + ) self.__lum_en_plots.append(plot_lum) + self.__lum_en_plots.append(plot_eps) + self.__lum_en_plots.append(plot_epsy) self.__initialised.append(title) def plot_luminosity_energy_production(self): title = "Luminosity and energy production" if self.__redraw: - ax = self.__axes[title] - ax.clear() + ax_lum = self.__axes[title][0] + ax_lum.clear() + ax_energy = self.__axes[title][1] + ax_energy.clear() if ( title not in self.__initialised or self.__redraw ): self.initialise_luminosity_energy_production() return - ax = self.__axes[title] + ax_lum = self.__axes[title][0] + ax_energy = self.__axes[title][1] mass_profile = self.star.get_cumulative_mass_profile() luminosity_profile = self.star.luminosity_profile.value_in( units.LSun ) luminosity_profile = luminosity_profile / max(luminosity_profile) - self.__lum_en_plots[0].set_xdata( - mass_profile - ) + for i, plot in enumerate(self.__lum_en_plots): + plot.set_xdata( + mass_profile + ) self.__lum_en_plots[0].set_ydata( luminosity_profile ) - ax.set_ylim( + ax_lum.set_ylim( ( min(luminosity_profile)-0.1, max(luminosity_profile)+0.1, ) ) + eps = self.star.get_eps_profile() + eps[eps <= 0.] = 1e-32 + eps_H_log = np.log10(eps) + epsy = self.star.get_epsy_profile() + epsy[epsy <= 0.] = 1e-32 + eps_He_log = np.log10(epsy) + max_eps = max(max(eps_H_log), max(eps_He_log)) + min_eps = max(min(eps_H_log), 2) + + ax_energy.set_ylim( + (min_eps, max_eps) + ) + for i, ydata in enumerate( + [eps_H_log, eps_He_log, ] + ): + self.__lum_en_plots[1+i].set_ydata( + ydata, + ) def initialise_temperature_pressure(self): title = "Temperature and pressure" @@ -520,10 +577,10 @@ def initialise_temperature_pressure(self): ax_pres = self.__axes[title][1] ax_pres.set_ylabel('log(P)') mass_profile = self.star.get_cumulative_mass_profile() - temperature_profile = numpy.log10( + temperature_profile = np.log10( self.star.temperature_profile.value_in(units.K) ) - pressure_profile = numpy.log10( + pressure_profile = np.log10( self.star.pressure_profile.number ) plot_temp, = ax.plot( @@ -556,10 +613,10 @@ def plot_temperature_pressure(self): ax = self.__axes[title][0] ax_pres = self.__axes[title][1] mass_profile = self.star.get_cumulative_mass_profile() - temperature_profile = numpy.log10( + temperature_profile = np.log10( self.star.temperature_profile.value_in(units.K) ) - pressure_profile = numpy.log10( + pressure_profile = np.log10( self.star.pressure_profile.number ) for i in (0, 1): From 724403e1d0b8555af36ec8753cbbbcef28206cac Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 20 Dec 2022 18:01:07 +0100 Subject: [PATCH 48/72] add remaining eps --- src/amuse/community/genec/interface.f90 | 65 ++++++ src/amuse/community/genec/interface.py | 267 +++++++++++++++++++++++- 2 files changed, 331 insertions(+), 1 deletion(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 188189f842..4476a52a86 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -2779,6 +2779,71 @@ function get_eps_c_adv_at_zone(index_of_the_star, zone, eps_c_adv) get_eps_c_adv_at_zone = 0 end function +function get_eps_ne_adv_at_zone(index_of_the_star, zone, eps_ne_adv) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: eps_ne_adv + integer:: get_eps_ne_adv_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + eps_ne_adv = GenecStar%eps_ne_adv(i) + end if + get_eps_ne_adv_at_zone = 0 +end function + +function get_eps_o_adv_at_zone(index_of_the_star, zone, eps_o_adv) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: eps_o_adv + integer:: get_eps_o_adv_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + eps_o_adv = GenecStar%eps_o_adv(i) + end if + get_eps_o_adv_at_zone = 0 +end function + +function get_eps_si_adv_at_zone(index_of_the_star, zone, eps_si_adv) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: eps_si_adv + integer:: get_eps_si_adv_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + eps_si_adv = GenecStar%eps_si_adv(i) + end if + get_eps_si_adv_at_zone = 0 +end function + +function get_eps_grav_at_zone(index_of_the_star, zone, eps_grav) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: eps_grav + integer:: get_eps_grav_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + eps_grav = GenecStar%eps_grav(i) + end if + get_eps_grav_at_zone = 0 +end function + +function get_eps_nu_at_zone(index_of_the_star, zone, eps_nu) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: eps_nu + integer:: get_eps_nu_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + eps_nu = GenecStar%eps_nu(i) + end if + get_eps_nu_at_zone = 0 +end function + function get_nabla_rad_at_zone(index_of_the_star, zone, nabla_rad) implicit none integer:: index_of_the_star diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index dec30f417e..5d7b5330a8 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -3678,7 +3678,7 @@ def get_epsy_at_zone(): @legacy_function def get_eps_c_adv_at_zone(): """ - Retrieve eps at the specified zone/mesh-cell of the star. + Retrieve eps_c_adv at the specified zone/mesh-cell of the star. """ function = LegacyFunctionSpecification() function.can_handle_array = True @@ -3705,6 +3705,156 @@ def get_eps_c_adv_at_zone(): """ return function + @legacy_function + def get_eps_ne_adv_at_zone(): + """ + Retrieve eps_ne_adv at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'eps_ne_adv', dtype='float64', direction=function.OUT, + description=( + "eps_ne_adv at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + @legacy_function + def get_eps_o_adv_at_zone(): + """ + Retrieve eps_o_adv at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'eps_o_adv', dtype='float64', direction=function.OUT, + description=( + "eps_o_adv at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + @legacy_function + def get_eps_si_adv_at_zone(): + """ + Retrieve eps_si_adv at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'eps_si_adv', dtype='float64', direction=function.OUT, + description=( + "eps_si_adv at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + @legacy_function + def get_eps_grav_at_zone(): + """ + Retrieve eps_grav at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'eps_grav', dtype='float64', direction=function.OUT, + description=( + "eps_grav at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + + @legacy_function + def get_eps_nu_at_zone(): + """ + Retrieve eps_nu at the specified zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to get the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to get the value of") + function.addParameter( + 'eps_nu', dtype='float64', direction=function.OUT, + description=( + "eps_nu at the specified zone/mesh-cell of the star." + ) + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was retrieved. + -1 - ERROR + A star with the given index was not found. + -2 - ERROR + A zone with the given index was not found. + """ + return function + @legacy_function def get_nabla_rad_at_zone(): """ @@ -6224,6 +6374,11 @@ def define_particle_sets(self, handler): handler.add_method(set_name, 'get_eps_profile') handler.add_method(set_name, 'get_epsy_profile') handler.add_method(set_name, 'get_eps_c_adv_profile') + handler.add_method(set_name, 'get_eps_ne_adv_profile') + handler.add_method(set_name, 'get_eps_o_adv_profile') + handler.add_method(set_name, 'get_eps_si_adv_profile') + handler.add_method(set_name, 'get_eps_grav_profile') + handler.add_method(set_name, 'get_eps_nu_profile') handler.add_method(set_name, 'get_cumulative_mass_profile') handler.add_getter( set_name, 'get_surface_velocity', names=('surface_velocity',) @@ -6266,6 +6421,31 @@ def define_particle_sets(self, handler): 'get_eps_c_adv_at_zone', 'get_firstlast_zone', names=('eps_c_adv_profile',) ) + handler.add_gridded_getter( + set_name, + 'get_eps_ne_adv_at_zone', 'get_firstlast_zone', + names=('eps_ne_adv_profile',) + ) + handler.add_gridded_getter( + set_name, + 'get_eps_o_adv_at_zone', 'get_firstlast_zone', + names=('eps_o_adv_profile',) + ) + handler.add_gridded_getter( + set_name, + 'get_eps_si_adv_at_zone', 'get_firstlast_zone', + names=('eps_si_adv_profile',) + ) + handler.add_gridded_getter( + set_name, + 'get_eps_grav_at_zone', 'get_firstlast_zone', + names=('eps_grav_profile',) + ) + handler.add_gridded_getter( + set_name, + 'get_eps_nu_at_zone', 'get_firstlast_zone', + names=('eps_nu_profile',) + ) handler.add_gridded_getter( set_name, 'get_radius_at_zone', 'get_firstlast_zone', @@ -6369,6 +6549,11 @@ def define_state(self, handler): handler.add_method(state, 'get_eps_at_zone') handler.add_method(state, 'get_epsy_at_zone') handler.add_method(state, 'get_eps_c_adv_at_zone') + handler.add_method(state, 'get_eps_ne_adv_at_zone') + handler.add_method(state, 'get_eps_o_adv_at_zone') + handler.add_method(state, 'get_eps_si_adv_at_zone') + handler.add_method(state, 'get_eps_grav_at_zone') + handler.add_method(state, 'get_eps_nu_at_zone') handler.add_method(state, 'get_surface_velocity') handler.add_method(state, 'get_temperature') handler.add_method(state, 'get_temperature_at_zone') @@ -6531,6 +6716,86 @@ def get_eps_c_adv_profile( list(range(number_of_zones)) | units.none ) + def get_eps_ne_adv_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying eps_c_adv profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_number_of_zones(indices_of_the_stars) + return self.get_eps_ne_adv_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + + def get_eps_o_adv_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying eps_c_adv profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_number_of_zones(indices_of_the_stars) + return self.get_eps_o_adv_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + + def get_eps_si_adv_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying eps_c_adv profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_number_of_zones(indices_of_the_stars) + return self.get_eps_si_adv_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + + def get_eps_grav_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying eps_c_adv profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_number_of_zones(indices_of_the_stars) + return self.get_eps_grav_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + + def get_eps_nu_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying eps_c_adv profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_number_of_zones(indices_of_the_stars) + return self.get_eps_nu_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + def get_mass_profile( self, indices_of_the_stars, From 807ac2ea8e9a855cc8c7b61866708e87fcd495ba Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 20 Dec 2022 18:06:00 +0100 Subject: [PATCH 49/72] plotting updates --- src/amuse/community/genec/plot_models.py | 13 ++++++++----- .../community/genec/test_integrate_default_star.py | 8 -------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/amuse/community/genec/plot_models.py b/src/amuse/community/genec/plot_models.py index a063f89dc1..1f48c06cff 100644 --- a/src/amuse/community/genec/plot_models.py +++ b/src/amuse/community/genec/plot_models.py @@ -248,10 +248,6 @@ def initialise_central_abundance(self): ax = self.__axes[title] ax.set_title(title) - ax.set_xlim( - -0.05, - 0.05, - ) ax.set_ylim(-0.05, 1.05) if (self.star.phase > 1 and len(self.__age) > 2): ax.set_xlabel(f'log age/{unit_age}') @@ -266,6 +262,10 @@ def initialise_central_abundance(self): else: ax.set_xlabel(f'age ({unit_age})') time_xdata = self.__age.value_in(unit_age) + xmax = max(time_xdata) + 0.05 + xmin = min(time_xdata) + ax.set_xlim(xmin, xmax) + ax.set_ylabel('abundance fraction') ax.ticklabel_format( style='sci', @@ -304,6 +304,9 @@ def plot_central_abundance(self): ax.set_xlabel(f'age ({unit_age})') time_xdata = self.__age.value_in(unit_age) + xmax = max(time_xdata) + 0.05 + xmin = min(time_xdata) + ax.set_xlim(xmin, xmax) for i, species in enumerate(self.__mainspecies): self.__central_abundance_plots[i].set_xdata( time_xdata @@ -409,7 +412,7 @@ def initialise_gradient(self): min(nabla_ad), min(nabla_rad), min(nabla_mu), - -0.05 + -0.1 ) max_nabla = max( max(nabla_ad), diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index 25f5c02b2c..f40b79d4b7 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -235,15 +235,7 @@ def write_backup( star_in_evo = evo.fullparticles.add_particle(star) # NOTE: this will now reset parameters... # evo.parameters.idebug = 2 # print(star_in_evo) -star_in_evo.evolve_one_step() -star_in_evo.evolve_one_step() -exit() -# for p in params.items(): -# setattr(evo.parameters, p[0], p[1]) -# evo.commit_particles() -# print(evo.parameters) -#print(star_in_evo.get_radius_at_zone(0)) font = { 'size': 8, } From 5927b73a9f4c25c0b7d40ad1ba02a0cd6051e143 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 10 Jan 2023 13:55:34 +0100 Subject: [PATCH 50/72] Revamping the interface - move from code parameters to particle properties - use simpler remote_functions - add dicts of available properties (note: the order is very important!) --- .../code_examples}/genec/plot_models.py | 0 .../genec/test_integrate_default_star.py | 0 .../genec/test_integrate_difficult_star.py | 0 src/amuse/community/genec/interface.f90 | 2897 +++++---- src/amuse/community/genec/interface.py | 5258 ++++------------- 5 files changed, 2939 insertions(+), 5216 deletions(-) rename {src/amuse/community => examples/code_examples}/genec/plot_models.py (100%) rename {src/amuse/community => examples/code_examples}/genec/test_integrate_default_star.py (100%) rename {src/amuse/community => examples/code_examples}/genec/test_integrate_difficult_star.py (100%) diff --git a/src/amuse/community/genec/plot_models.py b/examples/code_examples/genec/plot_models.py similarity index 100% rename from src/amuse/community/genec/plot_models.py rename to examples/code_examples/genec/plot_models.py diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/examples/code_examples/genec/test_integrate_default_star.py similarity index 100% rename from src/amuse/community/genec/test_integrate_default_star.py rename to examples/code_examples/genec/test_integrate_default_star.py diff --git a/src/amuse/community/genec/test_integrate_difficult_star.py b/examples/code_examples/genec/test_integrate_difficult_star.py similarity index 100% rename from src/amuse/community/genec/test_integrate_difficult_star.py rename to examples/code_examples/genec/test_integrate_difficult_star.py diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 4476a52a86..6cd7d8225e 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -13,21 +13,21 @@ module AmuseInterface public:: BackupGenecStar,number_of_stars contains -function restore_star() +integer function restore_star() implicit none - integer:: restore_star restore_star = 0 end function -function initialize_code() +integer function initialize_code() !use WriteSaveClose, only: quitafterclosing use genec, only: initialise_genec use evol, only: input_dir use inputparam, only: libgenec use io_definitions implicit none - integer:: initialize_code + !io_runfile = 6 + !io_logs = 6 libgenec = .true. !io_logs = 6 input_dir = "./src/GENEC/code" @@ -36,1547 +36,1613 @@ function initialize_code() initialize_code = 0 end function -function read_genec_model(index_of_the_star, cardfilename) +integer function read_genec_model(index_of_the_star, cardfilename) ! This should only be called if no star has been initialised yet! implicit none integer:: index_of_the_star character(256):: cardfilename - integer:: read_genec_model read_genec_model = 0 end function -function cleanup_code() +integer function cleanup_code() implicit none - integer:: cleanup_code cleanup_code = 0 end function ! **** Parameters -function get_model_number(model_number) +integer function get_model_number(model_number) implicit none integer:: model_number - integer:: get_model_number model_number = GenecStar%nwmd get_model_number = 0 end function -function set_model_number(model_number) +integer function set_model_number(model_number) implicit none integer:: model_number - integer:: set_model_number GenecStar%nwmd = model_number set_model_number = 0 end function -function get_min_timestep_stop_condition(min_timestep_stop_condition) +integer function get_min_timestep_stop_condition(min_timestep_stop_condition) implicit none real(kindreal):: min_timestep_stop_condition - integer:: get_min_timestep_stop_condition get_min_timestep_stop_condition = 0 end function -function get_par_n_snap(n_snap_out) + +!######### + + +integer function get_initialised(index_of_the_particle, initialised) implicit none - integer:: n_snap_out - integer:: get_par_n_snap - n_snap_out = GenecStar%n_snap - get_par_n_snap = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(out):: initialised + initialised = GenecStar%initialised + get_initialised = 0 +end function get_initialised -function set_par_n_snap(n_snap_in) +integer function set_initialised(index_of_the_particle, initialised) implicit none - integer:: n_snap_in - integer:: set_par_n_snap - GenecStar%n_snap = n_snap_in - set_par_n_snap= 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(in):: initialised + GenecStar%initialised = initialised + set_initialised = 0 +end function set_initialised -function get_par_ipoly(par_ipoly) +integer function get_starname(index_of_the_particle, starname) implicit none - integer:: par_ipoly - integer:: get_par_ipoly - par_ipoly = InitialGenecStar%ipoly - get_par_ipoly = 0 -end function + integer, intent(in):: index_of_the_particle + character(len=256), intent(out):: starname + starname = GenecStar%starname + get_starname = 0 +end function get_starname -function set_par_ipoly(par_ipoly) +integer function set_starname(index_of_the_particle, starname) implicit none - integer:: par_ipoly - integer:: set_par_ipoly - InitialGenecStar%ipoly = par_ipoly - set_par_ipoly = 0 -end function + integer, intent(in):: index_of_the_particle + character(len=256), intent(in):: starname + GenecStar%starname = starname + set_starname = 0 +end function set_starname -function get_par_nwseq(par_nwseq) +integer function get_nwseq(index_of_the_particle, nwseq) implicit none - integer:: par_nwseq - integer:: get_par_nwseq - par_nwseq = GenecStar%nwseq - get_par_nwseq = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: nwseq + nwseq = GenecStar%nwseq + get_nwseq = 0 +end function get_nwseq -function set_par_nwseq(par_nwseq) +integer function set_nwseq(index_of_the_particle, nwseq) implicit none - integer:: par_nwseq - integer:: set_par_nwseq - GenecStar%nwseq = par_nwseq - set_par_nwseq = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: nwseq + GenecStar%nwseq = nwseq + set_nwseq = 0 +end function set_nwseq -function get_par_modanf(par_modanf) +integer function get_modanf(index_of_the_particle, modanf) implicit none - integer:: par_modanf - integer:: get_par_modanf - par_modanf = GenecStar%modanf - get_par_modanf = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: modanf + modanf = GenecStar%modanf + get_modanf = 0 +end function get_modanf -function set_par_modanf(par_modanf) +integer function set_modanf(index_of_the_particle, modanf) implicit none - integer:: par_modanf - integer:: set_par_modanf - GenecStar%modanf = par_modanf - set_par_modanf = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: modanf + GenecStar%modanf = modanf + set_modanf = 0 +end function set_modanf -function get_par_nzmod(par_nzmod) +integer function get_nzmod(index_of_the_particle, nzmod) implicit none - integer:: par_nzmod - integer:: get_par_nzmod - par_nzmod = GenecStar%nzmod - get_par_nzmod = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: nzmod + nzmod = GenecStar%nzmod + get_nzmod = 0 +end function get_nzmod -function set_par_nzmod(par_nzmod) +integer function set_nzmod(index_of_the_particle, nzmod) implicit none - integer:: par_nzmod - integer:: set_par_nzmod - GenecStar%nzmod = par_nzmod - set_par_nzmod = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: nzmod + GenecStar%nzmod = nzmod + set_nzmod = 0 +end function set_nzmod -function get_par_irot(par_irot) +integer function get_end_at_phase(index_of_the_particle, end_at_phase) implicit none - integer:: par_irot - integer:: get_par_irot - par_irot = GenecStar%irot - get_par_irot = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: end_at_phase + end_at_phase = GenecStar%end_at_phase + get_end_at_phase = 0 +end function get_end_at_phase -function set_par_irot(par_irot) +integer function set_end_at_phase(index_of_the_particle, end_at_phase) implicit none - integer:: par_irot - integer:: set_par_irot - GenecStar%irot = par_irot - set_par_irot = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: end_at_phase + GenecStar%end_at_phase = end_at_phase + set_end_at_phase = 0 +end function set_end_at_phase -function get_par_isol(par_isol) +integer function get_end_at_model(index_of_the_particle, end_at_model) implicit none - integer:: par_isol - integer:: get_par_isol - par_isol = GenecStar%isol - get_par_isol = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: end_at_model + end_at_model = GenecStar%end_at_model + get_end_at_model = 0 +end function get_end_at_model -function set_par_isol(par_isol) +integer function set_end_at_model(index_of_the_particle, end_at_model) implicit none - integer:: par_isol - integer:: set_par_isol - GenecStar%isol = par_isol - set_par_isol = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: end_at_model + GenecStar%end_at_model = end_at_model + set_end_at_model = 0 +end function set_end_at_model -function get_par_imagn(par_imagn) +integer function get_irot(index_of_the_particle, irot) implicit none - integer:: par_imagn - integer:: get_par_imagn - par_imagn = GenecStar%imagn - get_par_imagn = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: irot + irot = GenecStar%irot + get_irot = 0 +end function get_irot -function set_par_imagn(par_imagn) +integer function set_irot(index_of_the_particle, irot) implicit none - integer:: par_imagn - integer:: set_par_imagn - GenecStar%imagn = par_imagn - set_par_imagn = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: irot + GenecStar%irot = irot + set_irot = 0 +end function set_irot -function get_par_ialflu(par_ialflu) +integer function get_isol(index_of_the_particle, isol) implicit none - integer:: par_ialflu - integer:: get_par_ialflu - par_ialflu = GenecStar%ialflu - get_par_ialflu = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: isol + isol = GenecStar%isol + get_isol = 0 +end function get_isol -function set_par_ialflu(par_ialflu) +integer function set_isol(index_of_the_particle, isol) implicit none - integer:: par_ialflu - integer:: set_par_ialflu - GenecStar%ialflu = par_ialflu - set_par_ialflu = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: isol + GenecStar%isol = isol + set_isol = 0 +end function set_isol -function get_par_ianiso(par_ianiso) +integer function get_imagn(index_of_the_particle, imagn) implicit none - integer:: par_ianiso - integer:: get_par_ianiso - par_ianiso = GenecStar%ianiso - get_par_ianiso = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: imagn + imagn = GenecStar%imagn + get_imagn = 0 +end function get_imagn -function set_par_ianiso(par_ianiso) +integer function set_imagn(index_of_the_particle, imagn) implicit none - integer:: par_ianiso - integer:: set_par_ianiso - GenecStar%ianiso = par_ianiso - set_par_ianiso = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: imagn + GenecStar%imagn = imagn + set_imagn = 0 +end function set_imagn -function get_par_ipop3(par_ipop3) +integer function get_ialflu(index_of_the_particle, ialflu) implicit none - integer:: par_ipop3 - integer:: get_par_ipop3 - par_ipop3 = GenecStar%ipop3 - get_par_ipop3 = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: ialflu + ialflu = GenecStar%ialflu + get_ialflu = 0 +end function get_ialflu -function set_par_ipop3(par_ipop3) +integer function set_ialflu(index_of_the_particle, ialflu) implicit none - integer:: par_ipop3 - integer:: set_par_ipop3 - GenecStar%ipop3 = par_ipop3 - set_par_ipop3 = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: ialflu + GenecStar%ialflu = ialflu + set_ialflu = 0 +end function set_ialflu -function get_par_ibasnet(par_ibasnet) +integer function get_ianiso(index_of_the_particle, ianiso) implicit none - integer:: par_ibasnet - integer:: get_par_ibasnet - par_ibasnet = GenecStar%ibasnet - get_par_ibasnet = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: ianiso + ianiso = GenecStar%ianiso + get_ianiso = 0 +end function get_ianiso -function set_par_ibasnet(par_ibasnet) +integer function set_ianiso(index_of_the_particle, ianiso) implicit none - integer:: par_ibasnet - integer:: set_par_ibasnet - GenecStar%ibasnet = par_ibasnet - set_par_ibasnet = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: ianiso + GenecStar%ianiso = ianiso + set_ianiso = 0 +end function set_ianiso -function get_par_iopac(par_iopac) +integer function get_ipop3(index_of_the_particle, ipop3) implicit none - integer:: par_iopac - integer:: get_par_iopac - par_iopac = GenecStar%iopac - get_par_iopac = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: ipop3 + ipop3 = GenecStar%ipop3 + get_ipop3 = 0 +end function get_ipop3 -function set_par_iopac(par_iopac) +integer function set_ipop3(index_of_the_particle, ipop3) implicit none - integer:: par_iopac - integer:: set_par_iopac - GenecStar%iopac = par_iopac - set_par_iopac = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: ipop3 + GenecStar%ipop3 = ipop3 + set_ipop3 = 0 +end function set_ipop3 -function get_par_ikappa(par_ikappa) +integer function get_ibasnet(index_of_the_particle, ibasnet) implicit none - integer:: par_ikappa - integer:: get_par_ikappa - par_ikappa = GenecStar%ikappa - get_par_ikappa = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: ibasnet + ibasnet = GenecStar%ibasnet + get_ibasnet = 0 +end function get_ibasnet -function set_par_ikappa(par_ikappa) +integer function set_ibasnet(index_of_the_particle, ibasnet) implicit none - integer:: par_ikappa - integer:: set_par_ikappa - GenecStar%ikappa = par_ikappa - set_par_ikappa = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: ibasnet + GenecStar%ibasnet = ibasnet + set_ibasnet = 0 +end function set_ibasnet -function get_par_idiff(par_idiff) +integer function get_phase(index_of_the_particle, phase) implicit none - integer:: par_idiff - integer:: get_par_idiff - par_idiff = GenecStar%idiff - get_par_idiff = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: phase + phase = GenecStar%phase + get_phase = 0 +end function get_phase -function set_par_idiff(par_idiff) +integer function set_phase(index_of_the_particle, phase) implicit none - integer:: par_idiff - integer:: set_par_idiff - GenecStar%idiff = par_idiff - set_par_idiff = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: phase + GenecStar%phase = phase + set_phase = 0 +end function set_phase -function get_par_iadvec(par_iadvec) +integer function get_var_rates(index_of_the_particle, var_rates) implicit none - integer:: par_iadvec - integer:: get_par_iadvec - par_iadvec = GenecStar%iadvec - get_par_iadvec = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(out):: var_rates + var_rates = GenecStar%var_rates + get_var_rates = 0 +end function get_var_rates -function set_par_iadvec(par_iadvec) +integer function set_var_rates(index_of_the_particle, var_rates) implicit none - integer:: par_iadvec - integer:: set_par_iadvec - GenecStar%iadvec = par_iadvec - set_par_iadvec = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(in):: var_rates + GenecStar%var_rates = var_rates + set_var_rates = 0 +end function set_var_rates -function get_par_istati(par_istati) +integer function get_bintide(index_of_the_particle, bintide) implicit none - integer:: par_istati - integer:: get_par_istati - par_istati = GenecStar%istati - get_par_istati = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(out):: bintide + bintide = GenecStar%bintide + get_bintide = 0 +end function get_bintide -function set_par_istati(par_istati) +integer function set_bintide(index_of_the_particle, bintide) implicit none - integer:: par_istati - integer:: set_par_istati - GenecStar%istati = par_istati - set_par_istati = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(in):: bintide + GenecStar%bintide = bintide + set_bintide = 0 +end function set_bintide -function get_par_icoeff(par_icoeff) +integer function get_binm2(index_of_the_particle, binm2) implicit none - integer:: par_icoeff - integer:: get_par_icoeff - par_icoeff = GenecStar%icoeff - get_par_icoeff = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: binm2 + binm2 = GenecStar%binm2 + get_binm2 = 0 +end function get_binm2 -function set_par_icoeff(par_icoeff) +integer function set_binm2(index_of_the_particle, binm2) implicit none - integer:: par_icoeff - integer:: set_par_icoeff - GenecStar%icoeff = par_icoeff - set_par_icoeff = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: binm2 + GenecStar%binm2 = binm2 + set_binm2 = 0 +end function set_binm2 -function get_par_igamma(par_igamma) +integer function get_periodini(index_of_the_particle, periodini) implicit none - integer:: par_igamma - integer:: get_par_igamma - par_igamma = GenecStar%igamma - get_par_igamma = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: periodini + periodini = GenecStar%periodini + get_periodini = 0 +end function get_periodini -function set_par_igamma(par_igamma) +integer function set_periodini(index_of_the_particle, periodini) implicit none - integer:: par_igamma - integer:: set_par_igamma - GenecStar%igamma = par_igamma - set_par_igamma = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: periodini + GenecStar%periodini = periodini + set_periodini = 0 +end function set_periodini -function get_par_idialo(par_idialo) +integer function get_const_per(index_of_the_particle, const_per) implicit none - integer:: par_idialo - integer:: get_par_idialo - par_idialo = GenecStar%idialo - get_par_idialo = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(out):: const_per + const_per = GenecStar%const_per + get_const_per = 0 +end function get_const_per -function set_par_idialo(par_idialo) +integer function set_const_per(index_of_the_particle, const_per) implicit none - integer:: par_idialo - integer:: set_par_idialo - GenecStar%idialo = par_idialo - set_par_idialo = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(in):: const_per + GenecStar%const_per = const_per + set_const_per = 0 +end function set_const_per -function get_par_idialu(par_idialu) +integer function get_iprezams(index_of_the_particle, iprezams) implicit none - integer:: par_idialu - integer:: get_par_idialu - par_idialu = GenecStar%idialu - get_par_idialu = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: iprezams + iprezams = GenecStar%iprezams + get_iprezams = 0 +end function get_iprezams -function set_par_idialu(par_idialu) +integer function set_iprezams(index_of_the_particle, iprezams) implicit none - integer:: par_idialu - integer:: set_par_idialu - GenecStar%idialu = par_idialu - set_par_idialu = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: iprezams + GenecStar%iprezams = iprezams + set_iprezams = 0 +end function set_iprezams -function get_par_imloss(par_imloss) +integer function get_zinit(index_of_the_particle, zinit) implicit none - integer:: par_imloss - integer:: get_par_imloss - par_imloss = GenecStar%imloss - get_par_imloss = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: zinit + zinit = GenecStar%zinit + get_zinit = 0 +end function get_zinit -function set_par_imloss(par_imloss) +integer function set_zinit(index_of_the_particle, zinit) implicit none - integer:: par_imloss - integer:: set_par_imloss - GenecStar%imloss = par_imloss - set_par_imloss = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: zinit + GenecStar%zinit = zinit + set_zinit = 0 +end function set_zinit -function get_par_ifitm(par_ifitm) +integer function get_zsol(index_of_the_particle, zsol) implicit none - integer:: par_ifitm - integer:: get_par_ifitm - par_ifitm = GenecStar%ifitm - get_par_ifitm = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: zsol + zsol = GenecStar%zsol + get_zsol = 0 +end function get_zsol -function set_par_ifitm(par_ifitm) +integer function set_zsol(index_of_the_particle, zsol) implicit none - integer:: par_ifitm - integer:: set_par_ifitm - GenecStar%ifitm = par_ifitm - set_par_ifitm = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: zsol + GenecStar%zsol = zsol + set_zsol = 0 +end function set_zsol -function get_par_nndr(par_nndr) +integer function get_z(index_of_the_particle, z) implicit none - integer:: par_nndr - integer:: get_par_nndr - par_nndr = GenecStar%nndr - get_par_nndr = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: z + z = GenecStar%z + get_z = 0 +end function get_z -function set_par_nndr(par_nndr) +integer function set_z(index_of_the_particle, z) implicit none - integer:: par_nndr - integer:: set_par_nndr - GenecStar%nndr = par_nndr - set_par_nndr = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: z + GenecStar%z = z + set_z = 0 +end function set_z -function get_par_iledou(par_iledou) +integer function get_iopac(index_of_the_particle, iopac) implicit none - integer:: par_iledou - integer:: get_par_iledou - par_iledou = GenecStar%iledou - get_par_iledou = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: iopac + iopac = GenecStar%iopac + get_iopac = 0 +end function get_iopac -function set_par_iledou(par_iledou) +integer function set_iopac(index_of_the_particle, iopac) implicit none - integer:: par_iledou - integer:: set_par_iledou - GenecStar%iledou = par_iledou - set_par_iledou = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: iopac + GenecStar%iopac = iopac + set_iopac = 0 +end function set_iopac -function get_par_idifcon(par_idifcon) +integer function get_ikappa(index_of_the_particle, ikappa) implicit none - integer:: par_idifcon - integer:: get_par_idifcon - par_idifcon = GenecStar%idifcon - get_par_idifcon = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: ikappa + ikappa = GenecStar%ikappa + get_ikappa = 0 +end function get_ikappa -function set_par_idifcon(par_idifcon) +integer function set_ikappa(index_of_the_particle, ikappa) implicit none - integer:: par_idifcon - integer:: set_par_idifcon - GenecStar%idifcon = par_idifcon - set_par_idifcon = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: ikappa + GenecStar%ikappa = ikappa + set_ikappa = 0 +end function set_ikappa -function get_par_my(par_my) +integer function get_idiff(index_of_the_particle, idiff) implicit none - integer:: par_my - integer:: get_par_my - par_my = GenecStar%my - get_par_my = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: idiff + idiff = GenecStar%idiff + get_idiff = 0 +end function get_idiff -function set_par_my(par_my) +integer function set_idiff(index_of_the_particle, idiff) implicit none - integer:: par_my - integer:: set_par_my - GenecStar%my = par_my - set_par_my = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: idiff + GenecStar%idiff = idiff + set_idiff = 0 +end function set_idiff -function get_par_iover(par_iover) +integer function get_iadvec(index_of_the_particle, iadvec) implicit none - integer:: par_iover - integer:: get_par_iover - par_iover = GenecStar%iover - get_par_iover = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: iadvec + iadvec = GenecStar%iadvec + get_iadvec = 0 +end function get_iadvec -function set_par_iover(par_iover) +integer function set_iadvec(index_of_the_particle, iadvec) implicit none - integer:: par_iover - integer:: set_par_iover - GenecStar%iover = par_iover - set_par_iover = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: iadvec + GenecStar%iadvec = iadvec + set_iadvec = 0 +end function set_iadvec -function get_par_iunder(par_iunder) +integer function get_istati(index_of_the_particle, istati) implicit none - integer:: par_iunder - integer:: get_par_iunder - par_iunder = GenecStar%iunder - get_par_iunder = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: istati + istati = GenecStar%istati + get_istati = 0 +end function get_istati -function set_par_iunder(par_iunder) +integer function set_istati(index_of_the_particle, istati) implicit none - integer:: par_iunder - integer:: set_par_iunder - GenecStar%iunder = par_iunder - set_par_iunder = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: istati + GenecStar%istati = istati + set_istati = 0 +end function set_istati -function get_par_nbchx(par_nbchx) +integer function get_icoeff(index_of_the_particle, icoeff) implicit none - integer:: par_nbchx - integer:: get_par_nbchx - par_nbchx = GenecStar%nbchx - get_par_nbchx = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: icoeff + icoeff = GenecStar%icoeff + get_icoeff = 0 +end function get_icoeff -function set_par_nbchx(par_nbchx) +integer function set_icoeff(index_of_the_particle, icoeff) implicit none - integer:: par_nbchx - integer:: set_par_nbchx - GenecStar%nbchx = par_nbchx - set_par_nbchx = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: icoeff + GenecStar%icoeff = icoeff + set_icoeff = 0 +end function set_icoeff -function get_par_nrband(par_nrband) +integer function get_fenerg(index_of_the_particle, fenerg) implicit none - integer:: par_nrband - integer:: get_par_nrband - par_nrband = GenecStar%nrband - get_par_nrband = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: fenerg + fenerg = GenecStar%fenerg + get_fenerg = 0 +end function get_fenerg -function set_par_nrband(par_nrband) +integer function set_fenerg(index_of_the_particle, fenerg) implicit none - integer:: par_nrband - integer:: set_par_nrband - GenecStar%nrband = par_nrband - set_par_nrband = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: fenerg + GenecStar%fenerg = fenerg + set_fenerg = 0 +end function set_fenerg -function get_par_islow(par_islow) +integer function get_richac(index_of_the_particle, richac) implicit none - integer:: par_islow - integer:: get_par_islow - par_islow = GenecStar%islow - get_par_islow = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: richac + richac = GenecStar%richac + get_richac = 0 +end function get_richac -function set_par_islow(par_islow) +integer function set_richac(index_of_the_particle, richac) implicit none - integer:: par_islow - integer:: set_par_islow - GenecStar%islow = par_islow - set_par_islow = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: richac + GenecStar%richac = richac + set_richac = 0 +end function set_richac -function get_par_icncst(par_icncst) +integer function get_igamma(index_of_the_particle, igamma) implicit none - integer:: par_icncst - integer:: get_par_icncst - par_icncst = GenecStar%icncst - get_par_icncst = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: igamma + igamma = GenecStar%igamma + get_igamma = 0 +end function get_igamma -function set_par_icncst(par_icncst) +integer function set_igamma(index_of_the_particle, igamma) implicit none - integer:: par_icncst - integer:: set_par_icncst - GenecStar%icncst = par_icncst - set_par_icncst = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: igamma + GenecStar%igamma = igamma + set_igamma = 0 +end function set_igamma -function get_par_tauH_fit(par_tauH_fit) +integer function get_frein(index_of_the_particle, frein) implicit none - integer:: par_tauH_fit - integer:: get_par_tauH_fit - par_tauH_fit = GenecStar%tauH_fit - get_par_tauH_fit = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: frein + frein = GenecStar%frein + get_frein = 0 +end function get_frein -function set_par_tauH_fit(par_tauH_fit) +integer function set_frein(index_of_the_particle, frein) implicit none - integer:: par_tauH_fit - integer:: set_par_tauH_fit - GenecStar%tauH_fit = par_tauH_fit - set_par_tauH_fit = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: frein + GenecStar%frein = frein + set_frein = 0 +end function set_frein -function get_par_iauto(par_iauto) +integer function get_K_Kawaler(index_of_the_particle, K_Kawaler) implicit none - integer:: par_iauto - integer:: get_par_iauto - par_iauto = GenecStar%iauto - get_par_iauto = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: K_Kawaler + K_Kawaler = GenecStar%K_Kawaler + get_K_Kawaler = 0 +end function get_K_Kawaler -function set_par_iauto(par_iauto) +integer function set_K_Kawaler(index_of_the_particle, K_Kawaler) implicit none - integer:: par_iauto - integer:: set_par_iauto - GenecStar%iauto = par_iauto - set_par_iauto = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: K_Kawaler + GenecStar%K_Kawaler = K_Kawaler + set_K_Kawaler = 0 +end function set_K_Kawaler -function get_par_iprn(par_iprn) +integer function get_Omega_saturation(index_of_the_particle, Omega_saturation) implicit none - integer:: par_iprn - integer:: get_par_iprn - par_iprn = GenecStar%iprn - get_par_iprn = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: Omega_saturation + Omega_saturation = GenecStar%Omega_saturation + get_Omega_saturation = 0 +end function get_Omega_saturation -function set_par_iprn(par_iprn) +integer function set_Omega_saturation(index_of_the_particle, Omega_saturation) implicit none - integer:: par_iprn - integer:: set_par_iprn - GenecStar%iprn = par_iprn - set_par_iprn = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: Omega_saturation + GenecStar%Omega_saturation = Omega_saturation + set_Omega_saturation = 0 +end function set_Omega_saturation -function get_par_iout(par_iout) +integer function get_rapcrilim(index_of_the_particle, rapcrilim) implicit none - integer:: par_iout - integer:: get_par_iout - par_iout = GenecStar%iout - get_par_iout = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: rapcrilim + rapcrilim = GenecStar%rapcrilim + get_rapcrilim = 0 +end function get_rapcrilim -function set_par_iout(par_iout) +integer function set_rapcrilim(index_of_the_particle, rapcrilim) implicit none - integer:: par_iout - integer:: set_par_iout - GenecStar%iout = par_iout - set_par_iout = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: rapcrilim + GenecStar%rapcrilim = rapcrilim + set_rapcrilim = 0 +end function set_rapcrilim -function get_par_itmin(par_itmin) +integer function get_vwant(index_of_the_particle, vwant) implicit none - integer:: par_itmin - integer:: get_par_itmin - par_itmin = GenecStar%itmin - get_par_itmin = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: vwant + vwant = GenecStar%vwant + get_vwant = 0 +end function get_vwant -function set_par_itmin(par_itmin) +integer function set_vwant(index_of_the_particle, vwant) implicit none - integer:: par_itmin - integer:: set_par_itmin - GenecStar%itmin = par_itmin - set_par_itmin = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: vwant + GenecStar%vwant = vwant + set_vwant = 0 +end function set_vwant -function get_par_idebug(par_idebug) +integer function get_xfom(index_of_the_particle, xfom) implicit none - integer:: par_idebug - integer:: get_par_idebug - par_idebug = GenecStar%idebug - get_par_idebug = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xfom + xfom = GenecStar%xfom + get_xfom = 0 +end function get_xfom -function set_par_idebug(par_idebug) +integer function set_xfom(index_of_the_particle, xfom) implicit none - integer:: par_idebug - integer:: set_par_idebug - GenecStar%idebug = par_idebug - set_par_idebug = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xfom + GenecStar%xfom = xfom + set_xfom = 0 +end function set_xfom -function get_par_itests(par_itests) +integer function get_omega(index_of_the_particle, omega) implicit none - integer:: par_itests - integer:: get_par_itests - par_itests = GenecStar%itests - get_par_itests = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: omega + omega = GenecStar%omega + get_omega = 0 +end function get_omega -function set_par_itests(par_itests) +integer function set_omega(index_of_the_particle, omega) implicit none - integer:: par_itests - integer:: set_par_itests - GenecStar%itests = par_itests - set_par_itests = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: omega + GenecStar%omega = omega + set_omega = 0 +end function set_omega -function get_par_var_rates(par_var_rates) +integer function get_xdial(index_of_the_particle, xdial) implicit none - logical:: par_var_rates - integer:: get_par_var_rates - par_var_rates = GenecStar%var_rates - get_par_var_rates = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xdial + xdial = GenecStar%xdial + get_xdial = 0 +end function get_xdial -function set_par_var_rates(par_var_rates) +integer function set_xdial(index_of_the_particle, xdial) implicit none - logical:: par_var_rates - integer:: set_par_var_rates - GenecStar%var_rates = par_var_rates - set_par_var_rates = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xdial + GenecStar%xdial = xdial + set_xdial = 0 +end function set_xdial -function get_par_bintide(par_bintide) +integer function get_idialo(index_of_the_particle, idialo) implicit none - logical:: par_bintide - integer:: get_par_bintide - par_bintide = GenecStar%bintide - get_par_bintide = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: idialo + idialo = GenecStar%idialo + get_idialo = 0 +end function get_idialo -function set_par_bintide(par_bintide) +integer function set_idialo(index_of_the_particle, idialo) implicit none - logical:: par_bintide - integer:: set_par_bintide - GenecStar%bintide = par_bintide - set_par_bintide = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: idialo + GenecStar%idialo = idialo + set_idialo = 0 +end function set_idialo -function get_par_const_per(par_const_per) +integer function get_idialu(index_of_the_particle, idialu) implicit none - logical:: par_const_per - integer:: get_par_const_per - par_const_per = GenecStar%const_per - get_par_const_per = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: idialu + idialu = GenecStar%idialu + get_idialu = 0 +end function get_idialu -function set_par_const_per(par_const_per) +integer function set_idialu(index_of_the_particle, idialu) implicit none - logical:: par_const_per - integer:: set_par_const_per - GenecStar%const_per = par_const_per - set_par_const_per = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: idialu + GenecStar%idialu = idialu + set_idialu = 0 +end function set_idialu -function get_par_Add_Flux(par_Add_Flux) +integer function get_Add_Flux(index_of_the_particle, Add_Flux) implicit none - logical:: par_Add_Flux - integer:: get_par_Add_Flux - par_Add_Flux = GenecStar%Add_Flux - get_par_Add_Flux = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(out):: Add_Flux + Add_Flux = GenecStar%Add_Flux + get_Add_Flux = 0 +end function get_Add_Flux -function set_par_Add_Flux(par_Add_Flux) +integer function set_Add_Flux(index_of_the_particle, Add_Flux) implicit none - logical:: par_Add_Flux - integer:: set_par_Add_Flux - GenecStar%Add_Flux = par_Add_Flux - set_par_Add_Flux = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(in):: Add_Flux + GenecStar%Add_Flux = Add_Flux + set_Add_Flux = 0 +end function set_Add_Flux -function get_par_diff_only(par_diff_only) +integer function get_diff_only(index_of_the_particle, diff_only) implicit none - logical:: par_diff_only - integer:: get_par_diff_only - par_diff_only = GenecStar%diff_only - get_par_diff_only = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(out):: diff_only + diff_only = GenecStar%diff_only + get_diff_only = 0 +end function get_diff_only -function set_par_diff_only(par_diff_only) +integer function set_diff_only(index_of_the_particle, diff_only) implicit none - logical:: par_diff_only - integer:: set_par_diff_only - GenecStar%diff_only = par_diff_only - set_par_diff_only = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(in):: diff_only + GenecStar%diff_only = diff_only + set_diff_only = 0 +end function set_diff_only -function get_par_RSG_Mdot(par_RSG_Mdot) +integer function get_B_initial(index_of_the_particle, B_initial) implicit none - integer:: par_RSG_Mdot - integer:: get_par_RSG_Mdot - par_RSG_Mdot = GenecStar%RSG_Mdot - get_par_RSG_Mdot = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: B_initial + B_initial = GenecStar%B_initial + get_B_initial = 0 +end function get_B_initial -function set_par_RSG_Mdot(par_RSG_Mdot) +integer function set_B_initial(index_of_the_particle, B_initial) implicit none - integer:: par_RSG_Mdot - integer:: set_par_RSG_Mdot - GenecStar%RSG_Mdot = par_RSG_Mdot - set_par_RSG_Mdot = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: B_initial + GenecStar%B_initial = B_initial + set_B_initial = 0 +end function set_B_initial -function get_par_display_plot(par_display_plot) +integer function get_add_diff(index_of_the_particle, add_diff) implicit none - logical:: par_display_plot - integer:: get_par_display_plot - par_display_plot = GenecStar%display_plot - get_par_display_plot = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: add_diff + add_diff = GenecStar%add_diff + get_add_diff = 0 +end function get_add_diff -function set_par_display_plot(par_display_plot) +integer function set_add_diff(index_of_the_particle, add_diff) implicit none - logical:: par_display_plot - integer:: set_par_display_plot - GenecStar%display_plot = par_display_plot - set_par_display_plot = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: add_diff + GenecStar%add_diff = add_diff + set_add_diff = 0 +end function set_add_diff -function get_par_xyfiles(par_xyfiles) +integer function get_n_mag(index_of_the_particle, n_mag) implicit none - logical:: par_xyfiles - integer:: get_par_xyfiles - par_xyfiles = GenecStar%xyfiles - get_par_xyfiles = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: n_mag + n_mag = GenecStar%n_mag + get_n_mag = 0 +end function get_n_mag -function set_par_xyfiles(par_xyfiles) +integer function set_n_mag(index_of_the_particle, n_mag) implicit none - logical:: par_xyfiles - integer:: set_par_xyfiles - GenecStar%xyfiles = par_xyfiles - set_par_xyfiles = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: n_mag + GenecStar%n_mag = n_mag + set_n_mag = 0 +end function set_n_mag -function get_par_verbose(par_verbose) +integer function get_alpha_F(index_of_the_particle, alpha_F) implicit none - logical:: par_verbose - integer:: get_par_verbose - par_verbose = GenecStar%verbose - get_par_verbose = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: alpha_F + alpha_F = GenecStar%alpha_F + get_alpha_F = 0 +end function get_alpha_F -function set_par_verbose(par_verbose) +integer function set_alpha_F(index_of_the_particle, alpha_F) implicit none - logical:: par_verbose - integer:: set_par_verbose - GenecStar%verbose = par_verbose - set_par_verbose = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: alpha_F + GenecStar%alpha_F = alpha_F + set_alpha_F = 0 +end function set_alpha_F -function get_par_stop_deg(par_stop_deg) +integer function get_nsmooth(index_of_the_particle, nsmooth) implicit none - logical:: par_stop_deg - integer:: get_par_stop_deg - par_stop_deg = GenecStar%stop_deg - get_par_stop_deg = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: nsmooth + nsmooth = GenecStar%nsmooth + get_nsmooth = 0 +end function get_nsmooth -function set_par_stop_deg(par_stop_deg) +integer function set_nsmooth(index_of_the_particle, nsmooth) implicit none - logical:: par_stop_deg - integer:: set_par_stop_deg - GenecStar%stop_deg = par_stop_deg - set_par_stop_deg = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: nsmooth + GenecStar%nsmooth = nsmooth + set_nsmooth = 0 +end function set_nsmooth -function get_par_index_poly(par_index_poly) +integer function get_qminsmooth(index_of_the_particle, qminsmooth) implicit none - real(kindreal):: par_index_poly - integer:: get_par_index_poly - par_index_poly = InitialGenecStar%n - get_par_index_poly = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(out):: qminsmooth + qminsmooth = GenecStar%qminsmooth + get_qminsmooth = 0 +end function get_qminsmooth -function set_par_index_poly(par_index_poly) +integer function set_qminsmooth(index_of_the_particle, qminsmooth) implicit none - real(kindreal):: par_index_poly - integer:: set_par_index_poly - InitialGenecStar%n = par_index_poly - set_par_index_poly = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(in):: qminsmooth + GenecStar%qminsmooth = qminsmooth + set_qminsmooth = 0 +end function set_qminsmooth -function get_par_binm2(par_binm2) - use inputparam, only: binm2 +integer function get_imloss(index_of_the_particle, imloss) implicit none - real(kindreal):: par_binm2 - integer:: get_par_binm2 - par_binm2 = binm2 - get_par_binm2 = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: imloss + imloss = GenecStar%imloss + get_imloss = 0 +end function get_imloss -function set_par_binm2(par_binm2) - use inputparam, only: binm2 +integer function set_imloss(index_of_the_particle, imloss) implicit none - real(kindreal):: par_binm2 - integer:: set_par_binm2 - binm2 = par_binm2 - set_par_binm2 = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: imloss + GenecStar%imloss = imloss + set_imloss = 0 +end function set_imloss -function get_par_periodini(par_periodini) - use inputparam, only: periodini +integer function get_fmlos(index_of_the_particle, fmlos) implicit none - real(kindreal):: par_periodini - integer:: get_par_periodini - par_periodini = periodini - get_par_periodini = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: fmlos + fmlos = GenecStar%fmlos + get_fmlos = 0 +end function get_fmlos -function set_par_periodini(par_periodini) - use inputparam, only: periodini +integer function set_fmlos(index_of_the_particle, fmlos) implicit none - real(kindreal):: par_periodini - integer:: set_par_periodini - periodini = par_periodini - set_par_periodini = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: fmlos + GenecStar%fmlos = fmlos + set_fmlos = 0 +end function set_fmlos -function get_par_zinit(par_zinit) - use inputparam, only: zinit +integer function get_ifitm(index_of_the_particle, ifitm) implicit none - real(kindreal):: par_zinit - integer:: get_par_zinit - par_zinit = zinit - get_par_zinit = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: ifitm + ifitm = GenecStar%ifitm + get_ifitm = 0 +end function get_ifitm -function set_par_zinit(par_zinit) - use inputparam, only: zinit +integer function set_ifitm(index_of_the_particle, ifitm) implicit none - real(kindreal):: par_zinit - integer:: set_par_zinit - zinit = par_zinit - set_par_zinit = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: ifitm + GenecStar%ifitm = ifitm + set_ifitm = 0 +end function set_ifitm -function get_par_zsol(par_zsol) - use inputparam, only: zsol +integer function get_fitm(index_of_the_particle, fitm) implicit none - real(kindreal):: par_zsol - integer:: get_par_zsol - par_zsol = zsol - get_par_zsol = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: fitm + fitm = GenecStar%fitm + get_fitm = 0 +end function get_fitm -function set_par_zsol(par_zsol) - use inputparam, only: zsol +integer function set_fitm(index_of_the_particle, fitm) implicit none - real(kindreal):: par_zsol - integer:: set_par_zsol - zsol = par_zsol - set_par_zsol = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: fitm + GenecStar%fitm = fitm + set_fitm = 0 +end function set_fitm -function get_par_z(par_z) - use inputparam, only: z +integer function get_fitmi(index_of_the_particle, fitmi) implicit none - real(kindreal):: par_z - integer:: get_par_z - par_z = z - get_par_z = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: fitmi + fitmi = GenecStar%fitmi + get_fitmi = 0 +end function get_fitmi -function set_par_z(par_z) - use inputparam, only: z +integer function set_fitmi(index_of_the_particle, fitmi) implicit none - real(kindreal):: par_z - integer:: set_par_z - z = par_z - set_par_z = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: fitmi + GenecStar%fitmi = fitmi + set_fitmi = 0 +end function set_fitmi -function get_par_fenerg(par_fenerg) - use inputparam, only: fenerg +integer function get_deltal(index_of_the_particle, deltal) implicit none - real(kindreal):: par_fenerg - integer:: get_par_fenerg - par_fenerg = fenerg - get_par_fenerg = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: deltal + deltal = GenecStar%deltal + get_deltal = 0 +end function get_deltal -function set_par_fenerg(par_fenerg) - use inputparam, only: fenerg +integer function set_deltal(index_of_the_particle, deltal) implicit none - real(kindreal):: par_fenerg - integer:: set_par_fenerg - fenerg = par_fenerg - set_par_fenerg = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: deltal + GenecStar%deltal = deltal + set_deltal = 0 +end function set_deltal -function get_par_richac(par_richac) - use inputparam, only: richac +integer function get_deltat(index_of_the_particle, deltat) implicit none - real(kindreal):: par_richac - integer:: get_par_richac - par_richac = richac - get_par_richac = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: deltat + deltat = GenecStar%deltat + get_deltat = 0 +end function get_deltat -function set_par_richac(par_richac) - use inputparam, only: richac +integer function set_deltat(index_of_the_particle, deltat) implicit none - real(kindreal):: par_richac - integer:: set_par_richac - richac = par_richac - set_par_richac = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: deltat + GenecStar%deltat = deltat + set_deltat = 0 +end function set_deltat -function get_par_frein(par_frein) - use inputparam, only: frein +integer function get_nndr(index_of_the_particle, nndr) implicit none - real(kindreal):: par_frein - integer:: get_par_frein - par_frein = frein - get_par_frein = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: nndr + nndr = GenecStar%nndr + get_nndr = 0 +end function get_nndr -function set_par_frein(par_frein) - use inputparam, only: frein +integer function set_nndr(index_of_the_particle, nndr) implicit none - real(kindreal):: par_frein - integer:: set_par_frein - frein = par_frein - set_par_frein = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: nndr + GenecStar%nndr = nndr + set_nndr = 0 +end function set_nndr -function get_par_K_Kawaler(par_K_Kawaler) - use inputparam, only: K_Kawaler +integer function get_RSG_Mdot(index_of_the_particle, RSG_Mdot) implicit none - real(kindreal):: par_K_Kawaler - integer:: get_par_K_Kawaler - par_K_Kawaler = K_Kawaler - get_par_K_Kawaler = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: RSG_Mdot + RSG_Mdot = GenecStar%RSG_Mdot + get_RSG_Mdot = 0 +end function get_RSG_Mdot -function set_par_K_Kawaler(par_K_Kawaler) - use inputparam, only: K_Kawaler +integer function set_RSG_Mdot(index_of_the_particle, RSG_Mdot) implicit none - real(kindreal):: par_K_Kawaler - integer:: set_par_K_Kawaler - K_Kawaler = par_K_Kawaler - set_par_K_Kawaler = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: RSG_Mdot + GenecStar%RSG_Mdot = RSG_Mdot + set_RSG_Mdot = 0 +end function set_RSG_Mdot -function get_par_Omega_saturation(par_Omega_saturation) - use inputparam, only: Omega_saturation +integer function get_SupraEddMdot(index_of_the_particle, SupraEddMdot) implicit none - real(kindreal):: par_Omega_saturation - integer:: get_par_Omega_saturation - par_Omega_saturation = Omega_saturation - get_par_Omega_saturation = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(out):: SupraEddMdot + SupraEddMdot = GenecStar%SupraEddMdot + get_SupraEddMdot = 0 +end function get_SupraEddMdot -function set_par_Omega_saturation(par_Omega_saturation) - use inputparam, only: Omega_saturation +integer function set_SupraEddMdot(index_of_the_particle, SupraEddMdot) implicit none - real(kindreal):: par_Omega_saturation - integer:: set_par_Omega_saturation - Omega_saturation = par_Omega_saturation - set_par_Omega_saturation = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(in):: SupraEddMdot + GenecStar%SupraEddMdot = SupraEddMdot + set_SupraEddMdot = 0 +end function set_SupraEddMdot -function get_par_rapcrilim(par_rapcrilim) - use inputparam, only: rapcrilim +integer function get_Be_mdotfrac(index_of_the_particle, Be_mdotfrac) implicit none - real(kindreal):: par_rapcrilim - integer:: get_par_rapcrilim - par_rapcrilim = rapcrilim - get_par_rapcrilim = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: Be_mdotfrac + Be_mdotfrac = GenecStar%Be_mdotfrac + get_Be_mdotfrac = 0 +end function get_Be_mdotfrac -function set_par_rapcrilim(par_rapcrilim) - use inputparam, only: rapcrilim +integer function set_Be_mdotfrac(index_of_the_particle, Be_mdotfrac) implicit none - real(kindreal):: par_rapcrilim - integer:: set_par_rapcrilim - rapcrilim = par_rapcrilim - set_par_rapcrilim = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: Be_mdotfrac + GenecStar%Be_mdotfrac = Be_mdotfrac + set_Be_mdotfrac = 0 +end function set_Be_mdotfrac -function get_par_vwant(par_vwant) +integer function get_start_mdot(index_of_the_particle, start_mdot) implicit none - real(kindreal):: par_vwant - integer:: get_par_vwant - par_vwant = InitialGenecStar%vwant - get_par_vwant = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: start_mdot + start_mdot = GenecStar%start_mdot + get_start_mdot = 0 +end function get_start_mdot -function set_par_vwant(par_vwant) +integer function set_start_mdot(index_of_the_particle, start_mdot) implicit none - real(kindreal):: par_vwant - integer:: set_par_vwant - InitialGenecStar%vwant = par_vwant - set_par_vwant = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: start_mdot + GenecStar%start_mdot = start_mdot + set_start_mdot = 0 +end function set_start_mdot -function get_par_xfom(par_xfom) - use inputparam, only: xfom +integer function get_iledou(index_of_the_particle, iledou) implicit none - real(kindreal):: par_xfom - integer:: get_par_xfom - par_xfom = xfom - get_par_xfom = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: iledou + iledou = GenecStar%iledou + get_iledou = 0 +end function get_iledou -function set_par_xfom(par_xfom) - use inputparam, only: xfom +integer function set_iledou(index_of_the_particle, iledou) implicit none - real(kindreal):: par_xfom - integer:: set_par_xfom - xfom = par_xfom - set_par_xfom = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: iledou + GenecStar%iledou = iledou + set_iledou = 0 +end function set_iledou -function get_par_omega(par_omega) - use inputparam, only: omega +integer function get_idifcon(index_of_the_particle, idifcon) implicit none - real(kindreal):: par_omega - integer:: get_par_omega - par_omega = omega - get_par_omega = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: idifcon + idifcon = GenecStar%idifcon + get_idifcon = 0 +end function get_idifcon -function set_par_omega(par_omega) - use inputparam, only: omega +integer function set_idifcon(index_of_the_particle, idifcon) implicit none - real(kindreal):: par_omega - integer:: set_par_omega - omega = par_omega - set_par_omega = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: idifcon + GenecStar%idifcon = idifcon + set_idifcon = 0 +end function set_idifcon -function get_par_xdial(par_xdial) - use inputparam, only: xdial +integer function get_iover(index_of_the_particle, iover) implicit none - real(kindreal):: par_xdial - integer:: get_par_xdial - par_xdial = xdial - get_par_xdial = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: iover + iover = GenecStar%iover + get_iover = 0 +end function get_iover -function set_par_xdial(par_xdial) - use inputparam, only: xdial +integer function set_iover(index_of_the_particle, iover) implicit none - real(kindreal):: par_xdial - integer:: set_par_xdial - xdial = par_xdial - set_par_xdial = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: iover + GenecStar%iover = iover + set_iover = 0 +end function set_iover -function get_par_B_initial(par_B_initial) - use inputparam, only: B_initial +integer function get_elph(index_of_the_particle, elph) implicit none - real(kindreal):: par_B_initial - integer:: get_par_B_initial - par_B_initial = B_initial - get_par_B_initial = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: elph + elph = GenecStar%elph + get_elph = 0 +end function get_elph -function set_par_B_initial(par_B_initial) - use inputparam, only: B_initial +integer function set_elph(index_of_the_particle, elph) implicit none - real(kindreal):: par_B_initial - integer:: set_par_B_initial - B_initial = par_B_initial - set_par_B_initial = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: elph + GenecStar%elph = elph + set_elph = 0 +end function set_elph -function get_par_add_diff(par_add_diff) - use inputparam, only: add_diff +integer function get_my(index_of_the_particle, my) implicit none - real(kindreal):: par_add_diff - integer:: get_par_add_diff - par_add_diff = add_diff - get_par_add_diff = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: my + my = GenecStar%my + get_my = 0 +end function get_my -function set_par_add_diff(par_add_diff) - use inputparam, only: add_diff +integer function set_my(index_of_the_particle, my) implicit none - real(kindreal):: par_add_diff - integer:: set_par_add_diff - add_diff = par_add_diff - set_par_add_diff = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: my + GenecStar%my = my + set_my = 0 +end function set_my -function get_par_fmlos(par_fmlos) - use inputparam, only: fmlos +integer function get_dovhp(index_of_the_particle, dovhp) implicit none - real(kindreal):: par_fmlos - integer:: get_par_fmlos - par_fmlos = fmlos - get_par_fmlos = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dovhp + dovhp = GenecStar%dovhp + get_dovhp = 0 +end function get_dovhp -function set_par_fmlos(par_fmlos) - use inputparam, only: fmlos +integer function set_dovhp(index_of_the_particle, dovhp) implicit none - real(kindreal):: par_fmlos - integer:: set_par_fmlos - fmlos = par_fmlos - set_par_fmlos = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dovhp + GenecStar%dovhp = dovhp + set_dovhp = 0 +end function set_dovhp -function get_par_fitm(par_fitm) - use inputparam, only: fitm +integer function get_iunder(index_of_the_particle, iunder) implicit none - real(kindreal):: par_fitm - integer:: get_par_fitm - par_fitm = fitm - get_par_fitm = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: iunder + iunder = GenecStar%iunder + get_iunder = 0 +end function get_iunder -function set_par_fitm(par_fitm) - use inputparam, only: fitm +integer function set_iunder(index_of_the_particle, iunder) implicit none - real(kindreal):: par_fitm - integer:: set_par_fitm - fitm = par_fitm - set_par_fitm = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: iunder + GenecStar%iunder = iunder + set_iunder = 0 +end function set_iunder -function get_par_fitmi(par_fitmi) - use inputparam, only: fitmi +integer function get_dunder(index_of_the_particle, dunder) implicit none - real(kindreal):: par_fitmi - integer:: get_par_fitmi - par_fitmi = fitmi - get_par_fitmi = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dunder + dunder = GenecStar%dunder + get_dunder = 0 +end function get_dunder -function set_par_fitmi(par_fitmi) - use inputparam, only: fitmi +integer function set_dunder(index_of_the_particle, dunder) implicit none - real(kindreal):: par_fitmi - integer:: set_par_fitmi - fitmi = par_fitmi - set_par_fitmi = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dunder + GenecStar%dunder = dunder + set_dunder = 0 +end function set_dunder -function get_par_fitmi_default(par_fitmi_default) - use inputparam, only: fitmi_default +integer function get_gkorm(index_of_the_particle, gkorm) implicit none - real(kindreal):: par_fitmi_default - integer:: get_par_fitmi_default - par_fitmi_default = fitmi_default - get_par_fitmi_default = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: gkorm + gkorm = GenecStar%gkorm + get_gkorm = 0 +end function get_gkorm -function set_par_fitmi_default(par_fitmi_default) - use inputparam, only: fitmi_default +integer function set_gkorm(index_of_the_particle, gkorm) implicit none - real(kindreal):: par_fitmi_default - integer:: set_par_fitmi_default - fitmi_default = par_fitmi_default - set_par_fitmi_default = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: gkorm + GenecStar%gkorm = gkorm + set_gkorm = 0 +end function set_gkorm -function get_par_deltal(par_deltal) - use inputparam, only: deltal +integer function get_alph(index_of_the_particle, alph) implicit none - real(kindreal):: par_deltal - integer:: get_par_deltal - par_deltal = deltal - get_par_deltal = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: alph + alph = GenecStar%alph + get_alph = 0 +end function get_alph -function set_par_deltal(par_deltal) - use inputparam, only: deltal +integer function set_alph(index_of_the_particle, alph) implicit none - real(kindreal):: par_deltal - integer:: set_par_deltal - deltal = par_deltal - set_par_deltal = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: alph + GenecStar%alph = alph + set_alph = 0 +end function set_alph -function get_par_deltat(par_deltat) - use inputparam, only: deltat +integer function get_agdr(index_of_the_particle, agdr) implicit none - real(kindreal):: par_deltat - integer:: get_par_deltat - par_deltat = deltat - get_par_deltat = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: agdr + agdr = GenecStar%agdr + get_agdr = 0 +end function get_agdr -function set_par_deltat(par_deltat) - use inputparam, only: deltat +integer function set_agdr(index_of_the_particle, agdr) implicit none - real(kindreal):: par_deltat - integer:: set_par_deltat - deltat = par_deltat - set_par_deltat = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: agdr + GenecStar%agdr = agdr + set_agdr = 0 +end function set_agdr -function get_par_elph(par_elph) - use inputparam, only: elph +integer function get_faktor(index_of_the_particle, faktor) implicit none - real(kindreal):: par_elph - integer:: get_par_elph - par_elph = elph - get_par_elph = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: faktor + faktor = GenecStar%faktor + get_faktor = 0 +end function get_faktor -function set_par_elph(par_elph) - use inputparam, only: elph +integer function set_faktor(index_of_the_particle, faktor) implicit none - real(kindreal):: par_elph - integer:: set_par_elph - elph = par_elph - set_par_elph = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: faktor + GenecStar%faktor = faktor + set_faktor = 0 +end function set_faktor -function get_par_dovhp(par_dovhp) - use inputparam, only: dovhp +integer function get_dgrp(index_of_the_particle, dgrp) implicit none - real(kindreal):: par_dovhp - integer:: get_par_dovhp - par_dovhp = dovhp - get_par_dovhp = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dgrp + dgrp = GenecStar%dgrp + get_dgrp = 0 +end function get_dgrp -function set_par_dovhp(par_dovhp) - use inputparam, only: dovhp +integer function set_dgrp(index_of_the_particle, dgrp) implicit none - real(kindreal):: par_dovhp - integer:: set_par_dovhp - dovhp = par_dovhp - set_par_dovhp = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dgrp + GenecStar%dgrp = dgrp + set_dgrp = 0 +end function set_dgrp -function get_par_dunder(par_dunder) - use inputparam, only: dunder +integer function get_dgrl(index_of_the_particle, dgrl) implicit none - real(kindreal):: par_dunder - integer:: get_par_dunder - par_dunder = dunder - get_par_dunder = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dgrl + dgrl = GenecStar%dgrl + get_dgrl = 0 +end function get_dgrl -function set_par_dunder(par_dunder) - use inputparam, only: dunder +integer function set_dgrl(index_of_the_particle, dgrl) implicit none - real(kindreal):: par_dunder - integer:: set_par_dunder - dunder = par_dunder - set_par_dunder = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dgrl + GenecStar%dgrl = dgrl + set_dgrl = 0 +end function set_dgrl -function get_par_gkorm(par_gkorm) - use inputparam, only: gkorm +integer function get_dgry(index_of_the_particle, dgry) implicit none - real(kindreal):: par_gkorm - integer:: get_par_gkorm - par_gkorm = gkorm - get_par_gkorm = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dgry + dgry = GenecStar%dgry + get_dgry = 0 +end function get_dgry -function set_par_gkorm(par_gkorm) - use inputparam, only: gkorm +integer function set_dgry(index_of_the_particle, dgry) implicit none - real(kindreal):: par_gkorm - integer:: set_par_gkorm - gkorm = par_gkorm - set_par_gkorm = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dgry + GenecStar%dgry = dgry + set_dgry = 0 +end function set_dgry -function get_par_alph(par_alph) - use inputparam, only: alph +integer function get_dgrc(index_of_the_particle, dgrc) implicit none - real(kindreal):: par_alph - integer:: get_par_alph - par_alph = alph - get_par_alph = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dgrc + dgrc = GenecStar%dgrc + get_dgrc = 0 +end function get_dgrc -function set_par_alph(par_alph) - use inputparam, only: alph +integer function set_dgrc(index_of_the_particle, dgrc) implicit none - real(kindreal):: par_alph - integer:: set_par_alph - alph = par_alph - set_par_alph = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dgrc + GenecStar%dgrc = dgrc + set_dgrc = 0 +end function set_dgrc -function get_par_agdr(par_agdr) - use inputparam, only: agdr +integer function get_dgro(index_of_the_particle, dgro) implicit none - real(kindreal):: par_agdr - integer:: get_par_agdr - par_agdr = agdr - get_par_agdr = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dgro + dgro = GenecStar%dgro + get_dgro = 0 +end function get_dgro -function set_par_agdr(par_agdr) - use inputparam, only: agdr +integer function set_dgro(index_of_the_particle, dgro) implicit none - real(kindreal):: par_agdr - integer:: set_par_agdr - agdr = par_agdr - set_par_agdr = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dgro + GenecStar%dgro = dgro + set_dgro = 0 +end function set_dgro -function get_par_faktor(par_faktor) - use inputparam, only: faktor +integer function get_dgr20(index_of_the_particle, dgr20) implicit none - real(kindreal):: par_faktor - integer:: get_par_faktor - par_faktor = faktor - get_par_faktor = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dgr20 + dgr20 = GenecStar%dgr20 + get_dgr20 = 0 +end function get_dgr20 -function set_par_faktor(par_faktor) - use inputparam, only: faktor +integer function set_dgr20(index_of_the_particle, dgr20) implicit none - real(kindreal):: par_faktor - integer:: set_par_faktor - faktor = par_faktor - set_par_faktor = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dgr20 + GenecStar%dgr20 = dgr20 + set_dgr20 = 0 +end function set_dgr20 -function get_par_dgrp(par_dgrp) - use inputparam, only: dgrp +integer function get_nbchx(index_of_the_particle, nbchx) implicit none - real(kindreal):: par_dgrp - integer:: get_par_dgrp - par_dgrp = dgrp - get_par_dgrp = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: nbchx + nbchx = GenecStar%nbchx + get_nbchx = 0 +end function get_nbchx -function set_par_dgrp(par_dgrp) - use inputparam, only: dgrp +integer function set_nbchx(index_of_the_particle, nbchx) implicit none - real(kindreal):: par_dgrp - integer:: set_par_dgrp - dgrp = par_dgrp - set_par_dgrp = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: nbchx + GenecStar%nbchx = nbchx + set_nbchx = 0 +end function set_nbchx -function get_par_dgrl(par_dgrl) - use inputparam, only: dgrl +integer function get_nrband(index_of_the_particle, nrband) implicit none - real(kindreal):: par_dgrl - integer:: get_par_dgrl - par_dgrl = dgrl - get_par_dgrl = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: nrband + nrband = GenecStar%nrband + get_nrband = 0 +end function get_nrband -function set_par_dgrl(par_dgrl) - use inputparam, only: dgrl +integer function set_nrband(index_of_the_particle, nrband) implicit none - real(kindreal):: par_dgrl - integer:: set_par_dgrl - dgrl = par_dgrl - set_par_dgrl = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: nrband + GenecStar%nrband = nrband + set_nrband = 0 +end function set_nrband -function get_par_dgry(par_dgry) - use inputparam, only: dgry +integer function get_xcn(index_of_the_particle, xcn) implicit none - real(kindreal):: par_dgry - integer:: get_par_dgry - par_dgry = dgry - get_par_dgry = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xcn + xcn = GenecStar%xcn + get_xcn = 0 +end function get_xcn -function set_par_dgry(par_dgry) - use inputparam, only: dgry +integer function set_xcn(index_of_the_particle, xcn) implicit none - real(kindreal):: par_dgry - integer:: set_par_dgry - dgry = par_dgry - set_par_dgry = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xcn + GenecStar%xcn = xcn + set_xcn = 0 +end function set_xcn -function get_par_dgrc(par_dgrc) - use inputparam, only: dgrc +integer function get_islow(index_of_the_particle, islow) implicit none - real(kindreal):: par_dgrc - integer:: get_par_dgrc - par_dgrc = dgrc - get_par_dgrc = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: islow + islow = GenecStar%islow + get_islow = 0 +end function get_islow -function set_par_dgrc(par_dgrc) - use inputparam, only: dgrc +integer function set_islow(index_of_the_particle, islow) implicit none - real(kindreal):: par_dgrc - integer:: set_par_dgrc - dgrc = par_dgrc - set_par_dgrc = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: islow + GenecStar%islow = islow + set_islow = 0 +end function set_islow -function get_par_dgro(par_dgro) - use inputparam, only: dgro +integer function get_icncst(index_of_the_particle, icncst) implicit none - real(kindreal):: par_dgro - integer:: get_par_dgro - par_dgro = dgro - get_par_dgro = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: icncst + icncst = GenecStar%icncst + get_icncst = 0 +end function get_icncst -function set_par_dgro(par_dgro) - use inputparam, only: dgro +integer function set_icncst(index_of_the_particle, icncst) implicit none - real(kindreal):: par_dgro - integer:: set_par_dgro - dgro = par_dgro - set_par_dgro = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: icncst + GenecStar%icncst = icncst + set_icncst = 0 +end function set_icncst -function get_par_dgr20(par_dgr20) - use inputparam, only: dgr20 +integer function get_tauH_fit(index_of_the_particle, tauH_fit) implicit none - real(kindreal):: par_dgr20 - integer:: get_par_dgr20 - par_dgr20 = dgr20 - get_par_dgr20 = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: tauH_fit + tauH_fit = GenecStar%tauH_fit + get_tauH_fit = 0 +end function get_tauH_fit -function set_par_dgr20(par_dgr20) - use inputparam, only: dgr20 +integer function set_tauH_fit(index_of_the_particle, tauH_fit) implicit none - real(kindreal):: par_dgr20 - integer:: set_par_dgr20 - dgr20 = par_dgr20 - set_par_dgr20 = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: tauH_fit + GenecStar%tauH_fit = tauH_fit + set_tauH_fit = 0 +end function set_tauH_fit -function get_par_xcn(par_xcn) - use inputparam, only: xcn +integer function get_display_plot(index_of_the_particle, display_plot) implicit none - real(kindreal):: par_xcn - integer:: get_par_xcn - par_xcn = xcn - get_par_xcn = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(out):: display_plot + display_plot = GenecStar%display_plot + get_display_plot = 0 +end function get_display_plot -function set_par_xcn(par_xcn) - use inputparam, only: xcn +integer function set_display_plot(index_of_the_particle, display_plot) implicit none - real(kindreal):: par_xcn - integer:: set_par_xcn - xcn = par_xcn - set_par_xcn = 0 -end function + integer, intent(in):: index_of_the_particle + logical, intent(in):: display_plot + GenecStar%display_plot = display_plot + set_display_plot = 0 +end function set_display_plot -function get_par_starname(par_starname) - use inputparam, only: starname +integer function get_iauto(index_of_the_particle, iauto) implicit none - character(256):: par_starname - integer:: get_par_starname - if (GenecStar%initialised) then - par_starname = GenecStar%starname - else - par_starname = InitialGenecStar%starname - endif - get_par_starname = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: iauto + iauto = GenecStar%iauto + get_iauto = 0 +end function get_iauto -function set_par_starname(par_starname) - use inputparam, only: starname +integer function set_iauto(index_of_the_particle, iauto) implicit none - character(256):: par_starname - integer:: set_par_starname - InitialGenecStar%starname = par_starname - set_par_starname = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: iauto + GenecStar%iauto = iauto + set_iauto = 0 +end function set_iauto + +integer function get_iprn(index_of_the_particle, iprn) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: iprn + iprn = GenecStar%iprn + get_iprn = 0 +end function get_iprn + +integer function set_iprn(index_of_the_particle, iprn) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: iprn + GenecStar%iprn = iprn + set_iprn = 0 +end function set_iprn + +integer function get_iout(index_of_the_particle, iout) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: iout + iout = GenecStar%iout + get_iout = 0 +end function get_iout + +integer function set_iout(index_of_the_particle, iout) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: iout + GenecStar%iout = iout + set_iout = 0 +end function set_iout + +integer function get_itmin(index_of_the_particle, itmin) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: itmin + itmin = GenecStar%itmin + get_itmin = 0 +end function get_itmin + +integer function set_itmin(index_of_the_particle, itmin) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: itmin + GenecStar%itmin = itmin + set_itmin = 0 +end function set_itmin + +integer function get_xyfiles(index_of_the_particle, xyfiles) + implicit none + integer, intent(in):: index_of_the_particle + logical, intent(out):: xyfiles + xyfiles = GenecStar%xyfiles + get_xyfiles = 0 +end function get_xyfiles + +integer function set_xyfiles(index_of_the_particle, xyfiles) + implicit none + integer, intent(in):: index_of_the_particle + logical, intent(in):: xyfiles + GenecStar%xyfiles = xyfiles + set_xyfiles = 0 +end function set_xyfiles + +integer function get_idebug(index_of_the_particle, idebug) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: idebug + idebug = GenecStar%idebug + get_idebug = 0 +end function get_idebug + +integer function set_idebug(index_of_the_particle, idebug) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: idebug + GenecStar%idebug = idebug + set_idebug = 0 +end function set_idebug + +integer function get_itests(index_of_the_particle, itests) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: itests + itests = GenecStar%itests + get_itests = 0 +end function get_itests + +integer function set_itests(index_of_the_particle, itests) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: itests + GenecStar%itests = itests + set_itests = 0 +end function set_itests + +integer function get_verbose(index_of_the_particle, verbose) + implicit none + integer, intent(in):: index_of_the_particle + logical, intent(out):: verbose + verbose = GenecStar%verbose + get_verbose = 0 +end function get_verbose + +integer function set_verbose(index_of_the_particle, verbose) + implicit none + integer, intent(in):: index_of_the_particle + logical, intent(in):: verbose + GenecStar%verbose = verbose + set_verbose = 0 +end function set_verbose + +integer function get_stop_deg(index_of_the_particle, stop_deg) + implicit none + integer, intent(in):: index_of_the_particle + logical, intent(out):: stop_deg + stop_deg = GenecStar%stop_deg + get_stop_deg = 0 +end function get_stop_deg + +integer function set_stop_deg(index_of_the_particle, stop_deg) + implicit none + integer, intent(in):: index_of_the_particle + logical, intent(in):: stop_deg + GenecStar%stop_deg = stop_deg + set_stop_deg = 0 +end function set_stop_deg + +integer function get_n_snap(index_of_the_particle, n_snap) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: n_snap + n_snap = GenecStar%n_snap + get_n_snap = 0 +end function get_n_snap + +integer function set_n_snap(index_of_the_particle, n_snap) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: n_snap + GenecStar%n_snap = n_snap + set_n_snap = 0 +end function set_n_snap + ! **** End Parameters @@ -2959,6 +3025,10 @@ function get_time(time) get_time = 0 end function + + + + function new_particle(index_of_the_star, mass, metallicity, am_starname) implicit none integer:: index_of_the_star, key @@ -2975,6 +3045,453 @@ function new_particle(index_of_the_star, mass, metallicity, am_starname) new_particle = 0 end function +function new_stellar_model(& + integer_of_the_star,& + initialised, starname, nwseq, modanf, nzmod, end_at_phase, end_at_model, irot, isol, imagn, ialflu, ianiso, ipop3,& + ibasnet, phase, var_rates, bintide, binm2, periodini, const_per, iprezams, zinit, zsol, z, iopac, ikappa, idiff, iadvec,& + istati, icoeff, fenerg, richac, igamma, frein, K_Kawaler, Omega_saturation, rapcrilim, vwant, xfom, omega, xdial, idialo,& + idialu, Add_Flux, diff_only, B_initial, add_diff, n_mag, alpha_F, nsmooth, qminsmooth, imloss, fmlos, ifitm, fitm, fitmi,& + deltal, deltat, nndr, RSG_Mdot, SupraEddMdot, Be_mdotfrac, start_mdot, iledou, idifcon, iover, elph, my, dovhp, iunder,& + dunder, gkorm, alph, agdr, faktor, dgrp, dgrl, dgry, dgrc, dgro, dgr20, nbchx, nrband, xcn, islow, icncst, tauH_fit,& + display_plot, iauto, iprn, iout, itmin, xyfiles, idebug, itests, verbose, stop_deg, n_snap,& + m,gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,dm_lost,& + q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& + xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& + vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26g,vxneut,vxprot,vomegi,& + vxbid,vxbid1& + ) + implicit none + integer:: integer_of_the_star + logical, intent(in):: & + initialised,var_rates,bintide,const_per,Add_Flux,diff_only,qminsmooth,SupraEddMdot,display_plot,xyfiles,verbose,& + stop_deg + integer, intent(in):: & + nwseq,modanf,nzmod,end_at_phase,end_at_model,irot,isol,imagn,ialflu,ianiso,ipop3,ibasnet,phase,iprezams,iopac,ikappa,& + idiff,iadvec,istati,icoeff,igamma,idialo,idialu,n_mag,nsmooth,imloss,ifitm,nndr,RSG_Mdot,iledou,idifcon,iover,my,& + iunder,nbchx,nrband,islow,icncst,tauH_fit,iauto,iprn,iout,itmin,idebug,itests,n_snap + real(kindreal), intent(in):: & + binm2,periodini,zinit,zsol,z,fenerg,richac,frein,K_Kawaler,Omega_saturation,rapcrilim,vwant,xfom,omega,xdial,& + B_initial,add_diff,alpha_F,fmlos,fitm,fitmi,deltal,deltat,Be_mdotfrac,start_mdot,elph,dovhp,dunder,gkorm,alph,& + agdr,faktor,dgrp,dgrl,dgry,dgrc,dgro,dgr20,xcn + character(len=200), intent(in):: & + starname + integer, intent(in) :: m + real(kindreal), intent(in) :: & + gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,& + dm_lost + !real(kindreal), dimension(ldi) :: & + real(kindreal), dimension(m), intent(in):: & + q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& + xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& + vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26g,vxneut,vxprot,vomegi,& + vxbid,vxbid1 + integer:: new_stellar_model + + GenecStar%initialised = initialised + GenecStar%starname = starname + !GenecStar%nwmd = nwmd + GenecStar%nwseq = nwseq + GenecStar%modanf = modanf + GenecStar%nzmod = nzmod + GenecStar%end_at_phase = end_at_phase + GenecStar%end_at_model = end_at_model + GenecStar%irot = irot + GenecStar%isol = isol + GenecStar%imagn = imagn + GenecStar%ialflu = ialflu + GenecStar%ianiso = ianiso + GenecStar%ipop3 = ipop3 + GenecStar%ibasnet = ibasnet + GenecStar%phase = phase + GenecStar%iprezams = iprezams + GenecStar%var_rates = var_rates + GenecStar%bintide = bintide + GenecStar%binm2 = binm2 + GenecStar%periodini = periodini + GenecStar%const_per = const_per + GenecStar%iopac = iopac + GenecStar%ikappa = ikappa + GenecStar%zinit = zinit + GenecStar%zsol = zsol + GenecStar%z = z + GenecStar%idiff = idiff + GenecStar%iadvec = iadvec + GenecStar%istati = istati + GenecStar%icoeff = icoeff + GenecStar%igamma = igamma + GenecStar%idialo = idialo + GenecStar%idialu = idialu + GenecStar%n_mag = n_mag + GenecStar%nsmooth = nsmooth + GenecStar%fenerg = fenerg + GenecStar%richac = richac + GenecStar%frein = frein + GenecStar%K_Kawaler = K_Kawaler + GenecStar%Omega_saturation = Omega_saturation + GenecStar%rapcrilim = rapcrilim + GenecStar%vwant = vwant + GenecStar%xfom = xfom + GenecStar%omega = omega + GenecStar%xdial = xdial + GenecStar%B_initial = B_initial + GenecStar%add_diff = add_diff + GenecStar%alpha_F = alpha_F + GenecStar%Add_Flux = Add_Flux + GenecStar%diff_only = diff_only + GenecStar%qminsmooth = qminsmooth + GenecStar%imloss = imloss + GenecStar%ifitm = ifitm + GenecStar%nndr = nndr + GenecStar%RSG_Mdot = RSG_Mdot + GenecStar%fmlos = fmlos + GenecStar%fitm = fitm + GenecStar%fitmi = fitmi + GenecStar%deltal = deltal + GenecStar%deltat = deltat + GenecStar%Be_mdotfrac = Be_mdotfrac + GenecStar%start_mdot = start_mdot + GenecStar%SupraEddMdot = SupraEddMdot + GenecStar%iledou = iledou + GenecStar%idifcon = idifcon + GenecStar%my = my + GenecStar%iover = iover + GenecStar%iunder = iunder + GenecStar%elph = elph + GenecStar%dovhp = dovhp + GenecStar%dunder = dunder + GenecStar%nbchx = nbchx + GenecStar%nrband = nrband + GenecStar%gkorm = gkorm + GenecStar%alph = alph + GenecStar%agdr = agdr + GenecStar%faktor = faktor + GenecStar%dgrp = dgrp + GenecStar%dgrl = dgrl + GenecStar%dgry = dgry + GenecStar%dgrc = dgrc + GenecStar%dgro = dgro + GenecStar%dgr20 = dgr20 + GenecStar%islow = islow + GenecStar%icncst = icncst + GenecStar%tauH_fit = tauH_fit + GenecStar%xcn = xcn + GenecStar%iauto = iauto + GenecStar%iprn = iprn + GenecStar%iout = iout + GenecStar%itmin = itmin + GenecStar%idebug = idebug + GenecStar%itests = itests + GenecStar%n_snap = n_snap + GenecStar%display_plot = display_plot + GenecStar%xyfiles = xyfiles + GenecStar%verbose = verbose + GenecStar%stop_deg = stop_deg + + GenecStar%m = m + GenecStar%gms = gms + GenecStar%alter = alter + GenecStar%gls = gls + GenecStar%teff = teff + GenecStar%glsv = glsv + GenecStar%teffv = teffv + GenecStar%dzeitj = dzeitj + GenecStar%dzeit = dzeit + GenecStar%dzeitv = dzeitv + GenecStar%summas = summas + GenecStar%xmini = xmini + GenecStar%ab = ab + GenecStar%dm_lost = dm_lost + GenecStar%q = q + GenecStar%p = p + GenecStar%t = t + GenecStar%r = r + GenecStar%s = s + GenecStar%x = x + GenecStar%y = y + GenecStar%xc12 = xc12 + GenecStar%vp = vp + GenecStar%vt = vt + GenecStar%vr = vr + GenecStar%vs = vs + GenecStar%xo16 = xo16 + GenecStar%vx = vx + GenecStar%vy = vy + GenecStar%vxc12 = vxc12 + GenecStar%vxo16 = vxo16 + GenecStar%y3 = y3 + GenecStar%xc13 = xc13 + GenecStar%xn14 = xn14 + GenecStar%xn15 = xn15 + GenecStar%xo17 = xo17 + GenecStar%xo18 = xo18 + GenecStar%vy3 = vy3 + GenecStar%vxc13 = vxc13 + GenecStar%vxn14 = vxn14 + GenecStar%vxn15 = vxn15 + GenecStar%vxo17 = vxo17 + GenecStar%vxo18 = vxo18 + GenecStar%xne20 = xne20 + GenecStar%xne22 = xne22 + GenecStar%xmg24 = xmg24 + GenecStar%xmg25 = xmg25 + GenecStar%xmg26 = xmg26 + GenecStar%vxne20 = vxne20 + GenecStar%vxne22 = vxne22 + GenecStar%vxmg24 = vxmg24 + GenecStar%vxmg25 = vxmg25 + GenecStar%vxmg26 = vxmg26 + GenecStar%omegi = omegi + GenecStar%vomegi = vomegi + GenecStar%xf19 = xf19 + GenecStar%xne21 = xne21 + GenecStar%xna23 = xna23 + GenecStar%xal26 = xal26 + GenecStar%xal27 = xal27 + GenecStar%xsi28 = xsi28 + GenecStar%vxf19 = vxf19 + GenecStar%vxne21 = vxne21 + GenecStar%vxna23 = vxna23 + GenecStar%vxal26g = vxal26g + GenecStar%vxal27 = vxal27 + GenecStar%vxsi28 = vxsi28 + GenecStar%xneut = xneut + GenecStar%xprot = xprot + GenecStar%xc14 = xc14 + GenecStar%xf18 = xf18 + GenecStar%xbid = xbid + GenecStar%xbid1 = xbid1 + GenecStar%vxneut = vxneut + GenecStar%vxprot = vxprot + GenecStar%vxc14 = vxc14 + GenecStar%vxf18 = vxf18 + GenecStar%vxbid = vxbid + GenecStar%vxbid1 = vxbid1 + + new_stellar_model = 0 +end function + +function get_stellar_model(& + integer_of_the_star,& + initialised, starname, nwseq, modanf, nzmod, end_at_phase, end_at_model, irot, isol, imagn, ialflu, ianiso, ipop3,& + ibasnet, phase, var_rates, bintide, binm2, periodini, const_per, iprezams, zinit, zsol, z, iopac, ikappa, idiff, iadvec,& + istati, icoeff, fenerg, richac, igamma, frein, K_Kawaler, Omega_saturation, rapcrilim, vwant, xfom, omega, xdial, idialo,& + idialu, Add_Flux, diff_only, B_initial, add_diff, n_mag, alpha_F, nsmooth, qminsmooth, imloss, fmlos, ifitm, fitm, fitmi,& + deltal, deltat, nndr, RSG_Mdot, SupraEddMdot, Be_mdotfrac, start_mdot, iledou, idifcon, iover, elph, my, dovhp, iunder,& + dunder, gkorm, alph, agdr, faktor, dgrp, dgrl, dgry, dgrc, dgro, dgr20, nbchx, nrband, xcn, islow, icncst, tauH_fit,& + display_plot, iauto, iprn, iout, itmin, xyfiles, idebug, itests, verbose, stop_deg, n_snap,& + m,gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,dm_lost,& + q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& + xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& + vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26g,vxneut,vxprot,vomegi,& + vxbid,vxbid1& + ) + implicit none + integer:: integer_of_the_star + logical, intent(out):: & + initialised,var_rates,bintide,const_per,Add_Flux,diff_only,qminsmooth,SupraEddMdot,display_plot,xyfiles,verbose,& + stop_deg + integer, intent(out):: & + nwseq,modanf,nzmod,end_at_phase,end_at_model,irot,isol,imagn,ialflu,ianiso,ipop3,ibasnet,phase,iprezams,iopac,ikappa,& + idiff,iadvec,istati,icoeff,igamma,idialo,idialu,n_mag,nsmooth,imloss,ifitm,nndr,RSG_Mdot,iledou,idifcon,iover,my,& + iunder,nbchx,nrband,islow,icncst,tauH_fit,iauto,iprn,iout,itmin,idebug,itests,n_snap + real(kindreal), intent(out):: & + binm2,periodini,zinit,zsol,z,fenerg,richac,frein,K_Kawaler,Omega_saturation,rapcrilim,vwant,xfom,omega,xdial,& + B_initial,add_diff,alpha_F,fmlos,fitm,fitmi,deltal,deltat,Be_mdotfrac,start_mdot,elph,dovhp,dunder,gkorm,alph,& + agdr,faktor,dgrp,dgrl,dgry,dgrc,dgro,dgr20,xcn + character(len=200), intent(out):: & + starname + integer, intent(out) :: m + real(kindreal), intent(out) :: & + gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,& + dm_lost + real(kindreal), dimension(GenecStar%m), intent(out):: & + q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& + xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& + vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26g,vxneut,vxprot,vomegi,& + vxbid,vxbid1 + integer:: get_stellar_model + + initialised = GenecStar%initialised + starname = GenecStar%starname + nwseq = GenecStar%nwseq + modanf = GenecStar%modanf + nzmod = GenecStar%nzmod + end_at_phase = GenecStar%end_at_phase + end_at_model = GenecStar%end_at_model + irot = GenecStar%irot + isol = GenecStar%isol + imagn = GenecStar%imagn + ialflu = GenecStar%ialflu + ianiso = GenecStar%ianiso + ipop3 = GenecStar%ipop3 + ibasnet = GenecStar%ibasnet + phase = GenecStar%phase + iprezams = GenecStar%iprezams + var_rates = GenecStar%var_rates + bintide = GenecStar%bintide + binm2 = GenecStar%binm2 + periodini = GenecStar%periodini + const_per = GenecStar%const_per + iopac = GenecStar%iopac + ikappa = GenecStar%ikappa + zinit = GenecStar%zinit + zsol = GenecStar%zsol + z = GenecStar%z + idiff = GenecStar%idiff + iadvec = GenecStar%iadvec + istati = GenecStar%istati + icoeff = GenecStar%icoeff + igamma = GenecStar%igamma + idialo = GenecStar%idialo + idialu = GenecStar%idialu + n_mag = GenecStar%n_mag + nsmooth = GenecStar%nsmooth + fenerg = GenecStar%fenerg + richac = GenecStar%richac + frein = GenecStar%frein + K_Kawaler = GenecStar%K_Kawaler + Omega_saturation = GenecStar%Omega_saturation + rapcrilim = GenecStar%rapcrilim + vwant = GenecStar%vwant + xfom = GenecStar%xfom + omega = GenecStar%omega + xdial = GenecStar%xdial + B_initial = GenecStar%B_initial + add_diff = GenecStar%add_diff + alpha_F = GenecStar%alpha_F + Add_Flux = GenecStar%Add_Flux + diff_only = GenecStar%diff_only + qminsmooth = GenecStar%qminsmooth + imloss = GenecStar%imloss + ifitm = GenecStar%ifitm + nndr = GenecStar%nndr + RSG_Mdot = GenecStar%RSG_Mdot + fmlos = GenecStar%fmlos + fitm = GenecStar%fitm + fitmi = GenecStar%fitmi + deltal = GenecStar%deltal + deltat = GenecStar%deltat + Be_mdotfrac = GenecStar%Be_mdotfrac + start_mdot = GenecStar%start_mdot + SupraEddMdot = GenecStar%SupraEddMdot + iledou = GenecStar%iledou + idifcon = GenecStar%idifcon + my = GenecStar%my + iover = GenecStar%iover + iunder = GenecStar%iunder + elph = GenecStar%elph + dovhp = GenecStar%dovhp + dunder = GenecStar%dunder + nbchx = GenecStar%nbchx + nrband = GenecStar%nrband + gkorm = GenecStar%gkorm + alph = GenecStar%alph + agdr = GenecStar%agdr + faktor = GenecStar%faktor + dgrp = GenecStar%dgrp + dgrl = GenecStar%dgrl + dgry = GenecStar%dgry + dgrc = GenecStar%dgrc + dgro = GenecStar%dgro + dgr20 = GenecStar%dgr20 + islow = GenecStar%islow + icncst = GenecStar%icncst + tauH_fit = GenecStar%tauH_fit + xcn = GenecStar%xcn + iauto = GenecStar%iauto + iprn = GenecStar%iprn + iout = GenecStar%iout + itmin = GenecStar%itmin + idebug = GenecStar%idebug + itests = GenecStar%itests + n_snap = GenecStar%n_snap + display_plot = GenecStar%display_plot + xyfiles = GenecStar%xyfiles + verbose = GenecStar%verbose + stop_deg = GenecStar%stop_deg + + m = GenecStar%m + gms = GenecStar%gms + alter = GenecStar%alter + gls = GenecStar%gls + teff = GenecStar%teff + glsv = GenecStar%glsv + teffv = GenecStar%teffv + dzeitj = GenecStar%dzeitj + dzeit = GenecStar%dzeit + dzeitv = GenecStar%dzeitv + summas = GenecStar%summas + xmini = GenecStar%xmini + ab = GenecStar%ab + dm_lost = GenecStar%dm_lost + q = GenecStar%q + p = GenecStar%p + t = GenecStar%t + r = GenecStar%r + s = GenecStar%s + x = GenecStar%x + y = GenecStar%y + xc12 = GenecStar%xc12 + vp = GenecStar%vp + vt = GenecStar%vt + vr = GenecStar%vr + vs = GenecStar%vs + xo16 = GenecStar%xo16 + vx = GenecStar%vx + vy = GenecStar%vy + vxc12 = GenecStar%vxc12 + vxo16 = GenecStar%vxo16 + y3 = GenecStar%y3 + xc13 = GenecStar%xc13 + xn14 = GenecStar%xn14 + xn15 = GenecStar%xn15 + xo17 = GenecStar%xo17 + xo18 = GenecStar%xo18 + vy3 = GenecStar%vy3 + vxc13 = GenecStar%vxc13 + vxn14 = GenecStar%vxn14 + vxn15 = GenecStar%vxn15 + vxo17 = GenecStar%vxo17 + vxo18 = GenecStar%vxo18 + xne20 = GenecStar%xne20 + xne22 = GenecStar%xne22 + xmg24 = GenecStar%xmg24 + xmg25 = GenecStar%xmg25 + xmg26 = GenecStar%xmg26 + vxne20 = GenecStar%vxne20 + vxne22 = GenecStar%vxne22 + vxmg24 = GenecStar%vxmg24 + vxmg25 = GenecStar%vxmg25 + vxmg26 = GenecStar%vxmg26 + omegi = GenecStar%omegi + vomegi = GenecStar%vomegi + xf19 = GenecStar%xf19 + xne21 = GenecStar%xne21 + xna23 = GenecStar%xna23 + xal26 = GenecStar%xal26 + xal27 = GenecStar%xal27 + xsi28 = GenecStar%xsi28 + vxf19 = GenecStar%vxf19 + vxne21 = GenecStar%vxne21 + vxna23 = GenecStar%vxna23 + vxal26g = GenecStar%vxal26g + vxal27 = GenecStar%vxal27 + vxsi28 = GenecStar%vxsi28 + xneut = GenecStar%xneut + xprot = GenecStar%xprot + xc14 = GenecStar%xc14 + xf18 = GenecStar%xf18 + xbid = GenecStar%xbid + xbid1 = GenecStar%xbid1 + vxneut = GenecStar%vxneut + vxprot = GenecStar%vxprot + vxc14 = GenecStar%vxc14 + vxf18 = GenecStar%vxf18 + vxbid = GenecStar%vxbid + vxbid1 = GenecStar%vxbid1 + get_stellar_model = 0 +end function + function recommit_parameters() implicit none integer:: recommit_parameters @@ -3000,37 +3517,37 @@ function set_genec_path(path) set_genec_path = 0 end function -function get_starname(index_of_the_star, am_starname) - implicit none - integer:: get_starname, index_of_the_star - character(len=200):: am_starname - am_starname = InitialGenecStar%starname - get_starname = 0 -end function - -function set_starname(index_of_the_star, am_starname) - implicit none - integer:: set_starname, index_of_the_star - character(len=200):: am_starname - InitialGenecStar%starname = am_starname - set_starname = 0 -end function - -function get_phase(index_of_the_star, phase) - implicit none - integer:: index_of_the_star, phase - integer:: get_phase - phase = GenecStar%phase - get_phase = 0 -end function +!function get_starname(index_of_the_star, am_starname) +! implicit none +! integer:: get_starname, index_of_the_star +! character(len=200):: am_starname +! am_starname = InitialGenecStar%starname +! get_starname = 0 +!end function +! +!function set_starname(index_of_the_star, am_starname) +! implicit none +! integer:: set_starname, index_of_the_star +! character(len=200):: am_starname +! InitialGenecStar%starname = am_starname +! set_starname = 0 +!end function -function set_phase(index_of_the_star, phase) - implicit none - integer:: index_of_the_star, phase - integer:: set_phase - GenecStar%phase = phase - set_phase = 0 -end function +!function get_phase(index_of_the_star, phase) +! implicit none +! integer:: index_of_the_star, phase +! integer:: get_phase +! phase = GenecStar%phase +! get_phase = 0 +!end function +! +!function set_phase(index_of_the_star, phase) +! implicit none +! integer:: index_of_the_star, phase +! integer:: set_phase +! GenecStar%phase = phase +! set_phase = 0 +!end function function set_temperature_at_zone(index_of_the_star, zone, T_i) implicit none diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 5d7b5330a8..7e2b656eca 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -1,11 +1,16 @@ -import numpy +""" +Interface for GENEC. +""" + +import numpy as np from amuse.datamodel import ParticlesWithFilteredAttributes from amuse.community import CodeInterface from amuse.community import LegacyFunctionSpecification -from amuse.community import legacy_function +from amuse.community import legacy_function, remote_function from amuse.community import LiteratureReferencesMixIn from amuse.community import CodeWithDataDirectories from amuse.community import InCodeComponentImplementation +from amuse.community import NO_UNIT, ERROR_CODE from amuse.community.interface.se import StellarEvolution from amuse.community.interface.se import StellarEvolutionInterface from amuse.community.interface.se import InternalStellarStructure @@ -45,6 +50,193 @@ 'bid1': 27, } +GENEC_STAR_PROPERTIES = { + 'n_snap': ('int32', NO_UNIT, "number of steps between snapshots [0]"), + #'ipoly': ('int32', NO_UNIT, "polytropic index"), +} + +GENEC_STAR_PARAMETERS = { + 'initialised': ['bool', NO_UNIT, "True if the star is an intialised model"], + 'starname': ['string', NO_UNIT, "Name of the star"], + 'nwseq': ['int32', NO_UNIT, ""], + 'modanf': ['int32', NO_UNIT, ""], + 'nzmod': ['int32', NO_UNIT, ""], + 'end_at_phase': ['int32', NO_UNIT, "Stop if this phase is reached"], + 'end_at_model': ['int32', NO_UNIT, "Stop if this model number is reached"], + 'irot': ['int32', NO_UNIT, ""], + 'isol': ['int32', NO_UNIT, ""], + 'imagn': ['int32', NO_UNIT, ""], + 'ialflu': ['int32', NO_UNIT, ""], + 'ianiso': ['int32', NO_UNIT, ""], + 'ipop3': ['int32', NO_UNIT, ""], + 'ibasnet': ['int32', NO_UNIT, ""], + 'phase': ['int32', NO_UNIT, ""], + 'var_rates': ['bool', NO_UNIT, ""], + 'bintide': ['bool', NO_UNIT, ""], + 'binm2': ['float64', NO_UNIT, ""], + 'periodini': ['float64', NO_UNIT, ""], + 'const_per': ['bool', NO_UNIT, ""], + 'iprezams': ['int32', NO_UNIT, ""], + 'zinit': ['float64', NO_UNIT, ""], + 'zsol': ['float64', NO_UNIT, ""], + 'z': ['float64', NO_UNIT, ""], + 'iopac': ['int32', NO_UNIT, ""], + 'ikappa': ['int32', NO_UNIT, ""], + 'idiff': ['int32', NO_UNIT, ""], + 'iadvec': ['int32', NO_UNIT, ""], + 'istati': ['int32', NO_UNIT, ""], + 'icoeff': ['int32', NO_UNIT, ""], + 'fenerg': ['float64', NO_UNIT, ""], + 'richac': ['float64', NO_UNIT, ""], + 'igamma': ['int32', NO_UNIT, ""], + 'frein': ['float64', NO_UNIT, ""], + 'K_Kawaler': ['float64', NO_UNIT, ""], + 'Omega_saturation': ['float64', NO_UNIT, ""], + 'rapcrilim': ['float64', NO_UNIT, ""], + 'vwant': ['float64', NO_UNIT, ""], + 'xfom': ['float64', NO_UNIT, ""], + 'omega': ['float64', NO_UNIT, ""], + 'xdial': ['float64', NO_UNIT, ""], + 'idialo': ['int32', NO_UNIT, ""], + 'idialu': ['int32', NO_UNIT, ""], + 'Add_Flux': ['bool', NO_UNIT, ""], + 'diff_only': ['bool', NO_UNIT, ""], + 'B_initial': ['float64', NO_UNIT, ""], + 'add_diff': ['float64', NO_UNIT, ""], + 'n_mag': ['int32', NO_UNIT, ""], + 'alpha_F': ['float64', NO_UNIT, ""], + 'nsmooth': ['int32', NO_UNIT, ""], + 'qminsmooth': ['bool', NO_UNIT, ""], + 'imloss': ['int32', NO_UNIT, ""], + 'fmlos': ['float64', NO_UNIT, ""], + 'ifitm': ['int32', NO_UNIT, ""], + 'fitm': ['float64', NO_UNIT, ""], + 'fitmi': ['float64', NO_UNIT, ""], + 'deltal': ['float64', NO_UNIT, ""], + 'deltat': ['float64', NO_UNIT, ""], + 'nndr': ['int32', NO_UNIT, ""], + 'RSG_Mdot': ['int32', NO_UNIT, ""], + 'SupraEddMdot': ['bool', NO_UNIT, ""], + 'Be_mdotfrac': ['float64', NO_UNIT, ""], + 'start_mdot': ['float64', NO_UNIT, ""], + 'iledou': ['int32', NO_UNIT, ""], + 'idifcon': ['int32', NO_UNIT, ""], + 'iover': ['int32', NO_UNIT, ""], + 'elph': ['float64', NO_UNIT, ""], + 'my': ['int32', NO_UNIT, ""], + 'dovhp': ['float64', NO_UNIT, ""], + 'iunder': ['int32', NO_UNIT, ""], + 'dunder': ['float64', NO_UNIT, ""], + 'gkorm': ['float64', NO_UNIT, ""], + 'alph': ['float64', NO_UNIT, ""], + 'agdr': ['float64', NO_UNIT, ""], + 'faktor': ['float64', NO_UNIT, ""], + 'dgrp': ['float64', NO_UNIT, ""], + 'dgrl': ['float64', NO_UNIT, ""], + 'dgry': ['float64', NO_UNIT, ""], + 'dgrc': ['float64', NO_UNIT, ""], + 'dgro': ['float64', NO_UNIT, ""], + 'dgr20': ['float64', NO_UNIT, ""], + 'nbchx': ['int32', NO_UNIT, ""], + 'nrband': ['int32', NO_UNIT, ""], + 'xcn': ['float64', NO_UNIT, ""], + 'islow': ['int32', NO_UNIT, ""], + 'icncst': ['int32', NO_UNIT, ""], + 'tauH_fit': ['int32', NO_UNIT, ""], + 'display_plot': ['bool', NO_UNIT, ""], + 'iauto': ['int32', NO_UNIT, ""], + 'iprn': ['int32', NO_UNIT, ""], + 'iout': ['int32', NO_UNIT, ""], + 'itmin': ['int32', NO_UNIT, ""], + 'xyfiles': ['bool', NO_UNIT, ""], + 'idebug': ['int32', NO_UNIT, ""], + 'itests': ['int32', NO_UNIT, ""], + 'verbose': ['bool', NO_UNIT, ""], + 'stop_deg': ['bool', NO_UNIT, ""], + 'n_snap': ['int32', NO_UNIT, "number of steps between snapshots [0]"], +} + +GENEC_STAR_STRUCTURE = { + 'm': ['int32', NO_UNIT, "number of zones"], + 'gms': ['float64', units.MSun, "total mass"], + 'alter': ['float64', units.julianyr, "stellar age"], + 'gls': ['float64', NO_UNIT, ""], + 'teff': ['float64', units.K, "effective temperature"], + 'glsv': ['float64', NO_UNIT, ""], + 'teffv': ['float64', units.K, "previous effective temperature"], + 'dzeitj': ['float64', units.julianyr, "time step"], + 'dzeit': ['float64', units.s, "time step"], + 'dzeitv': ['float64', units.s, "previous time step"], + 'xmini': ['float64', NO_UNIT, ""], + 'summas': ['float64', units.MSun, "total mass"], + 'ab': ['float64', NO_UNIT, ""], + 'dm_lost': ['float64', units.MSun, "total mass lost"], + 'q': ['float64', NO_UNIT, ""], + 'p': ['float64', NO_UNIT, ""], + 't': ['float64', NO_UNIT, ""], + 'r': ['float64', NO_UNIT, ""], + 's': ['float64', NO_UNIT, ""], + 'x': ['float64', NO_UNIT, "H fraction"], + 'y3': ['float64', NO_UNIT, "He3 fraction"], + 'y': ['float64', NO_UNIT, "He fraction"], + 'xc12': ['float64', NO_UNIT, "C12 fraction"], + 'xc13': ['float64', NO_UNIT, "C13 fraction"], + 'xn14': ['float64', NO_UNIT, "N14 fraction"], + 'xn15': ['float64', NO_UNIT, ""], + 'xo16': ['float64', NO_UNIT, ""], + 'xo17': ['float64', NO_UNIT, ""], + 'xo18': ['float64', NO_UNIT, ""], + 'xne20': ['float64', NO_UNIT, ""], + 'xne22': ['float64', NO_UNIT, ""], + 'xmg24': ['float64', NO_UNIT, ""], + 'xmg25': ['float64', NO_UNIT, ""], + 'xmg26': ['float64', NO_UNIT, ""], + 'xf19': ['float64', NO_UNIT, ""], + 'xne21': ['float64', NO_UNIT, ""], + 'xna23': ['float64', NO_UNIT, ""], + 'xal27': ['float64', NO_UNIT, ""], + 'xsi28': ['float64', NO_UNIT, ""], + 'xc14': ['float64', NO_UNIT, ""], + 'xf18': ['float64', NO_UNIT, ""], + 'xal26': ['float64', NO_UNIT, ""], + 'xneut': ['float64', NO_UNIT, "Neutron fraction"], + 'xprot': ['float64', NO_UNIT, "Proton fraction"], + 'omegi': ['float64', NO_UNIT, "Rotation"], + 'xbid': ['float64', NO_UNIT, ""], + 'xbid1': ['float64', NO_UNIT, ""], + 'vp': ['float64', NO_UNIT, ""], + 'vt': ['float64', NO_UNIT, ""], + 'vr': ['float64', NO_UNIT, ""], + 'vs': ['float64', NO_UNIT, ""], + 'vx': ['float64', NO_UNIT, ""], + 'vy': ['float64', NO_UNIT, ""], + 'vy3': ['float64', NO_UNIT, ""], + 'vxc12': ['float64', NO_UNIT, ""], + 'vxc13': ['float64', NO_UNIT, ""], + 'vxn14': ['float64', NO_UNIT, ""], + 'vxn15': ['float64', NO_UNIT, ""], + 'vxo16': ['float64', NO_UNIT, ""], + 'vxo17': ['float64', NO_UNIT, ""], + 'vxo18': ['float64', NO_UNIT, ""], + 'vxne20': ['float64', NO_UNIT, ""], + 'vxne22': ['float64', NO_UNIT, ""], + 'vxmg24': ['float64', NO_UNIT, ""], + 'vxmg25': ['float64', NO_UNIT, ""], + 'vxmg26': ['float64', NO_UNIT, ""], + 'vxf19': ['float64', NO_UNIT, ""], + 'vxne21': ['float64', NO_UNIT, ""], + 'vxna23': ['float64', NO_UNIT, ""], + 'vxal27': ['float64', NO_UNIT, ""], + 'vxsi28': ['float64', NO_UNIT, ""], + 'vxc14': ['float64', NO_UNIT, ""], + 'vxf18': ['float64', NO_UNIT, ""], + 'vxal26g': ['float64', NO_UNIT, ""], + 'vxneut': ['float64', NO_UNIT, ""], + 'vxprot': ['float64', NO_UNIT, ""], + 'vomegi': ['float64', NO_UNIT, ""], + 'vxbid': ['float64', NO_UNIT, ""], + 'vxbid1': ['float64', NO_UNIT, ""], +} class GenecInterface( CodeInterface, @@ -75,3252 +267,793 @@ def finalize_stellar_model(): function.result_type = 'int32' return function - @legacy_function - def write_genec_model(): - function = LegacyFunctionSpecification() - function.result_type = 'int32' - return function + @remote_function + def set_genec_path(genec_path='s'): + returns () - @legacy_function - def set_genec_path(): - """ - set path to Genec data directories - """ - function = LegacyFunctionSpecification() - function.addParameter( - 'genec_path', dtype='string', direction=function.IN, - description="Path to Genec", - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - Current value was set - -1 - ERROR - Directory does not exist - """ - return function + @remote_function(can_handle_array=True) + def get_initialised(index_of_the_particle='i'): + returns (initialised='bool') - # @legacy_function - # def read_genec_model(): - # """ - # Read a previously saved GENEC model - # """ - # function = LegacyFunctionSpecification() - # function.can_handle_array = False - # function.addParameter( - # 'index_of_the_star', dtype='int32', direction=function.OUT, - # description="index of the star", - # ) - # function.addParameter( - # 'cardfilename', dtype='string', direction=function.IN, - # description="GENEC input card", - # ) - # function.result_type = 'int32' - # return function - # Parameters + @remote_function(can_handle_array=True) + def set_initialised(index_of_the_particle='i', initialised='bool'): + returns () - @legacy_function - def get_par_n_snap(): - 'get parameter n_snap' - function = LegacyFunctionSpecification() - function.addParameter( - 'n_snap', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_starname(index_of_the_particle='i'): + returns (starname='string') - @legacy_function - def set_par_n_snap(): - 'set parameter n_snap' - function = LegacyFunctionSpecification() - function.addParameter( - 'n_snap', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_starname(index_of_the_particle='i', starname='string'): + returns () - @legacy_function - def get_par_ipoly(): - 'get parameter ipoly' - function = LegacyFunctionSpecification() - function.addParameter( - 'ipoly', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_nwseq(index_of_the_particle='i'): + returns (nwseq='int32') - @legacy_function - def set_par_ipoly(): - 'set parameter ipoly' - function = LegacyFunctionSpecification() - function.addParameter( - 'ipoly', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_nwseq(index_of_the_particle='i', nwseq='int32'): + returns () - @legacy_function - def get_par_nwseq(): - 'get parameter nwseq' - function = LegacyFunctionSpecification() - function.addParameter( - 'nwseq', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_modanf(index_of_the_particle='i'): + returns (modanf='int32') - @legacy_function - def set_par_nwseq(): - 'set parameter nwseq' - function = LegacyFunctionSpecification() - function.addParameter( - 'nwseq', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_modanf(index_of_the_particle='i', modanf='int32'): + returns () - @legacy_function - def get_par_modanf(): - 'get parameter modanf' - function = LegacyFunctionSpecification() - function.addParameter( - 'modanf', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_nzmod(index_of_the_particle='i'): + returns (nzmod='int32') - @legacy_function - def set_par_modanf(): - 'set parameter modanf' - function = LegacyFunctionSpecification() - function.addParameter( - 'modanf', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_nzmod(index_of_the_particle='i', nzmod='int32'): + returns () - @legacy_function - def get_par_nzmod(): - 'get parameter nzmod' - function = LegacyFunctionSpecification() - function.addParameter( - 'nzmod', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_end_at_phase(index_of_the_particle='i'): + returns (end_at_phase='int32') - @legacy_function - def set_par_nzmod(): - 'set parameter nzmod' - function = LegacyFunctionSpecification() - function.addParameter( - 'nzmod', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_end_at_phase(index_of_the_particle='i', end_at_phase='int32'): + returns () - @legacy_function - def get_par_irot(): - 'get parameter irot' - function = LegacyFunctionSpecification() - function.addParameter( - 'irot', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_end_at_model(index_of_the_particle='i'): + returns (end_at_model='int32') - @legacy_function - def set_par_irot(): - 'set parameter irot' - function = LegacyFunctionSpecification() - function.addParameter( - 'irot', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_end_at_model(index_of_the_particle='i', end_at_model='int32'): + returns () - @legacy_function - def get_par_isol(): - 'get parameter isol' - function = LegacyFunctionSpecification() - function.addParameter( - 'isol', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_irot(index_of_the_particle='i'): + returns (irot='int32') - @legacy_function - def set_par_isol(): - 'set parameter isol' - function = LegacyFunctionSpecification() - function.addParameter( - 'isol', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_irot(index_of_the_particle='i', irot='int32'): + returns () - @legacy_function - def get_par_imagn(): - 'get parameter imagn' - function = LegacyFunctionSpecification() - function.addParameter( - 'imagn', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_isol(index_of_the_particle='i'): + returns (isol='int32') - @legacy_function - def set_par_imagn(): - 'set parameter imagn' - function = LegacyFunctionSpecification() - function.addParameter( - 'imagn', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_isol(index_of_the_particle='i', isol='int32'): + returns () - @legacy_function - def get_par_ialflu(): - 'get parameter ialflu' - function = LegacyFunctionSpecification() - function.addParameter( - 'ialflu', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_imagn(index_of_the_particle='i'): + returns (imagn='int32') - @legacy_function - def set_par_ialflu(): - 'set parameter ialflu' - function = LegacyFunctionSpecification() - function.addParameter( - 'ialflu', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_imagn(index_of_the_particle='i', imagn='int32'): + returns () - @legacy_function - def get_par_ianiso(): - 'get parameter ianiso' - function = LegacyFunctionSpecification() - function.addParameter( - 'ianiso', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_ialflu(index_of_the_particle='i'): + returns (ialflu='int32') - @legacy_function - def set_par_ianiso(): - 'set parameter ianiso' - function = LegacyFunctionSpecification() - function.addParameter( - 'ianiso', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_ialflu(index_of_the_particle='i', ialflu='int32'): + returns () - @legacy_function - def get_par_ipop3(): - 'get parameter ipop3' - function = LegacyFunctionSpecification() - function.addParameter( - 'ipop3', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_ianiso(index_of_the_particle='i'): + returns (ianiso='int32') - @legacy_function - def set_par_ipop3(): - 'set parameter ipop3' - function = LegacyFunctionSpecification() - function.addParameter( - 'ipop3', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_ianiso(index_of_the_particle='i', ianiso='int32'): + returns () - @legacy_function - def get_par_ibasnet(): - 'get parameter ibasnet' - function = LegacyFunctionSpecification() - function.addParameter( - 'ibasnet', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_ipop3(index_of_the_particle='i'): + returns (ipop3='int32') - @legacy_function - def set_par_ibasnet(): - 'set parameter ibasnet' - function = LegacyFunctionSpecification() - function.addParameter( - 'ibasnet', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_ipop3(index_of_the_particle='i', ipop3='int32'): + returns () - @legacy_function - def get_par_iopac(): - 'get parameter iopac' - function = LegacyFunctionSpecification() - function.addParameter( - 'iopac', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_ibasnet(index_of_the_particle='i'): + returns (ibasnet='int32') - @legacy_function - def set_par_iopac(): - 'set parameter iopac' - function = LegacyFunctionSpecification() - function.addParameter( - 'iopac', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_ibasnet(index_of_the_particle='i', ibasnet='int32'): + returns () - @legacy_function - def get_par_ikappa(): - 'get parameter ikappa' - function = LegacyFunctionSpecification() - function.addParameter( - 'ikappa', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_phase(index_of_the_particle='i'): + returns (phase='int32') - @legacy_function - def set_par_ikappa(): - 'set parameter ikappa' - function = LegacyFunctionSpecification() - function.addParameter( - 'ikappa', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_phase(index_of_the_particle='i', phase='int32'): + returns () - @legacy_function - def get_par_idiff(): - 'get parameter idiff' - function = LegacyFunctionSpecification() - function.addParameter( - 'idiff', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_var_rates(index_of_the_particle='i'): + returns (var_rates='bool') - @legacy_function - def set_par_idiff(): - 'set parameter idiff' - function = LegacyFunctionSpecification() - function.addParameter( - 'idiff', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_var_rates(index_of_the_particle='i', var_rates='bool'): + returns () - @legacy_function - def get_par_iadvec(): - 'get parameter iadvec' - function = LegacyFunctionSpecification() - function.addParameter( - 'iadvec', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_bintide(index_of_the_particle='i'): + returns (bintide='bool') - @legacy_function - def set_par_iadvec(): - 'set parameter iadvec' - function = LegacyFunctionSpecification() - function.addParameter( - 'iadvec', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_bintide(index_of_the_particle='i', bintide='bool'): + returns () - @legacy_function - def get_par_istati(): - 'get parameter istati' - function = LegacyFunctionSpecification() - function.addParameter( - 'istati', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_binm2(index_of_the_particle='i'): + returns (binm2='float64') - @legacy_function - def set_par_istati(): - 'set parameter istati' - function = LegacyFunctionSpecification() - function.addParameter( - 'istati', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_binm2(index_of_the_particle='i', binm2='float64'): + returns () - @legacy_function - def get_par_icoeff(): - 'get parameter icoeff' - function = LegacyFunctionSpecification() - function.addParameter( - 'icoeff', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_periodini(index_of_the_particle='i'): + returns (periodini='float64') - @legacy_function - def set_par_icoeff(): - 'set parameter icoeff' - function = LegacyFunctionSpecification() - function.addParameter( - 'icoeff', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_periodini(index_of_the_particle='i', periodini='float64'): + returns () - @legacy_function - def get_par_igamma(): - 'get parameter igamma' - function = LegacyFunctionSpecification() - function.addParameter( - 'igamma', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_const_per(index_of_the_particle='i'): + returns (const_per='bool') - @legacy_function - def set_par_igamma(): - 'set parameter igamma' - function = LegacyFunctionSpecification() - function.addParameter( - 'igamma', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_const_per(index_of_the_particle='i', const_per='bool'): + returns () - @legacy_function - def get_par_idialo(): - 'get parameter idialo' - function = LegacyFunctionSpecification() - function.addParameter( - 'idialo', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_iprezams(index_of_the_particle='i'): + returns (iprezams='int32') - @legacy_function - def set_par_idialo(): - 'set parameter idialo' - function = LegacyFunctionSpecification() - function.addParameter( - 'idialo', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_iprezams(index_of_the_particle='i', iprezams='int32'): + returns () - @legacy_function - def get_par_idialu(): - 'get parameter idialu' - function = LegacyFunctionSpecification() - function.addParameter( - 'idialu', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_zinit(index_of_the_particle='i'): + returns (zinit='float64') - @legacy_function - def set_par_idialu(): - 'set parameter idialu' - function = LegacyFunctionSpecification() - function.addParameter( - 'idialu', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_zinit(index_of_the_particle='i', zinit='float64'): + returns () - @legacy_function - def get_par_imloss(): - 'get parameter imloss' - function = LegacyFunctionSpecification() - function.addParameter( - 'imloss', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_zsol(index_of_the_particle='i'): + returns (zsol='float64') - @legacy_function - def set_par_imloss(): - 'set parameter imloss' - function = LegacyFunctionSpecification() - function.addParameter( - 'imloss', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_zsol(index_of_the_particle='i', zsol='float64'): + returns () - @legacy_function - def get_par_ifitm(): - 'get parameter ifitm' - function = LegacyFunctionSpecification() - function.addParameter( - 'ifitm', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_z(index_of_the_particle='i'): + returns (z='float64') - @legacy_function - def set_par_ifitm(): - 'set parameter ifitm' - function = LegacyFunctionSpecification() - function.addParameter( - 'ifitm', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_z(index_of_the_particle='i', z='float64'): + returns () - @legacy_function - def get_par_nndr(): - 'get parameter nndr' - function = LegacyFunctionSpecification() - function.addParameter( - 'nndr', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_iopac(index_of_the_particle='i'): + returns (iopac='int32') - @legacy_function - def set_par_nndr(): - 'set parameter nndr' - function = LegacyFunctionSpecification() - function.addParameter( - 'nndr', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_iopac(index_of_the_particle='i', iopac='int32'): + returns () - @legacy_function - def get_par_iledou(): - 'get parameter iledou' - function = LegacyFunctionSpecification() - function.addParameter( - 'iledou', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_ikappa(index_of_the_particle='i'): + returns (ikappa='int32') - @legacy_function - def set_par_iledou(): - 'set parameter iledou' - function = LegacyFunctionSpecification() - function.addParameter( - 'iledou', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_ikappa(index_of_the_particle='i', ikappa='int32'): + returns () - @legacy_function - def get_par_idifcon(): - 'get parameter idifcon' - function = LegacyFunctionSpecification() - function.addParameter( - 'idifcon', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_idiff(index_of_the_particle='i'): + returns (idiff='int32') - @legacy_function - def set_par_idifcon(): - 'set parameter idifcon' - function = LegacyFunctionSpecification() - function.addParameter( - 'idifcon', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_idiff(index_of_the_particle='i', idiff='int32'): + returns () - @legacy_function - def get_par_my(): - 'get parameter my' - function = LegacyFunctionSpecification() - function.addParameter( - 'my', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_iadvec(index_of_the_particle='i'): + returns (iadvec='int32') - @legacy_function - def set_par_my(): - 'set parameter my' - function = LegacyFunctionSpecification() - function.addParameter( - 'my', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_iadvec(index_of_the_particle='i', iadvec='int32'): + returns () - @legacy_function - def get_par_iover(): - 'get parameter iover' - function = LegacyFunctionSpecification() - function.addParameter( - 'iover', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_istati(index_of_the_particle='i'): + returns (istati='int32') - @legacy_function - def set_par_iover(): - 'set parameter iover' - function = LegacyFunctionSpecification() - function.addParameter( - 'iover', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_istati(index_of_the_particle='i', istati='int32'): + returns () - @legacy_function - def get_par_iunder(): - 'get parameter iunder' - function = LegacyFunctionSpecification() - function.addParameter( - 'iunder', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_icoeff(index_of_the_particle='i'): + returns (icoeff='int32') - @legacy_function - def set_par_iunder(): - 'set parameter iunder' - function = LegacyFunctionSpecification() - function.addParameter( - 'iunder', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_icoeff(index_of_the_particle='i', icoeff='int32'): + returns () - @legacy_function - def get_par_nbchx(): - 'get parameter nbchx' - function = LegacyFunctionSpecification() - function.addParameter( - 'nbchx', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_fenerg(index_of_the_particle='i'): + returns (fenerg='float64') - @legacy_function - def set_par_nbchx(): - 'set parameter nbchx' - function = LegacyFunctionSpecification() - function.addParameter( - 'nbchx', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_fenerg(index_of_the_particle='i', fenerg='float64'): + returns () - @legacy_function - def get_par_nrband(): - 'get parameter nrband' - function = LegacyFunctionSpecification() - function.addParameter( - 'nrband', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_richac(index_of_the_particle='i'): + returns (richac='float64') - @legacy_function - def set_par_nrband(): - 'set parameter nrband' - function = LegacyFunctionSpecification() - function.addParameter( - 'nrband', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_richac(index_of_the_particle='i', richac='float64'): + returns () - @legacy_function - def get_par_islow(): - 'get parameter islow' - function = LegacyFunctionSpecification() - function.addParameter( - 'islow', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_igamma(index_of_the_particle='i'): + returns (igamma='int32') - @legacy_function - def set_par_islow(): - 'set parameter islow' - function = LegacyFunctionSpecification() - function.addParameter( - 'islow', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_igamma(index_of_the_particle='i', igamma='int32'): + returns () - @legacy_function - def get_par_icncst(): - 'get parameter icncst' - function = LegacyFunctionSpecification() - function.addParameter( - 'icncst', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_frein(index_of_the_particle='i'): + returns (frein='float64') - @legacy_function - def set_par_icncst(): - 'set parameter icncst' - function = LegacyFunctionSpecification() - function.addParameter( - 'icncst', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_frein(index_of_the_particle='i', frein='float64'): + returns () - @legacy_function - def get_par_tauH_fit(): - 'get parameter tauH_fit' - function = LegacyFunctionSpecification() - function.addParameter( - 'tauH_fit', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_K_Kawaler(index_of_the_particle='i'): + returns (K_Kawaler='float64') - @legacy_function - def set_par_tauH_fit(): - 'set parameter tauH_fit' - function = LegacyFunctionSpecification() - function.addParameter( - 'tauH_fit', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_K_Kawaler(index_of_the_particle='i', K_Kawaler='float64'): + returns () - @legacy_function - def get_par_iauto(): - 'get parameter iauto' - function = LegacyFunctionSpecification() - function.addParameter( - 'iauto', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_Omega_saturation(index_of_the_particle='i'): + returns (Omega_saturation='float64') - @legacy_function - def set_par_iauto(): - 'set parameter iauto' - function = LegacyFunctionSpecification() - function.addParameter( - 'iauto', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_Omega_saturation(index_of_the_particle='i', Omega_saturation='float64'): + returns () - @legacy_function - def get_par_iprn(): - 'get parameter iprn' - function = LegacyFunctionSpecification() - function.addParameter( - 'iprn', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_rapcrilim(index_of_the_particle='i'): + returns (rapcrilim='float64') - @legacy_function - def set_par_iprn(): - 'set parameter iprn' - function = LegacyFunctionSpecification() - function.addParameter( - 'iprn', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_rapcrilim(index_of_the_particle='i', rapcrilim='float64'): + returns () - @legacy_function - def get_par_iout(): - 'get parameter iout' - function = LegacyFunctionSpecification() - function.addParameter( - 'iout', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_vwant(index_of_the_particle='i'): + returns (vwant='float64') - @legacy_function - def set_par_iout(): - 'set parameter iout' - function = LegacyFunctionSpecification() - function.addParameter( - 'iout', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_vwant(index_of_the_particle='i', vwant='float64'): + returns () - @legacy_function - def get_par_itmin(): - 'get parameter itmin' - function = LegacyFunctionSpecification() - function.addParameter( - 'itmin', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_xfom(index_of_the_particle='i'): + returns (xfom='float64') - @legacy_function - def set_par_itmin(): - 'set parameter itmin' - function = LegacyFunctionSpecification() - function.addParameter( - 'itmin', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_xfom(index_of_the_particle='i', xfom='float64'): + returns () - @legacy_function - def get_par_idebug(): - 'get parameter idebug' - function = LegacyFunctionSpecification() - function.addParameter( - 'idebug', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_omega(index_of_the_particle='i'): + returns (omega='float64') - @legacy_function - def set_par_idebug(): - 'set parameter idebug' - function = LegacyFunctionSpecification() - function.addParameter( - 'idebug', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_omega(index_of_the_particle='i', omega='float64'): + returns () - @legacy_function - def get_par_itests(): - 'get parameter itests' - function = LegacyFunctionSpecification() - function.addParameter( - 'itests', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_xdial(index_of_the_particle='i'): + returns (xdial='float64') - @legacy_function - def set_par_itests(): - 'set parameter itests' - function = LegacyFunctionSpecification() - function.addParameter( - 'itests', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_xdial(index_of_the_particle='i', xdial='float64'): + returns () - @legacy_function - def get_par_var_rates(): - 'get parameter var_rates' - function = LegacyFunctionSpecification() - function.addParameter( - 'var_rates', dtype='bool', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_idialo(index_of_the_particle='i'): + returns (idialo='int32') - @legacy_function - def set_par_var_rates(): - 'set parameter var_rates' - function = LegacyFunctionSpecification() - function.addParameter( - 'var_rates', dtype='bool', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_idialo(index_of_the_particle='i', idialo='int32'): + returns () - @legacy_function - def get_par_bintide(): - 'get parameter bintide' - function = LegacyFunctionSpecification() - function.addParameter( - 'bintide', dtype='bool', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_idialu(index_of_the_particle='i'): + returns (idialu='int32') - @legacy_function - def set_par_bintide(): - 'set parameter bintide' - function = LegacyFunctionSpecification() - function.addParameter( - 'bintide', dtype='bool', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_idialu(index_of_the_particle='i', idialu='int32'): + returns () - @legacy_function - def get_par_const_per(): - 'get parameter const_per' - function = LegacyFunctionSpecification() - function.addParameter( - 'const_per', dtype='bool', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_Add_Flux(index_of_the_particle='i'): + returns (Add_Flux='bool') - @legacy_function - def set_par_const_per(): - 'set parameter const_per' - function = LegacyFunctionSpecification() - function.addParameter( - 'const_per', dtype='bool', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_Add_Flux(index_of_the_particle='i', Add_Flux='bool'): + returns () - @legacy_function - def get_par_Add_Flux(): - 'get parameter Add_Flux' - function = LegacyFunctionSpecification() - function.addParameter( - 'Add_Flux', dtype='bool', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_diff_only(index_of_the_particle='i'): + returns (diff_only='bool') - @legacy_function - def set_par_Add_Flux(): - 'set parameter Add_Flux' - function = LegacyFunctionSpecification() - function.addParameter( - 'Add_Flux', dtype='bool', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_diff_only(index_of_the_particle='i', diff_only='bool'): + returns () - @legacy_function - def get_par_diff_only(): - 'get parameter diff_only' - function = LegacyFunctionSpecification() - function.addParameter( - 'diff_only', dtype='bool', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_B_initial(index_of_the_particle='i'): + returns (B_initial='float64') - @legacy_function - def set_par_diff_only(): - 'set parameter diff_only' - function = LegacyFunctionSpecification() - function.addParameter( - 'diff_only', dtype='bool', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_B_initial(index_of_the_particle='i', B_initial='float64'): + returns () - @legacy_function - def get_par_RSG_Mdot(): - 'get parameter RSG_Mdot' - function = LegacyFunctionSpecification() - function.addParameter( - 'RSG_Mdot', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_add_diff(index_of_the_particle='i'): + returns (add_diff='float64') - @legacy_function - def set_par_RSG_Mdot(): - 'set parameter RSG_Mdot' - function = LegacyFunctionSpecification() - function.addParameter( - 'RSG_Mdot', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_add_diff(index_of_the_particle='i', add_diff='float64'): + returns () - @legacy_function - def get_par_display_plot(): - 'get parameter display_plot' - function = LegacyFunctionSpecification() - function.addParameter( - 'display_plot', dtype='bool', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_n_mag(index_of_the_particle='i'): + returns (n_mag='int32') - @legacy_function - def set_par_display_plot(): - 'set parameter display_plot' - function = LegacyFunctionSpecification() - function.addParameter( - 'display_plot', dtype='bool', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_n_mag(index_of_the_particle='i', n_mag='int32'): + returns () - @legacy_function - def get_par_xyfiles(): - 'get parameter xyfiles' - function = LegacyFunctionSpecification() - function.addParameter( - 'xyfiles', dtype='bool', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_alpha_F(index_of_the_particle='i'): + returns (alpha_F='float64') - @legacy_function - def set_par_xyfiles(): - 'set parameter xyfiles' - function = LegacyFunctionSpecification() - function.addParameter( - 'xyfiles', dtype='bool', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_alpha_F(index_of_the_particle='i', alpha_F='float64'): + returns () - @legacy_function - def get_par_verbose(): - 'get parameter verbose' - function = LegacyFunctionSpecification() - function.addParameter( - 'verbose', dtype='bool', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_nsmooth(index_of_the_particle='i'): + returns (nsmooth='int32') - @legacy_function - def set_par_verbose(): - 'set parameter verbose' - function = LegacyFunctionSpecification() - function.addParameter( - 'verbose', dtype='bool', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_nsmooth(index_of_the_particle='i', nsmooth='int32'): + returns () - @legacy_function - def get_par_stop_deg(): - 'get parameter stop_deg' - function = LegacyFunctionSpecification() - function.addParameter( - 'stop_deg', dtype='bool', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_qminsmooth(index_of_the_particle='i'): + returns (qminsmooth='bool') - @legacy_function - def set_par_stop_deg(): - 'set parameter stop_deg' - function = LegacyFunctionSpecification() - function.addParameter( - 'stop_deg', dtype='bool', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_qminsmooth(index_of_the_particle='i', qminsmooth='bool'): + returns () - @legacy_function - def get_par_index_poly(): - 'get parameter index_poly' - function = LegacyFunctionSpecification() - function.addParameter( - 'index_poly', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_imloss(index_of_the_particle='i'): + returns (imloss='int32') - @legacy_function - def set_par_index_poly(): - 'set parameter index_poly' - function = LegacyFunctionSpecification() - function.addParameter( - 'index_poly', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function - @legacy_function - def get_par_binm2(): - 'get parameter binm2' - function = LegacyFunctionSpecification() - function.addParameter( - 'binm2', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_imloss(index_of_the_particle='i', imloss='int32'): + returns () - @legacy_function - def set_par_binm2(): - 'set parameter binm2' - function = LegacyFunctionSpecification() - function.addParameter( - 'binm2', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_fmlos(index_of_the_particle='i'): + returns (fmlos='float64') - @legacy_function - def get_par_periodini(): - 'get parameter periodini' - function = LegacyFunctionSpecification() - function.addParameter( - 'periodini', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_fmlos(index_of_the_particle='i', fmlos='float64'): + returns () - @legacy_function - def set_par_periodini(): - 'set parameter periodini' - function = LegacyFunctionSpecification() - function.addParameter( - 'periodini', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_ifitm(index_of_the_particle='i'): + returns (ifitm='int32') - @legacy_function - def get_par_zinit(): - 'get parameter zinit' - function = LegacyFunctionSpecification() - function.addParameter( - 'zinit', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_ifitm(index_of_the_particle='i', ifitm='int32'): + returns () - @legacy_function - def set_par_zinit(): - 'set parameter zinit' - function = LegacyFunctionSpecification() - function.addParameter( - 'zinit', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_fitm(index_of_the_particle='i'): + returns (fitm='float64') - @legacy_function - def get_par_zsol(): - 'get parameter zsol' - function = LegacyFunctionSpecification() - function.addParameter( - 'zsol', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_fitm(index_of_the_particle='i', fitm='float64'): + returns () - @legacy_function - def set_par_zsol(): - 'set parameter zsol' - function = LegacyFunctionSpecification() - function.addParameter( - 'zsol', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_fitmi(index_of_the_particle='i'): + returns (fitmi='float64') - @legacy_function - def get_par_z(): - 'get parameter z' - function = LegacyFunctionSpecification() - function.addParameter( - 'z', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_fitmi(index_of_the_particle='i', fitmi='float64'): + returns () - @legacy_function - def set_par_z(): - 'set parameter z' - function = LegacyFunctionSpecification() - function.addParameter( - 'z', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_deltal(index_of_the_particle='i'): + returns (deltal='float64') - @legacy_function - def get_par_fenerg(): - 'get parameter fenerg' - function = LegacyFunctionSpecification() - function.addParameter( - 'fenerg', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_deltal(index_of_the_particle='i', deltal='float64'): + returns () - @legacy_function - def set_par_fenerg(): - 'set parameter fenerg' - function = LegacyFunctionSpecification() - function.addParameter( - 'fenerg', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_deltat(index_of_the_particle='i'): + returns (deltat='float64') - @legacy_function - def get_par_richac(): - 'get parameter richac' - function = LegacyFunctionSpecification() - function.addParameter( - 'richac', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_deltat(index_of_the_particle='i', deltat='float64'): + returns () - @legacy_function - def set_par_richac(): - 'set parameter richac' - function = LegacyFunctionSpecification() - function.addParameter( - 'richac', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_nndr(index_of_the_particle='i'): + returns (nndr='int32') - @legacy_function - def get_par_frein(): - 'get parameter frein' - function = LegacyFunctionSpecification() - function.addParameter( - 'frein', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_nndr(index_of_the_particle='i', nndr='int32'): + returns () - @legacy_function - def set_par_frein(): - 'set parameter frein' - function = LegacyFunctionSpecification() - function.addParameter( - 'frein', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_RSG_Mdot(index_of_the_particle='i'): + returns (RSG_Mdot='int32') - @legacy_function - def get_par_K_Kawaler(): - 'get parameter K_Kawaler' - function = LegacyFunctionSpecification() - function.addParameter( - 'K_Kawaler', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_RSG_Mdot(index_of_the_particle='i', RSG_Mdot='int32'): + returns () - @legacy_function - def set_par_K_Kawaler(): - 'set parameter K_Kawaler' - function = LegacyFunctionSpecification() - function.addParameter( - 'K_Kawaler', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_SupraEddMdot(index_of_the_particle='i'): + returns (SupraEddMdot='bool') - @legacy_function - def get_par_Omega_saturation(): - 'get parameter Omega_saturation' - function = LegacyFunctionSpecification() - function.addParameter( - 'Omega_saturation', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_SupraEddMdot(index_of_the_particle='i', SupraEddMdot='bool'): + returns () - @legacy_function - def set_par_Omega_saturation(): - 'set parameter Omega_saturation' - function = LegacyFunctionSpecification() - function.addParameter( - 'Omega_saturation', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_Be_mdotfrac(index_of_the_particle='i'): + returns (Be_mdotfrac='float64') - @legacy_function - def get_par_rapcrilim(): - 'get parameter rapcrilim' - function = LegacyFunctionSpecification() - function.addParameter( - 'rapcrilim', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_Be_mdotfrac(index_of_the_particle='i', Be_mdotfrac='float64'): + returns () - @legacy_function - def set_par_rapcrilim(): - 'set parameter rapcrilim' - function = LegacyFunctionSpecification() - function.addParameter( - 'rapcrilim', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_start_mdot(index_of_the_particle='i'): + returns (start_mdot='float64') - @legacy_function - def get_par_vwant(): - 'get parameter vwant' - function = LegacyFunctionSpecification() - function.addParameter( - 'vwant', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_start_mdot(index_of_the_particle='i', start_mdot='float64'): + returns () - @legacy_function - def set_par_vwant(): - 'set parameter vwant' - function = LegacyFunctionSpecification() - function.addParameter( - 'vwant', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_iledou(index_of_the_particle='i'): + returns (iledou='int32') + + @remote_function(can_handle_array=True) + def set_iledou(index_of_the_particle='i', iledou='int32'): + returns () + + @remote_function(can_handle_array=True) + def get_idifcon(index_of_the_particle='i'): + returns (idifcon='int32') + + @remote_function(can_handle_array=True) + def set_idifcon(index_of_the_particle='i', idifcon='int32'): + returns () + + @remote_function(can_handle_array=True) + def get_iover(index_of_the_particle='i'): + returns (iover='int32') + + @remote_function(can_handle_array=True) + def set_iover(index_of_the_particle='i', iover='int32'): + returns () + + @remote_function(can_handle_array=True) + def get_elph(index_of_the_particle='i'): + returns (elph='float64') + + @remote_function(can_handle_array=True) + def set_elph(index_of_the_particle='i', elph='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_my(index_of_the_particle='i'): + returns (my='int32') + + @remote_function(can_handle_array=True) + def set_my(index_of_the_particle='i', my='int32'): + returns () + + @remote_function(can_handle_array=True) + def get_dovhp(index_of_the_particle='i'): + returns (dovhp='float64') + + @remote_function(can_handle_array=True) + def set_dovhp(index_of_the_particle='i', dovhp='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_iunder(index_of_the_particle='i'): + returns (iunder='int32') + + @remote_function(can_handle_array=True) + def set_iunder(index_of_the_particle='i', iunder='int32'): + returns () - @legacy_function - def get_par_xfom(): - 'get parameter xfom' - function = LegacyFunctionSpecification() - function.addParameter( - 'xfom', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_dunder(index_of_the_particle='i'): + returns (dunder='float64') - @legacy_function - def set_par_xfom(): - 'set parameter xfom' - function = LegacyFunctionSpecification() - function.addParameter( - 'xfom', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_dunder(index_of_the_particle='i', dunder='float64'): + returns () - @legacy_function - def get_par_omega(): - 'get parameter omega' - function = LegacyFunctionSpecification() - function.addParameter( - 'omega', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_gkorm(index_of_the_particle='i'): + returns (gkorm='float64') - @legacy_function - def set_par_omega(): - 'set parameter omega' - function = LegacyFunctionSpecification() - function.addParameter( - 'omega', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_gkorm(index_of_the_particle='i', gkorm='float64'): + returns () - @legacy_function - def get_par_xdial(): - 'get parameter xdial' - function = LegacyFunctionSpecification() - function.addParameter( - 'xdial', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_alph(index_of_the_particle='i'): + returns (alph='float64') - @legacy_function - def set_par_xdial(): - 'set parameter xdial' - function = LegacyFunctionSpecification() - function.addParameter( - 'xdial', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_alph(index_of_the_particle='i', alph='float64'): + returns () - @legacy_function - def get_par_B_initial(): - 'get parameter B_initial' - function = LegacyFunctionSpecification() - function.addParameter( - 'B_initial', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_agdr(index_of_the_particle='i'): + returns (agdr='float64') - @legacy_function - def set_par_B_initial(): - 'set parameter B_initial' - function = LegacyFunctionSpecification() - function.addParameter( - 'B_initial', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_agdr(index_of_the_particle='i', agdr='float64'): + returns () - @legacy_function - def get_par_add_diff(): - 'get parameter add_diff' - function = LegacyFunctionSpecification() - function.addParameter( - 'add_diff', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_faktor(index_of_the_particle='i'): + returns (faktor='float64') - @legacy_function - def set_par_add_diff(): - 'set parameter add_diff' - function = LegacyFunctionSpecification() - function.addParameter( - 'add_diff', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_faktor(index_of_the_particle='i', faktor='float64'): + returns () - @legacy_function - def get_par_fmlos(): - 'get parameter fmlos' - function = LegacyFunctionSpecification() - function.addParameter( - 'fmlos', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_dgrp(index_of_the_particle='i'): + returns (dgrp='float64') - @legacy_function - def set_par_fmlos(): - 'set parameter fmlos' - function = LegacyFunctionSpecification() - function.addParameter( - 'fmlos', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_dgrp(index_of_the_particle='i', dgrp='float64'): + returns () - @legacy_function - def get_par_fitm(): - 'get parameter fitm' - function = LegacyFunctionSpecification() - function.addParameter( - 'fitm', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_dgrl(index_of_the_particle='i'): + returns (dgrl='float64') - @legacy_function - def set_par_fitm(): - 'set parameter fitm' - function = LegacyFunctionSpecification() - function.addParameter( - 'fitm', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_dgrl(index_of_the_particle='i', dgrl='float64'): + returns () - @legacy_function - def get_par_fitmi(): - 'get parameter fitmi' - function = LegacyFunctionSpecification() - function.addParameter( - 'fitmi', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_dgry(index_of_the_particle='i'): + returns (dgry='float64') - @legacy_function - def set_par_fitmi(): - 'set parameter fitmi' - function = LegacyFunctionSpecification() - function.addParameter( - 'fitmi', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_dgry(index_of_the_particle='i', dgry='float64'): + returns () - @legacy_function - def get_par_fitmi_default(): - 'get parameter fitmi_default' - function = LegacyFunctionSpecification() - function.addParameter( - 'fitmi_default', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_dgrc(index_of_the_particle='i'): + returns (dgrc='float64') - @legacy_function - def set_par_fitmi_default(): - 'set parameter fitmi_default' - function = LegacyFunctionSpecification() - function.addParameter( - 'fitmi_default', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_dgrc(index_of_the_particle='i', dgrc='float64'): + returns () - @legacy_function - def get_par_deltal(): - 'get parameter deltal' - function = LegacyFunctionSpecification() - function.addParameter( - 'deltal', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_dgro(index_of_the_particle='i'): + returns (dgro='float64') - @legacy_function - def set_par_deltal(): - 'set parameter deltal' - function = LegacyFunctionSpecification() - function.addParameter( - 'deltal', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_dgro(index_of_the_particle='i', dgro='float64'): + returns () - @legacy_function - def get_par_deltat(): - 'get parameter deltat' - function = LegacyFunctionSpecification() - function.addParameter( - 'deltat', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_dgr20(index_of_the_particle='i'): + returns (dgr20='float64') - @legacy_function - def set_par_deltat(): - 'set parameter deltat' - function = LegacyFunctionSpecification() - function.addParameter( - 'deltat', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_dgr20(index_of_the_particle='i', dgr20='float64'): + returns () - @legacy_function - def get_par_elph(): - 'get parameter elph' - function = LegacyFunctionSpecification() - function.addParameter( - 'elph', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_nbchx(index_of_the_particle='i'): + returns (nbchx='int32') - @legacy_function - def set_par_elph(): - 'set parameter elph' - function = LegacyFunctionSpecification() - function.addParameter( - 'elph', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_nbchx(index_of_the_particle='i', nbchx='int32'): + returns () - @legacy_function - def get_par_dovhp(): - 'get parameter dovhp' - function = LegacyFunctionSpecification() - function.addParameter( - 'dovhp', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_nrband(index_of_the_particle='i'): + returns (nrband='int32') - @legacy_function - def set_par_dovhp(): - 'set parameter dovhp' - function = LegacyFunctionSpecification() - function.addParameter( - 'dovhp', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_nrband(index_of_the_particle='i', nrband='int32'): + returns () - @legacy_function - def get_par_dunder(): - 'get parameter dunder' - function = LegacyFunctionSpecification() - function.addParameter( - 'dunder', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_xcn(index_of_the_particle='i'): + returns (xcn='float64') - @legacy_function - def set_par_dunder(): - 'set parameter dunder' - function = LegacyFunctionSpecification() - function.addParameter( - 'dunder', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_xcn(index_of_the_particle='i', xcn='float64'): + returns () - @legacy_function - def get_par_gkorm(): - 'get parameter gkorm' - function = LegacyFunctionSpecification() - function.addParameter( - 'gkorm', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def get_islow(index_of_the_particle='i'): + returns (islow='int32') - @legacy_function - def set_par_gkorm(): - 'set parameter gkorm' - function = LegacyFunctionSpecification() - function.addParameter( - 'gkorm', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def set_islow(index_of_the_particle='i', islow='int32'): + returns () + + @remote_function(can_handle_array=True) + def get_icncst(index_of_the_particle='i'): + returns (icncst='int32') - @legacy_function - def get_par_alph(): - 'get parameter alph' - function = LegacyFunctionSpecification() - function.addParameter( - 'alph', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_icncst(index_of_the_particle='i', icncst='int32'): + returns () - @legacy_function - def set_par_alph(): - 'set parameter alph' - function = LegacyFunctionSpecification() - function.addParameter( - 'alph', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_tauH_fit(index_of_the_particle='i'): + returns (tauH_fit='int32') - @legacy_function - def get_par_agdr(): - 'get parameter agdr' - function = LegacyFunctionSpecification() - function.addParameter( - 'agdr', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_tauH_fit(index_of_the_particle='i', tauH_fit='int32'): + returns () - @legacy_function - def set_par_agdr(): - 'set parameter agdr' - function = LegacyFunctionSpecification() - function.addParameter( - 'agdr', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_display_plot(index_of_the_particle='i'): + returns (display_plot='bool') - @legacy_function - def get_par_faktor(): - 'get parameter faktor' - function = LegacyFunctionSpecification() - function.addParameter( - 'faktor', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_display_plot(index_of_the_particle='i', display_plot='bool'): + returns () - @legacy_function - def set_par_faktor(): - 'set parameter faktor' - function = LegacyFunctionSpecification() - function.addParameter( - 'faktor', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_iauto(index_of_the_particle='i'): + returns (iauto='int32') - @legacy_function - def get_par_dgrp(): - 'get parameter dgrp' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgrp', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_iauto(index_of_the_particle='i', iauto='int32'): + returns () - @legacy_function - def set_par_dgrp(): - 'set parameter dgrp' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgrp', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_iprn(index_of_the_particle='i'): + returns (iprn='int32') - @legacy_function - def get_par_dgrl(): - 'get parameter dgrl' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgrl', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_iprn(index_of_the_particle='i', iprn='int32'): + returns () - @legacy_function - def set_par_dgrl(): - 'set parameter dgrl' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgrl', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_iout(index_of_the_particle='i'): + returns (iout='int32') - @legacy_function - def get_par_dgry(): - 'get parameter dgry' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgry', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_iout(index_of_the_particle='i', iout='int32'): + returns () - @legacy_function - def set_par_dgry(): - 'set parameter dgry' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgry', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_itmin(index_of_the_particle='i'): + returns (itmin='int32') - @legacy_function - def get_par_dgrc(): - 'get parameter dgrc' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgrc', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_itmin(index_of_the_particle='i', itmin='int32'): + returns () - @legacy_function - def set_par_dgrc(): - 'set parameter dgrc' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgrc', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_xyfiles(index_of_the_particle='i'): + returns (xyfiles='bool') - @legacy_function - def get_par_dgro(): - 'get parameter dgro' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgro', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_xyfiles(index_of_the_particle='i', xyfiles='bool'): + returns () - @legacy_function - def set_par_dgro(): - 'set parameter dgro' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgro', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_idebug(index_of_the_particle='i'): + returns (idebug='int32') - @legacy_function - def get_par_dgr20(): - 'get parameter dgr20' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgr20', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_idebug(index_of_the_particle='i', idebug='int32'): + returns () - @legacy_function - def set_par_dgr20(): - 'set parameter dgr20' - function = LegacyFunctionSpecification() - function.addParameter( - 'dgr20', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_itests(index_of_the_particle='i'): + returns (itests='int32') - @legacy_function - def get_par_xcn(): - 'get parameter xcn' - function = LegacyFunctionSpecification() - function.addParameter( - 'xcn', dtype='float64', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_itests(index_of_the_particle='i', itests='int32'): + returns () - @legacy_function - def set_par_xcn(): - 'set parameter xcn' - function = LegacyFunctionSpecification() - function.addParameter( - 'xcn', dtype='float64', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_verbose(index_of_the_particle='i'): + returns (verbose='bool') - @legacy_function - def get_par_starname(): - 'get parameter starname' - function = LegacyFunctionSpecification() - function.addParameter( - 'starname', dtype='string', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function + @remote_function(can_handle_array=True) + def set_verbose(index_of_the_particle='i', verbose='bool'): + returns () - @legacy_function - def set_par_starname(): - 'set parameter starname' - function = LegacyFunctionSpecification() - function.addParameter( - 'starname', dtype='string', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function + @remote_function(can_handle_array=True) + def get_stop_deg(index_of_the_particle='i'): + returns (stop_deg='bool') + + @remote_function(can_handle_array=True) + def set_stop_deg(index_of_the_particle='i', stop_deg='bool'): + returns () + + @remote_function(can_handle_array=True) + def get_n_snap(index_of_the_particle='i'): + returns (n_snap='int32') + + @remote_function(can_handle_array=True) + def set_n_snap(index_of_the_particle='i', n_snap='int32'): + returns () # @legacy_function # def get_par_stopping_condition(): @@ -3383,114 +1116,11 @@ def set_number_of_zones(): """ return function - @legacy_function - def commit_parameters(): - function = LegacyFunctionSpecification() - function.result_type = 'int32' - return function - - @legacy_function - def get_starname(): - """ - Get the star name (identical to AMUSE particle key?) - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', - direction=function.OUT, - description="The star's key" - ) - function.addParameter( - 'starname', dtype='string', direction=function.IN, - description="star name", - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - """ - return function - - @legacy_function - def set_starname(): - """ - Set the star name (identical to AMUSE particle key?) - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', - direction=function.IN, - description="The star's key" - ) - function.addParameter( - 'starname', dtype='string', direction=function.OUT, - description="star name", - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - """ - return function - - @legacy_function - def get_phase(): - 'get phase' - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', - direction=function.IN, - description="The star's key" - ) - function.addParameter( - 'phase', dtype='int32', - direction=function.OUT, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - Got the value. - -1 - ERROR - Unable to get. - ''' - return function - - @legacy_function - def set_phase(): - 'set phase' - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', - direction=function.IN, - description="The star's key" - ) - function.addParameter( - 'phase', dtype='int32', - direction=function.IN, - ) - function.result_type = 'int32' - function.result_doc = ''' - 0 - OK - The value has been set. - -1 - ERROR - Unable to set. - -2 - ERROR - Cannot set at this point, already running. - ''' - return function - + @legacy_function + def commit_parameters(): + function = LegacyFunctionSpecification() + function.result_type = 'int32' + return function @legacy_function def new_particle(): @@ -3528,6 +1158,73 @@ def new_particle(): """ return function + @legacy_function + def new_stellar_model(): + """ + New star from an existing model + """ + function = LegacyFunctionSpecification() + function.can_handle_array = False + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.OUT, + description=( + "The new index for the star. This index can be used to refer " + "to this star in other functions" + ) + ) + for parameter in GENEC_STAR_PARAMETERS: + function.addParameter( + parameter, + dtype=GENEC_STAR_PARAMETERS[parameter][0], + unit=GENEC_STAR_PARAMETERS[parameter][1], + description=GENEC_STAR_PARAMETERS[parameter][2], + direction=function.IN, + ) + for parameter in GENEC_STAR_STRUCTURE: + function.addParameter( + parameter, + dtype=GENEC_STAR_STRUCTURE[parameter][0], + unit=GENEC_STAR_STRUCTURE[parameter][1], + description=GENEC_STAR_STRUCTURE[parameter][2], + direction=function.IN, + ) + + function.result_type = 'int32' + return function + + @legacy_function + def get_stellar_model(): + """ + Get an existing model + """ + function = LegacyFunctionSpecification() + function.must_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description=( + "The new index for the star. This index can be used to refer " + "to this star in other functions" + ) + ) + for parameter in GENEC_STAR_PARAMETERS: + function.addParameter( + parameter, + dtype=GENEC_STAR_PARAMETERS[parameter][0], + unit=GENEC_STAR_PARAMETERS[parameter][1], + description=GENEC_STAR_PARAMETERS[parameter][2], + direction=function.OUT, + ) + for parameter in GENEC_STAR_STRUCTURE: + function.addParameter( + parameter, + dtype=GENEC_STAR_STRUCTURE[parameter][0], + unit=GENEC_STAR_STRUCTURE[parameter][1], + description=GENEC_STAR_STRUCTURE[parameter][2], + direction=function.OUT, + ) + function.result_type = 'int32' + return function + @legacy_function def get_firstlast_zone(): function = LegacyFunctionSpecification() @@ -5247,226 +2944,9 @@ def set_mass_fraction_of_mg24_at_zone(): @legacy_function - def set_mass_fraction_of_mg25_at_zone(): - """ - Set the fractional abundance of mg25 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function - - - @legacy_function - def set_mass_fraction_of_mg26_at_zone(): - """ - Set the fractional abundance of mg26 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function - - - @legacy_function - def set_mass_fraction_of_c14_at_zone(): - """ - Set the fractional abundance of c14 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function - - - @legacy_function - def set_mass_fraction_of_f18_at_zone(): - """ - Set the fractional abundance of f18 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function - - - @legacy_function - def set_mass_fraction_of_f19_at_zone(): - """ - Set the fractional abundance of f19 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function - - - @legacy_function - def set_mass_fraction_of_ne21_at_zone(): - """ - Set the fractional abundance of ne21 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function - - - @legacy_function - def set_mass_fraction_of_na23_at_zone(): - """ - Set the fractional abundance of na23 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function - - - @legacy_function - def set_mass_fraction_of_al26_at_zone(): + def set_mass_fraction_of_mg25_at_zone(): """ - Set the fractional abundance of al26 at the specified + Set the fractional abundance of mg25 at the specified zone/mesh-cell of the star. """ function = LegacyFunctionSpecification() @@ -5495,9 +2975,9 @@ def set_mass_fraction_of_al26_at_zone(): @legacy_function - def set_mass_fraction_of_al27_at_zone(): + def set_mass_fraction_of_mg26_at_zone(): """ - Set the fractional abundance of al27 at the specified + Set the fractional abundance of mg26 at the specified zone/mesh-cell of the star. """ function = LegacyFunctionSpecification() @@ -5526,9 +3006,9 @@ def set_mass_fraction_of_al27_at_zone(): @legacy_function - def set_mass_fraction_of_si28_at_zone(): + def set_mass_fraction_of_c14_at_zone(): """ - Set the fractional abundance of si28 at the specified + Set the fractional abundance of c14 at the specified zone/mesh-cell of the star. """ function = LegacyFunctionSpecification() @@ -5557,9 +3037,9 @@ def set_mass_fraction_of_si28_at_zone(): @legacy_function - def set_mass_fraction_of_neut_at_zone(): + def set_mass_fraction_of_f18_at_zone(): """ - Set the fractional abundance of neut at the specified + Set the fractional abundance of f18 at the specified zone/mesh-cell of the star. """ function = LegacyFunctionSpecification() @@ -5588,9 +3068,9 @@ def set_mass_fraction_of_neut_at_zone(): @legacy_function - def set_mass_fraction_of_prot_at_zone(): + def set_mass_fraction_of_f19_at_zone(): """ - Set the fractional abundance of prot at the specified + Set the fractional abundance of f19 at the specified zone/mesh-cell of the star. """ function = LegacyFunctionSpecification() @@ -5619,9 +3099,9 @@ def set_mass_fraction_of_prot_at_zone(): @legacy_function - def set_mass_fraction_of_bid_at_zone(): + def set_mass_fraction_of_ne21_at_zone(): """ - Set the fractional abundance of bid at the specified + Set the fractional abundance of ne21 at the specified zone/mesh-cell of the star. """ function = LegacyFunctionSpecification() @@ -5650,9 +3130,9 @@ def set_mass_fraction_of_bid_at_zone(): @legacy_function - def set_mass_fraction_of_bid1_at_zone(): + def set_mass_fraction_of_na23_at_zone(): """ - Set the fractional abundance of bid1 at the specified + Set the fractional abundance of na23 at the specified zone/mesh-cell of the star. """ function = LegacyFunctionSpecification() @@ -5676,642 +3156,243 @@ def set_mass_fraction_of_bid1_at_zone(): The value was set. -1 - ERROR A star with the given index was not found. - """ - return function - - - -class Genec(StellarEvolution, InternalStellarStructure): - - def __init__(self, **options): - InCodeComponentImplementation.__init__( - self, GenecInterface(**options), **options) - # self.stopping_conditions = StoppingConditions(self) - self.model_time = 0.0 | units.yr - - def define_parameters(self, handler): - handler.add_method_parameter( - None, - "set_genec_path", - "path_to_data", - "Path to the data directory", - default_value=self.data_directory - ) - - handler.add_method_parameter( - "get_par_ipoly", - "set_par_ipoly", - "ipoly", - "GENEC parameter ipoly", - ) - - handler.add_method_parameter( - "get_par_nwseq", - "set_par_nwseq", - "nwseq", - "GENEC parameter nwseq", - ) - - handler.add_method_parameter( - "get_par_modanf", - "set_par_modanf", - "modanf", - "GENEC parameter modanf", - ) - - handler.add_method_parameter( - "get_par_nzmod", - "set_par_nzmod", - "nzmod", - "GENEC parameter nzmod", - ) - - handler.add_method_parameter( - "get_par_irot", - "set_par_irot", - "irot", - "GENEC parameter irot", - ) - - handler.add_method_parameter( - "get_par_isol", - "set_par_isol", - "isol", - "GENEC parameter isol", - ) - - handler.add_method_parameter( - "get_par_imagn", - "set_par_imagn", - "imagn", - "GENEC parameter imagn", - ) - - handler.add_method_parameter( - "get_par_ialflu", - "set_par_ialflu", - "ialflu", - "GENEC parameter ialflu", - ) - - handler.add_method_parameter( - "get_par_ianiso", - "set_par_ianiso", - "ianiso", - "GENEC parameter ianiso", - ) - - handler.add_method_parameter( - "get_par_ipop3", - "set_par_ipop3", - "ipop3", - "GENEC parameter ipop3", - ) - - handler.add_method_parameter( - "get_par_ibasnet", - "set_par_ibasnet", - "ibasnet", - "GENEC parameter ibasnet", - ) - - handler.add_method_parameter( - "get_par_iopac", - "set_par_iopac", - "iopac", - "GENEC parameter iopac", - ) - - handler.add_method_parameter( - "get_par_ikappa", - "set_par_ikappa", - "ikappa", - "GENEC parameter ikappa", - ) - - handler.add_method_parameter( - "get_par_idiff", - "set_par_idiff", - "idiff", - "GENEC parameter idiff", - ) - - handler.add_method_parameter( - "get_par_iadvec", - "set_par_iadvec", - "iadvec", - "GENEC parameter iadvec", - ) - - handler.add_method_parameter( - "get_par_istati", - "set_par_istati", - "istati", - "GENEC parameter istati", - ) - - handler.add_method_parameter( - "get_par_icoeff", - "set_par_icoeff", - "icoeff", - "GENEC parameter icoeff", - ) - - handler.add_method_parameter( - "get_par_igamma", - "set_par_igamma", - "igamma", - "GENEC parameter igamma", - ) - - handler.add_method_parameter( - "get_par_idialo", - "set_par_idialo", - "idialo", - "GENEC parameter idialo", - ) - - handler.add_method_parameter( - "get_par_idialu", - "set_par_idialu", - "idialu", - "GENEC parameter idialu", - ) - - handler.add_method_parameter( - "get_par_imloss", - "set_par_imloss", - "imloss", - "GENEC parameter imloss", - ) - - handler.add_method_parameter( - "get_par_ifitm", - "set_par_ifitm", - "ifitm", - "GENEC parameter ifitm", - ) - - handler.add_method_parameter( - "get_par_nndr", - "set_par_nndr", - "nndr", - "GENEC parameter nndr", - ) - - handler.add_method_parameter( - "get_par_iledou", - "set_par_iledou", - "iledou", - "GENEC parameter iledou", - ) - - handler.add_method_parameter( - "get_par_idifcon", - "set_par_idifcon", - "idifcon", - "GENEC parameter idifcon", - ) - - handler.add_method_parameter( - "get_par_my", - "set_par_my", - "my", - "GENEC parameter my", - ) - - handler.add_method_parameter( - "get_par_iover", - "set_par_iover", - "iover", - "GENEC parameter iover", - ) - - handler.add_method_parameter( - "get_par_iunder", - "set_par_iunder", - "iunder", - "GENEC parameter iunder", - ) - - handler.add_method_parameter( - "get_par_nbchx", - "set_par_nbchx", - "nbchx", - "GENEC parameter nbchx", - ) - - handler.add_method_parameter( - "get_par_nrband", - "set_par_nrband", - "nrband", - "GENEC parameter nrband", - ) - - handler.add_method_parameter( - "get_par_islow", - "set_par_islow", - "islow", - "GENEC parameter islow", - ) - - handler.add_method_parameter( - "get_par_icncst", - "set_par_icncst", - "icncst", - "GENEC parameter icncst", - ) - - handler.add_method_parameter( - "get_par_tauH_fit", - "set_par_tauH_fit", - "tauH_fit", - "GENEC parameter tauH_fit", - ) - - handler.add_method_parameter( - "get_par_iauto", - "set_par_iauto", - "iauto", - "GENEC parameter iauto", - ) - - handler.add_method_parameter( - "get_par_iprn", - "set_par_iprn", - "iprn", - "GENEC parameter iprn", - ) - - handler.add_method_parameter( - "get_par_iout", - "set_par_iout", - "iout", - "GENEC parameter iout", - ) - - handler.add_method_parameter( - "get_par_itmin", - "set_par_itmin", - "itmin", - "GENEC parameter itmin", - ) - - handler.add_method_parameter( - "get_par_idebug", - "set_par_idebug", - "idebug", - "GENEC parameter idebug", - ) - - handler.add_method_parameter( - "get_par_itests", - "set_par_itests", - "itests", - "GENEC parameter itests", - ) - - handler.add_method_parameter( - "get_par_var_rates", - "set_par_var_rates", - "var_rates", - "GENEC parameter var_rates", - ) - - handler.add_method_parameter( - "get_par_bintide", - "set_par_bintide", - "bintide", - "GENEC parameter bintide", - ) - - handler.add_method_parameter( - "get_par_const_per", - "set_par_const_per", - "const_per", - "GENEC parameter const_per", - ) - - handler.add_method_parameter( - "get_par_Add_Flux", - "set_par_Add_Flux", - "Add_Flux", - "GENEC parameter Add_Flux", - ) - - handler.add_method_parameter( - "get_par_diff_only", - "set_par_diff_only", - "diff_only", - "GENEC parameter diff_only", - ) - - handler.add_method_parameter( - "get_par_RSG_Mdot", - "set_par_RSG_Mdot", - "RSG_Mdot", - "GENEC parameter RSG_Mdot", - ) - - handler.add_method_parameter( - "get_par_display_plot", - "set_par_display_plot", - "display_plot", - "GENEC parameter display_plot", - ) - - handler.add_method_parameter( - "get_par_xyfiles", - "set_par_xyfiles", - "xyfiles", - "GENEC parameter xyfiles", - ) - - handler.add_method_parameter( - "get_par_verbose", - "set_par_verbose", - "verbose", - "GENEC parameter verbose", - ) - - handler.add_method_parameter( - "get_par_stop_deg", - "set_par_stop_deg", - "stop_deg", - "GENEC parameter stop_deg", - ) - - handler.add_method_parameter( - "get_par_index_poly", - "set_par_index_poly", - "index_poly", - "GENEC parameter index_poly", - ) - - handler.add_method_parameter( - "get_par_binm2", - "set_par_binm2", - "binm2", - "GENEC parameter binm2", - ) - - handler.add_method_parameter( - "get_par_periodini", - "set_par_periodini", - "periodini", - "GENEC parameter periodini", - ) - - handler.add_method_parameter( - "get_par_zinit", - "set_par_zinit", - "zinit", - "GENEC parameter zinit", - ) - - handler.add_method_parameter( - "get_par_zsol", - "set_par_zsol", - "zsol", - "GENEC parameter zsol", - ) - - handler.add_method_parameter( - "get_par_z", - "set_par_z", - "z", - "GENEC parameter z", - ) - - handler.add_method_parameter( - "get_par_fenerg", - "set_par_fenerg", - "fenerg", - "GENEC parameter fenerg", - ) - - handler.add_method_parameter( - "get_par_richac", - "set_par_richac", - "richac", - "GENEC parameter richac", - ) - - handler.add_method_parameter( - "get_par_frein", - "set_par_frein", - "frein", - "GENEC parameter frein", - ) - - handler.add_method_parameter( - "get_par_K_Kawaler", - "set_par_K_Kawaler", - "K_Kawaler", - "GENEC parameter K_Kawaler", - ) - - handler.add_method_parameter( - "get_par_Omega_saturation", - "set_par_Omega_saturation", - "Omega_saturation", - "GENEC parameter Omega_saturation", - ) - - handler.add_method_parameter( - "get_par_rapcrilim", - "set_par_rapcrilim", - "rapcrilim", - "GENEC parameter rapcrilim", - ) - - handler.add_method_parameter( - "get_par_vwant", - "set_par_vwant", - "vwant", - "GENEC parameter vwant", - ) - - handler.add_method_parameter( - "get_par_xfom", - "set_par_xfom", - "xfom", - "GENEC parameter xfom", - ) - - handler.add_method_parameter( - "get_par_omega", - "set_par_omega", - "omega", - "GENEC parameter omega", - ) - - handler.add_method_parameter( - "get_par_xdial", - "set_par_xdial", - "xdial", - "GENEC parameter xdial", - ) - - handler.add_method_parameter( - "get_par_B_initial", - "set_par_B_initial", - "B_initial", - "GENEC parameter B_initial", - ) - - handler.add_method_parameter( - "get_par_add_diff", - "set_par_add_diff", - "add_diff", - "GENEC parameter add_diff", - ) - - handler.add_method_parameter( - "get_par_fmlos", - "set_par_fmlos", - "fmlos", - "GENEC parameter fmlos", - ) - - handler.add_method_parameter( - "get_par_fitm", - "set_par_fitm", - "fitm", - "GENEC parameter fitm", - ) + """ + return function - handler.add_method_parameter( - "get_par_fitmi", - "set_par_fitmi", - "fitmi", - "GENEC parameter fitmi", - ) - handler.add_method_parameter( - "get_par_fitmi_default", - "set_par_fitmi_default", - "fitmi_default", - "GENEC parameter fitmi_default", + @legacy_function + def set_mass_fraction_of_al26_at_zone(): + """ + Set the fractional abundance of al26 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_deltal", - "set_par_deltal", - "deltal", - "GENEC parameter deltal", - ) - handler.add_method_parameter( - "get_par_deltat", - "set_par_deltat", - "deltat", - "GENEC parameter deltat", + @legacy_function + def set_mass_fraction_of_al27_at_zone(): + """ + Set the fractional abundance of al27 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_elph", - "set_par_elph", - "elph", - "GENEC parameter elph", - ) - handler.add_method_parameter( - "get_par_dovhp", - "set_par_dovhp", - "dovhp", - "GENEC parameter dovhp", + @legacy_function + def set_mass_fraction_of_si28_at_zone(): + """ + Set the fractional abundance of si28 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_dunder", - "set_par_dunder", - "dunder", - "GENEC parameter dunder", - ) - handler.add_method_parameter( - "get_par_gkorm", - "set_par_gkorm", - "gkorm", - "GENEC parameter gkorm", + @legacy_function + def set_mass_fraction_of_neut_at_zone(): + """ + Set the fractional abundance of neut at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_alph", - "set_par_alph", - "alph", - "GENEC parameter alph", - ) - handler.add_method_parameter( - "get_par_agdr", - "set_par_agdr", - "agdr", - "GENEC parameter agdr", + @legacy_function + def set_mass_fraction_of_prot_at_zone(): + """ + Set the fractional abundance of prot at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_faktor", - "set_par_faktor", - "faktor", - "GENEC parameter faktor", - ) - handler.add_method_parameter( - "get_par_dgrp", - "set_par_dgrp", - "dgrp", - "GENEC parameter dgrp", + @legacy_function + def set_mass_fraction_of_bid_at_zone(): + """ + Set the fractional abundance of bid at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_dgrl", - "set_par_dgrl", - "dgrl", - "GENEC parameter dgrl", - ) - handler.add_method_parameter( - "get_par_dgry", - "set_par_dgry", - "dgry", - "GENEC parameter dgry", + @legacy_function + def set_mass_fraction_of_bid1_at_zone(): + """ + Set the fractional abundance of bid1 at the specified + zone/mesh-cell of the star. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_star', dtype='int32', direction=function.IN, + description="The index of the star to set the value of") + function.addParameter( + 'zone', dtype='int32', direction=function.IN, + description="The zone/mesh-cell of the star to set the value of") + function.addParameter( + 'Xj_i', dtype='float64', direction=function.IN, + description=( + "The fractional chemical abundance variable at the specified " + "zone/mesh-cell of the star." + ) ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + The value was set. + -1 - ERROR + A star with the given index was not found. + """ + return function - handler.add_method_parameter( - "get_par_dgrc", - "set_par_dgrc", - "dgrc", - "GENEC parameter dgrc", - ) - handler.add_method_parameter( - "get_par_dgro", - "set_par_dgro", - "dgro", - "GENEC parameter dgro", - ) - handler.add_method_parameter( - "get_par_dgr20", - "set_par_dgr20", - "dgr20", - "GENEC parameter dgr20", - ) +class Genec(StellarEvolution, InternalStellarStructure): - handler.add_method_parameter( - "get_par_xcn", - "set_par_xcn", - "xcn", - "GENEC parameter xcn", - ) + def __init__(self, **options): + InCodeComponentImplementation.__init__( + self, GenecInterface(**options), **options) + # self.stopping_conditions = StoppingConditions(self) + self.model_time = 0.0 | units.yr + def define_parameters(self, handler): handler.add_method_parameter( - "get_par_starname", - "set_par_starname", - "starname", - "GENEC parameter starname", + None, + "set_genec_path", + "path_to_data", + "Path to the data directory", + default_value=self.data_directory ) # handler.add_method_parameter( @@ -6321,13 +3402,6 @@ def define_parameters(self, handler): # "GENEC parameter stopping_condition", # ) - handler.add_method_parameter( - "get_par_n_snap", - "set_par_n_snap", - "n_snap", - "GENEC snapshot writing", - ) - # handler.add_method_parameter( # "get_min_timestep_stop_condition", # "set_min_timestep_stop_condition", @@ -6346,6 +3420,12 @@ def define_particle_sets(self, handler): ) handler.set_new(set_name, 'new_particle') + for particle_property in GENEC_STAR_PARAMETERS: + handler.add_getter( + set_name, + f'get_{particle_property}', + names=(particle_property,) + ) handler.add_getter(set_name, 'get_phase', names=('phase',)) handler.add_getter(set_name, 'get_radius') handler.add_getter(set_name, 'get_mass') @@ -6531,13 +3611,15 @@ def define_state(self, handler): handler.add_method # -> Edit (commit_parameters) - handler.add_method('EDIT', 'set_starname') + #handler.add_method('EDIT', 'set_starname') # handler.add_method('EDIT', 'new_particle') # -> Run (commit_particles) handler.add_transition('EDIT', 'RUN', 'commit_particles') for state in ["UPDATE"]: + for particle_property in GENEC_STAR_PARAMETERS: + handler.add_method(state, f'get_{particle_property}') handler.add_method(state, 'get_chemical_abundance_profiles') handler.add_method(state, 'get_mass_fraction_of_species_at_zone') handler.add_method(state, 'get_mu_at_zone') @@ -6571,6 +3653,9 @@ def define_state(self, handler): # -> Update handler.add_transition('RUN', 'UPDATE', 'finalize_stellar_model') + + handler.add_method('UPDATE', 'set_n_snap') + #handler.add_method('UPDATE', 'set_ipoly') handler.add_method('UPDATE', 'set_chemical_abundance_profiles') handler.add_method('UPDATE', 'set_mass_fraction_of_species_at_zone') handler.add_method('UPDATE', 'set_number_of_zones') @@ -6590,7 +3675,7 @@ def define_state(self, handler): ) # -> Run (recommit_particles) - handler.add_method('UPDATE', 'set_starname') + #handler.add_method('UPDATE', 'set_starname') # handler.add_method('UPDATE', 'new_particle') def define_methods(self, handler): @@ -6601,6 +3686,31 @@ def define_methods(self, handler): (units.MSun, handler.NO_UNIT, handler.NO_UNIT), (handler.INDEX, handler.ERROR_CODE) ) + + # NEW_STELLAR_MODEL_IN = [] + # NEW_STELLAR_MODEL_IN += [p[1][1] for p in GENEC_STAR_PARAMETERS.items()] + # NEW_STELLAR_MODEL_IN += [p[1][1] for p in GENEC_STAR_STRUCTURE.items()] + + # handler.add_method( + # "new_stellar_model", + # ( + # NEW_STELLAR_MODEL_IN, + # ), + # ( + # handler.INDEX, handler.ERROR_CODE + # ) + # ) + + # GET_STELLAR_MODEL_OUT = [] + # GET_STELLAR_MODEL_OUT += [p[1][1] for p in GENEC_STAR_PARAMETERS.items()] + # GET_STELLAR_MODEL_OUT += [p[1][1] for p in GENEC_STAR_STRUCTURE.items()] + # GET_STELLAR_MODEL_OUT.append(handler.ERROR_CODE) + + # handler.add_method( + # "get_stellar_model", + # (handler.INDEX,), + # tuple(GET_STELLAR_MODEL_OUT) + # ) handler.add_method( "read_genec_model", (handler.NO_UNIT), @@ -6817,3 +3927,99 @@ def get_cumulative_mass_profile( frac_profile = self.get_mass_profile( indices_of_the_stars, number_of_zones=number_of_zones) return frac_profile.cumsum() + + def new_particle_from_model( + self, internal_structure, current_age=0 | units.julianyr, key=None + ): + self.new_stellar_model( + internal_structure[0], internal_structure[1], + internal_structure[2], internal_structure[3], + internal_structure[4], internal_structure[5], + internal_structure[6], internal_structure[7], + internal_structure[8], internal_structure[9], + internal_structure[10], internal_structure[11], + internal_structure[12], internal_structure[13], + internal_structure[14], internal_structure[15], + internal_structure[16], internal_structure[17], + internal_structure[18], internal_structure[19], + internal_structure[20], internal_structure[21], + internal_structure[22], internal_structure[23], + internal_structure[24], internal_structure[25], + internal_structure[26], internal_structure[27], + internal_structure[28], internal_structure[29], + internal_structure[30], internal_structure[31], + internal_structure[32], internal_structure[33], + internal_structure[34], internal_structure[35], + internal_structure[36], internal_structure[37], + internal_structure[38], internal_structure[39], + internal_structure[40], internal_structure[41], + internal_structure[42], internal_structure[43], + internal_structure[44], internal_structure[45], + internal_structure[46], internal_structure[47], + internal_structure[48], internal_structure[49], + internal_structure[50], internal_structure[51], + internal_structure[52], internal_structure[53], + internal_structure[54], internal_structure[55], + internal_structure[56], internal_structure[57], + internal_structure[58], internal_structure[59], + internal_structure[60], internal_structure[61], + internal_structure[62], internal_structure[63], + internal_structure[64], internal_structure[65], + internal_structure[66], internal_structure[67], + internal_structure[68], internal_structure[69], + internal_structure[70], internal_structure[71], + internal_structure[72], internal_structure[73], + internal_structure[74], internal_structure[75], + internal_structure[76], internal_structure[77], + internal_structure[78], internal_structure[79], + internal_structure[80], internal_structure[81], + internal_structure[82], internal_structure[83], + internal_structure[84], internal_structure[85], + internal_structure[86], internal_structure[87], + internal_structure[88], internal_structure[89], + internal_structure[90], internal_structure[91], + internal_structure[92], internal_structure[93], + internal_structure[94], internal_structure[95], + internal_structure[96], internal_structure[97], + internal_structure[98], internal_structure[99], + internal_structure[100], internal_structure[101], + internal_structure[102], internal_structure[103], + internal_structure[104], internal_structure[105], + internal_structure[106], internal_structure[107], + internal_structure[108], internal_structure[109], + internal_structure[110], internal_structure[111], + internal_structure[112], internal_structure[113], + internal_structure[114], internal_structure[115], + internal_structure[116], internal_structure[117], + internal_structure[118], internal_structure[119], + internal_structure[120], internal_structure[121], + internal_structure[122], internal_structure[123], + internal_structure[124], internal_structure[125], + internal_structure[126], internal_structure[127], + internal_structure[128], internal_structure[129], + internal_structure[130], internal_structure[131], + internal_structure[132], internal_structure[133], + internal_structure[134], internal_structure[135], + internal_structure[136], internal_structure[137], + internal_structure[138], internal_structure[139], + internal_structure[140], internal_structure[141], + internal_structure[142], internal_structure[143], + internal_structure[144], internal_structure[145], + internal_structure[146], internal_structure[147], + internal_structure[148], internal_structure[149], + internal_structure[150], internal_structure[151], + internal_structure[152], internal_structure[153], + internal_structure[154], internal_structure[155], + internal_structure[156], internal_structure[157], + internal_structure[158], internal_structure[159], + internal_structure[160], internal_structure[161], + internal_structure[162], internal_structure[163], + internal_structure[164], internal_structure[165], + internal_structure[166], internal_structure[167], + internal_structure[168], internal_structure[169], + internal_structure[170], internal_structure[171], + internal_structure[172], internal_structure[173], + internal_structure[174], internal_structure[175], + internal_structure[176], + ) + return From 99574c53ef70695bb3173d6f2921163bc0914850 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 10 Jan 2023 17:12:31 +0100 Subject: [PATCH 51/72] More updates / cleanup. Also add helper script for the interface. --- src/amuse/community/genec/interface.f90 | 229 +++++- src/amuse/community/genec/interface.py | 727 +++++++++---------- src/amuse/community/genec/make_getsetters.py | 58 ++ 3 files changed, 638 insertions(+), 376 deletions(-) create mode 100644 src/amuse/community/genec/make_getsetters.py diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 6cd7d8225e..42e48e8241 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1643,9 +1643,236 @@ integer function set_n_snap(index_of_the_particle, n_snap) set_n_snap = 0 end function set_n_snap - ! **** End Parameters +! **** Begin Properties +integer function get_m(index_of_the_particle, m) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: m + m = GenecStar%m + get_m = 0 +end function get_m + +integer function set_m(index_of_the_particle, m) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: m + GenecStar%m = m + set_m = 0 +end function set_m + +integer function get_gms(index_of_the_particle, gms) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: gms + gms = GenecStar%gms + get_gms = 0 +end function get_gms + +integer function set_gms(index_of_the_particle, gms) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: gms + GenecStar%gms = gms + set_gms = 0 +end function set_gms + +integer function get_alter(index_of_the_particle, alter) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: alter + alter = GenecStar%alter + get_alter = 0 +end function get_alter + +integer function set_alter(index_of_the_particle, alter) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: alter + GenecStar%alter = alter + set_alter = 0 +end function set_alter + +integer function get_gls(index_of_the_particle, gls) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: gls + gls = GenecStar%gls + get_gls = 0 +end function get_gls + +integer function set_gls(index_of_the_particle, gls) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: gls + GenecStar%gls = gls + set_gls = 0 +end function set_gls + +integer function get_teff(index_of_the_particle, teff) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: teff + teff = GenecStar%teff + get_teff = 0 +end function get_teff + +integer function set_teff(index_of_the_particle, teff) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: teff + GenecStar%teff = teff + set_teff = 0 +end function set_teff + +integer function get_glsv(index_of_the_particle, glsv) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: glsv + glsv = GenecStar%glsv + get_glsv = 0 +end function get_glsv + +integer function set_glsv(index_of_the_particle, glsv) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: glsv + GenecStar%glsv = glsv + set_glsv = 0 +end function set_glsv + +integer function get_teffv(index_of_the_particle, teffv) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: teffv + teffv = GenecStar%teffv + get_teffv = 0 +end function get_teffv + +integer function set_teffv(index_of_the_particle, teffv) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: teffv + GenecStar%teffv = teffv + set_teffv = 0 +end function set_teffv + +integer function get_dzeitj(index_of_the_particle, dzeitj) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dzeitj + dzeitj = GenecStar%dzeitj + get_dzeitj = 0 +end function get_dzeitj + +integer function set_dzeitj(index_of_the_particle, dzeitj) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dzeitj + GenecStar%dzeitj = dzeitj + set_dzeitj = 0 +end function set_dzeitj + +integer function get_dzeit(index_of_the_particle, dzeit) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dzeit + dzeit = GenecStar%dzeit + get_dzeit = 0 +end function get_dzeit + +integer function set_dzeit(index_of_the_particle, dzeit) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dzeit + GenecStar%dzeit = dzeit + set_dzeit = 0 +end function set_dzeit + +integer function get_dzeitv(index_of_the_particle, dzeitv) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dzeitv + dzeitv = GenecStar%dzeitv + get_dzeitv = 0 +end function get_dzeitv + +integer function set_dzeitv(index_of_the_particle, dzeitv) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dzeitv + GenecStar%dzeitv = dzeitv + set_dzeitv = 0 +end function set_dzeitv + +integer function get_xmini(index_of_the_particle, xmini) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xmini + xmini = GenecStar%xmini + get_xmini = 0 +end function get_xmini + +integer function set_xmini(index_of_the_particle, xmini) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xmini + GenecStar%xmini = xmini + set_xmini = 0 +end function set_xmini + +integer function get_summas(index_of_the_particle, summas) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: summas + summas = GenecStar%summas + get_summas = 0 +end function get_summas + +integer function set_summas(index_of_the_particle, summas) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: summas + GenecStar%summas = summas + set_summas = 0 +end function set_summas + +integer function get_ab(index_of_the_particle, ab) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: ab + ab = GenecStar%ab + get_ab = 0 +end function get_ab + +integer function set_ab(index_of_the_particle, ab) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: ab + GenecStar%ab = ab + set_ab = 0 +end function set_ab + +integer function get_dm_lost(index_of_the_particle, dm_lost) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dm_lost + dm_lost = GenecStar%dm_lost + get_dm_lost = 0 +end function get_dm_lost + +integer function set_dm_lost(index_of_the_particle, dm_lost) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dm_lost + GenecStar%dm_lost = dm_lost + set_dm_lost = 0 +end function set_dm_lost + +! **** End Properties + + function finalize_stellar_model() implicit none integer:: finalize_stellar_model diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 7e2b656eca..7566152a7d 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -50,192 +50,196 @@ 'bid1': 27, } -GENEC_STAR_PROPERTIES = { - 'n_snap': ('int32', NO_UNIT, "number of steps between snapshots [0]"), - #'ipoly': ('int32', NO_UNIT, "polytropic index"), +# Parameters (but individual to each star) +GENEC_STAR_PARAMETERS = { + # 'GENEC name: [dtype, unit, description, AMUSE name (optional)] + 'initialised': ['bool', '', "True if the star is an intialised model"], + 'starname': ['string', '', "Name of the star"], + 'nwseq': ['int32', '', ""], + 'modanf': ['int32', '', ""], + 'nzmod': ['int32', '', ""], + 'end_at_phase': ['int32', '', "Stop if this phase is reached"], + 'end_at_model': ['int32', '', "Stop if this model number is reached"], + 'irot': ['int32', '', ""], + 'isol': ['int32', '', ""], + 'imagn': ['int32', '', ""], + 'ialflu': ['int32', '', ""], + 'ianiso': ['int32', '', ""], + 'ipop3': ['int32', '', ""], + 'ibasnet': ['int32', '', ""], + 'phase': ['int32', '', ""], + 'var_rates': ['bool', '', ""], + 'bintide': ['bool', '', ""], + 'binm2': ['float64', '', ""], + 'periodini': ['float64', '', ""], + 'const_per': ['bool', '', ""], + 'iprezams': ['int32', '', ""], + 'zinit': ['float64', '', ""], + 'zsol': ['float64', '', ""], + 'z': ['float64', '', ""], + 'iopac': ['int32', '', ""], + 'ikappa': ['int32', '', ""], + 'idiff': ['int32', '', ""], + 'iadvec': ['int32', '', ""], + 'istati': ['int32', '', ""], + 'icoeff': ['int32', '', ""], + 'fenerg': ['float64', '', ""], + 'richac': ['float64', '', ""], + 'igamma': ['int32', '', ""], + 'frein': ['float64', '', ""], + 'K_Kawaler': ['float64', '', ""], + 'Omega_saturation': ['float64', '', ""], + 'rapcrilim': ['float64', '', ""], + 'vwant': ['float64', '', ""], + 'xfom': ['float64', '', ""], + 'omega': ['float64', '', ""], + 'xdial': ['float64', '', ""], + 'idialo': ['int32', '', ""], + 'idialu': ['int32', '', ""], + 'Add_Flux': ['bool', '', ""], + 'diff_only': ['bool', '', ""], + 'B_initial': ['float64', '', ""], + 'add_diff': ['float64', '', ""], + 'n_mag': ['int32', '', ""], + 'alpha_F': ['float64', '', ""], + 'nsmooth': ['int32', '', ""], + 'qminsmooth': ['bool', '', ""], + 'imloss': ['int32', '', ""], + 'fmlos': ['float64', '', ""], + 'ifitm': ['int32', '', ""], + 'fitm': ['float64', '', ""], + 'fitmi': ['float64', '', ""], + 'deltal': ['float64', '', ""], + 'deltat': ['float64', '', ""], + 'nndr': ['int32', '', ""], + 'RSG_Mdot': ['int32', '', ""], + 'SupraEddMdot': ['bool', '', ""], + 'Be_mdotfrac': ['float64', '', ""], + 'start_mdot': ['float64', '', ""], + 'iledou': ['int32', '', ""], + 'idifcon': ['int32', '', ""], + 'iover': ['int32', '', ""], + 'elph': ['float64', '', ""], + 'my': ['int32', '', ""], + 'dovhp': ['float64', '', ""], + 'iunder': ['int32', '', ""], + 'dunder': ['float64', '', ""], + 'gkorm': ['float64', '', ""], + 'alph': ['float64', '', ""], + 'agdr': ['float64', '', ""], + 'faktor': ['float64', '', ""], + 'dgrp': ['float64', '', ""], + 'dgrl': ['float64', '', ""], + 'dgry': ['float64', '', ""], + 'dgrc': ['float64', '', ""], + 'dgro': ['float64', '', ""], + 'dgr20': ['float64', '', ""], + 'nbchx': ['int32', '', ""], + 'nrband': ['int32', '', ""], + 'xcn': ['float64', '', ""], + 'islow': ['int32', '', ""], + 'icncst': ['int32', '', ""], + 'tauH_fit': ['int32', '', ""], + 'display_plot': ['bool', '', ""], + 'iauto': ['int32', '', ""], + 'iprn': ['int32', '', ""], + 'iout': ['int32', '', ""], + 'itmin': ['int32', '', ""], + 'xyfiles': ['bool', '', ""], + 'idebug': ['int32', '', ""], + 'itests': ['int32', '', ""], + 'verbose': ['bool', '', ""], + 'stop_deg': ['bool', '', ""], + 'n_snap': ['int32', '', "number of steps between snapshots [0]"], } -GENEC_STAR_PARAMETERS = { - 'initialised': ['bool', NO_UNIT, "True if the star is an intialised model"], - 'starname': ['string', NO_UNIT, "Name of the star"], - 'nwseq': ['int32', NO_UNIT, ""], - 'modanf': ['int32', NO_UNIT, ""], - 'nzmod': ['int32', NO_UNIT, ""], - 'end_at_phase': ['int32', NO_UNIT, "Stop if this phase is reached"], - 'end_at_model': ['int32', NO_UNIT, "Stop if this model number is reached"], - 'irot': ['int32', NO_UNIT, ""], - 'isol': ['int32', NO_UNIT, ""], - 'imagn': ['int32', NO_UNIT, ""], - 'ialflu': ['int32', NO_UNIT, ""], - 'ianiso': ['int32', NO_UNIT, ""], - 'ipop3': ['int32', NO_UNIT, ""], - 'ibasnet': ['int32', NO_UNIT, ""], - 'phase': ['int32', NO_UNIT, ""], - 'var_rates': ['bool', NO_UNIT, ""], - 'bintide': ['bool', NO_UNIT, ""], - 'binm2': ['float64', NO_UNIT, ""], - 'periodini': ['float64', NO_UNIT, ""], - 'const_per': ['bool', NO_UNIT, ""], - 'iprezams': ['int32', NO_UNIT, ""], - 'zinit': ['float64', NO_UNIT, ""], - 'zsol': ['float64', NO_UNIT, ""], - 'z': ['float64', NO_UNIT, ""], - 'iopac': ['int32', NO_UNIT, ""], - 'ikappa': ['int32', NO_UNIT, ""], - 'idiff': ['int32', NO_UNIT, ""], - 'iadvec': ['int32', NO_UNIT, ""], - 'istati': ['int32', NO_UNIT, ""], - 'icoeff': ['int32', NO_UNIT, ""], - 'fenerg': ['float64', NO_UNIT, ""], - 'richac': ['float64', NO_UNIT, ""], - 'igamma': ['int32', NO_UNIT, ""], - 'frein': ['float64', NO_UNIT, ""], - 'K_Kawaler': ['float64', NO_UNIT, ""], - 'Omega_saturation': ['float64', NO_UNIT, ""], - 'rapcrilim': ['float64', NO_UNIT, ""], - 'vwant': ['float64', NO_UNIT, ""], - 'xfom': ['float64', NO_UNIT, ""], - 'omega': ['float64', NO_UNIT, ""], - 'xdial': ['float64', NO_UNIT, ""], - 'idialo': ['int32', NO_UNIT, ""], - 'idialu': ['int32', NO_UNIT, ""], - 'Add_Flux': ['bool', NO_UNIT, ""], - 'diff_only': ['bool', NO_UNIT, ""], - 'B_initial': ['float64', NO_UNIT, ""], - 'add_diff': ['float64', NO_UNIT, ""], - 'n_mag': ['int32', NO_UNIT, ""], - 'alpha_F': ['float64', NO_UNIT, ""], - 'nsmooth': ['int32', NO_UNIT, ""], - 'qminsmooth': ['bool', NO_UNIT, ""], - 'imloss': ['int32', NO_UNIT, ""], - 'fmlos': ['float64', NO_UNIT, ""], - 'ifitm': ['int32', NO_UNIT, ""], - 'fitm': ['float64', NO_UNIT, ""], - 'fitmi': ['float64', NO_UNIT, ""], - 'deltal': ['float64', NO_UNIT, ""], - 'deltat': ['float64', NO_UNIT, ""], - 'nndr': ['int32', NO_UNIT, ""], - 'RSG_Mdot': ['int32', NO_UNIT, ""], - 'SupraEddMdot': ['bool', NO_UNIT, ""], - 'Be_mdotfrac': ['float64', NO_UNIT, ""], - 'start_mdot': ['float64', NO_UNIT, ""], - 'iledou': ['int32', NO_UNIT, ""], - 'idifcon': ['int32', NO_UNIT, ""], - 'iover': ['int32', NO_UNIT, ""], - 'elph': ['float64', NO_UNIT, ""], - 'my': ['int32', NO_UNIT, ""], - 'dovhp': ['float64', NO_UNIT, ""], - 'iunder': ['int32', NO_UNIT, ""], - 'dunder': ['float64', NO_UNIT, ""], - 'gkorm': ['float64', NO_UNIT, ""], - 'alph': ['float64', NO_UNIT, ""], - 'agdr': ['float64', NO_UNIT, ""], - 'faktor': ['float64', NO_UNIT, ""], - 'dgrp': ['float64', NO_UNIT, ""], - 'dgrl': ['float64', NO_UNIT, ""], - 'dgry': ['float64', NO_UNIT, ""], - 'dgrc': ['float64', NO_UNIT, ""], - 'dgro': ['float64', NO_UNIT, ""], - 'dgr20': ['float64', NO_UNIT, ""], - 'nbchx': ['int32', NO_UNIT, ""], - 'nrband': ['int32', NO_UNIT, ""], - 'xcn': ['float64', NO_UNIT, ""], - 'islow': ['int32', NO_UNIT, ""], - 'icncst': ['int32', NO_UNIT, ""], - 'tauH_fit': ['int32', NO_UNIT, ""], - 'display_plot': ['bool', NO_UNIT, ""], - 'iauto': ['int32', NO_UNIT, ""], - 'iprn': ['int32', NO_UNIT, ""], - 'iout': ['int32', NO_UNIT, ""], - 'itmin': ['int32', NO_UNIT, ""], - 'xyfiles': ['bool', NO_UNIT, ""], - 'idebug': ['int32', NO_UNIT, ""], - 'itests': ['int32', NO_UNIT, ""], - 'verbose': ['bool', NO_UNIT, ""], - 'stop_deg': ['bool', NO_UNIT, ""], - 'n_snap': ['int32', NO_UNIT, "number of steps between snapshots [0]"], +# Stellar properties (but global for the star) +GENEC_STAR_PROPERTIES = { + # 'GENEC name: [dtype, unit, description, AMUSE name (optional)] + 'm': ['int32', '', "number of zones", "n_zones"], + 'gms': ['float64', 'MSun', "total mass", 'mass'], + 'alter': ['float64', 'julianyr', "stellar age", 'age'], + 'gls': ['float64', 'LSun', "", 'luminosity'], + 'teff': ['float64', 'K', "effective temperature", 'temperature'], + 'glsv': ['float64', 'LSun', "previous luminosity"], + 'teffv': ['float64', 'K', "previous effective temperature"], + 'dzeitj': ['float64', 'julianyr', "time step", 'time_step'], + 'dzeit': ['float64', 's', "time step"], + 'dzeitv': ['float64', 's', "previous time step"], + 'xmini': ['float64', 'MSun', "", 'initial_mass'], + 'summas': ['float64', 'MSun', "total mass"], + 'ab': ['float64', '', ""], + 'dm_lost': ['float64', 'MSun', "total mass lost"], } +# Structural properties (m layers) GENEC_STAR_STRUCTURE = { - 'm': ['int32', NO_UNIT, "number of zones"], - 'gms': ['float64', units.MSun, "total mass"], - 'alter': ['float64', units.julianyr, "stellar age"], - 'gls': ['float64', NO_UNIT, ""], - 'teff': ['float64', units.K, "effective temperature"], - 'glsv': ['float64', NO_UNIT, ""], - 'teffv': ['float64', units.K, "previous effective temperature"], - 'dzeitj': ['float64', units.julianyr, "time step"], - 'dzeit': ['float64', units.s, "time step"], - 'dzeitv': ['float64', units.s, "previous time step"], - 'xmini': ['float64', NO_UNIT, ""], - 'summas': ['float64', units.MSun, "total mass"], - 'ab': ['float64', NO_UNIT, ""], - 'dm_lost': ['float64', units.MSun, "total mass lost"], - 'q': ['float64', NO_UNIT, ""], - 'p': ['float64', NO_UNIT, ""], - 't': ['float64', NO_UNIT, ""], - 'r': ['float64', NO_UNIT, ""], - 's': ['float64', NO_UNIT, ""], - 'x': ['float64', NO_UNIT, "H fraction"], - 'y3': ['float64', NO_UNIT, "He3 fraction"], - 'y': ['float64', NO_UNIT, "He fraction"], - 'xc12': ['float64', NO_UNIT, "C12 fraction"], - 'xc13': ['float64', NO_UNIT, "C13 fraction"], - 'xn14': ['float64', NO_UNIT, "N14 fraction"], - 'xn15': ['float64', NO_UNIT, ""], - 'xo16': ['float64', NO_UNIT, ""], - 'xo17': ['float64', NO_UNIT, ""], - 'xo18': ['float64', NO_UNIT, ""], - 'xne20': ['float64', NO_UNIT, ""], - 'xne22': ['float64', NO_UNIT, ""], - 'xmg24': ['float64', NO_UNIT, ""], - 'xmg25': ['float64', NO_UNIT, ""], - 'xmg26': ['float64', NO_UNIT, ""], - 'xf19': ['float64', NO_UNIT, ""], - 'xne21': ['float64', NO_UNIT, ""], - 'xna23': ['float64', NO_UNIT, ""], - 'xal27': ['float64', NO_UNIT, ""], - 'xsi28': ['float64', NO_UNIT, ""], - 'xc14': ['float64', NO_UNIT, ""], - 'xf18': ['float64', NO_UNIT, ""], - 'xal26': ['float64', NO_UNIT, ""], - 'xneut': ['float64', NO_UNIT, "Neutron fraction"], - 'xprot': ['float64', NO_UNIT, "Proton fraction"], - 'omegi': ['float64', NO_UNIT, "Rotation"], - 'xbid': ['float64', NO_UNIT, ""], - 'xbid1': ['float64', NO_UNIT, ""], - 'vp': ['float64', NO_UNIT, ""], - 'vt': ['float64', NO_UNIT, ""], - 'vr': ['float64', NO_UNIT, ""], - 'vs': ['float64', NO_UNIT, ""], - 'vx': ['float64', NO_UNIT, ""], - 'vy': ['float64', NO_UNIT, ""], - 'vy3': ['float64', NO_UNIT, ""], - 'vxc12': ['float64', NO_UNIT, ""], - 'vxc13': ['float64', NO_UNIT, ""], - 'vxn14': ['float64', NO_UNIT, ""], - 'vxn15': ['float64', NO_UNIT, ""], - 'vxo16': ['float64', NO_UNIT, ""], - 'vxo17': ['float64', NO_UNIT, ""], - 'vxo18': ['float64', NO_UNIT, ""], - 'vxne20': ['float64', NO_UNIT, ""], - 'vxne22': ['float64', NO_UNIT, ""], - 'vxmg24': ['float64', NO_UNIT, ""], - 'vxmg25': ['float64', NO_UNIT, ""], - 'vxmg26': ['float64', NO_UNIT, ""], - 'vxf19': ['float64', NO_UNIT, ""], - 'vxne21': ['float64', NO_UNIT, ""], - 'vxna23': ['float64', NO_UNIT, ""], - 'vxal27': ['float64', NO_UNIT, ""], - 'vxsi28': ['float64', NO_UNIT, ""], - 'vxc14': ['float64', NO_UNIT, ""], - 'vxf18': ['float64', NO_UNIT, ""], - 'vxal26g': ['float64', NO_UNIT, ""], - 'vxneut': ['float64', NO_UNIT, ""], - 'vxprot': ['float64', NO_UNIT, ""], - 'vomegi': ['float64', NO_UNIT, ""], - 'vxbid': ['float64', NO_UNIT, ""], - 'vxbid1': ['float64', NO_UNIT, ""], + # 'GENEC name: [dtype, unit, description, AMUSE name (optional)] + 'q': ['float64', '', ""], + 'p': ['float64', '', ""], + 't': ['float64', '', ""], + 'r': ['float64', '', ""], + 's': ['float64', '', ""], + 'x': ['float64', '', "H fraction"], + 'y3': ['float64', '', "He3 fraction"], + 'y': ['float64', '', "He fraction"], + 'xc12': ['float64', '', "C12 fraction"], + 'xc13': ['float64', '', "C13 fraction"], + 'xn14': ['float64', '', "N14 fraction"], + 'xn15': ['float64', '', ""], + 'xo16': ['float64', '', ""], + 'xo17': ['float64', '', ""], + 'xo18': ['float64', '', ""], + 'xne20': ['float64', '', ""], + 'xne22': ['float64', '', ""], + 'xmg24': ['float64', '', ""], + 'xmg25': ['float64', '', ""], + 'xmg26': ['float64', '', ""], + 'xf19': ['float64', '', ""], + 'xne21': ['float64', '', ""], + 'xna23': ['float64', '', ""], + 'xal27': ['float64', '', ""], + 'xsi28': ['float64', '', ""], + 'xc14': ['float64', '', ""], + 'xf18': ['float64', '', ""], + 'xal26': ['float64', '', ""], + 'xneut': ['float64', '', "Neutron fraction"], + 'xprot': ['float64', '', "Proton fraction"], + 'omegi': ['float64', '', "Rotation"], + 'xbid': ['float64', '', ""], + 'xbid1': ['float64', '', ""], + 'vp': ['float64', '', ""], + 'vt': ['float64', '', ""], + 'vr': ['float64', '', ""], + 'vs': ['float64', '', ""], + 'vx': ['float64', '', ""], + 'vy': ['float64', '', ""], + 'vy3': ['float64', '', ""], + 'vxc12': ['float64', '', ""], + 'vxc13': ['float64', '', ""], + 'vxn14': ['float64', '', ""], + 'vxn15': ['float64', '', ""], + 'vxo16': ['float64', '', ""], + 'vxo17': ['float64', '', ""], + 'vxo18': ['float64', '', ""], + 'vxne20': ['float64', '', ""], + 'vxne22': ['float64', '', ""], + 'vxmg24': ['float64', '', ""], + 'vxmg25': ['float64', '', ""], + 'vxmg26': ['float64', '', ""], + 'vxf19': ['float64', '', ""], + 'vxne21': ['float64', '', ""], + 'vxna23': ['float64', '', ""], + 'vxal27': ['float64', '', ""], + 'vxsi28': ['float64', '', ""], + 'vxc14': ['float64', '', ""], + 'vxf18': ['float64', '', ""], + 'vxal26g': ['float64', '', ""], + 'vxneut': ['float64', '', ""], + 'vxprot': ['float64', '', ""], + 'vomegi': ['float64', '', ""], + 'vxbid': ['float64', '', ""], + 'vxbid1': ['float64', '', ""], } class GenecInterface( @@ -1055,66 +1059,122 @@ def get_n_snap(index_of_the_particle='i'): def set_n_snap(index_of_the_particle='i', n_snap='int32'): returns () - # @legacy_function - # def get_par_stopping_condition(): - # 'get parameter stopping_condition' - # function = LegacyFunctionSpecification() - # function.addParameter( - # 'stopping_condition', dtype='string', - # direction=function.OUT, - # ) - # function.result_type = 'int32' - # function.result_doc = ''' - # 0 - OK - # Got the value. - # -1 - ERROR - # Unable to get. - # ''' - # return function - - # @legacy_function - # def set_par_stopping_condition(): - # 'set parameter stopping_condition' - # function = LegacyFunctionSpecification() - # function.addParameter( - # 'stopping_condition', dtype='string', - # direction=function.IN, - # ) - # function.result_type = 'int32' - # function.result_doc = ''' - # 0 - OK - # The value has been set. - # -1 - ERROR - # Unable to set. - # -2 - ERROR - # Cannot set at this point, already running. - # ''' - # return function + # end Parameters - # End parameters + # begin Properties + @remote_function(can_handle_array=True) + def get_m(index_of_the_particle='i'): + returns (m='int32') - @legacy_function - def set_number_of_zones(): - """ - Set the current number of zones/mesh-cells of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'n_zones', dtype='int32', direction=function.IN, - description="The current number of zones/mesh-cells of the star." - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_m(index_of_the_particle='i', m='int32'): + returns () + + @remote_function(can_handle_array=True) + def get_gms(index_of_the_particle='i'): + returns (gms='float64' | units.MSun) + + @remote_function(can_handle_array=True) + def set_gms(index_of_the_particle='i', gms='float64' | units.MSun): + returns () + + @remote_function(can_handle_array=True) + def get_alter(index_of_the_particle='i'): + returns (alter='float64' | units.julianyr) + + @remote_function(can_handle_array=True) + def set_alter(index_of_the_particle='i', alter='float64' | units.julianyr): + returns () + + @remote_function(can_handle_array=True) + def get_gls(index_of_the_particle='i'): + returns (gls='float64' | units.LSun) + + @remote_function(can_handle_array=True) + def set_gls(index_of_the_particle='i', gls='float64' | units.LSun): + returns () + + @remote_function(can_handle_array=True) + def get_teff(index_of_the_particle='i'): + returns (teff='float64' | units.K) + + @remote_function(can_handle_array=True) + def set_teff(index_of_the_particle='i', teff='float64' | units.K): + returns () + + @remote_function(can_handle_array=True) + def get_glsv(index_of_the_particle='i'): + returns (glsv='float64' | units.LSun) + + @remote_function(can_handle_array=True) + def set_glsv(index_of_the_particle='i', glsv='float64' | units.LSun): + returns () + + @remote_function(can_handle_array=True) + def get_teffv(index_of_the_particle='i'): + returns (teffv='float64' | units.K) + + @remote_function(can_handle_array=True) + def set_teffv(index_of_the_particle='i', teffv='float64' | units.K): + returns () + + @remote_function(can_handle_array=True) + def get_dzeitj(index_of_the_particle='i'): + returns (dzeitj='float64' | units.julianyr) + + @remote_function(can_handle_array=True) + def set_dzeitj(index_of_the_particle='i', dzeitj='float64' | units.julianyr): + returns () + + @remote_function(can_handle_array=True) + def get_dzeit(index_of_the_particle='i'): + returns (dzeit='float64' | units.s) + + @remote_function(can_handle_array=True) + def set_dzeit(index_of_the_particle='i', dzeit='float64' | units.s): + returns () + + @remote_function(can_handle_array=True) + def get_dzeitv(index_of_the_particle='i'): + returns (dzeitv='float64' | units.s) + + @remote_function(can_handle_array=True) + def set_dzeitv(index_of_the_particle='i', dzeitv='float64' | units.s): + returns () + + @remote_function(can_handle_array=True) + def get_xmini(index_of_the_particle='i'): + returns (xmini='float64' | units.MSun) + + @remote_function(can_handle_array=True) + def set_xmini(index_of_the_particle='i', xmini='float64' | units.MSun): + returns () + + @remote_function(can_handle_array=True) + def get_summas(index_of_the_particle='i'): + returns (summas='float64' | units.MSun) + + @remote_function(can_handle_array=True) + def set_summas(index_of_the_particle='i', summas='float64' | units.MSun): + returns () + + @remote_function(can_handle_array=True) + def get_ab(index_of_the_particle='i'): + returns (ab='float64') + + @remote_function(can_handle_array=True) + def set_ab(index_of_the_particle='i', ab='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_dm_lost(index_of_the_particle='i'): + returns (dm_lost='float64' | units.MSun) + + @remote_function(can_handle_array=True) + def set_dm_lost(index_of_the_particle='i', dm_lost='float64' | units.MSun): + returns () + + # end Properties @legacy_function def commit_parameters(): @@ -1172,20 +1232,20 @@ def new_stellar_model(): "to this star in other functions" ) ) - for parameter in GENEC_STAR_PARAMETERS: - function.addParameter( - parameter, - dtype=GENEC_STAR_PARAMETERS[parameter][0], - unit=GENEC_STAR_PARAMETERS[parameter][1], - description=GENEC_STAR_PARAMETERS[parameter][2], - direction=function.IN, - ) - for parameter in GENEC_STAR_STRUCTURE: + for parameter in { + **GENEC_STAR_PARAMETERS, + **GENEC_STAR_PROPERTIES, + **GENEC_STAR_STRUCTURE + }.items(): + if parameter[1][1] == "": + unit = NO_UNIT + else: + unit = getattr(units, parameter[1][1]) function.addParameter( - parameter, - dtype=GENEC_STAR_STRUCTURE[parameter][0], - unit=GENEC_STAR_STRUCTURE[parameter][1], - description=GENEC_STAR_STRUCTURE[parameter][2], + parameter[0], + dtype=parameter[1][0], + unit=unit, + description=parameter[1][2], direction=function.IN, ) @@ -1206,20 +1266,16 @@ def get_stellar_model(): "to this star in other functions" ) ) - for parameter in GENEC_STAR_PARAMETERS: - function.addParameter( - parameter, - dtype=GENEC_STAR_PARAMETERS[parameter][0], - unit=GENEC_STAR_PARAMETERS[parameter][1], - description=GENEC_STAR_PARAMETERS[parameter][2], - direction=function.OUT, - ) - for parameter in GENEC_STAR_STRUCTURE: + for parameter in { + **GENEC_STAR_PARAMETERS, + **GENEC_STAR_PROPERTIES, + **GENEC_STAR_STRUCTURE + }.items(): function.addParameter( - parameter, - dtype=GENEC_STAR_STRUCTURE[parameter][0], - unit=GENEC_STAR_STRUCTURE[parameter][1], - description=GENEC_STAR_STRUCTURE[parameter][2], + parameter[0], + dtype=parameter[1][0], + unit=parameter[1][1], + description=parameter[1][2], direction=function.OUT, ) function.result_type = 'int32' @@ -3420,33 +3476,32 @@ def define_particle_sets(self, handler): ) handler.set_new(set_name, 'new_particle') - for particle_property in GENEC_STAR_PARAMETERS: + for parameter in { + **GENEC_STAR_PARAMETERS, + **GENEC_STAR_PROPERTIES, + # **GENEC_STAR_STRUCTURE + }.items(): + if len(parameter[1]) == 4: + names = ( + parameter[1][3], + ) + else: + names = (parameter[0],) handler.add_getter( set_name, - f'get_{particle_property}', - names=(particle_property,) + f'get_{parameter[0]}', + names=names, ) - handler.add_getter(set_name, 'get_phase', names=('phase',)) handler.add_getter(set_name, 'get_radius') handler.add_getter(set_name, 'get_mass') handler.add_getter(set_name, 'get_age') handler.add_getter(set_name, 'get_luminosity') handler.add_getter(set_name, 'get_temperature') handler.add_getter(set_name, 'get_time_step', names=('time_step',)) - handler.add_getter( - set_name, 'get_number_of_zones', names=('n_zones',) - ) - handler.add_setter( - set_name, 'set_number_of_zones', names=('n_zones',) - ) handler.add_getter( set_name, 'get_number_of_species', names=('n_species',) ) - # handler.add_method(set_name, 'get_number_of_zones') - handler.add_method(set_name, 'get_number_of_zones') - handler.add_method(set_name, 'set_number_of_zones') - # handler.add_method(set_name, 'get_radius_profile') # handler.add_method(set_name, 'get_temperature_profile') # handler.add_method(set_name, 'get_luminosity_profile') @@ -3608,23 +3663,25 @@ def define_state(self, handler): # I.e. must do initialize_code and commit_parameters FIRST! # Initialized (initialize_code) - handler.add_method + # handler.add_method # -> Edit (commit_parameters) - #handler.add_method('EDIT', 'set_starname') + # handler.add_method('EDIT', 'set_starname') # handler.add_method('EDIT', 'new_particle') # -> Run (commit_particles) handler.add_transition('EDIT', 'RUN', 'commit_particles') for state in ["UPDATE"]: - for particle_property in GENEC_STAR_PARAMETERS: - handler.add_method(state, f'get_{particle_property}') + for parameter in { + **GENEC_STAR_PARAMETERS, + **GENEC_STAR_PROPERTIES, + }: + handler.add_method(state, f'get_{parameter[0]}') handler.add_method(state, 'get_chemical_abundance_profiles') handler.add_method(state, 'get_mass_fraction_of_species_at_zone') handler.add_method(state, 'get_mu_at_zone') handler.add_method(state, 'get_number_of_species') - handler.add_method(state, 'get_number_of_zones') handler.add_method(state, 'get_pressure_at_zone') handler.add_method(state, 'get_radius') handler.add_method(state, 'get_radius_at_zone') @@ -3658,7 +3715,6 @@ def define_state(self, handler): #handler.add_method('UPDATE', 'set_ipoly') handler.add_method('UPDATE', 'set_chemical_abundance_profiles') handler.add_method('UPDATE', 'set_mass_fraction_of_species_at_zone') - handler.add_method('UPDATE', 'set_number_of_zones') # handler.add_method('UPDATE', 'set_radius') # handler.add_method('UPDATE', 'set_pressure_at_zone') handler.add_method('UPDATE', 'set_radius_at_zone') @@ -3687,96 +3743,17 @@ def define_methods(self, handler): (handler.INDEX, handler.ERROR_CODE) ) - # NEW_STELLAR_MODEL_IN = [] - # NEW_STELLAR_MODEL_IN += [p[1][1] for p in GENEC_STAR_PARAMETERS.items()] - # NEW_STELLAR_MODEL_IN += [p[1][1] for p in GENEC_STAR_STRUCTURE.items()] - - # handler.add_method( - # "new_stellar_model", - # ( - # NEW_STELLAR_MODEL_IN, - # ), - # ( - # handler.INDEX, handler.ERROR_CODE - # ) - # ) - - # GET_STELLAR_MODEL_OUT = [] - # GET_STELLAR_MODEL_OUT += [p[1][1] for p in GENEC_STAR_PARAMETERS.items()] - # GET_STELLAR_MODEL_OUT += [p[1][1] for p in GENEC_STAR_STRUCTURE.items()] - # GET_STELLAR_MODEL_OUT.append(handler.ERROR_CODE) - - # handler.add_method( - # "get_stellar_model", - # (handler.INDEX,), - # tuple(GET_STELLAR_MODEL_OUT) - # ) handler.add_method( "read_genec_model", (handler.NO_UNIT), (handler.INDEX, handler.ERROR_CODE) - ) # handler.add_method( - # "get_radius", - # (handler.INDEX,), - # (units.RSun, handler.ERROR_CODE,) - # ) - handler.add_method( - "get_number_of_zones", - (handler.INDEX,), - (handler.NO_UNIT, handler.ERROR_CODE,) - ) - # handler.add_method( - # "get_radius_at_zone", - # (handler.INDEX, handler.NO_UNIT,), - # (units.cm, handler.ERROR_CODE,) - # ) - # handler.add_method( - # "set_radius_at_zone", - # (handler.INDEX, handler.NO_UNIT, units.cm), - # (handler.ERROR_CODE,) - # ) - # handler.add_method( - # "get_temperature_at_zone", - # (handler.INDEX, handler.NO_UNIT,), - # (units.K, handler.ERROR_CODE,) - # ) - # handler.add_method( - # "set_temperature_at_zone", - # (handler.INDEX, handler.NO_UNIT, units.K), - # (handler.ERROR_CODE,) - # ) - # handler.add_method( - # "get_luminosity_at_zone", - # (handler.INDEX, handler.NO_UNIT,), - # (units.erg/units.s, handler.ERROR_CODE,) - # ) - # handler.add_method( - # "set_luminosity_at_zone", - # (handler.INDEX, handler.NO_UNIT, units.erg/units.s), - # (handler.ERROR_CODE,) - # ) + ) + handler.add_method( "get_surface_velocity", (handler.INDEX), (units.km/units.s, handler.ERROR_CODE,) ) - # def define_parameters(self, handler): - - # def get_luminosity_profile( - # self, - # indices_of_the_stars, - # number_of_zones=None, - # ): - # indices_of_the_stars = self._check_number_of_indices( - # indices_of_the_stars, - # action_string="Querying luminosity profiles" - # ) - # if number_of_zones is None: - # number_of_zones = self.get_number_of_zones(indices_of_the_stars) - # return self.get_luminosity_at_zone( - # [indices_of_the_stars]*number_of_zones, - # list(range(number_of_zones)) | units.none - # ) def get_eps_profile( self, @@ -3788,7 +3765,7 @@ def get_eps_profile( action_string="Querying eps profiles" ) if number_of_zones is None: - number_of_zones = self.get_number_of_zones(indices_of_the_stars) + number_of_zones = self.get_m(indices_of_the_stars) return self.get_eps_at_zone( [indices_of_the_stars]*number_of_zones, list(range(number_of_zones)) | units.none @@ -3804,7 +3781,7 @@ def get_epsy_profile( action_string="Querying epsy profiles" ) if number_of_zones is None: - number_of_zones = self.get_number_of_zones(indices_of_the_stars) + number_of_zones = self.get_m(indices_of_the_stars) return self.get_epsy_at_zone( [indices_of_the_stars]*number_of_zones, list(range(number_of_zones)) | units.none @@ -3820,7 +3797,7 @@ def get_eps_c_adv_profile( action_string="Querying eps_c_adv profiles" ) if number_of_zones is None: - number_of_zones = self.get_number_of_zones(indices_of_the_stars) + number_of_zones = self.get_m(indices_of_the_stars) return self.get_eps_c_adv_at_zone( [indices_of_the_stars]*number_of_zones, list(range(number_of_zones)) | units.none @@ -3836,7 +3813,7 @@ def get_eps_ne_adv_profile( action_string="Querying eps_c_adv profiles" ) if number_of_zones is None: - number_of_zones = self.get_number_of_zones(indices_of_the_stars) + number_of_zones = self.get_m(indices_of_the_stars) return self.get_eps_ne_adv_at_zone( [indices_of_the_stars]*number_of_zones, list(range(number_of_zones)) | units.none @@ -3852,7 +3829,7 @@ def get_eps_o_adv_profile( action_string="Querying eps_c_adv profiles" ) if number_of_zones is None: - number_of_zones = self.get_number_of_zones(indices_of_the_stars) + number_of_zones = self.get_m(indices_of_the_stars) return self.get_eps_o_adv_at_zone( [indices_of_the_stars]*number_of_zones, list(range(number_of_zones)) | units.none @@ -3868,7 +3845,7 @@ def get_eps_si_adv_profile( action_string="Querying eps_c_adv profiles" ) if number_of_zones is None: - number_of_zones = self.get_number_of_zones(indices_of_the_stars) + number_of_zones = self.get_m(indices_of_the_stars) return self.get_eps_si_adv_at_zone( [indices_of_the_stars]*number_of_zones, list(range(number_of_zones)) | units.none @@ -3884,7 +3861,7 @@ def get_eps_grav_profile( action_string="Querying eps_c_adv profiles" ) if number_of_zones is None: - number_of_zones = self.get_number_of_zones(indices_of_the_stars) + number_of_zones = self.get_m(indices_of_the_stars) return self.get_eps_grav_at_zone( [indices_of_the_stars]*number_of_zones, list(range(number_of_zones)) | units.none @@ -3900,7 +3877,7 @@ def get_eps_nu_profile( action_string="Querying eps_c_adv profiles" ) if number_of_zones is None: - number_of_zones = self.get_number_of_zones(indices_of_the_stars) + number_of_zones = self.get_m(indices_of_the_stars) return self.get_eps_nu_at_zone( [indices_of_the_stars]*number_of_zones, list(range(number_of_zones)) | units.none @@ -3916,7 +3893,7 @@ def get_mass_profile( action_string="Querying mass profiles" ) if number_of_zones is None: - number_of_zones = self.get_number_of_zones(indices_of_the_stars) + number_of_zones = self.get_m(indices_of_the_stars) return self.get_mass_fraction_at_zone( [indices_of_the_stars]*number_of_zones, list(range(number_of_zones)) | units.none diff --git a/src/amuse/community/genec/make_getsetters.py b/src/amuse/community/genec/make_getsetters.py new file mode 100644 index 0000000000..4a525d1dee --- /dev/null +++ b/src/amuse/community/genec/make_getsetters.py @@ -0,0 +1,58 @@ +import sys +# from interface import GENEC_STAR_PARAMETERS as INPUT +from interface import GENEC_STAR_PROPERTIES as INPUT +from amuse.community import NO_UNIT + +def main(): + for star_property in INPUT: + dtype = INPUT[star_property][0] + if dtype in ["i", "int32"]: + f_dtype = "integer" + elif dtype in ["d", "float64"]: + f_dtype = "real(kindreal)" + elif dtype in ["b", "bool"]: + f_dtype = "logical" + elif dtype in ["s", "string"]: + f_dtype = "character(256)" + else: + print(f"wrong dtype: {dtype}") + sys.exit() + if INPUT[star_property][1] != '': + dtype = f"'{INPUT[star_property][0]}' | units.{INPUT[star_property][1]}" + else: + dtype = f"'{INPUT[star_property][0]}'" + with open("interface_temp.py", 'a') as py_out: + py_out.write( + f" @remote_function(can_handle_array=True)\n" + f" def get_{star_property}(index_of_the_particle='i'):\n" + f" returns ({star_property}={dtype})\n" + f"\n" + f" @remote_function(can_handle_array=True)\n" + f" def set_{star_property}(index_of_the_particle='i', {star_property}={dtype}):\n" + f" returns ()\n" + f"\n" + ) + + with open("interface_temp.f90", 'a') as f_out: + f_out.write( + f"integer function get_{star_property}(index_of_the_particle, {star_property})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" {f_dtype}, intent(out):: {star_property}\n" + f" {star_property} = GenecStar%{star_property}\n" + f" get_{star_property} = 0\n" + f"end function get_{star_property}\n" + f"\n" + f"integer function set_{star_property}(index_of_the_particle, {star_property})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" {f_dtype}, intent(in):: {star_property}\n" + f" GenecStar%{star_property} = {star_property}\n" + f" set_{star_property} = 0\n" + f"end function set_{star_property}\n" + f"\n" + ) + + +if __name__ == "__main__": + main() From 424e5c38266c06ec9d52c38c0c5faee9d0d377be Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Thu, 2 Feb 2023 15:03:45 +0100 Subject: [PATCH 52/72] newer interface version --- src/amuse/community/genec/interface.f90 | 5423 ++++++++++++------ src/amuse/community/genec/interface.py | 4858 +++++++--------- src/amuse/community/genec/make_getsetters.py | 954 ++- 3 files changed, 6773 insertions(+), 4462 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 42e48e8241..46e4ab8b66 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1,9 +1,10 @@ module AmuseInterface use storage, only:& - InitialGenecStar,InitialNetwork,& + InitialGenecStar,& GenecStar,genec_star use helpers, only:& - copy_to_genec_star,copy_from_genec_star + copy_to_genec_star,copy_namelists_from_genec_star,copy_from_genec_star,& + copy_structure_from_genec_star use evol, only: kindreal,ldi,npondcouche type(genec_star) :: BackupBackupGenecStar @@ -71,155 +72,1264 @@ integer function get_min_timestep_stop_condition(min_timestep_stop_condition) get_min_timestep_stop_condition = 0 end function - -!######### - - -integer function get_initialised(index_of_the_particle, initialised) +function finalize_stellar_model() implicit none - integer, intent(in):: index_of_the_particle - logical, intent(out):: initialised - initialised = GenecStar%initialised - get_initialised = 0 -end function get_initialised + integer:: finalize_stellar_model + !write(*,*) "copy to GenecStar" + !call copy_to_genec_star(GenecStar) + !write(*,*) GenecStar + finalize_stellar_model = 0 +end function -integer function set_initialised(index_of_the_particle, initialised) +function commit_parameters() implicit none - integer, intent(in):: index_of_the_particle - logical, intent(in):: initialised - GenecStar%initialised = initialised - set_initialised = 0 -end function set_initialised + integer:: commit_parameters + commit_parameters = 0 +end function -integer function get_starname(index_of_the_particle, starname) +function commit_particles() + use makeini, only: make_initial_star + use genec, only: initialise_star implicit none - integer, intent(in):: index_of_the_particle - character(len=256), intent(out):: starname - starname = GenecStar%starname - get_starname = 0 -end function get_starname + integer:: commit_particles + ! makeini will actually override some things from set_defaults now! FIXME + if (.not.GenecStar%initialised) then + write(*,*) 'i:', GenecStar%nbzel + call make_initial_star() + write(*,*) 'm_i_s:', GenecStar%nbzel + call copy_from_genec_star(GenecStar) + write(*,*) 'c_f_g_s:', GenecStar%nbzel + call initialise_star() + GenecStar%initialised = .true. + write(*,*) 'i_s:', GenecStar%nbzel + call copy_to_genec_star(GenecStar) + else + ! "read" GENEC star namelists + write(*,*) "call copy_namelists_from_genec_star(GenecStar)" + call copy_namelists_from_genec_star(GenecStar) + ! Initialise values not in GENEC star + ! but this also resets some values that are read, so... + write(*,*) 'call initialise_star()' + call initialise_star() + ! "read" the GENEC star structure + write(*,*) 'call copy_structure_from_genec_star(GenecStar)' + call copy_structure_from_genec_star(GenecStar) + ! and then copy back - some things may have changed? + write(*,*) 'call copy_to_genec_star(GenecStar)' + call copy_to_genec_star(GenecStar) + endif + write(*,*) "COMMIT PARTICLES DONE" + commit_particles = 0 +end function -integer function set_starname(index_of_the_particle, starname) +function delete_star(index_of_the_star) implicit none - integer, intent(in):: index_of_the_particle - character(len=256), intent(in):: starname - GenecStar%starname = starname - set_starname = 0 -end function set_starname + integer:: index_of_the_star + integer:: delete_star + delete_star = -1 ! not supported +end function -integer function get_nwseq(index_of_the_particle, nwseq) +function evolve_model(end_time) + use timestep, only: alter implicit none - integer, intent(in):: index_of_the_particle - integer, intent(out):: nwseq - nwseq = GenecStar%nwseq - get_nwseq = 0 -end function get_nwseq + real(kindreal):: end_time + integer:: evolve_model + !stopping_condition = "" -integer function set_nwseq(index_of_the_particle, nwseq) - implicit none - integer, intent(in):: index_of_the_particle - integer, intent(in):: nwseq - GenecStar%nwseq = nwseq - set_nwseq = 0 -end function set_nwseq + do while (alter < end_time) + !if (stopping_condition == "") then + write(*,*) "Current time: ", alter, ", evolving to: ", end_time + evolve_model = evolve_one_step(0) + end do + !call copy_to_genec_star(GenecStar) + evolve_model = 0 +end function -integer function get_modanf(index_of_the_particle, modanf) +function evolve_for(index_of_the_star, time) + ! get current time + ! set max time to current time plus argument + ! evolve + use timestep, only: alter implicit none - integer, intent(in):: index_of_the_particle - integer, intent(out):: modanf - modanf = GenecStar%modanf - get_modanf = 0 -end function get_modanf + integer:: index_of_the_star + real(kindreal):: time, end_time + integer:: evolve_for + end_time = alter+time + do while (alter < end_time) + write(*,*) "Current time: ", alter, ", evolving to: ", end_time + evolve_for = evolve_one_step(index_of_the_star) + end do + !call copy_to_genec_star(GenecStar) -integer function set_modanf(index_of_the_particle, modanf) - implicit none - integer, intent(in):: index_of_the_particle - integer, intent(in):: modanf - GenecStar%modanf = modanf - set_modanf = 0 -end function set_modanf + evolve_for = 0 +end function -integer function get_nzmod(index_of_the_particle, nzmod) +function evolve_one_step(index_of_the_star) + use timestep, only: alter + use WriteSaveClose, only: OpenAll + use genec, only: evolve, modell, finalise, veryFirst + use inputparam,only: modanf,nwseq,nzmod,end_at_phase,end_at_model + use genec, only: n_snap implicit none - integer, intent(in):: index_of_the_particle - integer, intent(out):: nzmod - nzmod = GenecStar%nzmod - get_nzmod = 0 -end function get_nzmod + integer:: index_of_the_star + integer:: evolve_one_step + integer:: original_nzmod + nzmod = 1 + n_snap = 0 -integer function set_nzmod(index_of_the_particle, nzmod) - implicit none - integer, intent(in):: index_of_the_particle - integer, intent(in):: nzmod - GenecStar%nzmod = nzmod - set_nzmod = 0 -end function set_nzmod + call evolve() + call finalise() + veryFirst = .false. + call copy_to_genec_star(GenecStar) + evolve_one_step = 0 +end function -integer function get_end_at_phase(index_of_the_particle, end_at_phase) +function write_genec_model() + !use inputparam, only: modanf + !use WriteSaveClose, only: OpenAll + !use genec, only: finalise + !use helpers, only: initialise_star implicit none - integer, intent(in):: index_of_the_particle - integer, intent(out):: end_at_phase - end_at_phase = GenecStar%end_at_phase - get_end_at_phase = 0 -end function get_end_at_phase + integer:: write_genec_model + !call finalise() + ! modanf = 0 + !call OpenAll() + !call initialise_star() + !call finalise() + !call OpenAll() + !call initialise_star() + write_genec_model = -1 +end function -integer function set_end_at_phase(index_of_the_particle, end_at_phase) +function get_age(index_of_the_star, age) implicit none - integer, intent(in):: index_of_the_particle - integer, intent(in):: end_at_phase - GenecStar%end_at_phase = end_at_phase - set_end_at_phase = 0 -end function set_end_at_phase + integer:: index_of_the_star + real(kindreal):: age + integer:: get_age + age = GenecStar%alter + get_age = 0 +end function -integer function get_end_at_model(index_of_the_particle, end_at_model) +function set_age(index_of_the_star, age) implicit none - integer, intent(in):: index_of_the_particle - integer, intent(out):: end_at_model - end_at_model = GenecStar%end_at_model - get_end_at_model = 0 -end function get_end_at_model + integer:: index_of_the_star + real(kindreal):: age + integer:: set_age + GenecStar%alter = age + set_age = 0 +end function -integer function set_end_at_model(index_of_the_particle, end_at_model) +function get_surface_velocity(index_of_the_star, surface_velocity) + use genec, only: vequat implicit none - integer, intent(in):: index_of_the_particle - integer, intent(in):: end_at_model - GenecStar%end_at_model = end_at_model - set_end_at_model = 0 -end function set_end_at_model + integer:: index_of_the_star + real(kindreal):: surface_velocity + integer:: get_surface_velocity + surface_velocity = vequat + get_surface_velocity = 0 +end function -integer function get_irot(index_of_the_particle, irot) +function get_density_at_zone(index_of_the_star, zone, rho_i) + use strucmod, only: rho implicit none - integer, intent(in):: index_of_the_particle - integer, intent(out):: irot - irot = GenecStar%irot - get_irot = 0 -end function get_irot + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: rho_i + integer:: get_density_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + rho_i = exp(rho(i)) + end if + get_density_at_zone = 0 +end function -integer function set_irot(index_of_the_particle, irot) +function set_density_at_zone(index_of_the_star, zone, rho_i) + use strucmod, only: rho implicit none - integer, intent(in):: index_of_the_particle - integer, intent(in):: irot - GenecStar%irot = irot - set_irot = 0 -end function set_irot + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: rho_i + integer:: set_density_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + rho(i) = log(rho_i) + end if + set_density_at_zone = 0 +end function -integer function get_isol(index_of_the_particle, isol) +function get_luminosity(index_of_the_star, luminosity) implicit none - integer, intent(in):: index_of_the_particle - integer, intent(out):: isol - isol = GenecStar%isol - get_isol = 0 -end function get_isol + integer:: index_of_the_star + real(kindreal):: luminosity + integer:: get_luminosity + !luminosity = exp(s(m)) ! in cgs units, so erg/s? + luminosity = GenecStar%gls + get_luminosity = 0 +end function -integer function set_isol(index_of_the_particle, isol) +function set_luminosity(index_of_the_star, luminosity) implicit none - integer, intent(in):: index_of_the_particle - integer, intent(in):: isol - GenecStar%isol = isol - set_isol = 0 -end function set_isol + integer:: index_of_the_star + real(kindreal):: luminosity + integer:: set_luminosity + !luminosity = exp(s(m)) ! in cgs units, so erg/s? + GenecStar%gls = luminosity + set_luminosity = 0 +end function -integer function get_imagn(index_of_the_particle, imagn) +function get_radius_at_zone(index_of_the_star, zone, R_i) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: R_i + integer:: get_radius_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + R_i = exp(GenecStar%r(i)) ! in cm + end if + get_radius_at_zone = 0 +end function + +function set_radius_at_zone(index_of_the_star, zone, R_i) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: R_i + integer:: set_radius_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + GenecStar%r(i) = log(R_i) + end if + set_radius_at_zone = 0 +end function + +function get_luminosity_at_zone(index_of_the_star, zone, lum_i) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: lum_i + integer:: get_luminosity_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + !lum_i = exp(s(zone+1)) + lum_i = exp(GenecStar%s(i)) - 1 + end if + get_luminosity_at_zone = 0 +end function + +function set_luminosity_at_zone(index_of_the_star, zone, lum_i) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: lum_i + integer:: set_luminosity_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + GenecStar%s(i) = log(lum_i + 1) + end if + set_luminosity_at_zone = 0 +end function + +function get_mass_fraction_at_zone(index_of_the_star, zone, dq_i) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: dq_i + integer:: get_mass_fraction_at_zone + i = GenecStar%m - zone + if (i == 1) then + dq_i = exp(GenecStar%q(i)) + else if (i <= GenecStar%m) then + !dq_i = 1-exp(q(zone+1)) + dq_i = (exp(GenecStar%q(i)) - exp(GenecStar%q(i-1))) + end if + get_mass_fraction_at_zone = 0 +end function + +function set_mass_fraction_at_zone(index_of_the_star, zone, dq_i) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: dq_i + integer:: set_mass_fraction_at_zone + i = GenecStar%m - zone + if (i == 1) then + GenecStar%q(i) = log(dq_i) + else if (i <= GenecStar%m) then + !dq_i = 1-exp(q(zone+1)) + GenecStar%q(i) = log(exp(GenecStar%q(i-1)) + dq_i) ! this won't do + end if + set_mass_fraction_at_zone = -1 ! This function is incomplete! +end function + +function get_mass(index_of_the_star, mass) + implicit none + real(kindreal):: mass + integer:: get_mass, index_of_the_star + mass = GenecStar%gms + get_mass = 0 +end function + +function set_mass(index_of_the_star, mass) + implicit none + integer:: set_mass, index_of_the_star + real(kindreal):: mass + InitialGenecStar%mstar = mass + set_mass = 0 +end function + +function get_mass_of_species(index_of_the_star, species, species_mass) + implicit none + integer:: index_of_the_star + integer:: species + real(kindreal):: species_mass + integer:: get_mass_of_species + get_mass_of_species = 0 + select case(species) + case(1) + species_mass = 1. + case(2) + species_mass = 3. + case(3) + species_mass = 4. + case(4) + species_mass = 12. + case(5) + species_mass = 13. + case(6) + species_mass = 14. + case(7) + species_mass = 15. + case(8) + species_mass = 16. + case(9) + species_mass = 17. + case(10) + species_mass = 18. + case(11) + species_mass = 20. + case(12) + species_mass = 22. + case(13) + species_mass = 24. + case(14) + species_mass = 25. + case(15) + species_mass = 26. + case(16) + species_mass = 14. + case(17) + species_mass = 18. + case(18) + species_mass = 19. + case(19) + species_mass = 21. + case(20) + species_mass = 23. + case(21) + species_mass = 26. + case(22) + species_mass = 27. + case(23) + species_mass = 28. + case(24) + species_mass = 1. !neut(i) + case(25) + species_mass = 1. !prot(i) +! case(26) +! species_mass = bid(i) +! case(27) +! species_mass = bid1(i) + case default + species_mass = 0. + end select +end function + +function get_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) + implicit none + integer:: index_of_the_star + integer:: species, zone, i + real(kindreal):: Xj_i + integer:: get_mass_fraction_of_species_at_zone + i = GenecStar%m-zone + if (zone <= GenecStar%m) then + select case(species) + case(1) + Xj_i = GenecStar%x(i) + case(2) + Xj_i = GenecStar%y3(i) + case(3) + Xj_i = GenecStar%y(i) + case(4) + Xj_i = GenecStar%xc12(i) + case(5) + Xj_i = GenecStar%xc13(i) + case(6) + Xj_i = GenecStar%xn14(i) + case(7) + Xj_i = GenecStar%xn15(i) + case(8) + Xj_i = GenecStar%xo16(i) + case(9) + Xj_i = GenecStar%xo17(i) + case(10) + Xj_i = GenecStar%xo18(i) + case(11) + Xj_i = GenecStar%xne20(i) + case(12) + Xj_i = GenecStar%xne22(i) + case(13) + Xj_i = GenecStar%xmg24(i) + case(14) + Xj_i = GenecStar%xmg25(i) + case(15) + Xj_i = GenecStar%xmg26(i) + case(16) + Xj_i = GenecStar%xc14(i) + case(17) + Xj_i = GenecStar%xf18(i) + case(18) + Xj_i = GenecStar%xf19(i) + case(19) + Xj_i = GenecStar%xne21(i) + case(20) + Xj_i = GenecStar%xna23(i) + case(21) + Xj_i = GenecStar%xal26(i) + case(22) + Xj_i = GenecStar%xal27(i) + case(23) + Xj_i = GenecStar%xsi28(i) + case(24) + Xj_i = GenecStar%xneut(i) + case(25) + Xj_i = GenecStar%xprot(i) + case(26) + Xj_i = GenecStar%xbid(i) + case(27) + Xj_i = GenecStar%xbid1(i) + case default + Xj_i = 0 + end select + end if + + get_mass_fraction_of_species_at_zone = 0 +end function + +function set_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) + implicit none + integer:: index_of_the_star + integer:: species, zone, i + real(kindreal):: Xj_i + integer:: set_mass_fraction_of_species_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + select case(species) + case(1) + GenecStar%x(i) = Xj_i + case(2) + GenecStar%y3(i) = Xj_i + case(3) + GenecStar%y(i) = Xj_i + case(4) + GenecStar%xc12(i) = Xj_i + case(5) + GenecStar%xc13(i) = Xj_i + case(6) + GenecStar%xn14(i) = Xj_i + case(7) + GenecStar%xn14(i) = Xj_i + case(8) + GenecStar%xo16(i) = Xj_i + case(9) + GenecStar%xo17(i) = Xj_i + case(10) + GenecStar%xo18(i) = Xj_i + case(11) + GenecStar%xne20(i) = Xj_i + case(12) + GenecStar%xne22(i) = Xj_i + case(13) + GenecStar%xmg24(i) = Xj_i + case(14) + GenecStar%xmg25(i) = Xj_i + case(15) + GenecStar%xmg26(i) = Xj_i + case(16) + GenecStar%xc14(i) = Xj_i + case(17) + GenecStar%xf18(i) = Xj_i + case(18) + GenecStar%xf19(i) = Xj_i + case(19) + GenecStar%xne21(i) = Xj_i + case(20) + GenecStar%xna23(i) = Xj_i + case(21) + GenecStar%xal26(i) = Xj_i + case(22) + GenecStar%xal27(i) = Xj_i + case(23) + GenecStar%xsi28(i) = Xj_i + case(24) + GenecStar%xneut(i) = Xj_i + case(25) + GenecStar%xprot(i) = Xj_i + case(26) + GenecStar%xbid(i) = Xj_i + case(27) + GenecStar%xbid1(i) = Xj_i + !case default + end select + end if + + set_mass_fraction_of_species_at_zone = 0 +end function + +function get_metallicity(metallicity) + implicit none + real(kindreal):: metallicity + integer:: get_metallicity + metallicity = InitialGenecStar%zini + get_metallicity = 0 +end function + +function set_metallicity(metallicity) + implicit none + real(kindreal):: metallicity + integer:: set_metallicity + InitialGenecStar%zini = metallicity + set_metallicity = 0 +end function + +function get_mu_at_zone(index_of_the_star, zone, mu_i) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: mu_i, X, Y3, Y + integer:: err + integer:: get_mu_at_zone + i = (GenecStar%m - zone) + if (zone <= GenecStar%m) then + mu_i = 0.0d0 + err = get_mass_fraction_of_species_at_zone(index_of_the_star, 1, zone, X) + err = get_mass_fraction_of_species_at_zone(index_of_the_star, 2, zone, Y3) + err = get_mass_fraction_of_species_at_zone(index_of_the_star, 3, zone, Y) + + mu_i = (4.0 / (2.0 + 6 * X - (Y+Y3))) + end if + get_mu_at_zone = 0 +end function + +function get_name_of_species(index_of_the_star, species, species_name) + implicit none + integer:: index_of_the_star + integer:: species + character(len = 6):: species_name + integer:: get_name_of_species + + character(len = 6), dimension(27):: species_names + + species_names(1) = 'h' + species_names(2) = 'he3' + species_names(3) = 'he' + species_names(4) = 'c12' + species_names(5) = 'c13' + species_names(6) = 'n14' + species_names(7) = 'n15' + species_names(8) = 'o16' + species_names(9) = 'o17' + species_names(10) = 'o18' + species_names(11) = 'ne20' + species_names(12) = 'ne22' + species_names(13) = 'mg24' + species_names(14) = 'mg25' + species_names(15) = 'mg26' + species_names(16) = 'c14' + species_names(17) = 'f18' + species_names(18) = 'f19' + species_names(19) = 'ne21' + species_names(20) = 'na23' + species_names(21) = 'al26' + species_names(22) = 'al27' + species_names(23) = 'si28' + species_names(24) = 'neut' + species_names(25) = 'prot' + species_names(26) = 'bid' + species_names(27) = 'bid1' + species_name = species_names(species) + !x: H1 + !y: He4 + !y3: He3 + !xneut: neutron + !xprot: proton + !xc12: C12 + !xXYY: XYY - X element YY mass number + !xXXYY: as above + get_name_of_species = 0 +end function + +function get_number_of_particles(n) + implicit none + integer:: n + integer:: get_number_of_particles + n = 1 + get_number_of_particles = 0 +end function + +function get_number_of_species(index_of_the_star, n_species) + implicit none + integer:: index_of_the_star + integer:: n_species + integer:: get_number_of_species + if (GenecStar%ialflu==1) then + n_species = 27 + else + n_species = 15 + end if + get_number_of_species = 0 +end function + +function get_firstlast_species_number(first, last) + implicit none + !integer:: index_of_the_star + integer:: first, last + integer:: get_firstlast_species_number + first = 1 + if (GenecStar%ialflu==1) then + last = 27 + else + last = 15 + end if + get_firstlast_species_number = 0 +end function + +function get_number_of_zones(index_of_the_star, n_zones) + implicit none + integer:: index_of_the_star + integer:: n_zones + integer:: get_number_of_zones + n_zones = GenecStar%m + get_number_of_zones = 0 +end function + +function set_number_of_zones(index_of_the_star, n_zones) + implicit none + integer:: index_of_the_star + integer:: n_zones + integer:: set_number_of_zones + GenecStar%m = n_zones + set_number_of_zones = 0 +end function + +function get_firstlast_zone(index_of_the_star, first, last) + implicit none + integer:: index_of_the_star + integer:: first, last + integer:: get_firstlast_zone + first = 0 + last = GenecStar%m-1 + get_firstlast_zone = 0 +end function + +function get_pressure_at_zone(index_of_the_star, zone, P_i) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: P_i + integer:: get_pressure_at_zone + if (zone <= GenecStar%m) then + i = GenecStar%m - zone + P_i = exp(GenecStar%p(i)) + end if + get_pressure_at_zone = 0 +end function + +!function set_pressure_at_zone(index_of_the_star, zone, P_i) +! use strucmod, only: p, m +! implicit none +! integer:: index_of_the_star +! integer:: zone, i +! real(kindreal):: P_i +! integer:: set_pressure_at_zone +! if (zone <= m) then +! i = m - zone +! p(i) = log(P_i) +! end if +! set_pressure_at_zone = 0 +!end function + +function get_radius(index_of_the_star, am_radius) + implicit none + integer:: index_of_the_star + real(kindreal):: am_radius + integer:: get_radius + am_radius = 10**GenecStar%radius + !radius = exp(r(1)) ! in cm + get_radius = 0 +end function + +function set_radius(index_of_the_star, am_radius) + implicit none + integer:: index_of_the_star + real(kindreal):: am_radius + integer:: set_radius + GenecStar%radius = log10(am_radius) + set_radius = 0 +end function + +function get_stellar_type(index_of_the_star, stellar_type) + implicit none + integer:: index_of_the_star + integer:: stellar_type + integer:: get_stellar_type + get_stellar_type = -1 +end function + +function get_temperature(index_of_the_star, temperature) + implicit none + integer:: index_of_the_star + real(kindreal):: temperature + integer:: get_temperature + temperature = GenecStar%teff + get_temperature = 0 +end function + +function get_temperature_at_zone(index_of_the_star, zone, T_i) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: T_i + integer:: get_temperature_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + T_i = exp(GenecStar%t(i)) + else + get_temperature_at_zone = -2 + return + end if + get_temperature_at_zone = 0 +end function + +function get_time_step(index_of_the_star, time_step) + implicit none + integer:: index_of_the_star + real(kindreal):: time_step + integer:: get_time_step + time_step = GenecStar%dzeitj + get_time_step = 0 +end function + +function get_time(time) + implicit none + real(kindreal):: time + integer:: get_time + time = GenecStar%alter + get_time = 0 +end function + +function new_particle(index_of_the_star, mass, metallicity, am_starname) + implicit none + integer:: index_of_the_star, key + real(kindreal):: mass, metallicity + integer:: new_particle + character(len=12):: am_starname + number_of_stars = number_of_stars + 1 + InitialGenecStar%starname = am_starname + InitialGenecStar%index_of_the_star = number_of_stars + InitialGenecStar%mstar = mass + InitialGenecStar%zini = metallicity + InitialGenecStar%idefaut = 1 + index_of_the_star = InitialGenecStar%index_of_the_star + + new_particle = 0 +end function + +!function new_stellar_model(& +! integer_of_the_star,& +! initialised, starname, nwseq, modanf, nzmod, end_at_phase, end_at_model, irot, isol, imagn, ialflu, ianiso, ipop3,& +! ibasnet, phase, var_rates, bintide, binm2, periodini, const_per, iprezams, zinit, zsol, z, iopac, ikappa, idiff, iadvec,& +! istati, icoeff, fenerg, richac, igamma, frein, K_Kawaler, Omega_saturation, rapcrilim, vwant, xfom, omega, xdial, idialo,& +! idialu, Add_Flux, diff_only, B_initial, add_diff, n_mag, alpha_F, nsmooth, qminsmooth, imloss, fmlos, ifitm, fitm, fitmi,& +! deltal, deltat, nndr, RSG_Mdot, SupraEddMdot, Be_mdotfrac, start_mdot, iledou, idifcon, iover, elph, my, dovhp, iunder,& +! dunder, gkorm, alph, agdr, faktor, dgrp, dgrl, dgry, dgrc, dgro, dgr20, nbchx, nrband, xcn, islow, icncst, tauH_fit,& +! display_plot, iauto, iprn, iout, itmin, xyfiles, idebug, itests, verbose, stop_deg, n_snap,& +! m,gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,dm_lost,& +! mbelx,xtefflast,xllast,xrholast,xclast,xtclast,inum,nsugi,period,r_core,vna,vnr,& +! q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& +! xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& +! vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26,vxneut,vxprot,vomegi,& +! vxbid,vxbid1,& +! abelx,vabelx& +! ) +! implicit none +! integer:: integer_of_the_star +! logical, intent(in):: & +! initialised,var_rates,bintide,const_per,Add_Flux,diff_only,qminsmooth,SupraEddMdot,display_plot,xyfiles,verbose,& +! stop_deg +! integer, intent(in):: & +! nwseq,modanf,nzmod,end_at_phase,end_at_model,irot,isol,imagn,ialflu,ianiso,ipop3,ibasnet,phase,iprezams,iopac,ikappa,& +! idiff,iadvec,istati,icoeff,igamma,idialo,idialu,n_mag,nsmooth,imloss,ifitm,nndr,RSG_Mdot,iledou,idifcon,iover,my,& +! iunder,nbchx,nrband,islow,icncst,tauH_fit,iauto,iprn,iout,itmin,idebug,itests,n_snap +! real(kindreal), intent(in):: & +! binm2,periodini,zinit,zsol,z,fenerg,richac,frein,K_Kawaler,Omega_saturation,rapcrilim,vwant,xfom,omega,xdial,& +! B_initial,add_diff,alpha_F,fmlos,fitm,fitmi,deltal,deltat,Be_mdotfrac,start_mdot,elph,dovhp,dunder,gkorm,alph,& +! agdr,faktor,dgrp,dgrl,dgry,dgrc,dgro,dgr20,xcn +! character(len=200), intent(in):: & +! starname +! integer, intent(in) :: m +! real(kindreal), intent(in) :: & +! gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,& +! dm_lost +! !real(kindreal), dimension(ldi) :: & +! integer, intent(in):: mbelx +! integer, intent(in):: inum,nsugi +! real(kindreal), intent(in):: & +! xtefflast,xllast,xrholast,xclast,xtclast,period,r_core,vna,vnr +! real(kindreal), dimension(m), intent(in):: & +! q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& +! xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& +! vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26,vxneut,vxprot,vomegi,& +! vxbid,vxbid1 +! real(kindreal), dimension(mbelx,m), intent(in):: & +! abelx,vabelx +! integer:: new_stellar_model +! +! GenecStar%initialised = initialised +! GenecStar%starname = starname +! !GenecStar%nwmd = nwmd +! GenecStar%nwseq = nwseq +! GenecStar%modanf = modanf +! GenecStar%nzmod = nzmod +! GenecStar%end_at_phase = end_at_phase +! GenecStar%end_at_model = end_at_model +! GenecStar%irot = irot +! GenecStar%isol = isol +! GenecStar%imagn = imagn +! GenecStar%ialflu = ialflu +! GenecStar%ianiso = ianiso +! GenecStar%ipop3 = ipop3 +! GenecStar%ibasnet = ibasnet +! GenecStar%phase = phase +! GenecStar%iprezams = iprezams +! GenecStar%var_rates = var_rates +! GenecStar%bintide = bintide +! GenecStar%binm2 = binm2 +! GenecStar%periodini = periodini +! GenecStar%const_per = const_per +! GenecStar%iopac = iopac +! GenecStar%ikappa = ikappa +! GenecStar%zinit = zinit +! GenecStar%zsol = zsol +! GenecStar%z = z +! GenecStar%idiff = idiff +! GenecStar%iadvec = iadvec +! GenecStar%istati = istati +! GenecStar%icoeff = icoeff +! GenecStar%igamma = igamma +! GenecStar%idialo = idialo +! GenecStar%idialu = idialu +! GenecStar%n_mag = n_mag +! GenecStar%nsmooth = nsmooth +! GenecStar%fenerg = fenerg +! GenecStar%richac = richac +! GenecStar%frein = frein +! GenecStar%K_Kawaler = K_Kawaler +! GenecStar%Omega_saturation = Omega_saturation +! GenecStar%rapcrilim = rapcrilim +! GenecStar%vwant = vwant +! GenecStar%xfom = xfom +! GenecStar%omega = omega +! GenecStar%xdial = xdial +! GenecStar%B_initial = B_initial +! GenecStar%add_diff = add_diff +! GenecStar%alpha_F = alpha_F +! GenecStar%Add_Flux = Add_Flux +! GenecStar%diff_only = diff_only +! GenecStar%qminsmooth = qminsmooth +! GenecStar%imloss = imloss +! GenecStar%ifitm = ifitm +! GenecStar%nndr = nndr +! GenecStar%RSG_Mdot = RSG_Mdot +! GenecStar%fmlos = fmlos +! GenecStar%fitm = fitm +! GenecStar%fitmi = fitmi +! GenecStar%deltal = deltal +! GenecStar%deltat = deltat +! GenecStar%Be_mdotfrac = Be_mdotfrac +! GenecStar%start_mdot = start_mdot +! GenecStar%SupraEddMdot = SupraEddMdot +! GenecStar%iledou = iledou +! GenecStar%idifcon = idifcon +! GenecStar%my = my +! GenecStar%iover = iover +! GenecStar%iunder = iunder +! GenecStar%elph = elph +! GenecStar%dovhp = dovhp +! GenecStar%dunder = dunder +! GenecStar%nbchx = nbchx +! GenecStar%nrband = nrband +! GenecStar%gkorm = gkorm +! GenecStar%alph = alph +! GenecStar%agdr = agdr +! GenecStar%faktor = faktor +! GenecStar%dgrp = dgrp +! GenecStar%dgrl = dgrl +! GenecStar%dgry = dgry +! GenecStar%dgrc = dgrc +! GenecStar%dgro = dgro +! GenecStar%dgr20 = dgr20 +! GenecStar%islow = islow +! GenecStar%icncst = icncst +! GenecStar%tauH_fit = tauH_fit +! GenecStar%xcn = xcn +! GenecStar%iauto = iauto +! GenecStar%iprn = iprn +! GenecStar%iout = iout +! GenecStar%itmin = itmin +! GenecStar%idebug = idebug +! GenecStar%itests = itests +! GenecStar%n_snap = n_snap +! GenecStar%display_plot = display_plot +! GenecStar%xyfiles = xyfiles +! GenecStar%verbose = verbose +! GenecStar%stop_deg = stop_deg +! +! GenecStar%m = m +! GenecStar%gms = gms +! GenecStar%alter = alter +! GenecStar%gls = gls +! GenecStar%teff = teff +! GenecStar%glsv = glsv +! GenecStar%teffv = teffv +! GenecStar%dzeitj = dzeitj +! GenecStar%dzeit = dzeit +! GenecStar%dzeitv = dzeitv +! GenecStar%summas = summas +! GenecStar%xmini = xmini +! GenecStar%ab = ab +! GenecStar%dm_lost = dm_lost +! +! GenecStar%mbelx = mbelx +! GenecStar%xteffprev = xteffprev +! GenecStar%xlprev = xlprev +! GenecStar%xrhoprev = xrhoprev +! GenecStar%xcprev = xcprev +! GenecStar%xtcprev = xtcprev +! GenecStar%inum = inum +! GenecStar%nsugi = nsugi +! GenecStar%period = period +! GenecStar%r_core = r_core +! GenecStar%vna = vna +! GenecStar%vnr = vnr +! +! GenecStar%q = q +! GenecStar%p = p +! GenecStar%t = t +! GenecStar%r = r +! GenecStar%s = s +! GenecStar%x = x +! GenecStar%y = y +! GenecStar%xc12 = xc12 +! GenecStar%vp = vp +! GenecStar%vt = vt +! GenecStar%vr = vr +! GenecStar%vs = vs +! GenecStar%xo16 = xo16 +! GenecStar%vx = vx +! GenecStar%vy = vy +! GenecStar%vxc12 = vxc12 +! GenecStar%vxo16 = vxo16 +! GenecStar%y3 = y3 +! GenecStar%xc13 = xc13 +! GenecStar%xn14 = xn14 +! GenecStar%xn15 = xn15 +! GenecStar%xo17 = xo17 +! GenecStar%xo18 = xo18 +! GenecStar%vy3 = vy3 +! GenecStar%vxc13 = vxc13 +! GenecStar%vxn14 = vxn14 +! GenecStar%vxn15 = vxn15 +! GenecStar%vxo17 = vxo17 +! GenecStar%vxo18 = vxo18 +! GenecStar%xne20 = xne20 +! GenecStar%xne22 = xne22 +! GenecStar%xmg24 = xmg24 +! GenecStar%xmg25 = xmg25 +! GenecStar%xmg26 = xmg26 +! GenecStar%vxne20 = vxne20 +! GenecStar%vxne22 = vxne22 +! GenecStar%vxmg24 = vxmg24 +! GenecStar%vxmg25 = vxmg25 +! GenecStar%vxmg26 = vxmg26 +! GenecStar%omegi = omegi +! GenecStar%vomegi = vomegi +! GenecStar%xf19 = xf19 +! GenecStar%xne21 = xne21 +! GenecStar%xna23 = xna23 +! GenecStar%xal26 = xal26 +! GenecStar%xal27 = xal27 +! GenecStar%xsi28 = xsi28 +! GenecStar%vxf19 = vxf19 +! GenecStar%vxne21 = vxne21 +! GenecStar%vxna23 = vxna23 +! GenecStar%vxal26 = vxal26 +! GenecStar%vxal27 = vxal27 +! GenecStar%vxsi28 = vxsi28 +! GenecStar%xneut = xneut +! GenecStar%xprot = xprot +! GenecStar%xc14 = xc14 +! GenecStar%xf18 = xf18 +! GenecStar%xbid = xbid +! GenecStar%xbid1 = xbid1 +! GenecStar%vxneut = vxneut +! GenecStar%vxprot = vxprot +! GenecStar%vxc14 = vxc14 +! GenecStar%vxf18 = vxf18 +! GenecStar%vxbid = vxbid +! GenecStar%vxbid1 = vxbid1 +! +! GenecStar%abelx = abelx +! GenecStar%vabelx = vabelx +! +! new_stellar_model = 0 +!end function + +function recommit_parameters() + implicit none + integer:: recommit_parameters + recommit_parameters = 0 +end function + +function recommit_particles() + use genec, only: initialise_star + implicit none + integer:: recommit_particles + !write(*,*) "copy from GenecStar" + !call copy_from_genec_star(GenecStar) + + ! "read" GENEC star namelists + write(*,*) "call copy_namelists_from_genec_star(GenecStar)" + call copy_namelists_from_genec_star(GenecStar) + ! Initialise values not in GENEC star + ! but this also resets some values that are read, so... + write(*,*) 'call initialise_star()' + call initialise_star() + ! "read" the GENEC star structure + write(*,*) 'call copy_structure_from_genec_star(GenecStar)' + call copy_structure_from_genec_star(GenecStar) + ! and then copy back - some things may have changed? + write(*,*) 'call copy_to_genec_star(GenecStar)' + call copy_to_genec_star(GenecStar) + recommit_particles = 0 +end function + +function set_genec_path(path) + use evol, only: input_dir + implicit none + character(len=200):: path + integer:: set_genec_path + + input_dir = path + set_genec_path = 0 +end function + +function set_temperature_at_zone(index_of_the_star, zone, T_i) + implicit none + integer:: index_of_the_star + integer:: zone, i + real(kindreal):: T_i + integer:: set_temperature_at_zone + i = GenecStar%m - zone + if (zone <= GenecStar%m) then + GenecStar%t(i) = log(T_i) + end if + + set_temperature_at_zone = 0 +end function + + + + + +!!!!!!!!! +integer function get_veryFirst(index_of_the_particle, veryFirst) + implicit none + integer, intent(in):: index_of_the_particle + logical, intent(out):: veryFirst + veryFirst = GenecStar%veryFirst + get_veryFirst = 0 +end function get_veryFirst + +integer function set_veryFirst(index_of_the_particle, veryFirst) + implicit none + integer, intent(in):: index_of_the_particle + logical, intent(in):: veryFirst + GenecStar%veryFirst = veryFirst + set_veryFirst = 0 +end function set_veryFirst + +integer function get_initialised(index_of_the_particle, initialised) + implicit none + integer, intent(in):: index_of_the_particle + logical, intent(out):: initialised + initialised = GenecStar%initialised + get_initialised = 0 +end function get_initialised + +integer function set_initialised(index_of_the_particle, initialised) + implicit none + integer, intent(in):: index_of_the_particle + logical, intent(in):: initialised + GenecStar%initialised = initialised + set_initialised = 0 +end function set_initialised + +integer function get_starname(index_of_the_particle, starname) + implicit none + integer, intent(in):: index_of_the_particle + character(256), intent(out):: starname + starname = GenecStar%starname + get_starname = 0 +end function get_starname + +integer function set_starname(index_of_the_particle, starname) + implicit none + integer, intent(in):: index_of_the_particle + character(256), intent(in):: starname + GenecStar%starname = starname + set_starname = 0 +end function set_starname + +integer function get_nwmd(index_of_the_particle, nwmd) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: nwmd + nwmd = GenecStar%nwmd + get_nwmd = 0 +end function get_nwmd + +integer function set_nwmd(index_of_the_particle, nwmd) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: nwmd + GenecStar%nwmd = nwmd + set_nwmd = 0 +end function set_nwmd + +integer function get_nwseq(index_of_the_particle, nwseq) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: nwseq + nwseq = GenecStar%nwseq + get_nwseq = 0 +end function get_nwseq + +integer function set_nwseq(index_of_the_particle, nwseq) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: nwseq + GenecStar%nwseq = nwseq + set_nwseq = 0 +end function set_nwseq + +integer function get_modanf(index_of_the_particle, modanf) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: modanf + modanf = GenecStar%modanf + get_modanf = 0 +end function get_modanf + +integer function set_modanf(index_of_the_particle, modanf) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: modanf + GenecStar%modanf = modanf + set_modanf = 0 +end function set_modanf + +integer function get_nzmod(index_of_the_particle, nzmod) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: nzmod + nzmod = GenecStar%nzmod + get_nzmod = 0 +end function get_nzmod + +integer function set_nzmod(index_of_the_particle, nzmod) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: nzmod + GenecStar%nzmod = nzmod + set_nzmod = 0 +end function set_nzmod + +integer function get_end_at_phase(index_of_the_particle, end_at_phase) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: end_at_phase + end_at_phase = GenecStar%end_at_phase + get_end_at_phase = 0 +end function get_end_at_phase + +integer function set_end_at_phase(index_of_the_particle, end_at_phase) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: end_at_phase + GenecStar%end_at_phase = end_at_phase + set_end_at_phase = 0 +end function set_end_at_phase + +integer function get_end_at_model(index_of_the_particle, end_at_model) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: end_at_model + end_at_model = GenecStar%end_at_model + get_end_at_model = 0 +end function get_end_at_model + +integer function set_end_at_model(index_of_the_particle, end_at_model) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: end_at_model + GenecStar%end_at_model = end_at_model + set_end_at_model = 0 +end function set_end_at_model + +integer function get_irot(index_of_the_particle, irot) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: irot + irot = GenecStar%irot + get_irot = 0 +end function get_irot + +integer function set_irot(index_of_the_particle, irot) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: irot + GenecStar%irot = irot + set_irot = 0 +end function set_irot + +integer function get_isol(index_of_the_particle, isol) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: isol + isol = GenecStar%isol + get_isol = 0 +end function get_isol + +integer function set_isol(index_of_the_particle, isol) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: isol + GenecStar%isol = isol + set_isol = 0 +end function set_isol + +integer function get_imagn(index_of_the_particle, imagn) implicit none integer, intent(in):: index_of_the_particle integer, intent(out):: imagn @@ -1643,9 +2753,6 @@ integer function set_n_snap(index_of_the_particle, n_snap) set_n_snap = 0 end function set_n_snap -! **** End Parameters - -! **** Begin Properties integer function get_m(index_of_the_particle, m) implicit none integer, intent(in):: index_of_the_particle @@ -1852,1942 +2959,2762 @@ integer function set_ab(index_of_the_particle, ab) real(kindreal), intent(in):: ab GenecStar%ab = ab set_ab = 0 -end function set_ab - -integer function get_dm_lost(index_of_the_particle, dm_lost) - implicit none - integer, intent(in):: index_of_the_particle - real(kindreal), intent(out):: dm_lost - dm_lost = GenecStar%dm_lost - get_dm_lost = 0 -end function get_dm_lost - -integer function set_dm_lost(index_of_the_particle, dm_lost) - implicit none - integer, intent(in):: index_of_the_particle - real(kindreal), intent(in):: dm_lost - GenecStar%dm_lost = dm_lost - set_dm_lost = 0 -end function set_dm_lost - -! **** End Properties - - -function finalize_stellar_model() - implicit none - integer:: finalize_stellar_model - call copy_to_genec_star(GenecStar) - finalize_stellar_model = 0 -end function - -function commit_parameters() - implicit none - integer:: commit_parameters - commit_parameters = 0 -end function - -function commit_particles() - use makeini, only: make_initial_star - use genec, only: initialise_star - use WriteSaveClose, only: OpenAll - use inputparam, only: nzmod - implicit none - integer:: commit_particles - ! makeini will actually override some things from set_defaults now! FIXME - call make_initial_star() - call copy_from_genec_star(GenecStar) - - !nzmod = 1 - !write(*,*) 'makeini done' - !call OpenAll() - !write(*,*) 'OpenAll done' - call initialise_star() - !call copy_network_to_star(InitialNetwork, GenecStar) - call copy_to_genec_star(GenecStar) - !write(*,*) 'initialise_star done' - commit_particles = 0 -end function - -function delete_star(index_of_the_star) - implicit none - integer:: index_of_the_star - integer:: delete_star - delete_star = -1 ! not supported -end function - -function evolve_model(end_time) - use timestep, only: alter - implicit none - real(kindreal):: end_time - integer:: evolve_model - !stopping_condition = "" - - do while (alter < end_time) - !if (stopping_condition == "") then - write(*,*) "Current time: ", alter, ", evolving to: ", end_time - evolve_model = evolve_one_step(0) - end do - evolve_model = 0 -end function - -function evolve_for(index_of_the_star, time) - ! get current time - ! set max time to current time plus argument - ! evolve - use timestep, only: alter - implicit none - integer:: index_of_the_star - real(kindreal):: time, end_time - integer:: evolve_for - end_time = alter+time - do while (alter < end_time) - write(*,*) "Current time: ", alter, ", evolving to: ", end_time - evolve_for = evolve_one_step(index_of_the_star) - end do - - evolve_for = 0 -end function +end function set_ab -function evolve_one_step(index_of_the_star) - use timestep, only: alter - use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise, veryFirst - use inputparam,only: modanf,nwseq,nzmod,end_at_phase,end_at_model - use genec, only: n_snap +integer function get_dm_lost(index_of_the_particle, dm_lost) implicit none - integer:: index_of_the_star - integer:: evolve_one_step - integer:: original_nzmod - nzmod = 1 - n_snap = 0 + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dm_lost + dm_lost = GenecStar%dm_lost + get_dm_lost = 0 +end function get_dm_lost - call evolve() - call finalise() - veryFirst = .false. - evolve_one_step = 0 -end function +integer function set_dm_lost(index_of_the_particle, dm_lost) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dm_lost + GenecStar%dm_lost = dm_lost + set_dm_lost = 0 +end function set_dm_lost -function write_genec_model() - !use inputparam, only: modanf - !use WriteSaveClose, only: OpenAll - !use genec, only: finalise - !use helpers, only: initialise_star +integer function get_mbelx(index_of_the_particle, mbelx) implicit none - integer:: write_genec_model - !call finalise() - ! modanf = 0 - !call OpenAll() - !call initialise_star() - !call finalise() - !call OpenAll() - !call initialise_star() - write_genec_model = -1 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: mbelx + mbelx = GenecStar%mbelx + get_mbelx = 0 +end function get_mbelx -function get_age(index_of_the_star, age) +integer function set_mbelx(index_of_the_particle, mbelx) implicit none - integer:: index_of_the_star - real(kindreal):: age - integer:: get_age - age = GenecStar%alter - get_age = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: mbelx + GenecStar%mbelx = mbelx + set_mbelx = 0 +end function set_mbelx -function set_age(index_of_the_star, age) +integer function get_xtefflast(index_of_the_particle, xtefflast) implicit none - integer:: index_of_the_star - real(kindreal):: age - integer:: set_age - GenecStar%alter = age - set_age = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xtefflast + xtefflast = GenecStar%xtefflast + get_xtefflast = 0 +end function get_xtefflast -function get_surface_velocity(index_of_the_star, surface_velocity) - use genec, only: vequat +integer function set_xtefflast(index_of_the_particle, xtefflast) implicit none - integer:: index_of_the_star - real(kindreal):: surface_velocity - integer:: get_surface_velocity - surface_velocity = vequat - get_surface_velocity = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xtefflast + GenecStar%xtefflast = xtefflast + set_xtefflast = 0 +end function set_xtefflast -function get_omegi_at_zone(index_of_the_star, zone, omegi_i) +integer function get_xllast(index_of_the_particle, xllast) implicit none - integer:: index_of_the_star - integer:: get_omegi_at_zone - real(kindreal):: omegi_i - integer:: zone, i - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - omegi_i = GenecStar%omegi(i) - end if - get_omegi_at_zone = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xllast + xllast = GenecStar%xllast + get_xllast = 0 +end function get_xllast -function get_density_at_zone(index_of_the_star, zone, rho_i) - use strucmod, only: rho +integer function set_xllast(index_of_the_particle, xllast) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: rho_i - integer:: get_density_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - rho_i = exp(rho(i)) - end if - get_density_at_zone = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xllast + GenecStar%xllast = xllast + set_xllast = 0 +end function set_xllast -function set_density_at_zone(index_of_the_star, zone, rho_i) - use strucmod, only: rho +integer function get_xrholast(index_of_the_particle, xrholast) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: rho_i - integer:: set_density_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - rho(i) = log(rho_i) - end if - set_density_at_zone = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xrholast + xrholast = GenecStar%xrholast + get_xrholast = 0 +end function get_xrholast -function get_luminosity(index_of_the_star, luminosity) +integer function set_xrholast(index_of_the_particle, xrholast) implicit none - integer:: index_of_the_star - real(kindreal):: luminosity - integer:: get_luminosity - !luminosity = exp(s(m)) ! in cgs units, so erg/s? - luminosity = GenecStar%gls - get_luminosity = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xrholast + GenecStar%xrholast = xrholast + set_xrholast = 0 +end function set_xrholast -function set_luminosity(index_of_the_star, luminosity) +integer function get_xclast(index_of_the_particle, xclast) implicit none - integer:: index_of_the_star - real(kindreal):: luminosity - integer:: set_luminosity - !luminosity = exp(s(m)) ! in cgs units, so erg/s? - GenecStar%gls = luminosity - set_luminosity = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xclast + xclast = GenecStar%xclast + get_xclast = 0 +end function get_xclast -function get_luminosity_at_zone(index_of_the_star, zone, lum_i) +integer function set_xclast(index_of_the_particle, xclast) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: lum_i - integer:: get_luminosity_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - !lum_i = exp(s(zone+1)) - lum_i = exp(GenecStar%s(i)) - 1 - end if - get_luminosity_at_zone = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xclast + GenecStar%xclast = xclast + set_xclast = 0 +end function set_xclast -function set_luminosity_at_zone(index_of_the_star, zone, lum_i) +integer function get_xtclast(index_of_the_particle, xtclast) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: lum_i - integer:: set_luminosity_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - GenecStar%s(i) = log(lum_i + 1) - end if - set_luminosity_at_zone = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xtclast + xtclast = GenecStar%xtclast + get_xtclast = 0 +end function get_xtclast -function get_mass_fraction_at_zone(index_of_the_star, zone, dq_i) +integer function set_xtclast(index_of_the_particle, xtclast) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: dq_i - integer:: get_mass_fraction_at_zone - i = GenecStar%m - zone - if (i == 1) then - dq_i = exp(GenecStar%q(i)) - else if (i <= GenecStar%m) then - !dq_i = 1-exp(q(zone+1)) - dq_i = (exp(GenecStar%q(i)) - exp(GenecStar%q(i-1))) - end if - get_mass_fraction_at_zone = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xtclast + GenecStar%xtclast = xtclast + set_xtclast = 0 +end function set_xtclast -function set_mass_fraction_at_zone(index_of_the_star, zone, dq_i) +integer function get_inum(index_of_the_particle, inum) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: dq_i - integer:: set_mass_fraction_at_zone - i = GenecStar%m - zone - if (i == 1) then - GenecStar%q(i) = log(dq_i) - else if (i <= GenecStar%m) then - !dq_i = 1-exp(q(zone+1)) - GenecStar%q(i) = log(exp(GenecStar%q(i-1)) + dq_i) ! this won't do - end if - set_mass_fraction_at_zone = -1 ! This function is incomplete! -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: inum + inum = GenecStar%inum + get_inum = 0 +end function get_inum -function get_mass(index_of_the_star, mass) +integer function set_inum(index_of_the_particle, inum) implicit none - real(kindreal):: mass - integer:: get_mass, index_of_the_star - mass = GenecStar%gms - get_mass = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: inum + GenecStar%inum = inum + set_inum = 0 +end function set_inum -function set_mass(index_of_the_star, mass) +integer function get_nsugi(index_of_the_particle, nsugi) implicit none - integer:: set_mass, index_of_the_star - real(kindreal):: mass - InitialGenecStar%mstar = mass - set_mass = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(out):: nsugi + nsugi = GenecStar%nsugi + get_nsugi = 0 +end function get_nsugi -function get_mass_of_species(index_of_the_star, species, species_mass) +integer function set_nsugi(index_of_the_particle, nsugi) implicit none - integer:: index_of_the_star - integer:: species - real(kindreal):: species_mass - integer:: get_mass_of_species - get_mass_of_species = 0 - select case(species) - case(1) - species_mass = 1. - case(2) - species_mass = 3. - case(3) - species_mass = 4. - case(4) - species_mass = 12. - case(5) - species_mass = 13. - case(6) - species_mass = 14. - case(7) - species_mass = 15. - case(8) - species_mass = 16. - case(9) - species_mass = 17. - case(10) - species_mass = 18. - case(11) - species_mass = 20. - case(12) - species_mass = 22. - case(13) - species_mass = 24. - case(14) - species_mass = 25. - case(15) - species_mass = 26. - case(16) - species_mass = 14. - case(17) - species_mass = 18. - case(18) - species_mass = 19. - case(19) - species_mass = 21. - case(20) - species_mass = 23. - case(21) - species_mass = 26. - case(22) - species_mass = 27. - case(23) - species_mass = 28. - case(24) - species_mass = 1. !neut(i) - case(25) - species_mass = 1. !prot(i) -! case(26) -! species_mass = bid(i) -! case(27) -! species_mass = bid1(i) - case default - species_mass = 0. - end select -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: nsugi + GenecStar%nsugi = nsugi + set_nsugi = 0 +end function set_nsugi -function get_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) +integer function get_period(index_of_the_particle, period) implicit none - integer:: index_of_the_star - integer:: species, zone, i - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_species_at_zone - i = GenecStar%m-zone - if (zone <= GenecStar%m) then - select case(species) - case(1) - Xj_i = GenecStar%x(i) - case(2) - Xj_i = GenecStar%y3(i) - case(3) - Xj_i = GenecStar%y(i) - case(4) - Xj_i = GenecStar%xc12(i) - case(5) - Xj_i = GenecStar%xc13(i) - case(6) - Xj_i = GenecStar%xn14(i) - case(7) - Xj_i = GenecStar%xn15(i) - case(8) - Xj_i = GenecStar%xo16(i) - case(9) - Xj_i = GenecStar%xo17(i) - case(10) - Xj_i = GenecStar%xo18(i) - case(11) - Xj_i = GenecStar%xne20(i) - case(12) - Xj_i = GenecStar%xne22(i) - case(13) - Xj_i = GenecStar%xmg24(i) - case(14) - Xj_i = GenecStar%xmg25(i) - case(15) - Xj_i = GenecStar%xmg26(i) - case(16) - Xj_i = GenecStar%xc14(i) - case(17) - Xj_i = GenecStar%xf18(i) - case(18) - Xj_i = GenecStar%xf19(i) - case(19) - Xj_i = GenecStar%xne21(i) - case(20) - Xj_i = GenecStar%xna23(i) - case(21) - Xj_i = GenecStar%xal26(i) - case(22) - Xj_i = GenecStar%xal27(i) - case(23) - Xj_i = GenecStar%xsi28(i) - case(24) - Xj_i = GenecStar%xneut(i) - case(25) - Xj_i = GenecStar%xprot(i) - case(26) - Xj_i = GenecStar%xbid(i) - case(27) - Xj_i = GenecStar%xbid1(i) - case default - Xj_i = 0 - end select - end if + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: period + period = GenecStar%period + get_period = 0 +end function get_period - get_mass_fraction_of_species_at_zone = 0 -end function +integer function set_period(index_of_the_particle, period) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: period + GenecStar%period = period + set_period = 0 +end function set_period -function set_mass_fraction_of_species_at_zone(index_of_the_star, species, zone, Xj_i) +integer function get_r_core(index_of_the_particle, r_core) implicit none - integer:: index_of_the_star - integer:: species, zone, i - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_species_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - select case(species) - case(1) - GenecStar%x(i) = Xj_i - case(2) - GenecStar%y3(i) = Xj_i - case(3) - GenecStar%y(i) = Xj_i - case(4) - GenecStar%xc12(i) = Xj_i - case(5) - GenecStar%xc13(i) = Xj_i - case(6) - GenecStar%xn14(i) = Xj_i - case(7) - GenecStar%xn14(i) = Xj_i - case(8) - GenecStar%xo16(i) = Xj_i - case(9) - GenecStar%xo17(i) = Xj_i - case(10) - GenecStar%xo18(i) = Xj_i - case(11) - GenecStar%xne20(i) = Xj_i - case(12) - GenecStar%xne22(i) = Xj_i - case(13) - GenecStar%xmg24(i) = Xj_i - case(14) - GenecStar%xmg25(i) = Xj_i - case(15) - GenecStar%xmg26(i) = Xj_i - case(16) - GenecStar%xc14(i) = Xj_i - case(17) - GenecStar%xf18(i) = Xj_i - case(18) - GenecStar%xf19(i) = Xj_i - case(19) - GenecStar%xne21(i) = Xj_i - case(20) - GenecStar%xna23(i) = Xj_i - case(21) - GenecStar%xal26(i) = Xj_i - case(22) - GenecStar%xal27(i) = Xj_i - case(23) - GenecStar%xsi28(i) = Xj_i - case(24) - GenecStar%xneut(i) = Xj_i - case(25) - GenecStar%xprot(i) = Xj_i - case(26) - GenecStar%xbid(i) = Xj_i - case(27) - GenecStar%xbid1(i) = Xj_i - !case default - end select + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: r_core + r_core = GenecStar%r_core + get_r_core = 0 +end function get_r_core + +integer function set_r_core(index_of_the_particle, r_core) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: r_core + GenecStar%r_core = r_core + set_r_core = 0 +end function set_r_core + +integer function get_vna(index_of_the_particle, vna) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: vna + vna = GenecStar%vna + get_vna = 0 +end function get_vna + +integer function set_vna(index_of_the_particle, vna) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: vna + GenecStar%vna = vna + set_vna = 0 +end function set_vna + +integer function get_vnr(index_of_the_particle, vnr) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: vnr + vnr = GenecStar%vnr + get_vnr = 0 +end function get_vnr + +integer function set_vnr(index_of_the_particle, vnr) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: vnr + GenecStar%vnr = vnr + set_vnr = 0 +end function set_vnr + +integer function get_q_at_zone(index_of_the_particle, zone, q) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: q + integer:: i + get_q_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + q = GenecStar%q(i) + get_q_at_zone = 0 end if +end function get_q_at_zone - set_mass_fraction_of_species_at_zone = 0 -end function +integer function set_q_at_zone(index_of_the_particle, zone, q) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: q + integer:: i + set_q_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%q(i) = q + set_q_at_zone = 0 + end if +end function set_q_at_zone -function get_metallicity(metallicity) +integer function get_p_at_zone(index_of_the_particle, zone, p) implicit none - real(kindreal):: metallicity - integer:: get_metallicity - metallicity = InitialGenecStar%zini - get_metallicity = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: p + integer:: i + get_p_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + p = GenecStar%p(i) + get_p_at_zone = 0 + end if +end function get_p_at_zone -function set_metallicity(metallicity) +integer function set_p_at_zone(index_of_the_particle, zone, p) implicit none - real(kindreal):: metallicity - integer:: set_metallicity - InitialGenecStar%zini = metallicity - set_metallicity = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: p + integer:: i + set_p_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%p(i) = p + set_p_at_zone = 0 + end if +end function set_p_at_zone -function get_mu_at_zone(index_of_the_star, zone, mu_i) +integer function get_t_at_zone(index_of_the_particle, zone, t) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: mu_i, X, Y3, Y - integer:: err - integer:: get_mu_at_zone - i = (GenecStar%m - zone) - if (zone <= GenecStar%m) then - mu_i = 0.0d0 - err = get_mass_fraction_of_species_at_zone(index_of_the_star, 1, zone, X) - err = get_mass_fraction_of_species_at_zone(index_of_the_star, 2, zone, Y3) - err = get_mass_fraction_of_species_at_zone(index_of_the_star, 3, zone, Y) + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: t + integer:: i + get_t_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + t = GenecStar%t(i) + get_t_at_zone = 0 + end if +end function get_t_at_zone - mu_i = (4.0 / (2.0 + 6 * X - (Y+Y3))) +integer function set_t_at_zone(index_of_the_particle, zone, t) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: t + integer:: i + set_t_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%t(i) = t + set_t_at_zone = 0 end if - get_mu_at_zone = 0 -end function +end function set_t_at_zone -function get_name_of_species(index_of_the_star, species, species_name) +integer function get_r_at_zone(index_of_the_particle, zone, r) implicit none - integer:: index_of_the_star - integer:: species - character(len = 6):: species_name - integer:: get_name_of_species + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: r + integer:: i + get_r_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + r = GenecStar%r(i) + get_r_at_zone = 0 + end if +end function get_r_at_zone - character(len = 6), dimension(27):: species_names +integer function set_r_at_zone(index_of_the_particle, zone, r) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: r + integer:: i + set_r_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%r(i) = r + set_r_at_zone = 0 + end if +end function set_r_at_zone - species_names(1) = 'h' - species_names(2) = 'he3' - species_names(3) = 'he' - species_names(4) = 'c12' - species_names(5) = 'c13' - species_names(6) = 'n14' - species_names(7) = 'n15' - species_names(8) = 'o16' - species_names(9) = 'o17' - species_names(10) = 'o18' - species_names(11) = 'ne20' - species_names(12) = 'ne22' - species_names(13) = 'mg24' - species_names(14) = 'mg25' - species_names(15) = 'mg26' - species_names(16) = 'c14' - species_names(17) = 'f18' - species_names(18) = 'f19' - species_names(19) = 'ne21' - species_names(20) = 'na23' - species_names(21) = 'al26' - species_names(22) = 'al27' - species_names(23) = 'si28' - species_names(24) = 'neut' - species_names(25) = 'prot' - species_names(26) = 'bid' - species_names(27) = 'bid1' - species_name = species_names(species) - !x: H1 - !y: He4 - !y3: He3 - !xneut: neutron - !xprot: proton - !xc12: C12 - !xXYY: XYY - X element YY mass number - !xXXYY: as above - get_name_of_species = 0 -end function +integer function get_s_at_zone(index_of_the_particle, zone, s) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: s + integer:: i + get_s_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + s = GenecStar%s(i) + get_s_at_zone = 0 + end if +end function get_s_at_zone -function get_mass_fraction_of_h_at_zone(index_of_the_star, zone, Xj_i) +integer function set_s_at_zone(index_of_the_particle, zone, s) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_h_at_zone - get_mass_fraction_of_h_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 1, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: s + integer:: i + set_s_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%s(i) = s + set_s_at_zone = 0 + end if +end function set_s_at_zone +integer function get_x_at_zone(index_of_the_particle, zone, x) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: x + integer:: i + get_x_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + x = GenecStar%x(i) + get_x_at_zone = 0 + end if +end function get_x_at_zone -function get_mass_fraction_of_he3_at_zone(index_of_the_star, zone, Xj_i) +integer function set_x_at_zone(index_of_the_particle, zone, x) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_he3_at_zone - get_mass_fraction_of_he3_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 2, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: x + integer:: i + set_x_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%x(i) = x + set_x_at_zone = 0 + end if +end function set_x_at_zone +integer function get_y3_at_zone(index_of_the_particle, zone, y3) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: y3 + integer:: i + get_y3_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + y3 = GenecStar%y3(i) + get_y3_at_zone = 0 + end if +end function get_y3_at_zone -function get_mass_fraction_of_he_at_zone(index_of_the_star, zone, Xj_i) +integer function set_y3_at_zone(index_of_the_particle, zone, y3) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_he_at_zone - get_mass_fraction_of_he_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 3, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: y3 + integer:: i + set_y3_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%y3(i) = y3 + set_y3_at_zone = 0 + end if +end function set_y3_at_zone +integer function get_y_at_zone(index_of_the_particle, zone, y) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: y + integer:: i + get_y_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + y = GenecStar%y(i) + get_y_at_zone = 0 + end if +end function get_y_at_zone -function get_mass_fraction_of_c12_at_zone(index_of_the_star, zone, Xj_i) +integer function set_y_at_zone(index_of_the_particle, zone, y) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_c12_at_zone - get_mass_fraction_of_c12_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 4, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: y + integer:: i + set_y_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%y(i) = y + set_y_at_zone = 0 + end if +end function set_y_at_zone +integer function get_xc12_at_zone(index_of_the_particle, zone, xc12) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xc12 + integer:: i + get_xc12_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xc12 = GenecStar%xc12(i) + get_xc12_at_zone = 0 + end if +end function get_xc12_at_zone -function get_mass_fraction_of_c13_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xc12_at_zone(index_of_the_particle, zone, xc12) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_c13_at_zone - get_mass_fraction_of_c13_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 5, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xc12 + integer:: i + set_xc12_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xc12(i) = xc12 + set_xc12_at_zone = 0 + end if +end function set_xc12_at_zone +integer function get_xc13_at_zone(index_of_the_particle, zone, xc13) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xc13 + integer:: i + get_xc13_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xc13 = GenecStar%xc13(i) + get_xc13_at_zone = 0 + end if +end function get_xc13_at_zone -function get_mass_fraction_of_n14_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xc13_at_zone(index_of_the_particle, zone, xc13) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_n14_at_zone - get_mass_fraction_of_n14_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 6, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xc13 + integer:: i + set_xc13_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xc13(i) = xc13 + set_xc13_at_zone = 0 + end if +end function set_xc13_at_zone +integer function get_xn14_at_zone(index_of_the_particle, zone, xn14) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xn14 + integer:: i + get_xn14_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xn14 = GenecStar%xn14(i) + get_xn14_at_zone = 0 + end if +end function get_xn14_at_zone -function get_mass_fraction_of_n15_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xn14_at_zone(index_of_the_particle, zone, xn14) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_n15_at_zone - get_mass_fraction_of_n15_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 7, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xn14 + integer:: i + set_xn14_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xn14(i) = xn14 + set_xn14_at_zone = 0 + end if +end function set_xn14_at_zone +integer function get_xn15_at_zone(index_of_the_particle, zone, xn15) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xn15 + integer:: i + get_xn15_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xn15 = GenecStar%xn15(i) + get_xn15_at_zone = 0 + end if +end function get_xn15_at_zone -function get_mass_fraction_of_o16_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xn15_at_zone(index_of_the_particle, zone, xn15) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_o16_at_zone - get_mass_fraction_of_o16_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 8, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xn15 + integer:: i + set_xn15_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xn15(i) = xn15 + set_xn15_at_zone = 0 + end if +end function set_xn15_at_zone +integer function get_xo16_at_zone(index_of_the_particle, zone, xo16) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xo16 + integer:: i + get_xo16_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xo16 = GenecStar%xo16(i) + get_xo16_at_zone = 0 + end if +end function get_xo16_at_zone -function get_mass_fraction_of_o17_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xo16_at_zone(index_of_the_particle, zone, xo16) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_o17_at_zone - get_mass_fraction_of_o17_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 9, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xo16 + integer:: i + set_xo16_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xo16(i) = xo16 + set_xo16_at_zone = 0 + end if +end function set_xo16_at_zone +integer function get_xo17_at_zone(index_of_the_particle, zone, xo17) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xo17 + integer:: i + get_xo17_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xo17 = GenecStar%xo17(i) + get_xo17_at_zone = 0 + end if +end function get_xo17_at_zone -function get_mass_fraction_of_o18_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xo17_at_zone(index_of_the_particle, zone, xo17) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_o18_at_zone - get_mass_fraction_of_o18_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 10, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xo17 + integer:: i + set_xo17_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xo17(i) = xo17 + set_xo17_at_zone = 0 + end if +end function set_xo17_at_zone +integer function get_xo18_at_zone(index_of_the_particle, zone, xo18) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xo18 + integer:: i + get_xo18_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xo18 = GenecStar%xo18(i) + get_xo18_at_zone = 0 + end if +end function get_xo18_at_zone -function get_mass_fraction_of_ne20_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xo18_at_zone(index_of_the_particle, zone, xo18) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_ne20_at_zone - get_mass_fraction_of_ne20_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 11, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xo18 + integer:: i + set_xo18_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xo18(i) = xo18 + set_xo18_at_zone = 0 + end if +end function set_xo18_at_zone +integer function get_xne20_at_zone(index_of_the_particle, zone, xne20) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xne20 + integer:: i + get_xne20_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xne20 = GenecStar%xne20(i) + get_xne20_at_zone = 0 + end if +end function get_xne20_at_zone -function get_mass_fraction_of_ne22_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xne20_at_zone(index_of_the_particle, zone, xne20) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_ne22_at_zone - get_mass_fraction_of_ne22_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 12, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xne20 + integer:: i + set_xne20_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xne20(i) = xne20 + set_xne20_at_zone = 0 + end if +end function set_xne20_at_zone +integer function get_xne22_at_zone(index_of_the_particle, zone, xne22) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xne22 + integer:: i + get_xne22_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xne22 = GenecStar%xne22(i) + get_xne22_at_zone = 0 + end if +end function get_xne22_at_zone -function get_mass_fraction_of_mg24_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xne22_at_zone(index_of_the_particle, zone, xne22) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_mg24_at_zone - get_mass_fraction_of_mg24_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 13, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xne22 + integer:: i + set_xne22_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xne22(i) = xne22 + set_xne22_at_zone = 0 + end if +end function set_xne22_at_zone +integer function get_xmg24_at_zone(index_of_the_particle, zone, xmg24) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xmg24 + integer:: i + get_xmg24_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xmg24 = GenecStar%xmg24(i) + get_xmg24_at_zone = 0 + end if +end function get_xmg24_at_zone -function get_mass_fraction_of_mg25_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xmg24_at_zone(index_of_the_particle, zone, xmg24) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_mg25_at_zone - get_mass_fraction_of_mg25_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 14, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xmg24 + integer:: i + set_xmg24_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xmg24(i) = xmg24 + set_xmg24_at_zone = 0 + end if +end function set_xmg24_at_zone +integer function get_xmg25_at_zone(index_of_the_particle, zone, xmg25) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xmg25 + integer:: i + get_xmg25_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xmg25 = GenecStar%xmg25(i) + get_xmg25_at_zone = 0 + end if +end function get_xmg25_at_zone -function get_mass_fraction_of_mg26_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xmg25_at_zone(index_of_the_particle, zone, xmg25) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_mg26_at_zone - get_mass_fraction_of_mg26_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 15, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xmg25 + integer:: i + set_xmg25_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xmg25(i) = xmg25 + set_xmg25_at_zone = 0 + end if +end function set_xmg25_at_zone +integer function get_xmg26_at_zone(index_of_the_particle, zone, xmg26) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xmg26 + integer:: i + get_xmg26_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xmg26 = GenecStar%xmg26(i) + get_xmg26_at_zone = 0 + end if +end function get_xmg26_at_zone -function get_mass_fraction_of_c14_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xmg26_at_zone(index_of_the_particle, zone, xmg26) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_c14_at_zone - get_mass_fraction_of_c14_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 16, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xmg26 + integer:: i + set_xmg26_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xmg26(i) = xmg26 + set_xmg26_at_zone = 0 + end if +end function set_xmg26_at_zone +integer function get_xf19_at_zone(index_of_the_particle, zone, xf19) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xf19 + integer:: i + get_xf19_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xf19 = GenecStar%xf19(i) + get_xf19_at_zone = 0 + end if +end function get_xf19_at_zone -function get_mass_fraction_of_f18_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xf19_at_zone(index_of_the_particle, zone, xf19) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_f18_at_zone - get_mass_fraction_of_f18_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 17, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xf19 + integer:: i + set_xf19_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xf19(i) = xf19 + set_xf19_at_zone = 0 + end if +end function set_xf19_at_zone +integer function get_xne21_at_zone(index_of_the_particle, zone, xne21) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xne21 + integer:: i + get_xne21_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xne21 = GenecStar%xne21(i) + get_xne21_at_zone = 0 + end if +end function get_xne21_at_zone -function get_mass_fraction_of_f19_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xne21_at_zone(index_of_the_particle, zone, xne21) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_f19_at_zone - get_mass_fraction_of_f19_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 18, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xne21 + integer:: i + set_xne21_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xne21(i) = xne21 + set_xne21_at_zone = 0 + end if +end function set_xne21_at_zone +integer function get_xna23_at_zone(index_of_the_particle, zone, xna23) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xna23 + integer:: i + get_xna23_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xna23 = GenecStar%xna23(i) + get_xna23_at_zone = 0 + end if +end function get_xna23_at_zone -function get_mass_fraction_of_ne21_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xna23_at_zone(index_of_the_particle, zone, xna23) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_ne21_at_zone - get_mass_fraction_of_ne21_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 19, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xna23 + integer:: i + set_xna23_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xna23(i) = xna23 + set_xna23_at_zone = 0 + end if +end function set_xna23_at_zone +integer function get_xal27_at_zone(index_of_the_particle, zone, xal27) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xal27 + integer:: i + get_xal27_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xal27 = GenecStar%xal27(i) + get_xal27_at_zone = 0 + end if +end function get_xal27_at_zone -function get_mass_fraction_of_na23_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xal27_at_zone(index_of_the_particle, zone, xal27) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_na23_at_zone - get_mass_fraction_of_na23_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 20, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xal27 + integer:: i + set_xal27_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xal27(i) = xal27 + set_xal27_at_zone = 0 + end if +end function set_xal27_at_zone +integer function get_xsi28_at_zone(index_of_the_particle, zone, xsi28) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xsi28 + integer:: i + get_xsi28_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xsi28 = GenecStar%xsi28(i) + get_xsi28_at_zone = 0 + end if +end function get_xsi28_at_zone -function get_mass_fraction_of_al26_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xsi28_at_zone(index_of_the_particle, zone, xsi28) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_al26_at_zone - get_mass_fraction_of_al26_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 21, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xsi28 + integer:: i + set_xsi28_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xsi28(i) = xsi28 + set_xsi28_at_zone = 0 + end if +end function set_xsi28_at_zone +integer function get_xc14_at_zone(index_of_the_particle, zone, xc14) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xc14 + integer:: i + get_xc14_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xc14 = GenecStar%xc14(i) + get_xc14_at_zone = 0 + end if +end function get_xc14_at_zone -function get_mass_fraction_of_al27_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xc14_at_zone(index_of_the_particle, zone, xc14) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_al27_at_zone - get_mass_fraction_of_al27_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 22, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xc14 + integer:: i + set_xc14_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xc14(i) = xc14 + set_xc14_at_zone = 0 + end if +end function set_xc14_at_zone +integer function get_xf18_at_zone(index_of_the_particle, zone, xf18) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xf18 + integer:: i + get_xf18_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xf18 = GenecStar%xf18(i) + get_xf18_at_zone = 0 + end if +end function get_xf18_at_zone -function get_mass_fraction_of_si28_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xf18_at_zone(index_of_the_particle, zone, xf18) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_si28_at_zone - get_mass_fraction_of_si28_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 23, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xf18 + integer:: i + set_xf18_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xf18(i) = xf18 + set_xf18_at_zone = 0 + end if +end function set_xf18_at_zone +integer function get_xal26_at_zone(index_of_the_particle, zone, xal26) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xal26 + integer:: i + get_xal26_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xal26 = GenecStar%xal26(i) + get_xal26_at_zone = 0 + end if +end function get_xal26_at_zone -function get_mass_fraction_of_neut_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xal26_at_zone(index_of_the_particle, zone, xal26) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_neut_at_zone - get_mass_fraction_of_neut_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 24, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xal26 + integer:: i + set_xal26_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xal26(i) = xal26 + set_xal26_at_zone = 0 + end if +end function set_xal26_at_zone + +integer function get_xneut_at_zone(index_of_the_particle, zone, xneut) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xneut + integer:: i + get_xneut_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xneut = GenecStar%xneut(i) + get_xneut_at_zone = 0 + end if +end function get_xneut_at_zone + +integer function set_xneut_at_zone(index_of_the_particle, zone, xneut) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xneut + integer:: i + set_xneut_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xneut(i) = xneut + set_xneut_at_zone = 0 + end if +end function set_xneut_at_zone + +integer function get_xprot_at_zone(index_of_the_particle, zone, xprot) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xprot + integer:: i + get_xprot_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xprot = GenecStar%xprot(i) + get_xprot_at_zone = 0 + end if +end function get_xprot_at_zone + +integer function set_xprot_at_zone(index_of_the_particle, zone, xprot) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xprot + integer:: i + set_xprot_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xprot(i) = xprot + set_xprot_at_zone = 0 + end if +end function set_xprot_at_zone + +integer function get_omegi_at_zone(index_of_the_particle, zone, omegi) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: omegi + integer:: i + get_omegi_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + omegi = GenecStar%omegi(i) + get_omegi_at_zone = 0 + end if +end function get_omegi_at_zone + +integer function set_omegi_at_zone(index_of_the_particle, zone, omegi) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: omegi + integer:: i + set_omegi_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%omegi(i) = omegi + set_omegi_at_zone = 0 + end if +end function set_omegi_at_zone + +integer function get_xbid_at_zone(index_of_the_particle, zone, xbid) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xbid + integer:: i + get_xbid_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xbid = GenecStar%xbid(i) + get_xbid_at_zone = 0 + end if +end function get_xbid_at_zone + +integer function set_xbid_at_zone(index_of_the_particle, zone, xbid) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xbid + integer:: i + set_xbid_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xbid(i) = xbid + set_xbid_at_zone = 0 + end if +end function set_xbid_at_zone +integer function get_xbid1_at_zone(index_of_the_particle, zone, xbid1) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: xbid1 + integer:: i + get_xbid1_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + xbid1 = GenecStar%xbid1(i) + get_xbid1_at_zone = 0 + end if +end function get_xbid1_at_zone -function get_mass_fraction_of_prot_at_zone(index_of_the_star, zone, Xj_i) +integer function set_xbid1_at_zone(index_of_the_particle, zone, xbid1) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_prot_at_zone - get_mass_fraction_of_prot_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 25, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: xbid1 + integer:: i + set_xbid1_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%xbid1(i) = xbid1 + set_xbid1_at_zone = 0 + end if +end function set_xbid1_at_zone +integer function get_vp_at_zone(index_of_the_particle, zone, vp) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vp + integer:: i + get_vp_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vp = GenecStar%vp(i) + get_vp_at_zone = 0 + end if +end function get_vp_at_zone -function get_mass_fraction_of_bid_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vp_at_zone(index_of_the_particle, zone, vp) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_bid_at_zone - get_mass_fraction_of_bid_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 26, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vp + integer:: i + set_vp_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vp(i) = vp + set_vp_at_zone = 0 + end if +end function set_vp_at_zone +integer function get_vt_at_zone(index_of_the_particle, zone, vt) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vt + integer:: i + get_vt_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vt = GenecStar%vt(i) + get_vt_at_zone = 0 + end if +end function get_vt_at_zone -function get_mass_fraction_of_bid1_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vt_at_zone(index_of_the_particle, zone, vt) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: get_mass_fraction_of_bid1_at_zone - get_mass_fraction_of_bid1_at_zone = get_mass_fraction_of_species_at_zone(index_of_the_star, 27, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vt + integer:: i + set_vt_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vt(i) = vt + set_vt_at_zone = 0 + end if +end function set_vt_at_zone +integer function get_vr_at_zone(index_of_the_particle, zone, vr) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vr + integer:: i + get_vr_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vr = GenecStar%vr(i) + get_vr_at_zone = 0 + end if +end function get_vr_at_zone -function set_mass_fraction_of_h_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vr_at_zone(index_of_the_particle, zone, vr) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_h_at_zone - set_mass_fraction_of_h_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 1, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vr + integer:: i + set_vr_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vr(i) = vr + set_vr_at_zone = 0 + end if +end function set_vr_at_zone +integer function get_vs_at_zone(index_of_the_particle, zone, vs) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vs + integer:: i + get_vs_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vs = GenecStar%vs(i) + get_vs_at_zone = 0 + end if +end function get_vs_at_zone -function set_mass_fraction_of_he3_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vs_at_zone(index_of_the_particle, zone, vs) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_he3_at_zone - set_mass_fraction_of_he3_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 2, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vs + integer:: i + set_vs_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vs(i) = vs + set_vs_at_zone = 0 + end if +end function set_vs_at_zone +integer function get_vx_at_zone(index_of_the_particle, zone, vx) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vx + integer:: i + get_vx_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vx = GenecStar%vx(i) + get_vx_at_zone = 0 + end if +end function get_vx_at_zone -function set_mass_fraction_of_he_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vx_at_zone(index_of_the_particle, zone, vx) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_he_at_zone - set_mass_fraction_of_he_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 3, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vx + integer:: i + set_vx_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vx(i) = vx + set_vx_at_zone = 0 + end if +end function set_vx_at_zone +integer function get_vy_at_zone(index_of_the_particle, zone, vy) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vy + integer:: i + get_vy_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vy = GenecStar%vy(i) + get_vy_at_zone = 0 + end if +end function get_vy_at_zone -function set_mass_fraction_of_c12_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vy_at_zone(index_of_the_particle, zone, vy) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_c12_at_zone - set_mass_fraction_of_c12_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 4, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vy + integer:: i + set_vy_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vy(i) = vy + set_vy_at_zone = 0 + end if +end function set_vy_at_zone +integer function get_vy3_at_zone(index_of_the_particle, zone, vy3) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vy3 + integer:: i + get_vy3_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vy3 = GenecStar%vy3(i) + get_vy3_at_zone = 0 + end if +end function get_vy3_at_zone -function set_mass_fraction_of_c13_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vy3_at_zone(index_of_the_particle, zone, vy3) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_c13_at_zone - set_mass_fraction_of_c13_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 5, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vy3 + integer:: i + set_vy3_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vy3(i) = vy3 + set_vy3_at_zone = 0 + end if +end function set_vy3_at_zone +integer function get_vxc12_at_zone(index_of_the_particle, zone, vxc12) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxc12 + integer:: i + get_vxc12_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxc12 = GenecStar%vxc12(i) + get_vxc12_at_zone = 0 + end if +end function get_vxc12_at_zone -function set_mass_fraction_of_n14_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxc12_at_zone(index_of_the_particle, zone, vxc12) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_n14_at_zone - set_mass_fraction_of_n14_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 6, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxc12 + integer:: i + set_vxc12_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxc12(i) = vxc12 + set_vxc12_at_zone = 0 + end if +end function set_vxc12_at_zone +integer function get_vxc13_at_zone(index_of_the_particle, zone, vxc13) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxc13 + integer:: i + get_vxc13_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxc13 = GenecStar%vxc13(i) + get_vxc13_at_zone = 0 + end if +end function get_vxc13_at_zone -function set_mass_fraction_of_n15_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxc13_at_zone(index_of_the_particle, zone, vxc13) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_n15_at_zone - set_mass_fraction_of_n15_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 7, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxc13 + integer:: i + set_vxc13_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxc13(i) = vxc13 + set_vxc13_at_zone = 0 + end if +end function set_vxc13_at_zone +integer function get_vxn14_at_zone(index_of_the_particle, zone, vxn14) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxn14 + integer:: i + get_vxn14_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxn14 = GenecStar%vxn14(i) + get_vxn14_at_zone = 0 + end if +end function get_vxn14_at_zone -function set_mass_fraction_of_o16_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxn14_at_zone(index_of_the_particle, zone, vxn14) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_o16_at_zone - set_mass_fraction_of_o16_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 8, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxn14 + integer:: i + set_vxn14_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxn14(i) = vxn14 + set_vxn14_at_zone = 0 + end if +end function set_vxn14_at_zone +integer function get_vxn15_at_zone(index_of_the_particle, zone, vxn15) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxn15 + integer:: i + get_vxn15_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxn15 = GenecStar%vxn15(i) + get_vxn15_at_zone = 0 + end if +end function get_vxn15_at_zone -function set_mass_fraction_of_o17_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxn15_at_zone(index_of_the_particle, zone, vxn15) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_o17_at_zone - set_mass_fraction_of_o17_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 9, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxn15 + integer:: i + set_vxn15_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxn15(i) = vxn15 + set_vxn15_at_zone = 0 + end if +end function set_vxn15_at_zone +integer function get_vxo16_at_zone(index_of_the_particle, zone, vxo16) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxo16 + integer:: i + get_vxo16_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxo16 = GenecStar%vxo16(i) + get_vxo16_at_zone = 0 + end if +end function get_vxo16_at_zone -function set_mass_fraction_of_o18_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxo16_at_zone(index_of_the_particle, zone, vxo16) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_o18_at_zone - set_mass_fraction_of_o18_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 10, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxo16 + integer:: i + set_vxo16_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxo16(i) = vxo16 + set_vxo16_at_zone = 0 + end if +end function set_vxo16_at_zone +integer function get_vxo17_at_zone(index_of_the_particle, zone, vxo17) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxo17 + integer:: i + get_vxo17_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxo17 = GenecStar%vxo17(i) + get_vxo17_at_zone = 0 + end if +end function get_vxo17_at_zone -function set_mass_fraction_of_ne20_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxo17_at_zone(index_of_the_particle, zone, vxo17) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_ne20_at_zone - set_mass_fraction_of_ne20_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 11, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxo17 + integer:: i + set_vxo17_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxo17(i) = vxo17 + set_vxo17_at_zone = 0 + end if +end function set_vxo17_at_zone +integer function get_vxo18_at_zone(index_of_the_particle, zone, vxo18) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxo18 + integer:: i + get_vxo18_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxo18 = GenecStar%vxo18(i) + get_vxo18_at_zone = 0 + end if +end function get_vxo18_at_zone -function set_mass_fraction_of_ne22_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxo18_at_zone(index_of_the_particle, zone, vxo18) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_ne22_at_zone - set_mass_fraction_of_ne22_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 12, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxo18 + integer:: i + set_vxo18_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxo18(i) = vxo18 + set_vxo18_at_zone = 0 + end if +end function set_vxo18_at_zone +integer function get_vxne20_at_zone(index_of_the_particle, zone, vxne20) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxne20 + integer:: i + get_vxne20_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxne20 = GenecStar%vxne20(i) + get_vxne20_at_zone = 0 + end if +end function get_vxne20_at_zone -function set_mass_fraction_of_mg24_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxne20_at_zone(index_of_the_particle, zone, vxne20) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_mg24_at_zone - set_mass_fraction_of_mg24_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 13, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxne20 + integer:: i + set_vxne20_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxne20(i) = vxne20 + set_vxne20_at_zone = 0 + end if +end function set_vxne20_at_zone +integer function get_vxne22_at_zone(index_of_the_particle, zone, vxne22) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxne22 + integer:: i + get_vxne22_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxne22 = GenecStar%vxne22(i) + get_vxne22_at_zone = 0 + end if +end function get_vxne22_at_zone -function set_mass_fraction_of_mg25_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxne22_at_zone(index_of_the_particle, zone, vxne22) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_mg25_at_zone - set_mass_fraction_of_mg25_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 14, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxne22 + integer:: i + set_vxne22_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxne22(i) = vxne22 + set_vxne22_at_zone = 0 + end if +end function set_vxne22_at_zone +integer function get_vxmg24_at_zone(index_of_the_particle, zone, vxmg24) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxmg24 + integer:: i + get_vxmg24_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxmg24 = GenecStar%vxmg24(i) + get_vxmg24_at_zone = 0 + end if +end function get_vxmg24_at_zone -function set_mass_fraction_of_mg26_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxmg24_at_zone(index_of_the_particle, zone, vxmg24) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_mg26_at_zone - set_mass_fraction_of_mg26_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 15, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxmg24 + integer:: i + set_vxmg24_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxmg24(i) = vxmg24 + set_vxmg24_at_zone = 0 + end if +end function set_vxmg24_at_zone +integer function get_vxmg25_at_zone(index_of_the_particle, zone, vxmg25) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxmg25 + integer:: i + get_vxmg25_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxmg25 = GenecStar%vxmg25(i) + get_vxmg25_at_zone = 0 + end if +end function get_vxmg25_at_zone -function set_mass_fraction_of_c14_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxmg25_at_zone(index_of_the_particle, zone, vxmg25) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_c14_at_zone - set_mass_fraction_of_c14_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 16, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxmg25 + integer:: i + set_vxmg25_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxmg25(i) = vxmg25 + set_vxmg25_at_zone = 0 + end if +end function set_vxmg25_at_zone +integer function get_vxmg26_at_zone(index_of_the_particle, zone, vxmg26) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxmg26 + integer:: i + get_vxmg26_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxmg26 = GenecStar%vxmg26(i) + get_vxmg26_at_zone = 0 + end if +end function get_vxmg26_at_zone -function set_mass_fraction_of_f18_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxmg26_at_zone(index_of_the_particle, zone, vxmg26) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_f18_at_zone - set_mass_fraction_of_f18_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 17, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxmg26 + integer:: i + set_vxmg26_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxmg26(i) = vxmg26 + set_vxmg26_at_zone = 0 + end if +end function set_vxmg26_at_zone +integer function get_vxf19_at_zone(index_of_the_particle, zone, vxf19) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxf19 + integer:: i + get_vxf19_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxf19 = GenecStar%vxf19(i) + get_vxf19_at_zone = 0 + end if +end function get_vxf19_at_zone -function set_mass_fraction_of_f19_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxf19_at_zone(index_of_the_particle, zone, vxf19) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_f19_at_zone - set_mass_fraction_of_f19_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 18, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxf19 + integer:: i + set_vxf19_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxf19(i) = vxf19 + set_vxf19_at_zone = 0 + end if +end function set_vxf19_at_zone +integer function get_vxne21_at_zone(index_of_the_particle, zone, vxne21) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxne21 + integer:: i + get_vxne21_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxne21 = GenecStar%vxne21(i) + get_vxne21_at_zone = 0 + end if +end function get_vxne21_at_zone -function set_mass_fraction_of_ne21_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxne21_at_zone(index_of_the_particle, zone, vxne21) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_ne21_at_zone - set_mass_fraction_of_ne21_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 19, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxne21 + integer:: i + set_vxne21_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxne21(i) = vxne21 + set_vxne21_at_zone = 0 + end if +end function set_vxne21_at_zone +integer function get_vxna23_at_zone(index_of_the_particle, zone, vxna23) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxna23 + integer:: i + get_vxna23_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxna23 = GenecStar%vxna23(i) + get_vxna23_at_zone = 0 + end if +end function get_vxna23_at_zone -function set_mass_fraction_of_na23_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxna23_at_zone(index_of_the_particle, zone, vxna23) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_na23_at_zone - set_mass_fraction_of_na23_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 20, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxna23 + integer:: i + set_vxna23_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxna23(i) = vxna23 + set_vxna23_at_zone = 0 + end if +end function set_vxna23_at_zone +integer function get_vxal27_at_zone(index_of_the_particle, zone, vxal27) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxal27 + integer:: i + get_vxal27_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxal27 = GenecStar%vxal27(i) + get_vxal27_at_zone = 0 + end if +end function get_vxal27_at_zone -function set_mass_fraction_of_al26_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxal27_at_zone(index_of_the_particle, zone, vxal27) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_al26_at_zone - set_mass_fraction_of_al26_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 21, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxal27 + integer:: i + set_vxal27_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxal27(i) = vxal27 + set_vxal27_at_zone = 0 + end if +end function set_vxal27_at_zone +integer function get_vxsi28_at_zone(index_of_the_particle, zone, vxsi28) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxsi28 + integer:: i + get_vxsi28_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxsi28 = GenecStar%vxsi28(i) + get_vxsi28_at_zone = 0 + end if +end function get_vxsi28_at_zone -function set_mass_fraction_of_al27_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxsi28_at_zone(index_of_the_particle, zone, vxsi28) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_al27_at_zone - set_mass_fraction_of_al27_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 22, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxsi28 + integer:: i + set_vxsi28_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxsi28(i) = vxsi28 + set_vxsi28_at_zone = 0 + end if +end function set_vxsi28_at_zone +integer function get_vxc14_at_zone(index_of_the_particle, zone, vxc14) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxc14 + integer:: i + get_vxc14_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxc14 = GenecStar%vxc14(i) + get_vxc14_at_zone = 0 + end if +end function get_vxc14_at_zone -function set_mass_fraction_of_si28_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxc14_at_zone(index_of_the_particle, zone, vxc14) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_si28_at_zone - set_mass_fraction_of_si28_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 23, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxc14 + integer:: i + set_vxc14_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxc14(i) = vxc14 + set_vxc14_at_zone = 0 + end if +end function set_vxc14_at_zone +integer function get_vxf18_at_zone(index_of_the_particle, zone, vxf18) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxf18 + integer:: i + get_vxf18_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxf18 = GenecStar%vxf18(i) + get_vxf18_at_zone = 0 + end if +end function get_vxf18_at_zone -function set_mass_fraction_of_neut_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxf18_at_zone(index_of_the_particle, zone, vxf18) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_neut_at_zone - set_mass_fraction_of_neut_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 24, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxf18 + integer:: i + set_vxf18_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxf18(i) = vxf18 + set_vxf18_at_zone = 0 + end if +end function set_vxf18_at_zone +integer function get_vxal26_at_zone(index_of_the_particle, zone, vxal26) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxal26 + integer:: i + get_vxal26_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxal26 = GenecStar%vxal26(i) + get_vxal26_at_zone = 0 + end if +end function get_vxal26_at_zone -function set_mass_fraction_of_prot_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxal26_at_zone(index_of_the_particle, zone, vxal26) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_prot_at_zone - set_mass_fraction_of_prot_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 25, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxal26 + integer:: i + set_vxal26_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxal26(i) = vxal26 + set_vxal26_at_zone = 0 + end if +end function set_vxal26_at_zone +integer function get_vxneut_at_zone(index_of_the_particle, zone, vxneut) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxneut + integer:: i + get_vxneut_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxneut = GenecStar%vxneut(i) + get_vxneut_at_zone = 0 + end if +end function get_vxneut_at_zone -function set_mass_fraction_of_bid_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxneut_at_zone(index_of_the_particle, zone, vxneut) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_bid_at_zone - set_mass_fraction_of_bid_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 26, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxneut + integer:: i + set_vxneut_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxneut(i) = vxneut + set_vxneut_at_zone = 0 + end if +end function set_vxneut_at_zone +integer function get_vxprot_at_zone(index_of_the_particle, zone, vxprot) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxprot + integer:: i + get_vxprot_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxprot = GenecStar%vxprot(i) + get_vxprot_at_zone = 0 + end if +end function get_vxprot_at_zone -function set_mass_fraction_of_bid1_at_zone(index_of_the_star, zone, Xj_i) +integer function set_vxprot_at_zone(index_of_the_particle, zone, vxprot) implicit none - integer:: index_of_the_star, zone - real(kindreal):: Xj_i - integer:: set_mass_fraction_of_bid1_at_zone - set_mass_fraction_of_bid1_at_zone = set_mass_fraction_of_species_at_zone(index_of_the_star, 27, zone, Xj_i) -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxprot + integer:: i + set_vxprot_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxprot(i) = vxprot + set_vxprot_at_zone = 0 + end if +end function set_vxprot_at_zone -function get_number_of_particles(n) +integer function get_vomegi_at_zone(index_of_the_particle, zone, vomegi) implicit none - integer:: n - integer:: get_number_of_particles - n = 1 - get_number_of_particles = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vomegi + integer:: i + get_vomegi_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vomegi = GenecStar%vomegi(i) + get_vomegi_at_zone = 0 + end if +end function get_vomegi_at_zone -function get_number_of_species(index_of_the_star, n_species) +integer function set_vomegi_at_zone(index_of_the_particle, zone, vomegi) implicit none - integer:: index_of_the_star - integer:: n_species - integer:: get_number_of_species - if (GenecStar%ialflu==1) then - n_species = 27 - else - n_species = 15 + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vomegi + integer:: i + set_vomegi_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vomegi(i) = vomegi + set_vomegi_at_zone = 0 end if - get_number_of_species = 0 -end function +end function set_vomegi_at_zone -function get_firstlast_species_number(first, last) +integer function get_vxbid_at_zone(index_of_the_particle, zone, vxbid) implicit none - !integer:: index_of_the_star - integer:: first, last - integer:: get_firstlast_species_number - first = 1 - if (GenecStar%ialflu==1) then - last = 27 - else - last = 15 + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxbid + integer:: i + get_vxbid_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxbid = GenecStar%vxbid(i) + get_vxbid_at_zone = 0 end if - get_firstlast_species_number = 0 -end function +end function get_vxbid_at_zone -function get_number_of_zones(index_of_the_star, n_zones) +integer function set_vxbid_at_zone(index_of_the_particle, zone, vxbid) implicit none - integer:: index_of_the_star - integer:: n_zones - integer:: get_number_of_zones - n_zones = GenecStar%m - get_number_of_zones = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxbid + integer:: i + set_vxbid_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxbid(i) = vxbid + set_vxbid_at_zone = 0 + end if +end function set_vxbid_at_zone -function set_number_of_zones(index_of_the_star, n_zones) +integer function get_vxbid1_at_zone(index_of_the_particle, zone, vxbid1) implicit none - integer:: index_of_the_star - integer:: n_zones - integer:: set_number_of_zones - GenecStar%m = n_zones - set_number_of_zones = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: vxbid1 + integer:: i + get_vxbid1_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vxbid1 = GenecStar%vxbid1(i) + get_vxbid1_at_zone = 0 + end if +end function get_vxbid1_at_zone -function get_firstlast_zone(first, last) +integer function set_vxbid1_at_zone(index_of_the_particle, zone, vxbid1) implicit none - !integer:: index_of_the_star - integer:: first, last - integer:: get_firstlast_zone - first = 0 - last = GenecStar%m-1 - get_firstlast_zone = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(in):: vxbid1 + integer:: i + set_vxbid1_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vxbid1(i) = vxbid1 + set_vxbid1_at_zone = 0 + end if +end function set_vxbid1_at_zone -function get_pressure_at_zone(index_of_the_star, zone, P_i) +integer function get_abelx_at_zone(index_of_the_particle, zone, element, abelx) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: P_i - integer:: get_pressure_at_zone - if (zone <= GenecStar%m) then - i = GenecStar%m - zone - P_i = exp(GenecStar%p(i)) + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + integer, intent(in):: element + real(kindreal), intent(out):: abelx + integer:: i + get_abelx_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + abelx = GenecStar%abelx(element,i) + get_abelx_at_zone = 0 end if - get_pressure_at_zone = 0 -end function +end function get_abelx_at_zone -!function set_pressure_at_zone(index_of_the_star, zone, P_i) -! use strucmod, only: p, m -! implicit none -! integer:: index_of_the_star -! integer:: zone, i -! real(kindreal):: P_i -! integer:: set_pressure_at_zone -! if (zone <= m) then -! i = m - zone -! p(i) = log(P_i) -! end if -! set_pressure_at_zone = 0 -!end function +integer function set_abelx_at_zone(index_of_the_particle, zone, element, abelx) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + integer, intent(in):: element + real(kindreal), intent(in):: abelx + integer:: i + set_abelx_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%abelx(element,i) = abelx + set_abelx_at_zone = 0 + end if +end function set_abelx_at_zone -function get_radius(index_of_the_star, am_radius) +integer function get_vabelx_at_zone(index_of_the_particle, zone, element, vabelx) implicit none - integer:: index_of_the_star - real(kindreal):: am_radius - integer:: get_radius - am_radius = 10**GenecStar%radius - !radius = exp(r(1)) ! in cm - get_radius = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + integer, intent(in):: element + real(kindreal), intent(out):: vabelx + integer:: i + get_vabelx_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + vabelx = GenecStar%vabelx(element,i) + get_vabelx_at_zone = 0 + end if +end function get_vabelx_at_zone -function set_radius(index_of_the_star, am_radius) +integer function set_vabelx_at_zone(index_of_the_particle, zone, element, vabelx) implicit none - integer:: index_of_the_star - real(kindreal):: am_radius - integer:: set_radius - GenecStar%radius = log10(am_radius) - set_radius = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + integer, intent(in):: element + real(kindreal), intent(in):: vabelx + integer:: i + set_vabelx_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + GenecStar%vabelx(element,i) = vabelx + set_vabelx_at_zone = 0 + end if +end function set_vabelx_at_zone -function get_eps_at_zone(index_of_the_star, zone, eps) +integer function get_eps_at_zone(index_of_the_particle, zone, eps) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: eps - integer:: get_eps_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: eps + integer:: i + get_eps_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then eps = GenecStar%eps(i) + get_eps_at_zone = 0 end if - get_eps_at_zone = 0 -end function +end function get_eps_at_zone -function get_epsy_at_zone(index_of_the_star, zone, epsy) +integer function get_epsy_at_zone(index_of_the_particle, zone, epsy) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: epsy - integer:: get_epsy_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: epsy + integer:: i + get_epsy_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then epsy = GenecStar%epsy(i) + get_epsy_at_zone = 0 end if - get_epsy_at_zone = 0 -end function +end function get_epsy_at_zone -function get_eps_c_adv_at_zone(index_of_the_star, zone, eps_c_adv) +integer function get_eps_c_adv_at_zone(index_of_the_particle, zone, eps_c_adv) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: eps_c_adv - integer:: get_eps_c_adv_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: eps_c_adv + integer:: i + get_eps_c_adv_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then eps_c_adv = GenecStar%eps_c_adv(i) + get_eps_c_adv_at_zone = 0 end if - get_eps_c_adv_at_zone = 0 -end function +end function get_eps_c_adv_at_zone -function get_eps_ne_adv_at_zone(index_of_the_star, zone, eps_ne_adv) +integer function get_eps_ne_adv_at_zone(index_of_the_particle, zone, eps_ne_adv) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: eps_ne_adv - integer:: get_eps_ne_adv_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: eps_ne_adv + integer:: i + get_eps_ne_adv_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then eps_ne_adv = GenecStar%eps_ne_adv(i) + get_eps_ne_adv_at_zone = 0 end if - get_eps_ne_adv_at_zone = 0 -end function +end function get_eps_ne_adv_at_zone -function get_eps_o_adv_at_zone(index_of_the_star, zone, eps_o_adv) +integer function get_eps_o_adv_at_zone(index_of_the_particle, zone, eps_o_adv) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: eps_o_adv - integer:: get_eps_o_adv_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: eps_o_adv + integer:: i + get_eps_o_adv_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then eps_o_adv = GenecStar%eps_o_adv(i) + get_eps_o_adv_at_zone = 0 end if - get_eps_o_adv_at_zone = 0 -end function +end function get_eps_o_adv_at_zone -function get_eps_si_adv_at_zone(index_of_the_star, zone, eps_si_adv) +integer function get_eps_si_adv_at_zone(index_of_the_particle, zone, eps_si_adv) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: eps_si_adv - integer:: get_eps_si_adv_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: eps_si_adv + integer:: i + get_eps_si_adv_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then eps_si_adv = GenecStar%eps_si_adv(i) + get_eps_si_adv_at_zone = 0 end if - get_eps_si_adv_at_zone = 0 -end function +end function get_eps_si_adv_at_zone -function get_eps_grav_at_zone(index_of_the_star, zone, eps_grav) +integer function get_eps_grav_at_zone(index_of_the_particle, zone, eps_grav) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: eps_grav - integer:: get_eps_grav_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: eps_grav + integer:: i + get_eps_grav_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then eps_grav = GenecStar%eps_grav(i) + get_eps_grav_at_zone = 0 end if - get_eps_grav_at_zone = 0 -end function +end function get_eps_grav_at_zone -function get_eps_nu_at_zone(index_of_the_star, zone, eps_nu) +integer function get_eps_nu_at_zone(index_of_the_particle, zone, eps_nu) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: eps_nu - integer:: get_eps_nu_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: eps_nu + integer:: i + get_eps_nu_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then eps_nu = GenecStar%eps_nu(i) + get_eps_nu_at_zone = 0 end if - get_eps_nu_at_zone = 0 -end function - -function get_nabla_rad_at_zone(index_of_the_star, zone, nabla_rad) - implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: nabla_rad - integer:: get_nabla_rad_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - nabla_rad = GenecStar%Nabla_rad(i) - end if - get_nabla_rad_at_zone = 0 -end function +end function get_eps_nu_at_zone -function get_nabla_ad_at_zone(index_of_the_star, zone, nabla_ad) +integer function get_nabla_rad_at_zone(index_of_the_particle, zone, nabla_rad) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: nabla_ad - integer:: get_nabla_ad_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - nabla_ad = GenecStar%Nabla_ad(i) + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: nabla_rad + integer:: i + get_nabla_rad_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + nabla_rad = GenecStar%nabla_rad(i) + get_nabla_rad_at_zone = 0 end if - get_nabla_ad_at_zone = 0 -end function +end function get_nabla_rad_at_zone -function get_nabla_mu_at_zone(index_of_the_star, zone, nabla_mu) +integer function get_nabla_ad_at_zone(index_of_the_particle, zone, nabla_ad) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: nabla_mu - integer:: get_nabla_mu_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - nabla_mu = GenecStar%Nabla_mu(i) + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: nabla_ad + integer:: i + get_nabla_ad_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + nabla_ad = GenecStar%nabla_ad(i) + get_nabla_ad_at_zone = 0 end if - get_nabla_mu_at_zone = 0 -end function +end function get_nabla_ad_at_zone -function get_radius_at_zone(index_of_the_star, zone, R_i) +integer function get_nabla_mu_at_zone(index_of_the_particle, zone, nabla_mu) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: R_i - integer:: get_radius_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - R_i = exp(GenecStar%r(i)) ! in cm + integer, intent(in):: index_of_the_particle + integer, intent(in):: zone + real(kindreal), intent(out):: nabla_mu + integer:: i + get_nabla_mu_at_zone = -1 + i = GenecStar%m-zone + if (.true.) then + nabla_mu = GenecStar%nabla_mu(i) + get_nabla_mu_at_zone = 0 end if - get_radius_at_zone = 0 -end function +end function get_nabla_mu_at_zone -function set_radius_at_zone(index_of_the_star, zone, R_i) +integer function get_xlostneu(index_of_the_particle, xlostneu) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: R_i - integer:: set_radius_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - GenecStar%r(i) = log(R_i) - end if - set_radius_at_zone = 0 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xlostneu + xlostneu = GenecStar%xlostneu + get_xlostneu = 0 +end function get_xlostneu -function get_stellar_type(index_of_the_star, stellar_type) +integer function set_xlostneu(index_of_the_particle, xlostneu) implicit none - integer:: index_of_the_star - integer:: stellar_type - integer:: get_stellar_type - get_stellar_type = -1 -end function + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xlostneu + GenecStar%xlostneu = xlostneu + set_xlostneu = 0 +end function set_xlostneu -function get_temperature(index_of_the_star, temperature) +integer function get_nbzel(index_of_the_particle, i, nbzel) implicit none - integer:: index_of_the_star - real(kindreal):: temperature - integer:: get_temperature - temperature = GenecStar%teff - get_temperature = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: i + integer, intent(out):: nbzel + get_nbzel = -1 + if ((i > 0) .and. (i < 9)) then + nbzel = GenecStar%nbzel(i) + get_nbzel = 0 + end if +end function get_nbzel -function get_temperature_at_zone(index_of_the_star, zone, T_i) +integer function set_nbzel(index_of_the_particle, i, nbzel) implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: T_i - integer:: get_temperature_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - T_i = exp(GenecStar%t(i)) - else - get_temperature_at_zone = -2 - return + integer, intent(in):: index_of_the_particle + integer, intent(in):: i + integer, intent(in):: nbzel + set_nbzel = -1 + if ((i > 0) .and. (i < 9)) then + GenecStar%nbzel(i) = nbzel + set_nbzel = 0 end if - get_temperature_at_zone = 0 -end function +end function set_nbzel -function get_time_step(index_of_the_star, time_step) +integer function get_nbael(index_of_the_particle, i, nbael) implicit none - integer:: index_of_the_star - real(kindreal):: time_step - integer:: get_time_step - time_step = GenecStar%dzeitj - get_time_step = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: i + integer, intent(out):: nbael + get_nbael = -1 + if ((i > 0) .and. (i < 9)) then + nbael = GenecStar%nbael(i) + get_nbael = 0 + end if +end function get_nbael -function get_time(time) +integer function set_nbael(index_of_the_particle, i, nbael) implicit none - real(kindreal):: time - integer:: get_time - time = GenecStar%alter - get_time = 0 -end function - + integer, intent(in):: index_of_the_particle + integer, intent(in):: i + integer, intent(in):: nbael + set_nbael = -1 + if ((i > 0) .and. (i < 9)) then + GenecStar%nbael(i) = nbael + set_nbael = 0 + end if +end function set_nbael +integer function get_abels(index_of_the_particle, i, abels) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: i + real(kindreal), intent(out):: abels + get_abels = -1 + if ((i > 0) .and. (i < 9)) then + abels = GenecStar%abels(i) + get_abels = 0 + end if +end function get_abels +integer function set_abels(index_of_the_particle, i, abels) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: i + real(kindreal), intent(in):: abels + set_abels = -1 + if ((i > 0) .and. (i < 9)) then + GenecStar%abels(i) = abels + set_abels = 0 + end if +end function set_abels +integer function get_xnetalu(index_of_the_particle, i, xnetalu) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: i + real(kindreal), intent(out):: xnetalu + get_xnetalu = -1 + if ((i > 0) .and. (i < 6)) then + xnetalu = GenecStar%xnetalu(i) + get_xnetalu = 0 + end if +end function get_xnetalu -function new_particle(index_of_the_star, mass, metallicity, am_starname) +integer function set_xnetalu(index_of_the_particle, i, xnetalu) implicit none - integer:: index_of_the_star, key - real(kindreal):: mass, metallicity - integer:: new_particle - character(len=12):: am_starname - number_of_stars = number_of_stars + 1 - InitialGenecStar%starname = am_starname - InitialGenecStar%index_of_the_star = number_of_stars - InitialGenecStar%mstar = mass - InitialGenecStar%zini = metallicity - InitialGenecStar%idefaut = 1 - - new_particle = 0 -end function + integer, intent(in):: index_of_the_particle + integer, intent(in):: i + real(kindreal), intent(in):: xnetalu + set_xnetalu = -1 + if ((i > 0) .and. (i < 6)) then + GenecStar%xnetalu(i) = xnetalu + set_xnetalu = 0 + end if +end function set_xnetalu function new_stellar_model(& - integer_of_the_star,& - initialised, starname, nwseq, modanf, nzmod, end_at_phase, end_at_model, irot, isol, imagn, ialflu, ianiso, ipop3,& - ibasnet, phase, var_rates, bintide, binm2, periodini, const_per, iprezams, zinit, zsol, z, iopac, ikappa, idiff, iadvec,& - istati, icoeff, fenerg, richac, igamma, frein, K_Kawaler, Omega_saturation, rapcrilim, vwant, xfom, omega, xdial, idialo,& - idialu, Add_Flux, diff_only, B_initial, add_diff, n_mag, alpha_F, nsmooth, qminsmooth, imloss, fmlos, ifitm, fitm, fitmi,& - deltal, deltat, nndr, RSG_Mdot, SupraEddMdot, Be_mdotfrac, start_mdot, iledou, idifcon, iover, elph, my, dovhp, iunder,& - dunder, gkorm, alph, agdr, faktor, dgrp, dgrl, dgry, dgrc, dgro, dgr20, nbchx, nrband, xcn, islow, icncst, tauH_fit,& - display_plot, iauto, iprn, iout, itmin, xyfiles, idebug, itests, verbose, stop_deg, n_snap,& - m,gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,dm_lost,& - q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& - xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& - vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26g,vxneut,vxprot,vomegi,& - vxbid,vxbid1& + index_of_the_star,& + initialised,veryFirst,starname,nwmd,nwseq,modanf,nzmod,end_at_phase,end_at_model,& + irot,isol,imagn,& + ialflu,ianiso,ipop3,ibasnet,phase,var_rates,bintide,binm2,periodini,const_per,iprezams,zinit,& + zsol,z,iopac,ikappa,idiff,iadvec,istati,icoeff,fenerg,richac,igamma,frein,K_Kawaler,& + Omega_saturation,rapcrilim,vwant,xfom,omega,xdial,idialo,idialu,Add_Flux,diff_only,B_initial,& + add_diff,n_mag,alpha_F,nsmooth,qminsmooth,imloss,fmlos,ifitm,fitm,fitmi,deltal,deltat,nndr,& + RSG_Mdot,SupraEddMdot,Be_mdotfrac,start_mdot,iledou,idifcon,iover,elph,my,dovhp,iunder,& + dunder,gkorm,alph,agdr,faktor,dgrp,dgrl,dgry,dgrc,dgro,dgr20,nbchx,nrband,xcn,islow,icncst,& + tauH_fit,display_plot,iauto,iprn,iout,itmin,xyfiles,idebug,itests,verbose,stop_deg,n_snap,m,& + gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,dm_lost,mbelx,xtefflast,& + xllast,xrholast,xclast,xtclast,inum,nsugi,period,r_core,vna,vnr,q,p,t,r,s,x,y3,y,xc12,xc13,& + xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,xc14,& + xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,& + vxo17,vxo18,vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,& + vxal26,vxneut,vxprot,vomegi,vxbid,vxbid1,& + xlostneu,& + n& ) implicit none - integer:: integer_of_the_star + integer:: index_of_the_star, n + + logical, intent(in):: & + initialised, veryFirst + character(256), intent(in):: & + starname + integer, intent(in):: & + nwmd,nwseq,modanf,nzmod,end_at_phase,end_at_model,irot,isol,imagn,& + ialflu,ianiso,ipop3,ibasnet,phase + logical, intent(in):: & + var_rates,bintide + real(kindreal), intent(in):: & + binm2,periodini + logical, intent(in):: & + const_per + integer, intent(in):: & + iprezams + real(kindreal), intent(in):: & + zinit,& + zsol,z + integer, intent(in):: & + iopac,ikappa,idiff,iadvec,istati,icoeff + real(kindreal), intent(in):: & + fenerg,richac + integer, intent(in):: & + igamma + real(kindreal), intent(in):: & + frein,K_Kawaler,& + Omega_saturation,rapcrilim,vwant,xfom,omega,xdial + integer, intent(in):: & + idialo,idialu + logical, intent(in):: & + Add_Flux,diff_only + real(kindreal), intent(in):: & + B_initial,& + add_diff + integer, intent(in):: & + n_mag + real(kindreal), intent(in):: & + alpha_F + integer, intent(in):: & + nsmooth + logical, intent(in):: & + qminsmooth + integer, intent(in):: & + imloss + real(kindreal), intent(in):: & + fmlos + integer, intent(in):: & + ifitm + real(kindreal), intent(in):: & + fitm,fitmi,deltal,deltat + integer, intent(in):: & + nndr,& + RSG_Mdot + logical, intent(in):: & + SupraEddMdot + real(kindreal), intent(in):: & + Be_mdotfrac,start_mdot + integer, intent(in):: & + iledou,idifcon,iover + real(kindreal), intent(in):: & + elph + integer, intent(in):: & + my + real(kindreal), intent(in):: & + dovhp + integer, intent(in):: & + iunder + real(kindreal), intent(in):: & + dunder,& + gkorm,alph,agdr,faktor,dgrp,dgrl,dgry,dgrc,dgro,dgr20 + integer, intent(in):: & + nbchx,nrband + real(kindreal), intent(in):: & + xcn + integer, intent(in):: & + islow,icncst,& + tauH_fit + logical, intent(in):: & + display_plot + integer, intent(in):: & + iauto,iprn,iout,itmin logical, intent(in):: & - initialised,var_rates,bintide,const_per,Add_Flux,diff_only,qminsmooth,SupraEddMdot,display_plot,xyfiles,verbose,& - stop_deg + xyfiles integer, intent(in):: & - nwseq,modanf,nzmod,end_at_phase,end_at_model,irot,isol,imagn,ialflu,ianiso,ipop3,ibasnet,phase,iprezams,iopac,ikappa,& - idiff,iadvec,istati,icoeff,igamma,idialo,idialu,n_mag,nsmooth,imloss,ifitm,nndr,RSG_Mdot,iledou,idifcon,iover,my,& - iunder,nbchx,nrband,islow,icncst,tauH_fit,iauto,iprn,iout,itmin,idebug,itests,n_snap + idebug,itests + logical, intent(in):: & + verbose,stop_deg + integer, intent(in):: & + n_snap,m + real(kindreal), intent(in):: & + gms,& + alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,dm_lost + integer, intent(in):: & + mbelx real(kindreal), intent(in):: & - binm2,periodini,zinit,zsol,z,fenerg,richac,frein,K_Kawaler,Omega_saturation,rapcrilim,vwant,xfom,omega,xdial,& - B_initial,add_diff,alpha_F,fmlos,fitm,fitmi,deltal,deltat,Be_mdotfrac,start_mdot,elph,dovhp,dunder,gkorm,alph,& - agdr,faktor,dgrp,dgrl,dgry,dgrc,dgro,dgr20,xcn - character(len=200), intent(in):: & - starname - integer, intent(in) :: m - real(kindreal), intent(in) :: & - gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,& - dm_lost - !real(kindreal), dimension(ldi) :: & + xtefflast,& + xllast,xrholast,xclast,xtclast + integer, intent(in):: & + inum,nsugi + real(kindreal), intent(in):: & + period,r_core,vna,vnr real(kindreal), dimension(m), intent(in):: & - q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& - xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& - vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26g,vxneut,vxprot,vomegi,& - vxbid,vxbid1 + q,p,t,r,s,x,y3,y,xc12,& + xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,& + xsi28,xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,& + vxn14,vxn15,vxo16,vxo17,vxo18,vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,& + vxal27,vxsi28,vxc14,vxf18,vxal26,vxneut,vxprot,vomegi,vxbid,vxbid1 + real(kindreal), intent(in):: & + xlostneu + integer:: new_stellar_model - GenecStar%initialised = initialised - GenecStar%starname = starname - !GenecStar%nwmd = nwmd - GenecStar%nwseq = nwseq - GenecStar%modanf = modanf - GenecStar%nzmod = nzmod - GenecStar%end_at_phase = end_at_phase - GenecStar%end_at_model = end_at_model - GenecStar%irot = irot - GenecStar%isol = isol - GenecStar%imagn = imagn - GenecStar%ialflu = ialflu - GenecStar%ianiso = ianiso - GenecStar%ipop3 = ipop3 - GenecStar%ibasnet = ibasnet - GenecStar%phase = phase - GenecStar%iprezams = iprezams - GenecStar%var_rates = var_rates - GenecStar%bintide = bintide - GenecStar%binm2 = binm2 - GenecStar%periodini = periodini - GenecStar%const_per = const_per - GenecStar%iopac = iopac - GenecStar%ikappa = ikappa - GenecStar%zinit = zinit - GenecStar%zsol = zsol - GenecStar%z = z - GenecStar%idiff = idiff - GenecStar%iadvec = iadvec - GenecStar%istati = istati - GenecStar%icoeff = icoeff - GenecStar%igamma = igamma - GenecStar%idialo = idialo - GenecStar%idialu = idialu - GenecStar%n_mag = n_mag - GenecStar%nsmooth = nsmooth - GenecStar%fenerg = fenerg - GenecStar%richac = richac - GenecStar%frein = frein - GenecStar%K_Kawaler = K_Kawaler + write(*,*) "*****N: ", n + + GenecStar%initialised = initialised + GenecStar%starname = starname + GenecStar%nwmd = nwmd + GenecStar%nwseq = nwseq + GenecStar%modanf = modanf + GenecStar%nzmod = nzmod + GenecStar%end_at_phase = end_at_phase + GenecStar%end_at_model = end_at_model + GenecStar%irot = irot + GenecStar%isol = isol + GenecStar%imagn = imagn + GenecStar%ialflu = ialflu + GenecStar%ianiso = ianiso + GenecStar%ipop3 = ipop3 + GenecStar%ibasnet = ibasnet + GenecStar%phase = phase + GenecStar%var_rates = var_rates + GenecStar%bintide = bintide + GenecStar%binm2 = binm2 + GenecStar%periodini = periodini + GenecStar%const_per = const_per + GenecStar%iprezams = iprezams + GenecStar%zinit = zinit + GenecStar%zsol = zsol + GenecStar%z = z + GenecStar%iopac = iopac + GenecStar%ikappa = ikappa + GenecStar%idiff = idiff + GenecStar%iadvec = iadvec + GenecStar%istati = istati + GenecStar%icoeff = icoeff + GenecStar%fenerg = fenerg + GenecStar%richac = richac + GenecStar%igamma = igamma + GenecStar%frein = frein + GenecStar%K_Kawaler = K_Kawaler GenecStar%Omega_saturation = Omega_saturation - GenecStar%rapcrilim = rapcrilim - GenecStar%vwant = vwant - GenecStar%xfom = xfom - GenecStar%omega = omega - GenecStar%xdial = xdial - GenecStar%B_initial = B_initial - GenecStar%add_diff = add_diff - GenecStar%alpha_F = alpha_F - GenecStar%Add_Flux = Add_Flux - GenecStar%diff_only = diff_only - GenecStar%qminsmooth = qminsmooth - GenecStar%imloss = imloss - GenecStar%ifitm = ifitm - GenecStar%nndr = nndr - GenecStar%RSG_Mdot = RSG_Mdot - GenecStar%fmlos = fmlos - GenecStar%fitm = fitm - GenecStar%fitmi = fitmi - GenecStar%deltal = deltal - GenecStar%deltat = deltat - GenecStar%Be_mdotfrac = Be_mdotfrac - GenecStar%start_mdot = start_mdot - GenecStar%SupraEddMdot = SupraEddMdot - GenecStar%iledou = iledou - GenecStar%idifcon = idifcon - GenecStar%my = my - GenecStar%iover = iover - GenecStar%iunder = iunder - GenecStar%elph = elph - GenecStar%dovhp = dovhp - GenecStar%dunder = dunder - GenecStar%nbchx = nbchx - GenecStar%nrband = nrband - GenecStar%gkorm = gkorm - GenecStar%alph = alph - GenecStar%agdr = agdr - GenecStar%faktor = faktor - GenecStar%dgrp = dgrp - GenecStar%dgrl = dgrl - GenecStar%dgry = dgry - GenecStar%dgrc = dgrc - GenecStar%dgro = dgro - GenecStar%dgr20 = dgr20 - GenecStar%islow = islow - GenecStar%icncst = icncst - GenecStar%tauH_fit = tauH_fit - GenecStar%xcn = xcn - GenecStar%iauto = iauto - GenecStar%iprn = iprn - GenecStar%iout = iout - GenecStar%itmin = itmin - GenecStar%idebug = idebug - GenecStar%itests = itests - GenecStar%n_snap = n_snap - GenecStar%display_plot = display_plot - GenecStar%xyfiles = xyfiles - GenecStar%verbose = verbose - GenecStar%stop_deg = stop_deg - - GenecStar%m = m - GenecStar%gms = gms - GenecStar%alter = alter - GenecStar%gls = gls - GenecStar%teff = teff - GenecStar%glsv = glsv - GenecStar%teffv = teffv - GenecStar%dzeitj = dzeitj - GenecStar%dzeit = dzeit - GenecStar%dzeitv = dzeitv - GenecStar%summas = summas - GenecStar%xmini = xmini - GenecStar%ab = ab - GenecStar%dm_lost = dm_lost - GenecStar%q = q - GenecStar%p = p - GenecStar%t = t - GenecStar%r = r - GenecStar%s = s - GenecStar%x = x - GenecStar%y = y - GenecStar%xc12 = xc12 - GenecStar%vp = vp - GenecStar%vt = vt - GenecStar%vr = vr - GenecStar%vs = vs - GenecStar%xo16 = xo16 - GenecStar%vx = vx - GenecStar%vy = vy - GenecStar%vxc12 = vxc12 - GenecStar%vxo16 = vxo16 - GenecStar%y3 = y3 - GenecStar%xc13 = xc13 - GenecStar%xn14 = xn14 - GenecStar%xn15 = xn15 - GenecStar%xo17 = xo17 - GenecStar%xo18 = xo18 - GenecStar%vy3 = vy3 - GenecStar%vxc13 = vxc13 - GenecStar%vxn14 = vxn14 - GenecStar%vxn15 = vxn15 - GenecStar%vxo17 = vxo17 - GenecStar%vxo18 = vxo18 - GenecStar%xne20 = xne20 - GenecStar%xne22 = xne22 - GenecStar%xmg24 = xmg24 - GenecStar%xmg25 = xmg25 - GenecStar%xmg26 = xmg26 - GenecStar%vxne20 = vxne20 - GenecStar%vxne22 = vxne22 - GenecStar%vxmg24 = vxmg24 - GenecStar%vxmg25 = vxmg25 - GenecStar%vxmg26 = vxmg26 - GenecStar%omegi = omegi - GenecStar%vomegi = vomegi - GenecStar%xf19 = xf19 - GenecStar%xne21 = xne21 - GenecStar%xna23 = xna23 - GenecStar%xal26 = xal26 - GenecStar%xal27 = xal27 - GenecStar%xsi28 = xsi28 - GenecStar%vxf19 = vxf19 - GenecStar%vxne21 = vxne21 - GenecStar%vxna23 = vxna23 - GenecStar%vxal26g = vxal26g - GenecStar%vxal27 = vxal27 - GenecStar%vxsi28 = vxsi28 - GenecStar%xneut = xneut - GenecStar%xprot = xprot - GenecStar%xc14 = xc14 - GenecStar%xf18 = xf18 - GenecStar%xbid = xbid - GenecStar%xbid1 = xbid1 - GenecStar%vxneut = vxneut - GenecStar%vxprot = vxprot - GenecStar%vxc14 = vxc14 - GenecStar%vxf18 = vxf18 - GenecStar%vxbid = vxbid - GenecStar%vxbid1 = vxbid1 + GenecStar%rapcrilim = rapcrilim + GenecStar%vwant = vwant + GenecStar%xfom = xfom + GenecStar%omega = omega + GenecStar%xdial = xdial + GenecStar%idialo = idialo + GenecStar%idialu = idialu + GenecStar%Add_Flux = Add_Flux + GenecStar%diff_only = diff_only + GenecStar%B_initial = B_initial + GenecStar%add_diff = add_diff + GenecStar%n_mag = n_mag + GenecStar%alpha_F = alpha_F + GenecStar%nsmooth = nsmooth + GenecStar%qminsmooth = qminsmooth + GenecStar%imloss = imloss + GenecStar%fmlos = fmlos + GenecStar%ifitm = ifitm + GenecStar%fitm = fitm + GenecStar%fitmi = fitmi + GenecStar%deltal = deltal + GenecStar%deltat = deltat + GenecStar%nndr = nndr + GenecStar%RSG_Mdot = RSG_Mdot + GenecStar%SupraEddMdot = SupraEddMdot + GenecStar%Be_mdotfrac = Be_mdotfrac + GenecStar%start_mdot = start_mdot + GenecStar%iledou = iledou + GenecStar%idifcon = idifcon + GenecStar%iover = iover + GenecStar%elph = elph + GenecStar%my = my + GenecStar%dovhp = dovhp + GenecStar%iunder = iunder + GenecStar%dunder = dunder + GenecStar%gkorm = gkorm + GenecStar%alph = alph + GenecStar%agdr = agdr + GenecStar%faktor = faktor + GenecStar%dgrp = dgrp + GenecStar%dgrl = dgrl + GenecStar%dgry = dgry + GenecStar%dgrc = dgrc + GenecStar%dgro = dgro + GenecStar%dgr20 = dgr20 + GenecStar%nbchx = nbchx + GenecStar%nrband = nrband + GenecStar%xcn = xcn + GenecStar%islow = islow + GenecStar%icncst = icncst + GenecStar%tauH_fit = tauH_fit + GenecStar%display_plot = display_plot + GenecStar%iauto = iauto + GenecStar%iprn = iprn + GenecStar%iout = iout + GenecStar%itmin = itmin + GenecStar%xyfiles = xyfiles + GenecStar%idebug = idebug + GenecStar%itests = itests + GenecStar%verbose = verbose + GenecStar%stop_deg = stop_deg + GenecStar%n_snap = n_snap + GenecStar%m = m + GenecStar%gms = gms + GenecStar%alter = alter + GenecStar%gls = gls + GenecStar%teff = teff + GenecStar%glsv = glsv + GenecStar%teffv = teffv + GenecStar%dzeitj = dzeitj + GenecStar%dzeit = dzeit + GenecStar%dzeitv = dzeitv + GenecStar%xmini = xmini + GenecStar%summas = summas + GenecStar%ab = ab + GenecStar%dm_lost = dm_lost + GenecStar%mbelx = mbelx + GenecStar%xtefflast = xtefflast + GenecStar%xllast = xllast + GenecStar%xrholast = xrholast + GenecStar%xclast = xclast + GenecStar%xtclast = xtclast + GenecStar%inum = inum + GenecStar%nsugi = nsugi + GenecStar%period = period + GenecStar%r_core = r_core + GenecStar%vna = vna + GenecStar%vnr = vnr + GenecStar%xlostneu = xlostneu + GenecStar%q = 0.d0 + GenecStar%q = q + GenecStar%p = 0.d0 + GenecStar%p = p + GenecStar%t = 0.d0 + GenecStar%t = t + GenecStar%r = 0.d0 + GenecStar%r = r + GenecStar%s = 0.d0 + GenecStar%s = s + GenecStar%x = 0.d0 + GenecStar%x = x + GenecStar%y3 = 0.d0 + GenecStar%y3 = y3 + GenecStar%y = 0.d0 + GenecStar%y = y + GenecStar%xc12 = 0.d0 + GenecStar%xc12 = xc12 + GenecStar%xc13 = 0.d0 + GenecStar%xc13 = xc13 + GenecStar%xn14 = 0.d0 + GenecStar%xn14 = xn14 + GenecStar%xn15 = 0.d0 + GenecStar%xn15 = xn15 + GenecStar%xo16 = 0.d0 + GenecStar%xo16 = xo16 + GenecStar%xo17 = 0.d0 + GenecStar%xo17 = xo17 + GenecStar%xo18 = 0.d0 + GenecStar%xo18 = xo18 + GenecStar%xne20 = 0.d0 + GenecStar%xne20 = xne20 + GenecStar%xne22 = 0.d0 + GenecStar%xne22 = xne22 + GenecStar%xmg24 = 0.d0 + GenecStar%xmg24 = xmg24 + GenecStar%xmg25 = 0.d0 + GenecStar%xmg25 = xmg25 + GenecStar%xmg26 = 0.d0 + GenecStar%xmg26 = xmg26 + GenecStar%xf19 = 0.d0 + GenecStar%xf19 = xf19 + GenecStar%xne21 = 0.d0 + GenecStar%xne21 = xne21 + GenecStar%xna23 = 0.d0 + GenecStar%xna23 = xna23 + GenecStar%xal27 = 0.d0 + GenecStar%xal27 = xal27 + GenecStar%xsi28 = 0.d0 + GenecStar%xsi28 = xsi28 + GenecStar%xc14 = 0.d0 + GenecStar%xc14 = xc14 + GenecStar%xf18 = 0.d0 + GenecStar%xf18 = xf18 + GenecStar%xal26 = 0.d0 + GenecStar%xal26 = xal26 + GenecStar%xneut = 0.d0 + GenecStar%xneut = xneut + GenecStar%xprot = 0.d0 + GenecStar%xprot = xprot + GenecStar%omegi = 0.d0 + GenecStar%omegi = omegi + GenecStar%xbid = 0.d0 + GenecStar%xbid = xbid + GenecStar%xbid1 = 0.d0 + GenecStar%xbid1 = xbid1 + GenecStar%vp = 0.d0 + GenecStar%vp = vp + GenecStar%vt = 0.d0 + GenecStar%vt = vt + GenecStar%vr = 0.d0 + GenecStar%vr = vr + GenecStar%vs = 0.d0 + GenecStar%vs = vs + GenecStar%vx = 0.d0 + GenecStar%vx = vx + GenecStar%vy = 0.d0 + GenecStar%vy = vy + GenecStar%vy3 = 0.d0 + GenecStar%vy3 = vy3 + GenecStar%vxc12 = 0.d0 + GenecStar%vxc12 = vxc12 + GenecStar%vxc13 = 0.d0 + GenecStar%vxc13 = vxc13 + GenecStar%vxn14 = 0.d0 + GenecStar%vxn14 = vxn14 + GenecStar%vxn15 = 0.d0 + GenecStar%vxn15 = vxn15 + GenecStar%vxo16 = 0.d0 + GenecStar%vxo16 = vxo16 + GenecStar%vxo17 = 0.d0 + GenecStar%vxo17 = vxo17 + GenecStar%vxo18 = 0.d0 + GenecStar%vxo18 = vxo18 + GenecStar%vxne20 = 0.d0 + GenecStar%vxne20 = vxne20 + GenecStar%vxne22 = 0.d0 + GenecStar%vxne22 = vxne22 + GenecStar%vxmg24 = 0.d0 + GenecStar%vxmg24 = vxmg24 + GenecStar%vxmg25 = 0.d0 + GenecStar%vxmg25 = vxmg25 + GenecStar%vxmg26 = 0.d0 + GenecStar%vxmg26 = vxmg26 + GenecStar%vxf19 = 0.d0 + GenecStar%vxf19 = vxf19 + GenecStar%vxne21 = 0.d0 + GenecStar%vxne21 = vxne21 + GenecStar%vxna23 = 0.d0 + GenecStar%vxna23 = vxna23 + GenecStar%vxal27 = 0.d0 + GenecStar%vxal27 = vxal27 + GenecStar%vxsi28 = 0.d0 + GenecStar%vxsi28 = vxsi28 + GenecStar%vxc14 = 0.d0 + GenecStar%vxc14 = vxc14 + GenecStar%vxf18 = 0.d0 + GenecStar%vxf18 = vxf18 + GenecStar%vxal26 = 0.d0 + GenecStar%vxal26 = vxal26 + GenecStar%vxneut = 0.d0 + GenecStar%vxneut = vxneut + GenecStar%vxprot = 0.d0 + GenecStar%vxprot = vxprot + GenecStar%vomegi = 0.d0 + GenecStar%vomegi = vomegi + GenecStar%vxbid = 0.d0 + GenecStar%vxbid = vxbid + GenecStar%vxbid1 = 0.d0 + GenecStar%vxbid1 = vxbid1 + GenecStar%abelx(:,:) = 0. + GenecStar%vabelx(:,:) = 0. + call copy_from_genec_star(GenecStar) new_stellar_model = 0 -end function - -function get_stellar_model(& - integer_of_the_star,& - initialised, starname, nwseq, modanf, nzmod, end_at_phase, end_at_model, irot, isol, imagn, ialflu, ianiso, ipop3,& - ibasnet, phase, var_rates, bintide, binm2, periodini, const_per, iprezams, zinit, zsol, z, iopac, ikappa, idiff, iadvec,& - istati, icoeff, fenerg, richac, igamma, frein, K_Kawaler, Omega_saturation, rapcrilim, vwant, xfom, omega, xdial, idialo,& - idialu, Add_Flux, diff_only, B_initial, add_diff, n_mag, alpha_F, nsmooth, qminsmooth, imloss, fmlos, ifitm, fitm, fitmi,& - deltal, deltat, nndr, RSG_Mdot, SupraEddMdot, Be_mdotfrac, start_mdot, iledou, idifcon, iover, elph, my, dovhp, iunder,& - dunder, gkorm, alph, agdr, faktor, dgrp, dgrl, dgry, dgrc, dgro, dgr20, nbchx, nrband, xcn, islow, icncst, tauH_fit,& - display_plot, iauto, iprn, iout, itmin, xyfiles, idebug, itests, verbose, stop_deg, n_snap,& - m,gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,dm_lost,& - q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& - xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& - vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26g,vxneut,vxprot,vomegi,& - vxbid,vxbid1& - ) - implicit none - integer:: integer_of_the_star - logical, intent(out):: & - initialised,var_rates,bintide,const_per,Add_Flux,diff_only,qminsmooth,SupraEddMdot,display_plot,xyfiles,verbose,& - stop_deg - integer, intent(out):: & - nwseq,modanf,nzmod,end_at_phase,end_at_model,irot,isol,imagn,ialflu,ianiso,ipop3,ibasnet,phase,iprezams,iopac,ikappa,& - idiff,iadvec,istati,icoeff,igamma,idialo,idialu,n_mag,nsmooth,imloss,ifitm,nndr,RSG_Mdot,iledou,idifcon,iover,my,& - iunder,nbchx,nrband,islow,icncst,tauH_fit,iauto,iprn,iout,itmin,idebug,itests,n_snap - real(kindreal), intent(out):: & - binm2,periodini,zinit,zsol,z,fenerg,richac,frein,K_Kawaler,Omega_saturation,rapcrilim,vwant,xfom,omega,xdial,& - B_initial,add_diff,alpha_F,fmlos,fitm,fitmi,deltal,deltat,Be_mdotfrac,start_mdot,elph,dovhp,dunder,gkorm,alph,& - agdr,faktor,dgrp,dgrl,dgry,dgrc,dgro,dgr20,xcn - character(len=200), intent(out):: & - starname - integer, intent(out) :: m - real(kindreal), intent(out) :: & - gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,& - dm_lost - real(kindreal), dimension(GenecStar%m), intent(out):: & - q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& - xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& - vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26g,vxneut,vxprot,vomegi,& - vxbid,vxbid1 - integer:: get_stellar_model - - initialised = GenecStar%initialised - starname = GenecStar%starname - nwseq = GenecStar%nwseq - modanf = GenecStar%modanf - nzmod = GenecStar%nzmod - end_at_phase = GenecStar%end_at_phase - end_at_model = GenecStar%end_at_model - irot = GenecStar%irot - isol = GenecStar%isol - imagn = GenecStar%imagn - ialflu = GenecStar%ialflu - ianiso = GenecStar%ianiso - ipop3 = GenecStar%ipop3 - ibasnet = GenecStar%ibasnet - phase = GenecStar%phase - iprezams = GenecStar%iprezams - var_rates = GenecStar%var_rates - bintide = GenecStar%bintide - binm2 = GenecStar%binm2 - periodini = GenecStar%periodini - const_per = GenecStar%const_per - iopac = GenecStar%iopac - ikappa = GenecStar%ikappa - zinit = GenecStar%zinit - zsol = GenecStar%zsol - z = GenecStar%z - idiff = GenecStar%idiff - iadvec = GenecStar%iadvec - istati = GenecStar%istati - icoeff = GenecStar%icoeff - igamma = GenecStar%igamma - idialo = GenecStar%idialo - idialu = GenecStar%idialu - n_mag = GenecStar%n_mag - nsmooth = GenecStar%nsmooth - fenerg = GenecStar%fenerg - richac = GenecStar%richac - frein = GenecStar%frein - K_Kawaler = GenecStar%K_Kawaler - Omega_saturation = GenecStar%Omega_saturation - rapcrilim = GenecStar%rapcrilim - vwant = GenecStar%vwant - xfom = GenecStar%xfom - omega = GenecStar%omega - xdial = GenecStar%xdial - B_initial = GenecStar%B_initial - add_diff = GenecStar%add_diff - alpha_F = GenecStar%alpha_F - Add_Flux = GenecStar%Add_Flux - diff_only = GenecStar%diff_only - qminsmooth = GenecStar%qminsmooth - imloss = GenecStar%imloss - ifitm = GenecStar%ifitm - nndr = GenecStar%nndr - RSG_Mdot = GenecStar%RSG_Mdot - fmlos = GenecStar%fmlos - fitm = GenecStar%fitm - fitmi = GenecStar%fitmi - deltal = GenecStar%deltal - deltat = GenecStar%deltat - Be_mdotfrac = GenecStar%Be_mdotfrac - start_mdot = GenecStar%start_mdot - SupraEddMdot = GenecStar%SupraEddMdot - iledou = GenecStar%iledou - idifcon = GenecStar%idifcon - my = GenecStar%my - iover = GenecStar%iover - iunder = GenecStar%iunder - elph = GenecStar%elph - dovhp = GenecStar%dovhp - dunder = GenecStar%dunder - nbchx = GenecStar%nbchx - nrband = GenecStar%nrband - gkorm = GenecStar%gkorm - alph = GenecStar%alph - agdr = GenecStar%agdr - faktor = GenecStar%faktor - dgrp = GenecStar%dgrp - dgrl = GenecStar%dgrl - dgry = GenecStar%dgry - dgrc = GenecStar%dgrc - dgro = GenecStar%dgro - dgr20 = GenecStar%dgr20 - islow = GenecStar%islow - icncst = GenecStar%icncst - tauH_fit = GenecStar%tauH_fit - xcn = GenecStar%xcn - iauto = GenecStar%iauto - iprn = GenecStar%iprn - iout = GenecStar%iout - itmin = GenecStar%itmin - idebug = GenecStar%idebug - itests = GenecStar%itests - n_snap = GenecStar%n_snap - display_plot = GenecStar%display_plot - xyfiles = GenecStar%xyfiles - verbose = GenecStar%verbose - stop_deg = GenecStar%stop_deg - - m = GenecStar%m - gms = GenecStar%gms - alter = GenecStar%alter - gls = GenecStar%gls - teff = GenecStar%teff - glsv = GenecStar%glsv - teffv = GenecStar%teffv - dzeitj = GenecStar%dzeitj - dzeit = GenecStar%dzeit - dzeitv = GenecStar%dzeitv - summas = GenecStar%summas - xmini = GenecStar%xmini - ab = GenecStar%ab - dm_lost = GenecStar%dm_lost - q = GenecStar%q - p = GenecStar%p - t = GenecStar%t - r = GenecStar%r - s = GenecStar%s - x = GenecStar%x - y = GenecStar%y - xc12 = GenecStar%xc12 - vp = GenecStar%vp - vt = GenecStar%vt - vr = GenecStar%vr - vs = GenecStar%vs - xo16 = GenecStar%xo16 - vx = GenecStar%vx - vy = GenecStar%vy - vxc12 = GenecStar%vxc12 - vxo16 = GenecStar%vxo16 - y3 = GenecStar%y3 - xc13 = GenecStar%xc13 - xn14 = GenecStar%xn14 - xn15 = GenecStar%xn15 - xo17 = GenecStar%xo17 - xo18 = GenecStar%xo18 - vy3 = GenecStar%vy3 - vxc13 = GenecStar%vxc13 - vxn14 = GenecStar%vxn14 - vxn15 = GenecStar%vxn15 - vxo17 = GenecStar%vxo17 - vxo18 = GenecStar%vxo18 - xne20 = GenecStar%xne20 - xne22 = GenecStar%xne22 - xmg24 = GenecStar%xmg24 - xmg25 = GenecStar%xmg25 - xmg26 = GenecStar%xmg26 - vxne20 = GenecStar%vxne20 - vxne22 = GenecStar%vxne22 - vxmg24 = GenecStar%vxmg24 - vxmg25 = GenecStar%vxmg25 - vxmg26 = GenecStar%vxmg26 - omegi = GenecStar%omegi - vomegi = GenecStar%vomegi - xf19 = GenecStar%xf19 - xne21 = GenecStar%xne21 - xna23 = GenecStar%xna23 - xal26 = GenecStar%xal26 - xal27 = GenecStar%xal27 - xsi28 = GenecStar%xsi28 - vxf19 = GenecStar%vxf19 - vxne21 = GenecStar%vxne21 - vxna23 = GenecStar%vxna23 - vxal26g = GenecStar%vxal26g - vxal27 = GenecStar%vxal27 - vxsi28 = GenecStar%vxsi28 - xneut = GenecStar%xneut - xprot = GenecStar%xprot - xc14 = GenecStar%xc14 - xf18 = GenecStar%xf18 - xbid = GenecStar%xbid - xbid1 = GenecStar%xbid1 - vxneut = GenecStar%vxneut - vxprot = GenecStar%vxprot - vxc14 = GenecStar%vxc14 - vxf18 = GenecStar%vxf18 - vxbid = GenecStar%vxbid - vxbid1 = GenecStar%vxbid1 - get_stellar_model = 0 -end function - -function recommit_parameters() - implicit none - integer:: recommit_parameters - recommit_parameters = 0 -end function - -function recommit_particles() - implicit none - integer:: recommit_particles - !call finalise() - !call OpenAll() - !call initialise_star() - recommit_particles = 0 -end function - -function set_genec_path(path) - use evol, only: input_dir - implicit none - character(len=200):: path - integer:: set_genec_path - - input_dir = path - set_genec_path = 0 -end function - -!function get_starname(index_of_the_star, am_starname) -! implicit none -! integer:: get_starname, index_of_the_star -! character(len=200):: am_starname -! am_starname = InitialGenecStar%starname -! get_starname = 0 -!end function -! -!function set_starname(index_of_the_star, am_starname) -! implicit none -! integer:: set_starname, index_of_the_star -! character(len=200):: am_starname -! InitialGenecStar%starname = am_starname -! set_starname = 0 -!end function - -!function get_phase(index_of_the_star, phase) -! implicit none -! integer:: index_of_the_star, phase -! integer:: get_phase -! phase = GenecStar%phase -! get_phase = 0 -!end function -! -!function set_phase(index_of_the_star, phase) -! implicit none -! integer:: index_of_the_star, phase -! integer:: set_phase -! GenecStar%phase = phase -! set_phase = 0 -!end function +end function new_stellar_model -function set_temperature_at_zone(index_of_the_star, zone, T_i) - implicit none - integer:: index_of_the_star - integer:: zone, i - real(kindreal):: T_i - integer:: set_temperature_at_zone - i = GenecStar%m - zone - if (zone <= GenecStar%m) then - GenecStar%t(i) = log(T_i) - end if - - set_temperature_at_zone = 0 -end function +!!!!!!!!! end module AmuseInterface diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 7566152a7d..f214208c40 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -51,197 +51,326 @@ } # Parameters (but individual to each star) -GENEC_STAR_PARAMETERS = { - # 'GENEC name: [dtype, unit, description, AMUSE name (optional)] +GENEC_STAR_CHARACTERISTICS = { + # 'GENEC name': [dtype, unit, description, AMUSE name (optional)] 'initialised': ['bool', '', "True if the star is an intialised model"], + 'veryFirst': ['bool', '', 'very first model?'], 'starname': ['string', '', "Name of the star"], - 'nwseq': ['int32', '', ""], - 'modanf': ['int32', '', ""], - 'nzmod': ['int32', '', ""], + 'nwmd': ['int32', '', 'model number'], + 'nwseq': ['int32', '', "number of the first model in the time-step series"], + 'modanf': ['int32', '', ".b file number"], + 'nzmod': ['int32', '', "number of models in a run"], 'end_at_phase': ['int32', '', "Stop if this phase is reached"], 'end_at_model': ['int32', '', "Stop if this model number is reached"], - 'irot': ['int32', '', ""], - 'isol': ['int32', '', ""], - 'imagn': ['int32', '', ""], - 'ialflu': ['int32', '', ""], - 'ianiso': ['int32', '', ""], - 'ipop3': ['int32', '', ""], - 'ibasnet': ['int32', '', ""], - 'phase': ['int32', '', ""], - 'var_rates': ['bool', '', ""], - 'bintide': ['bool', '', ""], - 'binm2': ['float64', '', ""], - 'periodini': ['float64', '', ""], - 'const_per': ['bool', '', ""], +} + +GENEC_STAR_PHYSICS = { + 'irot': ['int32', '', "rotating if set to 1"], + 'isol': ['int32', '', "solid rotation if set to 1"], + 'imagn': ['int32', '', "internal magnetic fields (0=none, 1=included)"], + 'ialflu': ['int32', '', "Ne-Na and Mg-Al networks if set to 1"], + 'ianiso': ['int32', '', "wind anisotropy if set to 1"], + 'ipop3': ['int32', '', "Z=0 models if set to 1"], + 'ibasnet': ['int32', '', "extended nuclear network if set to 1"], + 'phase': ['int32', '', "fusion phases"], + 'var_rates': ['bool', '', "allows to use different reaction rate files if set to True"], + 'bintide': ['bool', '', "tidal interaction in binaries if set to True"], + 'binm2': ['float64', '', "mass of the companion"], + 'periodini': ['float64', '', "initial period of the binary"], + 'const_per': ['bool', '', "keep constant period if True"], 'iprezams': ['int32', '', ""], - 'zinit': ['float64', '', ""], - 'zsol': ['float64', '', ""], - 'z': ['float64', '', ""], - 'iopac': ['int32', '', ""], - 'ikappa': ['int32', '', ""], - 'idiff': ['int32', '', ""], - 'iadvec': ['int32', '', ""], - 'istati': ['int32', '', ""], - 'icoeff': ['int32', '', ""], - 'fenerg': ['float64', '', ""], - 'richac': ['float64', '', ""], - 'igamma': ['int32', '', ""], - 'frein': ['float64', '', ""], - 'K_Kawaler': ['float64', '', ""], - 'Omega_saturation': ['float64', '', ""], - 'rapcrilim': ['float64', '', ""], - 'vwant': ['float64', '', ""], - 'xfom': ['float64', '', ""], - 'omega': ['float64', '', ""], +} + +GENEC_STAR_COMPOSITION = { + 'zinit': ['float64', '', "initial metallicity of the model"], + 'zsol': ['float64', '', "reference solar metallicity"], + 'z': ['float64', '', "abundance of the neglected isotopes"], + 'iopac': ['int32', '', "choice of the opacity table if ikappa = 5"], + 'ikappa': ['int32', '', "opacity choice"], +} + +GENEC_STAR_ROTATION = { + 'idiff': ['int32', '', "computation of the diffusion of Omega and chemicals if set to 1"], + 'iadvec': ['int32', '', "advecto-diffusive version of the transport of Omega if set to 1"], + 'istati': ['int32', '', "only local conservation of angular momentum if set to 1"], + 'icoeff': ['int32', '', "prescription to be used for the diffusion coefficients"], + 'fenerg': ['float64', '', "fraction of the shear energy used for the mixing"], + 'richac': ['float64', '', "critical Richardson number value"], + 'igamma': ['int32', '', "treatment of the shear according to M&M96 if set to 1"], + 'frein': ['float64', '', "magnetic braking if ≠ 0"], + 'K_Kawaler': ['float64', '', "K parameter in Kawaler1998 magnetic braking law"], + 'Omega_saturation': ['float64', '', "Ωsat in Kawaler magnetic braking law"], + 'rapcrilim': ['float64', '', "maximum Ωcrit ratio before the onset of mechanical mass loss"], + 'vwant': ['float64', '', "chosen velocity on the ZAMS (Veq if > 1.0, V/Vcrit if 00, switches on the wind quenching, and evolves the magnetic field strength according to the conservation of magnetic flux"], + 'add_diff': ['float64', '', "additional viscosity value, used to increase the core-envelope coupling"], + 'n_mag': ['int32', '', "type of treatment for magnetic fields"], + 'alpha_F': ['float64', '', "α parameter in Fuller+ 2019. Values higher than 1 lower the threshold to trigger the instability (Qmin) and increase the magnetic viscosity (increased transport)"], + 'nsmooth': ['int32', '', "number of layers used for smoothing the Ω gradient (used by Mag_diff_general). Default value is nsmooth=1, recommended value for Fuller+ 2019 is nsmooth=5"], + 'qminsmooth': ['bool', '', "mag. instability always considered if set to True"], +} + +GENEC_STAR_SURFACE = { + 'imloss': ['int32', '', "choice of the mass-loss prescription"], + 'fmlos': ['float64', '', "except for IMLOSS=2 or 3, multiplying factor applied to the mass loss"], + 'ifitm': ['int32', '', "management of the changes of fitm during redward evolution (and/or blueward evolution after a RSG phase)"], + 'fitm': ['float64', '', "mass included in the interior"], + 'fitmi': ['float64', '', "max value of FITM to which the star will come back when going back to the blue"], + 'deltal': ['float64', '', "triangle size for L at the surface"], + 'deltat': ['float64', '', "triangle size for T at the surface"], + 'nndr': ['int32', '', "management of the behaviour of (L,Teff) with respect to the triangle"], + 'RSG_Mdot': ['int32', '', "mass-loss recipe used for RSG"], + 'SupraEddMdot': ['bool', '', "x3 multiplication factor to the wind in case of supra-Eddington layers if set to True"], 'Be_mdotfrac': ['float64', '', ""], - 'start_mdot': ['float64', '', ""], - 'iledou': ['int32', '', ""], - 'idifcon': ['int32', '', ""], - 'iover': ['int32', '', ""], - 'elph': ['float64', '', ""], - 'my': ['int32', '', ""], - 'dovhp': ['float64', '', ""], - 'iunder': ['int32', '', ""], - 'dunder': ['float64', '', ""], - 'gkorm': ['float64', '', ""], - 'alph': ['float64', '', ""], - 'agdr': ['float64', '', ""], - 'faktor': ['float64', '', ""], - 'dgrp': ['float64', '', ""], - 'dgrl': ['float64', '', ""], - 'dgry': ['float64', '', ""], - 'dgrc': ['float64', '', ""], - 'dgro': ['float64', '', ""], - 'dgr20': ['float64', '', ""], - 'nbchx': ['int32', '', ""], - 'nrband': ['int32', '', ""], - 'xcn': ['float64', '', ""], - 'islow': ['int32', '', ""], - 'icncst': ['int32', '', ""], - 'tauH_fit': ['int32', '', ""], - 'display_plot': ['bool', '', ""], - 'iauto': ['int32', '', ""], - 'iprn': ['int32', '', ""], - 'iout': ['int32', '', ""], - 'itmin': ['int32', '', ""], + 'start_mdot': ['float64', '', "value of Ω/Ωcrit at which the Be mass loss starts to apply"], +} + +GENEC_STAR_CONVECTION = { + 'iledou': ['int32', '', "Ledoux criterion for convection if set to 1"], + 'idifcon': ['int32', '', "convection treated as a diffusion if set to 1 (used during O-b and Si-b)"], + 'iover': ['int32', '', "overshooting taken into account if set to 1"], + 'elph': ['float64', '', "mixing length for the external convective zone"], + 'my': ['int32', '', "integration of the envelope on ρ rather than P if set to 1"], + 'dovhp': ['float64', '', "value of the α overshooting parameter Λ = α HP"], + 'iunder': ['int32', '', "undershooting taken into account if set to 1"], + 'dunder': ['float64', '', "value of the undershooting parameter"], +} + +GENEC_STAR_CONVERGENCE = { + 'gkorm': ['float64', '', "accepted deviation on the structure variables"], + 'alph': ['float64', '', "fraction of the correction applied for the next iteration"], + 'agdr': ['float64', '', "absolute value of the maximum correction accepted on r, s, P and T"], + 'faktor': ['float64', '', "parameter allowing to 'compensate' (during the computation only) for layers with Lr > Ltot, and hence avoid dL/dr < 0"], + 'dgrp': ['float64', '', "relative variations (from one layer to the other) accepted on P"], + 'dgrl': ['float64', '', "relative variations (from one layer to the other) accepted on L"], + 'dgry': ['float64', '', "relative variations (from one layer to the other) accepted on 4He"], + 'dgrc': ['float64', '', "relative variations (from one layer to the other) accepted on 12C"], + 'dgro': ['float64', '', "relative variations (from one layer to the other) accepted on 16O"], + 'dgr20': ['float64', '', "relative variations (from one layer to the other) accepted on ?"], + 'nbchx': ['int32', '', "iteration number for the computation of the change in chemical composition"], + 'nrband': ['int32', '', "iteration number for the chemicals between model n and n+1"], +} + +GENEC_STAR_TIME = { + 'xcn': ['float64', '', "multiplying factor applied on the time step for the next run"], + 'islow': ['int32', '', "slow version of the program if not 0 by modification of the ideal nuclear time step ratxcn"], + 'icncst': ['int32', '', "constant time step (equivalent to xcn=1.0)"], + 'tauH_fit': ['int32', '', "used to set the maximal timestep in case of critical velocity, as a fraction of the MS lifetime"], +} + +GENEC_STAR_VARIOUS = { + 'display_plot': ['bool', '', "display of the pgplot window if set to True"], + 'iauto': ['int32', '', "management of the parameters change through the different phases of the evolution"], + 'iprn': ['int32', '', "the full structure is printed every iprn models. If iprn > nzmod, only one structure will be printed, the one corresponding to model nwseq"], + 'iout': ['int32', '', "number of layers used for the smoothing of the diffusion gradient at the border of the convective zones"], + 'itmin': ['int32', '', "minimal number of iterations in henyey"], 'xyfiles': ['bool', '', ""], - 'idebug': ['int32', '', ""], - 'itests': ['int32', '', ""], - 'verbose': ['bool', '', ""], - 'stop_deg': ['bool', '', ""], + 'idebug': ['int32', '', "addition of some terminal printings useful for the debugging, with different possible levels. All values > 0 set verbose=True"], + 'itests': ['int32', '', "use of a flag to test some pieces of code"], + 'verbose': ['bool', '', "increases the level of printings on the terminal and the .l file"], + 'stop_deg': ['bool', '', "automatically stops a computation when Tc becomes degenerate"], 'n_snap': ['int32', '', "number of steps between snapshots [0]"], } # Stellar properties (but global for the star) GENEC_STAR_PROPERTIES = { - # 'GENEC name: [dtype, unit, description, AMUSE name (optional)] + # 'GENEC name: [dtype, unit, description, AMUSE name (empty = not used)] 'm': ['int32', '', "number of zones", "n_zones"], - 'gms': ['float64', 'MSun', "total mass", 'mass'], - 'alter': ['float64', 'julianyr', "stellar age", 'age'], - 'gls': ['float64', 'LSun', "", 'luminosity'], - 'teff': ['float64', 'K', "effective temperature", 'temperature'], + 'gms': ['float64', 'MSun', "total mass", "mass"], + 'alter': ['float64', 'julianyr', "stellar age", "age"], + 'gls': ['float64', 'LSun', "stellar luminosity", "luminosity"], + 'teff': ['float64', 'K', "effective temperature", "temperature"], 'glsv': ['float64', 'LSun', "previous luminosity"], - 'teffv': ['float64', 'K', "previous effective temperature"], - 'dzeitj': ['float64', 'julianyr', "time step", 'time_step'], - 'dzeit': ['float64', 's', "time step"], - 'dzeitv': ['float64', 's', "previous time step"], - 'xmini': ['float64', 'MSun', "", 'initial_mass'], - 'summas': ['float64', 'MSun', "total mass"], - 'ab': ['float64', '', ""], - 'dm_lost': ['float64', 'MSun', "total mass lost"], + 'teffv': ['float64', 'K', "previous temperature"], + 'dzeitj': ['float64', 'julianyr', "time step (yr)", "time_step"], + 'dzeit': ['float64', 's', "time step (s)", ""], + 'dzeitv': ['float64', 's', "previous time step", ""], + 'xmini': ['float64', 'MSun', "initial mass", "initial_mass"], + 'summas': ['float64', 'MSun', "total mass", ""], + 'ab': ['float64', '', "binary separation", ""], + 'dm_lost': ['float64', 'MSun', "total mass lost", ""], +} + +GENEC_STAR_EXTRA = { + 'mbelx': ['int32', '', "number of extra elements"], + 'xtefflast': ['float64', '', ""], + 'xllast': ['float64', '', ""], + 'xrholast': ['float64', '', ""], + 'xclast': ['float64', '', ""], + 'xtclast': ['float64', '', ""], + 'inum': ['int32', '', ""], + 'nsugi': ['int32', '', ""], + 'period': ['float64', '', ""], + 'r_core': ['float64', '', ""], + 'vna': ['float64', '', "adiabatic gradient in the envelope"], + 'vnr': ['float64', '', "radiative gradient in the envelope"], } # Structural properties (m layers) GENEC_STAR_STRUCTURE = { - # 'GENEC name: [dtype, unit, description, AMUSE name (optional)] - 'q': ['float64', '', ""], - 'p': ['float64', '', ""], - 't': ['float64', '', ""], - 'r': ['float64', '', ""], - 's': ['float64', '', ""], - 'x': ['float64', '', "H fraction"], - 'y3': ['float64', '', "He3 fraction"], - 'y': ['float64', '', "He fraction"], - 'xc12': ['float64', '', "C12 fraction"], - 'xc13': ['float64', '', "C13 fraction"], - 'xn14': ['float64', '', "N14 fraction"], - 'xn15': ['float64', '', ""], - 'xo16': ['float64', '', ""], - 'xo17': ['float64', '', ""], - 'xo18': ['float64', '', ""], - 'xne20': ['float64', '', ""], - 'xne22': ['float64', '', ""], - 'xmg24': ['float64', '', ""], - 'xmg25': ['float64', '', ""], - 'xmg26': ['float64', '', ""], - 'xf19': ['float64', '', ""], - 'xne21': ['float64', '', ""], - 'xna23': ['float64', '', ""], - 'xal27': ['float64', '', ""], - 'xsi28': ['float64', '', ""], - 'xc14': ['float64', '', ""], - 'xf18': ['float64', '', ""], - 'xal26': ['float64', '', ""], - 'xneut': ['float64', '', "Neutron fraction"], - 'xprot': ['float64', '', "Proton fraction"], + # 'GENEC name: [dtype, unit, description, AMUSE name (optional) + 'q': ['float64', '', "ln(1-Mr/M)"], + 'p': ['float64', '', "ln(pressure)"], + 't': ['float64', '', "ln(temperature)"], + 'r': ['float64', '', "ln(radius)"], + 's': ['float64', '', "ln(internal luminosity + 1)"], + 'x': ['float64', '', "H abundance fraction"], + 'y3': ['float64', '', "He3 abundance fraction"], + 'y': ['float64', '', "He abundance fraction"], + 'xc12': ['float64', '', "C12 abundance fraction"], + 'xc13': ['float64', '', "C13 abundance fraction"], + 'xn14': ['float64', '', "N14 abundance fraction"], + 'xn15': ['float64', '', "N15 abundance fraction"], + 'xo16': ['float64', '', "O16 abundance fraction"], + 'xo17': ['float64', '', "O17 abundance fraction"], + 'xo18': ['float64', '', "O18 abundance fraction"], + 'xne20': ['float64', '', "Ne20 abundance fraction"], + 'xne22': ['float64', '', "Ne22 abundance fraction"], + 'xmg24': ['float64', '', "Mg24 abundance fraction"], + 'xmg25': ['float64', '', "Mg25 abundance fraction"], + 'xmg26': ['float64', '', "Mg26 abundance fraction"], + 'xf19': ['float64', '', "F19 abundance fraction"], + 'xne21': ['float64', '', "Ne21 abundance fraction"], + 'xna23': ['float64', '', "Na23 abundance fraction"], + 'xal27': ['float64', '', "Al27 abundance fraction"], + 'xsi28': ['float64', '', "Si28 abundance fraction"], + 'xc14': ['float64', '', "C14 abundance fraction"], + 'xf18': ['float64', '', "F18 abundance fraction"], + 'xal26': ['float64', '', "Al26 abundance fraction"], + 'xneut': ['float64', '', "Neutron abundance fraction"], + 'xprot': ['float64', '', "Proton abundance fraction"], 'omegi': ['float64', '', "Rotation"], - 'xbid': ['float64', '', ""], - 'xbid1': ['float64', '', ""], - 'vp': ['float64', '', ""], - 'vt': ['float64', '', ""], - 'vr': ['float64', '', ""], - 'vs': ['float64', '', ""], - 'vx': ['float64', '', ""], - 'vy': ['float64', '', ""], - 'vy3': ['float64', '', ""], - 'vxc12': ['float64', '', ""], - 'vxc13': ['float64', '', ""], - 'vxn14': ['float64', '', ""], - 'vxn15': ['float64', '', ""], - 'vxo16': ['float64', '', ""], - 'vxo17': ['float64', '', ""], - 'vxo18': ['float64', '', ""], - 'vxne20': ['float64', '', ""], - 'vxne22': ['float64', '', ""], - 'vxmg24': ['float64', '', ""], - 'vxmg25': ['float64', '', ""], - 'vxmg26': ['float64', '', ""], - 'vxf19': ['float64', '', ""], - 'vxne21': ['float64', '', ""], - 'vxna23': ['float64', '', ""], - 'vxal27': ['float64', '', ""], - 'vxsi28': ['float64', '', ""], - 'vxc14': ['float64', '', ""], - 'vxf18': ['float64', '', ""], - 'vxal26g': ['float64', '', ""], - 'vxneut': ['float64', '', ""], - 'vxprot': ['float64', '', ""], - 'vomegi': ['float64', '', ""], - 'vxbid': ['float64', '', ""], - 'vxbid1': ['float64', '', ""], + 'xbid': ['float64', '', "Pseudo element abundance fraction"], + 'xbid1': ['float64', '', "Pseudo element 2 abundance fraction"], + 'vp': ['float64', '', "Previous ln(pressure)"], + 'vt': ['float64', '', "Previous ln(temperature)"], + 'vr': ['float64', '', "Previous ln(radius)"], + 'vs': ['float64', '', "Previous ln(internal luminosity + 1)"], + 'vx': ['float64', '', "Previous H abundance fraction"], + 'vy': ['float64', '', "Previous He abundance fraction"], + 'vy3': ['float64', '', "Previous He3 abundance fraction"], + 'vxc12': ['float64', '', "Previous C12 abundance fraction"], + 'vxc13': ['float64', '', "Previous C13 abundance fraction"], + 'vxn14': ['float64', '', "Previous N14 abundance fraction"], + 'vxn15': ['float64', '', "Previous N15 abundance fraction"], + 'vxo16': ['float64', '', "Previous O16 abundance fraction"], + 'vxo17': ['float64', '', "Previous O17 abundance fraction"], + 'vxo18': ['float64', '', "Previous O18 abundance fraction"], + 'vxne20': ['float64', '', "Previous Ne20 abundance fraction"], + 'vxne22': ['float64', '', "Previous Ne22 abundance fraction"], + 'vxmg24': ['float64', '', "Previous Mg24 abundance fraction"], + 'vxmg25': ['float64', '', "Previous Mg25 abundance fraction"], + 'vxmg26': ['float64', '', "Previous Mg26 abundance fraction"], + 'vxf19': ['float64', '', "Previous F19 abundance fraction"], + 'vxne21': ['float64', '', "Previous Ne21 abundance fraction"], + 'vxna23': ['float64', '', "Previous Na23 abundance fraction"], + 'vxal27': ['float64', '', "Previous Al27 abundance fraction"], + 'vxsi28': ['float64', '', "Previous Si28 abundance fraction"], + 'vxc14': ['float64', '', "Previous C14 abundance fraction"], + 'vxf18': ['float64', '', "Previous F18 abundance fraction"], + 'vxal26': ['float64', '', "Previous Al26 abundance fraction"], + 'vxneut': ['float64', '', "Previous Neutron abundance fraction"], + 'vxprot': ['float64', '', "Previous Proton abundance fraction"], + 'vomegi': ['float64', '', "Previous rotation"], + 'vxbid': ['float64', '', "Previous Pseudo element abundance fraction"], + 'vxbid1': ['float64', '', "Previous Pseudo element 2 abundance fraction"], +} + +# Structural properties (mbelx elements, m layers) +GENEC_STAR_STRUCTURE_EXTRA = { + 'abelx': ['float64', '', "extra elements"], + 'vabelx': ['float64', '', "previous extra elements"], +} + +# These are not (re)stored / set, but they are calculated e.g. for plotting +GENEC_STAR_STRUCTURE_DERIVED = { + 'eps': ['float64', '', ""], + 'epsy': ['float64', '', ""], + 'eps_c_adv': ['float64', '', ""], + 'eps_ne_adv': ['float64', '', ""], + 'eps_o_adv': ['float64', '', ""], + 'eps_si_adv': ['float64', '', ""], + 'eps_grav': ['float64', '', ""], + 'eps_nu': ['float64', '', ""], + 'nabla_rad': ['float64', '', ""], + 'nabla_ad': ['float64', '', ""], + 'nabla_mu': ['float64', '', ""], +} + +GENEC_NETDEF_SCALARS = { + 'xlostneu': ['float64', '', "lost neutrons"], +} +GENEC_NETDEF_ARRAYS = { + 'nbzel': ['int32', '', 'length 8'], + 'nbael': ['int32', '', 'length 8'], + 'abels': ['float64', '', 'length 8'], +} +GENEC_NETALU_ARRAYS = { + 'xnetalu': ['float64', '', 'length 5'], +} + +ALL_SETTERS = { + **GENEC_STAR_CHARACTERISTICS, + **GENEC_STAR_PHYSICS, + **GENEC_STAR_COMPOSITION, + **GENEC_STAR_ROTATION, + **GENEC_STAR_SURFACE, + **GENEC_STAR_CONVECTION, + **GENEC_STAR_CONVERGENCE, + **GENEC_STAR_TIME, + **GENEC_STAR_VARIOUS, + **GENEC_STAR_PROPERTIES, + **GENEC_STAR_EXTRA, + **GENEC_STAR_STRUCTURE, + **GENEC_STAR_STRUCTURE_EXTRA, +} +SCALAR_SETTERS = { + **GENEC_STAR_CHARACTERISTICS, + **GENEC_STAR_PHYSICS, + **GENEC_STAR_COMPOSITION, + **GENEC_STAR_ROTATION, + **GENEC_STAR_SURFACE, + **GENEC_STAR_CONVECTION, + **GENEC_STAR_CONVERGENCE, + **GENEC_STAR_TIME, + **GENEC_STAR_VARIOUS, + **GENEC_STAR_PROPERTIES, + **GENEC_STAR_EXTRA, + **GENEC_NETDEF_SCALARS, +} + +VECTOR_SETTERS = { + **GENEC_STAR_STRUCTURE, + **GENEC_STAR_STRUCTURE_EXTRA, +} +ALL_GETTERS = { + **GENEC_STAR_CHARACTERISTICS, + **GENEC_STAR_PHYSICS, + **GENEC_STAR_COMPOSITION, + **GENEC_STAR_ROTATION, + **GENEC_STAR_SURFACE, + **GENEC_STAR_CONVECTION, + **GENEC_STAR_CONVERGENCE, + **GENEC_STAR_TIME, + **GENEC_STAR_VARIOUS, + **GENEC_STAR_PROPERTIES, + **GENEC_STAR_EXTRA, + **GENEC_STAR_STRUCTURE, + **GENEC_STAR_STRUCTURE_EXTRA, + **GENEC_STAR_STRUCTURE_DERIVED, + **GENEC_NETDEF_SCALARS, + **GENEC_NETDEF_ARRAYS, + **GENEC_NETALU_ARRAYS, } + class GenecInterface( CodeInterface, LiteratureReferencesMixIn, @@ -265,14 +394,135 @@ def __init__(self, **keyword_arguments): LiteratureReferencesMixIn.__init__(self) CodeWithDataDirectories.__init__(self) - @legacy_function + @remote_function def finalize_stellar_model(): + returns () + + @remote_function + def set_genec_path(genec_path='s'): + returns () + + @remote_function + def commit_parameters(): + returns () + + @legacy_function + def new_particle(): + """ + Define a new star in the code. The star will start with the given mass. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = False + function.addParameter( + 'index_of_the_particle', dtype='int32', direction=function.OUT, + description=( + "The new index for the star. This index can be used to refer " + "to this star in other functions" + ) + ) + function.addParameter( + 'mass', dtype='float64', direction=function.IN, + description="The initial mass of the star") + function.addParameter( + 'metallicity', dtype='float64', direction=function.IN, + default=0.014, + description="The initial metallicity of the star (default: 0.014)") + function.addParameter( + 'starname', dtype='string', direction=function.IN, + default='AmuseStar', description="The star's name") + # function.addParameter( + # 'age_tag', dtype='float64', direction=function.IN, + # description="Starting age of the star *to be specified exactly*") + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + New star was loaded and the index_of_the_particle parameter set. + -1 - ERROR + New star could not be created. + """ + return function + + @legacy_function + def new_stellar_model(): + """ + New star from an existing model + """ function = LegacyFunctionSpecification() + # function.can_handle_array = True + function.must_handle_array = True + function.addParameter( + 'index_of_the_particle', dtype='int32', direction=function.OUT, + description=( + "The new index for the star. This index can be used to refer " + "to this star in other functions" + ) + ) + for parameter in SCALAR_SETTERS.items(): + if parameter[1][1] == "": + unit = NO_UNIT + else: + unit = getattr(units, parameter[1][1]) + function.addParameter( + parameter[0], + dtype=parameter[1][0], + unit=unit, + description=parameter[1][2], + direction=function.IN, + ) + for parameter in GENEC_STAR_STRUCTURE.items(): + if parameter[1][1] == "": + unit = NO_UNIT + else: + unit = getattr(units, parameter[1][1]) + function.addParameter( + parameter[0], + dtype=parameter[1][0], + unit=unit, + description=parameter[1][2], + direction=function.IN, + ) + # for parameter in GENEC_STAR_STRUCTURE_EXTRA.items(): + # if parameter[1][1] == "": + # unit = NO_UNIT + # else: + # unit = getattr(units, parameter[1][1]) + # function.addParameter( + # parameter[0], + # dtype=parameter[1][0], + # unit=unit, + # description=parameter[1][2], + # direction=function.IN, + # ) + function.addParameter('n', 'int32', function.LENGTH) function.result_type = 'int32' return function - @remote_function - def set_genec_path(genec_path='s'): + @remote_function(can_handle_array=True) + def get_firstlast_zone(index_of_the_particle='i'): + returns (first='i', last='i') + + @remote_function(can_handle_array=True) + def get_surface_velocity(index_of_the_particle='i'): + returns (surface_velocity='d') + + @remote_function(can_handle_array=True) + def get_luminosity_at_zone(index_of_the_particle='i', zone='i'): + returns (lum_i='d' | units.LSun) + + @remote_function(can_handle_array=True) + def get_mass_of_species(index_of_the_particle='i', species='i'): + returns (species_mass='d') + + + @remote_function(can_handle_array=True) + def get_veryFirst(index_of_the_particle='i'): + returns (veryFirst='bool') + + @remote_function(can_handle_array=True) + def set_veryFirst( + index_of_the_particle='i', + veryFirst='bool', + ): returns () @remote_function(can_handle_array=True) @@ -280,7 +530,10 @@ def get_initialised(index_of_the_particle='i'): returns (initialised='bool') @remote_function(can_handle_array=True) - def set_initialised(index_of_the_particle='i', initialised='bool'): + def set_initialised( + index_of_the_particle='i', + initialised='bool', + ): returns () @remote_function(can_handle_array=True) @@ -288,7 +541,21 @@ def get_starname(index_of_the_particle='i'): returns (starname='string') @remote_function(can_handle_array=True) - def set_starname(index_of_the_particle='i', starname='string'): + def set_starname( + index_of_the_particle='i', + starname='string', + ): + returns () + + @remote_function(can_handle_array=True) + def get_nwmd(index_of_the_particle='i'): + returns (nwmd='int32') + + @remote_function(can_handle_array=True) + def set_nwmd( + index_of_the_particle='i', + nwmd='int32', + ): returns () @remote_function(can_handle_array=True) @@ -296,7 +563,10 @@ def get_nwseq(index_of_the_particle='i'): returns (nwseq='int32') @remote_function(can_handle_array=True) - def set_nwseq(index_of_the_particle='i', nwseq='int32'): + def set_nwseq( + index_of_the_particle='i', + nwseq='int32', + ): returns () @remote_function(can_handle_array=True) @@ -304,7 +574,10 @@ def get_modanf(index_of_the_particle='i'): returns (modanf='int32') @remote_function(can_handle_array=True) - def set_modanf(index_of_the_particle='i', modanf='int32'): + def set_modanf( + index_of_the_particle='i', + modanf='int32', + ): returns () @remote_function(can_handle_array=True) @@ -312,7 +585,10 @@ def get_nzmod(index_of_the_particle='i'): returns (nzmod='int32') @remote_function(can_handle_array=True) - def set_nzmod(index_of_the_particle='i', nzmod='int32'): + def set_nzmod( + index_of_the_particle='i', + nzmod='int32', + ): returns () @remote_function(can_handle_array=True) @@ -320,7 +596,10 @@ def get_end_at_phase(index_of_the_particle='i'): returns (end_at_phase='int32') @remote_function(can_handle_array=True) - def set_end_at_phase(index_of_the_particle='i', end_at_phase='int32'): + def set_end_at_phase( + index_of_the_particle='i', + end_at_phase='int32', + ): returns () @remote_function(can_handle_array=True) @@ -328,7 +607,10 @@ def get_end_at_model(index_of_the_particle='i'): returns (end_at_model='int32') @remote_function(can_handle_array=True) - def set_end_at_model(index_of_the_particle='i', end_at_model='int32'): + def set_end_at_model( + index_of_the_particle='i', + end_at_model='int32', + ): returns () @remote_function(can_handle_array=True) @@ -336,7 +618,10 @@ def get_irot(index_of_the_particle='i'): returns (irot='int32') @remote_function(can_handle_array=True) - def set_irot(index_of_the_particle='i', irot='int32'): + def set_irot( + index_of_the_particle='i', + irot='int32', + ): returns () @remote_function(can_handle_array=True) @@ -344,7 +629,10 @@ def get_isol(index_of_the_particle='i'): returns (isol='int32') @remote_function(can_handle_array=True) - def set_isol(index_of_the_particle='i', isol='int32'): + def set_isol( + index_of_the_particle='i', + isol='int32', + ): returns () @remote_function(can_handle_array=True) @@ -352,7 +640,10 @@ def get_imagn(index_of_the_particle='i'): returns (imagn='int32') @remote_function(can_handle_array=True) - def set_imagn(index_of_the_particle='i', imagn='int32'): + def set_imagn( + index_of_the_particle='i', + imagn='int32', + ): returns () @remote_function(can_handle_array=True) @@ -360,7 +651,10 @@ def get_ialflu(index_of_the_particle='i'): returns (ialflu='int32') @remote_function(can_handle_array=True) - def set_ialflu(index_of_the_particle='i', ialflu='int32'): + def set_ialflu( + index_of_the_particle='i', + ialflu='int32', + ): returns () @remote_function(can_handle_array=True) @@ -368,7 +662,10 @@ def get_ianiso(index_of_the_particle='i'): returns (ianiso='int32') @remote_function(can_handle_array=True) - def set_ianiso(index_of_the_particle='i', ianiso='int32'): + def set_ianiso( + index_of_the_particle='i', + ianiso='int32', + ): returns () @remote_function(can_handle_array=True) @@ -376,7 +673,10 @@ def get_ipop3(index_of_the_particle='i'): returns (ipop3='int32') @remote_function(can_handle_array=True) - def set_ipop3(index_of_the_particle='i', ipop3='int32'): + def set_ipop3( + index_of_the_particle='i', + ipop3='int32', + ): returns () @remote_function(can_handle_array=True) @@ -384,7 +684,10 @@ def get_ibasnet(index_of_the_particle='i'): returns (ibasnet='int32') @remote_function(can_handle_array=True) - def set_ibasnet(index_of_the_particle='i', ibasnet='int32'): + def set_ibasnet( + index_of_the_particle='i', + ibasnet='int32', + ): returns () @remote_function(can_handle_array=True) @@ -392,7 +695,10 @@ def get_phase(index_of_the_particle='i'): returns (phase='int32') @remote_function(can_handle_array=True) - def set_phase(index_of_the_particle='i', phase='int32'): + def set_phase( + index_of_the_particle='i', + phase='int32', + ): returns () @remote_function(can_handle_array=True) @@ -400,7 +706,10 @@ def get_var_rates(index_of_the_particle='i'): returns (var_rates='bool') @remote_function(can_handle_array=True) - def set_var_rates(index_of_the_particle='i', var_rates='bool'): + def set_var_rates( + index_of_the_particle='i', + var_rates='bool', + ): returns () @remote_function(can_handle_array=True) @@ -408,7 +717,10 @@ def get_bintide(index_of_the_particle='i'): returns (bintide='bool') @remote_function(can_handle_array=True) - def set_bintide(index_of_the_particle='i', bintide='bool'): + def set_bintide( + index_of_the_particle='i', + bintide='bool', + ): returns () @remote_function(can_handle_array=True) @@ -416,7 +728,10 @@ def get_binm2(index_of_the_particle='i'): returns (binm2='float64') @remote_function(can_handle_array=True) - def set_binm2(index_of_the_particle='i', binm2='float64'): + def set_binm2( + index_of_the_particle='i', + binm2='float64', + ): returns () @remote_function(can_handle_array=True) @@ -424,7 +739,10 @@ def get_periodini(index_of_the_particle='i'): returns (periodini='float64') @remote_function(can_handle_array=True) - def set_periodini(index_of_the_particle='i', periodini='float64'): + def set_periodini( + index_of_the_particle='i', + periodini='float64', + ): returns () @remote_function(can_handle_array=True) @@ -432,7 +750,10 @@ def get_const_per(index_of_the_particle='i'): returns (const_per='bool') @remote_function(can_handle_array=True) - def set_const_per(index_of_the_particle='i', const_per='bool'): + def set_const_per( + index_of_the_particle='i', + const_per='bool', + ): returns () @remote_function(can_handle_array=True) @@ -440,7 +761,10 @@ def get_iprezams(index_of_the_particle='i'): returns (iprezams='int32') @remote_function(can_handle_array=True) - def set_iprezams(index_of_the_particle='i', iprezams='int32'): + def set_iprezams( + index_of_the_particle='i', + iprezams='int32', + ): returns () @remote_function(can_handle_array=True) @@ -448,7 +772,10 @@ def get_zinit(index_of_the_particle='i'): returns (zinit='float64') @remote_function(can_handle_array=True) - def set_zinit(index_of_the_particle='i', zinit='float64'): + def set_zinit( + index_of_the_particle='i', + zinit='float64', + ): returns () @remote_function(can_handle_array=True) @@ -456,7 +783,10 @@ def get_zsol(index_of_the_particle='i'): returns (zsol='float64') @remote_function(can_handle_array=True) - def set_zsol(index_of_the_particle='i', zsol='float64'): + def set_zsol( + index_of_the_particle='i', + zsol='float64', + ): returns () @remote_function(can_handle_array=True) @@ -464,7 +794,10 @@ def get_z(index_of_the_particle='i'): returns (z='float64') @remote_function(can_handle_array=True) - def set_z(index_of_the_particle='i', z='float64'): + def set_z( + index_of_the_particle='i', + z='float64', + ): returns () @remote_function(can_handle_array=True) @@ -472,7 +805,10 @@ def get_iopac(index_of_the_particle='i'): returns (iopac='int32') @remote_function(can_handle_array=True) - def set_iopac(index_of_the_particle='i', iopac='int32'): + def set_iopac( + index_of_the_particle='i', + iopac='int32', + ): returns () @remote_function(can_handle_array=True) @@ -480,7 +816,10 @@ def get_ikappa(index_of_the_particle='i'): returns (ikappa='int32') @remote_function(can_handle_array=True) - def set_ikappa(index_of_the_particle='i', ikappa='int32'): + def set_ikappa( + index_of_the_particle='i', + ikappa='int32', + ): returns () @remote_function(can_handle_array=True) @@ -488,7 +827,10 @@ def get_idiff(index_of_the_particle='i'): returns (idiff='int32') @remote_function(can_handle_array=True) - def set_idiff(index_of_the_particle='i', idiff='int32'): + def set_idiff( + index_of_the_particle='i', + idiff='int32', + ): returns () @remote_function(can_handle_array=True) @@ -496,7 +838,10 @@ def get_iadvec(index_of_the_particle='i'): returns (iadvec='int32') @remote_function(can_handle_array=True) - def set_iadvec(index_of_the_particle='i', iadvec='int32'): + def set_iadvec( + index_of_the_particle='i', + iadvec='int32', + ): returns () @remote_function(can_handle_array=True) @@ -504,7 +849,10 @@ def get_istati(index_of_the_particle='i'): returns (istati='int32') @remote_function(can_handle_array=True) - def set_istati(index_of_the_particle='i', istati='int32'): + def set_istati( + index_of_the_particle='i', + istati='int32', + ): returns () @remote_function(can_handle_array=True) @@ -512,7 +860,10 @@ def get_icoeff(index_of_the_particle='i'): returns (icoeff='int32') @remote_function(can_handle_array=True) - def set_icoeff(index_of_the_particle='i', icoeff='int32'): + def set_icoeff( + index_of_the_particle='i', + icoeff='int32', + ): returns () @remote_function(can_handle_array=True) @@ -520,7 +871,10 @@ def get_fenerg(index_of_the_particle='i'): returns (fenerg='float64') @remote_function(can_handle_array=True) - def set_fenerg(index_of_the_particle='i', fenerg='float64'): + def set_fenerg( + index_of_the_particle='i', + fenerg='float64', + ): returns () @remote_function(can_handle_array=True) @@ -528,7 +882,10 @@ def get_richac(index_of_the_particle='i'): returns (richac='float64') @remote_function(can_handle_array=True) - def set_richac(index_of_the_particle='i', richac='float64'): + def set_richac( + index_of_the_particle='i', + richac='float64', + ): returns () @remote_function(can_handle_array=True) @@ -536,7 +893,10 @@ def get_igamma(index_of_the_particle='i'): returns (igamma='int32') @remote_function(can_handle_array=True) - def set_igamma(index_of_the_particle='i', igamma='int32'): + def set_igamma( + index_of_the_particle='i', + igamma='int32', + ): returns () @remote_function(can_handle_array=True) @@ -544,7 +904,10 @@ def get_frein(index_of_the_particle='i'): returns (frein='float64') @remote_function(can_handle_array=True) - def set_frein(index_of_the_particle='i', frein='float64'): + def set_frein( + index_of_the_particle='i', + frein='float64', + ): returns () @remote_function(can_handle_array=True) @@ -552,7 +915,10 @@ def get_K_Kawaler(index_of_the_particle='i'): returns (K_Kawaler='float64') @remote_function(can_handle_array=True) - def set_K_Kawaler(index_of_the_particle='i', K_Kawaler='float64'): + def set_K_Kawaler( + index_of_the_particle='i', + K_Kawaler='float64', + ): returns () @remote_function(can_handle_array=True) @@ -560,7 +926,10 @@ def get_Omega_saturation(index_of_the_particle='i'): returns (Omega_saturation='float64') @remote_function(can_handle_array=True) - def set_Omega_saturation(index_of_the_particle='i', Omega_saturation='float64'): + def set_Omega_saturation( + index_of_the_particle='i', + Omega_saturation='float64', + ): returns () @remote_function(can_handle_array=True) @@ -568,7 +937,10 @@ def get_rapcrilim(index_of_the_particle='i'): returns (rapcrilim='float64') @remote_function(can_handle_array=True) - def set_rapcrilim(index_of_the_particle='i', rapcrilim='float64'): + def set_rapcrilim( + index_of_the_particle='i', + rapcrilim='float64', + ): returns () @remote_function(can_handle_array=True) @@ -576,7 +948,10 @@ def get_vwant(index_of_the_particle='i'): returns (vwant='float64') @remote_function(can_handle_array=True) - def set_vwant(index_of_the_particle='i', vwant='float64'): + def set_vwant( + index_of_the_particle='i', + vwant='float64', + ): returns () @remote_function(can_handle_array=True) @@ -584,7 +959,10 @@ def get_xfom(index_of_the_particle='i'): returns (xfom='float64') @remote_function(can_handle_array=True) - def set_xfom(index_of_the_particle='i', xfom='float64'): + def set_xfom( + index_of_the_particle='i', + xfom='float64', + ): returns () @remote_function(can_handle_array=True) @@ -592,7 +970,10 @@ def get_omega(index_of_the_particle='i'): returns (omega='float64') @remote_function(can_handle_array=True) - def set_omega(index_of_the_particle='i', omega='float64'): + def set_omega( + index_of_the_particle='i', + omega='float64', + ): returns () @remote_function(can_handle_array=True) @@ -600,7 +981,10 @@ def get_xdial(index_of_the_particle='i'): returns (xdial='float64') @remote_function(can_handle_array=True) - def set_xdial(index_of_the_particle='i', xdial='float64'): + def set_xdial( + index_of_the_particle='i', + xdial='float64', + ): returns () @remote_function(can_handle_array=True) @@ -608,7 +992,10 @@ def get_idialo(index_of_the_particle='i'): returns (idialo='int32') @remote_function(can_handle_array=True) - def set_idialo(index_of_the_particle='i', idialo='int32'): + def set_idialo( + index_of_the_particle='i', + idialo='int32', + ): returns () @remote_function(can_handle_array=True) @@ -616,7 +1003,10 @@ def get_idialu(index_of_the_particle='i'): returns (idialu='int32') @remote_function(can_handle_array=True) - def set_idialu(index_of_the_particle='i', idialu='int32'): + def set_idialu( + index_of_the_particle='i', + idialu='int32', + ): returns () @remote_function(can_handle_array=True) @@ -624,7 +1014,10 @@ def get_Add_Flux(index_of_the_particle='i'): returns (Add_Flux='bool') @remote_function(can_handle_array=True) - def set_Add_Flux(index_of_the_particle='i', Add_Flux='bool'): + def set_Add_Flux( + index_of_the_particle='i', + Add_Flux='bool', + ): returns () @remote_function(can_handle_array=True) @@ -632,7 +1025,10 @@ def get_diff_only(index_of_the_particle='i'): returns (diff_only='bool') @remote_function(can_handle_array=True) - def set_diff_only(index_of_the_particle='i', diff_only='bool'): + def set_diff_only( + index_of_the_particle='i', + diff_only='bool', + ): returns () @remote_function(can_handle_array=True) @@ -640,7 +1036,10 @@ def get_B_initial(index_of_the_particle='i'): returns (B_initial='float64') @remote_function(can_handle_array=True) - def set_B_initial(index_of_the_particle='i', B_initial='float64'): + def set_B_initial( + index_of_the_particle='i', + B_initial='float64', + ): returns () @remote_function(can_handle_array=True) @@ -648,7 +1047,10 @@ def get_add_diff(index_of_the_particle='i'): returns (add_diff='float64') @remote_function(can_handle_array=True) - def set_add_diff(index_of_the_particle='i', add_diff='float64'): + def set_add_diff( + index_of_the_particle='i', + add_diff='float64', + ): returns () @remote_function(can_handle_array=True) @@ -656,7 +1058,10 @@ def get_n_mag(index_of_the_particle='i'): returns (n_mag='int32') @remote_function(can_handle_array=True) - def set_n_mag(index_of_the_particle='i', n_mag='int32'): + def set_n_mag( + index_of_the_particle='i', + n_mag='int32', + ): returns () @remote_function(can_handle_array=True) @@ -664,7 +1069,10 @@ def get_alpha_F(index_of_the_particle='i'): returns (alpha_F='float64') @remote_function(can_handle_array=True) - def set_alpha_F(index_of_the_particle='i', alpha_F='float64'): + def set_alpha_F( + index_of_the_particle='i', + alpha_F='float64', + ): returns () @remote_function(can_handle_array=True) @@ -672,7 +1080,10 @@ def get_nsmooth(index_of_the_particle='i'): returns (nsmooth='int32') @remote_function(can_handle_array=True) - def set_nsmooth(index_of_the_particle='i', nsmooth='int32'): + def set_nsmooth( + index_of_the_particle='i', + nsmooth='int32', + ): returns () @remote_function(can_handle_array=True) @@ -680,7 +1091,10 @@ def get_qminsmooth(index_of_the_particle='i'): returns (qminsmooth='bool') @remote_function(can_handle_array=True) - def set_qminsmooth(index_of_the_particle='i', qminsmooth='bool'): + def set_qminsmooth( + index_of_the_particle='i', + qminsmooth='bool', + ): returns () @remote_function(can_handle_array=True) @@ -688,7 +1102,10 @@ def get_imloss(index_of_the_particle='i'): returns (imloss='int32') @remote_function(can_handle_array=True) - def set_imloss(index_of_the_particle='i', imloss='int32'): + def set_imloss( + index_of_the_particle='i', + imloss='int32', + ): returns () @remote_function(can_handle_array=True) @@ -696,7 +1113,10 @@ def get_fmlos(index_of_the_particle='i'): returns (fmlos='float64') @remote_function(can_handle_array=True) - def set_fmlos(index_of_the_particle='i', fmlos='float64'): + def set_fmlos( + index_of_the_particle='i', + fmlos='float64', + ): returns () @remote_function(can_handle_array=True) @@ -704,7 +1124,10 @@ def get_ifitm(index_of_the_particle='i'): returns (ifitm='int32') @remote_function(can_handle_array=True) - def set_ifitm(index_of_the_particle='i', ifitm='int32'): + def set_ifitm( + index_of_the_particle='i', + ifitm='int32', + ): returns () @remote_function(can_handle_array=True) @@ -712,7 +1135,10 @@ def get_fitm(index_of_the_particle='i'): returns (fitm='float64') @remote_function(can_handle_array=True) - def set_fitm(index_of_the_particle='i', fitm='float64'): + def set_fitm( + index_of_the_particle='i', + fitm='float64', + ): returns () @remote_function(can_handle_array=True) @@ -720,7 +1146,10 @@ def get_fitmi(index_of_the_particle='i'): returns (fitmi='float64') @remote_function(can_handle_array=True) - def set_fitmi(index_of_the_particle='i', fitmi='float64'): + def set_fitmi( + index_of_the_particle='i', + fitmi='float64', + ): returns () @remote_function(can_handle_array=True) @@ -728,7 +1157,10 @@ def get_deltal(index_of_the_particle='i'): returns (deltal='float64') @remote_function(can_handle_array=True) - def set_deltal(index_of_the_particle='i', deltal='float64'): + def set_deltal( + index_of_the_particle='i', + deltal='float64', + ): returns () @remote_function(can_handle_array=True) @@ -736,7 +1168,10 @@ def get_deltat(index_of_the_particle='i'): returns (deltat='float64') @remote_function(can_handle_array=True) - def set_deltat(index_of_the_particle='i', deltat='float64'): + def set_deltat( + index_of_the_particle='i', + deltat='float64', + ): returns () @remote_function(can_handle_array=True) @@ -744,7 +1179,10 @@ def get_nndr(index_of_the_particle='i'): returns (nndr='int32') @remote_function(can_handle_array=True) - def set_nndr(index_of_the_particle='i', nndr='int32'): + def set_nndr( + index_of_the_particle='i', + nndr='int32', + ): returns () @remote_function(can_handle_array=True) @@ -752,7 +1190,10 @@ def get_RSG_Mdot(index_of_the_particle='i'): returns (RSG_Mdot='int32') @remote_function(can_handle_array=True) - def set_RSG_Mdot(index_of_the_particle='i', RSG_Mdot='int32'): + def set_RSG_Mdot( + index_of_the_particle='i', + RSG_Mdot='int32', + ): returns () @remote_function(can_handle_array=True) @@ -760,7 +1201,10 @@ def get_SupraEddMdot(index_of_the_particle='i'): returns (SupraEddMdot='bool') @remote_function(can_handle_array=True) - def set_SupraEddMdot(index_of_the_particle='i', SupraEddMdot='bool'): + def set_SupraEddMdot( + index_of_the_particle='i', + SupraEddMdot='bool', + ): returns () @remote_function(can_handle_array=True) @@ -768,7 +1212,10 @@ def get_Be_mdotfrac(index_of_the_particle='i'): returns (Be_mdotfrac='float64') @remote_function(can_handle_array=True) - def set_Be_mdotfrac(index_of_the_particle='i', Be_mdotfrac='float64'): + def set_Be_mdotfrac( + index_of_the_particle='i', + Be_mdotfrac='float64', + ): returns () @remote_function(can_handle_array=True) @@ -776,7 +1223,10 @@ def get_start_mdot(index_of_the_particle='i'): returns (start_mdot='float64') @remote_function(can_handle_array=True) - def set_start_mdot(index_of_the_particle='i', start_mdot='float64'): + def set_start_mdot( + index_of_the_particle='i', + start_mdot='float64', + ): returns () @remote_function(can_handle_array=True) @@ -784,7 +1234,10 @@ def get_iledou(index_of_the_particle='i'): returns (iledou='int32') @remote_function(can_handle_array=True) - def set_iledou(index_of_the_particle='i', iledou='int32'): + def set_iledou( + index_of_the_particle='i', + iledou='int32', + ): returns () @remote_function(can_handle_array=True) @@ -792,7 +1245,10 @@ def get_idifcon(index_of_the_particle='i'): returns (idifcon='int32') @remote_function(can_handle_array=True) - def set_idifcon(index_of_the_particle='i', idifcon='int32'): + def set_idifcon( + index_of_the_particle='i', + idifcon='int32', + ): returns () @remote_function(can_handle_array=True) @@ -800,7 +1256,10 @@ def get_iover(index_of_the_particle='i'): returns (iover='int32') @remote_function(can_handle_array=True) - def set_iover(index_of_the_particle='i', iover='int32'): + def set_iover( + index_of_the_particle='i', + iover='int32', + ): returns () @remote_function(can_handle_array=True) @@ -808,7 +1267,10 @@ def get_elph(index_of_the_particle='i'): returns (elph='float64') @remote_function(can_handle_array=True) - def set_elph(index_of_the_particle='i', elph='float64'): + def set_elph( + index_of_the_particle='i', + elph='float64', + ): returns () @remote_function(can_handle_array=True) @@ -816,7 +1278,10 @@ def get_my(index_of_the_particle='i'): returns (my='int32') @remote_function(can_handle_array=True) - def set_my(index_of_the_particle='i', my='int32'): + def set_my( + index_of_the_particle='i', + my='int32', + ): returns () @remote_function(can_handle_array=True) @@ -824,7 +1289,10 @@ def get_dovhp(index_of_the_particle='i'): returns (dovhp='float64') @remote_function(can_handle_array=True) - def set_dovhp(index_of_the_particle='i', dovhp='float64'): + def set_dovhp( + index_of_the_particle='i', + dovhp='float64', + ): returns () @remote_function(can_handle_array=True) @@ -832,7 +1300,10 @@ def get_iunder(index_of_the_particle='i'): returns (iunder='int32') @remote_function(can_handle_array=True) - def set_iunder(index_of_the_particle='i', iunder='int32'): + def set_iunder( + index_of_the_particle='i', + iunder='int32', + ): returns () @remote_function(can_handle_array=True) @@ -840,7 +1311,10 @@ def get_dunder(index_of_the_particle='i'): returns (dunder='float64') @remote_function(can_handle_array=True) - def set_dunder(index_of_the_particle='i', dunder='float64'): + def set_dunder( + index_of_the_particle='i', + dunder='float64', + ): returns () @remote_function(can_handle_array=True) @@ -848,7 +1322,10 @@ def get_gkorm(index_of_the_particle='i'): returns (gkorm='float64') @remote_function(can_handle_array=True) - def set_gkorm(index_of_the_particle='i', gkorm='float64'): + def set_gkorm( + index_of_the_particle='i', + gkorm='float64', + ): returns () @remote_function(can_handle_array=True) @@ -856,7 +1333,10 @@ def get_alph(index_of_the_particle='i'): returns (alph='float64') @remote_function(can_handle_array=True) - def set_alph(index_of_the_particle='i', alph='float64'): + def set_alph( + index_of_the_particle='i', + alph='float64', + ): returns () @remote_function(can_handle_array=True) @@ -864,7 +1344,10 @@ def get_agdr(index_of_the_particle='i'): returns (agdr='float64') @remote_function(can_handle_array=True) - def set_agdr(index_of_the_particle='i', agdr='float64'): + def set_agdr( + index_of_the_particle='i', + agdr='float64', + ): returns () @remote_function(can_handle_array=True) @@ -872,7 +1355,10 @@ def get_faktor(index_of_the_particle='i'): returns (faktor='float64') @remote_function(can_handle_array=True) - def set_faktor(index_of_the_particle='i', faktor='float64'): + def set_faktor( + index_of_the_particle='i', + faktor='float64', + ): returns () @remote_function(can_handle_array=True) @@ -880,7 +1366,10 @@ def get_dgrp(index_of_the_particle='i'): returns (dgrp='float64') @remote_function(can_handle_array=True) - def set_dgrp(index_of_the_particle='i', dgrp='float64'): + def set_dgrp( + index_of_the_particle='i', + dgrp='float64', + ): returns () @remote_function(can_handle_array=True) @@ -888,7 +1377,10 @@ def get_dgrl(index_of_the_particle='i'): returns (dgrl='float64') @remote_function(can_handle_array=True) - def set_dgrl(index_of_the_particle='i', dgrl='float64'): + def set_dgrl( + index_of_the_particle='i', + dgrl='float64', + ): returns () @remote_function(can_handle_array=True) @@ -896,7 +1388,10 @@ def get_dgry(index_of_the_particle='i'): returns (dgry='float64') @remote_function(can_handle_array=True) - def set_dgry(index_of_the_particle='i', dgry='float64'): + def set_dgry( + index_of_the_particle='i', + dgry='float64', + ): returns () @remote_function(can_handle_array=True) @@ -904,7 +1399,10 @@ def get_dgrc(index_of_the_particle='i'): returns (dgrc='float64') @remote_function(can_handle_array=True) - def set_dgrc(index_of_the_particle='i', dgrc='float64'): + def set_dgrc( + index_of_the_particle='i', + dgrc='float64', + ): returns () @remote_function(can_handle_array=True) @@ -912,7 +1410,10 @@ def get_dgro(index_of_the_particle='i'): returns (dgro='float64') @remote_function(can_handle_array=True) - def set_dgro(index_of_the_particle='i', dgro='float64'): + def set_dgro( + index_of_the_particle='i', + dgro='float64', + ): returns () @remote_function(can_handle_array=True) @@ -920,7 +1421,10 @@ def get_dgr20(index_of_the_particle='i'): returns (dgr20='float64') @remote_function(can_handle_array=True) - def set_dgr20(index_of_the_particle='i', dgr20='float64'): + def set_dgr20( + index_of_the_particle='i', + dgr20='float64', + ): returns () @remote_function(can_handle_array=True) @@ -928,7 +1432,10 @@ def get_nbchx(index_of_the_particle='i'): returns (nbchx='int32') @remote_function(can_handle_array=True) - def set_nbchx(index_of_the_particle='i', nbchx='int32'): + def set_nbchx( + index_of_the_particle='i', + nbchx='int32', + ): returns () @remote_function(can_handle_array=True) @@ -936,7 +1443,10 @@ def get_nrband(index_of_the_particle='i'): returns (nrband='int32') @remote_function(can_handle_array=True) - def set_nrband(index_of_the_particle='i', nrband='int32'): + def set_nrband( + index_of_the_particle='i', + nrband='int32', + ): returns () @remote_function(can_handle_array=True) @@ -944,7 +1454,10 @@ def get_xcn(index_of_the_particle='i'): returns (xcn='float64') @remote_function(can_handle_array=True) - def set_xcn(index_of_the_particle='i', xcn='float64'): + def set_xcn( + index_of_the_particle='i', + xcn='float64', + ): returns () @remote_function(can_handle_array=True) @@ -952,7 +1465,10 @@ def get_islow(index_of_the_particle='i'): returns (islow='int32') @remote_function(can_handle_array=True) - def set_islow(index_of_the_particle='i', islow='int32'): + def set_islow( + index_of_the_particle='i', + islow='int32', + ): returns () @remote_function(can_handle_array=True) @@ -960,7 +1476,10 @@ def get_icncst(index_of_the_particle='i'): returns (icncst='int32') @remote_function(can_handle_array=True) - def set_icncst(index_of_the_particle='i', icncst='int32'): + def set_icncst( + index_of_the_particle='i', + icncst='int32', + ): returns () @remote_function(can_handle_array=True) @@ -968,7 +1487,10 @@ def get_tauH_fit(index_of_the_particle='i'): returns (tauH_fit='int32') @remote_function(can_handle_array=True) - def set_tauH_fit(index_of_the_particle='i', tauH_fit='int32'): + def set_tauH_fit( + index_of_the_particle='i', + tauH_fit='int32', + ): returns () @remote_function(can_handle_array=True) @@ -976,7 +1498,10 @@ def get_display_plot(index_of_the_particle='i'): returns (display_plot='bool') @remote_function(can_handle_array=True) - def set_display_plot(index_of_the_particle='i', display_plot='bool'): + def set_display_plot( + index_of_the_particle='i', + display_plot='bool', + ): returns () @remote_function(can_handle_array=True) @@ -984,7 +1509,10 @@ def get_iauto(index_of_the_particle='i'): returns (iauto='int32') @remote_function(can_handle_array=True) - def set_iauto(index_of_the_particle='i', iauto='int32'): + def set_iauto( + index_of_the_particle='i', + iauto='int32', + ): returns () @remote_function(can_handle_array=True) @@ -992,7 +1520,10 @@ def get_iprn(index_of_the_particle='i'): returns (iprn='int32') @remote_function(can_handle_array=True) - def set_iprn(index_of_the_particle='i', iprn='int32'): + def set_iprn( + index_of_the_particle='i', + iprn='int32', + ): returns () @remote_function(can_handle_array=True) @@ -1000,7 +1531,10 @@ def get_iout(index_of_the_particle='i'): returns (iout='int32') @remote_function(can_handle_array=True) - def set_iout(index_of_the_particle='i', iout='int32'): + def set_iout( + index_of_the_particle='i', + iout='int32', + ): returns () @remote_function(can_handle_array=True) @@ -1008,7 +1542,10 @@ def get_itmin(index_of_the_particle='i'): returns (itmin='int32') @remote_function(can_handle_array=True) - def set_itmin(index_of_the_particle='i', itmin='int32'): + def set_itmin( + index_of_the_particle='i', + itmin='int32', + ): returns () @remote_function(can_handle_array=True) @@ -1016,7 +1553,10 @@ def get_xyfiles(index_of_the_particle='i'): returns (xyfiles='bool') @remote_function(can_handle_array=True) - def set_xyfiles(index_of_the_particle='i', xyfiles='bool'): + def set_xyfiles( + index_of_the_particle='i', + xyfiles='bool', + ): returns () @remote_function(can_handle_array=True) @@ -1024,7 +1564,10 @@ def get_idebug(index_of_the_particle='i'): returns (idebug='int32') @remote_function(can_handle_array=True) - def set_idebug(index_of_the_particle='i', idebug='int32'): + def set_idebug( + index_of_the_particle='i', + idebug='int32', + ): returns () @remote_function(can_handle_array=True) @@ -1032,7 +1575,10 @@ def get_itests(index_of_the_particle='i'): returns (itests='int32') @remote_function(can_handle_array=True) - def set_itests(index_of_the_particle='i', itests='int32'): + def set_itests( + index_of_the_particle='i', + itests='int32', + ): returns () @remote_function(can_handle_array=True) @@ -1040,7 +1586,10 @@ def get_verbose(index_of_the_particle='i'): returns (verbose='bool') @remote_function(can_handle_array=True) - def set_verbose(index_of_the_particle='i', verbose='bool'): + def set_verbose( + index_of_the_particle='i', + verbose='bool', + ): returns () @remote_function(can_handle_array=True) @@ -1048,7 +1597,10 @@ def get_stop_deg(index_of_the_particle='i'): returns (stop_deg='bool') @remote_function(can_handle_array=True) - def set_stop_deg(index_of_the_particle='i', stop_deg='bool'): + def set_stop_deg( + index_of_the_particle='i', + stop_deg='bool', + ): returns () @remote_function(can_handle_array=True) @@ -1056,18 +1608,21 @@ def get_n_snap(index_of_the_particle='i'): returns (n_snap='int32') @remote_function(can_handle_array=True) - def set_n_snap(index_of_the_particle='i', n_snap='int32'): + def set_n_snap( + index_of_the_particle='i', + n_snap='int32', + ): returns () - # end Parameters - - # begin Properties @remote_function(can_handle_array=True) def get_m(index_of_the_particle='i'): returns (m='int32') @remote_function(can_handle_array=True) - def set_m(index_of_the_particle='i', m='int32'): + def set_m( + index_of_the_particle='i', + m='int32', + ): returns () @remote_function(can_handle_array=True) @@ -1075,7 +1630,10 @@ def get_gms(index_of_the_particle='i'): returns (gms='float64' | units.MSun) @remote_function(can_handle_array=True) - def set_gms(index_of_the_particle='i', gms='float64' | units.MSun): + def set_gms( + index_of_the_particle='i', + gms='float64' | units.MSun, + ): returns () @remote_function(can_handle_array=True) @@ -1083,7 +1641,10 @@ def get_alter(index_of_the_particle='i'): returns (alter='float64' | units.julianyr) @remote_function(can_handle_array=True) - def set_alter(index_of_the_particle='i', alter='float64' | units.julianyr): + def set_alter( + index_of_the_particle='i', + alter='float64' | units.julianyr, + ): returns () @remote_function(can_handle_array=True) @@ -1091,7 +1652,10 @@ def get_gls(index_of_the_particle='i'): returns (gls='float64' | units.LSun) @remote_function(can_handle_array=True) - def set_gls(index_of_the_particle='i', gls='float64' | units.LSun): + def set_gls( + index_of_the_particle='i', + gls='float64' | units.LSun, + ): returns () @remote_function(can_handle_array=True) @@ -1099,7 +1663,10 @@ def get_teff(index_of_the_particle='i'): returns (teff='float64' | units.K) @remote_function(can_handle_array=True) - def set_teff(index_of_the_particle='i', teff='float64' | units.K): + def set_teff( + index_of_the_particle='i', + teff='float64' | units.K, + ): returns () @remote_function(can_handle_array=True) @@ -1107,7 +1674,10 @@ def get_glsv(index_of_the_particle='i'): returns (glsv='float64' | units.LSun) @remote_function(can_handle_array=True) - def set_glsv(index_of_the_particle='i', glsv='float64' | units.LSun): + def set_glsv( + index_of_the_particle='i', + glsv='float64' | units.LSun, + ): returns () @remote_function(can_handle_array=True) @@ -1115,7 +1685,10 @@ def get_teffv(index_of_the_particle='i'): returns (teffv='float64' | units.K) @remote_function(can_handle_array=True) - def set_teffv(index_of_the_particle='i', teffv='float64' | units.K): + def set_teffv( + index_of_the_particle='i', + teffv='float64' | units.K, + ): returns () @remote_function(can_handle_array=True) @@ -1123,7 +1696,10 @@ def get_dzeitj(index_of_the_particle='i'): returns (dzeitj='float64' | units.julianyr) @remote_function(can_handle_array=True) - def set_dzeitj(index_of_the_particle='i', dzeitj='float64' | units.julianyr): + def set_dzeitj( + index_of_the_particle='i', + dzeitj='float64' | units.julianyr, + ): returns () @remote_function(can_handle_array=True) @@ -1131,7 +1707,10 @@ def get_dzeit(index_of_the_particle='i'): returns (dzeit='float64' | units.s) @remote_function(can_handle_array=True) - def set_dzeit(index_of_the_particle='i', dzeit='float64' | units.s): + def set_dzeit( + index_of_the_particle='i', + dzeit='float64' | units.s, + ): returns () @remote_function(can_handle_array=True) @@ -1139,7 +1718,10 @@ def get_dzeitv(index_of_the_particle='i'): returns (dzeitv='float64' | units.s) @remote_function(can_handle_array=True) - def set_dzeitv(index_of_the_particle='i', dzeitv='float64' | units.s): + def set_dzeitv( + index_of_the_particle='i', + dzeitv='float64' | units.s, + ): returns () @remote_function(can_handle_array=True) @@ -1147,7 +1729,10 @@ def get_xmini(index_of_the_particle='i'): returns (xmini='float64' | units.MSun) @remote_function(can_handle_array=True) - def set_xmini(index_of_the_particle='i', xmini='float64' | units.MSun): + def set_xmini( + index_of_the_particle='i', + xmini='float64' | units.MSun, + ): returns () @remote_function(can_handle_array=True) @@ -1155,7 +1740,10 @@ def get_summas(index_of_the_particle='i'): returns (summas='float64' | units.MSun) @remote_function(can_handle_array=True) - def set_summas(index_of_the_particle='i', summas='float64' | units.MSun): + def set_summas( + index_of_the_particle='i', + summas='float64' | units.MSun, + ): returns () @remote_function(can_handle_array=True) @@ -1163,7 +1751,10 @@ def get_ab(index_of_the_particle='i'): returns (ab='float64') @remote_function(can_handle_array=True) - def set_ab(index_of_the_particle='i', ab='float64'): + def set_ab( + index_of_the_particle='i', + ab='float64', + ): returns () @remote_function(can_handle_array=True) @@ -1171,2267 +1762,1076 @@ def get_dm_lost(index_of_the_particle='i'): returns (dm_lost='float64' | units.MSun) @remote_function(can_handle_array=True) - def set_dm_lost(index_of_the_particle='i', dm_lost='float64' | units.MSun): + def set_dm_lost( + index_of_the_particle='i', + dm_lost='float64' | units.MSun, + ): returns () - # end Properties + @remote_function(can_handle_array=True) + def get_mbelx(index_of_the_particle='i'): + returns (mbelx='int32') - @legacy_function - def commit_parameters(): - function = LegacyFunctionSpecification() - function.result_type = 'int32' - return function + @remote_function(can_handle_array=True) + def set_mbelx( + index_of_the_particle='i', + mbelx='int32', + ): + returns () - @legacy_function - def new_particle(): - """ - Define a new star in the code. The star will start with the given mass. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = False - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.OUT, - description=( - "The new index for the star. This index can be used to refer " - "to this star in other functions" - ) - ) - function.addParameter( - 'mass', dtype='float64', direction=function.IN, - description="The initial mass of the star") - function.addParameter( - 'metallicity', dtype='float64', direction=function.IN, - default=0.014, - description="The initial metallicity of the star (default: 0.014)") - function.addParameter( - 'starname', dtype='string', direction=function.IN, - default='AmuseStar', description="The star's name") - # function.addParameter( - # 'age_tag', dtype='float64', direction=function.IN, - # description="Starting age of the star *to be specified exactly*") - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - New star was loaded and the index_of_the_star parameter set. - -1 - ERROR - New star could not be created. - """ - return function + @remote_function(can_handle_array=True) + def get_xtefflast(index_of_the_particle='i'): + returns (xtefflast='float64') - @legacy_function - def new_stellar_model(): - """ - New star from an existing model - """ - function = LegacyFunctionSpecification() - function.can_handle_array = False - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.OUT, - description=( - "The new index for the star. This index can be used to refer " - "to this star in other functions" - ) - ) - for parameter in { - **GENEC_STAR_PARAMETERS, - **GENEC_STAR_PROPERTIES, - **GENEC_STAR_STRUCTURE - }.items(): - if parameter[1][1] == "": - unit = NO_UNIT - else: - unit = getattr(units, parameter[1][1]) - function.addParameter( - parameter[0], - dtype=parameter[1][0], - unit=unit, - description=parameter[1][2], - direction=function.IN, - ) + @remote_function(can_handle_array=True) + def set_xtefflast( + index_of_the_particle='i', + xtefflast='float64', + ): + returns () - function.result_type = 'int32' - return function + @remote_function(can_handle_array=True) + def get_xllast(index_of_the_particle='i'): + returns (xllast='float64') - @legacy_function - def get_stellar_model(): - """ - Get an existing model - """ - function = LegacyFunctionSpecification() - function.must_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description=( - "The new index for the star. This index can be used to refer " - "to this star in other functions" - ) - ) - for parameter in { - **GENEC_STAR_PARAMETERS, - **GENEC_STAR_PROPERTIES, - **GENEC_STAR_STRUCTURE - }.items(): - function.addParameter( - parameter[0], - dtype=parameter[1][0], - unit=parameter[1][1], - description=parameter[1][2], - direction=function.OUT, - ) - function.result_type = 'int32' - return function + @remote_function(can_handle_array=True) + def set_xllast( + index_of_the_particle='i', + xllast='float64', + ): + returns () - @legacy_function - def get_firstlast_zone(): - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter('first', dtype='int32', direction=function.OUT) - function.addParameter('last', dtype='int32', direction=function.OUT) - function.result_type = 'int32' - return function + @remote_function(can_handle_array=True) + def get_xrholast(index_of_the_particle='i'): + returns (xrholast='float64') - @legacy_function - def get_surface_velocity(): - "Retrieve the surface velocity of the star." - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of" - ) - function.addParameter( - 'surface_velocity', dtype='float64', direction=function.OUT - ) - function.result_type = 'int32' - return function + @remote_function(can_handle_array=True) + def set_xrholast( + index_of_the_particle='i', + xrholast='float64', + ): + returns () - @legacy_function - def get_luminosity_at_zone(): - """ - Retrieve the luminosity at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of" - ) - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of" - ) - function.addParameter( - 'lum_i', dtype='float64', direction=function.OUT, - unit=units.LSun, - description=( - "The luminosity at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xclast(index_of_the_particle='i'): + returns (xclast='float64') - @legacy_function - def get_mass_of_species(): - """ - Retrieve the mass number of the chemical abundance variable of the - star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'species', dtype='int32', direction=function.IN, - description="The species of the star to get the mass number of") - function.addParameter( - 'species_mass', dtype='float64', direction=function.OUT, - description=( - "The mass number of the chemical abundance variable of " - "the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_xclast( + index_of_the_particle='i', + xclast='float64', + ): + returns () - @legacy_function - def get_eps_at_zone(): - """ - Retrieve eps at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'eps', dtype='float64', direction=function.OUT, - description=( - "eps at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xtclast(index_of_the_particle='i'): + returns (xtclast='float64') - @legacy_function - def get_epsy_at_zone(): - """ - Retrieve epsy at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'epsy', dtype='float64', direction=function.OUT, - description=( - "epsy at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_xtclast( + index_of_the_particle='i', + xtclast='float64', + ): + returns () - @legacy_function - def get_eps_c_adv_at_zone(): - """ - Retrieve eps_c_adv at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'eps_c_adv', dtype='float64', direction=function.OUT, - description=( - "eps_c_adv at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_inum(index_of_the_particle='i'): + returns (inum='int32') - @legacy_function - def get_eps_ne_adv_at_zone(): - """ - Retrieve eps_ne_adv at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'eps_ne_adv', dtype='float64', direction=function.OUT, - description=( - "eps_ne_adv at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_inum( + index_of_the_particle='i', + inum='int32', + ): + returns () - @legacy_function - def get_eps_o_adv_at_zone(): - """ - Retrieve eps_o_adv at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'eps_o_adv', dtype='float64', direction=function.OUT, - description=( - "eps_o_adv at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_nsugi(index_of_the_particle='i'): + returns (nsugi='int32') - @legacy_function - def get_eps_si_adv_at_zone(): - """ - Retrieve eps_si_adv at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'eps_si_adv', dtype='float64', direction=function.OUT, - description=( - "eps_si_adv at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_nsugi( + index_of_the_particle='i', + nsugi='int32', + ): + returns () - @legacy_function - def get_eps_grav_at_zone(): - """ - Retrieve eps_grav at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'eps_grav', dtype='float64', direction=function.OUT, - description=( - "eps_grav at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_period(index_of_the_particle='i'): + returns (period='float64') - @legacy_function - def get_eps_nu_at_zone(): - """ - Retrieve eps_nu at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'eps_nu', dtype='float64', direction=function.OUT, - description=( - "eps_nu at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_period( + index_of_the_particle='i', + period='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_r_core(index_of_the_particle='i'): + returns (r_core='float64') + + @remote_function(can_handle_array=True) + def set_r_core( + index_of_the_particle='i', + r_core='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_vna(index_of_the_particle='i'): + returns (vna='float64') + + @remote_function(can_handle_array=True) + def set_vna( + index_of_the_particle='i', + vna='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_vnr(index_of_the_particle='i'): + returns (vnr='float64') + + @remote_function(can_handle_array=True) + def set_vnr( + index_of_the_particle='i', + vnr='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_q_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (q='float64') + + @remote_function(can_handle_array=True) + def set_q_at_zone( + index_of_the_particle='i', zone='i', + q='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_p_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (p='float64') + + @remote_function(can_handle_array=True) + def set_p_at_zone( + index_of_the_particle='i', zone='i', + p='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_t_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (t='float64') + + @remote_function(can_handle_array=True) + def set_t_at_zone( + index_of_the_particle='i', zone='i', + t='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_r_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (r='float64') + + @remote_function(can_handle_array=True) + def set_r_at_zone( + index_of_the_particle='i', zone='i', + r='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_s_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (s='float64') + + @remote_function(can_handle_array=True) + def set_s_at_zone( + index_of_the_particle='i', zone='i', + s='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_x_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (x='float64') + + @remote_function(can_handle_array=True) + def set_x_at_zone( + index_of_the_particle='i', zone='i', + x='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_y3_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (y3='float64') + + @remote_function(can_handle_array=True) + def set_y3_at_zone( + index_of_the_particle='i', zone='i', + y3='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_y_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (y='float64') + + @remote_function(can_handle_array=True) + def set_y_at_zone( + index_of_the_particle='i', zone='i', + y='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_xc12_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xc12='float64') + + @remote_function(can_handle_array=True) + def set_xc12_at_zone( + index_of_the_particle='i', zone='i', + xc12='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_xc13_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xc13='float64') + + @remote_function(can_handle_array=True) + def set_xc13_at_zone( + index_of_the_particle='i', zone='i', + xc13='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_xn14_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xn14='float64') + + @remote_function(can_handle_array=True) + def set_xn14_at_zone( + index_of_the_particle='i', zone='i', + xn14='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_xn15_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xn15='float64') + + @remote_function(can_handle_array=True) + def set_xn15_at_zone( + index_of_the_particle='i', zone='i', + xn15='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_xo16_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xo16='float64') + + @remote_function(can_handle_array=True) + def set_xo16_at_zone( + index_of_the_particle='i', zone='i', + xo16='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_xo17_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xo17='float64') + + @remote_function(can_handle_array=True) + def set_xo17_at_zone( + index_of_the_particle='i', zone='i', + xo17='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_xo18_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xo18='float64') + + @remote_function(can_handle_array=True) + def set_xo18_at_zone( + index_of_the_particle='i', zone='i', + xo18='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_xne20_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xne20='float64') - @legacy_function - def get_nabla_rad_at_zone(): - """ - Retrieve nabla_rad at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'nabla_rad', dtype='float64', direction=function.OUT, - description=( - "nabla_rad at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_xne20_at_zone( + index_of_the_particle='i', zone='i', + xne20='float64'): + returns () - @legacy_function - def get_nabla_ad_at_zone(): - """ - Retrieve nabla_rad at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'nabla_ad', dtype='float64', direction=function.OUT, - description=( - "nabla_ad at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xne22_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xne22='float64') - @legacy_function - def get_nabla_mu_at_zone(): - """ - Retrieve nabla_rad at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'nabla_mu', dtype='float64', direction=function.OUT, - description=( - "nabla_mu at the specified zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_xne22_at_zone( + index_of_the_particle='i', zone='i', + xne22='float64'): + returns () - @legacy_function - def get_mass_fraction_at_zone(): - """ - Retrieve the mass fraction at the specified zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'dq_i', dtype='float64', direction=function.OUT, - description=( - "The mass fraction at the specified zone/mesh-cell of " - "the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - -2 - ERROR - A zone with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xmg24_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xmg24='float64') - @legacy_function - def get_omegi_at_zone(): - """ - Retrieve the rotation rate at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'omegi_i', dtype='float64', direction=function.OUT, - description=( - "The rotation rate at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_xmg24_at_zone( + index_of_the_particle='i', zone='i', + xmg24='float64'): + returns () - @legacy_function - def get_mass_fraction_of_h_at_zone(): - """ - Retrieve the fractional abundance of h at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xmg25_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xmg25='float64') + @remote_function(can_handle_array=True) + def set_xmg25_at_zone( + index_of_the_particle='i', zone='i', + xmg25='float64'): + returns () - @legacy_function - def get_mass_fraction_of_he3_at_zone(): - """ - Retrieve the fractional abundance of he3 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xmg26_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xmg26='float64') + @remote_function(can_handle_array=True) + def set_xmg26_at_zone( + index_of_the_particle='i', zone='i', + xmg26='float64'): + returns () - @legacy_function - def get_mass_fraction_of_he_at_zone(): - """ - Retrieve the fractional abundance of he at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xf19_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xf19='float64') + @remote_function(can_handle_array=True) + def set_xf19_at_zone( + index_of_the_particle='i', zone='i', + xf19='float64'): + returns () - @legacy_function - def get_mass_fraction_of_c12_at_zone(): - """ - Retrieve the fractional abundance of c12 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xne21_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xne21='float64') + @remote_function(can_handle_array=True) + def set_xne21_at_zone( + index_of_the_particle='i', zone='i', + xne21='float64'): + returns () - @legacy_function - def get_mass_fraction_of_c13_at_zone(): - """ - Retrieve the fractional abundance of c13 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xna23_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xna23='float64') + @remote_function(can_handle_array=True) + def set_xna23_at_zone( + index_of_the_particle='i', zone='i', + xna23='float64'): + returns () - @legacy_function - def get_mass_fraction_of_n14_at_zone(): - """ - Retrieve the fractional abundance of n14 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xal27_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xal27='float64') + @remote_function(can_handle_array=True) + def set_xal27_at_zone( + index_of_the_particle='i', zone='i', + xal27='float64'): + returns () - @legacy_function - def get_mass_fraction_of_n15_at_zone(): - """ - Retrieve the fractional abundance of n15 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xsi28_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xsi28='float64') + @remote_function(can_handle_array=True) + def set_xsi28_at_zone( + index_of_the_particle='i', zone='i', + xsi28='float64'): + returns () - @legacy_function - def get_mass_fraction_of_o16_at_zone(): - """ - Retrieve the fractional abundance of o16 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xc14_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xc14='float64') + @remote_function(can_handle_array=True) + def set_xc14_at_zone( + index_of_the_particle='i', zone='i', + xc14='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_xf18_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xf18='float64') + + @remote_function(can_handle_array=True) + def set_xf18_at_zone( + index_of_the_particle='i', zone='i', + xf18='float64'): + returns () - @legacy_function - def get_mass_fraction_of_o17_at_zone(): - """ - Retrieve the fractional abundance of o17 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xal26_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xal26='float64') + @remote_function(can_handle_array=True) + def set_xal26_at_zone( + index_of_the_particle='i', zone='i', + xal26='float64'): + returns () - @legacy_function - def get_mass_fraction_of_o18_at_zone(): - """ - Retrieve the fractional abundance of o18 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xneut_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xneut='float64') + @remote_function(can_handle_array=True) + def set_xneut_at_zone( + index_of_the_particle='i', zone='i', + xneut='float64'): + returns () - @legacy_function - def get_mass_fraction_of_ne20_at_zone(): - """ - Retrieve the fractional abundance of ne20 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xprot_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xprot='float64') + @remote_function(can_handle_array=True) + def set_xprot_at_zone( + index_of_the_particle='i', zone='i', + xprot='float64'): + returns () - @legacy_function - def get_mass_fraction_of_ne22_at_zone(): - """ - Retrieve the fractional abundance of ne22 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_omegi_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (omegi='float64') + @remote_function(can_handle_array=True) + def set_omegi_at_zone( + index_of_the_particle='i', zone='i', + omegi='float64'): + returns () - @legacy_function - def get_mass_fraction_of_mg24_at_zone(): - """ - Retrieve the fractional abundance of mg24 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xbid_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xbid='float64') + @remote_function(can_handle_array=True) + def set_xbid_at_zone( + index_of_the_particle='i', zone='i', + xbid='float64'): + returns () - @legacy_function - def get_mass_fraction_of_mg25_at_zone(): - """ - Retrieve the fractional abundance of mg25 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_xbid1_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (xbid1='float64') + @remote_function(can_handle_array=True) + def set_xbid1_at_zone( + index_of_the_particle='i', zone='i', + xbid1='float64'): + returns () - @legacy_function - def get_mass_fraction_of_mg26_at_zone(): - """ - Retrieve the fractional abundance of mg26 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vp_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vp='float64') + @remote_function(can_handle_array=True) + def set_vp_at_zone( + index_of_the_particle='i', zone='i', + vp='float64'): + returns () - @legacy_function - def get_mass_fraction_of_c14_at_zone(): - """ - Retrieve the fractional abundance of c14 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vt_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vt='float64') + @remote_function(can_handle_array=True) + def set_vt_at_zone( + index_of_the_particle='i', zone='i', + vt='float64'): + returns () - @legacy_function - def get_mass_fraction_of_f18_at_zone(): - """ - Retrieve the fractional abundance of f18 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vr_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vr='float64') + @remote_function(can_handle_array=True) + def set_vr_at_zone( + index_of_the_particle='i', zone='i', + vr='float64'): + returns () - @legacy_function - def get_mass_fraction_of_f19_at_zone(): - """ - Retrieve the fractional abundance of f19 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vs_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vs='float64') + @remote_function(can_handle_array=True) + def set_vs_at_zone( + index_of_the_particle='i', zone='i', + vs='float64'): + returns () - @legacy_function - def get_mass_fraction_of_ne21_at_zone(): - """ - Retrieve the fractional abundance of ne21 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vx_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vx='float64') + @remote_function(can_handle_array=True) + def set_vx_at_zone( + index_of_the_particle='i', zone='i', + vx='float64'): + returns () - @legacy_function - def get_mass_fraction_of_na23_at_zone(): - """ - Retrieve the fractional abundance of na23 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vy_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vy='float64') + @remote_function(can_handle_array=True) + def set_vy_at_zone( + index_of_the_particle='i', zone='i', + vy='float64'): + returns () - @legacy_function - def get_mass_fraction_of_al26_at_zone(): - """ - Retrieve the fractional abundance of al26 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vy3_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vy3='float64') + @remote_function(can_handle_array=True) + def set_vy3_at_zone( + index_of_the_particle='i', zone='i', + vy3='float64'): + returns () - @legacy_function - def get_mass_fraction_of_al27_at_zone(): - """ - Retrieve the fractional abundance of al27 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxc12_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxc12='float64') + @remote_function(can_handle_array=True) + def set_vxc12_at_zone( + index_of_the_particle='i', zone='i', + vxc12='float64'): + returns () - @legacy_function - def get_mass_fraction_of_si28_at_zone(): - """ - Retrieve the fractional abundance of si28 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxc13_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxc13='float64') + @remote_function(can_handle_array=True) + def set_vxc13_at_zone( + index_of_the_particle='i', zone='i', + vxc13='float64'): + returns () - @legacy_function - def get_mass_fraction_of_neut_at_zone(): - """ - Retrieve the fractional abundance of neut at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxn14_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxn14='float64') + @remote_function(can_handle_array=True) + def set_vxn14_at_zone( + index_of_the_particle='i', zone='i', + vxn14='float64'): + returns () - @legacy_function - def get_mass_fraction_of_prot_at_zone(): - """ - Retrieve the fractional abundance of prot at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxn15_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxn15='float64') + @remote_function(can_handle_array=True) + def set_vxn15_at_zone( + index_of_the_particle='i', zone='i', + vxn15='float64'): + returns () - @legacy_function - def get_mass_fraction_of_bid_at_zone(): - """ - Retrieve the fractional abundance of bid at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxo16_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxo16='float64') + @remote_function(can_handle_array=True) + def set_vxo16_at_zone( + index_of_the_particle='i', zone='i', + vxo16='float64'): + returns () - @legacy_function - def get_mass_fraction_of_bid1_at_zone(): - """ - Retrieve the fractional abundance of bid1 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to get the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to get the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.OUT, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was retrieved. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxo17_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxo17='float64') + @remote_function(can_handle_array=True) + def set_vxo17_at_zone( + index_of_the_particle='i', zone='i', + vxo17='float64'): + returns () - @legacy_function - def set_mass_fraction_of_h_at_zone(): - """ - Set the fractional abundance of h at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxo18_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxo18='float64') + @remote_function(can_handle_array=True) + def set_vxo18_at_zone( + index_of_the_particle='i', zone='i', + vxo18='float64'): + returns () - @legacy_function - def set_mass_fraction_of_he3_at_zone(): - """ - Set the fractional abundance of he3 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxne20_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxne20='float64') + @remote_function(can_handle_array=True) + def set_vxne20_at_zone( + index_of_the_particle='i', zone='i', + vxne20='float64'): + returns () - @legacy_function - def set_mass_fraction_of_he_at_zone(): - """ - Set the fractional abundance of he at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxne22_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxne22='float64') + @remote_function(can_handle_array=True) + def set_vxne22_at_zone( + index_of_the_particle='i', zone='i', + vxne22='float64'): + returns () - @legacy_function - def set_mass_fraction_of_c12_at_zone(): - """ - Set the fractional abundance of c12 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxmg24_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxmg24='float64') + @remote_function(can_handle_array=True) + def set_vxmg24_at_zone( + index_of_the_particle='i', zone='i', + vxmg24='float64'): + returns () - @legacy_function - def set_mass_fraction_of_c13_at_zone(): - """ - Set the fractional abundance of c13 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxmg25_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxmg25='float64') + + @remote_function(can_handle_array=True) + def set_vxmg25_at_zone( + index_of_the_particle='i', zone='i', + vxmg25='float64'): + returns () + @remote_function(can_handle_array=True) + def get_vxmg26_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxmg26='float64') - @legacy_function - def set_mass_fraction_of_n14_at_zone(): - """ - Set the fractional abundance of n14 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_vxmg26_at_zone( + index_of_the_particle='i', zone='i', + vxmg26='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_vxf19_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxf19='float64') + @remote_function(can_handle_array=True) + def set_vxf19_at_zone( + index_of_the_particle='i', zone='i', + vxf19='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_vxne21_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxne21='float64') + + @remote_function(can_handle_array=True) + def set_vxne21_at_zone( + index_of_the_particle='i', zone='i', + vxne21='float64'): + returns () - @legacy_function - def set_mass_fraction_of_n15_at_zone(): - """ - Set the fractional abundance of n15 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxna23_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxna23='float64') + @remote_function(can_handle_array=True) + def set_vxna23_at_zone( + index_of_the_particle='i', zone='i', + vxna23='float64'): + returns () - @legacy_function - def set_mass_fraction_of_o16_at_zone(): - """ - Set the fractional abundance of o16 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxal27_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxal27='float64') + @remote_function(can_handle_array=True) + def set_vxal27_at_zone( + index_of_the_particle='i', zone='i', + vxal27='float64'): + returns () - @legacy_function - def set_mass_fraction_of_o17_at_zone(): - """ - Set the fractional abundance of o17 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxsi28_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxsi28='float64') + @remote_function(can_handle_array=True) + def set_vxsi28_at_zone( + index_of_the_particle='i', zone='i', + vxsi28='float64'): + returns () - @legacy_function - def set_mass_fraction_of_o18_at_zone(): - """ - Set the fractional abundance of o18 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxc14_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxc14='float64') + @remote_function(can_handle_array=True) + def set_vxc14_at_zone( + index_of_the_particle='i', zone='i', + vxc14='float64'): + returns () - @legacy_function - def set_mass_fraction_of_ne20_at_zone(): - """ - Set the fractional abundance of ne20 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxf18_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxf18='float64') + @remote_function(can_handle_array=True) + def set_vxf18_at_zone( + index_of_the_particle='i', zone='i', + vxf18='float64'): + returns () - @legacy_function - def set_mass_fraction_of_ne22_at_zone(): - """ - Set the fractional abundance of ne22 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxal26_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxal26='float64') + @remote_function(can_handle_array=True) + def set_vxal26_at_zone( + index_of_the_particle='i', zone='i', + vxal26='float64'): + returns () - @legacy_function - def set_mass_fraction_of_mg24_at_zone(): - """ - Set the fractional abundance of mg24 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxneut_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxneut='float64') + @remote_function(can_handle_array=True) + def set_vxneut_at_zone( + index_of_the_particle='i', zone='i', + vxneut='float64'): + returns () - @legacy_function - def set_mass_fraction_of_mg25_at_zone(): - """ - Set the fractional abundance of mg25 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxprot_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxprot='float64') + @remote_function(can_handle_array=True) + def set_vxprot_at_zone( + index_of_the_particle='i', zone='i', + vxprot='float64'): + returns () - @legacy_function - def set_mass_fraction_of_mg26_at_zone(): - """ - Set the fractional abundance of mg26 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vomegi_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vomegi='float64') + @remote_function(can_handle_array=True) + def set_vomegi_at_zone( + index_of_the_particle='i', zone='i', + vomegi='float64'): + returns () - @legacy_function - def set_mass_fraction_of_c14_at_zone(): - """ - Set the fractional abundance of c14 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxbid_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxbid='float64') + @remote_function(can_handle_array=True) + def set_vxbid_at_zone( + index_of_the_particle='i', zone='i', + vxbid='float64'): + returns () - @legacy_function - def set_mass_fraction_of_f18_at_zone(): - """ - Set the fractional abundance of f18 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vxbid1_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (vxbid1='float64') + @remote_function(can_handle_array=True) + def set_vxbid1_at_zone( + index_of_the_particle='i', zone='i', + vxbid1='float64'): + returns () - @legacy_function - def set_mass_fraction_of_f19_at_zone(): - """ - Set the fractional abundance of f19 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_abelx_at_zone( + index_of_the_particle='i', zone='i', + element='i', + ): + returns (abelx='float64') + @remote_function(can_handle_array=True) + def set_abelx_at_zone( + index_of_the_particle='i', zone='i', + element='i', + abelx='float64'): + returns () - @legacy_function - def set_mass_fraction_of_ne21_at_zone(): - """ - Set the fractional abundance of ne21 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_vabelx_at_zone( + index_of_the_particle='i', zone='i', + element='i', + ): + returns (vabelx='float64') + @remote_function(can_handle_array=True) + def set_vabelx_at_zone( + index_of_the_particle='i', zone='i', + element='i', + vabelx='float64'): + returns () - @legacy_function - def set_mass_fraction_of_na23_at_zone(): - """ - Set the fractional abundance of na23 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_eps_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (eps='float64') + @remote_function(can_handle_array=True) + def get_epsy_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (epsy='float64') - @legacy_function - def set_mass_fraction_of_al26_at_zone(): - """ - Set the fractional abundance of al26 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_eps_c_adv_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (eps_c_adv='float64') + @remote_function(can_handle_array=True) + def get_eps_ne_adv_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (eps_ne_adv='float64') - @legacy_function - def set_mass_fraction_of_al27_at_zone(): - """ - Set the fractional abundance of al27 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_eps_o_adv_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (eps_o_adv='float64') + @remote_function(can_handle_array=True) + def get_eps_si_adv_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (eps_si_adv='float64') - @legacy_function - def set_mass_fraction_of_si28_at_zone(): - """ - Set the fractional abundance of si28 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_eps_grav_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (eps_grav='float64') + @remote_function(can_handle_array=True) + def get_eps_nu_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (eps_nu='float64') - @legacy_function - def set_mass_fraction_of_neut_at_zone(): - """ - Set the fractional abundance of neut at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_nabla_rad_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (nabla_rad='float64') + @remote_function(can_handle_array=True) + def get_nabla_ad_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (nabla_ad='float64') - @legacy_function - def set_mass_fraction_of_prot_at_zone(): - """ - Set the fractional abundance of prot at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def get_nabla_mu_at_zone( + index_of_the_particle='i', zone='i' + ): + returns (nabla_mu='float64') + @remote_function(can_handle_array=True) + def get_xlostneu(index_of_the_particle='i'): + returns (xlostneu='float64') - @legacy_function - def set_mass_fraction_of_bid_at_zone(): - """ - Set the fractional abundance of bid at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_xlostneu( + index_of_the_particle='i', + xlostneu='float64', + ): + returns () + @remote_function(can_handle_array=True) + def get_nbzel( + index_of_the_particle='i', number='i' + ): + returns (nbzel='int32') - @legacy_function - def set_mass_fraction_of_bid1_at_zone(): - """ - Set the fractional abundance of bid1 at the specified - zone/mesh-cell of the star. - """ - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_star', dtype='int32', direction=function.IN, - description="The index of the star to set the value of") - function.addParameter( - 'zone', dtype='int32', direction=function.IN, - description="The zone/mesh-cell of the star to set the value of") - function.addParameter( - 'Xj_i', dtype='float64', direction=function.IN, - description=( - "The fractional chemical abundance variable at the specified " - "zone/mesh-cell of the star." - ) - ) - function.result_type = 'int32' - function.result_doc = """ - 0 - OK - The value was set. - -1 - ERROR - A star with the given index was not found. - """ - return function + @remote_function(can_handle_array=True) + def set_nbzel( + index_of_the_particle='i', number='i', + nbzel='int32'): + returns () + + @remote_function(can_handle_array=True) + def get_nbael( + index_of_the_particle='i', number='i' + ): + returns (nbael='int32') + + @remote_function(can_handle_array=True) + def set_nbael( + index_of_the_particle='i', number='i', + nbael='int32'): + returns () + + @remote_function(can_handle_array=True) + def get_abels( + index_of_the_particle='i', number='i' + ): + returns (abels='float64') + + @remote_function(can_handle_array=True) + def set_abels( + index_of_the_particle='i', number='i', + abels='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_xnetalu( + index_of_the_particle='i', number='i' + ): + returns (xnetalu='float64') + @remote_function(can_handle_array=True) + def set_xnetalu( + index_of_the_particle='i', number='i', + xnetalu='float64'): + returns () class Genec(StellarEvolution, InternalStellarStructure): @@ -3468,39 +2868,38 @@ def define_parameters(self, handler): def define_particle_sets(self, handler): - # for set_name in ['fullparticles']: - for set_name in ['particles', 'fullparticles']: - handler.define_set(set_name, 'index_of_the_star') + for set_name in ['particles']: + handler.define_set(set_name, 'index_of_the_particle') InternalStellarStructure.define_particle_sets( self, handler, set_name=set_name ) handler.set_new(set_name, 'new_particle') - for parameter in { - **GENEC_STAR_PARAMETERS, - **GENEC_STAR_PROPERTIES, - # **GENEC_STAR_STRUCTURE - }.items(): - if len(parameter[1]) == 4: + for parameter in SCALAR_SETTERS.items(): + if ( + len(parameter[1]) == 4 + and parameter[1][3] != "" + ): names = ( parameter[1][3], ) - else: - names = (parameter[0],) - handler.add_getter( - set_name, - f'get_{parameter[0]}', - names=names, - ) + handler.add_getter( + set_name, + f'get_{parameter[0]}', + names=names, + ) handler.add_getter(set_name, 'get_radius') - handler.add_getter(set_name, 'get_mass') - handler.add_getter(set_name, 'get_age') - handler.add_getter(set_name, 'get_luminosity') - handler.add_getter(set_name, 'get_temperature') - handler.add_getter(set_name, 'get_time_step', names=('time_step',)) handler.add_getter( - set_name, 'get_number_of_species', names=('n_species',) + set_name, 'get_surface_velocity', names=('surface_velocity',) ) + # handler.add_getter(set_name, 'get_mass') + # handler.add_getter(set_name, 'get_age') + # handler.add_getter(set_name, 'get_luminosity') + # handler.add_getter(set_name, 'get_temperature') + # handler.add_getter(set_name, 'get_time_step', names=('time_step',)) + # handler.add_getter( + # set_name, 'get_number_of_species', names=('n_species',) + # ) # handler.add_method(set_name, 'get_radius_profile') # handler.add_method(set_name, 'get_temperature_profile') @@ -3515,135 +2914,45 @@ def define_particle_sets(self, handler): handler.add_method(set_name, 'get_eps_grav_profile') handler.add_method(set_name, 'get_eps_nu_profile') handler.add_method(set_name, 'get_cumulative_mass_profile') - handler.add_getter( - set_name, 'get_surface_velocity', names=('surface_velocity',) - ) handler.add_method(set_name, 'evolve_one_step') handler.add_method(set_name, 'evolve_for') handler.set_delete(set_name, 'delete_star') - handler.add_gridded_getter( - set_name, - 'get_nabla_rad_at_zone', 'get_firstlast_zone', - names=('nabla_rad_profile',) - ) - - handler.add_gridded_getter( - set_name, - 'get_nabla_ad_at_zone', 'get_firstlast_zone', - names=('nabla_ad_profile',) - ) - - handler.add_gridded_getter( - set_name, - 'get_nabla_mu_at_zone', 'get_firstlast_zone', - names=('nabla_mu_profile',) - ) - - handler.add_gridded_getter( - set_name, - 'get_eps_at_zone', 'get_firstlast_zone', - names=('eps_profile',) - ) - handler.add_gridded_getter( - set_name, - 'get_epsy_at_zone', 'get_firstlast_zone', - names=('epsy_profile',) - ) - handler.add_gridded_getter( - set_name, - 'get_eps_c_adv_at_zone', 'get_firstlast_zone', - names=('eps_c_adv_profile',) - ) - handler.add_gridded_getter( - set_name, - 'get_eps_ne_adv_at_zone', 'get_firstlast_zone', - names=('eps_ne_adv_profile',) - ) - handler.add_gridded_getter( - set_name, - 'get_eps_o_adv_at_zone', 'get_firstlast_zone', - names=('eps_o_adv_profile',) - ) - handler.add_gridded_getter( - set_name, - 'get_eps_si_adv_at_zone', 'get_firstlast_zone', - names=('eps_si_adv_profile',) - ) - handler.add_gridded_getter( - set_name, - 'get_eps_grav_at_zone', 'get_firstlast_zone', - names=('eps_grav_profile',) - ) - handler.add_gridded_getter( - set_name, - 'get_eps_nu_at_zone', 'get_firstlast_zone', - names=('eps_nu_profile',) - ) - handler.add_gridded_getter( - set_name, - 'get_radius_at_zone', 'get_firstlast_zone', - names=('radius_profile',) - ) - handler.add_gridded_setter( - set_name, - 'set_radius_at_zone', 'get_firstlast_zone', - names=('radius_profile',) - ) - - handler.add_gridded_getter( - set_name, - 'get_temperature_at_zone', 'get_firstlast_zone', - names=('temperature_profile',) - ) - handler.add_gridded_setter( - set_name, - 'set_temperature_at_zone', 'get_firstlast_zone', - names=('temperature_profile',) - ) - - handler.add_gridded_getter( - set_name, - 'get_density_at_zone', 'get_firstlast_zone', - names=('density_profile',) - ) - handler.add_gridded_getter( - set_name, - 'set_density_at_zone', 'get_firstlast_zone', - names=('density_profile',) - ) - handler.add_gridded_getter( - set_name, - 'get_luminosity_at_zone', 'get_firstlast_zone', - names=('luminosity_profile',), - ) - - handler.add_gridded_getter( - set_name, - 'get_pressure_at_zone', 'get_firstlast_zone', - names=('pressure_profile',) - ) - # handler.add_gridded_setter( - # set_name, - # 'set_pressure_at_zone', 'get_firstlast_zone', - # names=('pressure_profile',) - # ) - - for species in SPECIES_NAMES: - handler.add_gridded_getter( - set_name, - f'get_mass_fraction_of_{species}_at_zone', - 'get_firstlast_zone', - names=(f'abundance_{species}',) - ) - - handler.add_gridded_setter( - set_name, - f'set_mass_fraction_of_{species}_at_zone', - 'get_firstlast_zone', - names=(f'abundance_{species}',) - ) + handler.add_method(set_name, 'get_starname') + handler.add_method(set_name, 'get_internal_structure') + + # for star_prop in [ + # "nabla_rad", "nabla_ad", "nabla_mu", "eps", "epsy", + # "eps_c_adv", "eps_ne_adv", "eps_o_adv", "eps_si_adv", + # "eps_grav", "eps_nu", "radius", "temperature", "density", + # "luminosity", "pressure", + # ]: + # handler.add_gridded_getter( + # set_name, + # f'get_{star_prop}_at_zone', 'get_firstlast_zone', + # names=(f'{star_prop}_profile',) + # ) + # # handler.add_gridded_setter( + # # set_name, + # # 'set_temperature_at_zone', 'get_firstlast_zone', + # # names=('temperature_profile',) + # # ) + + # for species in SPECIES_NAMES: + # handler.add_gridded_getter( + # set_name, + # f'get_mass_fraction_of_{species}_at_zone', + # 'get_firstlast_zone', + # names=(f'abundance_{species}',) + # ) + + # handler.add_gridded_setter( + # set_name, + # f'set_mass_fraction_of_{species}_at_zone', + # 'get_firstlast_zone', + # names=(f'abundance_{species}',) + # ) # @property # def particles(self): @@ -3670,47 +2979,48 @@ def define_state(self, handler): # handler.add_method('EDIT', 'new_particle') # -> Run (commit_particles) - handler.add_transition('EDIT', 'RUN', 'commit_particles') + # handler.add_transition('EDIT', 'RUN', 'commit_particles') + # handler.add_method('RUN', 'evolve_one_step') - for state in ["UPDATE"]: - for parameter in { - **GENEC_STAR_PARAMETERS, - **GENEC_STAR_PROPERTIES, - }: + # -> Update + handler.add_transition('RUN', 'UPDATE', 'finalize_stellar_model') + + handler.add_method("UPDATE", 'new_particle_from_model') + for state in ["UPDATE", "RUN"]: + for parameter in ALL_GETTERS: handler.add_method(state, f'get_{parameter[0]}') + handler.add_method(state, 'get_internal_structure') + handler.add_method(state, 'get_radius') + handler.add_method(state, 'get_number_of_species') + handler.add_method(state, 'get_temperature') + handler.add_method(state, 'get_luminosity') + handler.add_method(state, 'get_time_step') + handler.add_method(state, 'get_mass') + handler.add_method(state, 'get_age') + handler.add_method(state, 'get_surface_velocity') + handler.add_method(state, 'get_chemical_abundance_profiles') + handler.add_method(state, 'get_mass_fraction_at_zone') handler.add_method(state, 'get_mass_fraction_of_species_at_zone') handler.add_method(state, 'get_mu_at_zone') - handler.add_method(state, 'get_number_of_species') handler.add_method(state, 'get_pressure_at_zone') - handler.add_method(state, 'get_radius') handler.add_method(state, 'get_radius_at_zone') - handler.add_method(state, 'get_eps_at_zone') - handler.add_method(state, 'get_epsy_at_zone') - handler.add_method(state, 'get_eps_c_adv_at_zone') - handler.add_method(state, 'get_eps_ne_adv_at_zone') - handler.add_method(state, 'get_eps_o_adv_at_zone') - handler.add_method(state, 'get_eps_si_adv_at_zone') - handler.add_method(state, 'get_eps_grav_at_zone') - handler.add_method(state, 'get_eps_nu_at_zone') - handler.add_method(state, 'get_surface_velocity') - handler.add_method(state, 'get_temperature') + # handler.add_method(state, 'get_eps_at_zone') + # handler.add_method(state, 'get_epsy_at_zone') + # handler.add_method(state, 'get_eps_c_adv_at_zone') + # handler.add_method(state, 'get_eps_ne_adv_at_zone') + # handler.add_method(state, 'get_eps_o_adv_at_zone') + # handler.add_method(state, 'get_eps_si_adv_at_zone') + # handler.add_method(state, 'get_eps_grav_at_zone') + # handler.add_method(state, 'get_eps_nu_at_zone') handler.add_method(state, 'get_temperature_at_zone') handler.add_method(state, 'get_density_at_zone') - handler.add_method(state, 'get_luminosity') # handler.add_method(state, 'get_luminosity_at_zone') - handler.add_method(state, 'get_time_step') - handler.add_method(state, 'get_mass') - handler.add_method(state, 'get_age') - handler.add_method(state, 'get_mass_fraction_at_zone') for species in SPECIES_NAMES: handler.add_method( state, f'get_mass_fraction_of_{species}_at_zone' ) - # -> Update - handler.add_transition('RUN', 'UPDATE', 'finalize_stellar_model') - handler.add_method('UPDATE', 'set_n_snap') #handler.add_method('UPDATE', 'set_ipoly') handler.add_method('UPDATE', 'set_chemical_abundance_profiles') @@ -3731,7 +3041,7 @@ def define_state(self, handler): ) # -> Run (recommit_particles) - #handler.add_method('UPDATE', 'set_starname') + # handler.add_method('UPDATE', 'set_starname') # handler.add_method('UPDATE', 'new_particle') def define_methods(self, handler): @@ -3743,11 +3053,11 @@ def define_methods(self, handler): (handler.INDEX, handler.ERROR_CODE) ) - handler.add_method( - "read_genec_model", - (handler.NO_UNIT), - (handler.INDEX, handler.ERROR_CODE) - ) + # handler.add_method( + # "read_genec_model", + # (handler.NO_UNIT), + # (handler.INDEX, handler.ERROR_CODE) + # ) handler.add_method( "get_surface_velocity", @@ -3905,98 +3215,284 @@ def get_cumulative_mass_profile( indices_of_the_stars, number_of_zones=number_of_zones) return frac_profile.cumsum() + def get_internal_structure(self, index_of_the_star): + internal_structure = {} + for star_property in SCALAR_SETTERS: + func = getattr(self, f'get_{star_property}') + internal_structure[star_property] = func(index_of_the_star) + number_of_zones = self.get_m(index_of_the_star) + for structure_property in { + **GENEC_STAR_STRUCTURE, + }: + func = getattr(self, f'get_{structure_property}_at_zone') + # internal_structure.append(func(index_of_the_star)) + + internal_structure[structure_property] = func( + index_of_the_star, + (list(range(number_of_zones)) | units.none)[::-1] + ) + extra_elements = self.get_mbelx(index_of_the_star) + for structure_property in { + **GENEC_STAR_STRUCTURE_EXTRA, + }: + func = getattr(self, f'get_{structure_property}_at_zone') + x = np.array([]) + for element in range(extra_elements): + x = np.append( + x, func( + index_of_the_star, + (list(range(number_of_zones)) | units.none)[::-1], + 1+element + ) + ) + internal_structure[structure_property] = x + for netdef_property in { + **GENEC_NETDEF_ARRAYS, + }: + func = getattr(self, f'get_{netdef_property}') + + internal_structure[netdef_property] = func( + index_of_the_star, + (list(range(1, 9)) | units.none) + ) + for netalu_property in { + **GENEC_NETALU_ARRAYS, + }: + func = getattr(self, f'get_{netalu_property}') + + internal_structure[netalu_property] = func( + index_of_the_star, + (list(range(1, 6)) | units.none) + ) + return internal_structure + def new_particle_from_model( self, internal_structure, current_age=0 | units.julianyr, key=None ): - self.new_stellar_model( - internal_structure[0], internal_structure[1], - internal_structure[2], internal_structure[3], - internal_structure[4], internal_structure[5], - internal_structure[6], internal_structure[7], - internal_structure[8], internal_structure[9], - internal_structure[10], internal_structure[11], - internal_structure[12], internal_structure[13], - internal_structure[14], internal_structure[15], - internal_structure[16], internal_structure[17], - internal_structure[18], internal_structure[19], - internal_structure[20], internal_structure[21], - internal_structure[22], internal_structure[23], - internal_structure[24], internal_structure[25], - internal_structure[26], internal_structure[27], - internal_structure[28], internal_structure[29], - internal_structure[30], internal_structure[31], - internal_structure[32], internal_structure[33], - internal_structure[34], internal_structure[35], - internal_structure[36], internal_structure[37], - internal_structure[38], internal_structure[39], - internal_structure[40], internal_structure[41], - internal_structure[42], internal_structure[43], - internal_structure[44], internal_structure[45], - internal_structure[46], internal_structure[47], - internal_structure[48], internal_structure[49], - internal_structure[50], internal_structure[51], - internal_structure[52], internal_structure[53], - internal_structure[54], internal_structure[55], - internal_structure[56], internal_structure[57], - internal_structure[58], internal_structure[59], - internal_structure[60], internal_structure[61], - internal_structure[62], internal_structure[63], - internal_structure[64], internal_structure[65], - internal_structure[66], internal_structure[67], - internal_structure[68], internal_structure[69], - internal_structure[70], internal_structure[71], - internal_structure[72], internal_structure[73], - internal_structure[74], internal_structure[75], - internal_structure[76], internal_structure[77], - internal_structure[78], internal_structure[79], - internal_structure[80], internal_structure[81], - internal_structure[82], internal_structure[83], - internal_structure[84], internal_structure[85], - internal_structure[86], internal_structure[87], - internal_structure[88], internal_structure[89], - internal_structure[90], internal_structure[91], - internal_structure[92], internal_structure[93], - internal_structure[94], internal_structure[95], - internal_structure[96], internal_structure[97], - internal_structure[98], internal_structure[99], - internal_structure[100], internal_structure[101], - internal_structure[102], internal_structure[103], - internal_structure[104], internal_structure[105], - internal_structure[106], internal_structure[107], - internal_structure[108], internal_structure[109], - internal_structure[110], internal_structure[111], - internal_structure[112], internal_structure[113], - internal_structure[114], internal_structure[115], - internal_structure[116], internal_structure[117], - internal_structure[118], internal_structure[119], - internal_structure[120], internal_structure[121], - internal_structure[122], internal_structure[123], - internal_structure[124], internal_structure[125], - internal_structure[126], internal_structure[127], - internal_structure[128], internal_structure[129], - internal_structure[130], internal_structure[131], - internal_structure[132], internal_structure[133], - internal_structure[134], internal_structure[135], - internal_structure[136], internal_structure[137], - internal_structure[138], internal_structure[139], - internal_structure[140], internal_structure[141], - internal_structure[142], internal_structure[143], - internal_structure[144], internal_structure[145], - internal_structure[146], internal_structure[147], - internal_structure[148], internal_structure[149], - internal_structure[150], internal_structure[151], - internal_structure[152], internal_structure[153], - internal_structure[154], internal_structure[155], - internal_structure[156], internal_structure[157], - internal_structure[158], internal_structure[159], - internal_structure[160], internal_structure[161], - internal_structure[162], internal_structure[163], - internal_structure[164], internal_structure[165], - internal_structure[166], internal_structure[167], - internal_structure[168], internal_structure[169], - internal_structure[170], internal_structure[171], - internal_structure[172], internal_structure[173], - internal_structure[174], internal_structure[175], - internal_structure[176], + index_of_the_particle = self.new_stellar_model( + internal_structure['initialised'], + internal_structure['veryFirst'], + internal_structure['starname'], + internal_structure['nwmd'], + internal_structure['nwseq'], + internal_structure['modanf'], + internal_structure['nzmod'], + internal_structure['end_at_phase'], + internal_structure['end_at_model'], + internal_structure['irot'], + internal_structure['isol'], + internal_structure['imagn'], + internal_structure['ialflu'], + internal_structure['ianiso'], + internal_structure['ipop3'], + internal_structure['ibasnet'], + internal_structure['phase'], + internal_structure['var_rates'], + internal_structure['bintide'], + internal_structure['binm2'], + internal_structure['periodini'], + internal_structure['const_per'], + internal_structure['iprezams'], + internal_structure['zinit'], + internal_structure['zsol'], + internal_structure['z'], + internal_structure['iopac'], + internal_structure['ikappa'], + internal_structure['idiff'], + internal_structure['iadvec'], + internal_structure['istati'], + internal_structure['icoeff'], + internal_structure['fenerg'], + internal_structure['richac'], + internal_structure['igamma'], + internal_structure['frein'], + internal_structure['K_Kawaler'], + internal_structure['Omega_saturation'], + internal_structure['rapcrilim'], + internal_structure['vwant'], + internal_structure['xfom'], + internal_structure['omega'], + internal_structure['xdial'], + internal_structure['idialo'], + internal_structure['idialu'], + internal_structure['Add_Flux'], + internal_structure['diff_only'], + internal_structure['B_initial'], + internal_structure['add_diff'], + internal_structure['n_mag'], + internal_structure['alpha_F'], + internal_structure['nsmooth'], + internal_structure['qminsmooth'], + internal_structure['imloss'], + internal_structure['fmlos'], + internal_structure['ifitm'], + internal_structure['fitm'], + internal_structure['fitmi'], + internal_structure['deltal'], + internal_structure['deltat'], + internal_structure['nndr'], + internal_structure['RSG_Mdot'], + internal_structure['SupraEddMdot'], + internal_structure['Be_mdotfrac'], + internal_structure['start_mdot'], + internal_structure['iledou'], + internal_structure['idifcon'], + internal_structure['iover'], + internal_structure['elph'], + internal_structure['my'], + internal_structure['dovhp'], + internal_structure['iunder'], + internal_structure['dunder'], + internal_structure['gkorm'], + internal_structure['alph'], + internal_structure['agdr'], + internal_structure['faktor'], + internal_structure['dgrp'], + internal_structure['dgrl'], + internal_structure['dgry'], + internal_structure['dgrc'], + internal_structure['dgro'], + internal_structure['dgr20'], + internal_structure['nbchx'], + internal_structure['nrband'], + internal_structure['xcn'], + internal_structure['islow'], + internal_structure['icncst'], + internal_structure['tauH_fit'], + internal_structure['display_plot'], + internal_structure['iauto'], + internal_structure['iprn'], + internal_structure['iout'], + internal_structure['itmin'], + internal_structure['xyfiles'], + internal_structure['idebug'], + internal_structure['itests'], + internal_structure['verbose'], + internal_structure['stop_deg'], + internal_structure['n_snap'], + internal_structure['m'], + internal_structure['gms'], + internal_structure['alter'], + internal_structure['gls'], + internal_structure['teff'], + internal_structure['glsv'], + internal_structure['teffv'], + internal_structure['dzeitj'], + internal_structure['dzeit'], + internal_structure['dzeitv'], + internal_structure['xmini'], + internal_structure['summas'], + internal_structure['ab'], + internal_structure['dm_lost'], + internal_structure['mbelx'], + internal_structure['xtefflast'], + internal_structure['xllast'], + internal_structure['xrholast'], + internal_structure['xclast'], + internal_structure['xtclast'], + internal_structure['inum'], + internal_structure['nsugi'], + internal_structure['period'], + internal_structure['r_core'], + internal_structure['vna'], + internal_structure['vnr'], + internal_structure['q'], + internal_structure['p'], + internal_structure['t'], + internal_structure['r'], + internal_structure['s'], + internal_structure['x'], + internal_structure['y3'], + internal_structure['y'], + internal_structure['xc12'], + internal_structure['xc13'], + internal_structure['xn14'], + internal_structure['xn15'], + internal_structure['xo16'], + internal_structure['xo17'], + internal_structure['xo18'], + internal_structure['xne20'], + internal_structure['xne22'], + internal_structure['xmg24'], + internal_structure['xmg25'], + internal_structure['xmg26'], + internal_structure['xf19'], + internal_structure['xne21'], + internal_structure['xna23'], + internal_structure['xal27'], + internal_structure['xsi28'], + internal_structure['xc14'], + internal_structure['xf18'], + internal_structure['xal26'], + internal_structure['xneut'], + internal_structure['xprot'], + internal_structure['omegi'], + internal_structure['xbid'], + internal_structure['xbid1'], + internal_structure['vp'], + internal_structure['vt'], + internal_structure['vr'], + internal_structure['vs'], + internal_structure['vx'], + internal_structure['vy'], + internal_structure['vy3'], + internal_structure['vxc12'], + internal_structure['vxc13'], + internal_structure['vxn14'], + internal_structure['vxn15'], + internal_structure['vxo16'], + internal_structure['vxo17'], + internal_structure['vxo18'], + internal_structure['vxne20'], + internal_structure['vxne22'], + internal_structure['vxmg24'], + internal_structure['vxmg25'], + internal_structure['vxmg26'], + internal_structure['vxf19'], + internal_structure['vxne21'], + internal_structure['vxna23'], + internal_structure['vxal27'], + internal_structure['vxsi28'], + internal_structure['vxc14'], + internal_structure['vxf18'], + internal_structure['vxal26'], + internal_structure['vxneut'], + internal_structure['vxprot'], + internal_structure['vomegi'], + internal_structure['vxbid'], + internal_structure['vxbid1'], + internal_structure['xlostneu'], + # internal_structure['abelx'], + # internal_structure['vabelx'], + ) + extra_elements = internal_structure['mbelx'] + zones = internal_structure['m'] + for element in range(extra_elements): + for zone in range(zones): + self.set_abelx_at_zone( + index_of_the_particle, zone, 1+element, + internal_structure['abelx'][element*zones + zone] + ) + self.set_vabelx_at_zone( + index_of_the_particle, zone, 1+element, + internal_structure['vabelx'][element*zones + zone] + ) + for i in range(8): + self.set_nbzel( + index_of_the_particle, i+1, + internal_structure['nbzel'][i] + ) + self.set_nbael( + index_of_the_particle, i+1, + internal_structure['nbael'][i] + ) + self.set_abels( + index_of_the_particle, i+1, + internal_structure['abels'][i] + ) + for i in range(5): + self.set_xnetalu( + index_of_the_particle, i+1, + internal_structure['xnetalu'][i] ) return diff --git a/src/amuse/community/genec/make_getsetters.py b/src/amuse/community/genec/make_getsetters.py index 4a525d1dee..98a7503ead 100644 --- a/src/amuse/community/genec/make_getsetters.py +++ b/src/amuse/community/genec/make_getsetters.py @@ -1,58 +1,946 @@ import sys -# from interface import GENEC_STAR_PARAMETERS as INPUT -from interface import GENEC_STAR_PROPERTIES as INPUT from amuse.community import NO_UNIT -def main(): - for star_property in INPUT: - dtype = INPUT[star_property][0] - if dtype in ["i", "int32"]: - f_dtype = "integer" - elif dtype in ["d", "float64"]: - f_dtype = "real(kindreal)" - elif dtype in ["b", "bool"]: - f_dtype = "logical" - elif dtype in ["s", "string"]: - f_dtype = "character(256)" +PY_INTERFACE_HEADER = """ +\"\"\" +Interface for GENEC. +\"\"\" + +import numpy as np +from amuse.datamodel import ParticlesWithFilteredAttributes +from amuse.community import CodeInterface +from amuse.community import LegacyFunctionSpecification +from amuse.community import legacy_function, remote_function +from amuse.community import LiteratureReferencesMixIn +from amuse.community import CodeWithDataDirectories +from amuse.community import InCodeComponentImplementation +from amuse.community import NO_UNIT, ERROR_CODE +from amuse.community.interface.se import StellarEvolution +from amuse.community.interface.se import StellarEvolutionInterface +from amuse.community.interface.se import InternalStellarStructure +from amuse.community.interface.se import InternalStellarStructureInterface +from amuse.community.interface.stopping_conditions import ( + StoppingConditionInterface, StoppingConditions +) +from amuse.units import units + +SPECIES_NAMES = { + 'h': 1, + 'he3': 2, + 'he': 3, + 'c12': 4, + 'c13': 5, + 'n14': 6, + 'n15': 7, + 'o16': 8, + 'o17': 9, + 'o18': 10, + 'ne20': 11, + 'ne22': 12, + 'mg24': 13, + 'mg25': 14, + 'mg26': 15, + 'c14': 16, + 'f18': 17, + 'f19': 18, + 'ne21': 19, + 'na23': 20, + 'al26': 21, + 'al27': 22, + 'si28': 23, + 'neut': 24, + 'prot': 25, + 'bid': 26, + 'bid1': 27, +} +""" + +# Parameters (but individual to each star) +GENEC_STAR_CHARACTERISTICS = { + # 'GENEC name': [dtype, unit, description, AMUSE name (optional)] + 'initialised': ['bool', '', "True if the star is an intialised model"], + 'starname': ['string', '', "Name of the star"], + 'nwmd': ['int32', '', "model number"], + 'nwseq': ['int32', '', "number of the first model in the time-step series"], + 'modanf': ['int32', '', ".b file number"], + 'nzmod': ['int32', '', "number of models in a run"], + 'end_at_phase': ['int32', '', "Stop if this phase is reached"], + 'end_at_model': ['int32', '', "Stop if this model number is reached"], +} + +GENEC_STAR_PHYSICS = { + 'irot': ['int32', '', "rotating if set to 1"], + 'isol': ['int32', '', "solid rotation if set to 1"], + 'imagn': ['int32', '', "internal magnetic fields (0=none, 1=included)"], + 'ialflu': ['int32', '', "Ne-Na and Mg-Al networks if set to 1"], + 'ianiso': ['int32', '', "wind anisotropy if set to 1"], + 'ipop3': ['int32', '', "Z=0 models if set to 1"], + 'ibasnet': ['int32', '', "extended nuclear network if set to 1"], + 'phase': ['int32', '', "fusion phases"], + 'var_rates': ['bool', '', "allows to use different reaction rate files if set to True"], + 'bintide': ['bool', '', "tidal interaction in binaries if set to True"], + 'binm2': ['float64', '', "mass of the companion"], + 'periodini': ['float64', '', "initial period of the binary"], + 'const_per': ['bool', '', "keep constant period if True"], + 'iprezams': ['int32', '', ""], +} + +GENEC_STAR_COMPOSITION = { + 'zinit': ['float64', '', "initial metallicity of the model"], + 'zsol': ['float64', '', "reference solar metallicity"], + 'z': ['float64', '', "abundance of the neglected isotopes"], + 'iopac': ['int32', '', "choice of the opacity table if ikappa = 5"], + 'ikappa': ['int32', '', "opacity choice"], +} + +GENEC_STAR_ROTATION = { + 'idiff': ['int32', '', "computation of the diffusion of Omega and chemicals if set to 1"], + 'iadvec': ['int32', '', "advecto-diffusive version of the transport of Omega if set to 1"], + 'istati': ['int32', '', "only local conservation of angular momentum if set to 1"], + 'icoeff': ['int32', '', "prescription to be used for the diffusion coefficients"], + 'fenerg': ['float64', '', "fraction of the shear energy used for the mixing"], + 'richac': ['float64', '', "critical Richardson number value"], + 'igamma': ['int32', '', "treatment of the shear according to M&M96 if set to 1"], + 'frein': ['float64', '', "magnetic braking if ≠ 0"], + 'K_Kawaler': ['float64', '', "K parameter in Kawaler1998 magnetic braking law"], + 'Omega_saturation': ['float64', '', "Ωsat in Kawaler magnetic braking law"], + 'rapcrilim': ['float64', '', "maximum Ωcrit ratio before the onset of mechanical mass loss"], + 'vwant': ['float64', '', "chosen velocity on the ZAMS (Veq if > 1.0, V/Vcrit if 00, switches on the wind quenching, and evolves the magnetic field strength according to the conservation of magnetic flux"], + 'add_diff': ['float64', '', "additional viscosity value, used to increase the core-envelope coupling"], + 'n_mag': ['int32', '', "type of treatment for magnetic fields"], + 'alpha_F': ['float64', '', "α parameter in Fuller+ 2019. Values higher than 1 lower the threshold to trigger the instability (Qmin) and increase the magnetic viscosity (increased transport)"], + 'nsmooth': ['int32', '', "number of layers used for smoothing the Ω gradient (used by Mag_diff_general). Default value is nsmooth=1, recommended value for Fuller+ 2019 is nsmooth=5"], + 'qminsmooth': ['bool', '', "mag. instability always considered if set to True"], +} + +GENEC_STAR_SURFACE = { + 'imloss': ['int32', '', "choice of the mass-loss prescription"], + 'fmlos': ['float64', '', "except for IMLOSS=2 or 3, multiplying factor applied to the mass loss"], + 'ifitm': ['int32', '', "management of the changes of fitm during redward evolution (and/or blueward evolution after a RSG phase)"], + 'fitm': ['float64', '', "mass included in the interior"], + 'fitmi': ['float64', '', "max value of FITM to which the star will come back when going back to the blue"], + 'deltal': ['float64', '', "triangle size for L at the surface"], + 'deltat': ['float64', '', "triangle size for T at the surface"], + 'nndr': ['int32', '', "management of the behaviour of (L,Teff) with respect to the triangle"], + 'RSG_Mdot': ['int32', '', "mass-loss recipe used for RSG"], + 'SupraEddMdot': ['bool', '', "x3 multiplication factor to the wind in case of supra-Eddington layers if set to True"], + 'Be_mdotfrac': ['float64', '', ""], + 'start_mdot': ['float64', '', "value of Ω/Ωcrit at which the Be mass loss starts to apply"], +} + +GENEC_STAR_CONVECTION = { + 'iledou': ['int32', '', "Ledoux criterion for convection if set to 1"], + 'idifcon': ['int32', '', "convection treated as a diffusion if set to 1 (used during O-b and Si-b)"], + 'iover': ['int32', '', "overshooting taken into account if set to 1"], + 'elph': ['float64', '', "mixing length for the external convective zone"], + 'my': ['int32', '', "integration of the envelope on ρ rather than P if set to 1"], + 'dovhp': ['float64', '', "value of the α overshooting parameter Λ = α HP"], + 'iunder': ['int32', '', "undershooting taken into account if set to 1"], + 'dunder': ['float64', '', "value of the undershooting parameter"], +} + +GENEC_STAR_CONVERGENCE = { + 'gkorm': ['float64', '', "accepted deviation on the structure variables"], + 'alph': ['float64', '', "fraction of the correction applied for the next iteration"], + 'agdr': ['float64', '', "absolute value of the maximum correction accepted on r, s, P and T"], + 'faktor': ['float64', '', "parameter allowing to 'compensate' (during the computation only) for layers with Lr > Ltot, and hence avoid dL/dr < 0"], + 'dgrp': ['float64', '', "relative variations (from one layer to the other) accepted on P"], + 'dgrl': ['float64', '', "relative variations (from one layer to the other) accepted on L"], + 'dgry': ['float64', '', "relative variations (from one layer to the other) accepted on 4He"], + 'dgrc': ['float64', '', "relative variations (from one layer to the other) accepted on 12C"], + 'dgro': ['float64', '', "relative variations (from one layer to the other) accepted on 16O"], + 'dgr20': ['float64', '', "relative variations (from one layer to the other) accepted on ?"], + 'nbchx': ['int32', '', "iteration number for the computation of the change in chemical composition"], + 'nrband': ['int32', '', "iteration number for the chemicals between model n and n+1"], +} + +GENEC_STAR_TIME = { + 'xcn': ['float64', '', "multiplying factor applied on the time step for the next run"], + 'islow': ['int32', '', "slow version of the program if not 0 by modification of the ideal nuclear time step ratxcn"], + 'icncst': ['int32', '', "constant time step (equivalent to xcn=1.0)"], + 'tauH_fit': ['int32', '', "used to set the maximal timestep in case of critical velocity, as a fraction of the MS lifetime"], +} + +GENEC_STAR_VARIOUS = { + 'display_plot': ['bool', '', "display of the pgplot window if set to True"], + 'iauto': ['int32', '', "management of the parameters change through the different phases of the evolution"], + 'iprn': ['int32', '', "the full structure is printed every iprn models. If iprn > nzmod, only one structure will be printed, the one corresponding to model nwseq"], + 'iout': ['int32', '', "number of layers used for the smoothing of the diffusion gradient at the border of the convective zones"], + 'itmin': ['int32', '', "minimal number of iterations in henyey"], + 'xyfiles': ['bool', '', ""], + 'idebug': ['int32', '', "addition of some terminal printings useful for the debugging, with different possible levels. All values > 0 set verbose=True"], + 'itests': ['int32', '', "use of a flag to test some pieces of code"], + 'verbose': ['bool', '', "increases the level of printings on the terminal and the .l file"], + 'stop_deg': ['bool', '', "automatically stops a computation when Tc becomes degenerate"], + 'n_snap': ['int32', '', "number of steps between snapshots [0]"], +} + +# Stellar properties (but global for the star) +GENEC_STAR_PROPERTIES = { + # 'GENEC name: [dtype, unit, description, AMUSE name (empty = not used)] + 'm': ['int32', '', "number of zones", "n_zones"], + 'gms': ['float64', 'MSun', "total mass", "mass"], + 'alter': ['float64', 'julianyr', "stellar age", "age"], + 'gls': ['float64', 'LSun', "stellar luminosity", "luminosity"], + 'teff': ['float64', 'K', "effective temperature", "temperature"], + 'glsv': ['float64', 'LSun', "previous luminosity"], + 'teffv': ['float64', 'K', "previous temperature"], + 'dzeitj': ['float64', 'julianyr', "time step (yr)", "time_step"], + 'dzeit': ['float64', 's', "time step (s)", ""], + 'dzeitv': ['float64', 's', "previous time step", ""], + 'xmini': ['float64', 'MSun', "initial mass", "initial_mass"], + 'summas': ['float64', 'MSun', "total mass", ""], + 'ab': ['float64', '', "binary separation", ""], + 'dm_lost': ['float64', 'MSun', "total mass lost", ""], +} + +GENEC_STAR_EXTRA = { + 'mbelx': ['int32', '', "number of extra elements"], + 'xtefflast': ['float64', '', ""], + 'xllast': ['float64', '', ""], + 'xrholast': ['float64', '', ""], + 'xclast': ['float64', '', ""], + 'xtclast': ['float64', '', ""], + 'inum': ['int32', '', ""], + 'nsugi': ['int32', '', ""], + 'period': ['float64', '', ""], + 'r_core': ['float64', '', ""], + 'vna': ['float64', '', "adiabatic gradient in the envelope"], + 'vnr': ['float64', '', "radiative gradient in the envelope"], +} + +# Structural properties (m layers) +GENEC_STAR_STRUCTURE = { + # 'GENEC name: [dtype, unit, description, AMUSE name (optional) + 'q': ['float64', '', "ln(1-Mr/M)"], + 'p': ['float64', '', "ln(pressure)"], + 't': ['float64', '', "ln(temperature)"], + 'r': ['float64', '', "ln(radius)"], + 's': ['float64', '', "ln(internal luminosity + 1)"], + 'x': ['float64', '', "H abundance fraction"], + 'y3': ['float64', '', "He3 abundance fraction"], + 'y': ['float64', '', "He abundance fraction"], + 'xc12': ['float64', '', "C12 abundance fraction"], + 'xc13': ['float64', '', "C13 abundance fraction"], + 'xn14': ['float64', '', "N14 abundance fraction"], + 'xn15': ['float64', '', "N15 abundance fraction"], + 'xo16': ['float64', '', "O16 abundance fraction"], + 'xo17': ['float64', '', "O17 abundance fraction"], + 'xo18': ['float64', '', "O18 abundance fraction"], + 'xne20': ['float64', '', "Ne20 abundance fraction"], + 'xne22': ['float64', '', "Ne22 abundance fraction"], + 'xmg24': ['float64', '', "Mg24 abundance fraction"], + 'xmg25': ['float64', '', "Mg25 abundance fraction"], + 'xmg26': ['float64', '', "Mg26 abundance fraction"], + 'xf19': ['float64', '', "F19 abundance fraction"], + 'xne21': ['float64', '', "Ne21 abundance fraction"], + 'xna23': ['float64', '', "Na23 abundance fraction"], + 'xal27': ['float64', '', "Al27 abundance fraction"], + 'xsi28': ['float64', '', "Si28 abundance fraction"], + 'xc14': ['float64', '', "C14 abundance fraction"], + 'xf18': ['float64', '', "F18 abundance fraction"], + 'xal26': ['float64', '', "Al26 abundance fraction"], + 'xneut': ['float64', '', "Neutron abundance fraction"], + 'xprot': ['float64', '', "Proton abundance fraction"], + 'omegi': ['float64', '', "Rotation"], + 'xbid': ['float64', '', "Pseudo element abundance fraction"], + 'xbid1': ['float64', '', "Pseudo element 2 abundance fraction"], + 'vp': ['float64', '', "Previous ln(pressure)"], + 'vt': ['float64', '', "Previous ln(temperature)"], + 'vr': ['float64', '', "Previous ln(radius)"], + 'vs': ['float64', '', "Previous ln(internal luminosity + 1)"], + 'vx': ['float64', '', "Previous H abundance fraction"], + 'vy': ['float64', '', "Previous He abundance fraction"], + 'vy3': ['float64', '', "Previous He3 abundance fraction"], + 'vxc12': ['float64', '', "Previous C12 abundance fraction"], + 'vxc13': ['float64', '', "Previous C13 abundance fraction"], + 'vxn14': ['float64', '', "Previous N14 abundance fraction"], + 'vxn15': ['float64', '', "Previous N15 abundance fraction"], + 'vxo16': ['float64', '', "Previous O16 abundance fraction"], + 'vxo17': ['float64', '', "Previous O17 abundance fraction"], + 'vxo18': ['float64', '', "Previous O18 abundance fraction"], + 'vxne20': ['float64', '', "Previous Ne20 abundance fraction"], + 'vxne22': ['float64', '', "Previous Ne22 abundance fraction"], + 'vxmg24': ['float64', '', "Previous Mg24 abundance fraction"], + 'vxmg25': ['float64', '', "Previous Mg25 abundance fraction"], + 'vxmg26': ['float64', '', "Previous Mg26 abundance fraction"], + 'vxf19': ['float64', '', "Previous F19 abundance fraction"], + 'vxne21': ['float64', '', "Previous Ne21 abundance fraction"], + 'vxna23': ['float64', '', "Previous Na23 abundance fraction"], + 'vxal27': ['float64', '', "Previous Al27 abundance fraction"], + 'vxsi28': ['float64', '', "Previous Si28 abundance fraction"], + 'vxc14': ['float64', '', "Previous C14 abundance fraction"], + 'vxf18': ['float64', '', "Previous F18 abundance fraction"], + 'vxal26': ['float64', '', "Previous Al26 abundance fraction"], + 'vxneut': ['float64', '', "Previous Neutron abundance fraction"], + 'vxprot': ['float64', '', "Previous Proton abundance fraction"], + 'vomegi': ['float64', '', "Previous rotation"], + 'vxbid': ['float64', '', "Previous Pseudo element abundance fraction"], + 'vxbid1': ['float64', '', "Previous Pseudo element 2 abundance fraction"], +} + +# Structural properties (mbelx elements, m layers) +GENEC_STAR_STRUCTURE_EXTRA = { + 'abelx': ['float64', '', "extra elements"], + 'vabelx': ['float64', '', "previous extra elements"], +} + +GENEC_NETDEF_SCALARS = { + 'xlostneu': ['float64', '', "lost neutrons"], +} +GENEC_NETDEF_ARRAYS = { + 'nbzel': ['int32', '', 'length 8'], + 'nbael': ['int32', '', 'length 8'], + 'abels': ['float64', '', 'length 8'], +} +GENEC_NETALU_ARRAYS = { + 'xnetalu': ['float64', '', 'length 5'], +} + +# These are not (re)stored / set, but they are calculated e.g. for plotting +GENEC_STAR_STRUCTURE_DERIVED = { + 'eps': ['float64', '', ""], + 'epsy': ['float64', '', ""], + 'eps_c_adv': ['float64', '', ""], + 'eps_ne_adv': ['float64', '', ""], + 'eps_o_adv': ['float64', '', ""], + 'eps_si_adv': ['float64', '', ""], + 'eps_grav': ['float64', '', ""], + 'eps_nu': ['float64', '', ""], + 'nabla_rad': ['float64', '', ""], + 'nabla_ad': ['float64', '', ""], + 'nabla_mu': ['float64', '', ""], +} + +ALL_SETTERS = { + **GENEC_STAR_CHARACTERISTICS, + **GENEC_STAR_PHYSICS, + **GENEC_STAR_COMPOSITION, + **GENEC_STAR_ROTATION, + **GENEC_STAR_SURFACE, + **GENEC_STAR_CONVECTION, + **GENEC_STAR_CONVERGENCE, + **GENEC_STAR_TIME, + **GENEC_STAR_VARIOUS, + **GENEC_STAR_PROPERTIES, + **GENEC_STAR_EXTRA, + **GENEC_STAR_STRUCTURE, + **GENEC_STAR_STRUCTURE_EXTRA, + **GENEC_NETDEF_SCALARS, +} +SCALAR_SETTERS = { + **GENEC_STAR_CHARACTERISTICS, + **GENEC_STAR_PHYSICS, + **GENEC_STAR_COMPOSITION, + **GENEC_STAR_ROTATION, + **GENEC_STAR_SURFACE, + **GENEC_STAR_CONVECTION, + **GENEC_STAR_CONVERGENCE, + **GENEC_STAR_TIME, + **GENEC_STAR_VARIOUS, + **GENEC_STAR_PROPERTIES, + **GENEC_STAR_EXTRA, + **GENEC_NETDEF_SCALARS, +} + +VECTOR_SETTERS = { + **GENEC_STAR_STRUCTURE, + **GENEC_STAR_STRUCTURE_EXTRA, +} + + +def star_parameters(outfilename): + py_outfile = f"{outfilename}.py" + f_outfile = f"{outfilename}.f90" + for parameter in { + **GENEC_STAR_CHARACTERISTICS, + **GENEC_STAR_PHYSICS, + **GENEC_STAR_COMPOSITION, + **GENEC_STAR_ROTATION, + **GENEC_STAR_SURFACE, + **GENEC_STAR_CONVECTION, + **GENEC_STAR_CONVERGENCE, + **GENEC_STAR_TIME, + **GENEC_STAR_VARIOUS, + **GENEC_STAR_PROPERTIES, + **GENEC_STAR_EXTRA, + }.items(): + name = parameter[0] + dtype = parameter[1][0] + unit = parameter[1][1] + description = parameter[1][2] + if len(parameter[1]) > 3: + amuse_name = parameter[1][3] + else: + amuse_name = None + f_dtype = get_f_dtype(dtype) + if unit != '': + dtype = f"'{dtype}' | units.{unit}" + else: + dtype = f"'{dtype}'" + with open(py_outfile, "a") as py_out: + py_out.write( + f" @remote_function(can_handle_array=True)\n" + f" def get_{name}(index_of_the_particle='i'):\n" + f" returns ({name}={dtype})\n" + f"\n" + f" @remote_function(can_handle_array=True)\n" + f" def set_{name}(\n" + f" index_of_the_particle='i',\n" + f" {name}={dtype},\n" + f" ):\n" + f" returns ()\n" + f"\n" + ) + with open(f_outfile, "a") as f_out: + f_out.write( + f"integer function get_{name}(index_of_the_particle, {name})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" {f_dtype}, intent(out):: {name}\n" + f" {name} = GenecStar%{name}\n" + f" get_{name} = 0\n" + f"end function get_{name}\n" + f"\n" + f"integer function set_{name}(index_of_the_particle, {name})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" {f_dtype}, intent(in):: {name}\n" + f" GenecStar%{name} = {name}\n" + f" set_{name} = 0\n" + f"end function set_{name}\n" + f"\n" + ) + return + +def star_structure(outfilename): + py_outfile = f"{outfilename}.py" + f_outfile = f"{outfilename}.f90" + for parameter in { + **GENEC_STAR_STRUCTURE, + }.items(): + name = parameter[0] + dtype = parameter[1][0] + unit = parameter[1][1] + description = parameter[1][2] + if len(parameter[1]) > 3: + amuse_name = parameter[1][3] + else: + amuse_name = None + f_dtype = get_f_dtype(dtype) + if unit != '': + dtype = f"'{dtype}' | units.{unit}" + else: + dtype = f"'{dtype}'" + with open(py_outfile, "a") as py_out: + py_out.write( + f" @remote_function(can_handle_array=True)\n" + f" def get_{name}_at_zone(\n" + f" index_of_the_particle='i', zone='i'\n" + f" ):\n" + f" returns ({name}={dtype})\n" + f"\n" + f" @remote_function(can_handle_array=True)\n" + f" def set_{name}_at_zone(\n" + f" index_of_the_particle='i', zone='i',\n" + f" {name}={dtype}):\n" + f" returns ()\n" + f"\n" + ) + with open(f_outfile, "a") as f_out: + f_out.write( + f"integer function get_{name}_at_zone(index_of_the_particle, zone, {name})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" integer, intent(in):: zone\n" + f" real(kindreal), intent(out):: {name}\n" + f" integer:: i\n" + f" get_{name}_at_zone = -1\n" + f" i = GenecStar%m-zone\n" + # f" if (zone <= GenecStar%m) then\n" + f" if (.true.) then\n" + f" {name} = GenecStar%{name}(i)\n" + f" get_{name}_at_zone = 0\n" + f" end if\n" + f"end function get_{name}_at_zone\n" + f"\n" + f"integer function set_{name}_at_zone(index_of_the_particle, zone, {name})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" integer, intent(in):: zone\n" + f" {f_dtype}, intent(in):: {name}\n" + f" integer:: i\n" + f" set_{name}_at_zone = -1\n" + f" i = GenecStar%m-zone\n" + # f" if (zone <= GenecStar%m) then\n" + f" if (.true.) then\n" + f" GenecStar%{name}(i) = {name}\n" + f" set_{name}_at_zone = 0\n" + f" end if\n" + f"end function set_{name}_at_zone\n" + f"\n" + ) + +def star_structure_extra(outfilename): + py_outfile = f"{outfilename}.py" + f_outfile = f"{outfilename}.f90" + for parameter in { + **GENEC_STAR_STRUCTURE_EXTRA, + }.items(): + name = parameter[0] + dtype = parameter[1][0] + unit = parameter[1][1] + description = parameter[1][2] + if len(parameter[1]) > 3: + amuse_name = parameter[1][3] + else: + amuse_name = None + f_dtype = get_f_dtype(dtype) + if unit != '': + dtype = f"'{dtype}' | units.{unit}" + else: + dtype = f"'{dtype}'" + with open(py_outfile, "a") as py_out: + py_out.write( + f" @remote_function(can_handle_array=True)\n" + f" def get_{name}_at_zone(\n" + f" index_of_the_particle='i', zone='i',\n" + f" element='i',\n" + f" ):\n" + f" returns ({name}={dtype})\n" + f"\n" + f" @remote_function(can_handle_array=True)\n" + f" def set_{name}_at_zone(\n" + f" index_of_the_particle='i', zone='i',\n" + f" element='i',\n" + f" {name}={dtype}):\n" + f" returns ()\n" + f"\n" + ) + with open(f_outfile, "a") as f_out: + f_out.write( + f"integer function get_{name}_at_zone(index_of_the_particle, zone, element, {name})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" integer, intent(in):: zone\n" + f" integer, intent(in):: element\n" + f" real(kindreal), intent(out):: {name}\n" + f" integer:: i\n" + f" get_{name}_at_zone = -1\n" + f" i = GenecStar%m-zone\n" + f" if (zone <= GenecStar%m) then\n" + f" {name} = GenecStar%{name}(element,i)\n" + f" get_{name}_at_zone = 0\n" + f" end if\n" + f"end function get_{name}_at_zone\n" + f"\n" + f"integer function set_{name}_at_zone(index_of_the_particle, zone, element, {name})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" integer, intent(in):: zone\n" + f" integer, intent(in):: element\n" + f" {f_dtype}, intent(in):: {name}\n" + f" integer:: i\n" + f" set_{name}_at_zone = -1\n" + f" i = GenecStar%m-zone\n" + # f" if (zone <= GenecStar%m) then\n" + f" if (.true.) then\n" + f" GenecStar%{name}(element,i) = {name}\n" + f" set_{name}_at_zone = 0\n" + f" end if\n" + f"end function set_{name}_at_zone\n" + f"\n" + ) + +def star_structure_derived(outfilename): + py_outfile = f"{outfilename}.py" + f_outfile = f"{outfilename}.f90" + for parameter in { + **GENEC_STAR_STRUCTURE_DERIVED, + }.items(): + name = parameter[0] + dtype = parameter[1][0] + unit = parameter[1][1] + description = parameter[1][2] + if len(parameter[1]) > 3: + amuse_name = parameter[1][3] else: - print(f"wrong dtype: {dtype}") - sys.exit() - if INPUT[star_property][1] != '': - dtype = f"'{INPUT[star_property][0]}' | units.{INPUT[star_property][1]}" + amuse_name = None + f_dtype = get_f_dtype(dtype) + if unit != '': + dtype = f"'{dtype}' | units.{unit}" else: - dtype = f"'{INPUT[star_property][0]}'" - with open("interface_temp.py", 'a') as py_out: + dtype = f"'{dtype}'" + with open(py_outfile, "a") as py_out: py_out.write( f" @remote_function(can_handle_array=True)\n" - f" def get_{star_property}(index_of_the_particle='i'):\n" - f" returns ({star_property}={dtype})\n" + f" def get_{name}_at_zone(\n" + f" index_of_the_particle='i', zone='i'\n" + f" ):\n" + f" returns ({name}={dtype})\n" + f"\n" + ) + with open(f_outfile, "a") as f_out: + f_out.write( + f"integer function get_{name}_at_zone(index_of_the_particle, zone, {name})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" integer, intent(in):: zone\n" + f" real(kindreal), intent(out):: {name}\n" + f" integer:: i\n" + f" get_{name}_at_zone = -1\n" + f" i = GenecStar%m-zone\n" + # f" if (zone <= GenecStar%m) then\n" + f" if (.true.) then\n" + f" {name} = GenecStar%{name}(i)\n" + f" get_{name}_at_zone = 0\n" + f" end if\n" + f"end function get_{name}_at_zone\n" f"\n" + ) + + +def netdef_scalars(outfilename): + py_outfile = f"{outfilename}.py" + f_outfile = f"{outfilename}.f90" + for parameter in { + **GENEC_NETDEF_SCALARS, + }.items(): + name = parameter[0] + dtype = parameter[1][0] + unit = parameter[1][1] + description = parameter[1][2] + if len(parameter[1]) > 3: + amuse_name = parameter[1][3] + else: + amuse_name = None + f_dtype = get_f_dtype(dtype) + if unit != '': + dtype = f"'{dtype}' | units.{unit}" + else: + dtype = f"'{dtype}'" + with open(py_outfile, "a") as py_out: + py_out.write( f" @remote_function(can_handle_array=True)\n" - f" def set_{star_property}(index_of_the_particle='i', {star_property}={dtype}):\n" + f" def get_{name}(index_of_the_particle='i'):\n" + f" returns ({name}={dtype})\n" + f"\n" + f" @remote_function(can_handle_array=True)\n" + f" def set_{name}(\n" + f" index_of_the_particle='i',\n" + f" {name}={dtype},\n" + f" ):\n" f" returns ()\n" f"\n" ) + with open(f_outfile, "a") as f_out: + f_out.write( + f"integer function get_{name}(index_of_the_particle, {name})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" {f_dtype}, intent(out):: {name}\n" + f" {name} = GenecStar%{name}\n" + f" get_{name} = 0\n" + f"end function get_{name}\n" + f"\n" + f"integer function set_{name}(index_of_the_particle, {name})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" {f_dtype}, intent(in):: {name}\n" + f" GenecStar%{name} = {name}\n" + f" set_{name} = 0\n" + f"end function set_{name}\n" + f"\n" + ) + return + - with open("interface_temp.f90", 'a') as f_out: +def netdef_arrays(outfilename): + py_outfile = f"{outfilename}.py" + f_outfile = f"{outfilename}.f90" + for parameter in { + **GENEC_NETDEF_ARRAYS, + }.items(): + name = parameter[0] + dtype = parameter[1][0] + unit = parameter[1][1] + description = parameter[1][2] + if len(parameter[1]) > 3: + amuse_name = parameter[1][3] + else: + amuse_name = None + f_dtype = get_f_dtype(dtype) + if unit != '': + dtype = f"'{dtype}' | units.{unit}" + else: + dtype = f"'{dtype}'" + with open(py_outfile, "a") as py_out: + py_out.write( + f" @remote_function(can_handle_array=True)\n" + f" def get_{name}(\n" + f" index_of_the_particle='i', number='i'\n" + f" ):\n" + f" returns ({name}={dtype})\n" + f"\n" + f" @remote_function(can_handle_array=True)\n" + f" def set_{name}(\n" + f" index_of_the_particle='i', number='i',\n" + f" {name}={dtype}):\n" + f" returns ()\n" + f"\n" + ) + with open(f_outfile, "a") as f_out: + f_out.write( + f"integer function get_{name}(index_of_the_particle, i, {name})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" integer, intent(in):: i\n" + f" {f_dtype}, intent(out):: {name}\n" + f" get_{name} = -1\n" + f" if ((i > 0) .and. (i < 9)) then\n" + f" {name} = GenecStar%{name}(i)\n" + f" get_{name} = 0\n" + f" end if\n" + f"end function get_{name}\n" + f"\n" + f"integer function set_{name}(index_of_the_particle, i, {name})\n" + f" implicit none\n" + f" integer, intent(in):: index_of_the_particle\n" + f" integer, intent(in):: i\n" + f" {f_dtype}, intent(in):: {name}\n" + f" set_{name} = -1\n" + f" if ((i > 0) .and. (i < 9)) then\n" + f" GenecStar%{name}(i) = {name}\n" + f" set_{name} = 0\n" + f" end if\n" + f"end function set_{name}\n" + f"\n" + ) + +def netalu_arrays(outfilename): + py_outfile = f"{outfilename}.py" + f_outfile = f"{outfilename}.f90" + for parameter in { + **GENEC_NETALU_ARRAYS, + }.items(): + name = parameter[0] + dtype = parameter[1][0] + unit = parameter[1][1] + description = parameter[1][2] + if len(parameter[1]) > 3: + amuse_name = parameter[1][3] + else: + amuse_name = None + f_dtype = get_f_dtype(dtype) + if unit != '': + dtype = f"'{dtype}' | units.{unit}" + else: + dtype = f"'{dtype}'" + with open(py_outfile, "a") as py_out: + py_out.write( + f" @remote_function(can_handle_array=True)\n" + f" def get_{name}(\n" + f" index_of_the_particle='i', number='i'\n" + f" ):\n" + f" returns ({name}={dtype})\n" + f"\n" + f" @remote_function(can_handle_array=True)\n" + f" def set_{name}(\n" + f" index_of_the_particle='i', number='i',\n" + f" {name}={dtype}):\n" + f" returns ()\n" + f"\n" + ) + with open(f_outfile, "a") as f_out: f_out.write( - f"integer function get_{star_property}(index_of_the_particle, {star_property})\n" + f"integer function get_{name}(index_of_the_particle, i, {name})\n" f" implicit none\n" f" integer, intent(in):: index_of_the_particle\n" - f" {f_dtype}, intent(out):: {star_property}\n" - f" {star_property} = GenecStar%{star_property}\n" - f" get_{star_property} = 0\n" - f"end function get_{star_property}\n" + f" integer, intent(in):: i\n" + f" real(kindreal), intent(out):: {name}\n" + f" get_{name} = -1\n" + f" if ((i > 0) .and. (i < 6)) then\n" + f" {name} = GenecStar%{name}(i)\n" + f" get_{name} = 0\n" + f" end if\n" + f"end function get_{name}\n" f"\n" - f"integer function set_{star_property}(index_of_the_particle, {star_property})\n" + f"integer function set_{name}(index_of_the_particle, i, {name})\n" f" implicit none\n" f" integer, intent(in):: index_of_the_particle\n" - f" {f_dtype}, intent(in):: {star_property}\n" - f" GenecStar%{star_property} = {star_property}\n" - f" set_{star_property} = 0\n" - f"end function set_{star_property}\n" + f" integer, intent(in):: i\n" + f" {f_dtype}, intent(in):: {name}\n" + f" set_{name} = -1\n" + f" if ((i > 0) .and. (i < 6)) then\n" + f" GenecStar%{name}(i) = {name}\n" + f" set_{name} = 0\n" + f" end if\n" + f"end function set_{name}\n" f"\n" ) +def f_new_stellar_model(outfilename): + f_outfile = f"{outfilename}.f90" + with open(f_outfile, "a") as f_out: + f_out.write( + "function new_stellar_model(&\n" + " index_of_the_star,&\n" + ) + line_length = line_length_start = 6 + first = True + max_linelength = 100 - 2 # 2 for ",&" buffer + for parameter in {**SCALAR_SETTERS, **GENEC_STAR_STRUCTURE}.items(): + name = parameter[0] + f_dtype = get_f_dtype(parameter[1][0]) + if line_length + 1 + len(name) <= max_linelength: + if first: + name = f" {name}" + first = False + else: + name = f",{name}" + line_length += len(name) + f_out.write(f"{name}") + else: + line_length = line_length_start + len(name) + f_out.write( + f",&\n" + f" {name}" + ) + f_out.write( + "&\n" + " )\n" + " implicit none\n" + " integer:: index_of_the_star\n" + ) + line_length = line_length_start = 13 + previous_f_dtype = None + for parameter in {**SCALAR_SETTERS, **GENEC_STAR_STRUCTURE}.items(): + name = parameter[0] + f_dtype = get_f_dtype(parameter[1][0]) + if f_dtype != previous_f_dtype: + f_out.write( + f"\n" + f" {f_dtype}, intent(in):: &\n" + ) + line_length += len(name) + name = line_length_start * " " + name + previous_f_dtype = f_dtype + f_out.write(f"{name}") + else: + if line_length + 1 + len(name) <= max_linelength: + name = f",{name}" + line_length += len(name) + f_out.write(f"{name}") + else: + name = line_length_start * " " + name + line_length = len(name) + f_out.write( + f",&\n" + f"{name}" + ) + f_out.write( + "\n" + " integer:: new_stellar_model\n" + "\n" + ) + for parameter in SCALAR_SETTERS.items(): + name = parameter[0] + f_dtype = get_f_dtype(parameter[1][0]) + if f_dtype == "logical": + f_out.write( + #f" if (GenecStar%{name} .neqv. {name}) then\n" + #f' write(*,*) "{name}:", GenecStar%{name}, {name}\n' + #f" endif\n" + f" GenecStar%{name} = {name}\n" + ) + else: + f_out.write( + #f" if (GenecStar%{name} /= {name}) then\n" + #f' write(*,*) "{name}:", GenecStar%{name}, {name}\n' + #f" endif\n" + f" GenecStar%{name} = {name}\n" + ) + for parameter in GENEC_STAR_STRUCTURE.items(): + name = parameter[0] + f_out.write( + f" GenecStar%{name} = 0.d0\n" + f" GenecStar%{name} = {name}\n" + ) + f_out.write( + "\n" + " new_stellar_model = 0\n" + "end function new_stellar_model\n" + "\n" + ) + + +def py_new_stellar_model(outfilename): + py_outfile = f"{outfilename}.py" + with open(py_outfile, "a") as py_out: + py_out.write( + " def new_particle_from_model(\n" + " self, internal_structure, current_age=0 | units.julianyr, key=None\n" + " ):\n" + " self.new_stellar_model(\n" + ) + for parameter in ALL_SETTERS.items(): + name = parameter[0] + py_out.write( + f" internal_structure['{name}'],\n" + ) + py_out.write( + " )\n" + " return\n" + ) + + +def py_header(outfilename): + py_outfile = f"{outfilename}.py" + with open(py_outfile, "a") as py_out: + py_out.write( + PY_INTERFACE_HEADER + ) + return + + +def get_f_dtype(dtype): + if dtype in ["i", "int32"]: + f_dtype = "integer" + elif dtype in ["d", "float64"]: + f_dtype = "real(kindreal)" + elif dtype in ["b", "bool"]: + f_dtype = "logical" + elif dtype in ["s", "string"]: + f_dtype = "character(256)" + else: + print(f"wrong dype: {dtype}") + sys.exit() + return f_dtype + +def main(): + outfilename = "new_interface" + # py_header(outfilename) + # star_parameters(outfilename) + # star_structure(outfilename) + # star_structure_extra(outfilename) + # star_structure_derived(outfilename) + # netdef_scalars(outfilename) + netdef_arrays(outfilename) + netalu_arrays(outfilename) + # py_new_stellar_model(outfilename) + # f_new_stellar_model(outfilename) + if __name__ == "__main__": + # for i in ALL_SETTERS.items(): + # i = i[0] + # print(f" {i} = Star%{i}") main() From 231a0ec9c4d79c992d0bf97a089745a3ddf64333 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 15 Feb 2023 13:38:58 +0100 Subject: [PATCH 53/72] rename file --- src/amuse/community/genec/interface.f90 | 16 +++++++--------- .../{make_getsetters.py => make_interface.py} | 0 2 files changed, 7 insertions(+), 9 deletions(-) rename src/amuse/community/genec/{make_getsetters.py => make_interface.py} (100%) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 46e4ab8b66..96a405bec5 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -4,7 +4,7 @@ module AmuseInterface GenecStar,genec_star use helpers, only:& copy_to_genec_star,copy_namelists_from_genec_star,copy_from_genec_star,& - copy_structure_from_genec_star + copy_structure_from_genec_star,copy_initial_structure_from_genec_star use evol, only: kindreal,ldi,npondcouche type(genec_star) :: BackupBackupGenecStar @@ -165,17 +165,15 @@ function evolve_for(index_of_the_star, time) end function function evolve_one_step(index_of_the_star) - use timestep, only: alter - use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise, veryFirst - use inputparam,only: modanf,nwseq,nzmod,end_at_phase,end_at_model + use genec, only: evolve, finalise, veryFirst + use inputparam, only: nzmod use genec, only: n_snap implicit none integer:: index_of_the_star integer:: evolve_one_step - integer:: original_nzmod - nzmod = 1 - n_snap = 0 + !integer:: original_nzmod + !nzmod = 1 + !n_snap = 0 call evolve() call finalise() @@ -5711,7 +5709,7 @@ function new_stellar_model(& GenecStar%abelx(:,:) = 0. GenecStar%vabelx(:,:) = 0. - call copy_from_genec_star(GenecStar) + call init_or_restore_star(GenecStar) new_stellar_model = 0 end function new_stellar_model diff --git a/src/amuse/community/genec/make_getsetters.py b/src/amuse/community/genec/make_interface.py similarity index 100% rename from src/amuse/community/genec/make_getsetters.py rename to src/amuse/community/genec/make_interface.py From 167baf31c8ebba9952b1a5a8e05ec946c2bd7144 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 30 May 2023 11:33:47 +0200 Subject: [PATCH 54/72] updates --- src/amuse/community/genec/interface.f90 | 1066 ++++++++++++++++++----- src/amuse/community/genec/interface.py | 771 +++++++++++++--- 2 files changed, 1486 insertions(+), 351 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 96a405bec5..045310f705 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -4,7 +4,7 @@ module AmuseInterface GenecStar,genec_star use helpers, only:& copy_to_genec_star,copy_namelists_from_genec_star,copy_from_genec_star,& - copy_structure_from_genec_star,copy_initial_structure_from_genec_star + copy_structure_from_genec_star,copy2_from_genec_star use evol, only: kindreal,ldi,npondcouche type(genec_star) :: BackupBackupGenecStar @@ -14,6 +14,240 @@ module AmuseInterface public:: BackupGenecStar,number_of_stars contains +subroutine init_or_restore_star(Star) + ! This function replaces read_parameters and initialise_star in genec.f90 + use genec + implicit none + type(genec_star), intent(in) :: Star + + call copy_namelists_from_genec_star(Star) + + if (idebug > 0) then + verbose = .true. + endif + + if (idebug > 1) then + write(*,*) 'initialisations...' + endif + + tzero=999999999.d0 + + idern=0 + id1=0 + id2=5 + dm_lost=0.d0 + + agdp = agdr ! ) + agds = agdr ! ) bounds on the corrections in henyey + agdt = agdr ! ) + + if (.not. Star%initialised) then + dgrp = dgrp*um ! maximum allowed variation in Ln P + dgrl = dgrl*um ! maximum allowed variation in Ln S + endif + + !if (nwseq == 1) then + ! restart = 0 + !else + ! restart = nwseq + !endif + + !if (modanf == 0) then + ! if (idebug > 1) then + ! write(*,*) 'initial values check and corrections' + ! endif + ! if (faktor /= 1.d0) then + ! faktor = 1.d0 + ! write(*,*) 'First model: faktor set to 1' + ! endif + ! if (phase /= 1) then + ! phase = 1 + ! write(*,*) 'First model: phase set to 1' + ! endif + ! if (irot == 1 .and. isol /= 1) then + ! isol = 1 + ! write(*,*) 'First model: isol set to 1' + ! endif + !endif + + if (idebug > 1) then + write(*,*) 'restoring network' + endif + call restore_network(z) + + if (ialflu == 1) then + xnetalu = Star%xnetalu + zabelx = zabelx-xnetalu(1)-xnetalu(2)-xnetalu(3)-xnetalu(4) + endif + + !if (isugi >= 1 .and. nwseq == 1) then + ! nsugi=mmax + !endif + + !inum = 0 + !if (nzmod > 1) then + ! modell = mod(nwseq,nzmod) + !else + ! modell = 1 + !endif + !nzmodini = nzmod + !if (.not. libgenec) then + !write(*,*) "\n\n\n\n ******FFFFFFFFF", veryFirst, "\n\n", nwmd, nwseq, "\n\n\n" + if (nwmd == 0) then + nwmd = nwseq + endif + !nwseqini = nwseq + + ! Initial model + if (modanf == 0) then +! security if initial file is missing the iprezams parameter + if (vwant>epsilon(vwant) .and. iprezams==0) then + write(*,*) 'VWANT/=0 --> IPREZAMS set to 1' + iprezams=1 + endif + if (idebug > 1) then + write(*,*) 'Reading of initial structure' + endif + call copy_structure_from_genec_star(Star) + !read(*,nml=IniStruc) + xmini=summas + zams_radius = 0.d0 + if (bintide) then + period = periodini*day + endif + if (irot == 1 .and. isol>=1 .and. omega /= omegi(1)) then + omegi(:) = omega + endif + if (alter == 0.d0) then + firstmods = .true. + else + firstmods = .false. + endif + + if (fitm /= exphi(q(1))) then + q(1) = log10(1.d0 - fitm) + endif + + if (ialflu == 1) then + xf19(:)=xnetalu(1) + xne21(:)=xnetalu(2) + xna23(:)=xnetalu(3) + xal26(:)=0.d0 + xal27(:)=xnetalu(4) + xsi28(:)=xnetalu(5) + xneut(:)=0.d0 + xprot(:)=0.d0 + xc14(:)=0.d0 + xf18(:)=0.d0 + xbid1(:)=0.d0 + + xsi28(:)=0.d0 + bibib = & + 1.d0-x(1)-y(1)-y3(1)-xc12(1)-xc13(1)-xn14(1)-xn15(1)-xo16(1)-xo17(1)-xo18(1)-xne22(1)& + -xmg24(1)-xmg25(1)-xmg26(1)-xne20(1)-xf19(1)-xne21(1)-xal27(1)-xsi28(1)-xna23(1) + + do ii=1,nbelx + bibib=bibib-abels(ii) + enddo + + xbid(1:m)=bibib + else + xf19(:)=0.d0 + xne21(:)=0.d0 + xna23(:)=0.d0 + xal26(:)=0.d0 + xal27(:)=0.d0 + xsi28(:)=0.d0 + xneut(:)=0.d0 + xprot(:)=0.d0 + xc14(:)=0.d0 + xf18(:)=0.d0 + xbid1(:)=0.d0 + endif + +! for each shell give same value + zabelx=z + do ii=1,nbelx + abelx(ii,:)=abels(ii) + zabelx=zabelx-abels(ii) + enddo + if (ialflu == 1) then + zabelx=zabelx-xf19(1)-xne21(1)-xna23(1)-xal27(1) + endif + write(*,*) 'z,zabelx,m',z,zabelx,m + + if (isugi >= 1) then + nsugi = m + endif + + NPcoucheEff = npondcouche + + !call write4 + + ab=ab*um + q(:)=q(:)*um + p(:)=p(:)*um + t(:)=t(:)*um + r(:)=r(:)*um + s(:)=s(:)*um + vp(:)=vp(:)*um + vt(:)=vt(:)*um + vr(:)=vr(:)*um + vs(:)=vs(:)*um + veryFirst = .true. + + else ! modanf > 0 + + call copy_structure_from_genec_star(Star) + !write(*,*) 's1/vs1 (helpers): ', s(1), vs(1) + + !vvsuminenv = vsuminenv + + ! if (phase > 1 .and. CorrOmega(npondcouche) < -100.d0) then + ! NPcoucheEff = npondcoucheAdv + ! else + ! NPcoucheEff = npondcouche + ! endif + + ! if (irot /= 0) then + ! if (idebug > 1) then + ! write(*,*) 'call momevo' + ! endif + ! call momevo(r,vomegi,xltod,CorrOmega,.true.) + ! endif + + ! if (x(1) > 7.d-1) then + ! xini = x(1) + ! if (x(m) > (xini - 5.d-3)) then + ! firstmods = .true. + ! else + ! firstmods = .false. + ! endif + ! else + ! firstmods = .false. + ! endif + + ! if (irot==1 .and. isol>=1 .and. abs(vwant)>1.0d-5) then + ! omegi(1:m)=sqrt(xfom)*omegi(1:m) + ! endif + + !call write4 + + !write(*,*) 'call fitmshift' + !call fitmshift + + endif ! modanf + + ! ftfp initialisation + !call initgeo + + if (ialflu==0 .and. xmini<=9.d0) then + ichem = 1 + endif + +end subroutine init_or_restore_star + + integer function restore_star() implicit none restore_star = 0 @@ -87,37 +321,86 @@ function commit_parameters() commit_parameters = 0 end function +subroutine restore_network(z) +!---------------------------------------------------------------------- + use evol, only: input_dir + use inputparam,only: idebug,libgenec + use abundmod,only: mbelx,abels,xlostneu,nbzel,nbael + use storage, only: GenecStar + + implicit none + + integer:: i,ii,ierror + integer:: nbelx ! FIXME: store this somewhere? + real(kindreal),intent(in):: z + real(kindreal):: zabelx ! FIXME: store? + character (256):: namenet,namereac +!---------------------------------------------------------------------- +! Reading network information (elements, ...) +! first add elements to the program + ierror = 0 + i = 1 + xlostneu = GenecStar%xlostneu + nbzel = GenecStar%nbzel + nbael = GenecStar%nbael + abels = GenecStar%abels + do while (i <= size(abels)) + if (GenecStar%verbose) then + write(*,*) nbzel(i), nbael(i), abels(i) + endif + i = i+1 + enddo + + nbelx = i-1 + + zabelx = z + do ii = 1, nbelx + zabelx = zabelx - abels(ii) + enddo + + if (nbelx > mbelx) then + write(*,*) 'nbelx= ',nbelx,' > mbelx= ',mbelx + stop 'stop in restore_network' + endif + + if (.false.) then ! skip this for now - fixme later --SR +! then decide which element are followed in netnewr.f + if (GenecStar%phase < 4) then + namenet=trim(input_dir)//'inputs/netinit.inCNE' + namereac=trim(input_dir)//'inputs/vit.datCNE' + else + namenet=trim(input_dir)//'inputs/netinit.inCNEO' + namereac=trim(input_dir)//'inputs/vit.datCNEO' + endif + + if (idebug > 0) then + write(*,*) 'call readnetZA' + endif + call readnetZA + if (idebug > 0) then + write(*,*) 'call readreac' + endif + call readreac + endif ! .false. + + return + +end subroutine restore_network + function commit_particles() use makeini, only: make_initial_star use genec, only: initialise_star implicit none integer:: commit_particles ! makeini will actually override some things from set_defaults now! FIXME + if (.not.GenecStar%initialised) then - write(*,*) 'i:', GenecStar%nbzel call make_initial_star() - write(*,*) 'm_i_s:', GenecStar%nbzel call copy_from_genec_star(GenecStar) - write(*,*) 'c_f_g_s:', GenecStar%nbzel - call initialise_star() GenecStar%initialised = .true. - write(*,*) 'i_s:', GenecStar%nbzel - call copy_to_genec_star(GenecStar) - else - ! "read" GENEC star namelists - write(*,*) "call copy_namelists_from_genec_star(GenecStar)" - call copy_namelists_from_genec_star(GenecStar) - ! Initialise values not in GENEC star - ! but this also resets some values that are read, so... - write(*,*) 'call initialise_star()' - call initialise_star() - ! "read" the GENEC star structure - write(*,*) 'call copy_structure_from_genec_star(GenecStar)' - call copy_structure_from_genec_star(GenecStar) - ! and then copy back - some things may have changed? - write(*,*) 'call copy_to_genec_star(GenecStar)' call copy_to_genec_star(GenecStar) endif + call init_or_restore_star(GenecStar) write(*,*) "COMMIT PARTICLES DONE" commit_particles = 0 end function @@ -165,16 +448,21 @@ function evolve_for(index_of_the_star, time) end function function evolve_one_step(index_of_the_star) - use genec, only: evolve, finalise, veryFirst - use inputparam, only: nzmod + use timestep, only: alter + use WriteSaveClose, only: OpenAll + use genec, only: evolve, modell, finalise, veryFirst + use inputparam,only: modanf,nwseq,nzmod,end_at_phase,end_at_model use genec, only: n_snap + use genec, only: m + use abundmod, only: x implicit none integer:: index_of_the_star integer:: evolve_one_step - !integer:: original_nzmod - !nzmod = 1 - !n_snap = 0 + integer:: original_nzmod + nzmod = 1 + modell = 1 + n_snap = 0 call evolve() call finalise() veryFirst = .false. @@ -1151,6 +1439,22 @@ function set_temperature_at_zone(index_of_the_star, zone, T_i) !!!!!!!!! +integer function get_modell(index_of_the_particle, modell) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: modell + modell = GenecStar%modell + get_modell = 0 +end function get_modell + +integer function set_modell(index_of_the_particle, modell) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: modell + GenecStar%modell = modell + set_modell = 0 +end function set_modell + integer function get_veryFirst(index_of_the_particle, veryFirst) implicit none integer, intent(in):: index_of_the_particle @@ -2079,6 +2383,22 @@ integer function set_fitmi(index_of_the_particle, fitmi) set_fitmi = 0 end function set_fitmi +integer function get_fitmi_default(index_of_the_particle, fitmi_default) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: fitmi_default + fitmi_default = GenecStar%fitmi_default + get_fitmi_default = 0 +end function get_fitmi_default + +integer function set_fitmi_default(index_of_the_particle, fitmi_default) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: fitmi_default + GenecStar%fitmi_default = fitmi_default + set_fitmi_default = 0 +end function set_fitmi_default + integer function get_deltal(index_of_the_particle, deltal) implicit none integer, intent(in):: index_of_the_particle @@ -2751,22 +3071,6 @@ integer function set_n_snap(index_of_the_particle, n_snap) set_n_snap = 0 end function set_n_snap -integer function get_m(index_of_the_particle, m) - implicit none - integer, intent(in):: index_of_the_particle - integer, intent(out):: m - m = GenecStar%m - get_m = 0 -end function get_m - -integer function set_m(index_of_the_particle, m) - implicit none - integer, intent(in):: index_of_the_particle - integer, intent(in):: m - GenecStar%m = m - set_m = 0 -end function set_m - integer function get_gms(index_of_the_particle, gms) implicit none integer, intent(in):: index_of_the_particle @@ -2927,22 +3231,6 @@ integer function set_xmini(index_of_the_particle, xmini) set_xmini = 0 end function set_xmini -integer function get_summas(index_of_the_particle, summas) - implicit none - integer, intent(in):: index_of_the_particle - real(kindreal), intent(out):: summas - summas = GenecStar%summas - get_summas = 0 -end function get_summas - -integer function set_summas(index_of_the_particle, summas) - implicit none - integer, intent(in):: index_of_the_particle - real(kindreal), intent(in):: summas - GenecStar%summas = summas - set_summas = 0 -end function set_summas - integer function get_ab(index_of_the_particle, ab) implicit none integer, intent(in):: index_of_the_particle @@ -2975,6 +3263,278 @@ integer function set_dm_lost(index_of_the_particle, dm_lost) set_dm_lost = 0 end function set_dm_lost +integer function get_m(index_of_the_particle, m) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(out):: m + m = GenecStar%m + get_m = 0 +end function get_m + +integer function set_m(index_of_the_particle, m) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: m + GenecStar%m = m + set_m = 0 +end function set_m + +integer function get_summas(index_of_the_particle, summas) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: summas + summas = GenecStar%summas + get_summas = 0 +end function get_summas + +integer function set_summas(index_of_the_particle, summas) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: summas + GenecStar%summas = summas + set_summas = 0 +end function set_summas + +integer function get_dk(index_of_the_particle, dk) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dk + dk = GenecStar%dk + get_dk = 0 +end function get_dk + +integer function set_dk(index_of_the_particle, dk) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dk + GenecStar%dk = dk + set_dk = 0 +end function set_dk + +integer function get_rlp(index_of_the_particle, rlp) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: rlp + rlp = GenecStar%rlp + get_rlp = 0 +end function get_rlp + +integer function set_rlp(index_of_the_particle, rlp) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: rlp + GenecStar%rlp = rlp + set_rlp = 0 +end function set_rlp + +integer function get_rlt(index_of_the_particle, rlt) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: rlt + rlt = GenecStar%rlt + get_rlt = 0 +end function get_rlt + +integer function set_rlt(index_of_the_particle, rlt) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: rlt + GenecStar%rlt = rlt + set_rlt = 0 +end function set_rlt + +integer function get_rlc(index_of_the_particle, rlc) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: rlc + rlc = GenecStar%rlc + get_rlc = 0 +end function get_rlc + +integer function set_rlc(index_of_the_particle, rlc) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: rlc + GenecStar%rlc = rlc + set_rlc = 0 +end function set_rlc + +integer function get_rrp(index_of_the_particle, rrp) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: rrp + rrp = GenecStar%rrp + get_rrp = 0 +end function get_rrp + +integer function set_rrp(index_of_the_particle, rrp) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: rrp + GenecStar%rrp = rrp + set_rrp = 0 +end function set_rrp + +integer function get_rrt(index_of_the_particle, rrt) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: rrt + rrt = GenecStar%rrt + get_rrt = 0 +end function get_rrt + +integer function set_rrt(index_of_the_particle, rrt) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: rrt + GenecStar%rrt = rrt + set_rrt = 0 +end function set_rrt + +integer function get_rrc(index_of_the_particle, rrc) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: rrc + rrc = GenecStar%rrc + get_rrc = 0 +end function get_rrc + +integer function set_rrc(index_of_the_particle, rrc) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: rrc + GenecStar%rrc = rrc + set_rrc = 0 +end function set_rrc + +integer function get_rtp(index_of_the_particle, rtp) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: rtp + rtp = GenecStar%rtp + get_rtp = 0 +end function get_rtp + +integer function set_rtp(index_of_the_particle, rtp) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: rtp + GenecStar%rtp = rtp + set_rtp = 0 +end function set_rtp + +integer function get_rtt(index_of_the_particle, rtt) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: rtt + rtt = GenecStar%rtt + get_rtt = 0 +end function get_rtt + +integer function set_rtt(index_of_the_particle, rtt) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: rtt + GenecStar%rtt = rtt + set_rtt = 0 +end function set_rtt + +integer function get_rtc(index_of_the_particle, rtc) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: rtc + rtc = GenecStar%rtc + get_rtc = 0 +end function get_rtc + +integer function set_rtc(index_of_the_particle, rtc) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: rtc + GenecStar%rtc = rtc + set_rtc = 0 +end function set_rtc + +integer function get_tdiff(index_of_the_particle, tdiff) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: tdiff + tdiff = GenecStar%tdiff + get_tdiff = 0 +end function get_tdiff + +integer function set_tdiff(index_of_the_particle, tdiff) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: tdiff + GenecStar%tdiff = tdiff + set_tdiff = 0 +end function set_tdiff + +integer function get_suminenv(index_of_the_particle, suminenv) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: suminenv + suminenv = GenecStar%suminenv + get_suminenv = 0 +end function get_suminenv + +integer function set_suminenv(index_of_the_particle, suminenv) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: suminenv + GenecStar%suminenv = suminenv + set_suminenv = 0 +end function set_suminenv + +integer function get_xltotbeg(index_of_the_particle, xltotbeg) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xltotbeg + xltotbeg = GenecStar%xltotbeg + get_xltotbeg = 0 +end function get_xltotbeg + +integer function set_xltotbeg(index_of_the_particle, xltotbeg) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xltotbeg + GenecStar%xltotbeg = xltotbeg + set_xltotbeg = 0 +end function set_xltotbeg + +integer function get_dlelexprev(index_of_the_particle, dlelexprev) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: dlelexprev + dlelexprev = GenecStar%dlelexprev + get_dlelexprev = 0 +end function get_dlelexprev + +integer function set_dlelexprev(index_of_the_particle, dlelexprev) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: dlelexprev + GenecStar%dlelexprev = dlelexprev + set_dlelexprev = 0 +end function set_dlelexprev + +integer function get_zams_radius(index_of_the_particle, zams_radius) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: zams_radius + zams_radius = GenecStar%zams_radius + get_zams_radius = 0 +end function get_zams_radius + +integer function set_zams_radius(index_of_the_particle, zams_radius) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: zams_radius + GenecStar%zams_radius = zams_radius + set_zams_radius = 0 +end function set_zams_radius + integer function get_mbelx(index_of_the_particle, mbelx) implicit none integer, intent(in):: index_of_the_particle @@ -3167,6 +3727,22 @@ integer function set_vnr(index_of_the_particle, vnr) set_vnr = 0 end function set_vnr +integer function get_xlostneu(index_of_the_particle, xlostneu) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(out):: xlostneu + xlostneu = GenecStar%xlostneu + get_xlostneu = 0 +end function get_xlostneu + +integer function set_xlostneu(index_of_the_particle, xlostneu) + implicit none + integer, intent(in):: index_of_the_particle + real(kindreal), intent(in):: xlostneu + GenecStar%xlostneu = xlostneu + set_xlostneu = 0 +end function set_xlostneu + integer function get_q_at_zone(index_of_the_particle, zone, q) implicit none integer, intent(in):: index_of_the_particle @@ -5047,6 +5623,96 @@ integer function set_vabelx_at_zone(index_of_the_particle, zone, element, vabelx end if end function set_vabelx_at_zone +integer function get_drl(index_of_the_particle, number, drl) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: number + real(kindreal), intent(out):: drl + drl = GenecStar%drl(number) + get_drl = 0 +end function get_drl + +integer function set_drl(index_of_the_particle, number, drl) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: number + real(kindreal), intent(in):: drl + GenecStar%drl(number) = drl + set_drl = 0 +end function set_drl + +integer function get_drte(index_of_the_particle, number, drte) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: number + real(kindreal), intent(out):: drte + drte = GenecStar%drte(number) + get_drte = 0 +end function get_drte + +integer function set_drte(index_of_the_particle, number, drte) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: number + real(kindreal), intent(in):: drte + GenecStar%drte(number) = drte + set_drte = 0 +end function set_drte + +integer function get_drp(index_of_the_particle, number, drp) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: number + real(kindreal), intent(out):: drp + drp = GenecStar%drp(number) + get_drp = 0 +end function get_drp + +integer function set_drp(index_of_the_particle, number, drp) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: number + real(kindreal), intent(in):: drp + GenecStar%drp(number) = drp + set_drp = 0 +end function set_drp + +integer function get_drt(index_of_the_particle, number, drt) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: number + real(kindreal), intent(out):: drt + drt = GenecStar%drt(number) + get_drt = 0 +end function get_drt + +integer function set_drt(index_of_the_particle, number, drt) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: number + real(kindreal), intent(in):: drt + GenecStar%drt(number) = drt + set_drt = 0 +end function set_drt + +integer function get_drr(index_of_the_particle, number, drr) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: number + real(kindreal), intent(out):: drr + drr = GenecStar%drr(number) + get_drr = 0 +end function get_drr + +integer function set_drr(index_of_the_particle, number, drr) + implicit none + integer, intent(in):: index_of_the_particle + integer, intent(in):: number + real(kindreal), intent(in):: drr + GenecStar%drr(number) = drr + set_drr = 0 +end function set_drr + integer function get_eps_at_zone(index_of_the_particle, zone, eps) implicit none integer, intent(in):: index_of_the_particle @@ -5201,22 +5867,6 @@ integer function get_nabla_mu_at_zone(index_of_the_particle, zone, nabla_mu) end if end function get_nabla_mu_at_zone -integer function get_xlostneu(index_of_the_particle, xlostneu) - implicit none - integer, intent(in):: index_of_the_particle - real(kindreal), intent(out):: xlostneu - xlostneu = GenecStar%xlostneu - get_xlostneu = 0 -end function get_xlostneu - -integer function set_xlostneu(index_of_the_particle, xlostneu) - implicit none - integer, intent(in):: index_of_the_particle - real(kindreal), intent(in):: xlostneu - GenecStar%xlostneu = xlostneu - set_xlostneu = 0 -end function set_xlostneu - integer function get_nbzel(index_of_the_particle, i, nbzel) implicit none integer, intent(in):: index_of_the_particle @@ -5315,17 +5965,22 @@ end function set_xnetalu function new_stellar_model(& index_of_the_star,& - initialised,veryFirst,starname,nwmd,nwseq,modanf,nzmod,end_at_phase,end_at_model,& - irot,isol,imagn,& - ialflu,ianiso,ipop3,ibasnet,phase,var_rates,bintide,binm2,periodini,const_per,iprezams,zinit,& - zsol,z,iopac,ikappa,idiff,iadvec,istati,icoeff,fenerg,richac,igamma,frein,K_Kawaler,& + modell,veryFirst,& + initialised,starname,nwmd,nwseq,modanf,nzmod,end_at_phase,end_at_model,& + irot,isol,imagn,ialflu,ianiso,ipop3,ibasnet,phase,var_rates,bintide,binm2,periodini,const_per,iprezams,& + zinit,zsol,z,iopac,ikappa,& + idiff,iadvec,istati,icoeff,fenerg,richac,igamma,frein,K_Kawaler,& Omega_saturation,rapcrilim,vwant,xfom,omega,xdial,idialo,idialu,Add_Flux,diff_only,B_initial,& - add_diff,n_mag,alpha_F,nsmooth,qminsmooth,imloss,fmlos,ifitm,fitm,fitmi,deltal,deltat,nndr,& - RSG_Mdot,SupraEddMdot,Be_mdotfrac,start_mdot,iledou,idifcon,iover,elph,my,dovhp,iunder,& - dunder,gkorm,alph,agdr,faktor,dgrp,dgrl,dgry,dgrc,dgro,dgr20,nbchx,nrband,xcn,islow,icncst,& - tauH_fit,display_plot,iauto,iprn,iout,itmin,xyfiles,idebug,itests,verbose,stop_deg,n_snap,m,& - gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,dm_lost,mbelx,xtefflast,& - xllast,xrholast,xclast,xtclast,inum,nsugi,period,r_core,vna,vnr,q,p,t,r,s,x,y3,y,xc12,xc13,& + add_diff,n_mag,alpha_F,nsmooth,qminsmooth,& + imloss,fmlos,ifitm,fitm,fitmi,fitmi_default,deltal,deltat,nndr,RSG_Mdot,SupraEddMdot,Be_mdotfrac,start_mdot,& + iledou,idifcon,iover,elph,my,dovhp,iunder,dunder,& + gkorm,alph,agdr,faktor,dgrp,dgrl,dgry,dgrc,dgro,dgr20,nbchx,nrband,& + xcn,islow,icncst,tauH_fit,& + display_plot,iauto,iprn,iout,itmin,xyfiles,idebug,itests,verbose,stop_deg,n_snap,& + gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,ab,dm_lost,m,summas,& + dk,rlp,rlt,rlc,rrp,rrt,rrc,rtp,rtt,rtc,tdiff,suminenv,xltotbeg,dlelexprev,radius,zams_radius,& ! new! + mbelx,xtefflast,xllast,xrholast,xclast,xtclast,inum,nsugi,period,r_core,vna,vnr,& + q,p,t,r,s,x,y3,y,xc12,xc13,& xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,xc14,& xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,& vxo17,vxo18,vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,& @@ -5336,6 +5991,8 @@ function new_stellar_model(& implicit none integer:: index_of_the_star, n + integer, intent(in):: & + modell logical, intent(in):: & initialised, veryFirst character(256), intent(in):: & @@ -5385,7 +6042,7 @@ function new_stellar_model(& integer, intent(in):: & ifitm real(kindreal), intent(in):: & - fitm,fitmi,deltal,deltat + fitm,fitmi,fitmi_default,deltal,deltat integer, intent(in):: & nndr,& RSG_Mdot @@ -5428,6 +6085,8 @@ function new_stellar_model(& real(kindreal), intent(in):: & gms,& alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,dm_lost + real(kindreal), intent(in):: & ! FIXME + dk,rlp,rlt,rlc,rrp,rrt,rrc,rtp,rtt,rtc,tdiff,suminenv,xltotbeg,dlelexprev,radius,zams_radius integer, intent(in):: & mbelx real(kindreal), intent(in):: & @@ -5450,6 +6109,8 @@ function new_stellar_model(& write(*,*) "*****N: ", n + GenecStar%modell = modell + GenecStar%veryFirst = veryFirst GenecStar%initialised = initialised GenecStar%starname = starname GenecStar%nwmd = nwmd @@ -5458,6 +6119,7 @@ function new_stellar_model(& GenecStar%nzmod = nzmod GenecStar%end_at_phase = end_at_phase GenecStar%end_at_model = end_at_model + !---- GenecStar%irot = irot GenecStar%isol = isol GenecStar%imagn = imagn @@ -5477,6 +6139,7 @@ function new_stellar_model(& GenecStar%z = z GenecStar%iopac = iopac GenecStar%ikappa = ikappa + !---- GenecStar%idiff = idiff GenecStar%iadvec = iadvec GenecStar%istati = istati @@ -5486,6 +6149,7 @@ function new_stellar_model(& GenecStar%igamma = igamma GenecStar%frein = frein GenecStar%K_Kawaler = K_Kawaler + !---- GenecStar%Omega_saturation = Omega_saturation GenecStar%rapcrilim = rapcrilim GenecStar%vwant = vwant @@ -5497,16 +6161,19 @@ function new_stellar_model(& GenecStar%Add_Flux = Add_Flux GenecStar%diff_only = diff_only GenecStar%B_initial = B_initial + !---- GenecStar%add_diff = add_diff GenecStar%n_mag = n_mag GenecStar%alpha_F = alpha_F GenecStar%nsmooth = nsmooth GenecStar%qminsmooth = qminsmooth + !---- GenecStar%imloss = imloss GenecStar%fmlos = fmlos GenecStar%ifitm = ifitm GenecStar%fitm = fitm GenecStar%fitmi = fitmi + GenecStar%fitmi_default = fitmi_default GenecStar%deltal = deltal GenecStar%deltat = deltat GenecStar%nndr = nndr @@ -5514,6 +6181,7 @@ function new_stellar_model(& GenecStar%SupraEddMdot = SupraEddMdot GenecStar%Be_mdotfrac = Be_mdotfrac GenecStar%start_mdot = start_mdot + !---- GenecStar%iledou = iledou GenecStar%idifcon = idifcon GenecStar%iover = iover @@ -5522,6 +6190,7 @@ function new_stellar_model(& GenecStar%dovhp = dovhp GenecStar%iunder = iunder GenecStar%dunder = dunder + !---- GenecStar%gkorm = gkorm GenecStar%alph = alph GenecStar%agdr = agdr @@ -5534,10 +6203,12 @@ function new_stellar_model(& GenecStar%dgr20 = dgr20 GenecStar%nbchx = nbchx GenecStar%nrband = nrband + !---- GenecStar%xcn = xcn GenecStar%islow = islow GenecStar%icncst = icncst GenecStar%tauH_fit = tauH_fit + !---- GenecStar%display_plot = display_plot GenecStar%iauto = iauto GenecStar%iprn = iprn @@ -5549,7 +6220,7 @@ function new_stellar_model(& GenecStar%verbose = verbose GenecStar%stop_deg = stop_deg GenecStar%n_snap = n_snap - GenecStar%m = m + !---- GenecStar%gms = gms GenecStar%alter = alter GenecStar%gls = gls @@ -5560,9 +6231,29 @@ function new_stellar_model(& GenecStar%dzeit = dzeit GenecStar%dzeitv = dzeitv GenecStar%xmini = xmini - GenecStar%summas = summas GenecStar%ab = ab GenecStar%dm_lost = dm_lost + GenecStar%m = m + GenecStar%summas = summas + !---- + GenecStar%dk = dk + GenecStar%rlp = rlp + GenecStar%rlt = rlt + GenecStar%rlc = rlc + GenecStar%rrp = rrp + GenecStar%rrt = rrt + GenecStar%rrc = rrc + GenecStar%rtp = rtp + GenecStar%rtt = rtt + GenecStar%rtc = rtc + GenecStar%tdiff = tdiff + GenecStar%suminenv = suminenv + GenecStar%xltotbeg = xltotbeg + GenecStar%dlelexprev = dlelexprev + GenecStar%radius = log10(radius) + GenecStar%zams_radius = zams_radius + !---- + GenecStar%mbelx = mbelx GenecStar%xtefflast = xtefflast GenecStar%xllast = xllast @@ -5575,141 +6266,78 @@ function new_stellar_model(& GenecStar%r_core = r_core GenecStar%vna = vna GenecStar%vnr = vnr + !---- + GenecStar%q(:m) = q + GenecStar%p(:m) = p + GenecStar%t(:m) = t + GenecStar%r(:m) = r + GenecStar%s(:m) = s + GenecStar%x(:m) = x + GenecStar%y3(:m) = y3 + GenecStar%y(:m) = y + GenecStar%xc12(:m) = xc12 + GenecStar%xc13(:m) = xc13 + GenecStar%xn14(:m) = xn14 + GenecStar%xn15(:m) = xn15 + GenecStar%xo16(:m) = xo16 + GenecStar%xo17(:m) = xo17 + GenecStar%xo18(:m) = xo18 + GenecStar%xne20(:m) = xne20 + GenecStar%xne22(:m) = xne22 + GenecStar%xmg24(:m) = xmg24 + GenecStar%xmg25(:m) = xmg25 + GenecStar%xmg26(:m) = xmg26 + GenecStar%xf19(:m) = xf19 + GenecStar%xne21(:m) = xne21 + GenecStar%xna23(:m) = xna23 + GenecStar%xal27(:m) = xal27 + GenecStar%xsi28(:m) = xsi28 + GenecStar%xc14(:m) = xc14 + GenecStar%xf18(:m) = xf18 + GenecStar%xal26(:m) = xal26 + GenecStar%xneut(:m) = xneut + GenecStar%xprot(:m) = xprot + GenecStar%omegi(:m) = omegi + !---- + GenecStar%xbid(:m) = xbid + GenecStar%xbid1(:m) = xbid1 + GenecStar%vp(:m) = vp + GenecStar%vt(:m) = vt + GenecStar%vr(:m) = vr + GenecStar%vs(:m) = vs + GenecStar%vx(:m) = vx + GenecStar%vy(:m) = vy + GenecStar%vy3(:m) = vy3 + GenecStar%vxc12(:m) = vxc12 + GenecStar%vxc13(:m) = vxc13 + GenecStar%vxn14(:m) = vxn14 + GenecStar%vxn15(:m) = vxn15 + GenecStar%vxo16(:m) = vxo16 + GenecStar%vxo17(:m) = vxo17 + GenecStar%vxo18(:m) = vxo18 + GenecStar%vxne20(:m) = vxne20 + GenecStar%vxne22(:m) = vxne22 + GenecStar%vxmg24(:m) = vxmg24 + GenecStar%vxmg25(:m) = vxmg25 + GenecStar%vxmg26(:m) = vxmg26 + GenecStar%vxf19(:m) = vxf19 + GenecStar%vxne21(:m) = vxne21 + GenecStar%vxna23(:m) = vxna23 + GenecStar%vxal27(:m) = vxal27 + GenecStar%vxsi28(:m) = vxsi28 + GenecStar%vxc14(:m) = vxc14 + GenecStar%vxf18(:m) = vxf18 + GenecStar%vxal26(:m) = vxal26 + GenecStar%vxneut(:m) = vxneut + GenecStar%vxprot(:m) = vxprot + GenecStar%vomegi(:m) = vomegi + GenecStar%vxbid(:m) = vxbid + GenecStar%vxbid1(:m) = vxbid1 GenecStar%xlostneu = xlostneu - GenecStar%q = 0.d0 - GenecStar%q = q - GenecStar%p = 0.d0 - GenecStar%p = p - GenecStar%t = 0.d0 - GenecStar%t = t - GenecStar%r = 0.d0 - GenecStar%r = r - GenecStar%s = 0.d0 - GenecStar%s = s - GenecStar%x = 0.d0 - GenecStar%x = x - GenecStar%y3 = 0.d0 - GenecStar%y3 = y3 - GenecStar%y = 0.d0 - GenecStar%y = y - GenecStar%xc12 = 0.d0 - GenecStar%xc12 = xc12 - GenecStar%xc13 = 0.d0 - GenecStar%xc13 = xc13 - GenecStar%xn14 = 0.d0 - GenecStar%xn14 = xn14 - GenecStar%xn15 = 0.d0 - GenecStar%xn15 = xn15 - GenecStar%xo16 = 0.d0 - GenecStar%xo16 = xo16 - GenecStar%xo17 = 0.d0 - GenecStar%xo17 = xo17 - GenecStar%xo18 = 0.d0 - GenecStar%xo18 = xo18 - GenecStar%xne20 = 0.d0 - GenecStar%xne20 = xne20 - GenecStar%xne22 = 0.d0 - GenecStar%xne22 = xne22 - GenecStar%xmg24 = 0.d0 - GenecStar%xmg24 = xmg24 - GenecStar%xmg25 = 0.d0 - GenecStar%xmg25 = xmg25 - GenecStar%xmg26 = 0.d0 - GenecStar%xmg26 = xmg26 - GenecStar%xf19 = 0.d0 - GenecStar%xf19 = xf19 - GenecStar%xne21 = 0.d0 - GenecStar%xne21 = xne21 - GenecStar%xna23 = 0.d0 - GenecStar%xna23 = xna23 - GenecStar%xal27 = 0.d0 - GenecStar%xal27 = xal27 - GenecStar%xsi28 = 0.d0 - GenecStar%xsi28 = xsi28 - GenecStar%xc14 = 0.d0 - GenecStar%xc14 = xc14 - GenecStar%xf18 = 0.d0 - GenecStar%xf18 = xf18 - GenecStar%xal26 = 0.d0 - GenecStar%xal26 = xal26 - GenecStar%xneut = 0.d0 - GenecStar%xneut = xneut - GenecStar%xprot = 0.d0 - GenecStar%xprot = xprot - GenecStar%omegi = 0.d0 - GenecStar%omegi = omegi - GenecStar%xbid = 0.d0 - GenecStar%xbid = xbid - GenecStar%xbid1 = 0.d0 - GenecStar%xbid1 = xbid1 - GenecStar%vp = 0.d0 - GenecStar%vp = vp - GenecStar%vt = 0.d0 - GenecStar%vt = vt - GenecStar%vr = 0.d0 - GenecStar%vr = vr - GenecStar%vs = 0.d0 - GenecStar%vs = vs - GenecStar%vx = 0.d0 - GenecStar%vx = vx - GenecStar%vy = 0.d0 - GenecStar%vy = vy - GenecStar%vy3 = 0.d0 - GenecStar%vy3 = vy3 - GenecStar%vxc12 = 0.d0 - GenecStar%vxc12 = vxc12 - GenecStar%vxc13 = 0.d0 - GenecStar%vxc13 = vxc13 - GenecStar%vxn14 = 0.d0 - GenecStar%vxn14 = vxn14 - GenecStar%vxn15 = 0.d0 - GenecStar%vxn15 = vxn15 - GenecStar%vxo16 = 0.d0 - GenecStar%vxo16 = vxo16 - GenecStar%vxo17 = 0.d0 - GenecStar%vxo17 = vxo17 - GenecStar%vxo18 = 0.d0 - GenecStar%vxo18 = vxo18 - GenecStar%vxne20 = 0.d0 - GenecStar%vxne20 = vxne20 - GenecStar%vxne22 = 0.d0 - GenecStar%vxne22 = vxne22 - GenecStar%vxmg24 = 0.d0 - GenecStar%vxmg24 = vxmg24 - GenecStar%vxmg25 = 0.d0 - GenecStar%vxmg25 = vxmg25 - GenecStar%vxmg26 = 0.d0 - GenecStar%vxmg26 = vxmg26 - GenecStar%vxf19 = 0.d0 - GenecStar%vxf19 = vxf19 - GenecStar%vxne21 = 0.d0 - GenecStar%vxne21 = vxne21 - GenecStar%vxna23 = 0.d0 - GenecStar%vxna23 = vxna23 - GenecStar%vxal27 = 0.d0 - GenecStar%vxal27 = vxal27 - GenecStar%vxsi28 = 0.d0 - GenecStar%vxsi28 = vxsi28 - GenecStar%vxc14 = 0.d0 - GenecStar%vxc14 = vxc14 - GenecStar%vxf18 = 0.d0 - GenecStar%vxf18 = vxf18 - GenecStar%vxal26 = 0.d0 - GenecStar%vxal26 = vxal26 - GenecStar%vxneut = 0.d0 - GenecStar%vxneut = vxneut - GenecStar%vxprot = 0.d0 - GenecStar%vxprot = vxprot - GenecStar%vomegi = 0.d0 - GenecStar%vomegi = vomegi - GenecStar%vxbid = 0.d0 - GenecStar%vxbid = vxbid - GenecStar%vxbid1 = 0.d0 - GenecStar%vxbid1 = vxbid1 - GenecStar%abelx(:,:) = 0. - GenecStar%vabelx(:,:) = 0. + !GenecStar%abelx(:,:) = 0. + !GenecStar%vabelx(:,:) = 0. - call init_or_restore_star(GenecStar) + !call copy_from_genec_star(GenecStar) new_stellar_model = 0 end function new_stellar_model diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index f214208c40..7a044f1108 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -50,14 +50,20 @@ 'bid1': 27, } +GENEC_AMUSE_SPECIFIC = { + 'modell': ['int32', '', ''], + 'veryFirst': ['bool', '', ''], +} + # Parameters (but individual to each star) GENEC_STAR_CHARACTERISTICS = { # 'GENEC name': [dtype, unit, description, AMUSE name (optional)] 'initialised': ['bool', '', "True if the star is an intialised model"], - 'veryFirst': ['bool', '', 'very first model?'], 'starname': ['string', '', "Name of the star"], - 'nwmd': ['int32', '', 'model number'], - 'nwseq': ['int32', '', "number of the first model in the time-step series"], + 'nwmd': ['int32', '', "model number"], + 'nwseq': [ + 'int32', '', "number of the first model in the time-step series" + ], 'modanf': ['int32', '', ".b file number"], 'nzmod': ['int32', '', "number of models in a run"], 'end_at_phase': ['int32', '', "Stop if this phase is reached"], @@ -73,7 +79,10 @@ 'ipop3': ['int32', '', "Z=0 models if set to 1"], 'ibasnet': ['int32', '', "extended nuclear network if set to 1"], 'phase': ['int32', '', "fusion phases"], - 'var_rates': ['bool', '', "allows to use different reaction rate files if set to True"], + 'var_rates': [ + 'bool', '', + "allows to use different reaction rate files if set to True" + ], 'bintide': ['bool', '', "tidal interaction in binaries if set to True"], 'binm2': ['float64', '', "mass of the companion"], 'periodini': ['float64', '', "initial period of the binary"], @@ -90,54 +99,137 @@ } GENEC_STAR_ROTATION = { - 'idiff': ['int32', '', "computation of the diffusion of Omega and chemicals if set to 1"], - 'iadvec': ['int32', '', "advecto-diffusive version of the transport of Omega if set to 1"], - 'istati': ['int32', '', "only local conservation of angular momentum if set to 1"], - 'icoeff': ['int32', '', "prescription to be used for the diffusion coefficients"], - 'fenerg': ['float64', '', "fraction of the shear energy used for the mixing"], + 'idiff': [ + 'int32', '', + "computation of the diffusion of Omega and chemicals if set to 1" + ], + 'iadvec': [ + 'int32', '', + "advecto-diffusive version of the transport of Omega if set to 1" + ], + 'istati': [ + 'int32', '', + "only local conservation of angular momentum if set to 1" + ], + 'icoeff': [ + 'int32', '', "prescription to be used for the diffusion coefficients"], + 'fenerg': [ + 'float64', '', "fraction of the shear energy used for the mixing"], 'richac': ['float64', '', "critical Richardson number value"], - 'igamma': ['int32', '', "treatment of the shear according to M&M96 if set to 1"], + 'igamma': [ + 'int32', '', "treatment of the shear according to M&M96 if set to 1" + ], 'frein': ['float64', '', "magnetic braking if ≠ 0"], - 'K_Kawaler': ['float64', '', "K parameter in Kawaler1998 magnetic braking law"], - 'Omega_saturation': ['float64', '', "Ωsat in Kawaler magnetic braking law"], - 'rapcrilim': ['float64', '', "maximum Ωcrit ratio before the onset of mechanical mass loss"], - 'vwant': ['float64', '', "chosen velocity on the ZAMS (Veq if > 1.0, V/Vcrit if 0 1.0, V/Vcrit if 00, switches on the wind quenching, and evolves the magnetic field strength according to the conservation of magnetic flux"], - 'add_diff': ['float64', '', "additional viscosity value, used to increase the core-envelope coupling"], + 'Add_Flux': [ + 'bool', '', + "improves the angular momentum conservation treatment if set to True" + ], + 'diff_only': [ + 'bool', '', + "applies the tidal mixing only in timesteps where we use diffusion " + "(and not advection) if set to True" + ], + 'B_initial': [ + 'float64', '', + "if >0, switches on the wind quenching, and evolves the magnetic " + "field strength according to the conservation of magnetic flux" + ], + 'add_diff': [ + 'float64', '', + "additional viscosity value, used to increase the core-envelope " + "coupling" + ], 'n_mag': ['int32', '', "type of treatment for magnetic fields"], - 'alpha_F': ['float64', '', "α parameter in Fuller+ 2019. Values higher than 1 lower the threshold to trigger the instability (Qmin) and increase the magnetic viscosity (increased transport)"], - 'nsmooth': ['int32', '', "number of layers used for smoothing the Ω gradient (used by Mag_diff_general). Default value is nsmooth=1, recommended value for Fuller+ 2019 is nsmooth=5"], - 'qminsmooth': ['bool', '', "mag. instability always considered if set to True"], + 'alpha_F': [ + 'float64', '', + "α parameter in Fuller+ 2019. Values higher than 1 lower the " + "threshold to trigger the instability (Qmin) and increase the " + "magnetic viscosity (increased transport)" + ], + 'nsmooth': [ + 'int32', '', + "number of layers used for smoothing the Ω gradient (used by " + "Mag_diff_general). Default value is nsmooth=1, recommended " + "value for Fuller+ 2019 is nsmooth=5" + ], + 'qminsmooth': [ + 'bool', '', "mag. instability always considered if set to True" + ], } GENEC_STAR_SURFACE = { 'imloss': ['int32', '', "choice of the mass-loss prescription"], - 'fmlos': ['float64', '', "except for IMLOSS=2 or 3, multiplying factor applied to the mass loss"], - 'ifitm': ['int32', '', "management of the changes of fitm during redward evolution (and/or blueward evolution after a RSG phase)"], + 'fmlos': [ + 'float64', '', + "except for IMLOSS=2 or 3, multiplying factor applied to the mass loss" + ], + 'ifitm': [ + 'int32', '', + "management of the changes of fitm during redward evolution (and/or " + "blueward evolution after a RSG phase)" + ], 'fitm': ['float64', '', "mass included in the interior"], - 'fitmi': ['float64', '', "max value of FITM to which the star will come back when going back to the blue"], + 'fitmi': [ + 'float64', '', + "max value of FITM to which the star will come back when going back " + "to the blue" + ], + 'fitmi_default': [ + 'float64', '', + '', '', + ], 'deltal': ['float64', '', "triangle size for L at the surface"], 'deltat': ['float64', '', "triangle size for T at the surface"], - 'nndr': ['int32', '', "management of the behaviour of (L,Teff) with respect to the triangle"], + 'nndr': [ + 'int32', '', + "management of the behaviour of (L,Teff) with respect to the triangle" + ], 'RSG_Mdot': ['int32', '', "mass-loss recipe used for RSG"], - 'SupraEddMdot': ['bool', '', "x3 multiplication factor to the wind in case of supra-Eddington layers if set to True"], + 'SupraEddMdot': [ + 'bool', '', + "x3 multiplication factor to the wind in case of supra-Eddington " + "layers if set to True" + ], 'Be_mdotfrac': ['float64', '', ""], - 'start_mdot': ['float64', '', "value of Ω/Ωcrit at which the Be mass loss starts to apply"], + 'start_mdot': [ + 'float64', '', + "value of Ω/Ωcrit at which the Be mass loss starts to apply" + ], } GENEC_STAR_CONVECTION = { 'iledou': ['int32', '', "Ledoux criterion for convection if set to 1"], - 'idifcon': ['int32', '', "convection treated as a diffusion if set to 1 (used during O-b and Si-b)"], + 'idifcon': [ + 'int32', '', + "convection treated as a diffusion if set to 1 (used during O-b " + "and Si-b)" + ], 'iover': ['int32', '', "overshooting taken into account if set to 1"], 'elph': ['float64', '', "mixing length for the external convective zone"], - 'my': ['int32', '', "integration of the envelope on ρ rather than P if set to 1"], + 'my': [ + 'int32', '', + "integration of the envelope on ρ rather than P if set to 1" + ], 'dovhp': ['float64', '', "value of the α overshooting parameter Λ = α HP"], 'iunder': ['int32', '', "undershooting taken into account if set to 1"], 'dunder': ['float64', '', "value of the undershooting parameter"], @@ -145,44 +237,114 @@ GENEC_STAR_CONVERGENCE = { 'gkorm': ['float64', '', "accepted deviation on the structure variables"], - 'alph': ['float64', '', "fraction of the correction applied for the next iteration"], - 'agdr': ['float64', '', "absolute value of the maximum correction accepted on r, s, P and T"], - 'faktor': ['float64', '', "parameter allowing to 'compensate' (during the computation only) for layers with Lr > Ltot, and hence avoid dL/dr < 0"], - 'dgrp': ['float64', '', "relative variations (from one layer to the other) accepted on P"], - 'dgrl': ['float64', '', "relative variations (from one layer to the other) accepted on L"], - 'dgry': ['float64', '', "relative variations (from one layer to the other) accepted on 4He"], - 'dgrc': ['float64', '', "relative variations (from one layer to the other) accepted on 12C"], - 'dgro': ['float64', '', "relative variations (from one layer to the other) accepted on 16O"], - 'dgr20': ['float64', '', "relative variations (from one layer to the other) accepted on ?"], - 'nbchx': ['int32', '', "iteration number for the computation of the change in chemical composition"], - 'nrband': ['int32', '', "iteration number for the chemicals between model n and n+1"], + 'alph': [ + 'float64', '', + "fraction of the correction applied for the next iteration" + ], + 'agdr': [ + 'float64', '', + "absolute value of the maximum correction accepted on r, s, P and T" + ], + 'faktor': [ + 'float64', '', + "parameter allowing to 'compensate' (during the computation only) for " + "layers with Lr > Ltot, and hence avoid dL/dr < 0" + ], + 'dgrp': [ + 'float64', '', + "relative variations (from one layer to the other) accepted on P" + ], + 'dgrl': [ + 'float64', '', + "relative variations (from one layer to the other) accepted on L" + ], + 'dgry': [ + 'float64', '', + "relative variations (from one layer to the other) accepted on 4He" + ], + 'dgrc': [ + 'float64', '', + "relative variations (from one layer to the other) accepted on 12C" + ], + 'dgro': [ + 'float64', '', + "relative variations (from one layer to the other) accepted on 16O" + ], + 'dgr20': [ + 'float64', '', + "relative variations (from one layer to the other) accepted on ?" + ], + 'nbchx': [ + 'int32', '', + "iteration number for the computation of the change in chemical " + "composition" + ], + 'nrband': [ + 'int32', '', + "iteration number for the chemicals between model n and n+1"], } GENEC_STAR_TIME = { - 'xcn': ['float64', '', "multiplying factor applied on the time step for the next run"], - 'islow': ['int32', '', "slow version of the program if not 0 by modification of the ideal nuclear time step ratxcn"], + 'xcn': [ + 'float64', '', + "multiplying factor applied on the time step for the next run" + ], + 'islow': [ + 'int32', '', + "slow version of the program if not 0 by modification of the ideal " + "nuclear time step ratxcn" + ], 'icncst': ['int32', '', "constant time step (equivalent to xcn=1.0)"], - 'tauH_fit': ['int32', '', "used to set the maximal timestep in case of critical velocity, as a fraction of the MS lifetime"], + 'tauH_fit': [ + 'int32', '', + "used to set the maximal timestep in case of critical velocity, as a " + "fraction of the MS lifetime" + ], } GENEC_STAR_VARIOUS = { - 'display_plot': ['bool', '', "display of the pgplot window if set to True"], - 'iauto': ['int32', '', "management of the parameters change through the different phases of the evolution"], - 'iprn': ['int32', '', "the full structure is printed every iprn models. If iprn > nzmod, only one structure will be printed, the one corresponding to model nwseq"], - 'iout': ['int32', '', "number of layers used for the smoothing of the diffusion gradient at the border of the convective zones"], + 'display_plot': [ + 'bool', '', "display of the pgplot window if set to True" + ], + 'iauto': [ + 'int32', '', + "management of the parameters change through the different phases of " + "the evolution" + ], + 'iprn': [ + 'int32', '', + "the full structure is printed every iprn models. If iprn > nzmod, " + "only one structure will be printed, the one corresponding to model " + "nwseq" + ], + 'iout': [ + 'int32', '', + "number of layers used for the smoothing of the diffusion gradient " + "at the border of the convective zones" + ], 'itmin': ['int32', '', "minimal number of iterations in henyey"], 'xyfiles': ['bool', '', ""], - 'idebug': ['int32', '', "addition of some terminal printings useful for the debugging, with different possible levels. All values > 0 set verbose=True"], + 'idebug': [ + 'int32', '', + "addition of some terminal printings useful for the debugging, with " + "different possible levels. All values > 0 set verbose=True" + ], 'itests': ['int32', '', "use of a flag to test some pieces of code"], - 'verbose': ['bool', '', "increases the level of printings on the terminal and the .l file"], - 'stop_deg': ['bool', '', "automatically stops a computation when Tc becomes degenerate"], + 'verbose': [ + 'bool', '', + "increases the level of printings on the terminal and the .l file" + ], + 'stop_deg': [ + 'bool', '', + "automatically stops a computation when Tc becomes degenerate" + ], 'n_snap': ['int32', '', "number of steps between snapshots [0]"], } # Stellar properties (but global for the star) +# i.e.: b file (not shells) GENEC_STAR_PROPERTIES = { # 'GENEC name: [dtype, unit, description, AMUSE name (empty = not used)] - 'm': ['int32', '', "number of zones", "n_zones"], 'gms': ['float64', 'MSun', "total mass", "mass"], 'alter': ['float64', 'julianyr', "stellar age", "age"], 'gls': ['float64', 'LSun', "stellar luminosity", "luminosity"], @@ -193,12 +355,27 @@ 'dzeit': ['float64', 's', "time step (s)", ""], 'dzeitv': ['float64', 's', "previous time step", ""], 'xmini': ['float64', 'MSun', "initial mass", "initial_mass"], - 'summas': ['float64', 'MSun', "total mass", ""], 'ab': ['float64', '', "binary separation", ""], 'dm_lost': ['float64', 'MSun', "total mass lost", ""], -} - -GENEC_STAR_EXTRA = { + 'm': ['int32', '', "number of zones", "n_zones"], + 'summas': ['float64', 'MSun', "total mass", ""], # = xmini + # then a bunch of layered stuff, then + "dk": ['float64', '', '', ''], + "rlp": ['float64', '', '', ''], + "rlt": ['float64', '', '', ''], + "rlc": ['float64', '', '', ''], + "rrp": ['float64', '', '', ''], + "rrt": ['float64', '', '', ''], + "rrc": ['float64', '', '', ''], + "rtp": ['float64', '', '', ''], + "rtt": ['float64', '', '', ''], + "rtc": ['float64', '', '', ''], + "tdiff": ['float64', '', '', ''], + "suminenv": ['float64', '', '', ''], + "xltotbeg": ['float64', '', '', ''], + "dlelexprev": ['float64', '', '', ''], + "radius": ['float64', 'RSun', '', ''], + "zams_radius": ['float64', '', '', ''], 'mbelx': ['int32', '', "number of extra elements"], 'xtefflast': ['float64', '', ""], 'xllast': ['float64', '', ""], @@ -213,8 +390,20 @@ 'vnr': ['float64', '', "radiative gradient in the envelope"], } +GENEC_ARRAY_3 = { + "drl": ['float64', '', '', ''], # length 3 + "drte": ['float64', '', '', ''], # length 3 + "drp": ['float64', '', '', ''], # length 3 + "drt": ['float64', '', '', ''], # length 3 + "drr": ['float64', '', '', ''], # length 3 +} + +GENEC_ARRAY_NPONDCOUCHE = { + "CorrOmega": ['float64', '', '', ''], +} + # Structural properties (m layers) -GENEC_STAR_STRUCTURE = { +GENEC_ZONE = { # 'GENEC name: [dtype, unit, description, AMUSE name (optional) 'q': ['float64', '', "ln(1-Mr/M)"], 'p': ['float64', '', "ln(pressure)"], @@ -284,13 +473,25 @@ } # Structural properties (mbelx elements, m layers) -GENEC_STAR_STRUCTURE_EXTRA = { +GENEC_ARRAY_MBELX_M = { 'abelx': ['float64', '', "extra elements"], 'vabelx': ['float64', '', "previous extra elements"], } +GENEC_NETDEF_SCALARS = { + 'xlostneu': ['float64', '', "lost neutrons"], +} +GENEC_NETDEF_ARRAYS = { + 'nbzel': ['int32', '', 'length 8'], + 'nbael': ['int32', '', 'length 8'], + 'abels': ['float64', '', 'length 8'], +} +GENEC_NETALU_ARRAYS = { + 'xnetalu': ['float64', '', 'length 5'], +} + # These are not (re)stored / set, but they are calculated e.g. for plotting -GENEC_STAR_STRUCTURE_DERIVED = { +GENEC_ZONE_DERIVED = { 'eps': ['float64', '', ""], 'epsy': ['float64', '', ""], 'eps_c_adv': ['float64', '', ""], @@ -304,18 +505,6 @@ 'nabla_mu': ['float64', '', ""], } -GENEC_NETDEF_SCALARS = { - 'xlostneu': ['float64', '', "lost neutrons"], -} -GENEC_NETDEF_ARRAYS = { - 'nbzel': ['int32', '', 'length 8'], - 'nbael': ['int32', '', 'length 8'], - 'abels': ['float64', '', 'length 8'], -} -GENEC_NETALU_ARRAYS = { - 'xnetalu': ['float64', '', 'length 5'], -} - ALL_SETTERS = { **GENEC_STAR_CHARACTERISTICS, **GENEC_STAR_PHYSICS, @@ -327,11 +516,17 @@ **GENEC_STAR_TIME, **GENEC_STAR_VARIOUS, **GENEC_STAR_PROPERTIES, - **GENEC_STAR_EXTRA, - **GENEC_STAR_STRUCTURE, - **GENEC_STAR_STRUCTURE_EXTRA, + **GENEC_NETDEF_SCALARS, + **GENEC_ARRAY_3, + **GENEC_ARRAY_NPONDCOUCHE, + **GENEC_ZONE, + **GENEC_ARRAY_MBELX_M, + **GENEC_NETDEF_ARRAYS, + **GENEC_NETALU_ARRAYS, } + SCALAR_SETTERS = { + **GENEC_AMUSE_SPECIFIC, **GENEC_STAR_CHARACTERISTICS, **GENEC_STAR_PHYSICS, **GENEC_STAR_COMPOSITION, @@ -342,34 +537,23 @@ **GENEC_STAR_TIME, **GENEC_STAR_VARIOUS, **GENEC_STAR_PROPERTIES, - **GENEC_STAR_EXTRA, **GENEC_NETDEF_SCALARS, } VECTOR_SETTERS = { - **GENEC_STAR_STRUCTURE, - **GENEC_STAR_STRUCTURE_EXTRA, -} -ALL_GETTERS = { - **GENEC_STAR_CHARACTERISTICS, - **GENEC_STAR_PHYSICS, - **GENEC_STAR_COMPOSITION, - **GENEC_STAR_ROTATION, - **GENEC_STAR_SURFACE, - **GENEC_STAR_CONVECTION, - **GENEC_STAR_CONVERGENCE, - **GENEC_STAR_TIME, - **GENEC_STAR_VARIOUS, - **GENEC_STAR_PROPERTIES, - **GENEC_STAR_EXTRA, - **GENEC_STAR_STRUCTURE, - **GENEC_STAR_STRUCTURE_EXTRA, - **GENEC_STAR_STRUCTURE_DERIVED, - **GENEC_NETDEF_SCALARS, + **GENEC_ARRAY_3, + **GENEC_ARRAY_NPONDCOUCHE, + **GENEC_ZONE, + **GENEC_ARRAY_MBELX_M, **GENEC_NETDEF_ARRAYS, **GENEC_NETALU_ARRAYS, } +ALL_GETTERS = { + **ALL_SETTERS, + **GENEC_ZONE_DERIVED, +} + class GenecInterface( CodeInterface, @@ -469,7 +653,7 @@ def new_stellar_model(): description=parameter[1][2], direction=function.IN, ) - for parameter in GENEC_STAR_STRUCTURE.items(): + for parameter in GENEC_ZONE.items(): if parameter[1][1] == "": unit = NO_UNIT else: @@ -501,6 +685,10 @@ def new_stellar_model(): def get_firstlast_zone(index_of_the_particle='i'): returns (first='i', last='i') + @remote_function(can_handle_array=True) + def get_mass_fraction_at_zone(index_of_the_particle='i', zone='i'): + returns (dq_i='d') + @remote_function(can_handle_array=True) def get_surface_velocity(index_of_the_particle='i'): returns (surface_velocity='d') @@ -513,6 +701,16 @@ def get_luminosity_at_zone(index_of_the_particle='i', zone='i'): def get_mass_of_species(index_of_the_particle='i', species='i'): returns (species_mass='d') + @remote_function(can_handle_array=True) + def get_modell(index_of_the_particle='i'): + returns (modell='int32') + + @remote_function(can_handle_array=True) + def set_modell( + index_of_the_particle='i', + modell='int32', + ): + returns () @remote_function(can_handle_array=True) def get_veryFirst(index_of_the_particle='i'): @@ -1152,6 +1350,17 @@ def set_fitmi( ): returns () + @remote_function(can_handle_array=True) + def get_fitmi_default(index_of_the_particle='i'): + returns (fitmi_default='float64') + + @remote_function(can_handle_array=True) + def set_fitmi_default( + index_of_the_particle='i', + fitmi_default='float64', + ): + returns () + @remote_function(can_handle_array=True) def get_deltal(index_of_the_particle='i'): returns (deltal='float64') @@ -1614,17 +1823,6 @@ def set_n_snap( ): returns () - @remote_function(can_handle_array=True) - def get_m(index_of_the_particle='i'): - returns (m='int32') - - @remote_function(can_handle_array=True) - def set_m( - index_of_the_particle='i', - m='int32', - ): - returns () - @remote_function(can_handle_array=True) def get_gms(index_of_the_particle='i'): returns (gms='float64' | units.MSun) @@ -1735,6 +1933,39 @@ def set_xmini( ): returns () + @remote_function(can_handle_array=True) + def get_ab(index_of_the_particle='i'): + returns (ab='float64') + + @remote_function(can_handle_array=True) + def set_ab( + index_of_the_particle='i', + ab='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_dm_lost(index_of_the_particle='i'): + returns (dm_lost='float64' | units.MSun) + + @remote_function(can_handle_array=True) + def set_dm_lost( + index_of_the_particle='i', + dm_lost='float64' | units.MSun, + ): + returns () + + @remote_function(can_handle_array=True) + def get_m(index_of_the_particle='i'): + returns (m='int32') + + @remote_function(can_handle_array=True) + def set_m( + index_of_the_particle='i', + m='int32', + ): + returns () + @remote_function(can_handle_array=True) def get_summas(index_of_the_particle='i'): returns (summas='float64' | units.MSun) @@ -1747,24 +1978,167 @@ def set_summas( returns () @remote_function(can_handle_array=True) - def get_ab(index_of_the_particle='i'): - returns (ab='float64') + def get_dk(index_of_the_particle='i'): + returns (dk='float64') @remote_function(can_handle_array=True) - def set_ab( + def set_dk( index_of_the_particle='i', - ab='float64', + dk='float64', ): returns () @remote_function(can_handle_array=True) - def get_dm_lost(index_of_the_particle='i'): - returns (dm_lost='float64' | units.MSun) + def get_rlp(index_of_the_particle='i'): + returns (rlp='float64') @remote_function(can_handle_array=True) - def set_dm_lost( + def set_rlp( index_of_the_particle='i', - dm_lost='float64' | units.MSun, + rlp='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_rlt(index_of_the_particle='i'): + returns (rlt='float64') + + @remote_function(can_handle_array=True) + def set_rlt( + index_of_the_particle='i', + rlt='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_rlc(index_of_the_particle='i'): + returns (rlc='float64') + + @remote_function(can_handle_array=True) + def set_rlc( + index_of_the_particle='i', + rlc='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_rrp(index_of_the_particle='i'): + returns (rrp='float64') + + @remote_function(can_handle_array=True) + def set_rrp( + index_of_the_particle='i', + rrp='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_rrt(index_of_the_particle='i'): + returns (rrt='float64') + + @remote_function(can_handle_array=True) + def set_rrt( + index_of_the_particle='i', + rrt='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_rrc(index_of_the_particle='i'): + returns (rrc='float64') + + @remote_function(can_handle_array=True) + def set_rrc( + index_of_the_particle='i', + rrc='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_rtp(index_of_the_particle='i'): + returns (rtp='float64') + + @remote_function(can_handle_array=True) + def set_rtp( + index_of_the_particle='i', + rtp='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_rtt(index_of_the_particle='i'): + returns (rtt='float64') + + @remote_function(can_handle_array=True) + def set_rtt( + index_of_the_particle='i', + rtt='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_rtc(index_of_the_particle='i'): + returns (rtc='float64') + + @remote_function(can_handle_array=True) + def set_rtc( + index_of_the_particle='i', + rtc='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_tdiff(index_of_the_particle='i'): + returns (tdiff='float64') + + @remote_function(can_handle_array=True) + def set_tdiff( + index_of_the_particle='i', + tdiff='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_suminenv(index_of_the_particle='i'): + returns (suminenv='float64') + + @remote_function(can_handle_array=True) + def set_suminenv( + index_of_the_particle='i', + suminenv='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_xltotbeg(index_of_the_particle='i'): + returns (xltotbeg='float64') + + @remote_function(can_handle_array=True) + def set_xltotbeg( + index_of_the_particle='i', + xltotbeg='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_dlelexprev(index_of_the_particle='i'): + returns (dlelexprev='float64') + + @remote_function(can_handle_array=True) + def set_dlelexprev( + index_of_the_particle='i', + dlelexprev='float64', + ): + returns () + + @remote_function(can_handle_array=True) + def get_zams_radius(index_of_the_particle='i'): + returns (zams_radius='float64') + + @remote_function(can_handle_array=True) + def set_zams_radius( + index_of_the_particle='i', + zams_radius='float64', ): returns () @@ -1900,6 +2274,17 @@ def set_vnr( ): returns () + @remote_function(can_handle_array=True) + def get_xlostneu(index_of_the_particle='i'): + returns (xlostneu='float64') + + @remote_function(can_handle_array=True) + def set_xlostneu( + index_of_the_particle='i', + xlostneu='float64', + ): + returns () + @remote_function(can_handle_array=True) def get_q_at_zone( index_of_the_particle='i', zone='i' @@ -2708,6 +3093,66 @@ def set_vabelx_at_zone( vabelx='float64'): returns () + @remote_function(can_handle_array=True) + def get_drl( + index_of_the_particle='i', number='i' + ): + returns (drl='float64') + + @remote_function(can_handle_array=True) + def set_drl( + index_of_the_particle='i', number='i', + drl='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_drte( + index_of_the_particle='i', number='i' + ): + returns (drte='float64') + + @remote_function(can_handle_array=True) + def set_drte( + index_of_the_particle='i', number='i', + drte='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_drp( + index_of_the_particle='i', number='i' + ): + returns (drp='float64') + + @remote_function(can_handle_array=True) + def set_drp( + index_of_the_particle='i', number='i', + drp='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_drt( + index_of_the_particle='i', number='i' + ): + returns (drt='float64') + + @remote_function(can_handle_array=True) + def set_drt( + index_of_the_particle='i', number='i', + drt='float64'): + returns () + + @remote_function(can_handle_array=True) + def get_drr( + index_of_the_particle='i', number='i' + ): + returns (drr='float64') + + @remote_function(can_handle_array=True) + def set_drr( + index_of_the_particle='i', number='i', + drr='float64'): + returns () + @remote_function(can_handle_array=True) def get_eps_at_zone( index_of_the_particle='i', zone='i' @@ -2774,17 +3219,6 @@ def get_nabla_mu_at_zone( ): returns (nabla_mu='float64') - @remote_function(can_handle_array=True) - def get_xlostneu(index_of_the_particle='i'): - returns (xlostneu='float64') - - @remote_function(can_handle_array=True) - def set_xlostneu( - index_of_the_particle='i', - xlostneu='float64', - ): - returns () - @remote_function(can_handle_array=True) def get_nbzel( index_of_the_particle='i', number='i' @@ -2904,6 +3338,7 @@ def define_particle_sets(self, handler): # handler.add_method(set_name, 'get_radius_profile') # handler.add_method(set_name, 'get_temperature_profile') # handler.add_method(set_name, 'get_luminosity_profile') + handler.add_method(set_name, 'get_phase') handler.add_method(set_name, 'get_mass_profile') handler.add_method(set_name, 'get_eps_profile') handler.add_method(set_name, 'get_epsy_profile') @@ -2914,6 +3349,7 @@ def define_particle_sets(self, handler): handler.add_method(set_name, 'get_eps_grav_profile') handler.add_method(set_name, 'get_eps_nu_profile') handler.add_method(set_name, 'get_cumulative_mass_profile') + handler.add_method(set_name, 'get_mass_fraction_at_zone') handler.add_method(set_name, 'evolve_one_step') handler.add_method(set_name, 'evolve_for') @@ -2985,7 +3421,14 @@ def define_state(self, handler): # -> Update handler.add_transition('RUN', 'UPDATE', 'finalize_stellar_model') - handler.add_method("UPDATE", 'new_particle_from_model') + for state in ["EDIT", "UPDATE"]: + for method in ( + "new_particle_from_model", "new_stellar_model", + "set_abelx_at_zone", "set_vabelx_at_zone", "set_nbzel", + "set_nbael", "set_abels", "set_xnetalu" + ): + handler.add_method(state, method) + for state in ["UPDATE", "RUN"]: for parameter in ALL_GETTERS: handler.add_method(state, f'get_{parameter[0]}') @@ -3022,7 +3465,7 @@ def define_state(self, handler): ) handler.add_method('UPDATE', 'set_n_snap') - #handler.add_method('UPDATE', 'set_ipoly') + # handler.add_method('UPDATE', 'set_ipoly') handler.add_method('UPDATE', 'set_chemical_abundance_profiles') handler.add_method('UPDATE', 'set_mass_fraction_of_species_at_zone') # handler.add_method('UPDATE', 'set_radius') @@ -3216,13 +3659,15 @@ def get_cumulative_mass_profile( return frac_profile.cumsum() def get_internal_structure(self, index_of_the_star): - internal_structure = {} + internal_structure = { + # 'veryFirst': self.get_veryFirst(index_of_the_star), + } for star_property in SCALAR_SETTERS: func = getattr(self, f'get_{star_property}') internal_structure[star_property] = func(index_of_the_star) number_of_zones = self.get_m(index_of_the_star) for structure_property in { - **GENEC_STAR_STRUCTURE, + **GENEC_ZONE, }: func = getattr(self, f'get_{structure_property}_at_zone') # internal_structure.append(func(index_of_the_star)) @@ -3233,7 +3678,7 @@ def get_internal_structure(self, index_of_the_star): ) extra_elements = self.get_mbelx(index_of_the_star) for structure_property in { - **GENEC_STAR_STRUCTURE_EXTRA, + **GENEC_ARRAY_MBELX_M, }: func = getattr(self, f'get_{structure_property}_at_zone') x = np.array([]) @@ -3264,14 +3709,27 @@ def get_internal_structure(self, index_of_the_star): index_of_the_star, (list(range(1, 6)) | units.none) ) + for array_3_property in { + **GENEC_ARRAY_3, + }: + func = getattr(self, f'get_{array_3_property}') + + internal_structure[array_3_property] = func( + index_of_the_star, + (list(range(1, 4)) | units.none) + ) + return internal_structure def new_particle_from_model( self, internal_structure, current_age=0 | units.julianyr, key=None ): index_of_the_particle = self.new_stellar_model( - internal_structure['initialised'], + # Extra - for AMUSE + internal_structure['modell'], internal_structure['veryFirst'], + # Characteristics + internal_structure['initialised'], internal_structure['starname'], internal_structure['nwmd'], internal_structure['nwseq'], @@ -3279,6 +3737,7 @@ def new_particle_from_model( internal_structure['nzmod'], internal_structure['end_at_phase'], internal_structure['end_at_model'], + # Physics internal_structure['irot'], internal_structure['isol'], internal_structure['imagn'], @@ -3293,11 +3752,13 @@ def new_particle_from_model( internal_structure['periodini'], internal_structure['const_per'], internal_structure['iprezams'], + # Composition internal_structure['zinit'], internal_structure['zsol'], internal_structure['z'], internal_structure['iopac'], internal_structure['ikappa'], + # Rotation internal_structure['idiff'], internal_structure['iadvec'], internal_structure['istati'], @@ -3323,11 +3784,13 @@ def new_particle_from_model( internal_structure['alpha_F'], internal_structure['nsmooth'], internal_structure['qminsmooth'], + # Surface internal_structure['imloss'], internal_structure['fmlos'], internal_structure['ifitm'], internal_structure['fitm'], internal_structure['fitmi'], + internal_structure['fitmi_default'], internal_structure['deltal'], internal_structure['deltat'], internal_structure['nndr'], @@ -3335,6 +3798,7 @@ def new_particle_from_model( internal_structure['SupraEddMdot'], internal_structure['Be_mdotfrac'], internal_structure['start_mdot'], + # Convection internal_structure['iledou'], internal_structure['idifcon'], internal_structure['iover'], @@ -3343,6 +3807,7 @@ def new_particle_from_model( internal_structure['dovhp'], internal_structure['iunder'], internal_structure['dunder'], + # Convergence internal_structure['gkorm'], internal_structure['alph'], internal_structure['agdr'], @@ -3355,10 +3820,12 @@ def new_particle_from_model( internal_structure['dgr20'], internal_structure['nbchx'], internal_structure['nrband'], + # Time internal_structure['xcn'], internal_structure['islow'], internal_structure['icncst'], internal_structure['tauH_fit'], + # Various internal_structure['display_plot'], internal_structure['iauto'], internal_structure['iprn'], @@ -3370,7 +3837,7 @@ def new_particle_from_model( internal_structure['verbose'], internal_structure['stop_deg'], internal_structure['n_snap'], - internal_structure['m'], + # Properties internal_structure['gms'], internal_structure['alter'], internal_structure['gls'], @@ -3381,9 +3848,26 @@ def new_particle_from_model( internal_structure['dzeit'], internal_structure['dzeitv'], internal_structure['xmini'], - internal_structure['summas'], internal_structure['ab'], internal_structure['dm_lost'], + internal_structure['m'], + internal_structure['summas'], + internal_structure['dk'], + internal_structure['rlp'], + internal_structure['rlt'], + internal_structure['rlc'], + internal_structure['rrp'], + internal_structure['rrt'], + internal_structure['rrc'], + internal_structure['rtp'], + internal_structure['rtt'], + internal_structure['rtc'], + internal_structure['tdiff'], + internal_structure['suminenv'], + internal_structure['xltotbeg'], + internal_structure['dlelexprev'], + internal_structure['radius'], + internal_structure['zams_radius'], internal_structure['mbelx'], internal_structure['xtefflast'], internal_structure['xllast'], @@ -3396,6 +3880,7 @@ def new_particle_from_model( internal_structure['r_core'], internal_structure['vna'], internal_structure['vnr'], + # Zone internal_structure['q'], internal_structure['p'], internal_structure['t'], @@ -3461,6 +3946,7 @@ def new_particle_from_model( internal_structure['vomegi'], internal_structure['vxbid'], internal_structure['vxbid1'], + # netdef scalars internal_structure['xlostneu'], # internal_structure['abelx'], # internal_structure['vabelx'], @@ -3495,4 +3981,25 @@ def new_particle_from_model( index_of_the_particle, i+1, internal_structure['xnetalu'][i] ) + for i in range(3): + self.set_drl( + index_of_the_particle, i+1, + internal_structure['drl'][i] + ) + self.set_drte( + index_of_the_particle, i+1, + internal_structure['drte'][i] + ) + self.set_drp( + index_of_the_particle, i+1, + internal_structure['drp'][i] + ) + self.set_drt( + index_of_the_particle, i+1, + internal_structure['drt'][i] + ) + self.set_drr( + index_of_the_particle, i+1, + internal_structure['drr'][i] + ) return From cf324dc0321915824ddf2b5cb79e38e13fa901e6 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 30 May 2023 11:34:23 +0200 Subject: [PATCH 55/72] updates --- examples/code_examples/genec/plot_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/code_examples/genec/plot_models.py b/examples/code_examples/genec/plot_models.py index 1f48c06cff..f691735b75 100644 --- a/examples/code_examples/genec/plot_models.py +++ b/examples/code_examples/genec/plot_models.py @@ -249,7 +249,7 @@ def initialise_central_abundance(self): ax.set_title(title) ax.set_ylim(-0.05, 1.05) - if (self.star.phase > 1 and len(self.__age) > 2): + if (self.star.get_phase() > 1 and len(self.__age) > 2): ax.set_xlabel(f'log age/{unit_age}') time_xdata = np.log10( 0.01 + @@ -290,7 +290,7 @@ def plot_central_abundance(self): self.initialise_central_abundance() unit_age = self.default_units['age'] ax = self.__axes[title] - if (self.star.phase > 1 and len(self.__age) > 2): + if (self.star.get_phase() > 1 and len(self.__age) > 2): ax.set_xlabel(f'log age/{unit_age}') time_xdata = -np.log10( 0.01 + From b1ef506795495050e0680afb2f50e4912c91ca04 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 30 May 2023 12:21:29 +0200 Subject: [PATCH 56/72] updates --- .../genec/test_integrate_default_star.py | 123 ++++-------------- 1 file changed, 26 insertions(+), 97 deletions(-) diff --git a/examples/code_examples/genec/test_integrate_default_star.py b/examples/code_examples/genec/test_integrate_default_star.py index f40b79d4b7..81976e93a6 100644 --- a/examples/code_examples/genec/test_integrate_default_star.py +++ b/examples/code_examples/genec/test_integrate_default_star.py @@ -1,3 +1,4 @@ +import sys import numpy import time @@ -22,6 +23,7 @@ logger = logging.getLogger(__name__) # logger.setLevel(logging.DEBUG) + class NeedToSave: def __init__(self): self.model = 0 @@ -60,6 +62,7 @@ def read_saved_star_timeline(star_key): age, radius = star.get_timeline_of_attribute_as_vector('radius') print(age.in_(units.yr)) print(radius.in_(units.RSun)) + return star def write_backup( @@ -139,100 +142,26 @@ def write_backup( mass=60 | units.MSun, metallicity=0.014, ) -star = Particle(mass=7.0 | units.MSun, metallicity=0.014, starname="AmuseStar") + +if len(sys.argv) > 1: + star = read_saved_star_timeline(sys.argv[1]) +else: + star = Particle( + mass=7.0 | units.MSun, + metallicity=0.014, + starname="AmuseStar", + ) evo = Genec(redirection="none") # evo.parameters.idebug = 2 # evo = Genec() if ROTATING_STAR: - params = { - # PhysicsParams - 'irot': 1, - 'isol': 1, - 'imagn': 0, - 'ialflu': 0, - 'ianiso': 1, - 'ipop3': 0, - 'ibasnet': 0, - 'phase': 1, - 'var_rates': False, - 'bintide': False, - # 'binM2': 0.00E+00, - 'periodini': 0.00E+00, - 'const_per': True, - # CompositionParams - 'zinit': 1.40E-02, - 'zsol': 0.140e-01, - 'z': 0.261956006494962e-02, - 'iopac': 3, - 'ikappa': 5, - # RotationParams - 'idiff': 0, - 'iadvec': 0, - 'istati': 0, - 'icoeff': 11, - 'fenerg': 0.100e+01, - 'richac': 0.100e+01, - 'igamma': 0, - 'frein': 0.000e+00, - 'K_Kawaler': 0.000e+00, - 'Omega_saturation': 0.140e+02, - 'rapcrilim': 0.99000, - 'vwant': 0.400e+00, - 'xfom': 0.100e+01, - 'omega': 1.000000000000000E-05, - 'xdial': 0.000, - 'idialo': 0, - 'idialu': 0, - 'Add_Flux': True, - 'diff_only': False, - 'B_initial': 0.000e+00, - 'add_diff': 0.000e+00, - # SurfaceParams - 'imloss': 6, - 'fmlos': 0.850e+00, - # 'RSG_Mdot': 0, - # 'noSupraEddMdot': False, - # 'Be_mdotfrac': 0.00, - # 'start_mdot': 0.80, - 'ifitm': 3, - 'fitmi': 0.999000000, - 'fitm': 0.999000000, - 'deltal': 0.02000, - 'deltat': 0.02000, - 'nndr': 1, - # ConvectionParams - 'iledou': 0, - 'idifcon': 0, - 'elph': 1.600, - 'my': 0, - 'iover': 1, - 'dovhp': 0.100, - 'iunder': 0, - 'dunder': 0.000, - # ConvergenceParams - 'gkorm': 9.000, - 'alph': 0.300, - 'agdr': 0.10e-04, - 'faktor': 1.00E+00, - 'dgrp': 0.0100, - 'dgrl': 0.0100, - 'dgry': 0.00300, - 'dgrc': 0.01000, - 'dgro': 0.01000, - 'dgr20': 0.100e-01, - 'nbchx': 200, - 'nrband': 1, - # TimeControle - 'islow': 0, - 'xcn': 1.000, - 'icncst': 0, - 'tauH_fit': 1, - } - evo.parameters.vwant = 0.7 + star.vwant = 0.7 else: - evo.parameters.vwant = 0.0 -evo.parameters.ipoly = 0 -star_in_evo = evo.fullparticles.add_particle(star) # NOTE: this will now reset parameters... + star.vwant = 0.0 +star.ipoly = 0 + +# NOTE: this will now reset parameters... +star_in_evo = evo.particles.add_particle(star) # evo.parameters.idebug = 2 # print(star_in_evo) @@ -246,7 +175,7 @@ def write_backup( save_every = 10 store_every = 1 plot_time = 10 | units.s -plot_models = 20 +plot_models = 1 step = 0 model_of_last_save = 0 @@ -273,10 +202,10 @@ def write_backup( # pressure_profile = star_in_evo.get_pressure_profile() chemical_abundance_profile = star_in_evo.get_chemical_abundance_profiles() - # print(evo.fullparticles[0]) - # print(evo.fullparticles[0].get_number_of_species()) - # print(evo.fullparticles[0].get_names_of_species()) - # print(evo.fullparticles[0].get_mass_profile()) + # print(evo.particles[0]) + # print(evo.particles[0].get_number_of_species()) + # print(evo.particles[0].get_names_of_species()) + # print(evo.particles[0].get_mass_profile()) # exit() print( star.age.in_(units.Myr), @@ -284,11 +213,11 @@ def write_backup( star.radius.in_(units.RSun), star.temperature.in_(units.K), star.luminosity.in_(units.LSun), - star.phase, + # star.phase, star.surface_velocity, star.abundance_h[0], - evo.parameters.vwant, - evo.parameters.xcn, + star.vwant, + star.xcn, ) print(f"step: {step} time: {star.age} timestep: {star.time_step} xcn: {evo.parameters.xcn}") if (step % store_every == 0) and plotting is not None: From acaceaf552d7782b5d31f96b7f71ed4c75ce840f Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Thu, 1 Jun 2023 17:11:01 +0200 Subject: [PATCH 57/72] take vwant into account for new stars not fully working yet --- src/amuse/community/genec/interface.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 045310f705..63166556a3 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -2092,6 +2092,7 @@ integer function set_vwant(index_of_the_particle, vwant) integer, intent(in):: index_of_the_particle real(kindreal), intent(in):: vwant GenecStar%vwant = vwant + InitialGenecStar%vwant = vwant set_vwant = 0 end function set_vwant From 4538aa787e54819c19c85972ac369f6642f63808 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 5 Jun 2023 10:24:01 +0200 Subject: [PATCH 58/72] fix: store zabelx/nbelx --- src/amuse/community/genec/interface.f90 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 045310f705..ad7c788b90 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -325,15 +325,13 @@ subroutine restore_network(z) !---------------------------------------------------------------------- use evol, only: input_dir use inputparam,only: idebug,libgenec - use abundmod,only: mbelx,abels,xlostneu,nbzel,nbael + use abundmod,only: mbelx,abels,xlostneu,nbzel,nbael,zabelx,nbelx use storage, only: GenecStar implicit none integer:: i,ii,ierror - integer:: nbelx ! FIXME: store this somewhere? real(kindreal),intent(in):: z - real(kindreal):: zabelx ! FIXME: store? character (256):: namenet,namereac !---------------------------------------------------------------------- ! Reading network information (elements, ...) @@ -660,8 +658,13 @@ function set_mass(index_of_the_star, mass) implicit none integer:: set_mass, index_of_the_star real(kindreal):: mass - InitialGenecStar%mstar = mass - set_mass = 0 + if (.not.GenecStar%initialised) then + InitialGenecStar%mstar = mass + set_mass = 0 + else + write(*,*) "This function should not be called when the star is already initialised" + set_mass = -2 + endif end function function get_mass_of_species(index_of_the_star, species, species_mass) @@ -2091,8 +2094,14 @@ integer function set_vwant(index_of_the_particle, vwant) implicit none integer, intent(in):: index_of_the_particle real(kindreal), intent(in):: vwant - GenecStar%vwant = vwant - set_vwant = 0 + if (.not.GenecStar%initialised) then + InitialGenecStar%vwant = vwant + GenecStar%vwant = vwant + set_vwant = 0 + else + write(*,*) "This function should not be called when the star is already initialised" + set_vwant = -2 + endif end function set_vwant integer function get_xfom(index_of_the_particle, xfom) From 87da6d137e584728c6da9d452cf4da1b26454406 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 5 Jun 2023 14:19:08 +0200 Subject: [PATCH 59/72] important updates --- examples/code_examples/genec/plot_models.py | 6 +++--- src/amuse/community/genec/interface.f90 | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/code_examples/genec/plot_models.py b/examples/code_examples/genec/plot_models.py index f691735b75..85d74da591 100644 --- a/examples/code_examples/genec/plot_models.py +++ b/examples/code_examples/genec/plot_models.py @@ -405,9 +405,9 @@ def initialise_gradient(self): ax.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') ax.set_ylabel('Nabla_(rad-ad-mu)') mass_profile = self.star.get_cumulative_mass_profile() - nabla_rad = self.star.nabla_rad_profile - nabla_ad = self.star.nabla_ad_profile - nabla_mu = self.star.nabla_mu_profile + nabla_rad = self.star.get_nabla_rad_profile() + nabla_ad = self.star.get_nabla_ad_profile() + nabla_mu = self.star.get_nabla_mu_profile() min_nabla = min( min(nabla_ad), min(nabla_rad), diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index ad7c788b90..827c8d23fd 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -239,7 +239,7 @@ subroutine init_or_restore_star(Star) endif ! modanf ! ftfp initialisation - !call initgeo + call initgeo if (ialflu==0 .and. xmini<=9.d0) then ichem = 1 @@ -2086,7 +2086,7 @@ integer function get_vwant(index_of_the_particle, vwant) implicit none integer, intent(in):: index_of_the_particle real(kindreal), intent(out):: vwant - vwant = GenecStar%vwant + vwant = InitialGenecStar%vwant get_vwant = 0 end function get_vwant @@ -2096,7 +2096,6 @@ integer function set_vwant(index_of_the_particle, vwant) real(kindreal), intent(in):: vwant if (.not.GenecStar%initialised) then InitialGenecStar%vwant = vwant - GenecStar%vwant = vwant set_vwant = 0 else write(*,*) "This function should not be called when the star is already initialised" From af6ccc985644efbb79a63230ab42a5c17e39158b Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 7 Jun 2023 17:32:54 +0200 Subject: [PATCH 60/72] fix bug that would lead to Nan values if nbael was 0 (and a load of related issues) --- src/amuse/community/genec/interface.f90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 827c8d23fd..4ce8152079 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -174,7 +174,6 @@ subroutine init_or_restore_star(Star) if (ialflu == 1) then zabelx=zabelx-xf19(1)-xne21(1)-xna23(1)-xal27(1) endif - write(*,*) 'z,zabelx,m',z,zabelx,m if (isugi >= 1) then nsugi = m @@ -342,7 +341,7 @@ subroutine restore_network(z) nbzel = GenecStar%nbzel nbael = GenecStar%nbael abels = GenecStar%abels - do while (i <= size(abels)) + do while (nbael(i) > 0) if (GenecStar%verbose) then write(*,*) nbzel(i), nbael(i), abels(i) endif From f88fb36d428c9399466e0bae0941e52e313b73af Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 7 Jun 2023 22:03:33 +0200 Subject: [PATCH 61/72] better recommit_particles --- src/amuse/community/genec/interface.f90 | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 4ce8152079..ba7bd26fc5 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1390,25 +1390,27 @@ function recommit_parameters() end function function recommit_particles() - use genec, only: initialise_star + !use genec, only: initialise_star implicit none integer:: recommit_particles !write(*,*) "copy from GenecStar" !call copy_from_genec_star(GenecStar) ! "read" GENEC star namelists - write(*,*) "call copy_namelists_from_genec_star(GenecStar)" - call copy_namelists_from_genec_star(GenecStar) - ! Initialise values not in GENEC star - ! but this also resets some values that are read, so... - write(*,*) 'call initialise_star()' - call initialise_star() - ! "read" the GENEC star structure - write(*,*) 'call copy_structure_from_genec_star(GenecStar)' - call copy_structure_from_genec_star(GenecStar) - ! and then copy back - some things may have changed? - write(*,*) 'call copy_to_genec_star(GenecStar)' - call copy_to_genec_star(GenecStar) + !write(*,*) "call copy_namelists_from_genec_star(GenecStar)" + !call copy_namelists_from_genec_star(GenecStar) + !! Initialise values not in GENEC star + !! but this also resets some values that are read, so... + !write(*,*) 'call initialise_star()' + !call initialise_star() + !! "read" the GENEC star structure + !write(*,*) 'call copy_structure_from_genec_star(GenecStar)' + !call copy_structure_from_genec_star(GenecStar) + !! and then copy back - some things may have changed? + !write(*,*) 'call copy_to_genec_star(GenecStar)' + !call copy_to_genec_star(GenecStar) + write(*,*) "recommit particles after a change" + call copy_from_genec_star(GenecStar) recommit_particles = 0 end function From 1b784fff083fd0ccd4939a9f183bfd298571a366 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Fri, 9 Jun 2023 14:55:11 +0200 Subject: [PATCH 62/72] few updates, now giving stars the right number of shells --- src/amuse/community/genec/interface.f90 | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index ba7bd26fc5..39c9e1067b 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -394,10 +394,10 @@ function commit_particles() if (.not.GenecStar%initialised) then call make_initial_star() call copy_from_genec_star(GenecStar) - GenecStar%initialised = .true. call copy_to_genec_star(GenecStar) endif call init_or_restore_star(GenecStar) + GenecStar%initialised = .true. write(*,*) "COMMIT PARTICLES DONE" commit_particles = 0 end function @@ -1104,8 +1104,18 @@ function get_time_step(index_of_the_star, time_step) integer:: index_of_the_star real(kindreal):: time_step integer:: get_time_step - time_step = GenecStar%dzeitj - get_time_step = 0 + get_time_step = get_dzeit(index_of_the_star, time_step) + !time_step = GenecStar%dzeitj + !time_step = GenecStar%dzeit + !get_time_step = 0 +end function + +function set_time_step(index_of_the_star, time_step) + implicit none + integer:: index_of_the_star + real(kindreal):: time_step + integer:: set_time_step + set_time_step = set_dzeit(index_of_the_star, time_step) end function function get_time(time) @@ -3201,10 +3211,12 @@ integer function get_dzeit(index_of_the_particle, dzeit) end function get_dzeit integer function set_dzeit(index_of_the_particle, dzeit) + use const, only: year implicit none integer, intent(in):: index_of_the_particle real(kindreal), intent(in):: dzeit GenecStar%dzeit = dzeit + GenecStar%dzeitj = dzeit / year set_dzeit = 0 end function set_dzeit From 4bf4da1e13301de33861fcae6348134f5adfbc58 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Fri, 9 Jun 2023 15:16:34 +0200 Subject: [PATCH 63/72] Updates to (mostly) units used --- src/amuse/community/genec/interface.py | 39 +++++++++++++++++--------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 7a044f1108..8f080b844f 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -84,8 +84,8 @@ "allows to use different reaction rate files if set to True" ], 'bintide': ['bool', '', "tidal interaction in binaries if set to True"], - 'binm2': ['float64', '', "mass of the companion"], - 'periodini': ['float64', '', "initial period of the binary"], + 'binm2': ['float64', 'MSun', "mass of the companion"], + 'periodini': ['float64', 'day', "initial period of the binary"], 'const_per': ['bool', '', "keep constant period if True"], 'iprezams': ['int32', '', ""], } @@ -346,13 +346,13 @@ GENEC_STAR_PROPERTIES = { # 'GENEC name: [dtype, unit, description, AMUSE name (empty = not used)] 'gms': ['float64', 'MSun', "total mass", "mass"], - 'alter': ['float64', 'julianyr', "stellar age", "age"], + 'alter': ['float64', 'yr', "stellar age", "age"], 'gls': ['float64', 'LSun', "stellar luminosity", "luminosity"], 'teff': ['float64', 'K', "effective temperature", "temperature"], 'glsv': ['float64', 'LSun', "previous luminosity"], 'teffv': ['float64', 'K', "previous temperature"], - 'dzeitj': ['float64', 'julianyr', "time step (yr)", "time_step"], - 'dzeit': ['float64', 's', "time step (s)", ""], + 'dzeitj': ['float64', 'yr', "time step (yr)", ""], + 'dzeit': ['float64', 's', "time step (s)", "time_step"], 'dzeitv': ['float64', 's', "previous time step", ""], 'xmini': ['float64', 'MSun', "initial mass", "initial_mass"], 'ab': ['float64', '', "binary separation", ""], @@ -923,23 +923,23 @@ def set_bintide( @remote_function(can_handle_array=True) def get_binm2(index_of_the_particle='i'): - returns (binm2='float64') + returns (binm2='float64' | units.MSun) @remote_function(can_handle_array=True) def set_binm2( index_of_the_particle='i', - binm2='float64', + binm2='float64' | units.MSun, ): returns () @remote_function(can_handle_array=True) def get_periodini(index_of_the_particle='i'): - returns (periodini='float64') + returns (periodini='float64' | units.day) @remote_function(can_handle_array=True) def set_periodini( index_of_the_particle='i', - periodini='float64', + periodini='float64' | units.day, ): returns () @@ -1891,12 +1891,12 @@ def set_teffv( @remote_function(can_handle_array=True) def get_dzeitj(index_of_the_particle='i'): - returns (dzeitj='float64' | units.julianyr) + returns (dzeitj='float64' | units.yr) @remote_function(can_handle_array=True) def set_dzeitj( index_of_the_particle='i', - dzeitj='float64' | units.julianyr, + dzeitj='float64' | units.yr, ): returns () @@ -1911,6 +1911,13 @@ def set_dzeit( ): returns () + @remote_function(can_handle_array=True) + def set_time_step( + index_of_the_particle='i', + time_step='float64' | units.s, + ): + returns () + @remote_function(can_handle_array=True) def get_dzeitv(index_of_the_particle='i'): returns (dzeitv='float64' | units.s) @@ -3302,7 +3309,7 @@ def define_parameters(self, handler): def define_particle_sets(self, handler): - for set_name in ['particles']: + for set_name in ['particles', ]: handler.define_set(set_name, 'index_of_the_particle') InternalStellarStructure.define_particle_sets( self, handler, set_name=set_name @@ -3330,7 +3337,8 @@ def define_particle_sets(self, handler): # handler.add_getter(set_name, 'get_age') # handler.add_getter(set_name, 'get_luminosity') # handler.add_getter(set_name, 'get_temperature') - # handler.add_getter(set_name, 'get_time_step', names=('time_step',)) + handler.add_getter(set_name, 'get_time_step', names=('time_step',)) + handler.add_setter(set_name, 'set_time_step', names=('time_step',)) # handler.add_getter( # set_name, 'get_number_of_species', names=('n_species',) # ) @@ -3463,6 +3471,9 @@ def define_state(self, handler): handler.add_method( state, f'get_mass_fraction_of_{species}_at_zone' ) + for state in ["EDIT", "UPDATE"]: + for parameter in ALL_SETTERS: + handler.add_method(state, f'set_{parameter[0]}') handler.add_method('UPDATE', 'set_n_snap') # handler.add_method('UPDATE', 'set_ipoly') @@ -3722,7 +3733,7 @@ def get_internal_structure(self, index_of_the_star): return internal_structure def new_particle_from_model( - self, internal_structure, current_age=0 | units.julianyr, key=None + self, internal_structure, current_age=0 | units.yr, key=None ): index_of_the_particle = self.new_stellar_model( # Extra - for AMUSE From ff921062dc2038956d88f81946048f9f1b980eaf Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 12 Jun 2023 16:09:26 +0200 Subject: [PATCH 64/72] Updates: add setters, rename parameters/methods --- src/amuse/community/genec/interface.f90 | 99 +++++++++++++------------ src/amuse/community/genec/interface.py | 97 +++++++++++++++--------- 2 files changed, 114 insertions(+), 82 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 39c9e1067b..f82d0522f9 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -658,7 +658,7 @@ function set_mass(index_of_the_star, mass) integer:: set_mass, index_of_the_star real(kindreal):: mass if (.not.GenecStar%initialised) then - InitialGenecStar%mstar = mass + InitialGenecStar%initial_mass = mass set_mass = 0 else write(*,*) "This function should not be called when the star is already initialised" @@ -878,7 +878,7 @@ function get_metallicity(metallicity) implicit none real(kindreal):: metallicity integer:: get_metallicity - metallicity = InitialGenecStar%zini + metallicity = InitialGenecStar%initial_metallicity get_metallicity = 0 end function @@ -886,7 +886,7 @@ function set_metallicity(metallicity) implicit none real(kindreal):: metallicity integer:: set_metallicity - InitialGenecStar%zini = metallicity + InitialGenecStar%initial_metallicity = metallicity set_metallicity = 0 end function @@ -1126,17 +1126,18 @@ function get_time(time) get_time = 0 end function -function new_particle(index_of_the_star, mass, metallicity, am_starname) +function new_particle(index_of_the_star, initial_mass, initial_metallicity, zams_velocity, star_name) implicit none integer:: index_of_the_star, key - real(kindreal):: mass, metallicity + real(kindreal):: initial_mass, initial_metallicity, zams_velocity integer:: new_particle - character(len=12):: am_starname + character(len=12):: star_name number_of_stars = number_of_stars + 1 - InitialGenecStar%starname = am_starname + InitialGenecStar%star_name = star_name InitialGenecStar%index_of_the_star = number_of_stars - InitialGenecStar%mstar = mass - InitialGenecStar%zini = metallicity + InitialGenecStar%initial_mass = initial_mass + InitialGenecStar%initial_metallicity = initial_metallicity + InitialGenecStar%zams_velocity = zams_velocity InitialGenecStar%idefaut = 1 index_of_the_star = InitialGenecStar%index_of_the_star @@ -1501,21 +1502,21 @@ integer function set_initialised(index_of_the_particle, initialised) set_initialised = 0 end function set_initialised -integer function get_starname(index_of_the_particle, starname) +integer function get_star_name(index_of_the_particle, star_name) implicit none integer, intent(in):: index_of_the_particle - character(256), intent(out):: starname - starname = GenecStar%starname - get_starname = 0 -end function get_starname + character(256), intent(out):: star_name + star_name = GenecStar%star_name + get_star_name = 0 +end function get_star_name -integer function set_starname(index_of_the_particle, starname) +integer function set_star_name(index_of_the_particle, star_name) implicit none integer, intent(in):: index_of_the_particle - character(256), intent(in):: starname - GenecStar%starname = starname - set_starname = 0 -end function set_starname + character(256), intent(in):: star_name + GenecStar%star_name = star_name + set_star_name = 0 +end function set_star_name integer function get_nwmd(index_of_the_particle, nwmd) implicit none @@ -1837,21 +1838,21 @@ integer function set_iprezams(index_of_the_particle, iprezams) set_iprezams = 0 end function set_iprezams -integer function get_zinit(index_of_the_particle, zinit) +integer function get_initial_metallicity(index_of_the_particle, initial_metallicity) implicit none integer, intent(in):: index_of_the_particle - real(kindreal), intent(out):: zinit - zinit = GenecStar%zinit - get_zinit = 0 -end function get_zinit + real(kindreal), intent(out):: initial_metallicity + initial_metallicity = GenecStar%initial_metallicity + get_initial_metallicity = 0 +end function get_initial_metallicity -integer function set_zinit(index_of_the_particle, zinit) +integer function set_initial_metallicity(index_of_the_particle, initial_metallicity) implicit none integer, intent(in):: index_of_the_particle - real(kindreal), intent(in):: zinit - GenecStar%zinit = zinit - set_zinit = 0 -end function set_zinit + real(kindreal), intent(in):: initial_metallicity + GenecStar%initial_metallicity = initial_metallicity + set_initial_metallicity = 0 +end function set_initial_metallicity integer function get_zsol(index_of_the_particle, zsol) implicit none @@ -2093,26 +2094,26 @@ integer function set_rapcrilim(index_of_the_particle, rapcrilim) set_rapcrilim = 0 end function set_rapcrilim -integer function get_vwant(index_of_the_particle, vwant) +integer function get_zams_velocity(index_of_the_particle, zams_velocity) implicit none integer, intent(in):: index_of_the_particle - real(kindreal), intent(out):: vwant - vwant = InitialGenecStar%vwant - get_vwant = 0 -end function get_vwant + real(kindreal), intent(out):: zams_velocity + zams_velocity = InitialGenecStar%zams_velocity + get_zams_velocity = 0 +end function get_zams_velocity -integer function set_vwant(index_of_the_particle, vwant) +integer function set_zams_velocity(index_of_the_particle, zams_velocity) implicit none integer, intent(in):: index_of_the_particle - real(kindreal), intent(in):: vwant + real(kindreal), intent(in):: zams_velocity if (.not.GenecStar%initialised) then - InitialGenecStar%vwant = vwant - set_vwant = 0 + InitialGenecStar%zams_velocity = zams_velocity + set_zams_velocity = 0 else write(*,*) "This function should not be called when the star is already initialised" - set_vwant = -2 + set_zams_velocity = -2 endif -end function set_vwant +end function set_zams_velocity integer function get_xfom(index_of_the_particle, xfom) implicit none @@ -5987,11 +5988,11 @@ end function set_xnetalu function new_stellar_model(& index_of_the_star,& modell,veryFirst,& - initialised,starname,nwmd,nwseq,modanf,nzmod,end_at_phase,end_at_model,& + initialised,star_name,nwmd,nwseq,modanf,nzmod,end_at_phase,end_at_model,& irot,isol,imagn,ialflu,ianiso,ipop3,ibasnet,phase,var_rates,bintide,binm2,periodini,const_per,iprezams,& - zinit,zsol,z,iopac,ikappa,& + initial_metallicity,zsol,z,iopac,ikappa,& idiff,iadvec,istati,icoeff,fenerg,richac,igamma,frein,K_Kawaler,& - Omega_saturation,rapcrilim,vwant,xfom,omega,xdial,idialo,idialu,Add_Flux,diff_only,B_initial,& + Omega_saturation,rapcrilim,zams_velocity,xfom,omega,xdial,idialo,idialu,Add_Flux,diff_only,B_initial,& add_diff,n_mag,alpha_F,nsmooth,qminsmooth,& imloss,fmlos,ifitm,fitm,fitmi,fitmi_default,deltal,deltat,nndr,RSG_Mdot,SupraEddMdot,Be_mdotfrac,start_mdot,& iledou,idifcon,iover,elph,my,dovhp,iunder,dunder,& @@ -6017,7 +6018,7 @@ function new_stellar_model(& logical, intent(in):: & initialised, veryFirst character(256), intent(in):: & - starname + star_name integer, intent(in):: & nwmd,nwseq,modanf,nzmod,end_at_phase,end_at_model,irot,isol,imagn,& ialflu,ianiso,ipop3,ibasnet,phase @@ -6030,7 +6031,7 @@ function new_stellar_model(& integer, intent(in):: & iprezams real(kindreal), intent(in):: & - zinit,& + initial_metallicity,& zsol,z integer, intent(in):: & iopac,ikappa,idiff,iadvec,istati,icoeff @@ -6040,7 +6041,7 @@ function new_stellar_model(& igamma real(kindreal), intent(in):: & frein,K_Kawaler,& - Omega_saturation,rapcrilim,vwant,xfom,omega,xdial + Omega_saturation,rapcrilim,zams_velocity,xfom,omega,xdial integer, intent(in):: & idialo,idialu logical, intent(in):: & @@ -6133,7 +6134,7 @@ function new_stellar_model(& GenecStar%modell = modell GenecStar%veryFirst = veryFirst GenecStar%initialised = initialised - GenecStar%starname = starname + GenecStar%star_name = star_name GenecStar%nwmd = nwmd GenecStar%nwseq = nwseq GenecStar%modanf = modanf @@ -6155,7 +6156,7 @@ function new_stellar_model(& GenecStar%periodini = periodini GenecStar%const_per = const_per GenecStar%iprezams = iprezams - GenecStar%zinit = zinit + GenecStar%initial_metallicity = initial_metallicity GenecStar%zsol = zsol GenecStar%z = z GenecStar%iopac = iopac @@ -6173,7 +6174,7 @@ function new_stellar_model(& !---- GenecStar%Omega_saturation = Omega_saturation GenecStar%rapcrilim = rapcrilim - GenecStar%vwant = vwant + GenecStar%zams_velocity = zams_velocity GenecStar%xfom = xfom GenecStar%omega = omega GenecStar%xdial = xdial diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 8f080b844f..dd66c52f75 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -59,7 +59,7 @@ GENEC_STAR_CHARACTERISTICS = { # 'GENEC name': [dtype, unit, description, AMUSE name (optional)] 'initialised': ['bool', '', "True if the star is an intialised model"], - 'starname': ['string', '', "Name of the star"], + 'star_name': ['string', '', "Name of the star"], 'nwmd': ['int32', '', "model number"], 'nwseq': [ 'int32', '', "number of the first model in the time-step series" @@ -83,15 +83,30 @@ 'bool', '', "allows to use different reaction rate files if set to True" ], - 'bintide': ['bool', '', "tidal interaction in binaries if set to True"], - 'binm2': ['float64', 'MSun', "mass of the companion"], - 'periodini': ['float64', 'day', "initial period of the binary"], + 'bintide': [ + 'bool', + '', + "tidal interaction in binaries if set to True", + "binary_enable_tides", + ], + 'binm2': [ + 'float64', + 'MSun', + "mass of the companion", + "binary_companion_mass", + ], + 'periodini': [ + 'float64', + 'day', + "initial period of the binary", + "binary_initial_period", + ], 'const_per': ['bool', '', "keep constant period if True"], 'iprezams': ['int32', '', ""], } GENEC_STAR_COMPOSITION = { - 'zinit': ['float64', '', "initial metallicity of the model"], + 'initial_metallicity': ['float64', '', "initial metallicity of the model"], 'zsol': ['float64', '', "reference solar metallicity"], 'z': ['float64', '', "abundance of the neglected isotopes"], 'iopac': ['int32', '', "choice of the opacity table if ikappa = 5"], @@ -130,10 +145,12 @@ 'float64', '', "maximum Ωcrit ratio before the onset of mechanical mass loss" ], - 'vwant': [ - 'float64', '', - "chosen velocity on the ZAMS (Veq if > 1.0, V/Vcrit if 0 1.0, V/Vcrit if 0 Edit (commit_parameters) - # handler.add_method('EDIT', 'set_starname') + # handler.add_method('EDIT', 'set_star_name') # handler.add_method('EDIT', 'new_particle') # -> Run (commit_particles) @@ -3495,7 +3526,7 @@ def define_state(self, handler): ) # -> Run (recommit_particles) - # handler.add_method('UPDATE', 'set_starname') + # handler.add_method('UPDATE', 'set_star_name') # handler.add_method('UPDATE', 'new_particle') def define_methods(self, handler): @@ -3503,7 +3534,7 @@ def define_methods(self, handler): StellarEvolution.define_methods(self, handler) handler.add_method( "new_particle", - (units.MSun, handler.NO_UNIT, handler.NO_UNIT), + (units.MSun, handler.NO_UNIT, handler.NO_UNIT, handler.NO_UNIT), (handler.INDEX, handler.ERROR_CODE) ) @@ -3741,7 +3772,7 @@ def new_particle_from_model( internal_structure['veryFirst'], # Characteristics internal_structure['initialised'], - internal_structure['starname'], + internal_structure['star_name'], internal_structure['nwmd'], internal_structure['nwseq'], internal_structure['modanf'], @@ -3764,7 +3795,7 @@ def new_particle_from_model( internal_structure['const_per'], internal_structure['iprezams'], # Composition - internal_structure['zinit'], + internal_structure['initial_metallicity'], internal_structure['zsol'], internal_structure['z'], internal_structure['iopac'], @@ -3781,7 +3812,7 @@ def new_particle_from_model( internal_structure['K_Kawaler'], internal_structure['Omega_saturation'], internal_structure['rapcrilim'], - internal_structure['vwant'], + internal_structure['zams_velocity'], internal_structure['xfom'], internal_structure['omega'], internal_structure['xdial'], From 71bb23797838965902f1c4972633c0df0e724601 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 14 Jun 2023 14:47:42 +0200 Subject: [PATCH 65/72] Updates --- src/amuse/community/genec/interface.f90 | 40 ++++++++++++++--------- src/amuse/community/genec/interface.py | 43 +++++++++++++++++++------ 2 files changed, 58 insertions(+), 25 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index f82d0522f9..d19a59c3fc 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1,10 +1,12 @@ module AmuseInterface use storage, only:& - InitialGenecStar,& GenecStar,genec_star use helpers, only:& - copy_to_genec_star,copy_namelists_from_genec_star,copy_from_genec_star,& - copy_structure_from_genec_star,copy2_from_genec_star + copy_to_genec_star,& + copy_namelists_from_genec_star,& + copy_from_genec_star,& + copy_structure_from_genec_star,& + copy2_from_genec_star use evol, only: kindreal,ldi,npondcouche type(genec_star) :: BackupBackupGenecStar @@ -387,17 +389,25 @@ end subroutine restore_network function commit_particles() use makeini, only: make_initial_star use genec, only: initialise_star + use genec, only: evolve, modell, finalise, veryFirst implicit none integer:: commit_particles ! makeini will actually override some things from set_defaults now! FIXME if (.not.GenecStar%initialised) then call make_initial_star() + GenecStar%nzmod = 1 + GenecStar%modell = 1 + GenecStar%n_snap = 0 call copy_from_genec_star(GenecStar) call copy_to_genec_star(GenecStar) endif call init_or_restore_star(GenecStar) GenecStar%initialised = .true. + call evolve() + call finalise() + call copy_to_genec_star(GenecStar) + veryFirst = .false. write(*,*) "COMMIT PARTICLES DONE" commit_particles = 0 end function @@ -658,7 +668,7 @@ function set_mass(index_of_the_star, mass) integer:: set_mass, index_of_the_star real(kindreal):: mass if (.not.GenecStar%initialised) then - InitialGenecStar%initial_mass = mass + GenecStar%initial_mass = mass set_mass = 0 else write(*,*) "This function should not be called when the star is already initialised" @@ -878,7 +888,7 @@ function get_metallicity(metallicity) implicit none real(kindreal):: metallicity integer:: get_metallicity - metallicity = InitialGenecStar%initial_metallicity + metallicity = GenecStar%initial_metallicity get_metallicity = 0 end function @@ -886,7 +896,7 @@ function set_metallicity(metallicity) implicit none real(kindreal):: metallicity integer:: set_metallicity - InitialGenecStar%initial_metallicity = metallicity + GenecStar%initial_metallicity = metallicity set_metallicity = 0 end function @@ -1133,13 +1143,13 @@ function new_particle(index_of_the_star, initial_mass, initial_metallicity, zams integer:: new_particle character(len=12):: star_name number_of_stars = number_of_stars + 1 - InitialGenecStar%star_name = star_name - InitialGenecStar%index_of_the_star = number_of_stars - InitialGenecStar%initial_mass = initial_mass - InitialGenecStar%initial_metallicity = initial_metallicity - InitialGenecStar%zams_velocity = zams_velocity - InitialGenecStar%idefaut = 1 - index_of_the_star = InitialGenecStar%index_of_the_star + GenecStar%star_name = star_name + GenecStar%index_of_the_star = number_of_stars + GenecStar%initial_mass = initial_mass + GenecStar%initial_metallicity = initial_metallicity + GenecStar%zams_velocity = zams_velocity + GenecStar%idefaut = 1 + index_of_the_star = GenecStar%index_of_the_star new_particle = 0 end function @@ -2098,7 +2108,7 @@ integer function get_zams_velocity(index_of_the_particle, zams_velocity) implicit none integer, intent(in):: index_of_the_particle real(kindreal), intent(out):: zams_velocity - zams_velocity = InitialGenecStar%zams_velocity + zams_velocity = GenecStar%zams_velocity get_zams_velocity = 0 end function get_zams_velocity @@ -2107,7 +2117,7 @@ integer function set_zams_velocity(index_of_the_particle, zams_velocity) integer, intent(in):: index_of_the_particle real(kindreal), intent(in):: zams_velocity if (.not.GenecStar%initialised) then - InitialGenecStar%zams_velocity = zams_velocity + GenecStar%zams_velocity = zams_velocity set_zams_velocity = 0 else write(*,*) "This function should not be called when the star is already initialised" diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index dd66c52f75..d30c2beb52 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -11,6 +11,7 @@ from amuse.community import CodeWithDataDirectories from amuse.community import InCodeComponentImplementation from amuse.community import NO_UNIT, ERROR_CODE +from amuse.community.interface import common from amuse.community.interface.se import StellarEvolution from amuse.community.interface.se import StellarEvolutionInterface from amuse.community.interface.se import InternalStellarStructure @@ -60,7 +61,7 @@ # 'GENEC name': [dtype, unit, description, AMUSE name (optional)] 'initialised': ['bool', '', "True if the star is an intialised model"], 'star_name': ['string', '', "Name of the star"], - 'nwmd': ['int32', '', "model number"], + 'nwmd': ['int32', '', "model number", "step"], 'nwseq': [ 'int32', '', "number of the first model in the time-step series" ], @@ -374,7 +375,7 @@ 'glsv': ['float64', 'LSun', "previous luminosity"], 'teffv': ['float64', 'K', "previous temperature"], 'dzeitj': ['float64', 'yr', "time step (yr)", ""], - 'dzeit': ['float64', 's', "time step (s)", "time_step"], + 'dzeit': ['float64', 's', "time step (s)", ""], 'dzeitv': ['float64', 's', "previous time step", ""], 'xmini': ['float64', 'MSun', "initial mass", "initial_mass"], 'ab': ['float64', '', "binary separation", ""], @@ -1917,12 +1918,12 @@ def set_teffv( @remote_function(can_handle_array=True) def get_dzeitj(index_of_the_particle='i'): - returns (dzeitj='float64' | units.yr) + returns (dzeitj='float64' | units.julianyr) @remote_function(can_handle_array=True) def set_dzeitj( index_of_the_particle='i', - dzeitj='float64' | units.yr, + dzeitj='float64' | units.julianyr, ): returns () @@ -1937,6 +1938,12 @@ def set_dzeit( ): returns () + @remote_function(can_handle_array=True) + def get_time_step( + index_of_the_particle='i', + ): + returns (time_step='float64' | units.s) + @remote_function(can_handle_array=True) def set_time_step( index_of_the_particle='i', @@ -3440,22 +3447,30 @@ def define_particle_sets(self, handler): # ) def define_state(self, handler): - StellarEvolution.define_state(self, handler) + common.CommonCode.define_state(self, handler) + # StellarEvolution.define_state(self, handler) # InternalStellarStructure.define_state(self, handler) # Only allow setting of star_name in EDIT or UPDATE states # I.e. must do initialize_code and commit_parameters FIRST! # Initialized (initialize_code) - # handler.add_method + handler.add_transition('UNINITIALIZED', 'INITIALIZED', 'initialize_code') # -> Edit (commit_parameters) + handler.add_transition('INITIALIZED', 'EDIT', 'commit_parameters') # handler.add_method('EDIT', 'set_star_name') - # handler.add_method('EDIT', 'new_particle') + handler.add_method('EDIT', 'new_particle') + handler.add_method('UPDATE', 'new_particle') + + handler.add_transition( + 'RUN', 'UPDATE', 'finalize_stellar_model', False) # -> Run (commit_particles) - # handler.add_transition('EDIT', 'RUN', 'commit_particles') - # handler.add_method('RUN', 'evolve_one_step') + handler.add_transition('EDIT', 'RUN', 'commit_particles') + handler.add_transition('EDIT', 'UPDATE', 'commit_particles') + handler.add_method('RUN', 'evolve_one_step') + handler.add_method('!UPDATE', 'evolve_one_step') # -> Update handler.add_transition('RUN', 'UPDATE', 'finalize_stellar_model') @@ -3502,9 +3517,10 @@ def define_state(self, handler): handler.add_method( state, f'get_mass_fraction_of_{species}_at_zone' ) - for state in ["EDIT", "UPDATE"]: + for state in ["EDIT", "UPDATE", "!RUN"]: for parameter in ALL_SETTERS: handler.add_method(state, f'set_{parameter[0]}') + handler.add_method(state, 'set_time_step') handler.add_method('UPDATE', 'set_n_snap') # handler.add_method('UPDATE', 'set_ipoly') @@ -3544,6 +3560,13 @@ def define_methods(self, handler): # (handler.INDEX, handler.ERROR_CODE) # ) + # specifically add this here since the unit is different + handler.add_method( + "get_time_step", + (handler.INDEX,), + (units.s, handler.ERROR_CODE,) + ) + handler.add_method( "get_surface_velocity", (handler.INDEX), From 1746fe9cba5d6aef2f419e07c85eb87cc0c40c7a Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 19 Jun 2023 12:10:55 +0200 Subject: [PATCH 66/72] fix for changing initial parameters of the star --- src/amuse/community/genec/interface.f90 | 20 +++++++++----------- src/amuse/community/genec/interface.py | 2 ++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index d19a59c3fc..9129f2625c 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -387,28 +387,19 @@ subroutine restore_network(z) end subroutine restore_network function commit_particles() - use makeini, only: make_initial_star use genec, only: initialise_star use genec, only: evolve, modell, finalise, veryFirst implicit none integer:: commit_particles ! makeini will actually override some things from set_defaults now! FIXME - if (.not.GenecStar%initialised) then - call make_initial_star() - GenecStar%nzmod = 1 - GenecStar%modell = 1 - GenecStar%n_snap = 0 - call copy_from_genec_star(GenecStar) - call copy_to_genec_star(GenecStar) - endif + call copy_from_genec_star(GenecStar) call init_or_restore_star(GenecStar) GenecStar%initialised = .true. call evolve() call finalise() call copy_to_genec_star(GenecStar) veryFirst = .false. - write(*,*) "COMMIT PARTICLES DONE" commit_particles = 0 end function @@ -1137,6 +1128,7 @@ function get_time(time) end function function new_particle(index_of_the_star, initial_mass, initial_metallicity, zams_velocity, star_name) + use makeini, only: make_initial_star implicit none integer:: index_of_the_star, key real(kindreal):: initial_mass, initial_metallicity, zams_velocity @@ -1150,7 +1142,13 @@ function new_particle(index_of_the_star, initial_mass, initial_metallicity, zams GenecStar%zams_velocity = zams_velocity GenecStar%idefaut = 1 index_of_the_star = GenecStar%index_of_the_star - + + call make_initial_star() + GenecStar%nzmod = 1 + GenecStar%modell = 1 + GenecStar%n_snap = 0 + call copy_from_genec_star(GenecStar) + call copy_to_genec_star(GenecStar) new_particle = 0 end function diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index d30c2beb52..5d060b6e40 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -3521,6 +3521,8 @@ def define_state(self, handler): for parameter in ALL_SETTERS: handler.add_method(state, f'set_{parameter[0]}') handler.add_method(state, 'set_time_step') + for state in ["!UPDATE"]: + handler.add_method(state, "set_bintide") handler.add_method('UPDATE', 'set_n_snap') # handler.add_method('UPDATE', 'set_ipoly') From 8351231b3e1db274163af61529f3da890d27a18f Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 19 Jun 2023 15:26:33 +0200 Subject: [PATCH 67/72] more updates! --- examples/code_examples/genec/plot_models.py | 18 +- .../genec/test_integrate_default_star.py | 17 +- .../genec/test_integrate_difficult_star.py | 68 ++--- src/amuse/community/genec/interface.f90 | 273 ------------------ src/amuse/community/genec/interface.py | 85 +++++- 5 files changed, 126 insertions(+), 335 deletions(-) diff --git a/examples/code_examples/genec/plot_models.py b/examples/code_examples/genec/plot_models.py index 85d74da591..efba5ecc98 100644 --- a/examples/code_examples/genec/plot_models.py +++ b/examples/code_examples/genec/plot_models.py @@ -443,9 +443,9 @@ def plot_gradient(self): return ax = self.__axes[title] mass_profile = self.star.get_cumulative_mass_profile() - nabla_rad = self.star.nabla_rad_profile - nabla_ad = self.star.nabla_ad_profile - nabla_mu = self.star.nabla_mu_profile + nabla_rad = self.star.get_nabla_rad_profile() + nabla_ad = self.star.get_nabla_ad_profile() + nabla_mu = self.star.get_nabla_mu_profile() min_nabla = min( min(nabla_ad), min(nabla_rad), @@ -477,7 +477,7 @@ def initialise_luminosity_energy_production(self): ax_energy.set_xlim(0, 1) ax_lum.set_xlabel('M$_{\\rm r}$/M$_{\\rm tot}$') mass_profile = self.star.get_cumulative_mass_profile() - luminosity_profile = self.star.luminosity_profile.value_in( + luminosity_profile = self.star.get_luminosity_profile().value_in( units.LSun ) luminosity_profile = luminosity_profile / max(luminosity_profile) @@ -532,7 +532,7 @@ def plot_luminosity_energy_production(self): ax_lum = self.__axes[title][0] ax_energy = self.__axes[title][1] mass_profile = self.star.get_cumulative_mass_profile() - luminosity_profile = self.star.luminosity_profile.value_in( + luminosity_profile = self.star.get_luminosity_profile().value_in( units.LSun ) luminosity_profile = luminosity_profile / max(luminosity_profile) @@ -581,10 +581,10 @@ def initialise_temperature_pressure(self): ax_pres.set_ylabel('log(P)') mass_profile = self.star.get_cumulative_mass_profile() temperature_profile = np.log10( - self.star.temperature_profile.value_in(units.K) + self.star.get_temperature_profile().value_in(units.K) ) pressure_profile = np.log10( - self.star.pressure_profile.number + self.star.get_pressure_profile().number ) plot_temp, = ax.plot( mass_profile, temperature_profile, label="temp", @@ -617,10 +617,10 @@ def plot_temperature_pressure(self): ax_pres = self.__axes[title][1] mass_profile = self.star.get_cumulative_mass_profile() temperature_profile = np.log10( - self.star.temperature_profile.value_in(units.K) + self.star.get_temperature_profile().value_in(units.K) ) pressure_profile = np.log10( - self.star.pressure_profile.number + self.star.get_pressure_profile().number ) for i in (0, 1): self.__temp_pres_plots[i].set_xdata( diff --git a/examples/code_examples/genec/test_integrate_default_star.py b/examples/code_examples/genec/test_integrate_default_star.py index 81976e93a6..656df557c9 100644 --- a/examples/code_examples/genec/test_integrate_default_star.py +++ b/examples/code_examples/genec/test_integrate_default_star.py @@ -115,7 +115,6 @@ def write_backup( # ) return -ROTATING_STAR = False MASS_UNIT = units.MSun LENGTH_UNIT = units.RSun SPEED_UNIT = units.kms @@ -150,20 +149,13 @@ def write_backup( mass=7.0 | units.MSun, metallicity=0.014, starname="AmuseStar", + zams_velocity=0., ) evo = Genec(redirection="none") -# evo.parameters.idebug = 2 # evo = Genec() -if ROTATING_STAR: - star.vwant = 0.7 -else: - star.vwant = 0.0 -star.ipoly = 0 # NOTE: this will now reset parameters... star_in_evo = evo.particles.add_particle(star) -# evo.parameters.idebug = 2 -# print(star_in_evo) font = { 'size': 8, @@ -188,7 +180,6 @@ def write_backup( plotting = StellarModelPlot(star_in_evo) # evo.parameters.nzmod = 100 -evo.parameters.n_snap = 0 print("age mass radius temp lum phase vequat h0 vwant xcn") while True: @@ -213,13 +204,9 @@ def write_backup( star.radius.in_(units.RSun), star.temperature.in_(units.K), star.luminosity.in_(units.LSun), - # star.phase, star.surface_velocity, - star.abundance_h[0], - star.vwant, - star.xcn, ) - print(f"step: {step} time: {star.age} timestep: {star.time_step} xcn: {evo.parameters.xcn}") + print(f"step: {step} time: {star.age} timestep: {star.time_step}") if (step % store_every == 0) and plotting is not None: plotting.update(star_in_evo) if ( diff --git a/examples/code_examples/genec/test_integrate_difficult_star.py b/examples/code_examples/genec/test_integrate_difficult_star.py index dc0a62667c..6f13461864 100644 --- a/examples/code_examples/genec/test_integrate_difficult_star.py +++ b/examples/code_examples/genec/test_integrate_difficult_star.py @@ -1,3 +1,4 @@ +import sys import numpy import time @@ -22,6 +23,7 @@ logger = logging.getLogger(__name__) # logger.setLevel(logging.DEBUG) + class NeedToSave: def __init__(self): self.model = 0 @@ -112,15 +114,14 @@ def write_backup( # ) return -ROTATING_STAR = True MASS_UNIT = units.MSun LENGTH_UNIT = units.RSun SPEED_UNIT = units.kms -TIME_UNIT = units.Myr -MASSLOSS_UNIT = units.MSun / units.yr +TIME_UNIT = units.mega(units.julianyr) +MASSLOSS_UNIT = units.MSun / units.julianyr TEMPERATURE_UNIT = units.K LUMINOSITY_UNIT = units.LSun -SPEEDUP_UNIT = units.Myr / units.minute +SPEEDUP_UNIT = units.mega(units.julianyr) / units.minute set_printing_strategy( "custom", preferred_units=[ @@ -139,25 +140,19 @@ def write_backup( mass=60 | units.MSun, metallicity=0.014, ) -star = Particle(mass=60.0 | units.MSun, metallicity=0.014, starname="RotatingStar") -evo = Genec(redirection="none") -# evo = Genec() -if ROTATING_STAR: - evo.parameters.vwant = 0.7 - evo.parameters.ianiso = 1 - # evo.parameters.irot = 1 - # evo.parameters.starname = "AmuseDifficultStar" -else: - evo.parameters.vwant = 0.0 -evo.parameters.ipoly = 0 -star_in_evo = evo.fullparticles.add_particle(star) -# evo.parameters.idebug = 2 -# for p in params.items(): -# setattr(evo.parameters, p[0], p[1]) -# evo.commit_particles() -# print(evo.parameters) -# print(star_in_evo) +star = Particle( + mass=60.0 | units.MSun, + metallicity=0.014, + starname="RotatingStar", + zams_velocity=0.7, +) +# evo = Genec(redirection="none") +evo = Genec() + +star_in_evo = evo.particles.add_particle(star) +star_in_evo.anisotropic_wind = True + font = { 'size': 8, } @@ -178,13 +173,14 @@ def write_backup( age_of_last_plot = star_in_evo.age plotting = None -plotting = StellarModelPlot(star_in_evo) +# plotting = StellarModelPlot(star_in_evo) # evo.parameters.nzmod = 100 -evo.parameters.n_snap = 0 +print(star_in_evo) +print(dir(star_in_evo)) print("age mass radius temp lum phase vequat h0 vwant xcn") -while True: +while star_in_evo.step < 61: time_elapsed = (time.time() | units.s) - time_start star = star_in_evo.copy() # number_of_zones = star_in_evo.get_number_of_zones() @@ -195,24 +191,22 @@ def write_backup( # pressure_profile = star_in_evo.get_pressure_profile() chemical_abundance_profile = star_in_evo.get_chemical_abundance_profiles() - # print(evo.fullparticles[0]) - # print(evo.fullparticles[0].get_number_of_species()) - # print(evo.fullparticles[0].get_names_of_species()) - # print(evo.fullparticles[0].get_mass_profile()) + # print(evo.particles[0]) + # print(evo.particles[0].get_number_of_species()) + # print(evo.particles[0].get_names_of_species()) + # print(evo.particles[0].get_mass_profile()) # exit() print( - star.age.in_(units.Myr), + star.age.in_(units.mega(units.julianyr)), star.mass.in_(units.MSun), star.radius.in_(units.RSun), star.temperature.in_(units.K), star.luminosity.in_(units.LSun), - star.phase, star.surface_velocity, - star.abundance_h[0], - evo.parameters.vwant, - evo.parameters.xcn, + star_in_evo.get_ialflu(), + star_in_evo.anisotropic_wind, ) - print(f"step: {step} time: {star.age} timestep: {star.time_step} xcn: {evo.parameters.xcn}") + print(f"step: {step} time: {star.age} timestep: {star.time_step}") if (step % store_every == 0) and plotting is not None: plotting.update(star_in_evo) if ( @@ -220,9 +214,9 @@ def write_backup( or step - model_of_last_plot > plot_models ): speed = ( - (star.age - age_of_last_plot).value_in(units.Myr) + (star.age - age_of_last_plot).value_in(units.mega(units.julianyr)) / (time_elapsed - time_of_last_plot).value_in(units.minute) - ) | units.Myr / units.minute + ) | units.mega(units.julianyr) / units.minute plotting.plot_all(speed=speed, step=step) model_of_last_plot = step time_of_last_plot = time_elapsed diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 9129f2625c..164066e036 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1106,9 +1106,6 @@ function get_time_step(index_of_the_star, time_step) real(kindreal):: time_step integer:: get_time_step get_time_step = get_dzeit(index_of_the_star, time_step) - !time_step = GenecStar%dzeitj - !time_step = GenecStar%dzeit - !get_time_step = 0 end function function set_time_step(index_of_the_star, time_step) @@ -1152,256 +1149,6 @@ function new_particle(index_of_the_star, initial_mass, initial_metallicity, zams new_particle = 0 end function -!function new_stellar_model(& -! integer_of_the_star,& -! initialised, starname, nwseq, modanf, nzmod, end_at_phase, end_at_model, irot, isol, imagn, ialflu, ianiso, ipop3,& -! ibasnet, phase, var_rates, bintide, binm2, periodini, const_per, iprezams, zinit, zsol, z, iopac, ikappa, idiff, iadvec,& -! istati, icoeff, fenerg, richac, igamma, frein, K_Kawaler, Omega_saturation, rapcrilim, vwant, xfom, omega, xdial, idialo,& -! idialu, Add_Flux, diff_only, B_initial, add_diff, n_mag, alpha_F, nsmooth, qminsmooth, imloss, fmlos, ifitm, fitm, fitmi,& -! deltal, deltat, nndr, RSG_Mdot, SupraEddMdot, Be_mdotfrac, start_mdot, iledou, idifcon, iover, elph, my, dovhp, iunder,& -! dunder, gkorm, alph, agdr, faktor, dgrp, dgrl, dgry, dgrc, dgro, dgr20, nbchx, nrband, xcn, islow, icncst, tauH_fit,& -! display_plot, iauto, iprn, iout, itmin, xyfiles, idebug, itests, verbose, stop_deg, n_snap,& -! m,gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,dm_lost,& -! mbelx,xtefflast,xllast,xrholast,xclast,xtclast,inum,nsugi,period,r_core,vna,vnr,& -! q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& -! xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& -! vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26,vxneut,vxprot,vomegi,& -! vxbid,vxbid1,& -! abelx,vabelx& -! ) -! implicit none -! integer:: integer_of_the_star -! logical, intent(in):: & -! initialised,var_rates,bintide,const_per,Add_Flux,diff_only,qminsmooth,SupraEddMdot,display_plot,xyfiles,verbose,& -! stop_deg -! integer, intent(in):: & -! nwseq,modanf,nzmod,end_at_phase,end_at_model,irot,isol,imagn,ialflu,ianiso,ipop3,ibasnet,phase,iprezams,iopac,ikappa,& -! idiff,iadvec,istati,icoeff,igamma,idialo,idialu,n_mag,nsmooth,imloss,ifitm,nndr,RSG_Mdot,iledou,idifcon,iover,my,& -! iunder,nbchx,nrband,islow,icncst,tauH_fit,iauto,iprn,iout,itmin,idebug,itests,n_snap -! real(kindreal), intent(in):: & -! binm2,periodini,zinit,zsol,z,fenerg,richac,frein,K_Kawaler,Omega_saturation,rapcrilim,vwant,xfom,omega,xdial,& -! B_initial,add_diff,alpha_F,fmlos,fitm,fitmi,deltal,deltat,Be_mdotfrac,start_mdot,elph,dovhp,dunder,gkorm,alph,& -! agdr,faktor,dgrp,dgrl,dgry,dgrc,dgro,dgr20,xcn -! character(len=200), intent(in):: & -! starname -! integer, intent(in) :: m -! real(kindreal), intent(in) :: & -! gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,summas,ab,& -! dm_lost -! !real(kindreal), dimension(ldi) :: & -! integer, intent(in):: mbelx -! integer, intent(in):: inum,nsugi -! real(kindreal), intent(in):: & -! xtefflast,xllast,xrholast,xclast,xtclast,period,r_core,vna,vnr -! real(kindreal), dimension(m), intent(in):: & -! q,p,t,r,s,x,y3,y,xc12,xc13,xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,& -! xc14,xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,vxo17,vxo18,& -! vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,vxal26,vxneut,vxprot,vomegi,& -! vxbid,vxbid1 -! real(kindreal), dimension(mbelx,m), intent(in):: & -! abelx,vabelx -! integer:: new_stellar_model -! -! GenecStar%initialised = initialised -! GenecStar%starname = starname -! !GenecStar%nwmd = nwmd -! GenecStar%nwseq = nwseq -! GenecStar%modanf = modanf -! GenecStar%nzmod = nzmod -! GenecStar%end_at_phase = end_at_phase -! GenecStar%end_at_model = end_at_model -! GenecStar%irot = irot -! GenecStar%isol = isol -! GenecStar%imagn = imagn -! GenecStar%ialflu = ialflu -! GenecStar%ianiso = ianiso -! GenecStar%ipop3 = ipop3 -! GenecStar%ibasnet = ibasnet -! GenecStar%phase = phase -! GenecStar%iprezams = iprezams -! GenecStar%var_rates = var_rates -! GenecStar%bintide = bintide -! GenecStar%binm2 = binm2 -! GenecStar%periodini = periodini -! GenecStar%const_per = const_per -! GenecStar%iopac = iopac -! GenecStar%ikappa = ikappa -! GenecStar%zinit = zinit -! GenecStar%zsol = zsol -! GenecStar%z = z -! GenecStar%idiff = idiff -! GenecStar%iadvec = iadvec -! GenecStar%istati = istati -! GenecStar%icoeff = icoeff -! GenecStar%igamma = igamma -! GenecStar%idialo = idialo -! GenecStar%idialu = idialu -! GenecStar%n_mag = n_mag -! GenecStar%nsmooth = nsmooth -! GenecStar%fenerg = fenerg -! GenecStar%richac = richac -! GenecStar%frein = frein -! GenecStar%K_Kawaler = K_Kawaler -! GenecStar%Omega_saturation = Omega_saturation -! GenecStar%rapcrilim = rapcrilim -! GenecStar%vwant = vwant -! GenecStar%xfom = xfom -! GenecStar%omega = omega -! GenecStar%xdial = xdial -! GenecStar%B_initial = B_initial -! GenecStar%add_diff = add_diff -! GenecStar%alpha_F = alpha_F -! GenecStar%Add_Flux = Add_Flux -! GenecStar%diff_only = diff_only -! GenecStar%qminsmooth = qminsmooth -! GenecStar%imloss = imloss -! GenecStar%ifitm = ifitm -! GenecStar%nndr = nndr -! GenecStar%RSG_Mdot = RSG_Mdot -! GenecStar%fmlos = fmlos -! GenecStar%fitm = fitm -! GenecStar%fitmi = fitmi -! GenecStar%deltal = deltal -! GenecStar%deltat = deltat -! GenecStar%Be_mdotfrac = Be_mdotfrac -! GenecStar%start_mdot = start_mdot -! GenecStar%SupraEddMdot = SupraEddMdot -! GenecStar%iledou = iledou -! GenecStar%idifcon = idifcon -! GenecStar%my = my -! GenecStar%iover = iover -! GenecStar%iunder = iunder -! GenecStar%elph = elph -! GenecStar%dovhp = dovhp -! GenecStar%dunder = dunder -! GenecStar%nbchx = nbchx -! GenecStar%nrband = nrband -! GenecStar%gkorm = gkorm -! GenecStar%alph = alph -! GenecStar%agdr = agdr -! GenecStar%faktor = faktor -! GenecStar%dgrp = dgrp -! GenecStar%dgrl = dgrl -! GenecStar%dgry = dgry -! GenecStar%dgrc = dgrc -! GenecStar%dgro = dgro -! GenecStar%dgr20 = dgr20 -! GenecStar%islow = islow -! GenecStar%icncst = icncst -! GenecStar%tauH_fit = tauH_fit -! GenecStar%xcn = xcn -! GenecStar%iauto = iauto -! GenecStar%iprn = iprn -! GenecStar%iout = iout -! GenecStar%itmin = itmin -! GenecStar%idebug = idebug -! GenecStar%itests = itests -! GenecStar%n_snap = n_snap -! GenecStar%display_plot = display_plot -! GenecStar%xyfiles = xyfiles -! GenecStar%verbose = verbose -! GenecStar%stop_deg = stop_deg -! -! GenecStar%m = m -! GenecStar%gms = gms -! GenecStar%alter = alter -! GenecStar%gls = gls -! GenecStar%teff = teff -! GenecStar%glsv = glsv -! GenecStar%teffv = teffv -! GenecStar%dzeitj = dzeitj -! GenecStar%dzeit = dzeit -! GenecStar%dzeitv = dzeitv -! GenecStar%summas = summas -! GenecStar%xmini = xmini -! GenecStar%ab = ab -! GenecStar%dm_lost = dm_lost -! -! GenecStar%mbelx = mbelx -! GenecStar%xteffprev = xteffprev -! GenecStar%xlprev = xlprev -! GenecStar%xrhoprev = xrhoprev -! GenecStar%xcprev = xcprev -! GenecStar%xtcprev = xtcprev -! GenecStar%inum = inum -! GenecStar%nsugi = nsugi -! GenecStar%period = period -! GenecStar%r_core = r_core -! GenecStar%vna = vna -! GenecStar%vnr = vnr -! -! GenecStar%q = q -! GenecStar%p = p -! GenecStar%t = t -! GenecStar%r = r -! GenecStar%s = s -! GenecStar%x = x -! GenecStar%y = y -! GenecStar%xc12 = xc12 -! GenecStar%vp = vp -! GenecStar%vt = vt -! GenecStar%vr = vr -! GenecStar%vs = vs -! GenecStar%xo16 = xo16 -! GenecStar%vx = vx -! GenecStar%vy = vy -! GenecStar%vxc12 = vxc12 -! GenecStar%vxo16 = vxo16 -! GenecStar%y3 = y3 -! GenecStar%xc13 = xc13 -! GenecStar%xn14 = xn14 -! GenecStar%xn15 = xn15 -! GenecStar%xo17 = xo17 -! GenecStar%xo18 = xo18 -! GenecStar%vy3 = vy3 -! GenecStar%vxc13 = vxc13 -! GenecStar%vxn14 = vxn14 -! GenecStar%vxn15 = vxn15 -! GenecStar%vxo17 = vxo17 -! GenecStar%vxo18 = vxo18 -! GenecStar%xne20 = xne20 -! GenecStar%xne22 = xne22 -! GenecStar%xmg24 = xmg24 -! GenecStar%xmg25 = xmg25 -! GenecStar%xmg26 = xmg26 -! GenecStar%vxne20 = vxne20 -! GenecStar%vxne22 = vxne22 -! GenecStar%vxmg24 = vxmg24 -! GenecStar%vxmg25 = vxmg25 -! GenecStar%vxmg26 = vxmg26 -! GenecStar%omegi = omegi -! GenecStar%vomegi = vomegi -! GenecStar%xf19 = xf19 -! GenecStar%xne21 = xne21 -! GenecStar%xna23 = xna23 -! GenecStar%xal26 = xal26 -! GenecStar%xal27 = xal27 -! GenecStar%xsi28 = xsi28 -! GenecStar%vxf19 = vxf19 -! GenecStar%vxne21 = vxne21 -! GenecStar%vxna23 = vxna23 -! GenecStar%vxal26 = vxal26 -! GenecStar%vxal27 = vxal27 -! GenecStar%vxsi28 = vxsi28 -! GenecStar%xneut = xneut -! GenecStar%xprot = xprot -! GenecStar%xc14 = xc14 -! GenecStar%xf18 = xf18 -! GenecStar%xbid = xbid -! GenecStar%xbid1 = xbid1 -! GenecStar%vxneut = vxneut -! GenecStar%vxprot = vxprot -! GenecStar%vxc14 = vxc14 -! GenecStar%vxf18 = vxf18 -! GenecStar%vxbid = vxbid -! GenecStar%vxbid1 = vxbid1 -! -! GenecStar%abelx = abelx -! GenecStar%vabelx = vabelx -! -! new_stellar_model = 0 -!end function - function recommit_parameters() implicit none integer:: recommit_parameters @@ -1409,26 +1156,8 @@ function recommit_parameters() end function function recommit_particles() - !use genec, only: initialise_star implicit none integer:: recommit_particles - !write(*,*) "copy from GenecStar" - !call copy_from_genec_star(GenecStar) - - ! "read" GENEC star namelists - !write(*,*) "call copy_namelists_from_genec_star(GenecStar)" - !call copy_namelists_from_genec_star(GenecStar) - !! Initialise values not in GENEC star - !! but this also resets some values that are read, so... - !write(*,*) 'call initialise_star()' - !call initialise_star() - !! "read" the GENEC star structure - !write(*,*) 'call copy_structure_from_genec_star(GenecStar)' - !call copy_structure_from_genec_star(GenecStar) - !! and then copy back - some things may have changed? - !write(*,*) 'call copy_to_genec_star(GenecStar)' - !call copy_to_genec_star(GenecStar) - write(*,*) "recommit particles after a change" call copy_from_genec_star(GenecStar) recommit_particles = 0 end function @@ -1459,8 +1188,6 @@ function set_temperature_at_zone(index_of_the_star, zone, T_i) - - !!!!!!!!! integer function get_modell(index_of_the_particle, modell) implicit none diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 5d060b6e40..9a1c88228e 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -76,7 +76,7 @@ 'isol': ['int32', '', "solid rotation if set to 1"], 'imagn': ['int32', '', "internal magnetic fields (0=none, 1=included)"], 'ialflu': ['int32', '', "Ne-Na and Mg-Al networks if set to 1"], - 'ianiso': ['int32', '', "wind anisotropy if set to 1"], + 'ianiso': ['int32', '', "wind anisotropy if set to 1", "anisotropic_wind"], 'ipop3': ['int32', '', "Z=0 models if set to 1"], 'ibasnet': ['int32', '', "extended nuclear network if set to 1"], 'phase': ['int32', '', "fusion phases"], @@ -3367,6 +3367,18 @@ def define_particle_sets(self, handler): f'set_{parameter[0]}', names=names, ) + elif parameter[0] not in [ + "radius", + ]: + handler.add_method( + set_name, + f'get_{parameter[0]}', + ) + handler.add_method( + set_name, + f'set_{parameter[0]}', + ) + handler.add_getter(set_name, 'get_radius') handler.add_getter( set_name, 'get_surface_velocity', names=('surface_velocity',) @@ -3394,6 +3406,10 @@ def define_particle_sets(self, handler): handler.add_method(set_name, 'get_eps_si_adv_profile') handler.add_method(set_name, 'get_eps_grav_profile') handler.add_method(set_name, 'get_eps_nu_profile') + handler.add_method(set_name, 'get_nabla_rad_profile') + handler.add_method(set_name, 'get_nabla_ad_profile') + handler.add_method(set_name, 'get_nabla_mu_profile') + handler.add_method(set_name, 'get_luminosity_profile') handler.add_method(set_name, 'get_cumulative_mass_profile') handler.add_method(set_name, 'get_mass_fraction_at_zone') @@ -3523,6 +3539,9 @@ def define_state(self, handler): handler.add_method(state, 'set_time_step') for state in ["!UPDATE"]: handler.add_method(state, "set_bintide") + handler.add_method(state, "set_zams_velocity") + for state in ["!EDIT"]: + handler.add_method(state, "set_zams_velocity") handler.add_method('UPDATE', 'set_n_snap') # handler.add_method('UPDATE', 'set_ipoly') @@ -3725,6 +3744,70 @@ def get_cumulative_mass_profile( indices_of_the_stars, number_of_zones=number_of_zones) return frac_profile.cumsum() + def get_nabla_rad_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying nabla_rad profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_m(indices_of_the_stars) + return self.get_nabla_rad_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + + def get_nabla_ad_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying nabla_ad profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_m(indices_of_the_stars) + return self.get_nabla_ad_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + + def get_nabla_mu_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying nabla_mu profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_m(indices_of_the_stars) + return self.get_nabla_mu_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + + def get_luminosity_profile( + self, + indices_of_the_stars, + number_of_zones=None, + ): + indices_of_the_stars = self._check_number_of_indices( + indices_of_the_stars, + action_string="Querying luminosity profiles" + ) + if number_of_zones is None: + number_of_zones = self.get_m(indices_of_the_stars) + return self.get_luminosity_at_zone( + [indices_of_the_stars]*number_of_zones, + list(range(number_of_zones)) | units.none + ) + def get_internal_structure(self, index_of_the_star): internal_structure = { # 'veryFirst': self.get_veryFirst(index_of_the_star), From 77881a33f45c9a811618216989efe43b9a1b6e19 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 19 Jun 2023 22:18:08 +0200 Subject: [PATCH 68/72] fixes for state model --- src/amuse/community/genec/interface.f90 | 4 ---- src/amuse/community/genec/interface.py | 2 -- 2 files changed, 6 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 164066e036..5aca5e5b81 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -6,7 +6,6 @@ module AmuseInterface copy_namelists_from_genec_star,& copy_from_genec_star,& copy_structure_from_genec_star,& - copy2_from_genec_star use evol, only: kindreal,ldi,npondcouche type(genec_star) :: BackupBackupGenecStar @@ -458,9 +457,6 @@ function evolve_one_step(index_of_the_star) integer:: evolve_one_step integer:: original_nzmod - nzmod = 1 - modell = 1 - n_snap = 0 call evolve() call finalise() veryFirst = .false. diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 9a1c88228e..8c25b40cef 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -3484,9 +3484,7 @@ def define_state(self, handler): # -> Run (commit_particles) handler.add_transition('EDIT', 'RUN', 'commit_particles') - handler.add_transition('EDIT', 'UPDATE', 'commit_particles') handler.add_method('RUN', 'evolve_one_step') - handler.add_method('!UPDATE', 'evolve_one_step') # -> Update handler.add_transition('RUN', 'UPDATE', 'finalize_stellar_model') From 8f4234423e984c74ee3b5cee2d73b673851c15da Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 19 Jun 2023 22:18:41 +0200 Subject: [PATCH 69/72] updates for clarity --- src/amuse/community/genec/interface.py | 51 +++++++++++++++++++------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index 8c25b40cef..c792ccb421 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -73,7 +73,11 @@ GENEC_STAR_PHYSICS = { 'irot': ['int32', '', "rotating if set to 1"], - 'isol': ['int32', '', "solid rotation if set to 1"], + 'isol': [ + 'int32', + '', + "solid rotation if set to 1", + ], 'imagn': ['int32', '', "internal magnetic fields (0=none, 1=included)"], 'ialflu': ['int32', '', "Ne-Na and Mg-Al networks if set to 1"], 'ianiso': ['int32', '', "wind anisotropy if set to 1", "anisotropic_wind"], @@ -102,7 +106,12 @@ "initial period of the binary", "binary_initial_period", ], - 'const_per': ['bool', '', "keep constant period if True"], + 'const_per': [ + 'bool', + '', + "keep constant period if True", + "binary_constant_period", + ], 'iprezams': ['int32', '', ""], } @@ -154,7 +163,11 @@ 'zams_velocity' ], 'xfom': ['float64', '', "multiplying factor for surface Ω"], - 'omega': ['float64', '', "surface Ω"], + 'omega': [ + 'float64', + '', + "surface Ω", + ], 'xdial': ['float64', '', ""], 'idialo': ['int32', '', ""], 'idialu': ['int32', '', ""], @@ -168,24 +181,28 @@ "(and not advection) if set to True" ], 'B_initial': [ - 'float64', '', + 'float64', + '', "if >0, switches on the wind quenching, and evolves the magnetic " "field strength according to the conservation of magnetic flux" ], 'add_diff': [ - 'float64', '', + 'float64', + '', "additional viscosity value, used to increase the core-envelope " "coupling" ], 'n_mag': ['int32', '', "type of treatment for magnetic fields"], 'alpha_F': [ - 'float64', '', + 'float64', + '', "α parameter in Fuller+ 2019. Values higher than 1 lower the " "threshold to trigger the instability (Qmin) and increase the " "magnetic viscosity (increased transport)" ], 'nsmooth': [ - 'int32', '', + 'int32', + '', "number of layers used for smoothing the Ω gradient (used by " "Mag_diff_general). Default value is nsmooth=1, recommended " "value for Fuller+ 2019 is nsmooth=5" @@ -198,7 +215,8 @@ GENEC_STAR_SURFACE = { 'imloss': ['int32', '', "choice of the mass-loss prescription"], 'fmlos': [ - 'float64', '', + 'float64', + '', "except for IMLOSS=2 or 3, multiplying factor applied to the mass loss" ], 'ifitm': [ @@ -309,18 +327,25 @@ GENEC_STAR_TIME = { 'xcn': [ - 'float64', '', + 'float64', + '', "multiplying factor applied on the time step for the next run" ], 'islow': [ - 'int32', '', + 'int32', + '', "slow version of the program if not 0 by modification of the ideal " "nuclear time step ratxcn" ], - 'icncst': ['int32', '', "constant time step (equivalent to xcn=1.0)"], + 'icncst': [ + 'int32', + '', + "constant time step (equivalent to xcn=1.0)", + ], 'tauH_fit': [ - 'int32', '', - "used to set the maximal timestep in case of critical velocity, as a " + 'int32', + '', + "used to set the maximum timestep in case of critical velocity, as a " "fraction of the MS lifetime" ], } From ea50c34380de2e0211a49b2d41f857433583f815 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 27 Jun 2023 08:17:37 +0200 Subject: [PATCH 70/72] updates --- src/amuse/community/genec/interface.f90 | 174 +++++++++++++++--------- src/amuse/community/genec/interface.py | 161 +++++++++++----------- 2 files changed, 192 insertions(+), 143 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 5aca5e5b81..383e6ea1f5 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -100,7 +100,8 @@ subroutine init_or_restore_star(Star) !nwseqini = nwseq ! Initial model - if (modanf == 0) then + if (.not.Star%initialised) then + write(*,*) "Unititialised star, initialising" ! security if initial file is missing the iprezams parameter if (vwant>epsilon(vwant) .and. iprezams==0) then write(*,*) 'VWANT/=0 --> IPREZAMS set to 1' @@ -196,8 +197,8 @@ subroutine init_or_restore_star(Star) vs(:)=vs(:)*um veryFirst = .true. - else ! modanf > 0 - + else ! already initialised + write(*,*) "Already initialised star, just copying" call copy_structure_from_genec_star(Star) !write(*,*) 's1/vs1 (helpers): ', s(1), vs(1) @@ -236,7 +237,7 @@ subroutine init_or_restore_star(Star) !write(*,*) 'call fitmshift' !call fitmshift - endif ! modanf + endif ! Star%initialised ! ftfp initialisation call initgeo @@ -267,6 +268,9 @@ integer function initialize_code() !io_logs = 6 input_dir = "./src/GENEC/code" call initialise_genec() + ! Send output to /dev/null + open(io_logs, file='/dev/null', status='unknown',form='formatted',access='append') + initialize_code = 0 end function @@ -280,7 +284,9 @@ integer function read_genec_model(index_of_the_star, cardfilename) end function integer function cleanup_code() + use io_definitions implicit none + close(io_logs) cleanup_code = 0 end function @@ -306,11 +312,12 @@ integer function get_min_timestep_stop_condition(min_timestep_stop_condition) get_min_timestep_stop_condition = 0 end function -function finalize_stellar_model() +integer function finalize_stellar_model() + !use genec, only: finalise implicit none - integer:: finalize_stellar_model + write(*,*) "FINALIZE_STELLAR_MODEL" !write(*,*) "copy to GenecStar" - !call copy_to_genec_star(GenecStar) + call copy_to_genec_star(GenecStar) !write(*,*) GenecStar finalize_stellar_model = 0 end function @@ -388,15 +395,23 @@ end subroutine restore_network function commit_particles() use genec, only: initialise_star use genec, only: evolve, modell, finalise, veryFirst + use genec, only: nzmod, modanf, m implicit none integer:: commit_particles + integer:: nzmod_tmp ! makeini will actually override some things from set_defaults now! FIXME call copy_from_genec_star(GenecStar) call init_or_restore_star(GenecStar) - GenecStar%initialised = .true. - call evolve() - call finalise() + if (.not. GenecStar%initialised) then + GenecStar%initialised = .true. + nzmod_tmp = nzmod + nzmod = 1 + call evolve() + !modanf = 1 + nzmod = nzmod_tmp + call finalise() + endif call copy_to_genec_star(GenecStar) veryFirst = .false. commit_particles = 0 @@ -409,59 +424,58 @@ function delete_star(index_of_the_star) delete_star = -1 ! not supported end function -function evolve_model(end_time) +integer function evolve_model(end_time) + use inputparam, only: end_at_time use timestep, only: alter + use genec, only: evolve implicit none real(kindreal):: end_time - integer:: evolve_model !stopping_condition = "" + end_at_time = end_time + call evolve() - do while (alter < end_time) - !if (stopping_condition == "") then - write(*,*) "Current time: ", alter, ", evolving to: ", end_time - evolve_model = evolve_one_step(0) - end do + !do while (alter < end_time) + ! !if (stopping_condition == "") then + ! !write(*,*) "Current time: ", alter, ", evolving to: ", end_time + ! evolve_model = evolve_one_step(0) + !end do !call copy_to_genec_star(GenecStar) - evolve_model = 0 + evolve_model = 0 !finalize_stellar_model() + end function -function evolve_for(index_of_the_star, time) +integer function evolve_for(index_of_the_star, time) ! get current time ! set max time to current time plus argument ! evolve + use inputparam, only: end_at_time use timestep, only: alter + use genec, only: evolve implicit none integer:: index_of_the_star - real(kindreal):: time, end_time - integer:: evolve_for - end_time = alter+time - do while (alter < end_time) - write(*,*) "Current time: ", alter, ", evolving to: ", end_time - evolve_for = evolve_one_step(index_of_the_star) - end do + real(kindreal):: time + end_at_time = alter+time + write(*,*) "end_at_time: ", end_at_time + call evolve() + !do while (alter < end_time) + !write(*,*) "Current time: ", alter, ", evolving to: ", end_time + !evolve_for = evolve_one_step(index_of_the_star) + !end do !call copy_to_genec_star(GenecStar) - evolve_for = 0 + evolve_for = 0 !finalize_stellar_model() end function -function evolve_one_step(index_of_the_star) - use timestep, only: alter - use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise, veryFirst - use inputparam,only: modanf,nwseq,nzmod,end_at_phase,end_at_model - use genec, only: n_snap - use genec, only: m - use abundmod, only: x +integer function evolve_one_step(index_of_the_star) + use caramodele, only: nwmd + use genec, only: evolve, finalise, veryFirst, modanf implicit none integer:: index_of_the_star - integer:: evolve_one_step - integer:: original_nzmod call evolve() - call finalise() - veryFirst = .false. - call copy_to_genec_star(GenecStar) - evolve_one_step = 0 + nwmd = nwmd+1 + + evolve_one_step = 0 !finalize_stellar_model() end function function write_genec_model() @@ -1120,11 +1134,20 @@ function get_time(time) get_time = 0 end function -function new_particle(index_of_the_star, initial_mass, initial_metallicity, zams_velocity, star_name) +function new_particle(& + index_of_the_star,& + initial_mass,& + initial_metallicity,& + zams_velocity,& + star_name,& + magnetic,& + anisotropic& + ) use makeini, only: make_initial_star implicit none integer:: index_of_the_star, key real(kindreal):: initial_mass, initial_metallicity, zams_velocity + integer:: magnetic, anisotropic integer:: new_particle character(len=12):: star_name number_of_stars = number_of_stars + 1 @@ -1134,6 +1157,8 @@ function new_particle(index_of_the_star, initial_mass, initial_metallicity, zams GenecStar%initial_metallicity = initial_metallicity GenecStar%zams_velocity = zams_velocity GenecStar%idefaut = 1 + GenecStar%imagn = magnetic + GenecStar%ianiso = anisotropic index_of_the_star = GenecStar%index_of_the_star call make_initial_star() @@ -5718,27 +5743,48 @@ end function set_xnetalu function new_stellar_model(& index_of_the_star,& - modell,veryFirst,& - initialised,star_name,nwmd,nwseq,modanf,nzmod,end_at_phase,end_at_model,& - irot,isol,imagn,ialflu,ianiso,ipop3,ibasnet,phase,var_rates,bintide,binm2,periodini,const_per,iprezams,& - initial_metallicity,zsol,z,iopac,ikappa,& - idiff,iadvec,istati,icoeff,fenerg,richac,igamma,frein,K_Kawaler,& - Omega_saturation,rapcrilim,zams_velocity,xfom,omega,xdial,idialo,idialu,Add_Flux,diff_only,B_initial,& - add_diff,n_mag,alpha_F,nsmooth,qminsmooth,& - imloss,fmlos,ifitm,fitm,fitmi,fitmi_default,deltal,deltat,nndr,RSG_Mdot,SupraEddMdot,Be_mdotfrac,start_mdot,& - iledou,idifcon,iover,elph,my,dovhp,iunder,dunder,& - gkorm,alph,agdr,faktor,dgrp,dgrl,dgry,dgrc,dgro,dgr20,nbchx,nrband,& - xcn,islow,icncst,tauH_fit,& - display_plot,iauto,iprn,iout,itmin,xyfiles,idebug,itests,verbose,stop_deg,n_snap,& - gms,alter,gls,teff,glsv,teffv,dzeitj,dzeit,dzeitv,xmini,ab,dm_lost,m,summas,& - dk,rlp,rlt,rlc,rrp,rrt,rrc,rtp,rtt,rtc,tdiff,suminenv,xltotbeg,dlelexprev,radius,zams_radius,& ! new! - mbelx,xtefflast,xllast,xrholast,xclast,xtclast,inum,nsugi,period,r_core,vna,vnr,& - q,p,t,r,s,x,y3,y,xc12,xc13,& - xn14,xn15,xo16,xo17,xo18,xne20,xne22,xmg24,xmg25,xmg26,xf19,xne21,xna23,xal27,xsi28,xc14,& - xf18,xal26,xneut,xprot,omegi,xbid,xbid1,vp,vt,vr,vs,vx,vy,vy3,vxc12,vxc13,vxn14,vxn15,vxo16,& - vxo17,vxo18,vxne20,vxne22,vxmg24,vxmg25,vxmg26,vxf19,vxne21,vxna23,vxal27,vxsi28,vxc14,vxf18,& - vxal26,vxneut,vxprot,vomegi,vxbid,vxbid1,& - xlostneu,& + modell,veryFirst,initialised,star_name,nwmd,& + nwseq,modanf,nzmod,end_at_phase,end_at_model,& + irot,isol,imagn,ialflu,ianiso,& + ipop3,ibasnet,phase,var_rates,bintide,& + binm2,periodini,const_per,iprezams,initial_metallicity,& + zsol,z,iopac,ikappa,idiff,& + iadvec,istati,icoeff,fenerg,richac,& + igamma,frein,K_Kawaler,Omega_saturation,rapcrilim,& + zams_velocity,xfom,omega,xdial,idialo,& + idialu,Add_Flux,diff_only,B_initial,add_diff,& + n_mag,alpha_F,nsmooth,qminsmooth,imloss,& + fmlos,ifitm,fitm,fitmi,fitmi_default,& + deltal,deltat,nndr,RSG_Mdot,SupraEddMdot,& + Be_mdotfrac,start_mdot,iledou,idifcon,iover,& + elph,my,dovhp,iunder,dunder,& + gkorm,alph,agdr,faktor,dgrp,& + dgrl,dgry,dgrc,dgro,dgr20,& + nbchx,nrband,xcn,islow,icncst,& + tauH_fit,display_plot,iauto,iprn,iout,& + itmin,xyfiles,idebug,itests,verbose,& + stop_deg,n_snap,gms,alter,gls,& + teff,glsv,teffv,dzeitj,dzeit,& + dzeitv,xmini,ab,dm_lost,m,& + summas,dk,rlp,rlt,rlc,& + rrp,rrt,rrc,rtp,rtt,& + rtc,tdiff,suminenv,xltotbeg,dlelexprev,& + radius,zams_radius,mbelx,xtefflast,xllast,& + xrholast,xclast,xtclast,inum,nsugi,& + period,r_core,vna,vnr,q,& + p,t,r,s,x,& + y3,y,xc12,xc13,xn14,& + xn15,xo16,xo17,xo18,xne20,& + xne22,xmg24,xmg25,xmg26,xf19,& + xne21,xna23,xal27,xsi28,xc14,& + xf18,xal26,xneut,xprot,omegi,& + xbid,xbid1,vp,vt,vr,& + vs,vx,vy,vy3,vxc12,& + vxc13,vxn14,vxn15,vxo16,vxo17,& + vxo18,vxne20,vxne22,vxmg24,vxmg25,& + vxmg26,vxf19,vxne21,vxna23,vxal27,& + vxsi28,vxc14,vxf18,vxal26,vxneut,& + vxprot,vomegi,vxbid,vxbid1,xlostneu,& n& ) implicit none @@ -6090,7 +6136,7 @@ function new_stellar_model(& !GenecStar%abelx(:,:) = 0. !GenecStar%vabelx(:,:) = 0. - !call copy_from_genec_star(GenecStar) + call copy_from_genec_star(GenecStar) new_stellar_model = 0 end function new_stellar_model diff --git a/src/amuse/community/genec/interface.py b/src/amuse/community/genec/interface.py index c792ccb421..c9b5300089 100644 --- a/src/amuse/community/genec/interface.py +++ b/src/amuse/community/genec/interface.py @@ -394,12 +394,12 @@ GENEC_STAR_PROPERTIES = { # 'GENEC name: [dtype, unit, description, AMUSE name (empty = not used)] 'gms': ['float64', 'MSun', "total mass", "mass"], - 'alter': ['float64', 'yr', "stellar age", "age"], + 'alter': ['float64', 'julianyr', "stellar age", "age"], 'gls': ['float64', 'LSun', "stellar luminosity", "luminosity"], 'teff': ['float64', 'K', "effective temperature", "temperature"], 'glsv': ['float64', 'LSun', "previous luminosity"], 'teffv': ['float64', 'K', "previous temperature"], - 'dzeitj': ['float64', 'yr', "time step (yr)", ""], + 'dzeitj': ['float64', 'julianyr', "time step (julian yr)", ""], 'dzeit': ['float64', 's', "time step (s)", ""], 'dzeitv': ['float64', 's', "previous time step", ""], 'xmini': ['float64', 'MSun', "initial mass", "initial_mass"], @@ -554,6 +554,7 @@ } ALL_SETTERS = { + **GENEC_AMUSE_SPECIFIC, **GENEC_STAR_CHARACTERISTICS, **GENEC_STAR_PHYSICS, **GENEC_STAR_COMPOSITION, @@ -638,6 +639,21 @@ def set_genec_path(genec_path='s'): def commit_parameters(): returns () + @remote_function + def evolve_model(end_time='float64' | units.s): + returns () + + # @remote_function + # def new_particle( + # mass=units.MSun, + # metallicity=0.014, + # zams_velocity=0.0, + # star_name='AmuseStar', + # magnetic=0, + # anisotropic=0, + # ): + # returns (index_of_the_particle='int32') + @legacy_function def new_particle(): """ @@ -647,28 +663,14 @@ def new_particle(): function.can_handle_array = False function.addParameter( 'index_of_the_particle', dtype='int32', direction=function.OUT, - description=( - "The new index for the star. This index can be used to refer " - "to this star in other functions" - ) ) - function.addParameter( - 'mass', dtype='float64', direction=function.IN, - description="The initial mass of the star") - function.addParameter( - 'metallicity', dtype='float64', direction=function.IN, - default=0.014, - description="The initial metallicity of the star (default: 0.014)") - function.addParameter( - 'zams_velocity', dtype='float64', direction=function.IN, - default=0.0, - description="The desired ZAMS velocity of the star (default: 0.0)") - function.addParameter( - 'star_name', dtype='string', direction=function.IN, - default='AmuseStar', description="The star's name") - # function.addParameter( - # 'age_tag', dtype='float64', direction=function.IN, - # description="Starting age of the star *to be specified exactly*") + function.addParameter('mass', dtype='float64', direction=function.IN) + function.addParameter('metallicity', dtype='float64', direction=function.IN, default=0.014,) + function.addParameter('zams_velocity', dtype='float64', direction=function.IN, default=0.0,) + function.addParameter('star_name', dtype='string', direction=function.IN, default='AmuseStar',) + function.addParameter('magnetic', dtype='i', direction=function.IN, default=0,) + function.addParameter('anisotropic', dtype='i', direction=function.IN, default=0,) + function.result_type = 'int32' function.result_doc = """ 0 - OK @@ -3440,6 +3442,7 @@ def define_particle_sets(self, handler): handler.add_method(set_name, 'evolve_one_step') handler.add_method(set_name, 'evolve_for') + handler.add_method(set_name, 'evolve_model') handler.set_delete(set_name, 'delete_star') handler.add_method(set_name, 'get_star_name') @@ -3498,14 +3501,19 @@ def define_state(self, handler): # Initialized (initialize_code) handler.add_transition('UNINITIALIZED', 'INITIALIZED', 'initialize_code') + # handler.add_method(state, "set_bintide") + # handler.add_method(state, "set_zams_velocity") # -> Edit (commit_parameters) handler.add_transition('INITIALIZED', 'EDIT', 'commit_parameters') # handler.add_method('EDIT', 'set_star_name') - handler.add_method('EDIT', 'new_particle') - handler.add_method('UPDATE', 'new_particle') - handler.add_transition( - 'RUN', 'UPDATE', 'finalize_stellar_model', False) + for method in ( + "new_particle", + "new_particle_from_model", "new_stellar_model", + "set_abelx_at_zone", "set_vabelx_at_zone", "set_nbzel", + "set_nbael", "set_abels", "set_xnetalu" + ): + handler.add_method('EDIT', method) # -> Run (commit_particles) handler.add_transition('EDIT', 'RUN', 'commit_particles') @@ -3514,57 +3522,42 @@ def define_state(self, handler): # -> Update handler.add_transition('RUN', 'UPDATE', 'finalize_stellar_model') - for state in ["EDIT", "UPDATE"]: - for method in ( - "new_particle_from_model", "new_stellar_model", - "set_abelx_at_zone", "set_vabelx_at_zone", "set_nbzel", - "set_nbael", "set_abels", "set_xnetalu" - ): - handler.add_method(state, method) - - for state in ["UPDATE", "RUN"]: - for parameter in ALL_GETTERS: - handler.add_method(state, f'get_{parameter[0]}') - handler.add_method(state, 'get_internal_structure') - handler.add_method(state, 'get_radius') - handler.add_method(state, 'get_number_of_species') - handler.add_method(state, 'get_temperature') - handler.add_method(state, 'get_luminosity') - handler.add_method(state, 'get_time_step') - handler.add_method(state, 'get_mass') - handler.add_method(state, 'get_age') - handler.add_method(state, 'get_surface_velocity') - - handler.add_method(state, 'get_chemical_abundance_profiles') - handler.add_method(state, 'get_mass_fraction_at_zone') - handler.add_method(state, 'get_mass_fraction_of_species_at_zone') - handler.add_method(state, 'get_mu_at_zone') - handler.add_method(state, 'get_pressure_at_zone') - handler.add_method(state, 'get_radius_at_zone') - # handler.add_method(state, 'get_eps_at_zone') - # handler.add_method(state, 'get_epsy_at_zone') - # handler.add_method(state, 'get_eps_c_adv_at_zone') - # handler.add_method(state, 'get_eps_ne_adv_at_zone') - # handler.add_method(state, 'get_eps_o_adv_at_zone') - # handler.add_method(state, 'get_eps_si_adv_at_zone') - # handler.add_method(state, 'get_eps_grav_at_zone') - # handler.add_method(state, 'get_eps_nu_at_zone') - handler.add_method(state, 'get_temperature_at_zone') - handler.add_method(state, 'get_density_at_zone') - # handler.add_method(state, 'get_luminosity_at_zone') - for species in SPECIES_NAMES: - handler.add_method( - state, f'get_mass_fraction_of_{species}_at_zone' - ) - for state in ["EDIT", "UPDATE", "!RUN"]: - for parameter in ALL_SETTERS: - handler.add_method(state, f'set_{parameter[0]}') - handler.add_method(state, 'set_time_step') - for state in ["!UPDATE"]: - handler.add_method(state, "set_bintide") - handler.add_method(state, "set_zams_velocity") - for state in ["!EDIT"]: - handler.add_method(state, "set_zams_velocity") + for parameter in ALL_GETTERS: + handler.add_method('UPDATE', f'get_{parameter}') + # handler.add_method('UPDATE', 'get_internal_structure') + handler.add_method('UPDATE', 'get_radius') + handler.add_method('UPDATE', 'get_number_of_species') + handler.add_method('UPDATE', 'get_temperature') + handler.add_method('UPDATE', 'get_luminosity') + handler.add_method('UPDATE', 'get_time_step') + handler.add_method('UPDATE', 'get_mass') + handler.add_method('UPDATE', 'get_age') + handler.add_method('UPDATE', 'get_surface_velocity') + handler.add_method('UPDATE', 'get_chemical_abundance_profiles') + handler.add_method('UPDATE', 'get_mass_fraction_at_zone') + handler.add_method('UPDATE', 'get_mass_fraction_of_species_at_zone') + handler.add_method('UPDATE', 'get_mu_at_zone') + handler.add_method('UPDATE', 'get_pressure_at_zone') + handler.add_method('UPDATE', 'get_radius_at_zone') + # handler.add_method('UPDATE', 'get_eps_at_zone') + # handler.add_method('UPDATE', 'get_epsy_at_zone') + # handler.add_method('UPDATE', 'get_eps_c_adv_at_zone') + # handler.add_method('UPDATE', 'get_eps_ne_adv_at_zone') + # handler.add_method('UPDATE', 'get_eps_o_adv_at_zone') + # handler.add_method('UPDATE', 'get_eps_si_adv_at_zone') + # handler.add_method('UPDATE', 'get_eps_grav_at_zone') + # handler.add_method('UPDATE', 'get_eps_nu_at_zone') + handler.add_method('UPDATE', 'get_temperature_at_zone') + handler.add_method('UPDATE', 'get_density_at_zone') + # handler.add_method('UPDATE', 'get_luminosity_at_zone') + for species in SPECIES_NAMES: + handler.add_method( + 'UPDATE', f'get_mass_fraction_of_{species}_at_zone' + ) + + for parameter in ALL_SETTERS: + handler.add_method('UPDATE', f'set_{parameter[0]}') + handler.add_method('UPDATE', 'set_time_step') handler.add_method('UPDATE', 'set_n_snap') # handler.add_method('UPDATE', 'set_ipoly') @@ -3594,7 +3587,11 @@ def define_methods(self, handler): StellarEvolution.define_methods(self, handler) handler.add_method( "new_particle", - (units.MSun, handler.NO_UNIT, handler.NO_UNIT, handler.NO_UNIT), + ( + units.MSun, + handler.NO_UNIT, handler.NO_UNIT, handler.NO_UNIT, + handler.NO_UNIT, handler.NO_UNIT, + ), (handler.INDEX, handler.ERROR_CODE) ) @@ -3617,6 +3614,12 @@ def define_methods(self, handler): (units.km/units.s, handler.ERROR_CODE,) ) + handler.add_method( + "evolve_for", + (handler.INDEX, units.julianyr), + (handler.ERROR_CODE,) + ) + def get_eps_profile( self, indices_of_the_stars, From 596ea32d475d4cab543dd157d25eb929364e7aaf Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 19 Sep 2023 11:03:46 +0200 Subject: [PATCH 71/72] small updates --- src/amuse/community/genec/interface.f90 | 17 ++++--------- .../genec/test_integrate_default_star.py | 24 +++++++++---------- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index c3d123d573..075dff0a70 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -1805,7 +1805,7 @@ function delete_star() function evolve_model(end_time) use timestep, only: alter use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise + use genec, only: evolve, finalise use amuse_helpers, only: initialise_star use State, only: stopping_condition implicit none @@ -1815,12 +1815,10 @@ function evolve_model(end_time) do while (alter < end_time) if (stopping_condition == "") then write(*,*) "Current time: ", alter, ", evolving to: ", end_time - !modell = 1 call evolve() call finalise() call OpenAll() call initialise_star() - !write(*,*) "*****Modell: ", modell else write(*,*) "stopped: ", stopping_condition exit @@ -1835,7 +1833,7 @@ function evolve_for(index_of_the_star, time) ! evolve use timestep, only: alter use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise + use genec, only: evolve, finalise use amuse_helpers, only: initialise_star implicit none integer:: index_of_the_star @@ -1847,12 +1845,10 @@ function evolve_for(index_of_the_star, time) end_time = alter+time do while (alter < end_time) write(*,*) "Current time: ", alter, ", evolving to: ", end_time - !modell = 1 call evolve() call finalise() call OpenAll() call initialise_star() - !write(*,*) "*****Modell: ", modell end do evolve_for = 0 @@ -1861,18 +1857,15 @@ function evolve_for(index_of_the_star, time) function evolve_one_step(index_of_the_star) use timestep, only: alter use WriteSaveClose, only: OpenAll - use genec, only: evolve, modell, finalise + use genec, only: evolve, finalise use amuse_helpers, only: initialise_star use State, only: stopping_condition use inputparam,only: modanf,nwseq,nzmod implicit none integer:: index_of_the_star integer:: evolve_one_step - integer:: original_nzmod - !original_nzmod = nzmod - nzmod = 1000000 + nzmod = 100 !000000 write(*,*) "Evolving one step, current time: ", alter - !modell = 1 if (stopping_condition == "") then call evolve() if (stopping_condition /= "") return @@ -1880,8 +1873,6 @@ function evolve_one_step(index_of_the_star) call OpenAll() call initialise_star() ! will set modell to 1 write(*,*) "Evolved one step, current time: ", alter - !nzmod = original_nzmod - !write(*,*) "*****modanf, nwseq, nzmod: ", modanf, nwseq, nzmod else write(*,*) "stopped: ", stopping_condition endif diff --git a/src/amuse/community/genec/test_integrate_default_star.py b/src/amuse/community/genec/test_integrate_default_star.py index 34636265da..171d3c65ea 100644 --- a/src/amuse/community/genec/test_integrate_default_star.py +++ b/src/amuse/community/genec/test_integrate_default_star.py @@ -128,8 +128,8 @@ def write_backup( star = Particle(mass=7.0 | units.MSun, metallicity=0.014) -evo = Genec(redirection="none") -# evo = Genec() +# evo = Genec(redirection="none") +evo = Genec(redirection="file", redirect_file="genec_worker.log") if ROTATING_STAR: params = { # PhysicsParams @@ -244,12 +244,12 @@ def write_backup( time_of_last_plot = 0 | units.s age_of_last_plot = star_in_evo.age -#plotting = StellarModelPlot(star_in_evo) +# plotting = StellarModelPlot(star_in_evo) evo.parameters.nzmod = 100 print("age mass radius temp lum phase vequat h0 vwant") -while step < 2: +while step < 1000000: time_elapsed = (time.time() | units.s) - time_start star = star_in_evo.copy() # number_of_zones = star_in_evo.get_number_of_zones() @@ -278,7 +278,7 @@ def write_backup( ) if step % store_every == 0: pass - #plotting.update(star_in_evo, phase=evo.parameters.phase) + # plotting.update(star_in_evo, phase=evo.parameters.phase) if ( (time_elapsed - time_of_last_plot) > plot_time or step - model_of_last_plot > plot_models @@ -287,7 +287,7 @@ def write_backup( (star.age - age_of_last_plot).value_in(units.Myr) / (time_elapsed - time_of_last_plot).value_in(units.minute) ) | units.Myr / units.minute - #plotting.plot_all(speed=speed, step=step) + # plotting.plot_all(speed=speed, step=step) model_of_last_plot = step time_of_last_plot = time_elapsed age_of_last_plot = star.age @@ -307,12 +307,12 @@ def write_backup( age_previous = star_in_evo.age star_in_evo.evolve_one_step() print(f"Condition: {evo.parameters.stopping_condition}") - if evo.parameters.stopping_condition != "none": - # star_in_evo.age == age_previous: - if step > 1: - print("Stopping - not evolving!") - print(f"Condition: {evo.parameters.stopping_condition}") - break + # if evo.parameters.stopping_condition != "none": + # # star_in_evo.age == age_previous: + # if step > 1: + # print("Stopping - not evolving!") + # print(f"Condition: {evo.parameters.stopping_condition}") + # break step += 1 runtime = (time.time() | units.s) - time_start From 5142a77060933082d3305af562df7be3966a089d Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Mon, 25 Sep 2023 10:49:11 +0200 Subject: [PATCH 72/72] fix typo --- src/amuse/community/genec/interface.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse/community/genec/interface.f90 b/src/amuse/community/genec/interface.f90 index 383e6ea1f5..d2c16432ea 100644 --- a/src/amuse/community/genec/interface.f90 +++ b/src/amuse/community/genec/interface.f90 @@ -5,7 +5,7 @@ module AmuseInterface copy_to_genec_star,& copy_namelists_from_genec_star,& copy_from_genec_star,& - copy_structure_from_genec_star,& + copy_structure_from_genec_star use evol, only: kindreal,ldi,npondcouche type(genec_star) :: BackupBackupGenecStar