← Back to team overview

dolfin team mailing list archive

Re: [Question #103034]: Different norms of a functional

 

Question #103034 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/103034

Murtazo Nazarov posted a new comment:
Anders Logg wrote:
> Your question #103034 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/103034
>
> Anders Logg posted a new comment:
> On Mon, Mar 15, 2010 at 03:45:30PM -0000, Murtazo Nazarov wrote:
>   
>> Question #103034 on DOLFIN changed:
>> https://answers.launchpad.net/dolfin/+question/103034
>>
>> Murtazo Nazarov posted a new comment:
>> Anders Logg wrote:
>>     
>>> Your question #103034 on DOLFIN changed:
>>> https://answers.launchpad.net/dolfin/+question/103034
>>>
>>> Anders Logg posted a new comment:
>>> On Sun, Mar 14, 2010 at 11:48:21PM -0000, Murtazo Nazarov wrote:
>>>
>>>       
>>>> Question #103034 on DOLFIN changed:
>>>> https://answers.launchpad.net/dolfin/+question/103034
>>>>
>>>> Murtazo Nazarov posted a new comment:
>>>> Murtazo Nazarov wrote:
>>>>
>>>>         
>>>>> Your question #103034 on DOLFIN changed:
>>>>> https://answers.launchpad.net/dolfin/+question/103034
>>>>>
>>>>>     Status: Answered => Open
>>>>>
>>>>> You are still having a problem:
>>>>> Anders Logg wrote:
>>>>>
>>>>>
>>>>>           
>>>>>> Question #103034 on DOLFIN changed:
>>>>>> https://answers.launchpad.net/dolfin/+question/103034
>>>>>>
>>>>>>     Status: Open => Answered
>>>>>>
>>>>>> Anders Logg proposed the following answer:
>>>>>> On Wed, Mar 03, 2010 at 02:36:59AM -0000, Murtazo Nazarov wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> New question #103034 on DOLFIN:
>>>>>>> https://answers.launchpad.net/dolfin/+question/103034
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am wondering how to compute an L1-norm, and L_inf norm of a functional on the cell. For instance how to compute
>>>>>>>
>>>>>>> 1. ||\div(Pu)||_{L_\infty} ?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> Try projecting div(Pu) onto piecewise constants and then pick the
>>>>>> largest absolute value in the vector.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>> I need L_inf norm on the cell. With this way, doesn't give the L_inf for
>>>>> the entire domain?
>>>>>
>>>>> murtazo
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> Instead of projecting div(Pu) onto piecewise constants, I projected it
>>>> into dG(1), with this way I get three values on each cell, which I can
>>>> then pick up the largest of them. That gives me then L_inf_K, where K is
>>>> a cell. Now, I cannot figured out how is the numbering done for the
>>>> dG(1) elements.
>>>>
>>>> If N is a total number of cells, then my projected vector Pdg has 3*N
>>>> elements. How can I pick up elements of Pdg in the cell K?
>>>>
>>>> Thanks,
>>>> murtazo
>>>>
>>>>         
>>> Why do you use DG(1) instead of DG(0)? If you use DG(0), the numbering
>>> is easier.
>>>
>>>
>>>       
>> DG(0) gives me an average of the function I have on the cell, however
>> the values can be large on the vertices especially in the places where
>> shocks exist.
>>
>> murtazo
>>     
>
> ok, then I suggest working through tabulate_dofs in the DofMap class
> to get the degrees of freedom for any given cell. Then you can just
> access those from the vector.
>
> --
> Anders
>
>   

I have some problem with dofmap for dG(1) elements. Here the piece of 
the code I am using:

      const DofMap& dofmap = U.function_space().dofmap();
      real Umax = 0.;
      UFCCell ufc_cell(*cell);
      uint dofsize = dofmap.max_local_dimension();
      uint* cell_dofs = new uint[dofsize];
      dofmap.tabulate_dofs(cell_dofs, ufc_cell, cid);
      for (int i = 0; i < dofsize; i++){
        Umax = max(Umax, fabs(Uarr[cell_dofs[i]]));
      }

It works fine for dG(0), however it gives strange results for dG(1).

Can anyone help?

Thanks,
Murtazo


>   
>>>
>>>       
>>>>>>> 2. ||\div(Pu)||_{L_1} ?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> Try
>>>>>>
>>>>>> M = abs(div(Pu))*dx
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> where u is velocity (vector) and P is pressure (scalar). L2 norm is obvious to do.
>>>>>>>
>>>>>>> I use C++ interface
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>       
>
>

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.



Follow ups

References