Solving Helmholtz Equations, HowTo calculate two fields' difference?
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; Code:
fvScalarMatrix pReEqn 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; Thanks very much for reading till here, I am open for suggestion and advice,Thanks! |
Use fvm for your unknown, fvc for your known variables.
http://www.cfd-online.com/Forums/ope...g-fvm-fvc.html |
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! |
Yes, that's correct :)
|
Quote:
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! |
For the second question
Quick Update~!
In the GeometricField< Type, PatchField, GeoMesh > Class Template, there is a operator -= I think it means that Code:
volScalarField p1 |
It seems that the operator -= works!
The operator seems working fine, the compiler has not threw any error.:)
Quote:
|
All times are GMT -4. The time now is 11:10. |