/usr/share/doc/freefem++/examples/examples++-3d/Period-Poisson-cube-ballon.edp is in freefem++-doc 3.19.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | verbosity=1;
load "msh3"
load "tetgen"
load "medit"
include "MeshSurface.idp"
mesh3 Th;
try {
Th=readmesh3("Th-hex-sph.mesh");
}
catch(...)
{
real hs = 0.2; // mesh size on sphere
int[int] NN=[11,9,10];
real [int,int] BB=[[-1.1,1.1],[-.9,.9],[-1,1]];
int [int,int] LL=[[1,2],[3,4],[5,6]];
////////////////////////////////
mesh3 ThHS = SurfaceHex(NN,BB,LL,1)+Sphere(0.5,hs,7,1); // "gluing" surface meshs to tolat boundary meshes
real voltet=(hs^3)/6.;
cout << " voltet = " << voltet << endl;
real[int] domaine = [0,0,0,1,voltet,0,0,0.7,2,voltet];
mesh3 Th = tetg(ThHS,switch="pqaAYY",nbofregions=2,regionlist=domaine);
// Tetrahelize the interior of the cube with tetgen
medit("tetg",Th,wait=1);
savemesh(Th,"Th-hex-sph.mesh");
}
fespace Ph(Th,P0);
verbosity=50;
fespace Vh(Th,P1,periodic=[[3,x,z],[4,x,z],[1,y,z],[2,y,z],[5,x,y],[6,x,y]]);// back and front
verbosity=1;
Ph reg=region;
cout << " centre = " << reg(0,0,0) << endl;
cout << " exterieur = " << reg(0,0,0.7) << endl;
macro Grad(u) [dx(u),dy(u),dz(u)] // EOM
Vh uh,vh;
real x0=0.3,y0=0.4,z0=06;
func f= sin(x*2*pi+x0)*sin(y*2*pi+y0)*sin(z*2*pi+z0);
real gn = 1.;
real cf= 1;
problem P(uh,vh,solver=sparsesolver)=
int3d(Th,1)( Grad(uh)'*Grad(vh)*100)
+ int3d(Th,2)( Grad(uh)'*Grad(vh)*2)
+ int3d(Th) (vh*f)
// + on(-1,uh=-1) + on(1,uh=1)
// + int2d(Th,2,-2)(vh*gn)
// + int2d(Th,3,-3)(cf*vh*uh)
;
P;
plot(uh,wait=1, nbiso=6);
medit(" uh ",Th, uh,wait=1);
|