ngsolve:ngxfem:The failure regarding the implementation of dtref(u.Trace()) )

Thank you to the developers of the ngsolve program for providing such a valuable learning platform. Due to the presence of time derivatives in the boundary terms of the equation, it is necessary to implement dtref at the boundaries. However, an error was encountered in doing so:Operator “dt” does not exist for CompoundFESpace!,Despite various attempts, the endeavor still ended in failure.I am very grateful for the guidance provided by the ngsolve team members.
main equation:


main code:
from netgen.geom2d import SplineGeometry
from ngsolve import *
from xfem import *
import numpy as np

Space finite element order

order = 1

Time finite element order

k_t = 2

Final simulation time

tend = 1.0

Time step

sizeh=4

PDE parameter

Diff_CF=0.02
Delta=0.02
Sigma=1
Diff_Gamma_CF=0.02
Delta_Gamma=0.02
k=1

delta_t = 1 / 2**(sizeh)
T_time=np.arange(0,1+delta_t ,delta_t )

geo = SplineGeometry()
geo.AddRectangle( (0, 0), (1, 1), bc = “outer”)
mesh = Mesh( geo.GenerateMesh(maxh=1/2**sizeh))

Normal=specialcf.normal(mesh.dim)

TLen=len(T_time)

def dt(u):
return 1.0 / delta_t * dtref(u)

told = Parameter(0)
t = told + delta_t * tref

dxt = delta_t * dxtref(mesh, time_order=8)
dst=delta_t*dxtref(mesh,time_order=8,definedon=‘mesh.Bounderies(outer)’)

Fan_Space=H1(mesh,order=1)
Mu_Space=H1(mesh,order=1)
Mu_Gamma_Space=Compress(H1(mesh,order=1,definedon=mesh.Boundaries(‘outer’)))
tfe = ScalarTimeFE(k_t) # type: ignore

ST_Fan=tfeFan_Space
ST_Mu=tfe
Mu_Space
ST_Mu_Gamma=tfe*Mu_Gamma_Space

fes=ST_FanST_MuST_Mu_Gamma

(Fan,Mu,Mu_Gamma),(theta1,theta2,theta3)=fes.TnT()

mass_Fan=np.zeros(TLen-1)
mass_Fan_Gamma=np.zeros(TLen-1)
H1_Err_Phi=np.zeros(TLen-1)
Err_Phi=np.zeros(TLen-1)

gfu_iter=GridFunction(fes)
Init_Fan=GridFunction(Fan_Space)

potential function second derive

def Doub_second(u):
return 3*u**2-1

def Doub_First(u):
return u**3-u

a_Lin=BilinearForm(fes)

the fan not the origin fan fan1=fan^{n-1}+(t-t_{n-1})fan

a_Lin+=Fantheta1dxt+delta_ttrefdt(Fan)theta1dxt+Diff_CFgrad(Mu)grad(theta1)dxt
+Fan.Trace()theta3dst+delta_t
tref
dt(Fan.Trace())theta3dst#+Diff_Gamma_CF
grad(Mu_Gamma).Trace()grad(theta3).Trace()dst
#-Mu
theta2
dxt-Mu_Gammatheta2.Trace()dst
#+delta_t
tref
DeltaSigmagrad(Fan)grad(theta2)dxt+delta_ttrefDelta_Gammakgrad(Fan).Trace()grad(theta2).Trace()dst
#+1/Delta
Sigma
delta_ttrefDoub_second(Init_Fan+delta_ttrefgfu_iter.components[0])Fantheta2dxt
#+1/Delta_Gamma**delta_t
trefDoub_second(Init_Fan+delta_ttrefgfu_iter.components[0])Fantheta2dst

                                                                                                                           Best regards
                                                                                                                           ChLun Ye