  Context. We investigate the grain opacity k_gr in the atmosphere of
protoplanets. This is important for the planetary mass-radius relation since
k_gr affects the H/He envelope mass of low-mass planets and the critical core
mass of giant planets. Aims. The goal of this study is to derive an analytical
model for k_gr. Methods. Our model is based on the comparison of the timescales
of microphysical processes like grain settling in the Stokes and Epstein
regime, growth by Brownian motion coagulation and differential settling, grain
evaporation, and grain advection due to envelope contraction. With these
timescales we derive the grain size, abundance, and opacity. Results. We find
that the main growth process is differential settling. In this regime, k_gr has
a simple functional form and is given as 27 Q/8 H rho in the Epstein regime and
as 2 Q/H rho for Stokes drag. Grain dynamics lead to a typical radial structure
of k_gr with high ISM-like values in the top layers but a strong decrease in
the deeper parts where the grain-free molecular opacities take over.
Conclusions. In agreement with earlier results we find that k_gr is typically
much lower than in the ISM. The equations also show that a higher dust input in
the top layer does not strongly increase k_gr with two important implications.
First, for a formation of giant planet cores via pebbles, there could be the
issue that pebbles increase the grain input high in the atmosphere due to
ablation. This could potentially increase k_gr hindering giant planet
formation. Our study shows that this adverse effect should not occur. Second,
it means that a higher stellar [Fe/H] which presumably leads to a higher
surface density of planetesimals only favors giant planet formation without
being detrimental to it due to an increased k_gr. This corroborates the result
that core accretion explains the increase of the giant planet frequency with
[Fe/H].
