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

How to modify gradient specification for fixedGradient b.c. during simulation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 6, 2017, 12:48
Default How to modify gradient specification for fixedGradient b.c. during simulation
  #1
New Member
 
Join Date: Aug 2016
Posts: 19
Rep Power: 10
mtgoncalves is on a distinguished road
I want to modify boundary conditions during a simulation from inside a custom solver (derived from pimpleFoam) without creating my own custom boundary condition type.

So far I have been successful for fixedValue boundary conditions. I managed this by using, for example

Code:
type fixedValue;
value uniform (0 0 0);
in the 0/U file. Then, during the simulation I modify the boundary values from inside my custom solver using

Code:
int index = 0;

forAll( U.boundaryFieldRef()[boundary_label(patchName)], i )
{
    for ( int j = 0; j < 3; j++ )
    {
        U.boundaryFieldRef()[boundary_label(patchName)][i][j] = velocityBC[index];
        index++;
    }
}
Thus, for a fixedValue b.c. I managed to modify the specification of "value". How can I do the same for the specification of "gradient" for a fixedGradient b.c.?
mtgoncalves is offline   Reply With Quote

Old   June 30, 2020, 08:57
Default
  #2
RGS
Member
 
Rohit George Sebastian
Join Date: May 2017
Posts: 42
Rep Power: 9
RGS is on a distinguished road
Quote:
Originally Posted by mtgoncalves View Post
I want to modify boundary conditions during a simulation from inside a custom solver (derived from pimpleFoam) without creating my own custom boundary condition type.

So far I have been successful for fixedValue boundary conditions. I managed this by using, for example

Code:
type fixedValue;
value uniform (0 0 0);
in the 0/U file. Then, during the simulation I modify the boundary values from inside my custom solver using

Code:
int index = 0;

forAll( U.boundaryFieldRef()[boundary_label(patchName)], i )
{
    for ( int j = 0; j < 3; j++ )
    {
        U.boundaryFieldRef()[boundary_label(patchName)][i][j] = velocityBC[index];
        index++;
    }
}
Thus, for a fixedValue b.c. I managed to modify the specification of "value". How can I do the same for the specification of "gradient" for a fixedGradient b.c.?



Hi,

Did you manage to figure out how to do this? I am trying to do something similar.


Thanks!
RGS is offline   Reply With Quote

Reply

Tags
boundaries condition, boundary variable, time vayring bc


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
Boundary condition setting regarding turbine simulation using CFX Lacerlacer CFX 11 March 12, 2012 10:32
Setting of gradient type B.C. in Phoenics black_spider Phoenics 2 May 4, 2011 08:16
Question) fan simulation & B.C Serazio FLUENT 0 February 7, 2011 14:27
Pressure gradient in particle simulation Mikka Main CFD Forum 0 August 5, 2007 22:55
Pressure gradient in particle simulation Mikka Main CFD Forum 0 June 30, 2007 23:16


All times are GMT -4. The time now is 17:39.