|
[Sponsors] |
April 26, 2017, 06:21 |
codedMixed instead of groovyBC
|
#1 |
New Member
Hans
Join Date: Sep 2016
Posts: 8
Rep Power: 10 |
Dear OpenFoamers,
since i am working with OpenFoam 4.1 i wanted to use the boundary condition codedMixed instead of groovyBC. I want to get access of the temperature from an outlet patch and use this temperature to calculate a new one for an inlet BC. With groovyBC i got easy access of the temperature from the outlet and safed it in a variable tOutlet: 0/T file: Code:
... inlet {... variables "tOutlet{outlet}=average(T);"; ...} i think i have to read at first the mesh field, then extract the temperature values from the right patch?! But the following code just accesses the patchfield from the actual patch and not from the one i want?! I never programmed in OpenFoam before in C++ so i would be really thankful for any hints! Code:
... code #{ const fv.mesh& mesh = patch().boundaryMesh().mesh(); const volScalarField& tOutlet = mesh.lookupObject<volScalarField>("T"); #}; GerHan |
|
May 2, 2018, 12:02 |
|
#2 |
Senior Member
Alejandro
Join Date: Jan 2014
Location: Argentina
Posts: 128
Rep Power: 12 |
try with
Code:
code #{ const fvPatch& p = this->patch(); // Actual boundary/patch label outletPatchID = p.patch().boundaryMesh().findPatchID("outlet"); // Desired patch ID const fvPatch& outletPatch = p.boundaryMesh()[outletPatchID]; // Desired patch const volScalarField& tOutlet = this->db().objectRegistry::template lookupObject<volScalarField>("T"); // Desired field 1 const scalarField& outletPatchField = tOutlet.boundaryField()[outletPatchID];// Desired field on desired patch ... #}; |
|
September 12, 2018, 12:05 |
codedMixed
|
#3 |
New Member
Alireza Jafarinia
Join Date: Jun 2018
Location: Austria
Posts: 6
Rep Power: 8 |
Hello,
I am implementing a codedmixed BC. My problem is unsteady and I have 7 scalar transport equations. (I have 7 codedMixed Bcs) I have some questions about the dynamic code and how it is linked to the code in each time step. Please let me know what you think. Thanks in advance. 1- Are the boundary conditions set at the beginning of each time step? This is important for me because in my boundary conditions I need to use the value of the volScalarField at the boundary; I dont want when I solve the first transport equation, the values of that scalar at the boundary changes in the current time step. I mean I want that boundary conditions be constant at each time step and use the values of scalars from the previous time step. That is why I want the boundary condition to be set at the beginning of each time step. 2- I define the same variables for each scalar boundary condition (here like S_lowerWall, RP_lowerWall , …); so the question id that is the code mixing them up or they are completely separate? This is an example of boundary condition for RP (volScalarField). I have 7 BCs like this and they are similar and as I said the name of variables are the same. Ap is also a volScalarField. lowerWall { type codedMixed; refValue uniform 0; refGradient uniform 0; valueFraction uniform 0; name RP_flux; code #{ const fvMesh& mesh = patch().boundaryMesh().mesh(); label lowerWallID = mesh.boundaryMesh().findPatchID(“lowerWall”); const volScalarField& RP = db().lookupObject(“RP”); const volScalarField& AP = db().lookupObject(“AP”); scalarList RP_lowerWall = RP.boundaryField()[lowerWallID]; scalarList AP_lowerWall = AP.boundaryField()[lowerWallID]; const dictionary& diffusionProperties = db().lookupObject ( “diffusionProperties” ); const dictionary& reactionProperties = db().lookupObject ( “reactionProperties” ); const dimensionedScalar& D_RP = diffusionProperties.lookup(“D_RP”); const dimensionedScalar& M_inf = reactionProperties.lookup(“M_inf”); const dimensionedScalar& K_pa = reactionProperties.lookup(“K_pa”); const dimensionedScalar& K_rs = reactionProperties.lookup(“K_rs”); const dimensionedScalar& K_as = reactionProperties.lookup(“K_as”); scalarList S_lowerWall = Foam::exp(-((K_rs.value()RP_lowerWall+K_as.value()AP_lowerWal l)/M_inf.value())*this->db().time().value()); this->refGrad() = (K_rs.value()RP_lowerWallS_lowerWall)/(D_RP.value()); #}; |
|
February 20, 2019, 12:08 |
|
#4 | |
Senior Member
Alejandro
Join Date: Jan 2014
Location: Argentina
Posts: 128
Rep Power: 12 |
Quote:
2- I do not understand the second question. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] groovyBC for oscillatory flow | liybzd | OpenFOAM Community Contributions | 5 | November 12, 2018 08:53 |
[swak4Foam] reactingMultiPhaseEulerFoam problems with groovyBC | zanilu70 | OpenFOAM Community Contributions | 4 | December 13, 2016 07:46 |
[swak4Foam] Change in alpha and U with groovyBC in twoPhaseEulerFoam | dani2702 | OpenFOAM Community Contributions | 0 | November 17, 2016 04:30 |
[swak4Foam] groovyBC issue - k and epsilon | sagnikmazumdar | OpenFOAM Community Contributions | 24 | March 1, 2015 08:16 |
[swak4Foam] groovyBC and Eqn.setReference() | benk | OpenFOAM Community Contributions | 3 | June 2, 2011 09:49 |