|
[Sponsors] |
Need of Help: HowTo designate explicitely unknown variables of a question? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 29, 2016, 00:53 |
Solving Helmholtz Equations, HowTo calculate two fields' difference?
|
#1 |
New Member
Xiaoqiu HE
Join Date: Mar 2016
Location: Wuhan, China
Posts: 29
Rep Power: 10 |
Hi~ Dear Foamers,
I'm a PhD students in Huazhong University of Science and Technology and I am studying OpenFOAM for simulating the acoustic radiation force in microfludic chips. My question: 1.In a fvMatrix class, how user explicite point out the unknown variables which is needed to be solved? Actually in all the documents, no one explicitly point out the "unknown variables" in a fvMatrix, so what is the mechanism OpenFOAM identify the "known variables" and "unknown variables" in a equation( fvMatrix ). Update: Thanks for akidess's answer! fvm operations comprise the unknown variable and it admits only one unknown variable; fvc operations comprise the already known variables 2. Is there a way to have explicte calculate two fields' difference as one iteration's residual? These two question is too abstract and I would like to objectify them in my studying case: I would like to solve the helmholtz equation as following: Code:
laplacian(P) - sqr(k)*P == 0 the pression and k is all complex number, so I decide to seperate them as follwing: Code:
surfaceScalarField p_Re; surfaceScalarField p_Im; surfaceScalarField kSq_Re; // constant already known surfaceScalarField kSq_Im; // constant already known Code:
fvScalarMatrix pReEqn ( fvm::laplacian(p_Re) + fvm::Sp(kSq_Re, p_Re) - fvc::Sp(kSq_Im, p_Im) ); fvScalarMatrix pImEqn ( fvm::laplacian(p_Im) + fvc::Sp(kSq_Im, p_Re) + fvm::Sp(kSq_Re, p_Im) ); 1. the first equation is solved in order to get the new p_Re 2. substituting the new p_Re into second equation and then solve it in order to get the new p_Im. 3. check the differences between new and old p_Re and p_Im. If the differences are small enough, finish; if not go back to step 1. If I set up two temporary variable as following: Code:
surfaceScalarField pOld_Re; surfaceScalarField pOld_Im; Thanks very much for reading till here, I am open for suggestion and advice,Thanks! Last edited by Democritus; March 29, 2016 at 04:28. Reason: Update the result |
|
March 29, 2016, 03:33 |
|
#2 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30 |
Use fvm for your unknown, fvc for your known variables.
http://www.cfd-online.com/Forums/ope...g-fvm-fvc.html
__________________
*On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer. |
|
March 29, 2016, 04:10 |
|
#3 |
New Member
Xiaoqiu HE
Join Date: Mar 2016
Location: Wuhan, China
Posts: 29
Rep Power: 10 |
Thank you very much for your respond~!
In fvm operations, there may be two arguments, such as fvm::div(psi, phi) The OpenFOAM treats phi as unknown variables by default and treats psi as known variable by default. In deduction, all the fvm operations only admit one argument as unknown and non-linear equations should be handled manually. Am I right? Thank you! |
|
March 29, 2016, 04:49 |
|
#5 |
New Member
Xiaoqiu HE
Join Date: Mar 2016
Location: Wuhan, China
Posts: 29
Rep Power: 10 |
As a beginner of OpenFOAM, I really need the confirmed answer of such a basic question, thanks!
For the second question, is there a method within surfaceScalarField class for calculating the difference between two fields of the same mesh? Thank you very much! |
|
March 31, 2016, 04:11 |
For the second question
|
#6 |
New Member
Xiaoqiu HE
Join Date: Mar 2016
Location: Wuhan, China
Posts: 29
Rep Power: 10 |
Quick Update~!
In the GeometricField< Type, PatchField, GeoMesh > Class Template, there is a operator -= I think it means that Code:
volScalarField p1 ( IOobject ( "p1", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); volScalarField p2 ( IOobject ( "p2", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); p1 -= p2; // p1 = p1 - p2 |
|
April 12, 2016, 09:38 |
It seems that the operator -= works!
|
#7 | |
New Member
Xiaoqiu HE
Join Date: Mar 2016
Location: Wuhan, China
Posts: 29
Rep Power: 10 |
The operator seems working fine, the compiler has not threw any error.
Quote:
|
||
Tags |
helmholtz, programming |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM - Quick way to delete previous calculation & HowTo get access to variables | kriz | OpenFOAM | 12 | March 6, 2023 04:20 |
Dynamic simulation for unknown variables? | fatb0y | CFX | 4 | December 8, 2010 20:26 |
Question about CFX-Pre Variables | seaharrier | CFX | 1 | July 29, 2009 08:13 |
compressible two phase flow in CFX4.4 | youngan | CFX | 0 | July 2, 2003 00:32 |
Error message | Pandu Sattvika | CFX | 0 | March 1, 2002 16:28 |