|
[Sponsors] |
August 31, 2020, 06:38 |
help needed in codedSource
|
#1 |
Senior Member
KGN
Join Date: Oct 2009
Location: Chennai, India
Posts: 121
Rep Power: 17 |
HI all,
Objective of my work is to replace the effusion holes with source and sink terms (mass, momentum and energy). For this I found out "codedSource" fvOptions is the best way. I need help in calculating MFR at sink location and apply the same in source and sink locations. Code:
massSourceEffusionHole { type scalarCodedSource; name sourceTime; active true; scalarCodedSourceCoeffs { fields (rho); selectionMode points; points //sink location ( (0.035 0.034 0.0) ); codeInclude #{ #}; codeCorrect #{ #}; codeAddSup #{ const Time& time1 = mesh().time(); const volScalarField& rhoJet = mesh_.lookupObject<volScalarField>("rho"); const volVectorField& velJet = mesh_.lookupObject<volVectorField>("U"); scalarField& massSource1 = eqn.source(); const labelList& cellIDs = cells(); forAll(cellIDs, i) { label cellI = cellIDs[i]; massSource1[cellI] = rhoJet[cellI]*mag(velJet[cellI])*6.28319*1e-6; } #}; codeSetValue #{ #} // Dummy entry. Make dependent on above to trigger recompilation code #{ $codeInclude $codeCorrect $codeAddSup $codeSetValue #}; } sourceTimeCoeffs { $scalarCodedSourceCoeffs; } } I need help in applying the MFR calculated at "sink" location to "source" location i.e. (0.0385 0.0365 0.0) FYI sink location (0.035 0.034 0.0) source location (0.0385 0.0365 0.0) Thanks KGN |
|
September 2, 2020, 19:11 |
|
#2 |
Member
alexander thierfelder
Join Date: Dec 2019
Posts: 71
Rep Power: 6 |
http://www.cfd-online.com/Forums/ope...at-source.html
Does that maybe help? I dont know at which point exactly your problem is. Is the problem to find the right cells at those locations? Then you can use some of the code I posted. |
|
September 2, 2020, 23:28 |
|
#3 |
Senior Member
KGN
Join Date: Oct 2009
Location: Chennai, India
Posts: 121
Rep Power: 17 |
Thanks for the reply. I actually referred your post.
Let me explain my problem in detail. Objective of my work is to replace small diameter pipe (dia <0.5 mm) with source and sink terms i.e. inlet of the pipe will be sink and outlet of the pipe is source. I have to use pressure drop across the pipe to calculate the mass flow rate; for this i need to get pressure at inlet and exit of the pipe.
Code:
codeAddSup #{ const volScalarField& rhoJet = mesh_.lookupObject<volScalarField>("rho"); const volVectorField& velJet = mesh_.lookupObject<volVectorField>("v1"); scalarField& massSource1 = eqn.source(); const labelList& cellIDs = cells(); forAll(cellIDs, i) { label cellSource = cellIDs[i]; massSource1[cellSource] += rhoJet[cellSink]*mag(velJet[cellSink])*6.28319*1e-6; } #}; hope this explains my problem |
|
September 9, 2020, 08:00 |
|
#4 |
Member
alexander thierfelder
Join Date: Dec 2019
Posts: 71
Rep Power: 6 |
Maybe you better use two new boundary patches and there use custom coded bc since you do not have a wall at inlet and outlet of this channel.
|
|
September 10, 2020, 07:35 |
|
#5 |
Senior Member
KGN
Join Date: Oct 2009
Location: Chennai, India
Posts: 121
Rep Power: 17 |
could you please elaborate your answer?
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[waves2Foam] Waves2Foam Related Topics | ngj | OpenFOAM Community Contributions | 660 | August 20, 2018 13:39 |
Running UDF with Supercomputer | roi247 | FLUENT | 4 | October 15, 2015 14:41 |
[OpenFOAM.org] OpenFOAM 2.1.1 installation on openSUSE 12.2 32 bit | saturn_53 | OpenFOAM Installation | 13 | February 1, 2015 05:17 |
[swak4Foam] Installing swak4Foam to OpenFOAM in mac | Kaquesang | OpenFOAM Community Contributions | 22 | January 21, 2013 12:51 |
compiling firefoam | Farshad_Noravesh | OpenFOAM | 27 | December 24, 2012 05:21 |