Re: [deal.II] Use of QGauss object in tutorials

2020-10-08 Thread Xuefeng Li
On Wed, Oct 7, 2020 at 7:19 PM Wolfgang Bangerth 
wrote:

>
> Xuefeng,
>
> > Still on the course of learning dealii by reading through the tutorials.
> Came
> > up with the following observation.
> >
> >  1. In Step-4, a single QGauss object was created in assemble_system(),
> and
> > was used later in assemble_system().
> >  2. In Step-23, multiple copies of the same QGauss object (i.e.,
> > QGauss(fe.degree + 1)) were created and used in setup_system()
> and run().
> >
> > My question is: will the output from Step-23 be any different if we had
> > created a single QGauss object as a global variable and used it anywhere
> that
> > a QGauss object is needed?
>
> Yes, that are all exactly identical, and will yield exactly the same
> result if
> they have the same type QGauss and are created with the same number of
> points
> (given by the argument).
>
> Best
>   W.
>
> Thanks for the confirmation. I was a Java guy. I found C++ quite different
(or liberal) in terms of variable declaration, initialization and memory
release. That's the reason I asked the question. I did learn from your
answer.

-- 
Stay put, practice social distancing, and be safe!

Best,

--Xuefeng Li, (504)865-3340(phone)
   Like floating clouds, the heart rests easy
   Like flowing water, the spirit stays free
  Loyola University New Orleans
   New Orleans, Louisiana (504)865-2051(fax)

-- 
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/CAO2HPGVE_w8yfcZuaLXrd6qnMiPYiR8z2ka_XigorO0zqPFWNw%40mail.gmail.com.


[deal.II] Use of QGauss object in tutorials

2020-10-07 Thread Xuefeng Li
Hi, there!

Still on the course of learning dealii by reading through the tutorials.
Came up with the following observation.

   1. In Step-4, a single QGauss object was created in assemble_system(),
   and was used later in assemble_system().
   2. In Step-23, multiple copies of the same QGauss object (i.e.,
   QGauss(fe.degree + 1)) were created and used in setup_system() and
   run().

My question is: will the output from Step-23 be any different if we had
created a single QGauss object as a global variable and used it anywhere
that a QGauss object is needed?

Thanks a lot for your enlightenment.

-- 
Stay put, practice social distancing, and be safe!

Best,

--Xuefeng Li, (504)865-3340(phone)
   Like floating clouds, the heart rests easy
   Like flowing water, the spirit stays free
  Loyola University New Orleans
   New Orleans, Louisiana (504)865-2051(fax)

-- 
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/CAO2HPGUqZRF7KkhsxRNA86do8coWy%2B0vB1jyrJ_%2BTQ2sAMscKg%40mail.gmail.com.


Re: [deal.II] Function apply_boundary_values()

2020-09-28 Thread Xuefeng Li
On Sun, Sep 27, 2020 at 10:33 PM Wolfgang Bangerth 
wrote:

> On 9/25/20 4:15 PM, Xuefeng Li wrote:
> >
> > For step-26, because system_rhs depends on time and time_step, we need
> to
> > assemble system_rhs in the loop. We therefore
> > need to call apply_boundary_values() inside the loop. Here is my
> question. *If
> > system_matrix were independent of time and time_step*
> > *(such as in the case of uniform time_step), **do we still need to
> assemble
> > system_matrix inside the loop? *
>
> Yes. The problem is that apply_b_v() modifies the system matrix during its
> operation, but it needs the original matrix to do its operations. That
> means
> that once you've run apply_b_v(), you can't run it again because the
> original
> matrix is no longer available.
>
> Whether you get the original matrix through assembly (expensive) or by
> saving
> the unmodified state from before you called apply_b_v() the first time
> around
> (cheap) does not matter.
>
> Thanks a lot. The above answered my original question!!! Have a great week!

-- 
Stay put, practice social distancing, and be safe!

Best,

--Xuefeng Li, (504)865-3340(phone)
   Like floating clouds, the heart rests easy
   Like flowing water, the spirit stays free
  Loyola University New Orleans
   New Orleans, Louisiana (504)865-2051(fax)

-- 
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/CAO2HPGUf%3DvXUDKVmgd%3Dv6rN9pefqr-ritkoKc033b7JVNTLbQg%40mail.gmail.com.


Re: [deal.II] Function apply_boundary_values()

2020-09-25 Thread Xuefeng Li
On Fri, Sep 25, 2020 at 4:29 PM Wolfgang Bangerth 
wrote:

> On 9/25/20 3:07 PM, Xuefeng Li wrote:
> >
> > My question is: will the repeated call to function
> apply_boundary_values()
> > inside the loop
> > alter the system_matrix that is meant to be constant (independent of
> iterate u)?
>
> It doesn't change it any further than it was changed the first time
> around.
> But it doesn't do the appropriate modifications: you need the original
> matrix
> for this to work.
>
>
>
> > If the answer is no, then the above code will be fine, I guess.
> >
> > If the answer is yes, I guess I'll need to assemble system_matrix inside
> the
> > loop repeatedly
> > even though it is independent of the iterate u.
>
> Right. Or do what step-26 does -- gosh darn, there seems to be a tutorial
> program for everything ;-) (It's Friday afternoon and I'm already having a
> drink -- the joster in me is shining through...)
>
> Yes, step-26 assembles system_matrix and system_rhs inside the loop
exactly because they depend on time and time_step.
Time and time_step change during the iteration.

For step-26, because system_rhs depends on time and time_step, we need to
assemble system_rhs in the loop. We therefore
need to call apply_boundary_values() inside the loop. Here is my question. *If
system_matrix were independent of time and time_step*
*(such as in the case of uniform time_step), **do we still need to assemble
system_matrix inside the loop? *

-- 
Stay put, practice social distancing, and be safe!

Best,

--Xuefeng Li, (504)865-3340(phone)
   Like floating clouds, the heart rests easy
   Like flowing water, the spirit stays free
  Loyola University New Orleans
   New Orleans, Louisiana (504)865-2051(fax)

-- 
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/CAO2HPGXZejraohcfxW7GwdJ0aMO_beaAzHh65YBqiqrQpw9fvg%40mail.gmail.com.


[deal.II] Function apply_boundary_values()

2020-09-25 Thread Xuefeng Li
Hi, there!

I have a question concerning the use of the function 
apply_boundary_values():

   MatrixTools::apply_boundary_values(boundary_values,
 system_matrix,
 solution,
 system_rhs);

Iteration is used to find a numerical solution. We know that
  system_matrix is independent of the iterate and remains unchanged during 
the iteration
  system_rhs depends on the iterate so it changes during the iteration 

Below is the pseudo-code of the program.

  initialize iterate u;
  assemble system_matrix; //Just once
  assemble system_rhs; //1st time
  call apply_boundary_values(); //Apply bdry 1st time
  while ( not converged ) {
solve FEM to get new iterate u;
assemble system_rhs; // repeated 
call apply_boundary_values(); // repeated
  }

My question is: will the repeated call to function apply_boundary_values() 
inside the loop
alter the system_matrix that is meant to be constant (independent of 
iterate u)?

If the answer is no, then the above code will be fine, I guess.

If the answer is yes, I guess I'll need to assemble system_matrix inside 
the loop repeatedly
even though it is independent of the iterate u.

Thanks for any assistance.

-- 
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/89a815ca-65e9-48ba-a5f2-76ddcf0848b5o%40googlegroups.com.


Re: [deal.II] Accessing nodal values of a FEM solution

2020-07-25 Thread Xuefeng Li
On Fri, Jul 24, 2020 at 9:58 PM Wolfgang Bangerth 
wrote:

> On 7/23/20 12:07 PM, Xuefeng Li wrote:
> >
> > Well, the above function calculates the gradients of a finite element at
> the
> > quadrature points of a cell, not at the nodal points of a cell.
> > Such a need arises in the following situation.
> >
> > for ( x in vector_of_nodal_points )
> >v(x) = g(x, u(x), grad u(x))
>
> It's worth pointing out, however, that for the common FE_Q elements, the
> function values u(x) are continuous and so it doesn't matter how exactly
> you
> compute u(x) at node points. On the other hand, grad u(x) is in general
> discontinuous and so trying to evaluate it at node points is not actually
> possible: You will either get the values from one adjacent cell or the
> value
> from another.
>
> In other words, if you want to compute a function that depends on 'grad
> u',
> you need to think about what exactly you mean by that. In the formulation
> above, v(x) will in general be a discontinuous function, and you need to
> think
> about whether using FE_Q (a continuous finite element space) is really
> what
> you want to do.
>
> Best
>   W.
>
> Indeed, grad u would be discontinuous under normal conditions when u is
approximated by FE_Q. I remember vaguely that such an issue was discussed
in one or more of the tutorial Step examples. Thanks for your follow-up.

-- 
Stay put, practice social distancing, and be safe!

Best,

--Xuefeng Li, (504)865-3340(phone)
   Like floating clouds, the heart rests easy
   Like flowing water, the spirit stays free
  Loyola University New Orleans
   New Orleans, Louisiana (504)865-2051(fax)

-- 
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/CAO2HPGW9tZ-U0mSuNYQcrzKGtnvg7mSoBA58svEL8DYEtfz%3DPQ%40mail.gmail.com.


Re: [deal.II] Accessing nodal values of a FEM solution

2020-07-24 Thread Xuefeng Li
On Thu, Jul 23, 2020 at 5:14 PM Daniel Arndt  wrote:

>
> You can do similarly,
>
> Quadrature q(fe.get_unit_support_points());
> FEValues fe_values (..., q, update_q_points);
> for (const auto& cell)
>   ...
>   points = fe_values.get_quadrature_points();
>   fe_values.get_function_values(values);
>   fe_values.get_function_gradients(gradients);
>   for (unsigned int i=0; i v(local_dof_indices[i]) = f(points[i],  values(i), gradients(i));
>
>
> Yes! Declaring a quadrature on support points is a great solution. Thanks
a lot!

-- 
Stay put, practice social distancing, and be safe!

Best,

--Xuefeng Li, (504)865-3340(phone)
   Like floating clouds, the heart rests easy
   Like flowing water, the spirit stays free
  Loyola University New Orleans
   New Orleans, Louisiana (504)865-2051(fax)

-- 
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/CAO2HPGW8067gaFaYx2QjVHc719xdUVSh%3Dyg2UdhrFa4U38cn5Q%40mail.gmail.com.


Re: [deal.II] Accessing nodal values of a FEM solution

2020-07-23 Thread Xuefeng Li
On Thu, Jul 23, 2020 at 12:43 PM Daniel Arndt 
wrote:

> However, I have two more related questions. BTW, I am a newbie in C++
>> programming. So my questions may seem absurd.
>>
>>1. Now that we have a vector holding all nodal point coordinates, and
>>another vector holding all nodal point values of the solution. How do we
>>access every nodal point coordinates, and at the same time, the associated
>>nodal point value within the same loop?
>>
>> Can you clarify in a short pseudocode example what you are trying to
> achieve?
>

We need to update function v based on solution u in the following loop.

for ( x in vector_of_nodal_points )
  v(x) = f(x, u(x))

where v(x) and u(x) are the nodal point value for functions v and u,
respectively, and f() is some function depending on function u as well as
the location of the nodal point. So in this case, we need to access nodal
point coordinates and nodal point values of the solution in the same loop.


>
>>1. In addition to nodal point values of a solution, are the partial
>>derivatives (or gradient) of the solution at each nodal point available in
>>deal.ii?
>>
>> That's basically what DataPostprocessor is doing. In general, you can
> loop over all cells and calculate the derivatives locally. Have a look at
> FEValuesBase::get_function_gradients (
> https://www.dealii.org/current/doxygen/deal.II/classFEValuesBase.html#ad1f4e0deb5d982e8172d82141c634a67
> ).
>
> Well, the above function calculates the gradients of a finite element at
the quadrature points of a cell, not at the nodal points of a cell.
Such a need arises in the following situation.

for ( x in vector_of_nodal_points )
  v(x) = g(x, u(x), grad u(x))

-- 
Stay put, practice social distancing, and be safe!

Best,

--Xuefeng Li, (504)865-3340(phone)
   Like floating clouds, the heart rests easy
   Like flowing water, the spirit stays free
  Loyola University New Orleans
   New Orleans, Louisiana (504)865-2051(fax)

-- 
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/CAO2HPGV-p6f7Tp_C%3DcTS9tNTva9gnm3cT8-JHjkviS7bXFxJXQ%40mail.gmail.com.


Re: [deal.II] Accessing nodal values of a FEM solution

2020-07-23 Thread Xuefeng Li
On Sun, Jul 19, 2020 at 7:36 PM Wolfgang Bangerth 
wrote:

> On 7/19/20 6:28 PM, Daniel Arndt wrote:
> >
> > The tutorial examples show only how to access values of the solution
> at
> > the quadrature points within each cell.
> >
> >
> https://github.com/dealii/dealii/wiki/Frequently-Asked-Questions#how-to-get-the-mapped-position-of-support-points-of-my-element
> > <
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdealii%2Fdealii%2Fwiki%2FFrequently-Asked-Questions%23how-to-get-the-mapped-position-of-support-points-of-my-element=02%7C01%7CWolfgang.Bangerth%40colostate.edu%7Cc61491e1703e46c5be0f08d82c43defe%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637308017305040965=TM3AYA4IqcrckUMqRTWfCJWUz3MGrUx%2FRFGvRrsg40Y%3D=0>
>
> > might also be helpful.
>
> You might also be interested in looking at the do_half_phase_step()
> function
> of step-58:
>
>
> https://dealii.org/developer/doxygen/deal.II/step_58.html#ImplementingtheStrangsplittingsteps
>
> Best
>   W.
>
>
> Thank both of you for your replies. The Step-58 function is very helpful
in showing how to access nodal point values of a solution vector object. I
assume I can access the nodal point coordinates in the similar way, where a
vector of nodal points is created using the
   DoFTools::map_dofs_to_support_points()
function.

However, I have two more related questions. BTW, I am a newbie in C++
programming. So my questions may seem absurd.

   1. Now that we have a vector holding all nodal point coordinates, and
   another vector holding all nodal point values of the solution. How do we
   access every nodal point coordinates, and at the same time, the associated
   nodal point value within the same loop?
   2. In addition to nodal point values of a solution, are the partial
   derivatives (or gradient) of the solution at each nodal point available in
   deal.ii?

Thanks again for any assistance!

-- 
Stay put, practice social distancing, and be safe!

Best,

--Xuefeng Li, (504)865-3340(phone)
   Like floating clouds, the heart rests easy
   Like flowing water, the spirit stays free
  Loyola University New Orleans
   New Orleans, Louisiana (504)865-2051(fax)

-- 
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/CAO2HPGUH18nde3KSrBkVFmeiuyChR_MKevmVMNDh%2B7xc5BO6%3DA%40mail.gmail.com.


[deal.II] Accessing nodal values of a FEM solution

2020-07-19 Thread Xuefeng Li
Hi, there!

I have some general questions about deal.ii, and here is the background 
info concerning my question.

There are two functions u and v, defined over domain \Omega in 1D/2D/3D. We 
use deal.ii to solve for the numerical approximation of function u, using 
1st degree polynomial for finite elements. That means that DOF on each cell 
is the same as values of function u at nodal points on each cell. In the 
mathematical model, we update the nodal values of function v using the 
nodal values of function u, pointwise, i.e., a nodal value of function v 
strictly depends on a nodal value of function u at the same nodal point. 
And that is the end of the process of solving for numerical approximations 
of functions u and v.

After reading through many tutorial examples at deal.ii, I have not come 
across with answers to my following questions. They are,

Is it possible to access nodal point values of a solution in deal.ii? And 
is it possible to revise nodal values of a solution pointwise?

The tutorial examples show only how to access values of the solution at the 
quadrature points within each cell.

Thanks for your insight on this question.

-- 
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/0a1ba92c-fc2f-4ea7-8a23-fccc4657d061n%40googlegroups.com.


Re: [deal.II] Local tutorial installation missing some examples

2020-04-09 Thread Xuefeng Li
I see. In that case, I'll just wait until the missing examples become a 
part of the regular release. Thanks again!

On Thursday, April 9, 2020 at 5:24:48 PM UTC-5, Jean-Paul Pelteret wrote:
>
> Hi Xuefeng,
>
> The list of tutorials that are contained in the latest release (currently 
> 9.1.1, which you’re using) are shown on this page:
> https://www.dealii.org/current/doxygen/deal.II/Tutorial.html
>
> The tutorials that your find missing are not a part of that release, and 
> are either new additions to the library or were not yet completed by the 
> time of the release. You’ll have to download the developer version of 
> deal.II in order to have a local copy of them.
>
> I hope that this answers your question!
> Best,
> Jean-Paul
>
> On 09 Apr 2020, at 23:02, Xuefeng Li > wrote:
>
> Hi, all!
>
> I installed dealii-9.1.1 along with documentation under Ubuntu 18 inside 
> VM VirtualBox on a Win10 PC. I spent the last couple of weeks reading 
> through the tutorial, one example at a time. I also ran some of the 
> examples as suggested by the tutorial.
>
> However, my local installation of tutorial misses a couple of examples 
> when compared to the tutorial online. Particularly, step-16b, 47, 50, 65, 
> 67, 69 are not available locally. Does anyone know why these examples are 
> missing? How do I make them available so that I can run them locally?
>
> Thanks in advance.
>
> -- 
> 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 dea...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/dealii/be52d36c-7c66-46b9-bd4b-5ecc9c024016%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/dealii/be52d36c-7c66-46b9-bd4b-5ecc9c024016%40googlegroups.com?utm_medium=email_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/a1f7939b-531a-4ef5-8d5d-ac0bb148fbce%40googlegroups.com.


[deal.II] Local tutorial installation missing some examples

2020-04-09 Thread Xuefeng Li
Hi, all!

I installed dealii-9.1.1 along with documentation under Ubuntu 18 inside VM 
VirtualBox on a Win10 PC. I spent the last couple of weeks reading through 
the tutorial, one example at a time. I also ran some of the examples as 
suggested by the tutorial.

However, my local installation of tutorial misses a couple of examples when 
compared to the tutorial online. Particularly, step-16b, 47, 50, 65, 67, 69 
are not available locally. Does anyone know why these examples are missing? 
How do I make them available so that I can run them locally?

Thanks in advance.

-- 
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/be52d36c-7c66-46b9-bd4b-5ecc9c024016%40googlegroups.com.