|
[Sponsors] |
June 23, 2015, 05:21 |
How i can equal a new variable with a PDE
|
#1 |
Senior Member
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11 |
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??? |
|
June 23, 2015, 06:33 |
|
#2 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
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; |
|
June 23, 2015, 07:16 |
|
#3 |
Senior Member
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11 |
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 |
|
June 23, 2015, 07:26 |
|
#4 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
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 |
|
June 23, 2015, 07:51 |
|
#5 |
Senior Member
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11 |
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 |
|
June 23, 2015, 08:04 |
|
#6 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
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.
|
|
June 23, 2015, 08:18 |
|
#7 |
Senior Member
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11 |
Thank u chriss,
I will search about it. |
|
|
|
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 |