Skip to main content
1-Visitor
February 19, 2020
Solved

Solving non-linear initial value problem (ODE) with Solve Block

  • February 19, 2020
  • 1 reply
  • 3129 views

Hi,

 

I am trying to model a moving fluid interface in an annular pipe for a varying cross-section. My model is based on a modified Poiseuille equation. If I use a constant cross-section, then MathCAD solves my linear ODE just fine and I get results as expected. If I consider a varying cross-section however, then my ODE becomes non-linear and I'm unclear on which format MathCAD requires to solve this.

 

All unknowns in my attached file are constants, except L(t).

 

I'd be very thankful for any help on how to format a non-linear ODE of this form within a solve block.

 

Regards,

Alex

Best answer by Werner_E

Obviously it has to do with the units and/or their magnitude.

I changed the values of the "unitless units" on top of the sheet and got the result you see below. Note the strange look of the solution curve after t=0,021. If I set t.end to a higher value then 0,025, the solve block fails again with that "unknown error".

Werner_E_0-1582151686395.png

Remark: AS kg is the base unit, it may make more sense to set kg:=1 rather than 1000 as I did. Doesn't make much difference, though.

Disabling the "unit-definitions" at the top should work OK but for reasons unknown to me still doesn't.

I attach the Prime 6 worksheet.

 

1 reply

25-Diamond I
February 19, 2020

The error message states a unit mismatch but we can't see the units you assigned to the various variables.

If possible you should attach your worksheet, not just a picture.

 

AlexW1-VisitorAuthor
1-Visitor
February 19, 2020

Hi Werner,

 

Thanks for your fast response. I attached a version of my worksheet.

 

Alex

25-Diamond I
February 19, 2020

You should delete the region saying "L:=0.1". After all L is not a variable but a function and you don't need a "guess" for a function.

I am getting a different error message -> "unknown error", not a unit mismatch ??

 

Nonetheless the solve block works OK if I delete all units (or set them all to 1).

So you may want to check your equations with respect to the units.

Werner_E_0-1582149008099.png

One additional remark: In the solve block odesolve command you set the end value for t to 0.001, but in your plot you try to plot up to t=0.8. That can't work.