# Static condensation of internal bubbles¶

Element-internal unknowns of higher order finite elements can be eliminated from the global linear system. This corresponds to the Schur-complement system for the coupling unknowns on the element boundaries.

To enable this option, set the eliminate_internal flag for the bilinear-form. This assembles the global Schur-complement system, and stores harmonic extensions, and internal inverses.

The user is responsible to transform the right-hand side and the solution vector. An example is as follows:

from netgen.geom2d import unit_square
from ngsolve import *

mesh = Mesh(unit_square.GenerateMesh(maxh=0.3))

fes = H1(mesh, order=10, dirichlet=[1,2])
u = fes.TestFunction()
v = fes.TrialFunction()

a = BilinearForm(fes, flags = { "eliminate_internal" : True } )
a.Assemble()

f = LinearForm(fes)
f += SymbolicLFI (1 * v)
f.Assemble()

u = GridFunction(fes)


modify right-hand side

f.vec.data += a.harmonic_extension_trans * f.vec


solve for external unknowns

u.vec.data = a.mat.Inverse(fes.FreeDofs(True)) * f.vec


and find element-internal solution

u.vec.data += a.harmonic_extension * u.vec
u.vec.data += a.inner_solve * f.vec

Draw (u)
{"ft_lang_label":"__label__en","ft_lang_prob":0.52552235,"math_prob":0.97645026,"size":1209,"snap":"2019-51-2020-05","text_gpt3_token_len":312,"char_repetition_ratio":0.10539419,"word_repetition_ratio":0.0,"special_character_ratio":0.24234904,"punctuation_ratio":0.17567568,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9798935,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-12-05T20:22:55Z\",\"WARC-Record-ID\":\"<urn:uuid:38ec6f01-5fce-4d2f-8512-070251dac180>\",\"Content-Length\":\"18050\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:0d609f4b-192e-411e-af9f-359c3ea60754>\",\"WARC-Concurrent-To\":\"<urn:uuid:3b5a5df9-45f0-43a7-be2f-bbaba193546e>\",\"WARC-IP-Address\":\"160.153.128.31\",\"WARC-Target-URI\":\"https://ngsolve.org/docu/latest/how_to/howto_staticcondensation.html\",\"WARC-Payload-Digest\":\"sha1:6ZMVKL2NWPRQ4F2L644FOTTFOI3MGOE7\",\"WARC-Block-Digest\":\"sha1:CLNHJRXI2DA4WIRQBDLFCFBGCDTOH4TP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-51/CC-MAIN-2019-51_segments_1575540482038.36_warc_CC-MAIN-20191205190939-20191205214939-00078.warc.gz\"}"}