weihuayi / fealpy

Finite Element Analysis Library in Python
Other
279 stars 123 forks source link

请教原始b(u^0)^3,v)的组装代码是否有误 #623

Open jibingquanm opened 5 months ago

jibingquanm commented 5 months ago

[魏老师原始组装代码图片],见网页链接(https://github.com/weihuayi/fealpy/assets/89182142/0e75857e-b0ac-4e0c-ad93-9e9405ade8c6) 魏老师: 您好! 上图是在学习您网页(https://www.weihuayi.cn/fealpy/docs/zh/example/num-nonlinear-interface)中组装(b(u^0)^3,v)的相应代码,其中b为常系数,u^0为已知的迭代时的有限元函数。您网页中的组装代码部分如下: space = uh.space mesh = space.mesh qf = mesh.integrator(q=2, etype='cell') bcs, ws = qf.get_quadrature_points_and_weights() cellmeasure = mesh.entity_measure('cell') pp = mesh.bc_to_point(bcs) cval = b(pp)*uh(bcs)**3 phii = space.basis(bcs) phij = space.basis(bcs) bb = np.einsum('q, qci, qc, qcj, c->cij',ws,phii,cval,phij,cellmeasure) 魏老师,我想向您请教一下,bb的组装是不是有误,应为如下的组装代码呀: bb = np.einsum('q, qc, qcj, c->cj', ws, cval, phij, cellmeasure)

weihuayi commented 3 months ago

@jibingquanm 上面的代码比较旧了,我安排了一个学生基于最新的接口来写上面的代码,这一周应该可以完成。非常抱歉,这一段事情很多,没有及时回复您。