Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug t radiative #2560

Merged
merged 15 commits into from
May 10, 2024
4 changes: 2 additions & 2 deletions tardis/model/geometry/radial1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class HomologousRadial1DGeometry:

Parameters
----------
r_inner : astropy.units.quantity.Quantity
r_outer : astropy.units.quantity.Quantity
v_inner : astropy.units.quantity.Quantity
v_outer : astropy.units.quantity.Quantity
v_inner_boundary : astropy.units.quantity.Quantity
v_outer_boundary : astropy.units.quantity.Quantity

Attributes
----------
Expand Down
50 changes: 6 additions & 44 deletions tardis/model/parse_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,6 @@ def parse_structure_config(config, time_explosion, enable_homology=True):
"""
Parse the structure configuration data.

Parameters
----------
config : object
The configuration data.
time_explosion : float
The time of the explosion.
enable_homology : bool, optional
Whether to enable homology (default is True).

Returns
-------
electron_densities : object
The parsed electron densities.
temperature : object
The parsed temperature.
geometry : object
The parsed geometry.
density : object
The parsed density.

Raises
------
NotImplementedError
If the structure configuration type is not supported.

Notes
-----
This function parses the structure configuration data and returns the parsed electron
densities, temperature, geometry, and density. The structure configuration can be of
type 'specific' or 'file'. If it is of type 'specific', the velocity and density are
parsed from the configuration. If it is of type 'file', the velocity and density are
read from a file. The parsed data is used to create a homologous radial 1D geometry object.
"""
"""
Parse the structure configuration data.

DeerWhale marked this conversation as resolved.
Show resolved Hide resolved
Parameters
----------
config : object
Expand Down Expand Up @@ -145,8 +109,8 @@ def parse_structure_config(config, time_explosion, enable_homology=True):
)
density = density[1:]
geometry = HomologousRadial1DGeometry(
velocity[:-1], # r_inner
velocity[1:], # r_outer
velocity[:-1], # v_inner
velocity[1:], # v_outer
v_inner_boundary=structure_config.get("v_inner_boundary", None),
v_outer_boundary=structure_config.get("v_outer_boundary", None),
time_explosion=time_explosion,
Expand Down Expand Up @@ -217,8 +181,8 @@ def parse_csvy_geometry(
velocity = velocity.to("cm/s")

geometry = HomologousRadial1DGeometry(
velocity[:-1], # r_inner
velocity[1:], # r_outer
velocity[:-1], # v_inner
velocity[1:], # v_outer
v_inner_boundary=v_boundary_inner,
v_outer_boundary=v_boundary_outer,
time_explosion=time_explosion,
Expand Down Expand Up @@ -723,10 +687,8 @@ def calculate_t_radiative_from_t_inner(geometry, packet_source):
Quantity
The calculated radiative temperature.
"""
lambda_wien_inner = const.b_wien / packet_source.temperature
t_radiative = const.b_wien / (
lambda_wien_inner
* (1 + (geometry.v_middle - geometry.v_inner_boundary) / const.c)
t_radiative = packet_source.temperature / (
(1 - (geometry.v_middle - geometry.v_inner_boundary) / const.c)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation is incorrect here: the 1 - should be 1 + because temperature should decrease further out. The other change (packet_source.temperature) is fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can modify the documentation to fix the sign of the function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes !!! That makes sense. I will change the documentation and will redo this change to the original.

)
return t_radiative

Expand Down
Loading