|
1 |
| -from flow360.component.simulation.user_code import SolverVariable |
| 1 | +from flow360.component.simulation.unit_system import * |
| 2 | +from flow360.component.simulation.user_code import SolverVariable, VariableComponents |
2 | 3 |
|
3 |
| -mut = SolverVariable(name="fl.mut", value=float("NaN")) # Turbulent viscosity |
4 |
| -mu = SolverVariable(name="fl.mu", value=float("NaN")) # Laminar viscosity |
| 4 | +# mut = SolverVariable( |
| 5 | +# name="fl.mut", |
| 6 | +# source_type="Volume", |
| 7 | +# components=VariableComponents(sizes=[1], dimensions=[ViscosityType.dim]), |
| 8 | +# description="Turbulent viscosity", |
| 9 | +# ) |
| 10 | +# mu = SolverVariable( |
| 11 | +# name="fl.mu", |
| 12 | +# source_type="Volume", |
| 13 | +# components=VariableComponents(sizes=[1], dimensions=[ViscosityType.dim]), |
| 14 | +# description="Laminar viscosity", |
| 15 | +# ) |
5 | 16 | solutionNavierStokes = SolverVariable(
|
6 |
| - name="fl.solutionNavierStokes", value=float("NaN") |
7 |
| -) # Solution for N-S equation in conservative form |
| 17 | + name="fl.solutionNavierStokes", |
| 18 | + source_type="Volume", |
| 19 | + solver_side_name="NavierStokes_solution", |
| 20 | + source=None, |
| 21 | + components=VariableComponents( |
| 22 | + sizes=[1, 3, 1], |
| 23 | + dimensions=[DensityType.dim_name, MassFluxType.dim_name, EnergyDensityType.dim_name], |
| 24 | + ), |
| 25 | + description="Solution for N-S equation in conservative form...", |
| 26 | +) |
| 27 | + |
8 | 28 | residualNavierStokes = SolverVariable(
|
9 |
| - name="fl.residualNavierStokes", value=float("NaN") |
10 |
| -) # Residual for N-S equation in conservative form |
11 |
| -solutionTurbulence = SolverVariable( |
12 |
| - name="fl.solutionTurbulence", value=float("NaN") |
13 |
| -) # Solution for turbulence model |
14 |
| -residualTurbulence = SolverVariable( |
15 |
| - name="fl.residualTurbulence", value=float("NaN") |
16 |
| -) # Residual for turbulence model |
17 |
| -kOmega = SolverVariable( |
18 |
| - name="fl.kOmega", value=float("NaN") |
19 |
| -) # Effectively solutionTurbulence when using SST model |
20 |
| -nuHat = SolverVariable( |
21 |
| - name="fl.nuHat", value=float("NaN") |
22 |
| -) # Effectively solutionTurbulence when using SA model |
23 |
| -solutionTransition = SolverVariable( |
24 |
| - name="fl.solutionTransition", value=float("NaN") |
25 |
| -) # Solution for transition model |
26 |
| -residualTransition = SolverVariable( |
27 |
| - name="fl.residualTransition", value=float("NaN") |
28 |
| -) # Residual for transition model |
29 |
| -solutionHeatSolver = SolverVariable( |
30 |
| - name="fl.solutionHeatSolver", value=float("NaN") |
31 |
| -) # Solution for heat equation |
32 |
| -residualHeatSolver = SolverVariable( |
33 |
| - name="fl.residualHeatSolver", value=float("NaN") |
34 |
| -) # Residual for heat equation |
35 |
| -coordinate = SolverVariable(name="fl.coordinate", value=float("NaN")) # Grid coordinates |
| 29 | + name="fl.residualNavierStokes", |
| 30 | + source_type="Volume", |
| 31 | + solver_side_name="NavierStokes_residual", |
| 32 | + source=None, |
| 33 | + components=VariableComponents(sizes=[1, 3, 1], dimensions=["1", "1", "1"]), |
| 34 | + description="Residual for N-S equation in conservative form.", |
| 35 | +) |
| 36 | + |
| 37 | +# TODO: Revert the comment below and finish conversion |
| 38 | +# kOmega = SolverVariable( |
| 39 | +# name="fl.kOmega", value=float("NaN") |
| 40 | +# ) # Effectively solutionTurbulence when using SST model |
| 41 | +# nuHat = SolverVariable( |
| 42 | +# name="fl.nuHat", value=float("NaN") |
| 43 | +# ) # Effectively solutionTurbulence when using SA model |
| 44 | +# solutionTransition = SolverVariable( |
| 45 | +# name="fl.solutionTransition", value=float("NaN") |
| 46 | +# ) # Solution for transition model |
| 47 | +# residualTransition = SolverVariable( |
| 48 | +# name="fl.residualTransition", value=float("NaN") |
| 49 | +# ) # Residual for transition model |
| 50 | +# solutionHeatSolver = SolverVariable( |
| 51 | +# name="fl.solutionHeatSolver", value=float("NaN") |
| 52 | +# ) # Solution for heat equation |
| 53 | +# residualHeatSolver = SolverVariable( |
| 54 | +# name="fl.residualHeatSolver", value=float("NaN") |
| 55 | +# ) # Residual for heat equation |
| 56 | +# coordinate = SolverVariable(name="fl.coordinate", value=float("NaN")) # Grid coordinates |
36 | 57 |
|
37 |
| -physicalStep = SolverVariable( |
38 |
| - name="fl.physicalStep", value=float("NaN") |
39 |
| -) # Physical time step, starting from 0 |
40 |
| -pseudoStep = SolverVariable( |
41 |
| - name="fl.pseudoStep", value=float("NaN") |
42 |
| -) # Pseudo time step within physical time step |
43 |
| -timeStepSize = SolverVariable(name="fl.timeStepSize", value=float("NaN")) # Physical time step size |
44 |
| -alphaAngle = SolverVariable( |
45 |
| - name="fl.alphaAngle", value=float("NaN") |
46 |
| -) # Alpha angle specified in freestream |
47 |
| -betaAngle = SolverVariable( |
48 |
| - name="fl.betaAngle", value=float("NaN") |
49 |
| -) # Beta angle specified in freestream |
50 |
| -pressureFreestream = SolverVariable( |
51 |
| - name="fl.pressureFreestream", value=float("NaN") |
52 |
| -) # Freestream reference pressure (1.0/1.4) |
53 |
| -momentLengthX = SolverVariable( |
54 |
| - name="fl.momentLengthX", value=float("NaN") |
55 |
| -) # X component of momentLength |
56 |
| -momentLengthY = SolverVariable( |
57 |
| - name="fl.momentLengthY", value=float("NaN") |
58 |
| -) # Y component of momentLength |
59 |
| -momentLengthZ = SolverVariable( |
60 |
| - name="fl.momentLengthZ", value=float("NaN") |
61 |
| -) # Z component of momentLength |
62 |
| -momentCenterX = SolverVariable( |
63 |
| - name="fl.momentCenterX", value=float("NaN") |
64 |
| -) # X component of momentCenter |
65 |
| -momentCenterY = SolverVariable( |
66 |
| - name="fl.momentCenterY", value=float("NaN") |
67 |
| -) # Y component of momentCenter |
68 |
| -momentCenterZ = SolverVariable( |
69 |
| - name="fl.momentCenterZ", value=float("NaN") |
70 |
| -) # Z component of momentCenter |
| 58 | +# physicalStep = SolverVariable( |
| 59 | +# name="fl.physicalStep", value=float("NaN") |
| 60 | +# ) # Physical time step, starting from 0 |
| 61 | +# pseudoStep = SolverVariable( |
| 62 | +# name="fl.pseudoStep", value=float("NaN") |
| 63 | +# ) # Pseudo time step within physical time step |
| 64 | +# timeStepSize = SolverVariable(name="fl.timeStepSize", value=float("NaN")) # Physical time step size |
| 65 | +# alphaAngle = SolverVariable( |
| 66 | +# name="fl.alphaAngle", value=float("NaN") |
| 67 | +# ) # Alpha angle specified in freestream |
| 68 | +# betaAngle = SolverVariable( |
| 69 | +# name="fl.betaAngle", value=float("NaN") |
| 70 | +# ) # Beta angle specified in freestream |
| 71 | +# pressureFreestream = SolverVariable( |
| 72 | +# name="fl.pressureFreestream", value=float("NaN") |
| 73 | +# ) # Freestream reference pressure (1.0/1.4) |
| 74 | +# momentLengthX = SolverVariable( |
| 75 | +# name="fl.momentLengthX", value=float("NaN") |
| 76 | +# ) # X component of momentLength |
| 77 | +# momentLengthY = SolverVariable( |
| 78 | +# name="fl.momentLengthY", value=float("NaN") |
| 79 | +# ) # Y component of momentLength |
| 80 | +# momentLengthZ = SolverVariable( |
| 81 | +# name="fl.momentLengthZ", value=float("NaN") |
| 82 | +# ) # Z component of momentLength |
| 83 | +# momentCenterX = SolverVariable( |
| 84 | +# name="fl.momentCenterX", value=float("NaN") |
| 85 | +# ) # X component of momentCenter |
| 86 | +# momentCenterY = SolverVariable( |
| 87 | +# name="fl.momentCenterY", value=float("NaN") |
| 88 | +# ) # Y component of momentCenter |
| 89 | +# momentCenterZ = SolverVariable( |
| 90 | +# name="fl.momentCenterZ", value=float("NaN") |
| 91 | +# ) # Z component of momentCenter |
71 | 92 |
|
72 |
| -bet_thrust = SolverVariable(name="fl.bet_thrust", value=float("NaN")) # Thrust force for BET disk |
73 |
| -bet_torque = SolverVariable(name="fl.bet_torque", value=float("NaN")) # Torque for BET disk |
74 |
| -bet_omega = SolverVariable(name="fl.bet_omega", value=float("NaN")) # Rotation speed for BET disk |
75 |
| -CD = SolverVariable(name="fl.CD", value=float("NaN")) # Drag coefficient on patch |
76 |
| -CL = SolverVariable(name="fl.CL", value=float("NaN")) # Lift coefficient on patch |
77 |
| -forceX = SolverVariable(name="fl.forceX", value=float("NaN")) # Total force in X direction |
78 |
| -forceY = SolverVariable(name="fl.forceY", value=float("NaN")) # Total force in Y direction |
79 |
| -forceZ = SolverVariable(name="fl.forceZ", value=float("NaN")) # Total force in Z direction |
80 |
| -momentX = SolverVariable(name="fl.momentX", value=float("NaN")) # Total moment in X direction |
81 |
| -momentY = SolverVariable(name="fl.momentY", value=float("NaN")) # Total moment in Y direction |
82 |
| -momentZ = SolverVariable(name="fl.momentZ", value=float("NaN")) # Total moment in Z direction |
83 |
| -nodeNormals = SolverVariable(name="fl.nodeNormals", value=float("NaN")) # Normal vector of patch |
84 |
| -theta = SolverVariable(name="fl.theta", value=float("NaN")) # Rotation angle of volume zone |
85 |
| -omega = SolverVariable(name="fl.omega", value=float("NaN")) # Rotation speed of volume zone |
86 |
| -omegaDot = SolverVariable( |
87 |
| - name="fl.omegaDot", value=float("NaN") |
88 |
| -) # Rotation acceleration of volume zone |
89 |
| -wallFunctionMetric = SolverVariable( |
90 |
| - name="fl.wallFunctionMetric", value=float("NaN") |
91 |
| -) # Wall model quality indicator |
92 |
| -wallShearStress = SolverVariable( |
93 |
| - name="fl.wallShearStress", value=float("NaN") |
94 |
| -) # Wall viscous shear stress |
95 |
| -yPlus = SolverVariable(name="fl.yPlus", value=float("NaN")) # Non-dimensional wall distance |
| 93 | +# bet_thrust = SolverVariable(name="fl.bet_thrust", value=float("NaN")) # Thrust force for BET disk |
| 94 | +# bet_torque = SolverVariable(name="fl.bet_torque", value=float("NaN")) # Torque for BET disk |
| 95 | +# bet_omega = SolverVariable(name="fl.bet_omega", value=float("NaN")) # Rotation speed for BET disk |
| 96 | +# CD = SolverVariable(name="fl.CD", value=float("NaN")) # Drag coefficient on patch |
| 97 | +# CL = SolverVariable(name="fl.CL", value=float("NaN")) # Lift coefficient on patch |
| 98 | +# forceX = SolverVariable(name="fl.forceX", value=float("NaN")) # Total force in X direction |
| 99 | +# forceY = SolverVariable(name="fl.forceY", value=float("NaN")) # Total force in Y direction |
| 100 | +# forceZ = SolverVariable(name="fl.forceZ", value=float("NaN")) # Total force in Z direction |
| 101 | +# momentX = SolverVariable(name="fl.momentX", value=float("NaN")) # Total moment in X direction |
| 102 | +# momentY = SolverVariable(name="fl.momentY", value=float("NaN")) # Total moment in Y direction |
| 103 | +# momentZ = SolverVariable(name="fl.momentZ", value=float("NaN")) # Total moment in Z direction |
| 104 | +# nodeNormals = SolverVariable(name="fl.nodeNormals", value=float("NaN")) # Normal vector of patch |
| 105 | +# theta = SolverVariable(name="fl.theta", value=float("NaN")) # Rotation angle of volume zone |
| 106 | +# omega = SolverVariable(name="fl.omega", value=float("NaN")) # Rotation speed of volume zone |
| 107 | +# omegaDot = SolverVariable( |
| 108 | +# name="fl.omegaDot", value=float("NaN") |
| 109 | +# ) # Rotation acceleration of volume zone |
| 110 | +# wallFunctionMetric = SolverVariable( |
| 111 | +# name="fl.wallFunctionMetric", value=float("NaN") |
| 112 | +# ) # Wall model quality indicator |
| 113 | +# wallShearStress = SolverVariable( |
| 114 | +# name="fl.wallShearStress", value=float("NaN") |
| 115 | +# ) # Wall viscous shear stress |
| 116 | +# yPlus = SolverVariable(name="fl.yPlus", value=float("NaN")) # Non-dimensional wall distance |
0 commit comments