Boundary definitions and Dirichlet BCs on specific DOFs for vector valued funcs

More
5 years 2 months ago - 5 years 2 months ago #1836 by christopher
The difference is mainly in internal memory layout, the H1(..., dim=2) defines a space with vector valued degrees of freedom. So each dof is a vector with 2 components, each matrix entry is actually a 2x2 matrix,...
The VectorH1 is a compound space of multiple H1 spaces. Actually almost the same as doing
Code:
vech1 = FESpace([h1,h1])
with the difference, that the VectorH1 defines additional convenience functionality like taking the gradient, divergence, ...

This is why it is not possible to define only the x component as dirichlet in the H1(dim) space but it is possible in the VectorH1. But one could achieve fixed boundaries for the H1 space by penalizing with robin boundary terms.

I'll look into the segfault

Best
Christopher
Last edit: 5 years 2 months ago by christopher.
More
5 years 2 months ago #1852 by anandes
Hi Christopher,

I just wanted to check back with you if you are able to duplicate the segfault issue with mesh refinement. If so, please let me know if there is a way to resolve the problem.

Thank you,
Anand
More
5 years 2 months ago #1857 by christopher
Hi sorry I forgot to answer.
I think I fixed that, at least in my version now I cannot reproduce a segfault. We are putting out a new release today (1907), tell me if you still segfault with it.

Best
More
5 years 2 months ago #1866 by anandes
Hi Christopher,

Thanks for the fix! I'm now able to run the problem with multiple uniform refinements and no segfaults (in release 1907).

Thank you,
Anand
More
5 years 4 weeks ago #1995 by anandes
Hello Christopher,

I have a follow-up question on this topic. Using your suggestion, I am able to apply homogeneous Dirichlet BCs on specific DOFs of a discretization of a VectorH1 space.

How can non-homogeneous Dirichlet BCs be applied on such DOFs? To be more specific, I have attached a NGSolve python file and an associated vol file. Is there a way to apply non-zero Dirichlet BCs (only in the y-direction) on the boundary marked "Pres_load" ?

Thank you,
Anand
More
5 years 4 weeks ago #1997 by hvwahl
Hello Anand,

non-homogeneous slip BCs should be a combination of what you have done and Docu: Non-homogeneous Dirichlet data .

First mark te appropriate dofs as Dirichlet and store them for later:
Code:
pres_load_dofs = [] for el in fesx.Elements(BND): if el.mat == "Pres_load": for dof in el.dofs: freedofs.Clear(fesx.ndof+dof) pres_load_dofs.append(fesx.ndof+dof)
Then add the non-homogeneous data to the solution grid function at the appropriate dofs and solve the system as in the documentation:
Code:
gfu.vec[:] = 0.0 for dof in pres_load_dofs: gfu.vec[dof] = 1 # Obtain solution res = gfu.vec.CreateVector() res.data = f.vec - a.mat*gfu.vec gfu.vec.data += a.mat.Inverse(fes.FreeDofs(), inverse="sparsecholesky") * res

I hope this helps :) .

Henry
Time to create page: 0.118 seconds