     if(deviceCount>1) {
       sys[sysIndex] = new ANCFSystem(sysIndex);
     } else {
-      sys[sysIndex] = new ANCFSystem();
+      sys[sysIndex] = new ANCFSystem(); // Create both systems on the same device
     }
 
     sys[sysIndex]->setTimeStep(hh, 1e-10);


  // if you don't want to visualize, then output the data
  int fileIndex = 0;
#pragma omp parallel shared(workingThread, g_lock)
  {
    int tid = omp_get_thread_num();
    while(true)


      else if (tid == abs(1 - loc_working_thread)) {
        // The non-working thread should update the preconditioner
        cout << "  SYSTEM " << tid << " UPDATE PRECONDITIONER... " << endl;
        sys[tid]->updatePreconditioner();

        omp_set_lock(&g_lock);
        updateDone = true;
        cout << "  PRECONDITIONER UPDATE COMPLETE (" << sys[tid]->precUpdated << ")" << endl;
        workingThread = abs(1 - workingThread);
        omp_unset_lock(&g_lock);
      }

      // If the preconditioner has been updated, or the working thread fails to solve the problem, do a switch
      if (updateDone) {

#pragma omp barrier
        if (sys[loc_working_thread]->time >= t_end) break;
