Re: [deal.II] The shape function on physical cell in hexahedral is not parallel with the edge (FeNedelecSZ and FENedelec)

2019-05-07 Thread Phạm Ngọc Kiên
Hi all,
It was a long time since the last time I posted my test for shape function
in 3D here.
This time I send you the results when testing with a more simple model in
2D, and the shape functions are still wrong with non-rectangle mesh.
The codes print results in this form:
dof i_th: 7
edge number: 3
edge vertices:
1 -1 and 0.5 -1
vector from first to second vertex of the edge: -0.5 0
shape functions on real cell:
0 0
0 0
0 0
1.2 1.29551
1.25 0.81524
1.3 0.0147947
2 2.15918
2 1.30438
2 0.022192

Here I use QGaussLobatto to get a certain shape function on the edge of a
cell.
It takes me so many times for testing where my codes return wrong solutions.
I think, in deal.II 9.0, the shape functions, defined in the two classes
FE_Nedelec and FE_NedelecSZ, are only work with structured grid (i.e. cube
in 3D and rectangle in 2D).
I hope it worth mentioning to fix this problem as we all want to carry out
finite element method with unstructured grid.

Best,
Pham Ngoc Kien

Vào Th 3, 16 thg 4, 2019 vào lúc 14:43 Phạm Ngọc Kiên <
ngockien.lea...@gmail.com> đã viết:

> Hi,
> I have written this code for testing purpose.
> In case of a rotated cube, the shape functions seemed to be good as they
> were parallel to the edge, although there was some small round-off errors
> at the value 0.
> However, when I tested with the grid which was loaded from GMSH, the shape
> functions failed.
> In the attachment, I showed the information for the first active cell
> only. It is easy to get information of other cells with the codes.
>
> I think that there exists something wrong with the cell that are not a
> cube, but a hexahedron when initializing the shape functions (fe_values).
>
> I think it would be easier for you to help me with the attachment below.
> Thank you very much.
> Best regards.
> Pham Ngoc Kien
>
> Vào Th 2, 15 thg 4, 2019 vào lúc 21:48 Wolfgang Bangerth <
> bange...@colostate.edu> đã viết:
>
>> On 4/11/19 9:17 PM, Phạm Ngọc Kiên wrote:
>> > Testing for an edge whose global vertices located from (0,0,0) to
>> (0,0,1) in
>> > real coordinates.
>> > With a cube I get the shape function vectors at the dof related to the
>> edge,
>> > for examples, (0,0,0), (0,0,-0.25), (0,0,-0.5), (0,0,-1), which are
>> parallel
>> > to the edge.
>> > However, if I create a mesh with GMSH and check the shape function
>> vectors,
>> > some of them are: (-0.0868383, -0.428, 1), (-0.129933, -0.402772, 1),
>> > (-0.052103 -0.2568 0.6),..,
>> > which are not parallel to the edge.
>> >
>> > In my limited opinion, I will get the wrong solution as the shape
>> functions
>> > created by my code are not parallel to the edge in my model.
>> > Could you please tell me why this happen and how to fix it?
>>
>> Good question. This does sound wrong. To figure out what is happening
>> exactly,
>> we typically construct small test cases that try to illustrate one
>> particular
>> issue. In your case, I would try to create a mesh with exactly one cell
>> --
>> either the one you have above, or maybe even simpler a cube that is just
>> rotated. Then create a DoFHandler on it and output the values of the
>> shape
>> functions. This way, you really have only one thing that could go wrong,
>> and
>> it's easy to demonstrate what you see and how it differs from
>> expectations.
>>
>> Do you think you could come up with a small program that does this?
>>
>> Best
>>   WB
>>
>> --
>> 
>> Wolfgang Bangerth  email: bange...@colostate.edu
>> www: http://www.math.colostate.edu/~bangerth/
>>
>> --
>> 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.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/CAAo%2BSZf2hqW7DixnW6AHb3hiHPn4KsW8xK9qCaXzRzPJg_S5ZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


2d testing.msh
Description: Mesh model
/* -
 *
 * Copyright (C) 2013 - 2018 by the deal.II authors
 *
 * This file is part of the deal.II library.
 *
 * The deal.II library is free software; you can use it, redistribute
 * it, and/or modify it 

Re: [deal.II] The shape function on physical cell in hexahedral is not parallel with the edge (FeNedelecSZ and FENedelec)

2019-04-15 Thread Phạm Ngọc Kiên
Hi,
I have written this code for testing purpose.
In case of a rotated cube, the shape functions seemed to be good as they
were parallel to the edge, although there was some small round-off errors
at the value 0.
However, when I tested with the grid which was loaded from GMSH, the shape
functions failed.
In the attachment, I showed the information for the first active cell only.
It is easy to get information of other cells with the codes.

I think that there exists something wrong with the cell that are not a
cube, but a hexahedron when initializing the shape functions (fe_values).

I think it would be easier for you to help me with the attachment below.
Thank you very much.
Best regards.
Pham Ngoc Kien

Vào Th 2, 15 thg 4, 2019 vào lúc 21:48 Wolfgang Bangerth <
bange...@colostate.edu> đã viết:

> On 4/11/19 9:17 PM, Phạm Ngọc Kiên wrote:
> > Testing for an edge whose global vertices located from (0,0,0) to
> (0,0,1) in
> > real coordinates.
> > With a cube I get the shape function vectors at the dof related to the
> edge,
> > for examples, (0,0,0), (0,0,-0.25), (0,0,-0.5), (0,0,-1), which are
> parallel
> > to the edge.
> > However, if I create a mesh with GMSH and check the shape function
> vectors,
> > some of them are: (-0.0868383, -0.428, 1), (-0.129933, -0.402772, 1),
> > (-0.052103 -0.2568 0.6),..,
> > which are not parallel to the edge.
> >
> > In my limited opinion, I will get the wrong solution as the shape
> functions
> > created by my code are not parallel to the edge in my model.
> > Could you please tell me why this happen and how to fix it?
>
> Good question. This does sound wrong. To figure out what is happening
> exactly,
> we typically construct small test cases that try to illustrate one
> particular
> issue. In your case, I would try to create a mesh with exactly one cell --
> either the one you have above, or maybe even simpler a cube that is just
> rotated. Then create a DoFHandler on it and output the values of the shape
> functions. This way, you really have only one thing that could go wrong,
> and
> it's easy to demonstrate what you see and how it differs from expectations.
>
> Do you think you could come up with a small program that does this?
>
> Best
>   WB
>
> --
> 
> Wolfgang Bangerth  email: bange...@colostate.edu
> www: http://www.math.colostate.edu/~bangerth/
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.
/* -
 *
 * Copyright (C) 2013 - 2018 by the deal.II authors
 *
 * This file is part of the deal.II library.
 *
 * The deal.II library is free software; you can use it, redistribute
 * it, and/or modify it under the terms of the GNU Lesser General
 * Public License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * The full text of the license can be found in the file LICENSE.md at
 * the top level directory of deal.II.
 *
 * -

 *
 * Author: Pham Ngoc Kien, Seoul National University, 2019
 */


#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 


#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 


#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 


#include 
#include 

#include 


#include 
#include 
#include 

#include 
#include 
#include 

using namespace dealii;

template
class EM {
public:
EM();

~EM();

void run();


private:
void grid_generation();

void setup_system();

void assemble_system();


void print_mesh_info(const Triangulation ,
 const std::string );


Triangulation triangulation;
MappingQ mapping;
const unsigned int order = 0; //order p of element
DoFHandler dof_handler;
FESystem fe;

Pointget_vertex_pos(const typename DoFHandler::active_cell_iterator ,
 const FESystem 

Re: [deal.II] The shape function on physical cell in hexahedral is not parallel with the edge (FeNedelecSZ and FENedelec)

2019-04-15 Thread Wolfgang Bangerth
On 4/11/19 9:17 PM, Phạm Ngọc Kiên wrote:
> Testing for an edge whose global vertices located from (0,0,0) to (0,0,1) in 
> real coordinates.
> With a cube I get the shape function vectors at the dof related to the edge, 
> for examples, (0,0,0), (0,0,-0.25), (0,0,-0.5), (0,0,-1), which are parallel 
> to the edge.
> However, if I create a mesh with GMSH and check the shape function vectors, 
> some of them are: (-0.0868383, -0.428, 1), (-0.129933, -0.402772, 1),  
> (-0.052103 -0.2568 0.6),..,
> which are not parallel to the edge.
> 
> In my limited opinion, I will get the wrong solution as the shape functions 
> created by my code are not parallel to the edge in my model.
> Could you please tell me why this happen and how to fix it?

Good question. This does sound wrong. To figure out what is happening exactly, 
we typically construct small test cases that try to illustrate one particular 
issue. In your case, I would try to create a mesh with exactly one cell -- 
either the one you have above, or maybe even simpler a cube that is just 
rotated. Then create a DoFHandler on it and output the values of the shape 
functions. This way, you really have only one thing that could go wrong, and 
it's easy to demonstrate what you see and how it differs from expectations.

Do you think you could come up with a small program that does this?

Best
  WB

-- 

Wolfgang Bangerth  email: bange...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[deal.II] The shape function on physical cell in hexahedral is not parallel with the edge (FeNedelecSZ and FENedelec)

2019-04-11 Thread Phạm Ngọc Kiên
Hi colleagues,
When using FE_NedelecSZ in my code.
Testing for an edge whose global vertices located from (0,0,0) to (0,0,1) 
in real coordinates.
With a cube I get the shape function vectors at the dof related to the 
edge, for examples, (0,0,0), (0,0,-0.25), (0,0,-0.5), (0,0,-1), which are 
parallel to the edge.
However, if I create a mesh with GMSH and check the shape function vectors, 
some of them are: (-0.0868383, -0.428, 1), (-0.129933, -0.402772, 1),  
(-0.052103 -0.2568 0.6),.., 
which are not parallel to the edge.

In my limited opinion, I will get the wrong solution as the shape functions 
created by my code are not parallel to the edge in my model.
Could you please tell me why this happen and how to fix it?

I would like to thank you very much in advance.
Best regards,.

-- 
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.
For more options, visit https://groups.google.com/d/optout.