|
[Sponsors] |
September 24, 2019, 14:33 |
Implementing boundary condition locally
|
#1 |
Member
Join Date: Feb 2018
Posts: 91
Rep Power: 8 |
Hi,
Hopefully I can make this question easy to understand. I want to implement a boundary condition but I want to do it locally, meaning i would like to implement it on a cell-by-cell basis. I believe that I have to loop through the cells in order to implement the boundary condition. So far what I have is this: Code:
forAll(patch(),facei) { label celli = patch().faceCells()[facei]; scalar mflux[celli] = {0}; mflux[celli] += hm*(((avgPatch*WF)/(R*avgTs))*(log((avgYfg-1)/(XFl-1)))); Info<<"mass flux is=" <<mflux<<nl<<endl; scalar avgU[celli] = {0}; avgU[celli] = mflux[celli]/avgRhocomp; Info<< "avgU="<< avgU<<nl<<endl; // tmp<vectorField> n = patch().nf(); vectorField n = patch().nf(); Info<< "n = " << n <<nl << endl; Info<< "patchName"<< patch().name()<<nl<<endl; operator==(n*avgU[celli]); fixedValueFvPatchField<vector>::updateCoeffs(); } Thanks |
|
September 24, 2019, 15:27 |
|
#2 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13 |
scalar mflux[celli] = {0};
scalar avgU[celli] = {0}; scalar type is not a vector type, so you cant use [] operator. {} initialization and = operator: you cant use both of them. i dont think this can compile operator==(n*avgU[celli]);
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
September 26, 2019, 14:41 |
|
#3 | |
Member
Join Date: Feb 2018
Posts: 91
Rep Power: 8 |
Quote:
I am not very experienced with the C++ code but from your reply I have a couple of questions: -First of all, I was able to compile the code like I said earlier but I get a value of 1 for mflux and avgU every iteration. - What operator am I meant to use then because I believe what am defining is an array containing the number of cells in the patch. - How do I initialize the array then. Regards |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wind turbine simulation | Saturn | CFX | 60 | July 17, 2024 06:45 |
Basic Nozzle-Expander Design | karmavatar | CFX | 20 | March 20, 2016 09:44 |
Trouble in implementing Boundary condition in OF | nandiganavishal | OpenFOAM Running, Solving & CFD | 0 | March 22, 2013 15:06 |
inlet velocity boundary condition | murali | CFX | 5 | August 3, 2012 09:56 |
External Radiation Boundary Condition (Two sided wall), Grid Interface | CFD XUE | FLUENT | 0 | July 8, 2010 07:49 |