quarkz |
March 26, 2022 20:34 |
Strange behaviour - custom boundary condition runs many times in 1 timestep
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?
|