Hello,
I have a fes for the whole system. Using the definedon=‘regexpr’ key the system is substructured into parts and stored to different fes_parts. Using the Compress method, I can use everything nice and clean for the different substructures.
To do the AssembleLinearization only on the elements in the substructure, I have a very large code-block to find all elements that have any dof in the substructure. Then translating the element-numbers into a BitArray that is then applied to the SymbolicBFI(…, definedonelements=BitArray).
Is there any shortcut available to find all elements related to the FreeDofs of such a fes_part automatically?
Also I didn’t understand the difference in the following example (dealing with exactly that):
[code]
fes_in = object.fespace(definedon=object.nonlinear_domain)
fesMini = Compress(fes_in)
u, v = fesMini.TnT()
print('---> Mini FE-Space', fesMini.ndof)
el_iterator = fesMini.Elements()
master_el_nrs = []
for el in el_iterator:
master_el_nrs.append(el.nr)
el_id = ElementId(VOL, el.nr)
act_el = BitArray(object.mesh.ne)
act_el[:] = False
for i in master_el_nrs:
act_el[i] = True
print('active elements...........', sum(act_el))
#-------------------------------------------------------------------------
InternalMask = fes_in.FreeDofs()
wii = np.where(InternalMask)
ix_ii = np.ix_(wii[0],wii[0])
aMini = BilinearForm(fesMini)
aMini += SymbolicBFI(object.fcn_weak_K(object, material, u,v), definedonelements=act_el )
aMini.Assemble()
KiiMini = ngsolve2spmat_mat(aMini.mat)
#Ergebnis: Immer zu klein, mit und ohne definedonelements
fesfull = object.fespace()
ufull,vfull = fesfull.TnT()
aTest = BilinearForm(fesfull)
aTest +=SymbolicBFI(object.fcn_weak_K(object, material, ufull,vfull), definedonelements=act_el )
aTest.Assemble()
ATest = ngsolve2spmat_mat(aTest.mat)
KiiTest = ATest[ix_ii]
#Ergebnis: mit definedonelements ist das Ergebnis zu klein, ohne passt es.
#Die Anzahl der dofs sind immer gleich...[/code]
Kind regards,