Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Interpolation on the boundary region

More
1 year 1 month ago #4719 by Coulson YU
Hi NGSolve guys,
I am struggled in the interpolation of a GridFunction on boundary of domain, from a coarse mesh to a fine mesh. For example, SolidDisplacement_d.vec is nonzero, but after SolidDisplacement_interpolate_ref.Set(SolidDisplacement_d,definedon = mesh_ref.Boundaries('ArteryWall')) , SolidDisplacement_interpolate_ref.vec is zero. That is, the interpolation does not wrok, the testing codes are as follows, Thanks in advance.

EITHER
from ngsolve import *
from netgen.geom2d import SplineGeometry
from ngsolve.webgui import Draw
geo = SplineGeometry()
L = 5
R = 0.5
geo.AddRectangle ( (0, 0), (L, R), bcs = ("SymmetricBoundary", "Outlet", "ArteryWall", "Inlet") )
h_size = 1/4
mesh = Mesh(geo.GenerateMesh(maxh = h_size))
k = 1
SolidFESpace = H1(mesh, definedon = mesh.Boundaries("ArteryWall"), order = k, dirichlet = "Inlet|Outlet")
SolidFESpace = Compress(SolidFESpace)
SolidDisplacement_d = GridFunction(SolidFESpace)
f = sin(x*y)
SolidDisplacement_d.Set(f,definedon = mesh.Boundaries('ArteryWall'))

mesh.Refine()
k = 1
SolidFESpace_ref = H1(mesh, definedon = mesh.Boundaries("ArteryWall"), order = k, dirichlet = "Inlet|Outlet")
SolidFESpace_ref = Compress(SolidFESpace_ref)
SolidDisplacement_interpolate_ref = GridFunction(SolidFESpace_ref)
SolidDisplacement_interpolate_ref.Set(SolidDisplacement_d,definedon = mesh.Boundaries('ArteryWall'))

OR
geo = SplineGeometry()
L = 5
R = 0.5
geo.AddRectangle ( (0, 0), (L, R), bcs = ("SymmetricBoundary", "Outlet", "ArteryWall", "Inlet") )
h_size = 1/4
mesh = Mesh(geo.GenerateMesh(maxh = h_size))
k = 1
SolidFESpace = H1(mesh, definedon = mesh.Boundaries("ArteryWall"), order = k, dirichlet = "Inlet|Outlet")
SolidFESpace = Compress(SolidFESpace)
SolidDisplacement_d = GridFunction(SolidFESpace)
f = sin(x*y)
SolidDisplacement_d.Set(f,definedon = mesh.Boundaries('ArteryWall'))
mesh_ref = Mesh(geo.GenerateMesh(maxh = h_size/2))
k = 1
SolidFESpace_ref = H1(mesh_ref, definedon = mesh_ref.Boundaries("ArteryWall"), order = k, dirichlet = "Inlet|Outlet")
SolidFESpace_ref = Compress(SolidFESpace_ref)
SolidDisplacement_interpolate_ref = GridFunction(SolidFESpace_ref)
SolidDisplacement_interpolate_ref.Set(SolidDisplacement_d,definedon = mesh_ref.Boundaries('ArteryWall'))

does not work.
Time to create page: 0.143 seconds