@@ -643,6 +643,12 @@ void initialize(Simulation* simulation, Vector<double>& timeP)
643643 solutions.current .Y .resize (tDof, tnNo);
644644 solutions.current .D .resize (tDof, tnNo);
645645
646+ // Initialize current solution from old solution
647+ // (will be modified by set_bc_dir later, before Integrator creation)
648+ solutions.current .A = solutions.old .A ;
649+ solutions.current .Y = solutions.old .Y ;
650+ solutions.current .D = solutions.old .D ;
651+
646652 com_mod.Bf .resize (nsd,tnNo);
647653
648654 // [TODO] DaveP not implemented?
@@ -770,8 +776,9 @@ void initialize(Simulation* simulation, Vector<double>& timeP)
770776 rmsh.D0 = solutions.old .D ;
771777 } // resetSim
772778
773- // Initialize new variables
774- // An, Yn, Dn moved to Integrator class (initialized there from Ao, Yo, Do)
779+ // An, Yn, Dn are now part of SolutionStates struct (solutions.current)
780+ // They are initialized from Ao, Yo, Do earlier in this function
781+ // and will be modified by set_bc_dir() before being passed to Integrator
775782
776783 for (int iM = 0 ; iM < nMsh; iM++) {
777784 if (cm.mas (cm_mod)) {
@@ -840,13 +847,13 @@ void initialize(Simulation* simulation, Vector<double>& timeP)
840847 post::ppbin2vtk (simulation);
841848 }
842849
843- // Making sure the old solution satisfies BCs
850+ // Making sure the solution satisfies BCs
844851 //
845- // Modifies Ao, Yo, Do (via solutions struct)
852+ // Modifies both old ( Ao, Yo, Do) and current (An, Yn, Dn) solution arrays
846853 //
847854 set_bc::set_bc_dir (com_mod, solutions);
848855
849- // Preparing TXT files (pass solutions since An, Dn, and Yn haven't been created in Integrator yet)
856+ // Preparing TXT files
850857 txt_ns::txt (simulation, true , solutions);
851858
852859 // Printing the first line and initializing timeP
0 commit comments