Skip to content

output

write(models, _outfile)

Write the results to the main output file (OUT.DAT).

Write the program results to a file, in a tidy format.

Parameters:

Name Type Description Default
models Models

physics and engineering model objects

required
_outfile int

Fortran output unit identifier

required
Source code in process/core/output.py
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
def write(models, _outfile):
    """Write the results to the main output file (OUT.DAT).

    Write the program results to a file, in a tidy format.

    Parameters
    ----------
    models : process.main.Models
        physics and engineering model objects
    _outfile : int
        Fortran output unit identifier

    """
    # ensure we are capturing warnings that occur in the 'output' stage as these are warnings
    # that occur at our solution point. So we clear existing warnings
    logging_model_handler.start_capturing()
    logging_model_handler.clear_logs()

    # Call stellarator output routine instead if relevant
    if data_structure.stellarator_variables.istell != 0:
        models.stellarator.run(output=True)
        return

    #  Call IFE output routine instead if relevant
    if data_structure.ife_variables.ife != 0:
        models.ife.run(output=True)
        return

    # Costs model
    # Cost switch values
    # No.  |  model
    # ---- | ------
    # 0    |  1990 costs model
    # 1    |  2015 Kovari model
    # 2    |  Custom model
    models.costs.run()
    models.costs.output()

    # Availability model
    models.availability.run(output=True)

    # Writing the output from physics.f90 into OUT.DAT + MFILE.DAT
    models.physics.calculate_effective_charge_ionisation_profiles()
    models.physics.outplas()

    # Detailed physics, currently only done at final point as values are not used
    # by any other functions
    models.physics_detailed.run()
    models.physics_detailed.output_detailed_physics()

    # TODO what is this? Not in caller.f90?
    models.current_drive.output_current_drive()

    # Pulsed reactor model
    models.pulse.run(output=True)
    models.physics.outtim()

    models.divertor.run(output=True)

    # Machine Build Model
    # Radial build
    models.build.calculate_radial_build(output=True)

    # Vertical build
    models.build.calculate_vertical_build(output=True)

    # Cryostat build
    models.cryostat.cryostat_output()

    # Toroidal field coil copper model
    if data_structure.tfcoil_variables.i_tf_sup == 0:
        models.copper_tf_coil.run(output=True)

    # Toroidal field coil superconductor model
    if data_structure.tfcoil_variables.i_tf_sup == 1:
        models.sctfcoil.run(output=True)
        models.sctfcoil.output_tf_superconductor_info()

    # Toroidal field coil aluminium model
    if data_structure.tfcoil_variables.i_tf_sup == 2:
        models.aluminium_tf_coil.run(output=True)

    # Tight aspect ratio machine model
    if (
        data_structure.physics_variables.itart == 1
        and data_structure.tfcoil_variables.i_tf_sup != 1
    ):
        models.tfcoil.iprint = 1
        models.tfcoil.cntrpst()
        models.tfcoil.iprint = 0

    # Poloidal field coil model
    models.pfcoil.output()

    # Structure Model
    models.structure.run(output=True)

    # Poloidal field coil inductance calculation
    models.pfcoil.output_induct()

    # Blanket model
    # Blanket switch values
    # No.  |  model
    # ---- | ------
    # 1    |  CCFE HCPB model
    # 2    |  KIT HCPB model
    # 3    |  CCFE HCPB model with Tritium Breeding Ratio calculation
    # 4    |  KIT HCLL model
    # 5    |  DCLL model

    models.shield.output_shld_areas_and_volumes()
    models.vacuum_vessel.output_vv_areas_and_volumes()

    # First wall geometry
    models.fw.output_fw_geometry()

    # First wall pumping
    models.fw.output_fw_pumping()

    if data_structure.fwbs_variables.i_blanket_type == 1:
        # CCFE HCPB model
        models.ccfe_hcpb.run(output=True)
    # i_blanket_type = 2, KIT HCPB removed
    # i_blanket_type = 3, CCFE HCPB with TBR calculation removed
    # i_blanket_type = 4, KIT HCLL removed
    elif data_structure.fwbs_variables.i_blanket_type == 5:
        # DCLL model
        models.dcll.run(output=True)

    # FISPACT and LOCA model (not used)- removed

    # Toroidal field coil power model
    models.power.tfpwr(output=True)

    # Poloidal field coil power model !
    models.power.pfpwr(output=True)

    # Vacuum model
    models.vacuum.run(output=True)

    # Buildings model
    models.buildings.run(output=True)

    # Plant AC power requirements
    models.power.acpow(output=True)

    # Plant heat transport pt 2 & 3
    models.power.output_cryogenics()
    models.power.output_plant_thermal_powers()
    models.power.output_plant_electric_powers()
    models.power.output_power_profiles_over_time()

    # Water usage in secondary cooling system
    models.water_use.run(output=True)

    # stop capturing warnings so that Outfile does not end up with
    # a lot of non-model logs
    logging_model_handler.stop_capturing()