CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Nonlinear Equation

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By dlahaye

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 18, 2022, 07:22
Default Nonlinear Equation
  #1
New Member
 
Max
Join Date: Feb 2022
Posts: 8
Rep Power: 4
Maxxxx is on a distinguished road
Hey,


I´m new to OpenFoam and would like to implement a nonlinear equation to my solver.


Target Equation: C1 * (C2 + C3 * (C4 * |X0-X|)^0.1) * (X-X0) = 0



Where C1,C2,C3 are constant dimensionedScalars,
X0 is my fixed reference volVectorField and

X is the volVectorField I would like to calculate for each cell


As you can see, I do not have any derivative to use fvm namespace or something else.


Hence, following code does obviously not work:


Code:
fvVectorMatrix XEqn
(
     C1 * (C2 + C3 * (C4 * |X0-X|)^0.1) * (X-X0)
);
XEqn.solve();

Now my question: How can I solve equations like this with no derivative for each single cell. Is this possible? If yes are there multiple methods?


Help is appreciated


Max
Maxxxx is offline   Reply With Quote

Old   February 18, 2022, 07:30
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 798
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
How is X coupled accross various cells?

Does a loop over cells and a Newton-type iteration in each cell suffice?
dlahaye is offline   Reply With Quote

Old   February 18, 2022, 07:49
Default
  #3
New Member
 
Max
Join Date: Feb 2022
Posts: 8
Rep Power: 4
Maxxxx is on a distinguished road
Hey,


and thank you for the answer.


My X0 is coupled over the whole mesh. What I would like to do is calculating my X without any coupling meaning I can also calculate it for each cell with a loop as you said, but how?


Tanks you


Max
Maxxxx is offline   Reply With Quote

Old   February 18, 2022, 11:21
Default
  #4
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 798
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
You can put a root finding algorithm inside a loop over cells.

To implement loop over cells, see e.g.

https://github.com/UnnamedMoose/Basi...mmingTutorials

A root finding algorithm can be found inside the boost libraries, see e.g. https://www.boost.org/doc/libs/1_64_...kit/roots.html. OpenFoam builds upon boost. Possible you can try to develop a boost solver outside of OpenFoam.
alundilong likes this.
dlahaye is offline   Reply With Quote

Old   August 21, 2023, 03:07
Default nonlinear spring stiffness
  #5
@ss
New Member
 
shristi
Join Date: Jun 2023
Posts: 26
Rep Power: 3
@ss is on a distinguished road
I want to use non-linear spring stiffness to solve motion equations in openFoam. can anyone tell me how I can do that?
@ss is offline   Reply With Quote

Old   August 21, 2023, 06:50
Default
  #6
Member
 
yijin Mao
Join Date: May 2010
Location: Columbia, MO
Posts: 64
Rep Power: 16
alundilong is on a distinguished road
please elaborate your question,
provide background and formula of interest would definitely help.
alundilong is offline   Reply With Quote

Old   August 21, 2023, 06:52
Default
  #7
Member
 
yijin Mao
Join Date: May 2010
Location: Columbia, MO
Posts: 64
Rep Power: 16
alundilong is on a distinguished road
Quote:
Originally Posted by @ss View Post
I want to use non-linear spring stiffness to solve motion equations in openFoam. can anyone tell me how I can do that?
please elaborate your question,
provide background and formula of interest would definitely help.
alundilong is offline   Reply With Quote

Old   August 21, 2023, 07:25
Default non- linear equation
  #8
@ss
New Member
 
shristi
Join Date: Jun 2023
Posts: 26
Rep Power: 3
@ss is on a distinguished road
First of all, Thank you sir for your response.....
sir, I am working on energy harvesting from vortex-induced vibration in which I use non-linear spring stiffness instead of linear stiffness in the spring mass damper system using OpenFOAM software.

my ̈ + Cy ̇ + ky +by^3= Fy

I am not able to introduce nonlinearity in the motion equation in openFoam and also I am not able to find any video or tutorials related to this.
I have done simulations with linear systems for isolated and multi-body but have not been able to do with non-linear systems.
@ss is offline   Reply With Quote

Old   August 22, 2023, 01:28
Default
  #9
Member
 
yijin Mao
Join Date: May 2010
Location: Columbia, MO
Posts: 64
Rep Power: 16
alundilong is on a distinguished road
Quote:
Originally Posted by @ss View Post
First of all, Thank you sir for your response.....
sir, I am working on energy harvesting from vortex-induced vibration in which I use non-linear spring stiffness instead of linear stiffness in the spring mass damper system using OpenFOAM software.

my ̈ + Cy ̇ + ky +by^3= Fy

I am not able to introduce nonlinearity in the motion equation in openFoam and also I am not able to find any video or tutorials related to this.
I have done simulations with linear systems for isolated and multi-body but have not been able to do with non-linear systems.
You might borrow the ODEsystem and ODESolver to find solution of this second order ODE. Please see the attached file to further explanation.
Attached Images
File Type: jpg solve ODE in OpenFOAM.jpg (29.8 KB, 25 views)
alundilong is offline   Reply With Quote

Reply

Tags
nonlinear equation


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can temperature e treated as a passive scalar be used in transport equation? granzer OpenFOAM Running, Solving & CFD 3 June 6, 2021 17:35
Derivation of the Temperature Equation Tobi OpenFOAM Programming & Development 21 April 10, 2018 23:15
How to solve nonlinear equation. BoredKoala OpenFOAM Programming & Development 14 October 3, 2016 13:19
How to? Extra term in k-e equation. Implicit-Explicit be_inspired OpenFOAM Programming & Development 1 March 19, 2013 11:50
Diffusion Equation izardy amiruddin Main CFD Forum 2 July 4, 2002 09:14


All times are GMT -4. The time now is 04:46.