|
[Sponsors] |
[HOW TO] solve the velocity components (Ux and Uy) from 2 equations |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 17, 2020, 13:13 |
[HOW TO] solve the velocity components (Ux and Uy) from 2 equations
|
#1 | ||
Senior Member
|
Hello Foamers,
Based on my previous thread, I'm continuing this new thread !! Couldn't able to figure out the technique - NO problem with Compilation I have defined a volVectorField U with two scalar fields Ux and Uy along x and y directions (2D). I want to extract Ux and Uy based on two equations given below. I tried defining the above two equations in many ways, but ends with no success. The pressure on the other hand is solved comfortably with no errors. Equs. (3a and b) is defined in OpenFOAM as, Quote:
Quote:
If anyone have some ideas, kindly do share it to proceed further. Thank you **The above equations are referred from the following reference: Equ. (9) expanded as 2 Equs. [Equ. 21 - cylindrical coordinates] https://aiche.onlinelibrary.wiley.co.../aic.690200519 |
|||
January 17, 2020, 14:02 |
|
#2 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
You have posted essentially the same question in three different threads now. I am sure that this is against forum etiquette, is kind of annoying, and will likely not get you help any faster.
You ask why your p field is being updated, and not your U field. I believe I have already answered that question in the other thread. If you did not fully understand the answer (which can happen), I am happy to continue the discussion in that thread. Here's another hint: what do you think this statement will do? Code:
(gradCurlUyx - gradCurlUxy) = (1/0.4343*(f1+(f2*rho*Ux)))*((Ux*gradUxy)-(Uy*gradUxx)); MODS: could you please merge the two threads? |
|
January 17, 2020, 14:58 |
|
#3 | ||
Senior Member
|
Sorry Adhiraj. I'm in a rush to complete my work - deadlines in short. I have searched threads in CFD forums, but couldn't able to find a way. Even in my previous thread, I replied at last - but there is no response back and I thought you are even tired of responding me everytime. So, I thought not to annoy you further and posted a new thread here again to get response from other foamers. I'm happy if you help me further.
And coming to your question, yes you answered my query. But, I didn't understand it completely and I'm glad to continue the discussion in previous thread. Quote:
Quote:
== operator I tried using == operator but ends in error as shown above in comment and I'm looking forward to resolve this case. MODS: could you please merge the two threads? -- I dont know, could you help me with it please... Thank you for your patience.. |
|||
January 17, 2020, 15:50 |
|
#4 | |||
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
I am happy to help, but instead of posting the same question over and over again, you need to spend a little time to understand the responses and then you will arrive at a solution to your problem much quicker.
Quote:
You created the variables gradCurlUyx and gradCurlUxy, but when the compiler sees (gradCurlUyx - gradCurlUxy), it creates a temporary variable to store the difference. This variable probably does not even have a name per se, and it is to this variable that the value of the right hand side is assigned. The variables gradCurlUyx and gradCurlUxy are not affected. See the problem? Quote:
Quote:
If you want to solve for Ux, you need to create the appropriate fvMatrix for it, using terms such as fvm::ddt(...), fvm::grad(...) and so on. |
||||
January 17, 2020, 17:39 |
|
#5 | |||
Senior Member
|
Dear Adhiraj,
Thank you for your clear-cut explanation. My biggest mistake was that, I didn't assign any name to solve velocity in matrix form, as how I assigned for pressure (p): Quote:
So, in order to solve velocities Ux and Uy - I need to create a fvScalarMatrix, something as such below: Quote:
Quote:
Thank you once again ^^ Last edited by Kummi; January 17, 2020 at 18:43. |
||||
January 17, 2020, 19:36 |
|
#6 | |
Senior Member
|
As stated in above error, when I looked into the fvMatrix.C file (see below), the constructors are based on fvm type
Quote:
Kindly share some tips - which will be helpful to proceed further. Thank you |
||
January 17, 2020, 19:39 |
|
#7 | |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Now we are making a little progress, but a couple of issues still remain.
Quote:
You are constructing the fvScalarMatrix wrong: Code:
fvScalarMatrix UxEqn ( (gradCurlUyx - gradCurlUxy) - (((Ux*gradUxy)-(Uy*gradUxx))/(0.4343*(f1+(f2*rho*Ux)))) ); No it does not. If you can successfully create the matrices, then UxEqn will solve for Ux, and UyEqn will solve for Uy. |
||
January 17, 2020, 22:14 |
|
#8 | ||
Senior Member
|
Dear Adhiraj,
Thank you. As you stated, to create the matrices, fvm operators are necessary. But in my case, the velocity equation contains only gradient terms. I referred the following thread and got some ideas: Gradient operator implicit discretization Quote:
Quote:
fvScalarMatrix MyEqn ( ... + fvm::div(sf I) - fvm::Sp(fvc::div(s), I) ... ); Should I want to use this kind of approach ? However, even if I follow the above approach, if I need to solve the Ux and Uy components separately in 2 equations, I will be holding only the scalar variables (Ux, Uy) not vector variable. But, the above formula solved based on both scalar and vector variables. If you have some references, kindly do share. Thank you |
|||
January 18, 2020, 16:50 |
|
#9 | |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Quote:
Using fvm::div(s) gives you the full gradient vector or matrix (depending on whether s is a scalar or a vector). Then you will have to extract the terms , , and so on. Please put some thought into how to best write your equations, and converting them into code. This step is often non-trivial. |
||
January 18, 2020, 20:47 |
|
#10 | ||
Senior Member
|
Dear Adhiraj,
Thank you. I have fully understood your above comments. Using fvm operator with divergence in hand, calculations are made firstly, and then followed by the extraction of necessary variables and finally converting into code. I have a question. When we try to define divergence term implicitly using fvm, we adopt the format ∇ • (ρUU) =====> div(phi,U) and φ = ρU But in my case, there is no necessity of phi. As you stated, "Using fvm::div(s) gives you the full gradient vector or matrix", then what may be the possibility to carry out the divergence of single term (s) using fvm operator ? Quote:
Quote:
Kindly correct me if I'm wrong anywhere Thank you Last edited by Kummi; January 19, 2020 at 22:02. |
|||
January 20, 2020, 14:36 |
|
#11 | |||
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Quote:
Quote:
I was trying to point out that your equations are not standard advection-diffusion equations. For example, one of the equations look like this: where and are the and components of the velocity vector . There are difficulties with this set of equations:
Thus you need to think carefully how to obtain from this set of equations. Maybe you should start with the vector form of the equation instead of the scalar forms? |
||||
January 21, 2020, 02:41 |
Convert the explicitly defined variables into implicit formulations
|
#12 | |||||
Senior Member
|
Dear Adhiraj,
Quote:
Quote:
Quote:
But, in order to define the matrix form, the equations should implicitly defined with fvm operators as discussed above. Quote:
problem with fvc:div In the above link, there found a statement confessing that: Quote:
Did I get it right until this point ? Thank you Last edited by Kummi; January 21, 2020 at 03:51. |
||||||
January 21, 2020, 10:02 |
|
#13 | |
Senior Member
|
Dear Adhiraj,
Hereby in this post, gradient variables are defined explicitly inside fvMatrix. How to add implicit terms to the momentum equation? Quote:
Could you please explain,as how the foamer defined the gradient variables inside fvMatrix ? How to add implicit terms to the momentum equation? The solve attached here by the same foamer, I tried compiling it, it has compiled well and good. I tried the same by defining gradient inside fvMatrix in my case, but it failed. May I miss something ? |
||
January 23, 2020, 04:42 |
fvVectorMatrix structure !!
|
#14 | ||
Senior Member
|
Dear Adhiraj,
I have came across a thread - implemented curl function in fvMatrix. Does anyone work with curl in OpenFoam With that in mind, I implemented the vector form of the equation in matrix form as: Quote:
- Without term (1) - dummy*(fvm::ddt(U)) implicit, the above matrix is not compiling in OpenFOAM. So is that mean, there should be atleast one implicit term in the matrix ? - I feel, introducing term (1) in the above matrix doesn't affect the flow physics. Correct me if I'm wrong here. - However, the solver is compiled good, there found no change in velocity during post-processing. I guess, its because the curl is defined explicitly. Quote:
Thank you |
|||
January 23, 2020, 08:31 |
|
#15 |
Senior Member
|
Block matrices vs segregated solvers
Block matrix implementation for implicit curl operators. Its in Foam-Extend versions based on fully implicit method (FIM). Guess it should work. Looking ahead !!! |
|
January 26, 2020, 05:38 |
Unable to define the operators - Implicitly
|
#16 | |||
Senior Member
|
As like OpenFOAM, "curl" operator has been expressed only explicitly in foam-extend too.
However, implicit "grad" operator is handled in foam-extend. But, I'm not sure how far it is accessible. Because, fvm::grad is intended for particular purpose. Quote:
With implicit "grad" operator in hand, I should split my curl into gradient operators. Then, instead of calculating vector variable like "U" as a whole, I should calculate my scalar [Ux, Uy] variables "fvm::grad(Ux)". With this above equation in mind, if I set explicitly, then there is no compilation error - but there is no change in velocity during post-processing as expected. Quote:
Yes, the gradient operator here can't be defined implicitly. Because physically, it calculates variables from the known value and so, explicit calculations of fvc returns geomertricField<Type>. Quote:
I guess, the only way to define my above equation is to set the operators (grad or curl) implicitly. Stuck here !! Difficulties:
Thank you Last edited by Kummi; January 26, 2020 at 06:48. |
||||
March 3, 2020, 02:06 |
Defined an ADDITIONAL implicit term - helps in compilation
|
#17 | |
Senior Member
|
As explained above, in order to define the equation in matrix form, the implicit term (fvm) is highly necessary. In my equation, I have only curl operator, which is only explicitly (fvc) defined in standard openfoam versions. So, I intentionally come up with the transient term defined with fvm operator (fvm::ddt(dummy)), where the dummy constant vector variable is defined with 0 value.
Quote:
- Now however, the solver is compiled good, there found no change in velocity during post-processing [ATTACHMENTS]. In above equation, the explicit calculations of fvc should return a field value. Still no change in velocity. I'm hereby attaching the case and code files. Kindly someone check it and share the thoughts. Thank you |
||
March 4, 2020, 15:33 |
|
#18 | |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Quote:
You are creating the fvVectorMatrix in a way that makes dummy as the unknown, and then expecting to obtain U from the system. It does not work that way. When you create the fvVectorMatrix, you are trying to create the matrix of the linear system Any term created using the fvm operators will go into the matrix , and everything else will go into . Your term Code:
fvm::ddt(dummy) The velocity will not be updated because the code as written in the post will not solve for velocity. |
||
March 5, 2020, 15:39 |
|
#19 | ||
Senior Member
|
Thank you for your reply.
Got your points. As I explained above, Quote:
Quote:
In my equation, I have only curl operator, which is only explicitly (fvc) defined. So all the velocity terms will go into b [Ax=b]. Velocity is not updated in matrix A. My question is: In order to get the velocity updated, the matrix term is necessary to be updated ? If so, in my work, there is no fvm operator to update the matrix for velocity variable. Any ideas as how to proceed from here.. Thank you |
|||
March 6, 2020, 12:05 |
|
#20 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
There seem to be no implicit operators that can produce the velocity-equation matrix for your case, which is making the job hard.
Here is a thought: instead of solving an equation for , simply calculate the other quantities such as , , and then directly update the velocity instead of solving an equation for . Keep in mind that this approach probably needs a carefully drafted formulation. I am not familiar with this problem, so I cannot help with the formulation, and I don't know what potential issues may crop up in doing so. Perhaps you can find some insight in the literature? |
|
|
|