On 12/10/21 03:23, Shahin Heydari wrote:
raw_flux_matrix(i,j) =
mass_matrix(i,j) * (solution_ul(i) - solution_ul(j))
-
mass_matrix(i,j) * (old_solution_u(i) - old_solution_u(j))
-
time_step * theta * matrix_D(i,j) * (solution_ul(i) - solution_ul(j))
-
time_step * (1-theta) * matrix_D(i,j) * (old_solution_u(i) -
old_solution_u(j));
but the obtained solution is very smeared and the solution does not do
one complete rotation as it supposed to do. I think the problem might be
that I have made a mistake in computing mij, dij and ul in the global
indices.
I suspect that you won't get anyone here who has the interest,
knowledge, and time to go through your code to check out what is the
problem. So it comes down to how you can debug the problem and my
suggestion always is to pick simple cases: For example, choose an
initial condition that is a step function and for which you can compute
everything on a piece of paper, run one time step, and compare what you
get with what you expected.
In any case, the code snippet you show that loops through the matrix
entries is at least conceptually correct, though I will point out that
this...
for(auto jt = sparsity_pattern.begin(i); jt !=
sparsity_pattern.end(i); jt++);
const auto j = jt->column();
...looks funny to me: The semicolon at the end of the for(...); line
means that the loop has an empty loop body. But then the variable 'jt'
would not actually live outside the loop body, and I would have expected
that you get an error message in the second line. In any case, the
following line that computes raw_flux_matrix is not within the loop body
because there are no curly braces, and so does not seem to be executed
for every 'j'. That doesn't seem right, but I infer that the code does
not compile that way, and so it must not be exactly what you have in
your code.
As I know, when we are inside the cell and want to access the
value of global matrix or vector we can compute the value at the
quadrature point for example as follow:
std::vector<double> old_solution_u_values(n_q_points);
fe_values.get_function_values(old_solution_u , old_solution_u_values);
I don't get that comment. I thought you were just working with nodal
values of the solution for the AFC. Why do you need the values at
quadrature points?
Now I am just wondering how I can access the entry of the global matrix
and vector in this case.
And I don't understand this question because you have already figured
this out.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: [email protected]
www: http://www.math.colostate.edu/~bangerth/
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/ecb298b0-ebd4-619b-5a4a-836033b52ef4%40colostate.edu.