Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

step-32 seems to assign vectors the wrong way around. #16333

Closed
bangerth opened this issue Dec 8, 2023 · 2 comments · Fixed by #16462
Closed

step-32 seems to assign vectors the wrong way around. #16333

bangerth opened this issue Dec 8, 2023 · 2 comments · Fixed by #16462
Milestone

Comments

@bangerth
Copy link
Member

bangerth commented Dec 8, 2023

In investigating #16332 , I also found this piece of code:

    {
      TimerOutput::Scope timer_section(computing_timer,
                                       "   Assemble temperature rhs");

      old_time_step = time_step;

      const double scaling = (dim == 3 ? 0.25 : 1.0);
      time_step            = (scaling / (2.1 * dim * std::sqrt(1. * dim)) /
                   (parameters.temperature_degree * get_cfl_number()));

      const double maximal_velocity = get_maximal_velocity();
      pcout << "   Maximal velocity: "
            << maximal_velocity * EquationData::year_in_seconds * 100
            << " cm/year" << std::endl;
      pcout << "   "
            << "Time step: " << time_step / EquationData::year_in_seconds
            << " years" << std::endl;

      temperature_solution = old_temperature_solution;

This last assignment seems fishy to me: We should never be assigning the old temperature to the current solution vector. I have no idea what is going on here. We ought to investigate.

@bangerth bangerth added this to the Release 9.6 milestone Dec 8, 2023
@tjhei
Copy link
Member

tjhei commented Dec 27, 2023

I would think this is to set the initial guess for the linear solver. I checked and temperature_solution is not used in the assembly.

So, one could move this assignment right before the solve (around line 2915) or, even better, just use old_temperature_solution in the assignment:

distributed_temperature_solution = temperature_solution;

@kronbichler
Copy link
Member

Yes, this is definitely to use as an initial guess (albeit not a very good one, it would get better by an extrapolation of more old solutions, or even a least squares fit). I agree with @tjhei in that we should make the assignment at the place where the system gets solved, to clearly indicate the purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants