Skip to content

Conversation

@edfink234
Copy link
Contributor

This PR would like to add hyperbolic1D_upwind.cpp as the C++ version of hyperbolic1D_upwind.m. This addresses issue #62

@jbrzensk
Copy link
Collaborator

This need to be updated ith the latest commits in MOLE, and can you implement the same looping structure you did with RK2, so there is no need for #include <thread>

You can pass loop commands to gnuplot in the script, the following has the output called "gp_script", but the point is the same:

    dataFile << "set terminal qt\n";
    dataFile << "set xlabel 'x'\n";
    dataFile << "set ylabel 'u(x,t)'\n";
    dataFile << "set xrange [0.0:1.0]\n";
    dataFile << "set yrange [-1.5:1.5]\n";
    dataFile << "set grid\n";
    dataFile << "do for [i=0:" << steps << "] {\n";
    dataFile << "    plot 'results.dat' index i using 1:2 with linespoints title sprintf('t = %.2f', i*" << dt << ")\n";
    dataFile << "    pause 0.1\n";
    dataFile << "}\n";

@edfink234
Copy link
Contributor Author

Ok, I think I've fixed it, please lmk if it looks good.

@mdumett mdumett self-requested a review February 21, 2025 19:26
@mdumett
Copy link
Collaborator

mdumett commented Feb 27, 2025

Please, even though that is not in the comments of the MATLAB code, indicate in the top comments of your code which equation is being solved, its time and space domains and its initial and boundary conditions.

@edfink234
Copy link
Contributor Author

Please, even though that is not in the comments of the MATLAB code, indicate in the top comments of your code which equation is being solved, its time and space domains and its initial and boundary conditions.

Thanks for the feedback! I just added this.

@mdumett
Copy link
Collaborator

mdumett commented Apr 2, 2025

  1. There are some constants in your code whose value are known before compilation.
  2. These should be constexpr, like the constant pi. In addition, could results.dat and gp_script be defined as constants?
  3. Look into cstdlib for return code EXIT_FAILURE and/or EXIT_SUCCESS

@edfink234
Copy link
Contributor Author

  1. There are some constants in your code whose value are known before compilation.
  2. These should be constexpr, like the constant pi. In addition, could results.dat and gp_script be defined as constants?
  3. Look into cstdlib for return code EXIT_FAILURE and/or EXIT_SUCCESS

I added this! The variables for the results.dat and gp_script files cannot be made const because of their non-const ostream member operators.

Copy link
Collaborator

@mdumett mdumett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, merge your code

@edfink234
Copy link
Contributor Author

Please, merge your code

sorry, how do I do this?

@mdumett
Copy link
Collaborator

mdumett commented Apr 4, 2025

Just take a look at the green button (Merge pull request) at the end of the pull request conversations

@edfink234
Copy link
Contributor Author

I don't see this, and I don't think I have this permission...

@mdumett mdumett merged commit fcba46f into csrc-sdsu:master Apr 4, 2025
3 of 4 checks passed
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 this pull request may close these issues.

3 participants