
[Sponsors] 
June 20, 2019, 11:35 
How does "fvm::SuSp" work ?

#1 
Member
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8 
Dear foamers,
I want to add source terms to my equations by using fvm::SuSp. However, whatever combination that I make fails. I have "no matching function for call" error*. How we can have a source terms as following : fvm::SuSp(VolScalarField, SurfaceScalarField) fvm::SuSp(VolScalarField, SurfaceVectorField) Thanks in advance for your help, Mary * For instance, one of the error is the following : Code:
error: no matching function for call to ‘SuSp(Foam::volScalarField&, Foam::surfaceScalarField&)’  fvc::SuSp(A,phi) Last edited by mkhm; June 23, 2019 at 12:05. 

June 23, 2019, 05:58 

#2 
Member
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8 
No one can help me ?


June 24, 2019, 05:47 

#3 
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 
Looking at the programmer guide fvm::susp takes only volumetric fields as arguments. So you have to tranform your surfacefied in a volumetric field


June 25, 2019, 05:24 

#4  
Member
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8 
Quote:
fvm::SuSp(c1,fvc::reconstructMag(phi)) where c1 is a volScalarField and phi is surfaceScalarfied. However, I had the error : Code:
error: no matching function for call to ‘SuSp(const volScalarField&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >)’  fvm::SuSp(c1,fvc::reconstructMag(phi)) Thanks for helping me. 

June 25, 2019, 06:06 

#5 
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 
Can you try to contruct your field first and then pass it to the function. I think the Problem is the tmp template.
Something like this: volScalarField phi1(fvc::reconstructMag(phi); fvm::SuSp(c1,phi1); 

June 27, 2019, 06:39 

#6 
Senior Member

What equation do you want to solve?
The second argument in the SuSp will be the variable which is solved in the equation. For example, epsilon_ is the second argument in SuSp of epsilon equation. https://github.com/OpenFOAM/OpenFOAM...Epsilon.C#L262 https://github.com/OpenFOAM/OpenFOAM...Epsilon.C#L283 SuSp function sets both the diag and source components of the matrices. https://github.com/OpenFOAM/OpenFOAM.../fvmSup.C#L210 

June 27, 2019, 12:33 

#7 
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 
maybe the there are some misunderstandings how to uses fvm::susp(A,phi)
A... a volscalarphield phi... is the variable you are solving for in the Matrix (can be a volScalarField, volVectorField or volTensorField) so if youre unkown field is c1 and phi is you mass flux (it is per Definition a surfaceField) you can write: fvm::SuSp(fvc::reconstructMag(phi),c1) 

June 28, 2019, 12:48 

#8 
Member
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8 
Hi Michael, Hi Shinji,
Thanks to both of you to answer me. I am solving the density, momentum and energy equation. I add to all 3 a different term. I did it with fvc and the compilation was fine. However, the subsonic part of the solution was not converging. So, I though maybe I should add this term in another way where the sign of the latter is considered and based on the sign, the source term is treated explicitly or implicitly (please see Understanding fvm::Sp() ). By the way, I am not sure that the use of fvm::SuSp will solve the problem. So, for instance I have the density equation : Code:
//  Solve density solve(fvm::ddt(rho) + fvc::div(phi) //native OF+ ==  fvc::reconstructMag(phi*fvc::interpolate(A)) //added and works ); Where Phi is Surface Scalar Field and is basically rho*velocity and A is a Vol scalar field (positive in supersonic part or negative in subsonic part). This modified version of solver is working (no compilation error and runs well). However, I have some issues for some subsonic cases. So, I wanted to try this fvm::SuSp. I have the following version based on Michael's suggestion : Code:
volScalarField phi1 // construct your field first and then pass it to the function. ( fvc::reconstructMag(phi) // fvc::reconstruct(surfScaField) ); //  Solve density solve(fvm::ddt(rho) + fvc::div(phi) //native OF+ ==  fvm::SuSp(A,phi1) //added and works ); This version of solver compiles well but after when I run on my case study, I have the following error : Code:
> FOAM FATAL ERROR: incompatible fields for operation [rho] == [reconstruct(phi)] I tried as well another version based on Michael's last comment as following : Code:
//  Solve density solve(fvm::ddt(rho) + fvc::div(phi) //native OF+ ==  fvm::SuSp(fvc::reconstructMag(phi),A) ); This version does not seem correct to me as I am somehow solving the rho related field. And if I look at Shinji examples, the field that you solve is the second argument of fvm::SuSp (correct me if I am saying wrong stuffs). This version compiles fine as well but when I run it, I have the following error: Code:
> FOAM FATAL ERROR: incompatible fields for operation [rho] == [A] Could you see what is wrong and did you have any experience to solve instability of your solvers by using fvm::SuSp ? Thanks a lot for your help, Best regards 

June 28, 2019, 14:04 

#9 
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 
The second argument to fvm::susp should be your unknown variable rho. This would work fvm::susp(A,rho)


June 28, 2019, 14:24 

#10 
Member
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8 
But the term to be added to this equation is A*phi and not A*rho. You mean that I should separate the velocity from the density and instead of using their multiplication which is in phi, I should do something like : fvm::susp(A*velocity,rho)?


June 28, 2019, 14:29 

#11 
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 
Yes this should compile and run


June 28, 2019, 14:34 

#12 
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 
A no take the magnitude of the velocity otherwise you Java a volVectorField on the left side


July 1, 2019, 07:08 

#13  
Member
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8 
Quote:
Thanks Michael for your prompt response. In this case, what about the energy equation ? : Code:
solve ( fvm::ddt(rhoE) //native OF + fvc::div(phiEp) //native OF  fvc::div(sigmaDotU) //native OF ==  fvm::SuSp(A,phiEp) ); In this case the term to be added is A*phiEp. So again, I have the same problem. If I add something like : Code:
volScalarField phiEp1 // construct your field first and then pass it to the function. ( fvc::reconstructMag(phiEp) // fvc::reconstruct(surfScaField) ); this  fvm::SuSp(A,phiEp1) compiles without errors but when it is applied to my test cases, I have the following error: Code:
> FOAM FATAL ERROR: incompatible fields for operation [rhoE] == [reconstruct(phiEp)] With your comment, I conclude that I should do something like :  fvm::SuSp(A*something,rhoE) However, this is not straightforward. We might need something like Code:
fvm::SuSp(A,rhoE)+ fvc::reconstructMag(phiEp*fvc::interpolate(A)) fvm::SuSp(A,rhoE) Which could be shortened to what I had before fvc::reconstructMag(phiEp*fvc::interpolate(A)). However, my purpose is to use fvm::SuSp to see if the stability problem could be solved. Do you have any idea how to treat this issue ? Best regards, Mary 

July 1, 2019, 08:26 

#14 
Senior Member

Hi Mary,
I'm not familiar with the rhoCentralFoam or other compressible solvers. So, I don't understand physics, just looking the code... If what you want to add is A*phiEp, then I guess the addition of something like the following will be work. Here, phiv is something similar to phiv_pos or phiv_neg. (or phiEp / rhoE) Code:
+fvm::SuSp(fvc::reconstructMag(phiv*fvc::interpolate(A)), rhoE) This will not be an exact expression. 

July 1, 2019, 11:19 

#15  
Member
K
Join Date: Jul 2017
Posts: 97
Rep Power: 8 
Quote:


Tags 
fvm::susp, implicit/explicit, sources 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
RP_Set_Integer does not work in parallel  86lolo  Fluent UDF and Scheme Programming  2  July 3, 2014 11:37 
Does CX_Interpret_String work in parallel?  86lolo  Fluent UDF and Scheme Programming  2  June 30, 2014 04:36 
Companies that lease software & hardware for cloudbased work?  Catthan  ANSYS  0  June 18, 2014 10:53 
Why do the Plant library cases don't work?  Alumna  Phoenics  6  June 22, 2004 12:08 
why my InForm doesn't work?  green  Phoenics  2  May 27, 2004 21:03 