I have a gas model where I want to compare two cases:
- using a fixed “compressibility factor” z
- computing z from an EoS [Equation of State]
The idea is to compare the dynamic behavior. So my idea is to add a structural_parameters
block:
@structural_parameters begin
z_choice = :fixed
end
thus with z_choice
as :fixed
by default. If I instead want to use a cubic EoS, set z_choice=:cubic
.
I have a long list of equations…
@equations begin
... ~ ...
z ~ ...
... ~ ...
end
Question: How do I switch between how I compute z
in the equations? Is the correct way to do:
if z_choice == :fixed
@equations begin
...~...
z ~ 0.9
... ~ ...
end
elseif z_choice == :cubic
@equations begin
... ~ ...
z ~ cubic(...)
... ~ ...
end
end
[do I need to enclose the above in a begin...end
block?]
or can I do the following (saving dramatically on the number of code lines):
@equations begin
... ~ ...
if z_choice == :fixed
z ~ 1.3
elseif z_choice == :cubic
z ~ cubic(...)
end
... ~ ...
end