From 88ed3769c246b436be5f8d7a0b81cc3fde0c7459 Mon Sep 17 00:00:00 2001 From: Justin Angus Date: Mon, 26 Aug 2024 08:25:25 -0700 Subject: [PATCH] minor comment update implicit solver classes. --- .../ImplicitSolvers/SemiImplicitEM.cpp | 16 ++++++++-------- .../ImplicitSolvers/ThetaImplicitEM.cpp | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/FieldSolver/ImplicitSolvers/SemiImplicitEM.cpp b/Source/FieldSolver/ImplicitSolvers/SemiImplicitEM.cpp index 897bd5c07f3..1477c36b2f8 100644 --- a/Source/FieldSolver/ImplicitSolvers/SemiImplicitEM.cpp +++ b/Source/FieldSolver/ImplicitSolvers/SemiImplicitEM.cpp @@ -64,24 +64,24 @@ void SemiImplicitEM::OneStep ( amrex::Real a_time, { amrex::ignore_unused(a_step); - // Fields have E^{n}, B^{n-1/2} - // Particles have p^{n} and x^{n}. + // Fields have Eg^{n}, Bg^{n-1/2} + // Particles have up^{n} and xp^{n}. // Save the values at the start of the time step, m_WarpX->SaveParticlesAtImplicitStepStart ( ); // Save the fields at the start of the step m_Eold.Copy( m_WarpX->getMultiLevelField(FieldType::Efield_fp) ); - m_E.Copy(m_Eold); // initial guess for E - // Compute Bfield at time n+1/2 + // Advance WarpX owned Bfield_fp to t_{n+1/2} m_WarpX->EvolveB(a_dt, DtType::Full); m_WarpX->ApplyMagneticFieldBCs(); const amrex::Real half_time = a_time + 0.5_rt*a_dt; - // Solve nonlinear system for E at t_{n+1/2} + // Solve nonlinear system for Eg at t_{n+1/2} // Particles will be advanced to t_{n+1/2} + m_E.Copy(m_Eold); // initial guess for Eg^{n+1/2} m_nlsolver->Solve( m_E, m_Eold, half_time, a_dt ); // Update WarpX owned Efield_fp to t_{n+1/2} @@ -90,8 +90,8 @@ void SemiImplicitEM::OneStep ( amrex::Real a_time, // Advance particles from time n+1/2 to time n+1 m_WarpX->FinishImplicitParticleUpdate(); - // Advance E fields from time n+1/2 to time n+1 - // Eg^{n+1} = 2.0*E_g^{n+1/2} - E_g^n + // Advance Eg from time n+1/2 to time n+1 + // Eg^{n+1} = 2.0*Eg^{n+1/2} - Eg^n m_E.linComb( 2._rt, m_E, -1._rt, m_Eold ); m_WarpX->SetElectricFieldAndApplyBCs( m_E ); @@ -112,6 +112,6 @@ void SemiImplicitEM::ComputeRHS ( WarpXSolverVec& a_RHS, // current state of the fields E and B. Deposit current density at time n+1/2. m_WarpX->ImplicitPreRHSOp( a_time, a_dt, a_nl_iter, a_from_jacobian ); - // RHS = cvac^2*0.5*dt*( curl(B^{n+1/2}) - mu0*J^{n+1/2} ) + // RHS = cvac^2*0.5*dt*( curl(Bg^{n+1/2}) - mu0*Jg^{n+1/2} ) m_WarpX->ImplicitComputeRHSE(0.5_rt*a_dt, a_RHS); } diff --git a/Source/FieldSolver/ImplicitSolvers/ThetaImplicitEM.cpp b/Source/FieldSolver/ImplicitSolvers/ThetaImplicitEM.cpp index 026c509c3ba..5eaf86fd818 100644 --- a/Source/FieldSolver/ImplicitSolvers/ThetaImplicitEM.cpp +++ b/Source/FieldSolver/ImplicitSolvers/ThetaImplicitEM.cpp @@ -85,15 +85,14 @@ void ThetaImplicitEM::OneStep ( const amrex::Real a_time, { amrex::ignore_unused(a_step); - // Fields have E^{n} and B^{n} - // Particles have p^{n} and x^{n}. + // Fields have Eg^{n} and Bg^{n} + // Particles have up^{n} and xp^{n}. // Save the values at the start of the time step, m_WarpX->SaveParticlesAtImplicitStepStart ( ); // Save the fields at the start of the step m_Eold.Copy( m_WarpX->getMultiLevelField(FieldType::Efield_fp) ); - m_E.Copy(m_Eold); // initial guess for E const int num_levels = static_cast(m_Bold.size()); for (int lev = 0; lev < num_levels; ++lev) { @@ -106,8 +105,9 @@ void ThetaImplicitEM::OneStep ( const amrex::Real a_time, const amrex::Real theta_time = a_time + m_theta*a_dt; - // Solve nonlinear system for E at t_{n+theta} + // Solve nonlinear system for Eg at t_{n+theta} // Particles will be advanced to t_{n+1/2} + m_E.Copy(m_Eold); // initial guess for Eg^{n+theta} m_nlsolver->Solve( m_E, m_Eold, theta_time, a_dt ); // Update WarpX owned Efield_fp and Bfield_fp to t_{n+theta} @@ -116,7 +116,7 @@ void ThetaImplicitEM::OneStep ( const amrex::Real a_time, // Advance particles from time n+1/2 to time n+1 m_WarpX->FinishImplicitParticleUpdate(); - // Advance E and B fields from time n+theta to time n+1 + // Advance Eg and Bg from time n+theta to time n+1 const amrex::Real new_time = a_time + a_dt; FinishFieldUpdate( new_time ); @@ -137,7 +137,7 @@ void ThetaImplicitEM::ComputeRHS ( WarpXSolverVec& a_RHS, // current state of the fields E and B. Deposit current density at time n+1/2. m_WarpX->ImplicitPreRHSOp( a_time, a_dt, a_nl_iter, a_from_jacobian ); - // RHS = cvac^2*m_theta*dt*( curl(B^{n+theta}) - mu0*J^{n+1/2} ) + // RHS = cvac^2*m_theta*dt*( curl(Bg^{n+theta}) - mu0*Jg^{n+1/2} ) m_WarpX->ImplicitComputeRHSE(m_theta*a_dt, a_RHS); } @@ -159,8 +159,8 @@ void ThetaImplicitEM::FinishFieldUpdate ( amrex::Real a_new_time ) { amrex::ignore_unused(a_new_time); - // Eg^{n+1} = (1/theta)*E_g^{n+theta} + (1-1/theta)*E_g^n - // Bg^{n+1} = (1/theta)*B_g^{n+theta} + (1-1/theta)*B_g^n + // Eg^{n+1} = (1/theta)*Eg^{n+theta} + (1-1/theta)*Eg^n + // Bg^{n+1} = (1/theta)*Bg^{n+theta} + (1-1/theta)*Bg^n const amrex::Real c0 = 1._rt/m_theta; const amrex::Real c1 = 1._rt - c0;