|
[Sponsors] |
How to add a source term which depends on position using codedSource |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 9, 2022, 14:22 |
How to add a source term which depends on position using codedSource
|
#1 |
New Member
manou mouna
Join Date: Jan 2022
Posts: 7
Rep Power: 4 |
Hi Openfoamers, I published my problem on the forum a few days ago but I did not receive any help. I want to explain more my case, I am working on laminar flow in a cylindrical tube using simpleFoam solver. I use water as a fluid, in my experimental work, I applied an ultrasonic wave to the flow of the fluid in the tube, this wave will generate a volumetric force which will influence the speed of the flow. I calculated the values of this force in each points of my mesh using a matlab code and I would now like to introduce only a value of this force in its point in openfoam as a constant source term in the z direction in order to study its effect on flow velocity. I am beginner on openfoam and I know that fvOptions allows me to add uniform source term which depends on position and according to UserGuide on codedSource I try to create the code below and use vectorCodedSource, the code it works but the solution doesn't converge and the results don't make sense, I reach huge speed values. how can I correct my code please? The force unit is m.s-2 (F/rho*Volume), I want to know how I can set the force unit in the code? I use openFoam 4.1
I hope to find help regards volumetricForce { type vectorCodedSource; active on; name volumetricForce; vectorCodedSourceCoeffs { fields (U); selectionMode points; points ( (0 0 0) ); codeInclude #{ #}; codeCorrect #{ Pout<< "**codeCorrect**" << endl; #}; codeAddSup #{ vectorField& USource = eqn.source(); const scalarField& V = mesh_.V(); vector const F (0,0,0.804); USource -= F; #}; codeSetValue #{ Pout<< "**codeSetValue**" << endl; #}; code #{ $codeInclude $codeCorrect $codeAddSup $codeSetValue #}; } sourceTimeCoeffs { } Last edited by Manouu; February 9, 2022 at 14:56. Reason: I want more detailed title |
|
June 25, 2022, 10:28 |
|
#2 | |
Member
Mahmoud
Join Date: Nov 2020
Location: United Kingdom
Posts: 43
Rep Power: 6 |
Quote:
are you going to add the F values to all cells, like gravity, or just a specific cell? |
||
June 27, 2022, 05:42 |
|
#3 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
The soon-to-been-released OpenFOAM-v2206 will support volume expressions for source terms, which means that you should be able to shape the selection a bit more precisely.
Otherwise you will probably need to preselect cells as a cellSet and restrict your sources to them. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[openSmoke] LaminarSMOKE compilation error | mdhfiz | OpenFOAM Community Contributions | 8 | July 2, 2024 11:32 |
[Other] Tabulated thermophysicalProperties library | chriss85 | OpenFOAM Community Contributions | 62 | October 2, 2022 04:50 |
Source term for EVAPORATION in Energy Equ. - technical difficulty ? | Kummi | OpenFOAM | 1 | September 9, 2019 10:32 |
polynomial BC | srv537 | OpenFOAM Pre-Processing | 4 | December 3, 2016 10:07 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 02:24 |