Dear all, 

after some time I came back to this problem again. I would kindly ask for 
some guidance to see if I can understand and solve the issue.
I am using a parallel::distributed::Triangulation with MPI.  I call the 
function solve() in a loop for different frequencies and want to export the 
solution of the whole domain for each frequency.
The code looks like:

*for ( int i= f0; i < fend; ++i)*
*{*
*....*
*solve();  // solve a frequency*

*testvec=locally_relevant_solution;   //extract the solution*

*// DataOut *
*DataOut<dim> data_out;*
*data_out.attach_dof_handler(dof_handler);*

*string f_output("sol_" + std::to_string(i) + ".txt");*
*std::ofstream outloop(f_output);*
*testvec.print(outloop,9,true,false); // Save txt file with solution for 1 
frequency.*
*}*

The way of extracting and exporting the solution with 
*testvec=locally_relevant_solution * is a bad practice? I am saving the 
locally relevant solution from many different processes in one single file 
for a given frequency. I am afraid that there is no synchronization between 
processes and the results will be saved without following the right order 
of DOF (which is needed for me). Is this statement correct?
In that case, what would be the better way to export my domain for each 
frequency? 

Another issue that I found is that this approach increases dramatically the 
computational time of the run() function. For a particular case, solving 
the domain takes 1h without exporting the domain, while it takes 8h adding 
the previous piece of code to export the domain. Is this because the print 
function is slow or there is some sync going on when calling 
*testvec=locally_relevant_solution?*

I would really appreciate if  you can clarify and guide mee to solve this 
issue.
Thank you very much
Regards

El jueves, 17 de febrero de 2022 a las 19:02:07 UTC+1, Wolfgang Bangerth 
escribió:

> On 2/17/22 09:22, Uclus Heis wrote:
> > 
> > I still had problems as I first copy the array and then I store it in a 
> matrix 
> > for diffeerent frequencies.The result I got was differet whene using few 
> > process compared to using 1 single process. I added the following code 
> and now 
> > works, is it right?
>
> It copies a vector into a row of a matrix. Whether that's what you want is 
> a 
> different question, so we can't tell you whether it's "right" :-)
>
> You can simplify this by saying
> tmparray = locally_relevant_solution;
>
> 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/c7b78893-9758-4f26-b46c-7bb62c95662dn%40googlegroups.com.

Reply via email to