From: Yuxiang W. <yw...@vi...> - 2019-04-15 06:10:52
|
Dear Vikram, Thank you again for the pointer (and the patience)! I used the PerfLog class and compared. As you mentioned, the assembly time change is quite small (1.8772 vs 1.8845 sec). And I appreciate your suggestion for checking directly on the type of element as well! Have a great week ahead, Shawn PS the complete timing report: Before including the qrule creation in the loop: ------------------------------------------------------------------------------------------------------------ | Assemble Performance: Alive time=1.88073, Active time=1.87716 | ------------------------------------------------------------------------------------------------------------ | Event nCalls Total Time Avg Time Total Time Avg Time % of Active Time | | w/o Sub w/o Sub With Sub With Sub w/o S With S | |------------------------------------------------------------------------------------------------------------| | | | Entire assembly 1 1.8772 1.877163 1.8772 1.877163 100.00 100.00 | ------------------------------------------------------------------------------------------------------------ | Totals: 1 1.8772 100.00 | ------------------------------------------------------------------------------------------------------------ After including the qrule creation in the loop: ------------------------------------------------------------------------------------------------------------ | Assemble Performance: Alive time=1.88795, Active time=1.88449 | ------------------------------------------------------------------------------------------------------------ | Event nCalls Total Time Avg Time Total Time Avg Time % of Active Time | | w/o Sub w/o Sub With Sub With Sub w/o S With S | |------------------------------------------------------------------------------------------------------------| | | | Entire assembly 1 1.8845 1.884490 1.8845 1.884490 100.00 100.00 | ------------------------------------------------------------------------------------------------------------ | Totals: 1 1.8845 100.00 | ------------------------------------------------------------------------------------------------------------ On Sun, Apr 14, 2019 at 4:11 PM Vikram Garg <vik...@gm...> wrote: > Hi Yuxiang, glad to hear you are getting the expected results. This change > looks correct for your case and should not affect the assembly time by a > significant amount. You could also check for the actual type of element > (QUAD4 or TRI) instead of checking indirectly via the number of nodes. > > You can check the performance change by checking the performance log which > is included at the end of the program's output. Look for something like: > > | System | > | assemble() 1 0.0014 0.001422 0.0028 0.002767 17.59 34.22 | > > Thanks. > Vikram Garg > > vikramvgarg.github.io/ > > > On Sun, Apr 14, 2019 at 5:22 PM Yuxiang Wang <yw...@vi...> wrote: > >> Hi Vikram, >> >> Thank you for your response! >> >> I didn't think about that - I tried to add that inside the loop over >> elements and got the correct results! >> >> Question - do you think that will significantly slow down the assembly, >> because we are now creating qrule and attaching it for every element loop? >> >> What I did was the following: >> >> for (const auto & elem : mesh.active_local_element_ptr_range()) { >> >> const unsigned int n_nodes = elem->n_nodes(); >> >> Order qrule_order; >> >> switch (n_nodes) >> { >> case 3: >> qrule_order = SECOND; >> break; >> >> case 4: >> qrule_order = THIRD; >> break; >> >> default: >> qrule_order = fe_type.default_quadrature_order(); >> break; >> } >> >> QGauss qrule (dim, qrule_order); >> fe->attach_quadrature_rule (&qrule); >> >> Thanks! >> >> Best, >> Shawn >> >> On Sun, Apr 14, 2019 at 2:53 PM Vikram Garg <vik...@gm...> >> wrote: >> >>> Hi Yuxiang, >>> It should be possible to move the construction of the >>> finite element and the specification of the quadrature rule inside the loop >>> over elements. Did this give any errors, or is otherwise unfeasible for >>> performance reasons ? >>> >>> Thanks. >>> Vikram Garg >>> >>> vikramvgarg.github.io/ >>> >>> >>> On Sun, Apr 14, 2019 at 4:30 PM Yuxiang Wang <yw...@vi...> wrote: >>> >>>> Dear all, >>>> >>>> Sorry for the spam. >>>> >>>> I have a mix of QUAD4 and TRI3 elements in my mesh, and would like to >>>> use >>>> different quadrature rule orders for each type. Specifically, I'd like >>>> to >>>> have order THIRD for QUAD4 and SECOND for TRI3. By default, the orders >>>> are >>>> both THIRD. >>>> >>>> In most examples, I noticed that the specification of qrule is only for >>>> the >>>> entire FEType and not dependent on the element type (e.g. QUAD4 vs >>>> TRI3). >>>> Could you please share with me some hints on how to make >>>> element-dependent >>>> qrule order selection happen? >>>> >>>> Best, >>>> Shawn >>>> >>>> >>>> -- >>>> Yuxiang "Shawn" Wang, PhD >>>> yw...@vi... >>>> +1 (434) 284-0836 >>>> >>>> _______________________________________________ >>>> Libmesh-users mailing list >>>> Lib...@li... >>>> https://lists.sourceforge.net/lists/listinfo/libmesh-users >>>> >>> >> >> -- >> Yuxiang "Shawn" Wang, PhD >> yw...@vi... >> +1 (434) 284-0836 >> > -- Yuxiang "Shawn" Wang, PhD yw...@vi... +1 (434) 284-0836 |