  Using Physics-Informed Neural Networks (PINNs) to solve a specific boundary
value problem is becoming more popular as an alternative to traditional
methods. However, depending on the specific problem, they could be
computationally expensive and potentially less accurate. The functionality of
PINNs for real-world physical problems can significantly improve if they become
more flexible and adaptable. To address this, our work explores the idea of
training a PINN for general boundary conditions and source terms expressed
through a limited number of coefficients, introduced as additional inputs in
the network. Although this process increases the dimensionality and is
computationally costly, using the trained network to evaluate new general
solutions is much faster. Our results indicate that PINN solutions are
relatively accurate, reliable, and well-behaved. We applied this idea to the
astrophysical scenario of the magnetic field evolution in the interior of a
neutron star connected to a force-free magnetosphere. Solving this problem
through a global simulation in the entire domain is expensive due to the
elliptic solver's needs for the exterior solution. The computational cost with
a PINN was more than an order of magnitude lower than the similar case solved
with classical methods. These results pave the way for the future extension to
3D of this (or a similar) problem, where generalised boundary conditions are
very costly to implement.
