Skip to content
Snippets Groups Projects
Unverified Commit c48d67ec authored by orestis.malaspin's avatar orestis.malaspin
Browse files

with the cosine

parent a939958c
Branches
No related tags found
No related merge requests found
......@@ -18,27 +18,27 @@ int main(int argc, char *argv[]) {
double dt = 0.001;
double max_t = 5.0;
int i = 0;
PLFLT x[NSIZE], y[NSIZE];
PLFLT xmin = 0., xmax = max_t, ymin = 0., ymax = rc.eps;
PLFLT xmin = 0., xmax = max_t, ymin = rc.eps-1, ymax = rc.eps+1;
for (double t = 0.0; t < max_t; t += dt) {
double ve = exact_solution(t, v_ini, &rc);
printf("t = %f, v = %f, v_e = %f, diff = %f\n", t, v, ve, ve - v);
x[i] = t;
y[i] = v;
v = rc_advance(v, dt, &rc);
i += 1;
}
v = v_ini = 1.0;
double omega = 0.0;
double omega = 10.0;
int i = 0;
for (double t = 0.0; t < max_t; t += dt) {
rc.eps = sin(omega * t);
rc.eps = v_ini * (1.0 + cos(omega * t));
double ve = exact_solution(t, v_ini, &rc);
printf("t = %f, v = %f, v_e = %f, diff = %f\n", t, v, ve, ve - v);
x[i] = t;
y[i] = v;
v = rc_advance(v, dt, &rc);
i += 1;
}
// Parse and process command line arguments
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment