CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   automatic change of advetion scheme (blend factor) (https://www.cfd-online.com/Forums/cfx/20660-automatic-change-advetion-scheme-blend-factor.html)

Ben September 21, 2004 03:28

automatic change of advetion scheme (blend factor)
 
hello everybody

my problem discribtion: I would like to do a simulation during the night (or weekend). I want to start the calculation with a low "Blend Factor" and after 30-50 time steps change to a higher "Blend Factor". now my question: is there a possiblity to change this factor automaticly after a specified amount of steps or reaching a predefined convergence level?

Thanks for your help in advance

greets

Ben

Glenn Horrocks September 21, 2004 19:23

Re: automatic change of advetion scheme (blend fac
 
Hi Ben,

You can always do this with two simulations, with the second simulation using the first as an initial condition. This can be automated with a batch file or script file.

Glenn Horrocks

Ben September 23, 2004 03:09

Re: automatic change of advetion scheme (blend fac
 
Hi Glen,

thanks for your reply. I thought there is an other way to change the advection scheme during the run.. Do you know whether the value of the blend factor is changeable during run by using CCL?

greets

Ben

Robin September 23, 2004 15:21

Re: automatic change of advetion scheme (blend fac
 
Hi Ben,

You can specify your blend factor as a CEL expression. As an expression, in this case, it must return a single value. To make it change during the run, make it a function of the absolute iteration number, 'aitern', or the current iteration number, 'citern'.

I suggest creating a 1D interpolation function, entering coordinate values equal to the iteration number and variable equal to the blend factor. If, for instance, you want the blend factor to be 0.5 from iteration 1 to 50, then increase to .9 between 51 and 60, enter the following data pairs:
50 0.5
60 0.9



When you define the linear interpolation function, make sure you check the extend min and extend max options. This will cause it to evaluate to 0.5 if below iteration 50 and 0.9 if above 60. A linear interpolation will be used to evaluate the blend factor between 50 and 60.

Regards,
Robin

Robin September 23, 2004 15:44

Re: automatic change of advetion scheme (blend fac
 
Actually, there is a bit more to it. First, here is the resulting CCL for the function and the Solver Control object:

LIBRARY:
CEL:
FUNCTION: blendFactor
Argument Units = []
Option = Interpolation
Profile Function = Off
Result Units = []
INTERPOLATION DATA:
Data Pairs = 50,0.5,60,0.9
Extend Max = On
Extend Min = On
Option = One Dimensional
END
END
END
END

FLOW:
SOLVER CONTROL:
ADVECTION SCHEME:
Blend Factor = blendFactor(aitern)
Option = Specified Blend Factor
END
END
END

Pre will give you an error about the solver control object, just ignore it.

Now, normally you cannot do this since the solver does not allow the blend factor to be a function of iteration number. To make it work, you will have to use a local RULES file. Create a local copy of <CFXROOT>/etc/RULES and open it in an editor (do not edit the original). Find the Blend Factor parameter object and add the 'Dependancy List' parameter, as shown below:

PARAMETER: Blend Factor
Description = Specifies the blend between pure UDS (0.0) and \
second order (1.0) discretisation.
Solver Name = BETA
Parameter Type = Real
Quantity Type = Dimensionless
Dynamic Reread Item = Yes
Default = 1.0
Lower Bound = 0.0
Upper Bound = 1.0
## Add this:
Dependency List = aitern, citern
END
To use the local RULES file for your run, add a '-ccl RULES' flag to your solver arguments. You can do this from the command line, or from the Solver tab in the Define Run dialog. From the command line it would look like this:

cfx5solve -def muRun.def -ccl RULES

If you saved the RULES file to another directory, include the appropriate path.

Best of luck.

Regards,
Robin

Jeff September 26, 2004 12:51

Re: automatic change of advetion scheme (blend fac
 
....or....

For a simple step change your could use the following CEL:

sw_pt = 50 # switch blend factors at iter. 50 bf1 = 0.25 # initial blend factor bf2 = 0.75 # second blend factor bf = step(sw_pt-citern)*bf1 + step(citern-sw_pt)*bf2

The first step fuction is 1 if current iteration number (citern) > sw_pt (50) and 0 after. The second step function is reversed. On exactly 50, you get half of each (0.5).

Then plug bf in for your blend factor on the solver form. A more complicated ramp function could also be implemented with a little more effort.

Jeff

Robin September 28, 2004 11:32

Re: automatic change of advetion scheme (blend fac
 
I would argue that a linear interpolation is easier to set up than a step function, but this could be done as well.

-Robin


All times are GMT -4. The time now is 21:26.