Hi Corbin,

The cell-wise solution corresponding to the p field could be determined as
follows:
```
dealii::FEValuesExtractorScalar pressureExtractor(2); //assuming you have
three scalar fields and pressure is the last one
dealii::Vector<double> solVecPerCell(nDOFsPerCell);
feValues[pressureExtractor].get_function_values(totalSolution,
solVecPerCell); // here only the values corresponding to pressure are
filled.
```
You could then use this cell-wise values of the p-field in whatever manner
you wish.

Another alternative approach, which I employ, is to use BlockVector object,
wherein one can easily get the total solution vector corresponding to any
of the fields.

Best regards,
Paras

On Thu, Jun 17, 2021 at 7:34 AM Corbin Foucart <corbin.fouc...@gmail.com>
wrote:

> I've found one way to do this, but I imagine it's not optimal:
>
>    - call DoFRenumbering::component_wise(fesys_dofh)
>    - Do the finite element solve
>    - then copy from one vector to another using the number of dofs in
>    that component and an offset
>    - This isn't great, however, because I'd rather store the fesys dofh
>    cell-by-cell for memory-friendliness, as almost all other operations are
>    elemental
>
> If there's a better way, I'd be glad to know :)
>
> Best,
> Corbin
>
> On Wednesday, June 16, 2021 at 11:21:56 PM UTC-4 Corbin Foucart wrote:
>
>> Hi everyone,
>>
>> This might be a simple question, but I haven't found a straightforward
>> answer in the "handling vector-valued problems" documentation.
>>
>> If I have a Vector<double> which stores the solution to an FESystem, say
>> 3 FE_DGQ fields for u, v, p, and I want to extract a new Vector<double>
>> which corresponds to only the pressure, what's the best way to do this?
>>
>> I'm not looking to write the data out for visualization, how to use the
>> DataComponentInterpretation classes is clear to me. What I want to do is
>> extract a separate Vector<double> which I can then add to another DG scalar
>> field of the same type as p in the (u,v,p) system.
>>
>> I don't need p at the quadrature points, only the nodal values to add to
>> another nodal field.
>>
>> Any advice would be appreciated!
>> Corbin
>>
> --
> 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/2bb1442a-830e-46a2-8639-8eec8b101e15n%40googlegroups.com
> <https://groups.google.com/d/msgid/dealii/2bb1442a-830e-46a2-8639-8eec8b101e15n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAEU6zmQuPz4OQG4g%2BW%2B20Ax9jEvZzi0fDPb8yKJM391po7h%2BtA%40mail.gmail.com.

Reply via email to