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

Change Boundary Condition Type From Solver

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 8, 2021, 02:59
Question Change Boundary Condition Type From Solver
  #1
New Member
 
Join Date: Feb 2021
Posts: 2
Rep Power: 0
Daveed is on a distinguished road
Hi guys. I want to change boundary condition type within the solver. how can I do it. for example initially Pressure boundary condition on a patch is fixedFluxPressure and I want when I reach certain time during simulation, change it to fixed value with specified value. (I want to do this from solver)

boundaryField
{
Left
{
type fixedFluxPressure;
}

.
.// other BCs
.

}


then change it to :

boundaryField
{
Left
{
type fixedValue;
value 1e5;
}

.
.// other BCs
.

}
Daveed is offline   Reply With Quote

Old   February 8, 2021, 05:16
Talking I found it!
  #2
New Member
 
Join Date: Feb 2021
Posts: 2
Rep Power: 0
Daveed is on a distinguished road
finally i found it and i leave this reply to my post maybe help another one with this issue some days later.

to change boundary condition type for a field, first you must find patch id of that face.

label leftFacePatchID = mesh.boundaryMesh().findPatchID("Left");
const polyPatch& leftPatch = mesh.boundaryMesh()[leftFacePatchID];

then you can set boundary type with this syntax: (for example if pressure is desired field with p notation)

p.boundaryFieldRef().set(leftFacePatchID , fvPatchField<scalar>::New("fixedValue", mesh.boundary()[leftFacePatchID ],p));

in above, first argument of New() must be boundary type, and for example here it sets BC to fixedValue.
then to assign a value to this fixed value BC, we must go through all cells face in patch and set desired value.

forAll(leftPatch , faceI)
{
p.boundaryFieldRef()[leftFacePatchID][faceI] = pressureValue;
}
Daveed is offline   Reply With Quote

Reply

Tags
boundary condition, cfd, solver

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 07:30
My radial inflow turbine Abo Anas CFX 27 May 11, 2018 01:44
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 05:15
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28
[swak4Foam] Air Conditioned room groovyBC Sebaj OpenFOAM Community Contributions 7 October 31, 2012 14:16


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