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

Strange behaviour - custom boundary condition runs many times in 1 timestep

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2022, 20:34
Default Strange behaviour - custom boundary condition runs many times in 1 timestep
  #1
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 400
Rep Power: 19
quarkz is on a distinguished road
Hi,

I tried to create a boundary incoming U boundary condition to change its value at each timestep. I tried using codedFixedValue and now also high lvl programming.

I tried to print some variables such as U, time for debugging purpose but I realised somethings strange - the U velocity is changed twice in 1 timestep when running simpleFoam. Moreover, if pimpleFoam is used, it runs even more -> twice within each pimpleFoam iteration.

My code is

Code:
inlet
    {
		type            codedFixedValue;
		value           $internalField;
		name    u_6dof_change;
		code
		#{
		
			scalar cur_incoming_vel;
			
			
			const fvPatch& boundaryPatch = patch(); 
			vectorField& field = *this;
		
			forAll(boundaryPatch, faceI) {
				
				field[faceI] =  field[faceI] + vector(1., 0,0);
	   
				cur_incoming_vel = field[faceI].component(vector::X);
				
			}
	   
			Info << "current incoming velocity = " << cur_incoming_vel << endl;
		   
			
	   #};
From simpleFoam

Code:
Starting time loop

Time = 0.0001

current incoming velocity = 2
smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 6.81739e-09, No Iterations 18
smoothSolver:  Solving for Uy, Initial residual = 1, Final residual = 7.71109e-09, No Iterations 16
GAMG:  Solving for p, Initial residual = 1, Final residual = 0.00713548, No Iterations 11
time step continuity errors : sum local = 2.62419e-08, global = -1.09807e-09, cumulative = -1.09807e-09
current incoming velocity = 3
current incoming velocity = 4
ExecutionTime = 0.14 s  ClockTime = 0 s

Time = 0.0002

smoothSolver:  Solving for Ux, Initial residual = 0.478384, Final residual = 3.57783e-09, No Iterations 18
smoothSolver:  Solving for Uy, Initial residual = 0.37882, Final residual = 9.38104e-09, No Iterations 16
GAMG:  Solving for p, Initial residual = 0.104267, Final residual = 0.0010176, No Iterations 10
time step continuity errors : sum local = 1.40033e-07, global = -2.25939e-08, cumulative = -2.3692e-08
current incoming velocity = 5
current incoming velocity = 6
ExecutionTime = 0.17 s  ClockTime = 0 s

Time = 0.0003
Why is this so? I only want it to run once per time step. How can I prevent this from happening?
quarkz is offline   Reply With Quote

Old   May 19, 2022, 00:44
Default
  #2
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 400
Rep Power: 19
quarkz is on a distinguished road
Hi,

I finally realised why this is happening. It turns that that it is due to:

Code:
moveMeshOuterCorrectors yes
in the fvSolution file.

When this is specified, this will update the mesh every single outer iteration of the PIMPLE loop (with iterative marching enabled). For moving bodies, you can use the option moveMeshOuterCorrectors yes to gain more stability. This is reported in : http://www.wolfdynamics.com/training...s_2021_OF8.pdf
quarkz 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
Fatal overflow in linear solver. iamnotfajar CFX 9 October 28, 2020 04:47
Wind turbine simulation Saturn CFX 58 July 3, 2020 01:13
Centrifugal fan-reverse flow in outlet lesds to a mass in flow field xiexing CFX 3 March 29, 2017 10:00
strange pressure behaviour with symmetricPlane boudary condition - interFoam duongquaphim OpenFOAM Running, Solving & CFD 10 August 20, 2013 14:00
External Radiation Boundary Condition (Two sided wall), Grid Interface CFD XUE FLUENT 0 July 8, 2010 06:49


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