There is a general model of Stellar Structure (Stellar Structure Model) consisting of a hot region in the center where Fusion is releasing energy (the Stellar Core), a region near the apparent surface of the star that generates the light that escapes (the Photosphere), and regions in between that transfer the energy from core to photosphere via Electromagnetic Radiation (i.e., Radiative Transfer) and/or Convection (transfer of heat by movement of bulk amounts the material holding the heat) with Conduction (transfer of heat by collision of particles) generally only a minor factor. The structural details depend nearly entirely on the mass and age of the star, the smaller or rarer factors including the initial chemical composition (characterized by its Metallicity), the degree of spin, and nearby companions.
Large mass stars have CNO Cycle fusion in the core, with a region surrounding it conveying energy via radiative transfer, the inner part of which also has some Proton-Proton Chain fusion, which can be triggered by somewhat lower temperatures.
Small mass stars such as Red Dwarves have only Proton-Proton Chain fusion in the core, and transfer energy through convection.
Between are stars like the Sun, which have an inner portion much like a large star, with a convection layer surrounding it.
The most basic mathematical model includes four differential equations relating changes in mass, Temperature, Luminosity, and pressure to the distance from the center of the star. They presume Local Thermodynamic Equilibrium and Hydrostatic Equilibrium.
dm —— = 4πr²ρ dr
(density is assumed constant at distance r from the center)
dP Gmρ —— = - ——— dr r²
(pressure counteracts Gravity at distance r from the center)
dL —— = 4πr²ε dr
(energy is conserved, any addition is from fusion at that level)
dT 3κρL —— = ———————— dr 64πr²σT³
(Opacity directly affects the rate at which temperature changes with radius. This is the equation for radiative transfer, i.e., energy transfer via EMR; Other equations are needed if heat conduction is significant or if there is convection.)
Opacity, density, and energy generation are functions of temperature and pressure and it is key that simple-but-effective approximate models have been developed (Equations of State).
Among approximations used to make the behavior of a star's Atmosphere more tractable are the Plane Parallel Atmosphere approximation (ignoring the curvature of its layers) and the Gray Atmosphere approximation (ignoring the Wavelength-dependence by using values averaged over wavelength). Also used is the Eddington Approximation.
To model a star, these are generally solved using Difference Equations, approximating the differential equations by calculating differences over a small value. A star with these equations, a set of consistent Boundary Conditions needs to be determined/selected. Some are clear: m, L must be zero at the center (where r = 0), while ρ, P, and T must be (essentially) zero at the surface (the maximum value of r). Since any numerical calculations must begin at a point with values for all the variables, guessing is required and multiple calculation attempts are likely needed to satisfy the above five constraints.
Codes using this approach are called Eulerian Codes: an alternative is Lagrangian Codes, that specify (changes in) values in relation to dm rather than dr, i.e., mass rather than radius.
Stellar Temperature Determination