  This paper deals with an optimal control problem related to a phase field
system of Caginalp type with a dynamic boundary condition for the temperature.
The control placed in the dynamic boundary condition acts on a part of the
boundary. The analysis carried out in this paper proves the existence of an
optimal control for a general class of potentials, possibly singular. The study
includes potentials for which the derivatives may not exist, these being
replaced by well-defined subdifferentials. Under some stronger assumptions on
the structure parameters and on the potentials (namely for the regular and the
logarithmic case having single-valued derivatives), the first order necessary
optimality conditions are derived and expressed in terms of the boundary trace
of the first adjoint variable.
