CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens > STAR-CCM+

Which Time Step - Implicit Unsteady

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

Like Tree1Likes
  • 1 Post By me3840

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2014, 08:40
Default Which Time Step - Implicit Unsteady
  #1
Member
 
Join Date: May 2014
Posts: 30
Rep Power: 12
mosef is on a distinguished road
Hi,
I'm simulating the melting and solidification of a spherical capsule (2D), which is filled with paraffin.
I'm using an Implicit unsteady model.
How can I find an appropriate time step? I have 30000 cells and currently my time step is 0,2s. I set the Courant number to 4. But which connection is between Courant Number and time step?
It is also possible to vary the time step?
The physical time to melt the paraffin is about 8000s. But whith this small time step, I need a few days for the simulation. I worry with a larger time step the simulation will not work.
Can you help me?
Thx a lot!
mosef is offline   Reply With Quote

Old   May 19, 2014, 12:03
Default
  #2
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
Your current timestep is already pretty high for VOF. You want the CFL on the VOF interface to be 1. You can track this variable if you want.

Push the Courant number higher and include fewer inner iterations to get a cheaper calculation.

You can put a field function in place of the timestep and dynamically change it based on CFL if you want.
me3840 is offline   Reply With Quote

Old   May 19, 2014, 15:15
Default
  #3
Member
 
Join Date: May 2014
Posts: 30
Rep Power: 12
mosef is on a distinguished road
Ok thanks so far. I'll try this tomorrow!
mosef is offline   Reply With Quote

Old   May 20, 2014, 08:16
Default
  #4
Member
 
Join Date: May 2014
Posts: 30
Rep Power: 12
mosef is on a distinguished road
Do I understand that correctly, that the CFL-number ist NOT the same as the courant number?!
I want the CFL to be 1 on the interface, yes. But I don't understand how I can define something as variable if I set the number to f.e. 4?
And WHERE should I define that? The only input field for CFL numbers I can find is in physic models -> Segregated Flow / VOF
Segregated Flow.PNG

VOF.PNG

I can send you my .sim file if u want
thx
mosef is offline   Reply With Quote

Old   May 20, 2014, 10:15
Default
  #5
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
You cannot explicitly set the CFL using an implicit method. You will have to make a feedback system. Run iteration > check CFL > if too high, reduce time step > if too low, increase time step.
me3840 is offline   Reply With Quote

Old   May 20, 2014, 10:27
Default
  #6
Member
 
Join Date: May 2014
Posts: 30
Rep Power: 12
mosef is on a distinguished road
Ok, I understand this.
I made a new report -> Maximum -> Skalar Field Function: Convective Courant Number.
The Courant Number is about 0,02.
I think it's too low, so I try to increase the time step, right?
mosef is offline   Reply With Quote

Old   May 20, 2014, 10:53
Default
  #7
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
That's correct.
me3840 is offline   Reply With Quote

Old   May 20, 2014, 11:02
Default
  #8
Member
 
Join Date: May 2014
Posts: 30
Rep Power: 12
mosef is on a distinguished road
Ok thanks so far
mosef is offline   Reply With Quote

Old   May 27, 2014, 05:12
Default
  #9
Member
 
Join Date: May 2014
Posts: 30
Rep Power: 12
mosef is on a distinguished road
Can I make a field function that describes the relation between Time Step and Convective Courant Number?
I wanna make a function whith this statement:

"If the Courant Number is larger than 1, then the Time Step should be reduced by 0,01 seconds".

Is that possible?
I am not good at programming, so Can you help me with this problems if it is possible?
My Field Function so far is:
(${ConvectiveCourantNumber}<=1.0) ? (${TimeStep} -0.01)
But I think it's wrong...
mosef is offline   Reply With Quote

Old   May 28, 2014, 10:00
Default
  #10
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
Take a look at this macro I wrote to control the timestep dynamically. You have the idea right with your function, but to make it work well you need to be a little more sophisticated.

Code:


import java.util.*;

import star.common.*;
import star.base.neo.*;
import star.vis.*;
import star.base.report.*;
import star.flow.*;

public class timeStepControlByFF extends StarMacro {

    public void execute() {
        execute0();
    }

    private void execute0() {

        Simulation sim = getActiveSimulation();

        UserFieldFunction userFieldFunction_0 = sim.getFieldFunctionManager().createFieldFunction();
        userFieldFunction_0.setPresentationName("userCalculatedTimeStep");
        userFieldFunction_0.setFunctionName("userCalculatedTimeStep");
        userFieldFunction_0.setDefinition("(($userTempTimeStep >= $userMaxDecrease)  && ($userTempTimeStep <= $userMaxIncrease)  && ($userTempTimeStep<$userMaxTimeStep) && ($userTempTimeStep>$userMinTimeStep))  ? $userTempTimeStep:$userLimitedTimeStep");

        UserFieldFunction userFieldFunction_1 = sim.getFieldFunctionManager().createFieldFunction();
        userFieldFunction_1.setPresentationName("userDesiredCFL");
        userFieldFunction_1.setFunctionName("userDesiredCFL");
        userFieldFunction_1.setDefinition("20");

        UserFieldFunction userFieldFunction_2 = sim.getFieldFunctionManager().createFieldFunction();
        userFieldFunction_2.setPresentationName("userLimitedTimeStep");
        userFieldFunction_2.setFunctionName("userLimitedTimeStep");
        userFieldFunction_2.setDefinition("$userDesiredCFL < $userMaxCFLReport ? ($userMaxDecrease>$userMinTimeStep ? $userMaxDecrease:$userMinTimeStep):($userMaxIncrease<$userMaxTimeStep ? $userMaxIncrease:$userMaxTimeStep)");

        UserFieldFunction userFieldFunction_3 = sim.getFieldFunctionManager().createFieldFunction();
        userFieldFunction_3.setPresentationName("userMaxDecrease");
        userFieldFunction_3.setFunctionName("userMaxDecrease");
        userFieldFunction_3.setDefinition("0.5*$TimeStep");

        UserFieldFunction userFieldFunction_4 = sim.getFieldFunctionManager().createFieldFunction();
        userFieldFunction_4.setPresentationName("userMaxIncrease");
        userFieldFunction_4.setFunctionName("userMaxIncrease");
        userFieldFunction_4.setDefinition("2.0*$TimeStep");

        UserFieldFunction userFieldFunction_5 = sim.getFieldFunctionManager().createFieldFunction();
        userFieldFunction_5.setPresentationName("userMaxTimeStep");
        userFieldFunction_5.setFunctionName("userMaxTimeStep");
        userFieldFunction_5.setDefinition("0.025");

        UserFieldFunction userFieldFunction_6 = sim.getFieldFunctionManager().createFieldFunction();
        userFieldFunction_6.setPresentationName("userMinTimeStep");
        userFieldFunction_6.setFunctionName("userMinTimeStep");
        userFieldFunction_6.setDefinition("0.0001");

        UserFieldFunction userFieldFunction_7 = sim.getFieldFunctionManager().createFieldFunction();
        userFieldFunction_7.setPresentationName("userTempTimeStep");
        userFieldFunction_7.setFunctionName("userTempTimeStep");
        userFieldFunction_7.setDefinition("$userDesiredCFL*$TimeStep/$userMaxCFLReport");

        UserFieldFunction userFieldFunction_8 = sim.getFieldFunctionManager().createFieldFunction();
        userFieldFunction_8.setPresentationName("userTimeStepControl");
        userFieldFunction_8.setFunctionName("userTimeStepControl");
        userFieldFunction_8.setDefinition("$Time==0 ? $userMinTimeStep:$userCalculatedTimeStep");

        ImplicitUnsteadySolver implicitUnsteadySolver_0 = ((ImplicitUnsteadySolver) sim.getSolverManager().getSolver(ImplicitUnsteadySolver.class));

        implicitUnsteadySolver_0.getTimeStep().setDefinition("$userTimeStepControl");

        Units units_1 = ((Units) sim.getUnitsManager().getObject("m"));

        NullFieldFunction nullFieldFunction_0 = ((NullFieldFunction) sim.getFieldFunctionManager().getFunction("NullFieldFunction"));
        ThresholdPart thresholdPart_1 = sim.getPartManager().createThresholdPart(new NeoObjectVector(new Object[]{}), new DoubleVector(new double[]{0.0, 1.0}), units_1, nullFieldFunction_0, 0);
        thresholdPart_1.setPresentationName("userTimeStepControlThreshold");
        thresholdPart_1.getRangeQuantities().setArray(new DoubleVector(new double[]{0.45, 0.55}));

        MaxReport maxReport_1 = sim.getReportManager().createReport(MaxReport.class);
        maxReport_1.setPresentationName("userMaxCFL");
        CourantNumberFunction courantNumberFunction_0 = ((CourantNumberFunction) sim.getFieldFunctionManager().getFunction("CourantNumber"));
        maxReport_1.setScalar(courantNumberFunction_0);
        maxReport_1.getParts().setObjects(thresholdPart_1);

        MaxReport maxReport_0 = sim.getReportManager().createReport(MaxReport.class);
        maxReport_0.setPresentationName("userTimeStep");
        PrimitiveFieldFunction primitiveFieldFunction_0 = ((PrimitiveFieldFunction) sim.getFieldFunctionManager().getFunction("TimeStep"));
        maxReport_0.setScalar(primitiveFieldFunction_0);
        sim.getMonitorManager().createMonitorAndPlot(new NeoObjectVector(new Object[]{maxReport_0}), true, "%1$s Plot");
        ReportMonitor reportMonitor_0 =((ReportMonitor) sim.getMonitorManager().getMonitor("userTimeStep Monitor"));
        MonitorPlot monitorPlot_0 =sim.getPlotManager().createMonitorPlot(new NeoObjectVector(new Object[]{reportMonitor_0}), "userTimeStep Monitor Plot");
        
        sim.println("\n");
        sim.println("userTimeStepControl setup complete");
        sim.println("==============================================");
        sim.println("WARNING: Set the threshold userTimeStepControlThreshold's region and field function assignment before iterating!");
        sim.println("WARNING: Set the report userTimeStep's region assignment before iterating!");
        sim.println("==============================================");
    }
}
crevoise likes this.
me3840 is offline   Reply With Quote

Reply

Tags
time step size

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
Time step size and max iterations per time step pUl| FLUENT 33 October 23, 2020 22:50
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 13:58
dynamic Mesh is faster than MRF???? sharonyue OpenFOAM Running, Solving & CFD 14 August 26, 2013 07:47
calculation diverge after continue to run zhajingjing OpenFOAM 0 April 28, 2010 04:35
Convergence moving mesh lr103476 OpenFOAM Running, Solving & CFD 30 November 19, 2007 14:09


All times are GMT -4. The time now is 01:27.