# Application of natural boundary conditions

I am trying to apply a time dependent load in AceFEM, for which i have used adaptive time method for analysis, also i need it to be applied at the nodal points from 1 to 15. So i have used natural boundary condition and gave the command but have encountered error that my "Boundary condition is not of prescribed form". Please guide me

<< AceFEM;
SMTInputData[];
P = 1000000;
SMTAddDomain["Ω","ML:SEPET1DFLET1DHooke", {"E *" -> 1000, "ν *" -> 0.3}];
ImplicitRegion[x^2 + y^2 > 0.05, {x, y}],
{{-3, 3}, {-3, 3}},"MeshOrder" -> 1], "Ω"
];
Clear[λ];
λ[t_] := P (1 - t/0.008);
Plot[λ[t], {t, 0, 0.008}]
SMTAddEssentialBoundary[Line[{{-3, -3}, {3, -3}}], 1 -> 0, 2 -> 0];
SMTAddEssentialBoundary[Line[{{-3, 3}, {3, 3}}], 1 -> 0, 2 -> 0];
SMTAddEssentialBoundary[Line[{{-3, 3}, {-3, -3}}], 1 -> 0, 2 -> 0];
SMTAddEssentialBoundary[Line[{{3, -3}, {3, 3}}], 1 -> 0, 2 -> 0];
SMTAddNaturalBoundary[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, 1 -> λ[t]];
SMTAnalysis[];

SMTNextStep["Δt" -> 0.008, "λ[t]" -> λ];
While[
While[
step=SMTConvergence[10^-8,15, {"Adaptive Time", 8, .00001, 0.01, 10}],
SMTNewtonIteration[];
];
If[
step[[4]] === "MinBound",
SMTStatusReport["Analyze"];
SMTStepBack[];
];
step[[3]],
If[
step[[1]],
SMTStepBack[];
];
SMTNextStep["Δt" -> step[[2]],"λ[t]" -> λ]];

Show[
SMTShowMesh["BoundaryConditions" -> True, "Field" -> "Sxx","Contour" ->True]
]

• Do you get any specific errors? Commented Jun 3, 2017 at 10:29
• I am getting this error Error in natural boundary condition. Description : Bondary condition is not of the prescribed form. Problematic natural boundary condition: {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, 1 -> 1000000*(1 - 125.*t)} Node:1 Value:\{1.*10^6 (1. -125. t)} Version: 6.816 Windows (10 May 17) (MMA 11 See also: Input Data AceFEM Troubleshooting Continue for this particular code [Lambda][t_] := P (1 - t/0.008); Plot[[Lambda][t], {t, 0, 0.008}] SMTAddNaturalBoundary[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, 1 -> [Lambda][t]]; Commented Jun 4, 2017 at 16:36
• @SwapnilAgarwal In the "Cyclic tension test" example from the manual only essential boundary conditions are specified, while the error message you posted in the comment mentions natural boundary conditions (SMTAddNaturalBoundary). Can you please edit your question to include all the code you have used and a clearly explain your goals. Commented Jun 4, 2017 at 18:06
• @Pinti mam, I have made the changes to question and code. Commented Jun 5, 2017 at 6:27

There are multiple issues with your code, but lets first address the source of error message about "Boundary condition is not of prescribed form".

Bellow I have copied the first section of your original code, up until SMTAnalysis command. After this we can already check if our data structures have been input correctly. (All built-in symbols/functions start with capital letter, your symbols defined in notebook should start with lowercase letter, so they can be easily distinguished. Keep in mind this good practice.)

<< AceFEM;

(* Note: This code section has intentional errors! *)
SMTInputData[];
P = 1000000;
SMTAddDomain["Ω","ML:SEPET1DFLET1DHooke", {"E *" -> 1000, "ν *" -> 0.3}];
ImplicitRegion[x^2 + y^2 > 0.05, {x, y}],
{{-3, 3}, {-3, 3}},"MeshOrder" -> 1], "Ω"
];
Clear[λ];
λ[t_] := P (1 - t/0.008);
Plot[λ[t], {t, 0, 0.008}]
SMTAddEssentialBoundary[Line[{{-3, -3}, {3, -3}}], 1 -> 0, 2 -> 0];
SMTAddEssentialBoundary[Line[{{-3, 3}, {3, 3}}], 1 -> 0, 2 -> 0];
SMTAddEssentialBoundary[Line[{{-3, 3}, {-3, -3}}], 1 -> 0, 2 -> 0];
SMTAddEssentialBoundary[Line[{{3, -3}, {3, 3}}], 1 -> 0, 2 -> 0];
SMTAddNaturalBoundary[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, 1 -> λ[t]];
SMTAnalysis[];


When you evaluate this code you get the error message saying "Error in natural boundary condition". Reason for this is that syntax SMTAddNaturalBoundary[..., 1 -> λ[t]]; is wrong. See the quote from documentation:

Current value of boundary conditions (Bt) is calculated from its value in previous time/load step (Bp): Bt=Bp+Δλ dB. Multiplier increment Δλ and reference BC intensity dB can have arbitrary values, but value of their product should be meaningful. Typically dB is set to 1 and multiplier λ goes from 0 to its final value. Multiplier can be also a function of time λ[t] and then time t goes from 0 to final time.

So, changing the definition of natural BC removes the error message, but there is another problem.

SMTAddNaturalBoundary[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, 1 -> 1];


You apply the force (natural BC) to nodes with specific node numbers from 1-15, but how can you be sure upfront what are the node numbers on your mesh in some area of interest. See the picture bellow, where one node on the inner edge doesn't get the applied force, but it probably should.

It is much better to find nodes of interest with appropriate "node selector", some function of their initial position. This is the whole block of code for correct definition of input phase. For NBC all nodes on the circle with the specified radius are chosen.

(* This definition of hole size is clearer. *)
SMTInputData[];
SMTAddDomain["Ω","ML:SEPET1DFLET1DHooke", {"E *" -> 1000, "ν *" -> 0.3}];
ToElementMesh[
ImplicitRegion[x^2 + y^2 > holeRadius^2, {x, y}], {{-3, 3}, {-3, 3}},
"MeshOrder" -> 1],
"Ω"];
SMTAddEssentialBoundary[Line[{{-3, -3}, {3, -3}}], 1 -> 0, 2 -> 0];
SMTAddEssentialBoundary[Line[{{-3, 3}, {3, 3}}], 1 -> 0, 2 -> 0];
SMTAddEssentialBoundary[Line[{{-3, 3}, {-3, -3}}], 1 -> 0, 2 -> 0];
SMTAddEssentialBoundary[Line[{{3, -3}, {3, 3}}], 1 -> 0, 2 -> 0];
SMTAnalysis[];

SMTShowMesh["BoundaryConditions"->True,PlotRange->0.5,ImageSize->200]


Time always starts from 0 and I think BC multiplier should also start from 0, but it can change as arbitrary function of time.

Clear[λ];
maxTime = 0.008;
(*Plot[λ[t],{t,0,0.008}]*)


These are key parameters for SMTConvergence that guide time stepping. Analysis will finish with somewhere between 10 and 100 steps. The first step will be smaller that maximum allowed step.

Δt0 = maxTime/20;
ΔtMax = maxTime/10;
ΔtMin = maxTime/100;


I am going to write explanation for analysis loop with inline comments, because it will be more readable. Analysis loop has two While loops, the outer controls time/load stepping and the inner controls number of (Newton-Rhapson) iterations for each step.

(* Increase values of BC for the first step.
Size of time step is prescribed, and the load multiplier changes according to function λ. *)
SMTNextStep["Δt" -> Δt0,"λ[t]" -> λ];

While[
(* Do iterations until SMTConvergence returns something else than explicit True.
In case of "Adaptive Time" this is a list of 4 elements that guide     further behaviour of analysis loop.
Return value of SMTConvergence is assigned to symbol step. *)
While[
step =
SMTConvergence[10^-8,15, {"Adaptive Time",8, ΔtMin, ΔtMax, maxTime}],
SMTNewtonIteration[];
];
If[
Not[step[[1]]],
(* All the code for collecting results goes here.
Code is evaluated only if no step back is needed. *)
SMTShowMesh[
"DeformedMesh"->False,"BoundaryConditions"->True,"Field"->"Sxx", "Contour" -> {-10^6, 10^6, 7},
"Show" -> "Window" | {"Animation", "MyTestName", ImageSize -> 400}]
];
If[
step[[4]] === "MinBound",
SMTStatusReport["Analyze"];
SMTStepBack[];
];
(* step[[3]] is test for outer While. This is the result of the last evaluation of SMTConvergence.
If it is True analysis should make another step (forward or backward).
It is False only if the final time has been reached or analysis has diverged. *)
step[[3]],
If[
step[[1]],
SMTStepBack[];
];
(* If analysis has converged in the last step and has not yet reached the final value of time,

• Why is there no change in stresses when i keep  λ[t_] := maxLoad*(1-(t/maxTime)) Is there any possible way to load this kind of condition. Also is there any mistake in the way i am using this animation command.  SMTMakeAnimation["blast", "gif","AnimationRepitions"->Infinity ] I am getting the error of no frames have been stored under this keyword Commented Jun 5, 2017 at 18:16
• @SwapnilAgarwal There is no stress, because with your definition of λ[t_] the final value of BC multiplier is zero (λ[maxTime]==0), so applied forces are zero. For making animation you have to first save its frames during the analysis. Please see my edited answer. Commented Jun 5, 2017 at 19:01