Commit 0932d846 by Christophe Geuzaine

pp

parent 4d76a8ef
Pipeline #1506 passed with stage
in 9 minutes 27 seconds
......@@ -25,8 +25,7 @@ DefineConstant[
"E: Young's modulus [N/m²]",
"ν: Poisson's ratio [-]",
"ρ: mass density [kg/m³]",
"f: force per unit volume [N/m³]",
"p: pressure [N/m²]"],
"f: force per unit volume [N/m³]"],
Name "Model/01Formulation"},
modelDim = GetNumber["Gmsh/Model dimension"],
modelPath = GetString["Gmsh/Model absolute path"],
......@@ -60,18 +59,18 @@ Group {
If(dim~{i} < modelDim)
DefineConstant[
bcx~{i} = {0, Choices{
0="Neumann: fixed px",
1="Dirichlet: fixed ux"
0="Neumann: σ . n (traction)",
1="Dirichlet: u (displacement)"
},
Name StrCat[surPath, name~{i}, "/0X-component"]}
bcy~{i} = {0, Choices{
0="Neumann: fixed py",
1="Dirichlet: fixed uy"
0="Neumann: σ . n (traction)",
1="Dirichlet: u (displacement)"
},
Name StrCat[surPath, name~{i}, "/2Y-component"]}
bcz~{i} = {0, Visible (modelDim == 3), Choices{
0="Neumann: fixed pz",
1="Dirichlet: fixed uz"
0="Neumann: σ . n (traction)",
1="Dirichlet: u (displacement)"
},
Name StrCat[surPath, name~{i}, "/4Z-component"]}
];
......@@ -165,7 +164,7 @@ Function {
Name StrCat[surPath, name~{i}, "/5Value"]}
];
If(bcx~{i} == 0 || bcy~{i} == 0 || (modelDim == 3 && bcz~{i} == 0))
str = StrCat[str, "p", reg, Sprintf[" = Vector[%g, %g, %g]; ",
str = StrCat[str, "sigman", reg, Sprintf[" = Vector[%g, %g, %g]; ",
bcx_val~{i}, bcy_val~{i}, bcz_val~{i}]];
EndIf
Else
......
......@@ -59,10 +59,10 @@ Group {
If(dim~{i} < modelDim)
DefineConstant[
bc~{i} = {0, Choices{
0="Neumann: fixed n . d",
1="Dirichlet: fixed v",
2="Floating conductor: fixed q",
3="Floating conductor: fixed v"
0="Neumann: n . d (electric displacement)",
1="Dirichlet: v (scalar potential)",
2="Floating conductor: q (free charge)",
3="Floating conductor: v (scalar potential)"
},
Name StrCat[surPath, name~{i}, "/0Type"]}
];
......
......@@ -57,8 +57,10 @@ Group {
If(dim~{i} < modelDim)
DefineConstant[
bc~{i} = {0, ReadOnlyRange 1, Choices{
0=StrCat["Neumann: fixed ", StrChoice[formulationType, "n x h", "n . b"]],
1=StrCat["Dirichlet: fixed ", StrChoice[formulationType, "a", "phi"]]
0=StrCat["Neumann: ", StrChoice[formulationType,
"n x h (magnetic field)", "n . b (flux density)"]],
1=StrCat["Dirichlet: ", StrChoice[formulationType,
"a (vector potential)", "phi (scalar potential)"]]
},
Name StrCat[surPath, name~{i}, "/0Type"]}
];
......
......@@ -16,6 +16,9 @@ DefineConstant[
Freq = 1, // frequency (for harmonic simulations)
Freq_Target = 1, // frequency target (for modal simulations)
Num_Modes = 10, // number of modes (for modal simulations)
TimeInit = 0, // intial time (for time-domain simulations)
TimeFinal = 1/50, // final time (for time-domain simulations)
DeltaTime = 1/500, // time step (for time-domain simulations)
Flag_Axi = 0, // axisymmetric model?
FE_Order = 1 // finite element order
];
......@@ -39,8 +42,8 @@ Function{
E, // Young modulus (in Vol_Mec)
nu, // Poisson coefficient (in Vol_Mec)
rho, // mass density (in Vol_Mec)
f, // applied force per unit volume (in Vol_Force_Mec)
p // applied pressure (on Sur_Neu_Mec)
f, // force per unit volume (in Vol_Force_Mec)
sigman // traction (on Sur_Neu_Mec)
];
}
......@@ -218,12 +221,12 @@ Formulation {
In Vol_F_Mec; Jacobian Vol; Integration Int; }
EndIf
Integral { [ CompX[p[]] , {ux} ];
Integral { [ CompX[sigman[]] , {ux} ];
In Sur_Neu_Mec; Jacobian Sur; Integration Int; }
Integral { [ CompY[p[]] , {uy} ];
Integral { [ CompY[sigman[]] , {uy} ];
In Sur_Neu_Mec; Jacobian Sur; Integration Int; }
If(modelDim == 3)
Integral { [ CompZ[p[]] , {uz} ];
Integral { [ CompZ[sigman[]] , {uz} ];
In Sur_Neu_Mec; Jacobian Sur; Integration Int; }
EndIf
EndIf
......@@ -241,11 +244,13 @@ Resolution {
}
}
Operation {
InitSolution[A];
If(Flag_Regime == 0 || Flag_Regime == 1)
Generate[A]; Solve[A]; SaveSolution[A];
ElseIf(Flag_Regime == 2)
Error["Time-domain not done yet"];
InitSolution[A]; InitSolution[A] ;
TimeLoopNewmark[TimeInit, TimeFinal, DeltaTime, 1/4, 1/2] {
Generate[A]; Solve[A]; SaveSolution[A];
}
Else
GenerateSeparate[A]; EigenSolve[A, Num_Modes, (2*Pi*Freq_Target)^2, 0];
SaveSolutions[A];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment