-
Hi all, I am trying to interpret a FE function on a "coarse" mesh like The background is that I have a FE function on Thank you very much for your help! I can provide more details on my question if needed. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 10 replies
-
Did you use Two-grid method?
…---- 回复的原邮件 ----
| 发件人 | ***@***.***> |
| 日期 | 2022年04月03日 00:17 |
| 收件人 | ***@***.***> |
| 抄送至 | ***@***.***> |
| 主题 | [kinnala/scikit-fem] Prolong FE function from a coarse to a fine mesh (Discussion #888) |
Hi all,
I am quite new to scikit-fem, so please excuse my (possibly) dumb question.
I am trying to interpret a FE function on a "coarse" mesh like mesh_coarse = skfem.MeshTri().refined(2) also as a FE function on a finer mesh like mesh_fine = skfem.MeshTri().refined(4). How can I accomplish this? I have tried around with Basis.interpolate and Basis.project, but did not succeed.
The background is that I have a FE function on mesh_fine (seen as a reference solution to some problem) and a FE function on mesh_coarse and I would like to compare those two/compute errors between the two.
Thank you very much for your help! I can provide more details on my question if needed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
refined_Mesh, X = basis.refinterp(x, 2)
…---- 回复的原邮件 ----
| 发件人 | ***@***.***> |
| 日期 | 2022年04月03日 00:31 |
| 收件人 | ***@***.***> |
| 抄送至 | |
| 主题 | Re: [kinnala/scikit-fem] Prolong FE function from a coarse to a fine mesh (Discussion #888) |
Did you use Two-grid method?
---- 回复的原邮件 ----
| 发件人 | ***@***.***> |
| 日期 | 2022年04月03日 00:17 |
| 收件人 | ***@***.***> |
| 抄送至 | ***@***.***> |
| 主题 | [kinnala/scikit-fem] Prolong FE function from a coarse to a fine mesh (Discussion #888) |
Hi all,
I am quite new to scikit-fem, so please excuse my (possibly) dumb question.
I am trying to interpret a FE function on a "coarse" mesh like mesh_coarse = skfem.MeshTri().refined(2) also as a FE function on a finer mesh like mesh_fine = skfem.MeshTri().refined(4). How can I accomplish this? I have tried around with Basis.interpolate and Basis.project, but did not succeed.
The background is that I have a FE function on mesh_fine (seen as a reference solution to some problem) and a FE function on mesh_coarse and I would like to compare those two/compute errors between the two.
Thank you very much for your help! I can provide more details on my question if needed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
In principle, it is possible to use In [1]: from skfem import *
In [2]: m = MeshTri().refined(2)
In [3]: basis = Basis(m, ElementTriP1())
In [4]: mfine = m.refined(2)
In [6]: import numpy as np
In [7]: x = np.sin(5. * m.p[0])
In [8]: interp = basis.interpolator(x)
In [10]: xfine = interp(mfine.p)
In [11]: from skfem.visuals.matplotlib import plot3, show
In [12]: basisfine = Basis(mfine, ElementTriP1())
In [13]: plot3(basisfine, xfine, nrefs=0).show() The most efficient implementation would create a prolongation matrix during call to |
Beta Was this translation helpful? Give feedback.
-
I try to use m = MeshTri().refined(5) x = np.sin(5. * m.p[0]) mfine_r, xfine_r = basis.refinterp(x, 2) pts_r = mfine_r.doflocs.T ix_inv[ix,]=np.arange(pts.shape[0]) get the same resultprint(np.max(xfine-xfine_r)) ` |
Beta Was this translation helpful? Give feedback.
In principle, it is possible to use
Basis.interpolator
between arbitrary meshes.This is not very efficient though for very fine meshes.