Re: [deal.II] Re: step-37 multiple DoFHandler's smoother problems

2023-07-10 Thread Sean Johnson
I believe all I had to do was upon initializing the MatrixFree operator I 
needed to include a vector that specified the "selected_row_blocks" which 
allows you to choose which component to use in the underlying matrix free 
object by including a vector with the index of the dof_handlers and 
constriants you choose to use. The n_components function I used still 
returned that the object had 2 components but the solving went through as 
if there were only one.

Thanks for your patience,
Sean Johnson

On Wednesday, July 5, 2023 at 3:03:29 PM UTC-6 Sean Johnson wrote:

> Okay I think I have implemented what I could of step-75. I currently have 
> deal.II compiled without Trilinos and am trying to keep it that way because 
> it is compiled without Trilinos on the high powered computer we will do 
> runs on later. That can change but would cause a headache for someone else 
> so I am just trying to avoid it.
>
> So I created the operator around a MatrixFree object. It allowed me the 
> ability to control m() for the matrix. I still have a problem and I went 
> back to my old version and this was a problem in both of them. Since in the 
> reinit function of the MatrixFree object is given two DoFHandlers, I have a 
> system matrix that expects a two component solution vector and rhs. The 
> solution vector and rhs are scalars with just one component. I am handing 
> both DoFHandlers over just because the computation of the matrix elements 
> depend on some variables I have calculated elsewhere with another 
> DoFHandler.
>
> Thanks for your time so far. I am still actively working on how to address 
> this. If you have any suggestions I am all ears.
> I will also work on a minimal example that causes the error.
>
> Thanks for your time again,
> Sean Johnson
>
> On Tuesday, June 27, 2023 at 3:19:10 PM UTC-6 Sean Johnson wrote:
>
>> I haven't done step-75 but I will look into it today and take a shot at 
>> it. There is nothing special about the way I did it besides that step-37 
>> came earlier so I had already done it and was familiar with that method. 
>> Thank you for your time and suggestion. I'll give an update probably in a 
>> day or so after learning and trying to do step-75.
>>
>> Big picture goal is we are doing a gravity waves simulation where they 
>> implode and form a black hole. Numerically, it has a few variables that 
>> have equations for evolving forward in time and then like three that don't 
>> but do have elliptic equations that if we know all the variables that have 
>> time equations we can then solve them on each time step. Thus the need for 
>> a DG DoFHandler for the time equations and a normal CG DoFHandler for the 
>> elliptic equation variables.
>>
>> Thanks again so much for your time,
>> Sean Johnson
>>
>> On Tuesday, June 27, 2023 at 2:02:59 PM UTC-6 peterr...@gmail.com wrote:
>>
>>> OK. The problem are these lines: 
>>> https://github.com/dealii/dealii/blob/8d68b3192ed1c8b928dfce03ca1d615201859904/include/deal.II/matrix_free/operators.h#L1225-L1235.
>>>  
>>> The number of rows are the sum of the number of DoFs of both attached 
>>> DoFHandlers...
>>>
>>> Personally, I would not use these matrix-free operators but create the 
>>> operator myself around a MatrixFree object. Just like in step-75. Would 
>>> that be possible?
>>>
>>> Out of curiosity, what is your goal?
>>>
>>> Best,
>>> PM
>>>
>>>
>>> On Tuesday, June 27, 2023 at 7:38:48 PM UTC+2 sljoh...@gmail.com wrote:
>>>
 Here is step-37 with minimal changes. All that was changed was in the 
 creation of a DG DoFHandler and the fe_system and constrains and what not 
 to go along with it. Then of the functions only the LapalceProblem 
 setup_system() function was altered and nothing else. It was just altered 
 to also be reinit with the dof_handler_DG.

 Obviously the LaplaceOperator in my actual code actually uses variables 
 that depend on the DG DoFHandler but that was left out of this example.

 Thank you again so much for your time and for all you guys do for this 
 library.

 Thanks,
 Sean Johnson

 On Tuesday, June 27, 2023 at 10:58:53 AM UTC-6 Sean Johnson wrote:

> Yes of course. I can get one with minimal changes made to step-37. 
> Full code do you want the entirety of the changed step-37 code or just 
> the 
> LaplaceProblem class or just the setup_system() function?
>
> On Tuesday, June 27, 2023 at 10:53:04 AM UTC-6 peterr...@gmail.com 
> wrote:
>
>> I'll try to take a look at the issue tomorrow. Could you attach the 
>> full code. I have a feeling what might be an issue. 
>>
>> Peter
>>
>> On Tue, Jun 27, 2023, 18:18 Sean Johnson  wrote:
>>
>>> Okay. Thank you.
>>>
>>> On Tuesday, June 27, 2023 at 10:02:16 AM UTC-6 Wolfgang Bangerth 
>>> wrote:
>>>
 On 6/27/23 09:53, Sean Johnson wrote: 
 > I keep seeing other questions getting at least one response. Is 

[deal.II] Matrix Free Multiple DoFHandlers

2023-07-10 Thread Sean Johnson
Hello it is me again,

I am trying to something very similar to this 
discussion: https://groups.google.com/g/dealii/c/Hh4iBsM21FI/m/cF-mzDP4GkwJ

My question would be how could I pass the solution vector of the 
pre-determined solution into the matrix free operator.

I know this is a bad idea but currently I have the vector as a global 
variable so I don't have to pass it into the local_apply function or 
anything really. I do call initialize_dof_vector with the correct index but 
in the conjugate gradient solve function the preconditioner throws the 
error included at the bottom of this message.

Also, attached is the just the setup_system() function similar to step-37 
to try and keep code to a minimal. Nothing has been altered in the solve() 
function from step-37 in the code.

Thanks if anyone has the time to get to this beforehand,
Sean Johnson


An error occurred in line <238> of file 

 
in function
void dealii::internal::check_vector_compatibility(const VectorType&, 
const dealii::MatrixFree&, const 
dealii::internal::MatrixFreeFunctions::DoFInfo&) [with int dim = 2; Number 
= double; VectorizedArrayType = dealii::VectorizedArray; 
VectorType = dealii::LinearAlgebra::distributed::Vector; typename 
std::enable_if, 
VectorType>::type*  = 0]
The violated condition was: 
false
Additional information: 
The parallel layout of the given vector is compatible neither with the
Partitioner of the current FEEvaluation with dof_handler_index=1 nor
with any Partitioner in MatrixFree. A potential reason is that you did
not use MatrixFree::initialize_dof_vector() to get a compatible
vector.

Stacktrace:
---
#0  ./step-37_minimal: void dealii::internal::check_vector_compatibility<2, 
double, dealii::VectorizedArray, 
dealii::LinearAlgebra::distributed::Vector, 
(dealii::LinearAlgebra::distributed::Vector*)0>(dealii::LinearAlgebra::distributed::Vector const&, dealii::MatrixFree<2, double, 
dealii::VectorizedArray > const&, 
dealii::internal::MatrixFreeFunctions::DoFInfo const&)
#1  ./step-37_minimal: void dealii::FEEvaluationBase<2, 1, double, false, 
dealii::VectorizedArray 
>::read_write_operation const, dealii::internal::VectorReader > 
>(dealii::internal::VectorReader > const&, 
std::array const*, 1ul> const&, 
std::array::value_type const, dealii::MemorySpace::Host>, 
std::allocator::value_type const, dealii::MemorySpace::Host> > 
> const*, 1ul> const&, std::bitset<2ul> const&, bool) const
#2  ./step-37_minimal: void dealii::FEEvaluationBase<2, 1, double, false, 
dealii::VectorizedArray 
>::read_dof_values 
>(dealii::LinearAlgebra::distributed::Vector const&, unsigned int, std::bitset<2ul> const&)
#3  ./step-37_minimal: Step37::LaplaceOperator<2, 3, 
double>::local_apply(dealii::MatrixFree<2, double, 
dealii::VectorizedArray > const&, 
dealii::LinearAlgebra::distributed::Vector&, 
dealii::LinearAlgebra::distributed::Vector const&, std::pair 
const&) const
#4  ./step-37_minimal: dealii::internal::MFWorker >, 
dealii::LinearAlgebra::distributed::Vector, 
dealii::LinearAlgebra::distributed::Vector, Step37::LaplaceOperator<2, 3, double>, 
true>::process_range(void (Step37::LaplaceOperator<2, 3, double>::* 
const&)(dealii::MatrixFree<2, double, dealii::VectorizedArray 
> const&, dealii::LinearAlgebra::distributed::Vector&, 
dealii::LinearAlgebra::distributed::Vector const&, std::pair 
const&) const, std::vector > 
const&, std::vector > const&, 
unsigned int)
#5  ./step-37_minimal: dealii::internal::MFWorker >, 
dealii::LinearAlgebra::distributed::Vector, 
dealii::LinearAlgebra::distributed::Vector, Step37::LaplaceOperator<2, 3, double>, 
true>::cell(unsigned int)
#6  /home/sjohnson/AE_beginnings/dealii/lib/libdeal_II.g.so.9.4.0: 
dealii::internal::MatrixFreeFunctions::TaskInfo::loop(dealii::internal::MFWorkerInterface&)
 
const
#7  ./step-37_minimal: void dealii::MatrixFree<2, double, 
dealii::VectorizedArray 
>::cell_loop, 
dealii::LinearAlgebra::distributed::Vector, 
dealii::LinearAlgebra::distributed::Vector >(void (Step37::LaplaceOperator<2, 3, 
double>::*)(dealii::MatrixFree<2, double, dealii::VectorizedArray > const&, dealii::LinearAlgebra::distributed::Vector&, 
dealii::LinearAlgebra::distributed::Vector const&, std::pair 
const&) const, Step37::LaplaceOperator<2, 3, double> const*, 
dealii::LinearAlgebra::distributed::Vector&, 
dealii::LinearAlgebra::distributed::Vector const&, bool) const
#8  ./step-37_minimal: Step37::LaplaceOperator<2, 3, 
double>::apply_add(dealii::LinearAlgebra::distributed::Vector&, 
dealii::LinearAlgebra::distributed::Vector const&) const
#9  ./step-37_minimal: dealii::MatrixFreeOperators::Base<2, 
dealii::LinearAlgebra::distributed::Vector, dealii::VectorizedArray 
>::mult_add(dealii::LinearAlgebra::distributed::Vector&, 
dealii::LinearAlgebra::distributed::Vector const&, bool) const
#10  ./step-37_minimal: dealii::MatrixFreeOperators::Base<2, 
dealii::LinearAlgebra::distributed::Vector, deal

Re: [deal.II] Re: Finding unconnected regions in a triangulation

2023-07-10 Thread Kaushik Das
I see. thanks for the tip.

On Mon, Jul 10, 2023 at 1:07 PM Daniel Arndt  wrote:

> Kaushik,
>
> The implementation for those functions is pretty simple so it shouldn't be
> too hard to modify them to meet your needs, see
> https://dealii.org/current/doxygen/deal.II/grid__tools_8cc_source.html#l03828
> .
>
> Best,
> Daniel
>
> On Mon, Jul 10, 2023 at 1:01 PM Kaushik Das  wrote:
>
>> Hi   Bruno, thank you very much for your quick reply. This is what I was
>> looking for. Thanks. But I have another question, is there a way the
>> generate these graph by only considering a subset of cells from a
>> triangulation? Like cells that has a specific fe_index or material_id or
>> flags? Thank you.
>>
>> On Mon, Jul 10, 2023 at 11:43 AM Bruno Turcksin 
>> wrote:
>>
>>> Kaushik,
>>>
>>> You could use get_face_connectivity_of_cells()
>>> 
>>> or get_vertex_connectivity_of_cells()
>>> 
>>> (depending on what you mean by connected) to have a sparsity pattern. This
>>> maps to a graph where the nodes are the cells, now you just need to check
>>> if the graph is connected see here
>>> 
>>>
>>> Best,
>>>
>>> Bruno
>>> On Monday, July 10, 2023 at 10:33:21 AM UTC-4 k.d...@gmail.com wrote:
>>>
 Hi all,
 Is there any way to find or count number of unconnected regions in a
 triangulation. Triangulation will have non zero refinement levels.
 Thanks,
 Kaushik

>>> --
>>> 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 a topic in the
>>> Google Groups "deal.II User Group" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/dealii/gQH57TWRGP0/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> dealii+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/dealii/c77b5d42-9228-497a-ab2b-2ac25dc06fb7n%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> 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 dealii+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/dealii/CAC-fs6vmote0mqgCu7d60EjRrsAHpRPw-kSXeJJRtaFXg%2BXDtw%40mail.gmail.com
>> 
>> .
>>
> --
> 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 a topic in the
> Google Groups "deal.II User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/dealii/gQH57TWRGP0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/CAOYDWbKH7hTA9PhQ8kE%2Bx8eUONPLjqGMCipEnWF9UYpKbLvX1g%40mail.gmail.com
> 
> .
>

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAC-fs6t3jSRmm7PmTN_21rpRP%3DUazcT1p1nk28KGojBt-Q8jqg%40mail.gmail.com.


Re: [deal.II] Re: Finding unconnected regions in a triangulation

2023-07-10 Thread Daniel Arndt
Kaushik,

The implementation for those functions is pretty simple so it shouldn't be
too hard to modify them to meet your needs, see
https://dealii.org/current/doxygen/deal.II/grid__tools_8cc_source.html#l03828
.

Best,
Daniel

On Mon, Jul 10, 2023 at 1:01 PM Kaushik Das  wrote:

> Hi   Bruno, thank you very much for your quick reply. This is what I was
> looking for. Thanks. But I have another question, is there a way the
> generate these graph by only considering a subset of cells from a
> triangulation? Like cells that has a specific fe_index or material_id or
> flags? Thank you.
>
> On Mon, Jul 10, 2023 at 11:43 AM Bruno Turcksin 
> wrote:
>
>> Kaushik,
>>
>> You could use get_face_connectivity_of_cells()
>> 
>> or get_vertex_connectivity_of_cells()
>> 
>> (depending on what you mean by connected) to have a sparsity pattern. This
>> maps to a graph where the nodes are the cells, now you just need to check
>> if the graph is connected see here
>> 
>>
>> Best,
>>
>> Bruno
>> On Monday, July 10, 2023 at 10:33:21 AM UTC-4 k.d...@gmail.com wrote:
>>
>>> Hi all,
>>> Is there any way to find or count number of unconnected regions in a
>>> triangulation. Triangulation will have non zero refinement levels.
>>> Thanks,
>>> Kaushik
>>>
>> --
>> 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 a topic in the
>> Google Groups "deal.II User Group" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/dealii/gQH57TWRGP0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> dealii+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/dealii/c77b5d42-9228-497a-ab2b-2ac25dc06fb7n%40googlegroups.com
>> 
>> .
>>
> --
> 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 dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/CAC-fs6vmote0mqgCu7d60EjRrsAHpRPw-kSXeJJRtaFXg%2BXDtw%40mail.gmail.com
> 
> .
>

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAOYDWbKH7hTA9PhQ8kE%2Bx8eUONPLjqGMCipEnWF9UYpKbLvX1g%40mail.gmail.com.


Re: [deal.II] Re: Finding unconnected regions in a triangulation

2023-07-10 Thread Kaushik Das
Hi   Bruno, thank you very much for your quick reply. This is what I was
looking for. Thanks. But I have another question, is there a way the
generate these graph by only considering a subset of cells from a
triangulation? Like cells that has a specific fe_index or material_id or
flags? Thank you.

On Mon, Jul 10, 2023 at 11:43 AM Bruno Turcksin 
wrote:

> Kaushik,
>
> You could use get_face_connectivity_of_cells()
> 
> or get_vertex_connectivity_of_cells()
> 
> (depending on what you mean by connected) to have a sparsity pattern. This
> maps to a graph where the nodes are the cells, now you just need to check
> if the graph is connected see here
> 
>
> Best,
>
> Bruno
> On Monday, July 10, 2023 at 10:33:21 AM UTC-4 k.d...@gmail.com wrote:
>
>> Hi all,
>> Is there any way to find or count number of unconnected regions in a
>> triangulation. Triangulation will have non zero refinement levels.
>> Thanks,
>> Kaushik
>>
> --
> 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 a topic in the
> Google Groups "deal.II User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/dealii/gQH57TWRGP0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/c77b5d42-9228-497a-ab2b-2ac25dc06fb7n%40googlegroups.com
> 
> .
>

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAC-fs6vmote0mqgCu7d60EjRrsAHpRPw-kSXeJJRtaFXg%2BXDtw%40mail.gmail.com.


[deal.II] Re: Finding unconnected regions in a triangulation

2023-07-10 Thread Bruno Turcksin
Kaushik,

You could use get_face_connectivity_of_cells() 

 
or get_vertex_connectivity_of_cells() 

 
(depending on what you mean by connected) to have a sparsity pattern. This 
maps to a graph where the nodes are the cells, now you just need to check 
if the graph is connected see here 


Best,

Bruno
On Monday, July 10, 2023 at 10:33:21 AM UTC-4 k.d...@gmail.com wrote:

> Hi all,
> Is there any way to find or count number of unconnected regions in a 
> triangulation. Triangulation will have non zero refinement levels. 
> Thanks,
> Kaushik 
>

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/c77b5d42-9228-497a-ab2b-2ac25dc06fb7n%40googlegroups.com.


[deal.II] Finding unconnected regions in a triangulation

2023-07-10 Thread Kaushik Das
Hi all,
Is there any way to find or count number of unconnected regions in a 
triangulation. Triangulation will have non zero refinement levels. 
Thanks,
Kaushik 

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/6cedc1e1-fa5e-4f31-9281-e819d0a7a594n%40googlegroups.com.