Friday, September 27, 2024

Initial model attempt for black body radiation using classic geometric viewpoint.

 Abstract

We attempt to model the behavior of black body radiation using a statistical model and chains of particle interactions to create the average energy levels we see in black body radiation.  

This is discussed in detail in my other paper: 

https://mystry-geek.blogspot.com/2024/09/a-geometric-deceleration-based-model.html

I wrote a model that implemented the rules of that paper and this is the result:




Program: 

import numpy as np

import matplotlib.pyplot as plt

from scipy.constants import k, h, c

from matplotlib.colors import LinearSegmentedColormap


def collision_energy(temp):

    return 3/2 * k * temp


def peak_emission_energy(temp):

    wavelength = 2.898e-3 / temp  # Wien's displacement law

    return h * c / wavelength


def emission_probability(energy, temp):

    peak_energy = peak_emission_energy(temp)


    # Probability increases with energy

    prob = 1 - np.exp(-energy / (k * temp)) 


    # Smooth transition function

    def smooth_transition(x, center, width):

        return 1 / (1 + np.exp(-(x - center) / width))


    # High energy damping

    high_energy_damping = np.exp(-(energy / (2.5 * peak_energy))**2.5)


    # Low energy factor

    low_energy_factor = 1 - np.exp(-(energy / (1.2 * peak_energy))**2)

    low_energy_factor = np.maximum(low_energy_factor, 0.01)


    # Smooth transition between low and high energy regimes

    transition = smooth_transition(energy, peak_energy, peak_energy / 5)

    combined_factor = transition * high_energy_damping + (1 - transition) * low_energy_factor


    # Temperature-dependent escape probability

    temp_factor = 1 - np.exp(-temp / 12000) 


    return prob * combined_factor * temp_factor


def generate_emissions(temp):

    scale_factor= .3+temp/10000

    num_points=temp*10000

    avg_energy = collision_energy(temp)

    energies = np.random.exponential(avg_energy, num_points) * scale_factor 

    

    # Simulate collision chains by occasionally combining energies

    chain_prob = 0.07

    chain_mask = np.random.random(num_points) < chain_prob

    energies[chain_mask] += energies[np.random.permutation(num_points)][chain_mask]

    

    probabilities = emission_probability(energies, temp)

    emissions = energies[np.random.random(num_points)< probabilities]

    return emissions


# Set up the plot

plt.figure(figsize=(12, 8))


# Generate data for each temperature

temps = [3000, 4000, 5000, 6000]

all_emissions = [generate_emissions(temp) for temp in temps]


# Convert energies to wavelengths

all_wavelengths = [h * c / e for e in all_emissions]


# Create histogram data

wavelength_bins = np.linspace(0, 3000e-9, 100)  # 0 to 3000 nm


hist_data = [np.histogram(w, bins=wavelength_bins)[0] for w in all_wavelengths]


# Create stacked area plot

plt.stackplot(wavelength_bins[:-1], hist_data, labels=[f'{temp}K' for temp in temps])


plt.xlabel('Wavelength (nm)')

plt.ylabel('Number of Emissions')

plt.title('Stacked Blackbody Radiation Model: Emission Wavelength Distribution')

#plt.yscale('log')  # Use log scale for y-axis to better show the distribution

#plt.xscale('log')`

plt.grid(True, which="both", ls="-", alpha=0.2)


# Set x-axis limits

plt.xlim(0, 3000e-9)


# Add visible spectrum representation

visible_range = (380e-9, 750e-9)  # Visible spectrum wavelength range

cmap = LinearSegmentedColormap.from_list("visible_spectrum", ['violet', 'blue', 'green', 'yellow', 'orange', 'red'])

plt.axvspan(visible_range[0], visible_range[1], alpha=0.3, color=cmap(0.5), label='Visible Spectrum')


# Customize x-axis ticks

wavelength_ticks = np.arange(0, 3001e-9, 500e-9)

wavelength_labels = [f'{int(w*1e9)}' for w in wavelength_ticks]

plt.xticks(wavelength_ticks, wavelength_labels)


plt.legend(loc='upper right')

plt.tight_layout()

plt.savefig('blackbody_radiation_model_wavelength_0_to_3000nm.png')

Analysis: 

For a first attempt this did recreate a black body shaped scatterplot with the peaks at the right place. This first attempt followed the rules as specified in the paper and it got very close to the results. And we learned a lot about how black body radiation works in the process.  The fact that following these rules does result in the spectrum we see in black body radiation means that the model is generally capturing the effects we see and the energy output is very similar.  We even cut off before we got too far into ultraviolet, naturally without additional rules. 

But a real statistical model should recreate the peaks without knowledge about them in the first place.   This is what I am going to focus on next.  I want to create a program from first principles that can find these peaks without knowledge of them in the first place.  We should just model the particle collisions we see in 

No comments:

Post a Comment