Skip to content

Instantly share code, notes, and snippets.

@1995hnagamin
Created September 7, 2022 09:36
Show Gist options
  • Save 1995hnagamin/c1f3c51b13cf159dcf747f81d8200941 to your computer and use it in GitHub Desktop.
Save 1995hnagamin/c1f3c51b13cf159dcf747f81d8200941 to your computer and use it in GitHub Desktop.
cout.precision(16);
func int debug(mesh &Th) {
cout << "Nb of boundary elements: " << Th.nbe << ",\t"
<< "Nb of nodes: " << Th.nv << ",\t"
<< "Nb of triangles: " << Th.nt << ",\t"
<< "Area: " << Th.measure << "\n\n";
return 0;
}
real CircleRadius = 1.0;
border Circle (t = 0, 2*pi) {
x = CircleRadius * cos(t);
y = CircleRadius * sin(t);
}
int MQ = 50;
mesh Th = buildmesh(Circle(MQ));
fespace Vh(Th, P0);
debug(Th);
plot(Th, wait=true);
func r = sqrt(x*x + y*y) / CircleRadius;
func theta = atan2(y, x);
for (int i = 0; i < 3; ++i) {
Vh f = exp(-pow(r, -3)) * sin(30*theta);
plot(f, fill=true, wait=true);
Th = adaptmesh(Th, f);
debug(Th);
plot(Th, wait=true);
}
func unit = 1;
real S = int2d(Th)(unit);
cout << S << endl;
-- mesh: Nb of Triangles = 434, Nb of Vertices 243
Nb of boundary elements: 50, Nb of nodes: 243, Nb of triangles: 434, Area: 3.133330839107606
number of required edges : 0
-- adaptmesh statistics: Nb triangles 7382 , h min 0.009126698093593557 , h max 0.2936446899931156
area = 3.141364305091918 , M area = 3232.315800981939 , M area/( |Khat| nt) 1.011204767164889
infiny-regularity: min 0.3617805391610899 max 2.368253559339975
anisomax 6.404846269502958, beta max = 1.312172227956168 min 0.7652751571657566
-- mesh: Nb of Triangles = 7382, Nb of Vertices 3856
Nb of boundary elements: 328, Nb of nodes: 3856, Nb of triangles: 7382, Area: 3.141364305091925
number of required edges : 0
-- adaptmesh statistics: Nb triangles 16486 , h min 0.001768832184741211 , h max 0.2931381836188622
area = 3.141575610372962 , M area = 40272.34825177077 , M area/( |Khat| nt) 5.641453622239041
infiny-regularity: min 0.3293751180875955 max 12.86826406734108
anisomax 11.42141904481124, beta max = 1.39623360945664 min 0.1387029625218979
-- mesh: Nb of Triangles = 16486, Nb of Vertices 8999
Nb of boundary elements: 1510, Nb of nodes: 8999, Nb of triangles: 16486, Area: 3.14157561037297
number of required edges : 0
-- adaptmesh statistics: Nb triangles 15345 , h min 0.000868869817924222 , h max 0.340572138182167
area = 3.141581706319954 , M area = 56941.76099041324 , M area/( |Khat| nt) 8.56965553234185
infiny-regularity: min 0.1197549283358454 max 96.71317654310471
anisomax 190.3197027400882, beta max = 1.841154103976471 min 0.02911522882582326
-- mesh: Nb of Triangles = 15345, Nb of Vertices 9000
Nb of boundary elements: 2653, Nb of nodes: 9000, Nb of triangles: 15345, Area: 3.141581706319957
3.141581706319984
times: compile 0.007178000000000004s, execution 1.037904s, mpirank:0
CodeAlloc : nb ptr 3721, size :466712 mpirank: 0
Ok: Normal End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment