|
[Sponsors] |
How to assign a value for a boundary patch inside createFields.H |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 27, 2016, 18:08 |
How to assign a value for a boundary patch inside createFields.H
|
#1 |
Senior Member
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 16 |
Dear Fellows
I have defined an internal variable in createFields.H file that has non-zero value only on one boundary patch. I want to assign that value to my variable (rhoE) inside createFields.H file. I have written the following snippet for this end: Code:
label patchID= mesh.boundaryMesh().findPatchID ("middown"); forAll(rhoE.boundaryField(), i) { if (mesh.boundaryMesh().name() == patchID) { rhoE.boundaryField()[i]= 21.79; } else { rhoE.boundaryField()[i]= 0; } } Would some body hint me how can I do this or where did I make a mistake? Regards |
|
August 27, 2016, 19:48 |
|
#2 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21 |
Code:
const word& boundName = "middown"; forAll(rhoE.boundaryField(), i) { fvPatchScalarField& rhoEpatchField = rhoE.boundaryField()[i]; if (rhoEpatchField.patch().name() == boundName) { rhoEpatchField = 21.79; } else { rhoEpatchField = 0; } } |
|
August 27, 2016, 20:06 |
|
#3 |
Senior Member
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 16 |
Thanks sergei
I will try your snippet and give feedback soon. It works sergei. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wind turbine simulation | Saturn | CFX | 60 | July 17, 2024 06:45 |
Radiation in semi-transparent media with surface-to-surface model? | mpeppels | CFX | 11 | August 22, 2019 08:30 |
Radiation interface | hinca | CFX | 15 | January 26, 2014 18:11 |
An error has occurred in cfx5solve: | volo87 | CFX | 5 | June 14, 2013 18:44 |
RPM in Wind Turbine | Pankaj | CFX | 9 | November 23, 2009 05:05 |