@@ -272,7 +272,7 @@ EquationSystem::FormLegacySystem(mfem::OperatorHandle & op,
272272 mfem ::Vector aux_x , aux_rhs ;
273273 mfem ::HypreParMatrix * aux_a = new mfem ::HypreParMatrix ;
274274 blf -> FormLinearSystem (
275- _ess_tdof_lists .at (i ), * (_var_ess_constraints .at (i )), * lf , * aux_a , aux_x , aux_rhs , true );
275+ _ess_tdof_lists .at (i ), * (_var_ess_constraints .at (i )), * lf , * aux_a , aux_x , aux_rhs );
276276 _h_blocks (i , i ) = aux_a ;
277277 trueX .GetBlock (i ) = aux_x ;
278278 trueRHS .GetBlock (i ) = aux_rhs ;
@@ -339,35 +339,29 @@ EquationSystem::Mult(const mfem::Vector & sol, mfem::Vector & residual) const
339339
340340 _BlockResidual = 0.0 ;
341341
342- for ( unsigned int i = 0 ; i < _test_var_names . size (); i ++ )
342+ if ( _non_linear )
343343 {
344- auto & test_var_name = _test_var_names .at (i );
344+ for (unsigned int i = 0 ; i < _test_var_names .size (); i ++ )
345+ {
346+ auto & test_var_name = _test_var_names .at (i );
345347
346- int offset = _BlockResidual .GetBlock (i ).Size ();
347- mfem ::Vector b (offset );
348+ int offset = _BlockResidual .GetBlock (i ).Size ();
349+ mfem ::Vector b (offset );
348350
349- auto lf = _lfs .GetShared (test_var_name );
350- lf -> Assemble ();
351- lf -> ParallelAssemble (b );
351+ auto lf = _lfs .GetShared (test_var_name );
352+ lf -> Assemble ();
353+ lf -> ParallelAssemble (b );
352354
353- auto nlf = _nlfs .GetShared (test_var_name );
354- nlf -> Assemble ();
355- nlf -> ParallelAssemble (_BlockResidual .GetBlock (i ));
355+ auto nlf = _nlfs .GetShared (test_var_name );
356+ nlf -> Assemble ();
357+ nlf -> ParallelAssemble (_BlockResidual .GetBlock (i ));
356358
357- _BlockResidual .GetBlock (i ) -= b ;
358- _BlockResidual .GetBlock (i ) *= -1 ;
359+ _BlockResidual .GetBlock (i ) -= b ;
360+ _BlockResidual .GetBlock (i ) *= -1 ;
359361
360- if (_non_linear )
361362 _BlockResidual .GetBlock (i ).SetSubVector (_ess_tdof_lists .at (i ), 0.0 );
362- }
363+ }
363364
364- if (!_non_linear )
365- {
366- const_cast < EquationSystem * > (this )-> FormLinearSystem (_jacobian , _trueBlockSol , _BlockResidual );
367- const_cast < EquationSystem * > (this )-> CopyVec (_BlockResidual , residual );
368- }
369- else
370- {
371365 const_cast < EquationSystem * > (this )-> CopyVec (_BlockResidual , residual );
372366 const_cast < EquationSystem * > (this )-> FormLinearSystem (_jacobian , _trueBlockSol , _BlockResidual );
373367 }
@@ -376,7 +370,9 @@ EquationSystem::Mult(const mfem::Vector & sol, mfem::Vector & residual) const
376370
377371 if (!_non_linear )
378372 {
379- _jacobian -> AddMult (sol , residual );
373+ //_jacobian->AddMult(sol, residual);
374+ residual = 0.0 ;
375+ _jacobian -> Mult (sol , residual );
380376 }
381377
382378 sol .HostRead ();
0 commit comments