CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Implementing boundary condition locally

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 24, 2019, 14:33
Default Implementing boundary condition locally
  #1
Member
 
Join Date: Feb 2018
Posts: 91
Rep Power: 8
charles4allme is on a distinguished road
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();
    }
The values used to calculate mflux are scalar values that was defined before the loop. When i run the code I get value of 1 every iteration. I was wondering if anyone could advise me on what am doing wrong.

Thanks
charles4allme is offline   Reply With Quote

Old   September 24, 2019, 15:27
Default
  #2
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
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]);
HPE is offline   Reply With Quote

Old   September 26, 2019, 14:41
Default
  #3
Member
 
Join Date: Feb 2018
Posts: 91
Rep Power: 8
charles4allme is on a distinguished road
Quote:
Originally Posted by HPE View Post
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]);
Hi HPE,

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
charles4allme is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 21:02.