Dirichlet condition in 3D over a surface

Hello everyone,

I would like to impose a Dirichlet boundary condition over a surface in 3D.

My geometry is simply a cylinder and the surface on which I would like to impose the Dirichlet condition is a disk. I used a 2D mesh (Th2D in the script below) to define the surface….but it is clearly the bad way to do it. I believe I should find the points of the 3D mesh included in my surface and affect them individually the Dirichlet condition.

Here is a part of the script… The problematic condition is the last line of the script.

Thank you in advance for your help.

int Cyz=99;
real R1 = 0.02; // Rayon du duramen
real R2 = 0.04; // Rayon de l aubier
real R4 = 0.05; // Rayon total
real H = 0.2; // Hauteur du cylindre

real kd = 5, ka = 5, ke = 20; // Conductivites thermiques
real T0 = 50.; // Temp initiale
real T = 0.002, dt = 0.0002 ;
int nt = floor(T/dt);
real[int] temps(nt);
int nx=30, ny = 30, nz = 30;
real [int] y2d(ny), z2d(nz);
real[int] xnz*nt);
real[int] uu(nz*nt);
real[int,int] u2dyz(ny,nz);

// Noms des régions
int regDuramen = 1;
int regAubier = 2;
int regEcorce = 3;

// contours
border b0(t=0, 2*pi){x=R1*cos(t); y=R1*sin(t); z = 0;}
border b1(t=0, 2*pi){x=R2*cos(t); y=R2*sin(t);z = 0;}
border b2(t=0, 2*pi){x=R4*cos(t); y=R4*sin(t);z = 0;}

// 2D mesh x-y
mesh Th2D = buildmesh(b0(nx) + b1(nx) + b2(nx));
plot(Th2D, wait=true, cmm=“Maillage 2D”);

// 3D mesh
mesh3 Th3D = buildlayers(Th2D, ny, zbound = [-H/2, H/2]);
plot(Th3D, wait=true, cmm=“Maillage 3D”);

real Duramen = Th3D(R1/2,0,0).region;
real Aubier = Th3D(R1+R2/2,0,0).region;
real Ecorce = Th3D(R1+R2+R4/2,0,0).region;

fespace Vh(Th3D, P1);
Vh u=T0, v, uold;
Vh k = kd*(region==Duramen)+ka*(region==Aubier)+ke*(region==Ecorce);

fespace Vh2(Th2D, P2);
Vh2 u2, u2e;

problem heat(u, v) =
int3d(Th3D)(u*v/dt + k*(du)*dv) + dy(u)*dy(v) + dz(u)*dz(v)))
- int3d(Th3D)(uold*v/dt)
+ on(Ecorce, u=10);
// + on(Th2D, u=10); // CL appliquee a la surface du disque (?)

As is explained in the documentation p.146

for the command buildlayers you need to define three arrays
rdown, rup, rmid to define the labels of the boundaries of the 3d mesh.
In your corrected file
dcsurf.edp (1.8 KB)

I have set label 21 for the bottom, 22 for the top, and 23 for the lateral boundary.

Hello François,

Thank you very much for having considered my question so rapidly and helped me to solve it !

It is limpid. I will try it tomorrow.

Christophe

Hello Francois,

Thanks too your help I did a lot of progress in the description of my problem. I am able to fix the boundary condition on any region of the problem. Physically I would describe the thermal behaviour of a tree which is represented by imbricated cylinder. I have a small cylinder region beside the tree. I described the 2D region, then I built 3D surface and finally construct a 3D mesh using tetg. The problem is solved….nevertheless the outer region (called Air) seems “inactive” and when I fix boundary condition on the small internal cylinder (Ant region) it is not taken into account. Maybe something is still wrong in the region definition. I would be really grateful if you could help me to solve it. Below is the script.

3dtrunk.edp (8.8 KB)

Dear Christophe,
I have not looked at the details of your code, indeed I don’t understand well your geometry and the boundary conditions you want to set. You have to take care that a PDE problem with a Dirichlet condition on a 2d surface which is inside the domain is ill-posed.
I see that you solve a heat equation. On the external boundaries where you don’t put any on() nor int1d term it means that you impose a homogeneous Neumann boundary condition.

Dear François,

Thank you very much for the prompt reply. The geometry consists in imbricated cylinders representing different anatomic region of a tree. The volume between the penultimate cylinder and the cylinder with the largest diameter is the “air” region. The small cylinder is located in the “air” region and will used to “heat” the tree. I take not about the numerical problem with a Dirichlet condition inside the domain, it was a convenient way to check that an impose temperature propagates into the volume. I attached a figure of the meshed problem, hoping it will be helpful. Thank you in advance for your valuable advices.

Christophe

Dear Christophe,
After checking, I have found a bug in your definition of the regions in the 3d mesh. When you define domain2, the region Air is defined by the one that contains the point (Rracine+(L-Rracine)/2,0,0).
But this point belongs to the Ant region, leading to wrong definitions.
You could put a minus sign (-(Rracine+(L-Rracine)/2),0,0) to correct it.

Dear François,

Thank you so much for having considered my problem and spend time on it. You’re right for the region Air. I corrected it… now the label affected to the region is consistent. I could have gone for a very long time without seeing this error. I am grateful to you.

Best Regards,

Chritsophe