  A photon dominated region (PDR) is one of the leading candidate mechanisms
for the origin of the warm CO gas with near universal $\sim$300~K rotational
temperature inferred from the CO emission detected towards embedded protostars
by Herschel/PACS. We have developed a PDR model in general coordinates, where
we can use the most adequate coordinate system for an embedded protostar having
outflow cavity walls, to solve chemistry and gas energetics self-consistently
for given UV radiation fields with different spectral shapes. Simple 1D tests
and applications show that FIR mid-$J$ ($14\leq J\leq 24$) CO lines are emitted
from near the surface of a dense region exposed to high UV fluxes. We apply our
model to HH46 and find the UV-heated outflow cavity wall can reproduce the
mid-$J$, CO transitions observed by Herschel/PACS. A model with UV radiation
corresponding to a blackbody of 10,000~K results in the rotational temperature
lower than 300~K, while models with the Draine interstellar radiation field and
the 15,000 K blackbody radiation field predict the rotational temperature
similar to the observed one.
