Estimates of dA_s/dt in the mixed-variable pullback ===================================================== In the explicit electromagnetic model with the mixed-variable formulation (``sml_electromagnetic=.true.``, ``sml_em_mixed_variable=.true.``) the parallel vector potential is split into a symplectic part :math:`A_s` and a Hamiltonian part :math:`A_h`. The pullback transformation at the end of every time step moves :math:`A_h` into :math:`A_s`, and the electron equations of motion need an estimate of :math:`\partial A_s/\partial t` during the step. ``sml_em_pullback_method`` selects it: ``Electrostatic`` (default) :math:`\partial A_s/\partial t = 0`. ``IdealMHD`` The ideal Ohm's law, :math:`\partial A_s/\partial t = -\mathbf{b}\cdot\nabla\phi` (filtered like the fields in ``push_As`` and damped by ``sml_em_pullback_dampfac``). Its error appears as the growth of :math:`A_h` within the step, which the pullback removes; the error grows with the time step. ``IntegralFeedback`` :math:`\partial A_s/\partial t = -\mathbf{b}\cdot\nabla\phi + C_n` with :math:`C_n = C_{n-1} + k\,(\partial A_h/\partial t)_n`, an integral feedback on the observed growth of :math:`A_h` with gain :math:`k` = ``em_pullback_feedback_gain``. :math:`C_n` is not checkpointed: a restarted run re-accumulates it from zero. ``LinearGain`` :math:`\partial A_s/\partial t = a\,e_n + b\,C_n + c\,R_n` per Runge-Kutta stage, with :math:`e_n` the ideal-MHD estimate, :math:`C_n = (1-k)\,C_{n-1} + k\,(r_{n-1} - e_{n-1})` the memory of the previous step's non-ideal rate (:math:`r_{n-1}`: observed :math:`\partial A_s/\partial t` of the previous step, :math:`e_{n-1}`: its ideal-MHD estimate) and :math:`R_n` an observed rate (:math:`r_{n-1}` at the first stage, the rate of the first half step of the total :math:`A_\parallel` at the second stage). The gains ``em_pullback_lin_{ideal,nonideal,rate}_gain_ipc{1,2}`` default to :math:`a=1`, :math:`b=c=0`, which reproduces the ideal-MHD estimate; see the fitted values below. ``NeuralNetwork`` :math:`\partial A_s/\partial t = e_n + N_E\,\mathrm{MLP}(x_n)`: the ideal-MHD estimate plus a per-node multilayer-perceptron correction, one network per Runge-Kutta stage, with weights read at start-up from ``em_pullback_nn_file_ipc1`` and ``em_pullback_nn_file_ipc2`` (ADIOS2 BP or text files written by the exporter of the dAdt_prediction training project). The inputs are the local normalized fields of the stage, their time derivatives, the previous step's non-ideal rate and node constants from the equilibrium profiles; :math:`N_E` is the flux-surface rms of the :math:`n\neq 0` part of :math:`e_n`. The input definition and the training range of every input are attributes of the weight file and are checked at start-up; nodes whose inputs leave the training range (``em_pullback_nn_range_check``, ``em_pullback_nn_range_margin``, ``em_pullback_nn_range_check_skip``) use the ideal-MHD estimate. The full input list is described in ``XGC_core/cpp/solvers/dAdt_nn_pullback.hpp``. The settings of ``IntegralFeedback``, ``LinearGain`` and ``NeuralNetwork`` are read from the namelist ``em_pullback_param`` (inputs ``em_pullback_*``); ``sml_em_pullback_method`` itself stays in ``sml_param``. With ``em_pullback_filter_correction=.true.`` (and ``sml_em_dasdt_filter_on=.true.``) the correction added to the ideal-MHD estimate passes through the same Fourier filter and hyperviscosity that ``push_As`` applies to :math:`\partial A_s/\partial t`, so that the markers feel only the mode content of the correction that :math:`A_s` receives. The filter is applied on the Ampere field boundary, like the ideal-MHD estimate; ``push_As`` also sets the estimate to zero outside the current boundary, which excludes the nodes near the wall, so the two still differ there for the ideal-MHD part and the correction alike. ``IntegralFeedback``, ``LinearGain`` and ``NeuralNetwork`` assume that every step is an electromagnetic step with the same time step. They are not supported with the EM/ES switching of the RMP penetration mode (``ptb_3db_mode=2``), where electrostatic steps have no pullback residual and the time step changes at each switch; such inputs stop at startup. Training data ------------- ``diag_dadt_nn_input_on`` writes the real-coordinate fields, the observed growth rate of :math:`A_h` and the total :math:`A_\parallel` of three consecutive steps every ``diag_dadt_nn_input_period`` steps, for any pullback method (:doc:`xgc_output_dadt_nn_input`). The LinearGain gains and the networks are fitted to these files. LinearGain gains fitted to training data ---------------------------------------- The gains below were least-squares fits to training data of a circular core case with total-f kinetic electrons, :math:`\beta_e = 0.5\,\%`, 16 toroidal planes in a one-third wedge and ``sml_dt`` = :math:`10^{-4}` toroidal transit times. The first stage was fitted to :math:`(A_s(n+1)-A_s(n))/\Delta t`, the second stage to the same target using the observed first-half-step rate of the total :math:`A_\parallel` as :math:`R`. The same values also held at half the time step. They are not the defaults; set them in the input to use them: .. list-table:: :header-rows: 1 * - Input - First stage (ipc1) - Second stage (ipc2) * - ``em_pullback_lin_ideal_gain_ipc*`` (:math:`a`) - 0.95 - 0.61 * - ``em_pullback_lin_nonideal_gain_ipc*`` (:math:`b`) - 0.95 - 0.585 * - ``em_pullback_lin_rate_gain_ipc*`` (:math:`c`) - 0.0 - 0.295 with ``em_pullback_feedback_gain`` = 1 (pure persistence of the previous step's non-ideal part). On that case the fitted LinearGain estimate reduced the rms error of the estimate only marginally at the first stage and by about 17 % at the second stage relative to persistence of the previous non-ideal rate; the NeuralNetwork estimate reduces it by an order of magnitude.