More questions regarding this topic.

Could I initialize to a certain value all the degrees of freedom of a
variable declared in an ExplicitSystem?

How could I access the value of that field in a certain element while I'm
iterating through the elements? For example in the element_time_derivative
routine. I thought of doing something similar to what is shown in example
fem_system2:

  // Get system called Densities
  ExplicitSystem& aux_system =
this->get_equation_systems().get_system<ExplicitSystem>("Densities");
  // Array to hold the dof indices
  std::vector<dof_id_type> densities_index;
  // Array to hold the values
  std::vector<Number> density;
  // Get dof indices, system has only one variable
  aux_system.get_dof_map().dof_indices(&c.get_elem(), densities_index, 0);
  // Get the value, stored in density
  aux_system.current_local_solution->get(densities_index, density);

Is there a better way? Something like using a context

Thanks
Miguel


On Thu, Aug 21, 2014 at 12:46 PM, Miguel Angel Salazar de Troya <
[email protected]> wrote:

> If I add that ExplicitSystem as you mention, I will obtain one degree of
> freedom per element, and they will be actually numbered from 0 to the
> number of elements and will change accordingly with the refinement or
> coarsening, won't they? This would be pretty convenient for me because I
> want to perform a matrix-vector operation. The vector would be the zeroth
> order monomial variable and the matrix would have a size of number of
> elements x number of elements.
>
> Thanks
> Miguel
>
>
> On Thu, Aug 21, 2014 at 11:28 AM, Miguel Angel Salazar de Troya <
> [email protected]> wrote:
>
>> The safest thing to do in this case is usually to create an
>> ExplicitSystem, attach it to your EquationSystems, and give it
>> variables corresponding to the data you want to store; e.g. for one
>> Number per Elem you'd give it a zeroth order monomial variable.
>>
>> This is exactly what I needed. Thanks a lot.
>>
>>
>> On Thu, Aug 21, 2014 at 11:19 AM, Roy Stogner <[email protected]>
>> wrote:
>>
>>>
>>> On Thu, 21 Aug 2014, Roy Stogner wrote:
>>>
>>>  after renumbering takes place (e.g. in the Mesh construction or the
>>>> EquationSystems reinit) then all the ids will be sequential.
>>>>
>>>
>>> It sounds like John just contradicted me, but really I just answered
>>> the question you asked but he was smart enough to answer the question
>>> you meant to ask: although element ids will be contiguous, some of
>>> those ids will be of parent elements, so "active element" ids will
>>> have gaps.
>>> ---
>>> Roy
>>>
>>
>>
>>
>> --
>> *Miguel Angel Salazar de Troya*
>>
>> Graduate Research Assistant
>> Department of Mechanical Science and Engineering
>> University of Illinois at Urbana-Champaign
>> (217) 550-2360
>> [email protected]
>>
>>
>
>
> --
> *Miguel Angel Salazar de Troya*
> Graduate Research Assistant
> Department of Mechanical Science and Engineering
> University of Illinois at Urbana-Champaign
> (217) 550-2360
> [email protected]
>
>


-- 
*Miguel Angel Salazar de Troya*
Graduate Research Assistant
Department of Mechanical Science and Engineering
University of Illinois at Urbana-Champaign
(217) 550-2360
[email protected]
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to