CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Hybrid discretisation - blend factor

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 21, 2016, 06:31
Default Hybrid discretisation - blend factor
  #1
New Member
 
Join Date: Apr 2016
Posts: 16
Rep Power: 6
gcoopermax is on a distinguished road
Hi,

I was wondering if there is any way to find what blend factor the solver is using while solving for the hybrid discretisation scheme? I have specified the blending factor as a function of aitern and stepping it up as the iterations progress to get the solution closer to second order accurate as it progresses, and also have added dependency of Blend Factor on aitern in RULES file. I had to suppress the warning in CFX Pre that the blend factor can't be a function of variable etc so the def file can generate.

In monitor plots, I see the expression for blend factor change with iterations as desired, but is there any way to find out whether the solver is indeed taking these values for blend factor? Alternatively, is there any easier way to achieve this?

Thanks
gcoopermax is offline   Reply With Quote

Old   September 21, 2016, 07:36
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 16,466
Rep Power: 128
ghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the rough
Be careful suppressing warnings. They are there for a reason - have you checked it is working correctly even though the warning is present (until you suppress it that is).

The best way to do this is to send your function you set the blend factor to as a CEL expression, then make a monitor point set to that expression. Then you will be able to view the function as the simulation progresses in solver manager.
ghorrocks is offline   Reply With Quote

Old   September 21, 2016, 07:57
Default
  #3
New Member
 
Join Date: Apr 2016
Posts: 16
Rep Power: 6
gcoopermax is on a distinguished road
Hi Glenn,
The warning is given because CFX doesn't allow the variables to be used in expression for Blend Factor. Until this warning is addressed (either by correcting it or suppressing it) I can't run the solution (perhaps def file is generated only after the warnings are addressed).

I have created following variable with expression:
bf=0.1*step(5-aitern)+0.3*step(10-aitern)*step(aitern-5)+0.5*step(15-aitern)*step(aitern-10)+0.75*step(aitern-15)

..and specified Blend Factor as "bf"

The monitor plots of this expression do show bf stepping up after each 5 iterations from 0.1 to 0.3 to 0.5... so it works.

To force solver to assign "bf" to Blending Factor, the following dependency was added in RULES file.

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
Dependency List = aitern #New line added in RULES file
END

"Edit run in progress" shows value of Blend Factor as "bf" and simulation continues flawlessly. But then, how to make sure if solver indeed is assigning value of bf to Blending Factor?

I tried putting value of 2 after 15 iterations, hoping the solver will give error because 2 is beyond the bounds of 0 and 1, but nothing happened. Perhaps the solver discarded value of 2 and used 1, making it a second order scheme? I wish there were a way to know what value of Blend Factor it is using...
gcoopermax is offline   Reply With Quote

Old   September 21, 2016, 08:21
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 16,466
Rep Power: 128
ghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the rough
There is no way of getting the actual blend factor it is using to my knowledge. I share your concern that it is not actually updating the blend factor at all - I suspect that is why the blend factor must be a constant.

The only way I can suggest to tell if it actually changes the value is to do a simulation with blend factor =0 and another with blend factor =1.0, then a third one which changes the blend factor from 0 to 1.0. This will allow you to check that the bf=0 and 1 simulations are actually different, and then whether your variable blend factor is actually working.

Note that this whole thing is unnecessary - you can achieve the same thing using "Edit run in progress", or by stopping and restarting the run with a new blend factor. Both of these approaches are fully supported should work fine. They can also be scripted if you want automation.
ghorrocks is offline   Reply With Quote

Old   September 22, 2016, 08:42
Default
  #5
New Member
 
Join Date: Apr 2016
Posts: 16
Rep Power: 6
gcoopermax is on a distinguished road
Thanks Glenn, you made a good point. I modelled a simple axisymmetric wedge of stepped cylinder and had results with first and second order (0 and 1 factor) as a reference. Then I prescribed the value of bf to Blend Factor and stepped it to 1 after 15 iterations. But the results resembled to that of first order scheme, with jet spreading out at a shorter distance than second order scheme due to added diffusion of first order. Next I tried a 1D interpolation function instead of expression to specify Blend Factor as bf(aitern), yet no luck. Lastly, I ran CFX through command line with cfx5solve -def wedge.def -ccl RULES, but the result was same. So if CFX solver doesn't like the forced value of Blend Factor, it keeps it as 0.

I was hoping to make it work to run overnight simulations without needing an intervention. This can of course be automated through scripting but I wanted to keep life simpler
gcoopermax is offline   Reply With Quote

Old   September 23, 2016, 09:05
Default
  #6
New Member
 
Join Date: Apr 2016
Posts: 16
Rep Power: 6
gcoopermax is on a distinguished road
Hi Glenn,

My scripting is still at nascent stage but I created an external Perl script to automate bf. Here subsequent runs are initialised with results of prior run with a new bf using the ccls "printed" by the Perl script in foreach loop. Results of run3_001.res file (which uses Blend Factor 1) shows the profile matching a second order solution so this approach works.

Code:
### Simple script to run the simulation with increasing Blend Factor###

#Set up a hash for the name, Blend Factor and initialisation file for each run

%run1= (NAME => "run1", ITER=>5, BF => 0, INIT => "");
%run2= (NAME => "run2", ITER=>10, BF => 0.5, INIT => "run1_001.res");
%run3= (NAME => "run3", ITER=>300, BF => 1, INIT => "run2_001.res");

# Create a list of references to the runs

@runList = (\%run1, \%run2, \%run3);


#loop over the list

foreach $run (@runList) {
  $name = $run->{NAME};
  $iterations = $run->{ITER}
  $BlendFactor = $run->{BF};
  $initFile = $run->{INIT};

# Initialising with appropriate file
  if (! -r $initFile) {
    print "Warning: Initial conditions file $initFile not found for run $name.\n";
    print "   Proceeding with default initial conditions\n";
    $initCmd = "";
  } else {
    $initCmd = "-ini $initFile";
  } 
#Open the solver to accept some CCL from STDIN

  open(SOLVER,"|cfx5solve -def stepped_cyinder.def -name $name $initCmd -par-local -part 2 -ccl -");
  
   
# Send off the CCL to modify the BC


    print SOLVER "FLOW: Flow Analysis 1\n";
    print SOLVER "  SOLVER CONTROL:\n";
    print SOLVER "    Turbulence Numerics = High Resolution\n";
    print SOLVER "    ADVECTION SCHEME:\n";
    print SOLVER "      Blend Factor = $BlendFactor\n";
    print SOLVER "      Option = Specified Blend Factor\n";
    print SOLVER "    END\n";
    print SOLVER "    CONVERGENCE CONTROL:\n";
    print SOLVER "      Length Scale Option = Conservative\n";
    print SOLVER "      Maximum Number of Iterations = $iterations\n";
    print SOLVER "      Minimum Number of Iterations = 1\n";
    print SOLVER "      Timescale Control = Auto Timescale\n";
    print SOLVER "      Timescale Factor = 1.0\n";
    print SOLVER "    END\n";
    print SOLVER "    CONVERGENCE CRITERIA:\n";
    print SOLVER "      Residual Target = 1.E-4\n";
    print SOLVER "      Residual Type = RMS\n";
    print SOLVER "    END\n";
    print SOLVER "    DYNAMIC MODEL CONTROL:\n";
    print SOLVER "      Global Dynamic Model Control = On\n";
    print SOLVER "    END\n";
    print SOLVER "  END\n";
    print SOLVER "END\n";
    print SOLVER "COMMAND FILE:\n";
    print SOLVER "  Version = 16.0\n";
    print SOLVER "END\n";
	close(SOLVER);


} # end of loop
Other way I can think of is creating ccls separately and creating a batch file with cfx5solve commands and using the ccls.

Code:
:: Initialising with default settings
cfx5solve -def stepped_cyinder.def -part 4 -start-method "Platform MPI Local Parallel"

:: Using ccls and initialising with prior results
cfx5solve -def stepped_cyinder.def -part 4 -start-method "Platform MPI Local Parallel" -ccl run2.ccl -ini stepped_cyinder_001.res 
cfx5solve -def stepped_cyinder.def -part 4 -start-method "Platform MPI Local Parallel" -ccl run3.ccl -ini stepped_cyinder_002.res
Above approach also is sensible although involves lot of files if you have multiple analyses to run. How do you typically approach such automated scripts, is there a better way?

Thanks

Last edited by gcoopermax; September 26, 2016 at 06:20. Reason: Added initialisation line and bat file approach
gcoopermax is offline   Reply With Quote

Reply

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
High order scheme vs Specified Blend factor 1 realanony87 CFX 1 November 10, 2015 11:36
Specified Blend factor =1 Vs Central Difference Kushagra CFX 4 May 2, 2008 14:14
larger blend factor or high resolution ? amine CFX 2 March 4, 2008 21:28
automatic change of advetion scheme (blend factor) Ben CFX 6 September 28, 2004 11:32
SST blend factor stefano CFX 1 March 24, 2003 07:23


All times are GMT -4. The time now is 15:59.