@@ -55,6 +55,8 @@ class CVariable {
5555 MatrixType Solution; /* !< \brief Solution of the problem. */
5656 MatrixType Solution_Old; /* !< \brief Old solution of the problem R-K. */
5757
58+ MatrixType UserDefinedSource; /* !< \brief User Defined Source of the problem. */
59+
5860 MatrixType External; /* !< \brief External (outer) contribution in discrete adjoint multizone problems. */
5961
6062 su2vector<bool > Non_Physical; /* !< \brief Non-physical points in the solution (force first order). */
@@ -289,6 +291,11 @@ class CVariable {
289291 */
290292 void Set_Solution_time_n1 ();
291293
294+ /* !
295+ * \brief Set the variable solution at time n-1.
296+ */
297+ void Set_UserDefinedSource ();
298+
292299 /* !
293300 * \brief Set the variable solution at time n.
294301 * \param[in] iPoint - Point index.
@@ -306,6 +313,15 @@ class CVariable {
306313 Solution_time_n1 (iPoint,iVar) = val_sol[iVar];
307314 }
308315
316+ /* !
317+ * \brief Set the variable solution at time n-1.
318+ * \param[in] iPoint - Point index.
319+ */
320+ inline void Set_UserDefinedSource (unsigned long iPoint, const su2double* val_sol) {
321+ for (unsigned long iVar = 0 ; iVar < nVar; iVar++)
322+ UserDefinedSource (iPoint,iVar) = val_sol[iVar];
323+ }
324+
309325 /* !
310326 * \brief Set the variable solution at time n.
311327 * \param[in] iPoint - Point index.
@@ -322,6 +338,14 @@ class CVariable {
322338 Solution_time_n1 (iPoint,iVar) = val_sol;
323339 }
324340
341+ /* !
342+ * \brief Set the variable solution at time n-1.
343+ * \param[in] iPoint - Point index.
344+ */
345+ inline void Set_UserDefinedSource (unsigned long iPoint, unsigned long iVar, su2double val_sol) {
346+ UserDefinedSource (iPoint,iVar) = val_sol;
347+ }
348+
325349 /* !
326350 * \brief Virtual Member. Specify a vector to set the velocity components of the solution.
327351 * Multiplied by density for compressible cases.
@@ -485,6 +509,20 @@ class CVariable {
485509 */
486510 inline su2double *GetSolution (unsigned long iPoint) { return Solution[iPoint]; }
487511
512+ /* !
513+ * \brief Get the entire solution of the problem.
514+ * \return Reference to the solution matrix.
515+ */
516+ inline const MatrixType& GetUserDefinedSource () const { return UserDefinedSource; }
517+ inline MatrixType& GetUserDefinedSource () { return UserDefinedSource; }
518+
519+ /* !
520+ * \brief Get the solution of the problem.
521+ * \param[in] iPoint - Point index.
522+ * \return Pointer to the solution vector.
523+ */
524+ inline su2double *GetUserDefinedSource (unsigned long iPoint) { return UserDefinedSource[iPoint]; }
525+
488526 /* !
489527 * \brief Get the old solution of the problem (Runge-Kutta method)
490528 * \param[in] iPoint - Point index.
@@ -2168,6 +2206,11 @@ class CVariable {
21682206 */
21692207 void RegisterSolution_time_n1 ();
21702208
2209+ /* !
2210+ * \brief Register the variables in the user defined source array as input/output variable.
2211+ */
2212+ void RegisterUserDefinedSource ();
2213+
21712214 /* !
21722215 * \brief Set the adjoint values of the solution.
21732216 * \param[in] adj_sol - The adjoint values of the solution.
0 commit comments