Running magnetostatic cmagnet simulation with Lagrange elements

More
6 years 3 months ago #692 by creativeworker
Hello,

i would like to set up an educational example where i assume not knowing that for magnetostatics one should use H(Curl) elements. Also neglecting all the stuff about gauging and stabilization.

I used the cmagnet.py as reference and did the following changes:
Code:
fes = H1(mesh, order=2, dirichlet="outer") a+= SymbolicBFI(nu*div(u)*div(v))

NGsolve tells me now that it cannot form div.
Isn't that the same structure as for linear elasticity problems?
Am i missing a mathematical trap or am i treating the program wrong?

Thank you for that great software and your strong support!
With best regards
More
6 years 3 months ago #693 by cwinters
Hi,

if you define a H1 space, your test and trial functions are scalar.
Thus applying the divergence does not make much sense.
Code:
from netgen.geom2d import unit_square from ngsolve import * mesh = Mesh(unit_square.GenerateMesh(maxh=0.2)) fes = VectorH1(mesh,order=2) # has mesh.dim components u,v = fes.TrialFunction(), fes.TestFunction() print(u) # the trial function also has dim=mesh.dim divu = div(u) # now you can apply the divergence print(divu) # that's scalar again

Best,
Christoph
The following user(s) said Thank You: creativeworker
More
6 years 3 months ago #695 by creativeworker
Ah, i see. Thank you for the good explanation! I thought the dimensions are set automatically in vector form also for the H1.
Time to create page: 0.109 seconds