- Thank you received: 0
Boundary definitions and Dirichlet BCs on specific DOFs for vector valued funcs
5 years 4 weeks ago #1999
by anandes
Replied by anandes on topic Boundary definitions and Dirichlet BCs on specific DOFs for vector valued funcs
Hello Henry,
Thank you for your detailed response. It works as expected for linear elements. But when I try this on elements of order 2, the displacements at mid-nodes are not the same as the applied value.
I print the values in gfu.vec corresponding to these DOFs and the values are as applied. But when I print the gfu(
Thank you for your detailed response. It works as expected for linear elements. But when I try this on elements of order 2, the displacements at mid-nodes are not the same as the applied value.
I print the values in gfu.vec corresponding to these DOFs and the values are as applied. But when I print the gfu(
5 years 4 weeks ago #2000
by anandes
Replied by anandes on topic Boundary definitions and Dirichlet BCs on specific DOFs for vector valued funcs
Hello Henry,
Thank you for your detailed response. It works as expected for linear elements.
However, when I try this on elements of order 2, the displacements at mid-nodes are not the same as the applied value (uy=0.01 on the top surface). I tried to ensure that the Dirichlet BCs are applied even on the mid-nodes (edge dofs) of the top surface.
I print the values in gfu.vec corresponding to these DOFs and the values are as applied. But when I print the gfu(mesh()) values corresponding to the mid-nodes, the values are incorrect. I have attached the python script. Can you please tell me if this is just an artifact of post-processing or if there is actually an error in the solution?
Thank you,
Anand
Thank you for your detailed response. It works as expected for linear elements.
However, when I try this on elements of order 2, the displacements at mid-nodes are not the same as the applied value (uy=0.01 on the top surface). I tried to ensure that the Dirichlet BCs are applied even on the mid-nodes (edge dofs) of the top surface.
I print the values in gfu.vec corresponding to these DOFs and the values are as applied. But when I print the gfu(mesh()) values corresponding to the mid-nodes, the values are incorrect. I have attached the python script. Can you please tell me if this is just an artifact of post-processing or if there is actually an error in the solution?
Thank you,
Anand
Attachments:
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
5 years 3 weeks ago - 5 years 3 weeks ago #2003
by christopher
Replied by christopher on topic Boundary definitions and Dirichlet BCs on specific DOFs for vector valued funcs
Hi Anand,
the standard H1 space in NGSolve does not have a nodal basis, but instead a hierarchical. If you want a nodal space you can create it with
then you can use the space as you expected.
If you want to define inhomogeneous bc for the hierarchical space use the Set function of the GridFunction.
Best
Christopher
the standard H1 space in NGSolve does not have a nodal basis, but instead a hierarchical. If you want a nodal space you can create it with
Code:
fes = FESpace(type="nodal", mesh=mesh, ...)
then you can use the space as you expected.
If you want to define inhomogeneous bc for the hierarchical space use the Set function of the GridFunction.
Best
Christopher
Last edit: 5 years 3 weeks ago by christopher.
5 years 3 weeks ago #2011
by anandes
Replied by anandes on topic Boundary definitions and Dirichlet BCs on specific DOFs for vector valued funcs
Hi Christopher,
Thank you for clarifying the reason for this discrepancy.
However, when I try nodal basis functions as you suggested with the following line:
fes = VectorH1(mesh=mesh, ele_order=2, type="nodal"),
I get the following warning -
WARNING: kwarg 'type' is an undocumented flags option for class <class 'ngsolve.comp.VectorH1'>, maybe there is a typo?,
and the error still persists on the mid-nodes of the element edges
As to your other suggestion, I am unable to use the "Set" function to apply non-homogeneous Dirichlet BCs on the hierarchical basis as there is no option in NGSolve to use the "Set " function to apply BCs on specific DOFs of vector-valued functions on the boundary. If I do, then the non-zero values are applied to all DOFs along that boundary.
Thank you,
Anand
Thank you for clarifying the reason for this discrepancy.
However, when I try nodal basis functions as you suggested with the following line:
fes = VectorH1(mesh=mesh, ele_order=2, type="nodal"),
I get the following warning -
WARNING: kwarg 'type' is an undocumented flags option for class <class 'ngsolve.comp.VectorH1'>, maybe there is a typo?,
and the error still persists on the mid-nodes of the element edges
As to your other suggestion, I am unable to use the "Set" function to apply non-homogeneous Dirichlet BCs on the hierarchical basis as there is no option in NGSolve to use the "Set " function to apply BCs on specific DOFs of vector-valued functions on the boundary. If I do, then the non-zero values are applied to all DOFs along that boundary.
Thank you,
Anand
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
5 years 3 weeks ago #2012
by christopher
Replied by christopher on topic Boundary definitions and Dirichlet BCs on specific DOFs for vector valued funcs
Not VectorH1
Vi = FESpace(type="nodal", mesh=mesh, order=2)
fes = FESpace([Vi, Vi])
Best Christopher
Vi = FESpace(type="nodal", mesh=mesh, order=2)
fes = FESpace([Vi, Vi])
Best Christopher
5 years 3 weeks ago #2019
by anandes
Replied by anandes on topic Boundary definitions and Dirichlet BCs on specific DOFs for vector valued funcs
Hi Christopher,
When I declare the FESpace as you suggest, the code works as expected for order = 1 (this also requires other changes to the script as some utilities like div, grad, do not work for compound FE spaces - you had mentioned this earlier).
However, for any order > 1 NGSolve throws the following error:
catch in AssembleBilinearform 2: Inconsistent number of degrees of freedom, vb=VOL fel::GetNDof() = 12 != dnums.Size() = 6!
One problem seems to be that fes.ndof is fixed at the same value (as fes.ndof for order=1) even when any order >1 is used.
I have attached the sample python script for your reference.
Thank you,
Anand
When I declare the FESpace as you suggest, the code works as expected for order = 1 (this also requires other changes to the script as some utilities like div, grad, do not work for compound FE spaces - you had mentioned this earlier).
However, for any order > 1 NGSolve throws the following error:
catch in AssembleBilinearform 2: Inconsistent number of degrees of freedom, vb=VOL fel::GetNDof() = 12 != dnums.Size() = 6!
One problem seems to be that fes.ndof is fixed at the same value (as fes.ndof for order=1) even when any order >1 is used.
I have attached the sample python script for your reference.
Thank you,
Anand
Attachments:
Time to create page: 0.138 seconds