diff --git a/docs/using/components/configuration/configuration.rst b/docs/using/components/configuration/configuration.rst index 35c68be6dfb..cacf5f927ac 100644 --- a/docs/using/components/configuration/configuration.rst +++ b/docs/using/components/configuration/configuration.rst @@ -50,7 +50,27 @@ file type where the information is stored or a number of other sections. .. jsonschema:: schemas/model.yml +Abundances +^^^^^^^^^^ +The ``abundance`` section has a possible ``file`` parameter with ``type`` (currently only ``artis`` is allowed) +and a ``name`` parameter giving a path to a file containing the abundance information. + +.. warning:: + In contrast to the ``structure`` section, the ``abundance`` section will not ignore abundances set in the rest of + the section but merely will overwrite the abundances given in the file section. + +The rest of the section can be used to configure uniform abundances for all shells, by giving the atom name and a +relative abundance fraction. If it does not add up to 1., TARDIS will warn --- but normalize the numbers. + + +.. jsonschema:: schemas/model_definitions.yml#/definitions/abundances/file + +.. jsonschema:: schemas/model_definitions.yml#/definitions/abundances/uniform + +Structure +^^^^^^^^^ All types of ``structure`` definitions have two keywords in common: ``v_inner_boundary`` and ``v_outer_boundary``. + In the ``structure`` section, one can specify a ``file`` section containing a ``type`` parameter (currently only ``artis`` is supported``) and a ``name`` parameter giving a path top a file. @@ -58,21 +78,24 @@ If one doesn't specify a ``file`` section, the code requires two sections (``vel parameter ``no_of_shells``. ``no_of_shells`` is the requested number of shells for a model. The ``velocity`` section requires a ``type``. Currently, only ``linear`` is supported. +.. jsonschema:: schemas/model_definitions.yml#/definitions/structure/file + +.. jsonschema:: schemas/model_definitions.yml#/definitions/structure/specific + +Densities +""""""""" In the ``densities`` section the ``type`` parameter again decides on the parameters. The type ``uniform`` only needs a - ``value`` parameter with a density compatible quantity. The type ``branch85_w7`` uses a seven-order polynomial fit to - the W7 model and is parametrised by time since explosion. The parameters ``time_0`` and ``density_coefficient`` are set - to sensible defaults and should not be changed. +``value`` parameter with a density compatible quantity. The type ``branch85_w7`` uses a seven-order polynomial fit to +the W7 model and is parametrised by time since explosion. The parameters ``time_0`` and ``density_coefficient`` are set +to sensible defaults and should not be changed. -The ``abundance`` section again has a possible ``file`` parameter with ``type`` (currently only ``artis`` is allowed) -and a ``name`` parameter giving a path to a file containing the abundance information. +.. jsonschema:: schemas/model_definitions.yml#/definitions/density/branch85_w7 -.. warning:: - In contrast to the ``structure`` section, the ``abundance`` section will not ignore abundances set in the rest of - the section but merely will overwrite the abundances given in the file section. +.. jsonschema:: schemas/model_definitions.yml#/definitions/density/exponential -The rest of the section can be used to configure uniform abundances for all shells, by giving the atom name and a -relative abundance fraction. If it does not add up to 1., TARDIS will warn --- but normalize the numbers. +.. jsonschema:: schemas/model_definitions.yml#/definitions/density/power_law +.. jsonschema:: schemas/model_definitions.yml#/definitions/density/uniform Plasma @@ -127,6 +150,10 @@ The ``montecarlo`` section describes the parameters for the Monte Carlo radiatio .. jsonschema:: schemas/montecarlo.yml +.. jsonschema:: schemas/montecarlo_definitions.yml#/definitions/convergence_strategy/damped + +.. jsonschema:: schemas/montecarlo_definitions.yml#/definitions/convergence_strategy/custom + The ``seed`` parameter seeds the random number generator first for the creation of the packets (:math:`\nu` and :math:`\mu`) and then the interactions in the actual Monte Carlo process. The ``no_of_packets`` parameter can take a float number for input convenience and gives the number of packets normally @@ -143,8 +170,8 @@ All convergence criteria can be specified separately for the three variables for override the defaults. -#. ``damped`` only has one parameter ``damping-constant`` and does not check for convergence. This can be used to fix the - temperature of the inner boundary (by increasing the ``convergence_criteria`` and +``damped`` only has one parameter ``damping-constant`` and does not check for convergence. This can be used to fix the +temperature of the inner boundary (by increasing the ``convergence_criteria`` and @@ -162,10 +189,9 @@ just an integer. Finally, the method option selects the final spectral synthesis * integrated: use the :doc:`formal integral method <../../../physics/montecarlo/sourceintegration>` of Lucy 1999 .. warning:: - - Currently, the "integrated" mode only works with the downbranching line - interaction mode. Note also the limitations listed at the bottom of the - dedicated page. + Currently, the "integrated" mode only works with the downbranching line + interaction mode. Note also the limitations listed at the bottom of the + dedicated page. .. include:: ../../example_data.inc \ No newline at end of file diff --git a/tardis/io/schemas/model.yml b/tardis/io/schemas/model.yml index 759076d89c2..1b11f7af946 100644 --- a/tardis/io/schemas/model.yml +++ b/tardis/io/schemas/model.yml @@ -4,171 +4,9 @@ additionalProperties: false properties: structure: oneOf: - - $ref: '#/definitions/structure/file' - - $ref: '#/definitions/structure/specific' + - $ref: 'model_definitions.yml#/definitions/structure/specific' + - $ref: 'model_definitions.yml#/definitions/structure/file' abundances: oneOf: - - $ref: '#/definitions/abundances/file' - - $ref: '#/definitions/abundances/uniform' - -definitions: - density: - branch85_w7: - type: object - additionalProperties: false - properties: - type: - enum: - - branch85_w7 - w7_time_0: - type: quantity - default: 0.000231481 day - description: This needs no change - DO NOT TOUCH - w7_rho_0: - type: quantity - default: 3e29 g/cm^3 - description: This needs no change - DO NOT TOUCH - w7_v_0: - type: quantity - default: 1 km/s - description: This needs no change - DO NOT TOUCH - exponential: - type: object - additionalProperties: false - properties: - type: - enum: - - exponential - time_0: - type: quantity - description: Time at which the pure model densities are right - rho_0: - type: quantity - description: density at time_0 - v_0: - type: quantity - description: at what velocity the density rho_0 applies - required: - - rho_0 - - v_0 - power_law: - type: object - additionalProperties: false - properties: - type: - enum: - - power_law - time_0: - type: quantity - description: Time at which the pure model densities are right - rho_0: - type: quantity - description: density at time_0 - v_0: - type: quantity - description: at what velocity the density rho_0 applies - exponent: - type: number - description: exponent for exponential density profile - required: - - rho_0 - - v_0 - - exponent - uniform: - type: object - additionalProperties: false - properties: - type: - enum: - - uniform - time_0: - type: quantity - description: Time at which the pure model densities are right - value: - type: quantity - description: value for uniform density - required: - - value - structure: - file: - type: object - additionalProperties: false - properties: - type: - enum: - - file - filename: - type: string - description: file name (with path) to structure model - filetype: - type: string - enum: - - simple_ascii - - artis - - cmfgen_model - description: file type - v_inner_boundary: - type: quantity - default: -1 km/s - description: location of the inner boundary chosen from the model - v_outer_boundary: - type: quantity - default: -1 km/s - description: location of the inner boundary chosen from the model - required: - - filename - - filetype - specific: - type: object - additionalProperties: false - properties: - type: - enum: - - specific - velocity: - type: object - properties: - start: - type: quantity - stop: - type: quantity - num: - type: number - multipleOf: 1.0 - description: description of the boundaries of the shells - density: - oneOf: - - $ref: '#/definitions/density/branch85_w7' - - $ref: '#/definitions/density/exponential' - - $ref: '#/definitions/density/power_law' - - $ref: '#/definitions/density/uniform' - required: - - velocity - - density - abundances: - file: - type: object - additionalProperties: false - properties: - type: - enum: - - file - filetype: - type: string - description: type of abundance file to read in - filename: - type: string - description: filename - required: - - filetype - - filename - uniform: - type: object - properties: - type: - enum: - - uniform - additionalProperties: - type: number - minimum: 0 - maximum: 1 + - $ref: 'model_definitions.yml#/definitions/abundances/file' + - $ref: 'model_definitions.yml#/definitions/abundances/uniform' diff --git a/tardis/io/schemas/model_definitions.yml b/tardis/io/schemas/model_definitions.yml new file mode 100644 index 00000000000..9cc6357de18 --- /dev/null +++ b/tardis/io/schemas/model_definitions.yml @@ -0,0 +1,178 @@ +title: 'definitions for the values in Model.yml' +definitions: + density: + branch85_w7: + $$target: '#/definitions/density/branch85_w7' + title: 'Branch85_w7 Density' + type: object + additionalProperties: false + properties: + type: + enum: + - branch85_w7 + w7_time_0: + type: quantity + default: 0.000231481 day + description: This needs no change - DO NOT TOUCH + w7_rho_0: + type: quantity + default: 3e29 g/cm^3 + description: This needs no change - DO NOT TOUCH + w7_v_0: + type: quantity + default: 1 km/s + description: This needs no change - DO NOT TOUCH + exponential: + $$target: '#/definitions/density/exponential' + title: 'Exponential Density' + type: object + additionalProperties: false + properties: + type: + enum: + - exponential + time_0: + type: quantity + description: Time at which the pure model densities are right + rho_0: + type: quantity + description: density at time_0 + v_0: + type: quantity + description: at what velocity the density rho_0 applies + required: + - rho_0 + - v_0 + power_law: + $$target: '#/definitions/density/power_law' + title: 'Power_law Density' + type: object + additionalProperties: false + properties: + type: + enum: + - power_law + time_0: + type: quantity + description: Time at which the pure model densities are right + rho_0: + type: quantity + description: density at time_0 + v_0: + type: quantity + description: at what velocity the density rho_0 applies + exponent: + type: number + description: exponent for exponential density profile + required: + - rho_0 + - v_0 + - exponent + uniform: + $$target: '#/definitions/density/uniform' + title: 'Uniform Density' + type: object + additionalProperties: false + properties: + type: + enum: + - uniform + time_0: + type: quantity + description: Time at which the pure model densities are right + value: + type: quantity + description: value for uniform density + required: + - value + structure: + file: + $$target: 'model_definitions.yml#/definitions/structure/file' + title: 'File Structure' + type: object + additionalProperties: false + properties: + type: + enum: + - file + filename: + type: string + description: file name (with path) to structure model + filetype: + type: string + enum: + - simple_ascii + - artis + - cmfgen_model + description: file type + v_inner_boundary: + type: quantity + default: -1 km/s + description: location of the inner boundary chosen from the model + v_outer_boundary: + type: quantity + default: -1 km/s + description: location of the inner boundary chosen from the model + required: + - filename + - filetype + specific: + $$target: 'model_definitions.yml#/definitions/structure/specific' + title: 'Specific Structure' + type: object + additionalProperties: false + properties: + type: + enum: + - specific + velocity: + type: object + properties: + start: + type: quantity + stop: + type: quantity + num: + type: number + multipleOf: 1.0 + description: description of the boundaries of the shells + density: + oneOf: + - $ref: '#/definitions/density/branch85_w7' + - $ref: '#/definitions/density/exponential' + - $ref: '#/definitions/density/power_law' + - $ref: '#/definitions/density/uniform' + required: + - velocity + - density + abundances: + file: + $$target: 'model_definitions.yml#/definitions/abundances/file' + title: 'File Abundance' + type: object + additionalProperties: false + properties: + type: + enum: + - file + filetype: + type: string + description: type of abundance file to read in + filename: + type: string + description: filename + required: + - filetype + - filename + uniform: + $$target: 'model_definitions.yml#/definitions/abundances/uniform' + title: 'Uniform Abundance' + type: object + properties: + type: + enum: + - uniform + additionalProperties: + type: number + minimum: 0 + maximum: 1 diff --git a/tardis/io/schemas/montecarlo.yml b/tardis/io/schemas/montecarlo.yml index c218f4267ce..0e6df3c7988 100644 --- a/tardis/io/schemas/montecarlo.yml +++ b/tardis/io/schemas/montecarlo.yml @@ -55,8 +55,8 @@ properties: description: albedo of the reflective boundary convergence_strategy: oneOf: - - $ref: '#/definitions/convergence_strategy/damped' - - $ref: '#/definitions/convergence_strategy/custom' + - $ref: 'montecarlo_definitions.yml#/definitions/convergence_strategy/damped' + - $ref: 'montecarlo_definitions.yml#/definitions/convergence_strategy/custom' default: type: 'damped' enable_full_relativity: @@ -81,116 +81,3 @@ properties: required: - no_of_packets - iterations - -definitions: - convergence_strategy: - damped: - type: object - additionalProperties: false - properties: - properties: - type: - enum: - - damped - default: damped - stop_if_converged: - type: boolean - default: false - description: stop plasma iterations before number of specified - iterations are reached if the simulation is plasma and inner - boundary state is converged - fraction: - type: number - default: 0.8 - description: the fraction of shells that have to converge to the given convergence - threshold. For example, 0.8 means that 80% of shells have to converge - to the threshold that convergence is established - minimum: 0 - hold_iterations: - type: number - multipleOf: 1.0 - default: 3 - description: the number of iterations that the convergence criteria need - to be fulfilled before TARDIS accepts the simulation as converged - damping_constant: - type: number - default: 1.0 - description: damping constant - minimum: 0 - threshold: - type: number - default: 0.05 - description: specifies the threshold that is taken as convergence (i.e. - 0.05 means that the value does not change more than 5%) - minimum: 0 - t_inner: - type: object - additionalProperties: false - properties: - damping_constant: - type: number - default: 0.5 - description: damping constant - minimum: 0 - threshold: - type: number - description: specifies the threshold that is taken as convergence (i.e. - 0.05 means that the value does not change more than 5%) - minimum: 0 - t_rad: - type: object - additionalProperties: false - properties: - damping_constant: - type: number - default: 0.5 - description: damping constant - minimum: 0 - threshold: - type: number - description: specifies the threshold that is taken as convergence (i.e. - 0.05 means that the value does not change more than 5%) - minimum: 0 - required: - - threshold - w: - type: object - additionalProperties: false - properties: - damping_constant: - type: number - default: 0.5 - description: damping constant - minimum: 0 - threshold: - type: number - description: specifies the threshold that is taken as convergence (i.e. - 0.05 means that the value does not change more than 5%) - minimum: 0 - required: - - threshold - lock_t_inner_cycles: - type: number - multipleOf: 1.0 - default: 1 - description: The number of cycles to lock the update of the inner boundary - temperature. This process helps with convergence. The default is to switch - it off (1 cycle) - t_inner_update_exponent: - type: number - default: -0.5 - description: L=4*pi*r**2*T^y - custom: - type: object - additionalProperties: false - properties: - type: - enum: - - custom - description: Use this convergence_strategy for your specific needs. You - need to change the codebase accordingly - required: - - fraction - - damping_constant - - threshold - - hold_iterations diff --git a/tardis/io/schemas/montecarlo_definitions.yml b/tardis/io/schemas/montecarlo_definitions.yml new file mode 100644 index 00000000000..ea1233ac3b1 --- /dev/null +++ b/tardis/io/schemas/montecarlo_definitions.yml @@ -0,0 +1,116 @@ +definitions: + convergence_strategy: + damped: + $$target: 'montecarlo_definitions.yml#/definitions/convergence_strategy/damped' + title: 'Damped Convergence Strategy' + type: object + additionalProperties: false + properties: + properties: + type: + enum: + - damped + default: damped + stop_if_converged: + type: boolean + default: false + description: stop plasma iterations before number of specified + iterations are reached if the simulation is plasma and inner + boundary state is converged + fraction: + type: number + default: 0.8 + description: the fraction of shells that have to converge to the given convergence + threshold. For example, 0.8 means that 80% of shells have to converge + to the threshold that convergence is established + minimum: 0 + hold_iterations: + type: number + multipleOf: 1.0 + default: 3 + description: the number of iterations that the convergence criteria need + to be fulfilled before TARDIS accepts the simulation as converged + damping_constant: + type: number + default: 1.0 + description: damping constant + minimum: 0 + threshold: + type: number + default: 0.05 + description: specifies the threshold that is taken as convergence (i.e. + 0.05 means that the value does not change more than 5%) + minimum: 0 + t_inner: + type: object + additionalProperties: false + properties: + damping_constant: + type: number + default: 0.5 + description: damping constant + minimum: 0 + threshold: + type: number + description: specifies the threshold that is taken as convergence (i.e. + 0.05 means that the value does not change more than 5%) + minimum: 0 + t_rad: + type: object + additionalProperties: false + properties: + damping_constant: + type: number + default: 0.5 + description: damping constant + minimum: 0 + threshold: + type: number + description: specifies the threshold that is taken as convergence (i.e. + 0.05 means that the value does not change more than 5%) + minimum: 0 + required: + - threshold + w: + type: object + additionalProperties: false + properties: + damping_constant: + type: number + default: 0.5 + description: damping constant + minimum: 0 + threshold: + type: number + description: specifies the threshold that is taken as convergence (i.e. + 0.05 means that the value does not change more than 5%) + minimum: 0 + required: + - threshold + lock_t_inner_cycles: + type: number + multipleOf: 1.0 + default: 1 + description: The number of cycles to lock the update of the inner boundary + temperature. This process helps with convergence. The default is to switch + it off (1 cycle) + t_inner_update_exponent: + type: number + default: -0.5 + description: L=4*pi*r**2*T^y + custom: + $$target: 'montecarlo_definitions.yml#/definitions/convergence_strategy/custom' + title: 'Custom Convergence Strategy' + type: object + additionalProperties: false + properties: + type: + enum: + - custom + description: Use this convergence_strategy for your specific needs. You + need to change the codebase accordingly + required: + - fraction + - damping_constant + - threshold + - hold_iterations