Commit babd7b76 authored by Salko Jr, Robert's avatar Salko Jr, Robert
Browse files

Add ability to set additional CTF models

parent 12e5b0ed
Loading
Loading
Loading
Loading
+41 −1
Original line number Diff line number Diff line
@@ -243,6 +243,12 @@ class Model:
        # Under-relaxation coefficients
        me.betaHTC = None

        # Optional model specifications
        me.optionalModels = {}

        # Numerical controls
        me.numericalControls = {}

    @property
    def is_nodal(self):
        """ Access private is_nodal attr """
@@ -266,7 +272,8 @@ class Model:
        """
        me.title = str(title)

    def setModelOptions(me, beta=None, enableEntrainment=None, betaHTC=None):
    def setModelOptions(me, beta=None, enableEntrainment=None, betaHTC=None, intDragModel=None,
            flowRegimeMap=None, subcooledBoilingModel=None, tpFrictionModel = None):
        """ Set various modeling options

        Any model that can be changed via this method has a default.
@@ -276,6 +283,15 @@ class Model:
           beta (float): Single-phase turbulent mixing coefficietn
           enableEntrainment (bool): Set to True to enable entrainment/de-entrainment of droplets
           betaHTC (float): Under-relaxation coefficient for fluid/solid heat transfer coefficient
           intDragModel (str): Enter "drift_flux" or "legacy" to pick the drift flux or legacy models for
              modeling interfacial drag, or leave as None to default.
           flowRegimeMap (str): Enter "legacy" or "ge_nonprop" to pick the legacy or GE non-proprietary
              model, or leave as None to default.
           subcooledBoilingModel (str): Enter "thom"  to use Thom plus Hancox-Nicol for near-wall
              condensation (no ONB model) or "saha" to use the Gorenflo model with Saha-Zuber for determining
              bubble detachment (uses ONB model to determine when boiling starts).
           tpFrictionModel (str): Enter 'wallis', 'chisholm', or 'lockhart' to select from the Wallis, Chisholm
              or Lockhart-Martinelli models for the two-phase flow multiplier, or leave as None to default.
        """

        if beta is not None:
@@ -283,6 +299,18 @@ class Model:
        if enableEntrainment is not None:
            me.enableEntrainment = enableEntrainment
        me.betaHTC = betaHTC
        if intDragModel is not None:
            assert intDragModel in ['legacy', 'drift_flux']
            me.optionalModels['intDragModel'] = intDragModel
        if flowRegimeMap is not None:
            assert flowRegimeMap=='legacy' or flowRegimeMap=='ge_nonprop'
            me.optionalModels['flowRegimeMap'] = flowRegimeMap
        if subcooledBoilingModel is not None:
            assert subcooledBoilingModel=='thom' or subcooledBoilingModel=='saha'
            me.optionalModels['subcooledBoilingModel'] = subcooledBoilingModel
        if tpFrictionModel is not None:
            assert tpFrictionModel in ['wallis', 'chisholm', 'lockhart']
            me.optionalModels['tpFrictionModel'] = tpFrictionModel

    def setFrictionModel(me, model):
        """ Sets the friction model option
@@ -1224,6 +1252,18 @@ class Model:
        else:
            me.solver = 5

    def setNumericalControls(me, maxOuterIterations=None):
        """ Set numerical controls

        Args:
           maxOuterIterations (int): This is the maximum number of outer iterations to take during a timestep.
              Note that by default, CTF does not use the outer iteration loop.  Adding this and setting number
              of outer iterations greater than 1 will enable the loop.
        """
        if maxOuterIterations is not None:
            assert maxOuterIterations>0
            me.numericalControls['maxOuterIterations'] = maxOuterIterations

    def setSteadyState(me, energyBalance=None, massBalance=None, maxIterations=None, rtwfp=None,
                       p_l2=None, p_linf=None, Tcool_l2=None, Tcool_linf=None,
                       Tsolid_l2=None, Tsolid_linf=None, vl_l2=None, vl_linf=None, vv_l2=None, vv_linf=None,
+22 −3
Original line number Diff line number Diff line
@@ -85,7 +85,10 @@ def writeDeck(model, filename):
    controlData.append("*INITIAL   DUMPF\n")
    controlData.append("       1       0\n")
    controlData.append("**    EPSO    OITMAX    IITMAX   COURANT\n")
    controlData.append("  1e-4             5       200  0.800000\n")
    oitmax = 5
    if 'maxOuterIterations' in model.numericalControls:
        oitmax = model.numericalControls['maxOuterIterations']
    controlData.append("  1e-4{:14d}       200  0.800000\n".format(oitmax))
    controlData.append("*TITLE\n")
    controlData.append(model.title + "\n")

@@ -158,6 +161,18 @@ def writeDeck(model, filename):
    if model.betaHTC is not None:
        group1Data.append("{{beta_htc}} {:15.3e}\n".format(model.betaHTC))

    if 'intDragModel' in model.optionalModels:
        group1Data.append("{{int_drag_model}} {:s}\n".format(model.optionalModels['intDragModel']))
    if 'flowRegimeMap' in model.optionalModels:
        group1Data.append("{{flow_regime_map}} {:s}\n".format(model.optionalModels['flowRegimeMap']))
    if 'subcooledBoilingModel' in model.optionalModels:
        if model.optionalModels['subcooledBoilingModel']=='saha':
            group1Data.append("{use_onb_model} .true.\n")
    if 'tpFrictionModel' in model.optionalModels:
        group1Data.append("{{tp_fric_model}} {:s}\n".format(model.optionalModels['tpFrictionModel']))
    if 'maxOuterIterations' in model.numericalControls:
        group1Data.append("{enable_outer_iteration_loop} .true.\n")

    # The Card Group 2 data to be written to the deck
    group2Data = []
    group2Data.append("**NGR\n")
@@ -466,8 +481,12 @@ def writeDeck(model, filename):
        dnbchk = 1
    elif model.conductorOptions['postChfCheck']['value'] == 'groeneveld':
        dnbchk = 3
    group8Data.append("{:7d}{:7d}{:6d}     1     0     0     1     1     0     0{:6d}     1{:6d}     0\n".format(
        len(heated), len(unheated), model.conductorOptions['nc']['value'], w3, dnbchk))
    ihtc = 1
    if 'subcooledBoilingModel' in model.optionalModels:
        if model.optionalModels['subcooledBoilingModel'] == 'saha':
            ihtc = 2
    group8Data.append("{:7d}{:7d}{:6d}     1     0     0     1     1     0     0{:6d}{:5d}{:6d}     0\n".format(
        len(heated), len(unheated), model.conductorOptions['nc']['value'], w3, ihtc, dnbchk))

    # If this is a parallel model write data
    if model.rodsInDomain:
+73 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
*INITIAL   DUMPF
       1       0
**    EPSO    OITMAX    IITMAX   COURANT
  1e-4             5       200  0.800000
  1e-4            10       200  0.800000
*TITLE
ctf model
***********************************************************************************************
@@ -25,6 +25,11 @@ ctf model
*Card 1.4
**GTP(1)   VFRAC(3)  GTP(2) VFRAC(4)  GTP(3) VFRAC(5)  GTP(4) VFRAC(6)
     air     0.0001
{int_drag_model} drift_flux
{flow_regime_map} ge_nonprop
{use_onb_model} .true.
{tp_fric_model} chisholm
{enable_outer_iteration_loop} .true.
***********************************************************************************************
*GROUP 2 - Channel Description
***********************************************************************************************
@@ -115,6 +120,48 @@ ctf model
*Card 7.2
**   CDL    J   CD1   CD2   CD3   CD4   CD5   CD6   CD7   CD8   CD9  CD10  CD11  CD12
***********************************************************************************************
*GROUP 8 - Rod and Unheated Conductor Data
***********************************************************************************************
**NGR
    8
*Card 8.1
** NRRD   NSRD    NC  NRTB  NRAD  NLTY  NSTA   NXF  NCAN  RADF    W3 IHTC  DNBCHK NDM14
      1      0     1     1     0     0     1     1     0     0    -1    2     1     0
*Card 8.2
**    N   IFTY   IAXP   NRND DAXMIN       RMULT         HGAP  ISECR       HTAMB        TAMB  SYMROD  HTCMAP TKEMAP NSUBAX NSUBAZ
*Card 8.3
**NSCH   PIE  NSCH   PIE  NSCH   PIE  NSCH   PIE  NSCH   PIE  NSCH   PIE  NSCH   PIE NSCH   PIE
      1      1      1      0       0  1.0000e+00  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
     1 0.500     2 0.500     0 0.000     0 0.000     0 0.000     0 0.000     0 0.000     0 0.000
*Card 8.5
**    N   ISTYP      HPERIM     HPERIMI       RMULS  NOSLCH  NSLCHC       HTAMBS        TAMBS
*Card 8.6
**    I   NRT1   NST1   NRX1
      1      1      0      2
*Card 8.7
**IRTB1  IRTB2  IRTB3  IRTB4  IRTB5  IRTB6  IRTB7  IRTB8  IRTB9 IRTB10 IRTB11 IRTB12
      1
*Card 8.8
**ISTB1  ISTB2  ISTB3  ISTB4  ISTB5  ISTB6  ISTB7  ISTB8  ISTB9 ISTB10 ISTB11 ISTB12
*Card 8.9
**    AXIALT      TRINIT
 0.00000e+00 2.70000e+02
 1.00000e+00 2.70000e+02
***********************************************************************************************
*GROUP 9 - Conductor Geometry Description
***********************************************************************************************
**NGR
    9
*Card 9.1
** NFLT IRLF ICNF IMWR ISWL IDNS IRLG CREEP NDM9 NM10 NM11 NM12 NM13 NM14
      1   -1   -1   -1   -1   -1   -1   -1    0    0    0    0    0    0
*Card 9.6
**  I FTYP           DROD            DIN   NFUL IMTF IMTC DUM8 DUM9  DUM10  DUM11  DUM12  DUM13  DUM14  EPSO
    1 tube   1.000000e-03    8.00000e-04      1    0    0    0   0       0     0     0      0    0    0.0
*Card 9.7
** NODER  MATR          TREG   QREG
       3     0  1.000000e-04  1.0
***********************************************************************************************
*GROUP 10 - Material Properties Tables
***********************************************************************************************
*NGRP
@@ -123,6 +170,31 @@ ctf model
     0    0    0    0    0    0    0    0    0    0    0    0    0    0
*
***********************************************************************************************
*GROUP 11 - Core Power Distribution Information
***********************************************************************************************
*NGR group number
   11
**Card 11.1
* NQA  NAXP  MNXN    NQ NGPFF   NQR  NDM7  NDM8  NDM9 NDM10 NDM11 NDM12 NDM13 NDM14
    1     1     2     0     0     1     0     0     0     0     0     0     0     0
**Card 11.2
*           YQA
    0.00000e+00
**Card 11.3
*     I   NAXN
      1      2
**Card 11.4
*             Y         AXIALZ
    0.00000e+00    1.00000e+00
    1.00000e+00    1.00000e+00
**Radial power profile forcing function
**Card 11.7
*          YQR
    0.00000E+00
**Card 11.8
*    FQR1      FQR2      FQR3      FQR4      FQR5      FQR6      FQR7      FQR8
   1.00000
***********************************************************************************************
*GROUP 12 - Turbulent Mixing and Void Drift Data
***********************************************************************************************
**NGR
+12 −0
Original line number Diff line number Diff line
# This is a 2 channel model
# Tests:
# - Ability to model axial variation tables
# - Ability to turn on outer iteration loop
# - Ability to change the interfacial drag model
# - Ability to change the flow regime map model
# - Ability to change the subcooled boiling model
import sys
sys.path.insert(0, '../../../')
import SubKit.build as skb
@@ -57,6 +61,14 @@ def main():
    model.assignTableToGap(tableID=3, gapID=1)
    model.assignTableToChannel(tableID=2, chID=2, applies='scalar')

    model.solidQuickAdd(solidID=1, geoObj=skb.Tube(d_outer=1e-3, d_inner=0.8e-3))
    model.addSolidOuterChan(solidID=1, chID=[1, 2], percent=[0.5, 0.5])

    model.setNumericalControls(maxOuterIterations=10)

    model.setModelOptions(flowRegimeMap="ge_nonprop", intDragModel='drift_flux', subcooledBoilingModel='saha',
            tpFrictionModel='chisholm')

    model.generateModel()