Interpolation on the boundary region
- Coulson YU
- Topic Author
- New Member
Less
More
1 year 8 months ago #4719
by Coulson YU
Interpolation on the boundary region was created 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.
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.094 seconds