Request help with a 3D model

Good morning,

Please be patient with this request. I am trying to learn Freefem, and decided to try to convert the 2D example in the documentation (under the system of elasticity) into a 3d problem. I am stuck at the point where the boundary conditions are applied.

Here is my attempt at the model:

// Three dimensional plate model
// a trial model
//

// metric model kg,m,s unit system

load β€œmsh3”

// r3 is the surface label vector
int[int] r3=[11,12,13,14,15,16];
// face y=0 is 11
// face x=1 is 12
// face y=1 is 13
// face x=0 is 14
// face z=0 is 15
// face z=1 is 16

int r5 = 5;
// r5 is the volume label

// Material Properties

real Yngs = 210e9; // Pa
real nu = 0.3;
real rho = 7750; // kg/m^3

real mu = Yngs/(2*(1+nu)); // lame coefficient mu
real lambda = Yngsnu/((1+nu)(1-2*nu)); // lame coefficient lambda

// Geometry

real Wdth=0.42; // width
real Lngth=0.42; // length
real Th=0.01; // Thickness

int NW = 20; // Grid resolution width
int NL = 20; // Grid resolution length
int NT = 5; // grid resolution thickness

// Meshing
mesh3 Sp = cube(NW,NL,NT, [Wdthx, Lngthy, Th*z], label=r3, flags=3, region=r5);
plot(Sp);

// gravity type load
real f = -1;

// Define Fespace
fespace Vh(Sp, P2);
Vh u, v, w;
Vh uu, vv, ww;

// define the differential operators
real sqrt2=(2.)^0.5;
macro epsilon(u1,u2,u3) [dx(u1), dy(u2), (dy(u1)+dx(u2))/sqrt2, dz(u3), (dz(u2)+dy(u3))/sqrt2, (dz(u1)+dx(u2))/sqrt2] // diff op

macro div(u,v,w) (dx(u)+dy(v)+dz(w))

// Problem
solve lame([u, v, w], [uu, vv, ww])
= int3d(Sp)(
lambda*(div(u, v, w) * div(uu, vv, ww)
+ 2.mu * ( epsilon(u,v,w)’ * epsilon(uu, vv, ww) )
)
- int3d(Sp)(
f
ww
)
+ on(14, u=0)
+ on(14, v=0)
+ on(14, w=0)
;

plot([u, v, w],wait 1, coef=coef);

// move mesh
mesh SP2 = movemesh(Sp, [x+ucoef, y+vcoef, z+w*coef]);

Freefem crashes at the on command, and I am stuck.

I would appreciate some assistance in getting this example model to work, and would greatly appreciate any advice in the model in general.

Thank you in advance for your time and assistance.
Ed

You just miss a closing parenthese for the term with lambda in factor.

Here, is your Code with several corrections.
FEM_elasticity-3D.edp (2.0 KB)
(Now, error is coming higher as i have not included the source term in the problem. If you give that i hope error will come nice as exact solution and approximate solution are matching).

If you give me your equations or provide your source, i will check order of convergence.

Thanks in advance!.

Thank you both very much!

My equations are all written down on paper, and I need to formalize them. I will post the math and ask you to look at it. Thank you for making the offer.

Thank you

1 Like

Math Notes:

Grad u= βˆ‡u= βˆ‚u/βˆ‚x i+ βˆ‚u/βˆ‚y j+ βˆ‚u/βˆ‚z k
div u= βˆ‡βˆ™u= βˆ‚u/βˆ‚x+ βˆ‚u/βˆ‚y+ βˆ‚u/βˆ‚z
curl u= βˆ‡Γ—u=((βˆ‚u_3)/βˆ‚y- (βˆ‚u_2)/βˆ‚z,(βˆ‚u_3)/βˆ‚z- (βˆ‚u_1)/βˆ‚x,(βˆ‚u_2)/βˆ‚x- (βˆ‚u_1)/βˆ‚y)
curl u= βˆ‡Γ—u= (βˆ‚/βˆ‚x,βˆ‚/βˆ‚y,βˆ‚/βˆ‚z)Γ—(u_1,u_2,u_3 )
βˆ‡Γ—u= ((βˆ‚u_3)/βˆ‚y- (βˆ‚u_2)/βˆ‚z)i-((βˆ‚u_3)/βˆ‚z- (βˆ‚u_1)/βˆ‚x)j+((βˆ‚u_2)/βˆ‚x- (βˆ‚u_1)/βˆ‚y)k

Kronecker Delta=Ξ΄_ij= β– (1 if i=j@0 otherwise)

Relationship between stress tensor and strain tensor

stress tensor= Οƒ_ij= λδ_ij βˆ‡βˆ™u+2ΞΌΟ΅_ij (u)
strain tensor= Ο΅_ij= 1/2 (γ€–βˆ‚uγ€—_i/γ€–βˆ‚xγ€—_j +γ€–βˆ‚uγ€—_j/γ€–βˆ‚xγ€—_i )

Lame constants
Ξ»= EΞ½/(1+Ξ½)(1-2Ξ½)
ΞΌ=E/2(1+Ξ½)

Where:
E = Young’s Modulus
 = poisson’s ratio

Displacement formula : Navier-LamΓ© equations

(Ξ»+ΞΌ) u_(k,ki)+ΞΌu_(i,kk)+F_i=ρ (βˆ‚^2 u_i)/γ€–βˆ‚tγ€—^2
(Ξ»+ΞΌ)βˆ‡βˆ‡βˆ™u+ΞΌβˆ‡^2Γ—u+F_i=ρ (βˆ‚^2 u_i)/γ€–βˆ‚tγ€—^2
(Ξ»+ΞΌ)grad div u+ΞΌcurl curl u+F_i=ρ (βˆ‚^2 u_i)/γ€–βˆ‚tγ€—^2

For static conditions

ρ (βˆ‚^2 u_i)/γ€–βˆ‚tγ€—^2 =0

FreeFEM does not use the Navier-Lame equation for a structural problem, because the associated variational form does not give the right boundary conditions. Instead:

-div(Οƒ)=f in Ξ©

As FreeFEM solves the div value to begin with, the matrix definition of  is required.

Οƒ_ij= λδ_ij (βˆ‚u/βˆ‚x+ βˆ‚u/βˆ‚y+ βˆ‚u/βˆ‚z)+2/2 ΞΌ(γ€–βˆ‚uγ€—_i/γ€–βˆ‚xγ€—_j +γ€–βˆ‚uγ€—_j/γ€–βˆ‚xγ€—_i )

Οƒ_11= Ξ»(γ€–βˆ‚uγ€—_x/βˆ‚x)+2ΞΌ(γ€–βˆ‚uγ€—_x/βˆ‚x)
Οƒ_12= ΞΌ(γ€–βˆ‚uγ€—_x/βˆ‚y+γ€–βˆ‚uγ€—_y/βˆ‚x)
Οƒ_13= ΞΌ(γ€–βˆ‚uγ€—_x/βˆ‚z+γ€–βˆ‚uγ€—_z/βˆ‚x)
Οƒ_22= Ξ»( γ€–βˆ‚uγ€—_y/βˆ‚y)+2ΞΌ(γ€–βˆ‚uγ€—_y/βˆ‚y)
Οƒ_23= ΞΌ(γ€–βˆ‚uγ€—_y/βˆ‚z+γ€–βˆ‚uγ€—_z/βˆ‚y)
Οƒ_33= Ξ»( γ€–βˆ‚uγ€—_z/βˆ‚z)+2ΞΌ(γ€–βˆ‚uγ€—_z/βˆ‚z)

These values are used in the div and epsilon matrices which are fed to the div and epsilon matrices which are fed to the solve function

epsilon=[β– (γ€–βˆ‚uγ€—_x/βˆ‚x&γ€–βˆ‚uγ€—_x/βˆ‚y+γ€–βˆ‚uγ€—_y/βˆ‚x&γ€–βˆ‚uγ€—_x/βˆ‚z+γ€–βˆ‚uγ€—_z/βˆ‚x@γ€–βˆ‚uγ€—_x/βˆ‚y+γ€–βˆ‚uγ€—_y/βˆ‚x&γ€–βˆ‚uγ€—_y/βˆ‚y&γ€–βˆ‚uγ€—_y/βˆ‚z+γ€–βˆ‚uγ€—_z/βˆ‚y@γ€–βˆ‚uγ€—_x/βˆ‚z+γ€–βˆ‚uγ€—_z/βˆ‚x&γ€–βˆ‚uγ€—_y/βˆ‚z+γ€–βˆ‚uγ€—_z/βˆ‚y& γ€–βˆ‚uγ€—_z/βˆ‚z)]

div=[β– (γ€–βˆ‚uγ€—_x/βˆ‚x&0&0@0&γ€–βˆ‚uγ€—_y/βˆ‚y&0@0&0& γ€–βˆ‚uγ€—_z/βˆ‚z)]
Note: The coefficients ,2 and are handles in the solve sequence. These matrices just separate the terms.

real sqrt2=(2.)^0.5;
macro epsilon(u1,u2,u3) [dx(u1), dy(u2), (dy(u1)+dx(u2))/sqrt2, dz(u3), (dz(u2)+dy(u3))/sqrt2, (dz(u1)+dx(u2))/sqrt2]

// epsilon(u1,u2)’*epsilon(v1,v2) = epsilon(u): epsilon(v)

macro div(u,v,w) (dx(u)+dy(v)+dz(w))

and the solve function looks like this:
// Problem
solve lame([u, v, w], [uu, vv, ww])
= int3d(Sp)(lambda*(div(u, v, w) * div(uu, vv, ww)))
+ int3d(Sp)(2.*mu * ( epsilon(u,v,w)’ * epsilon(uu, vv, ww)))

…
Minus forces
…
On boundary conditions
…
;

lame; // solve

These are the notes that go with the script. It is a simple cantilevered beam structural statics model. I was wondering if the definitions are correct, especially that for epsilon. Does the order of the terms matter?