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

How i can equal a new variable with a PDE

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 23, 2015, 05:21
Question How i can equal a new variable with a PDE
  #1
Senior Member
 
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11
rapierrz is on a distinguished road
Hi friends,

I want to equal a variable with a pde :

U is calculated from navier stokes equation and I want to have :

a=ddt(U)+div(phi.U)-g;

How I can define this equation in openfoam solver???
rapierrz is offline   Reply With Quote

Old   June 23, 2015, 06:33
Default
  #2
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
First you need to define your new variable. This is usually done in createFields.H in the solver.
Then you will have to assign it. You're not solving a PDE here, you're just assigning a value. For this you want to use the explicit schemes, namely
Code:
a = fvc::ddt(U) + fvc::div(phi, U) - g;
chriss85 is offline   Reply With Quote

Old   June 23, 2015, 07:16
Default
  #3
Senior Member
 
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11
rapierrz is on a distinguished road
Thank u very much Chriss,

I have another question.

How I can solve equation x*mag(x)=a that x is a vector and a is the

same a=fvc::ddt(U)+fvc::div(U)-g
rapierrz is offline   Reply With Quote

Old   June 23, 2015, 07:26
Default
  #4
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
Can't you just rewrite that to x=sqrt(mag(a))*sign(a) ?
Edit: Nevermind, I skipped the vector part. So you're coupling between the vector components by using the magnitude? I think you might have to use a fixed point procedure then, such as Newton's method
chriss85 is offline   Reply With Quote

Old   June 23, 2015, 07:51
Default
  #5
Senior Member
 
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11
rapierrz is on a distinguished road
thank you friend,

my target is that calculate the drift velocity then use it in navier stokes

equations but in my equation there is V*mag(V)=a and V is relative velocity

How I can solve V?what is initial guess for V in createField?

thank u
rapierrz is offline   Reply With Quote

Old   June 23, 2015, 08:04
Default
  #6
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
You don't have a differential equation there but a normal equation that you need to invert numerically. Please read up and see if Newton's method (or some similar iterative method) is suitable for this. Equation solving capability of OpenFOAM is not going to help you here, you will have to program this yourself.
chriss85 is offline   Reply With Quote

Old   June 23, 2015, 08:18
Default
  #7
Senior Member
 
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11
rapierrz is on a distinguished road
Thank u chriss,

I will search about it.
rapierrz is offline   Reply With Quote

Reply


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
using time as a variable to classify a pde nargess_md Main CFD Forum 9 October 6, 2013 06:38
emag beta feature: charge density charlotte CFX 4 March 22, 2011 10:14
error in COMSOL:'ERROR:6164 Duplicate Variable' bhushas COMSOL 1 May 30, 2008 05:35
Env variable not set gruber2 OpenFOAM Installation 5 December 30, 2005 05:27
Replace periodic by inlet-outlet pair lego CFX 3 November 5, 2002 21:09


All times are GMT -4. The time now is 07:30.