## How to apply the boundary condition as DERIVATIVE in FlexPDE

General discussions about how to formulate a script for FlexPDE.

### How to apply the boundary condition as DERIVATIVE in FlexPDE

Dear All

I want to solve the following ordinary differential equation related to deflection of the cantilever beam.
dxx(w)=-P*x/E/I
BC1: w=0 at x=0
BC2: dw/dx=0 at x=0
I cannot impose the boundary condition BC2 correctly.
------------------------------------------------------------------------------
TITLE 'Cantilever Beam' { the problem identification }
COORDINATES cartesian1 { coordinate system, 1D,2D,3D, etc }
VARIABLES
W
H

DEFINITIONS

L=1
P=200
E=70e9
I=1/12*0.03^4
ans_analytical=-(1/6)*P*x^3/(E*i)

EQUATIONS { PDE's, one for each variable }
H: H=dx(w)
W: dx(H)=-P*x/E/I

BOUNDARIES { The domain definition }
REGION 'domain' { For each material region }
START(0) { Walk the domain boundary }
point value (w)=0
point value (H)=0
LINE TO (L)

MONITORS { show progress }
PLOTS { save result displays }
elevation (w,ans_analytical) from (0) to (L) as "deflection"
END
----------------------------------------------
Why my script is not resulted in the correct solution?
How can I apply “Natural (Or load) Boundary condition” to solve my problem?
How can I impose boundary condition as DERIVATIVE in FlexPDE?

nit

Posts: 1
Joined: Fri Mar 24, 2017 4:28 pm

### Re: How to apply the boundary condition as DERIVATIVE in FlexPDE

Hi nit! Sorry for not being able to help you but I have the same doubt. Can someone tell us?
JAFig

Posts: 3
Joined: Fri Sep 18, 2020 3:44 am

### Re: How to apply the boundary condition as DERIVATIVE in FlexPDE

This reflects an oversight on our part.
In the dual first-order formulation, the W equation has no dependence on W itself.
Our default preconditioner uses the reciprocal of the diagonal element of each row, which in this case is zero.
There is a guard to replace 1/0 with 1, but this is not the right correction. We should trap the condition earlier and select a different preconditioner.

In any case, you can correct this error with SELECT NOPRECON.
ATAPRECON also works.
moderator

Posts: 865
Joined: Tue Jan 11, 2011 1:45 pm

### Re: How to apply the boundary condition as DERIVATIVE in FlexPDE

Yes, thank you very much for your help. It works.
But one question: If instead of posing the equations in this way:

EQUATIONS { PDE's, one for each variable }
H: H=dx(w)
W: dx(H)=-P*x/E/I

we do it this way:

EQUATIONS { PDE's, one for each variable }
H: H=dx(w)
W: dxx(w)=-P*x/E/I

In this case, the W equation has dependence on W itself. However, how can I impose that the derivative is equal to zero in the inicial point: dx(w) = 0? Is it possible to impose this boundary condition? How to apply the boundary condition as DERIVATIVE?

JAFig

Posts: 3
Joined: Fri Sep 18, 2020 3:44 am

### Re: How to apply the boundary condition as DERIVATIVE in FlexPDE

First I should point out that there in nothing wrong with the dual first-order formulation you initially proposed, except that it triggered an oversight in our default preconditioner.
That condition can be bypassed by selecting a safe preconditioner (ATAPRECON) or none (NOPRECON).
It has been corrected for the next update of FlexPDE7.

The modification you propose does not solve the problem. It constructs a system in which three boundary conditions are required, and does not enforce the conditions you want in any case.

The conventional way to apply a flux boundary condition is with the NATURAL() construct (see NATURAL in the Help index). This requires a second order equation, and we then still face the problem that you can't pose two BCs at the same point. I can think of a few ways that we might support this need, but they are not implemented in the current code, and the condition is rare in any case. The NATURAL BC builds the appropriate boundary terms for the integration-by-parts used in the formation of the Galerkin equations, but it does not enforce the condition if other processes have conflicting demands.
moderator

Posts: 865
Joined: Tue Jan 11, 2011 1:45 pm

### Re: How to apply the boundary condition as DERIVATIVE in FlexPDE

Perfect. Thanks! I can use then the equations formulated initially bypassing the default preconditioner.

Yes, imposing two boundary conditions at the same point is a problem as it is not possible. However, for some problems it would be interesting to condition the contour with two BCs, as in this case. One way to do this could be to assign the relationship between both BC values. For example, to impose the value of the variable (u) and its derivative (dy(u)) on the contour, the relationship between the two can be imposed, for example, u/dy(u) = target value. Of course, this will be more problematic than imposing the NATURAL condition, as it is better conditioned.
JAFig

Posts: 3
Joined: Fri Sep 18, 2020 3:44 am