The diffusion of gasses in solids can be described by the Ficks diffusion flux law and the continuity equation. Both equations gives the diffusion equation when solved with appropriate boundary conditions and initial conditions can result in the diffusion profile of the gas in the solid. The diffusion doping technology is widely used in semicondcutor industry and therefor you can find technology simulators that can be used to solve your problem. Please see for example the tool: https://www.silvaco.com/content/kbase/process.pdf