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

Java code to get the current residuals values

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 8, 2018, 20:37
Default Java code to get the current residuals values
  #1
New Member
 
Élio Pereira
Join Date: May 2018
Location: Lisbon
Posts: 2
Rep Power: 0
Élio Pereira is on a distinguished road
From the forum topic Java code to get the current time/iteration step, I learnt that the current iteration number can be accessed through the following command:

getActiveSimulation().getSimulationIterator().getC urrentIteration()


I wonder if there's a similar command to get the current residual values ( Continuity, X-momentum, Y-momentum and Energy). I tried, for example, the following command for the continuity:

getActiveSimulation().getSimulationIterator().getC urrentContinuity()


but I wasn't successful. Star CCM+ doesn't aknowledge this one. Which commands should be used to get the current residuals values?
Élio Pereira is offline   Reply With Quote

Old   May 12, 2018, 18:19
Default
  #2
Senior Member
 
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 389
Rep Power: 13
bluebase is on a distinguished road
Quote:
Originally Posted by Élio Pereira View Post
I wonder if there's a similar command to get the current residual values ( Continuity, X-momentum, Y-momentum and Energy).

Yes, sure there is way.


However, you'll not find the residual values in the SimulationIterator class.
Instead, you can get the latest resdiual value from their respective monitors.


I don't recall the way to directly get the current residual value, but below is a working example. For more information and alternative way, check the java api guide to get an overview what the ResidualMonitor (or PlotableMonitor) class can do.



Code:
import java.util.*;

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

public class printConti extends StarMacro {
  public void execute() {

    Simulation sim = getActiveSimulation();

    ResidualMonitor residualMonitor_0 = 
      ((ResidualMonitor) sim.getMonitorManager().getMonitor("Continuity"));

    double[] conti = residualMonitor_0.getPlotYValues() ;
    
    sim.println("The current continuity residual is " + conti[conti.length-1]);
  }
}

Best regards,
Sebastian
bluebase is offline   Reply With Quote

Old   May 14, 2018, 04:29
Default
  #3
New Member
 
Élio Pereira
Join Date: May 2018
Location: Lisbon
Posts: 2
Rep Power: 0
Élio Pereira is on a distinguished road
Thank you for your answer!
Élio Pereira is offline   Reply With Quote

Reply

Tags
code, current, macro, residuals, star ccm+

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
I got code 1 error from ANSYS CFX zlor1324 CFX 0 March 11, 2014 20:22
max node values exceed max element values in contour plot jason_t FLUENT 0 August 19, 2009 12:32
exact face values RubenG Main CFD Forum 0 June 22, 2009 12:09
State of the art in CFD technology Juan Carlos GARCIA SALAS Main CFD Forum 39 November 1, 1999 15:34
What kind of Cmmercial CFD code you feel well? Lans Main CFD Forum 13 October 27, 1998 11:20


All times are GMT -4. The time now is 10:34.