0% found this document useful (0 votes)
12 views7 pages

Modified Chatgpt Code

The document outlines modifications needed for the OpenFOAM solver to simulate high-pressure liquid CO2 jets interacting with solid propellant, focusing on thermophysical properties, boundary conditions, mesh refinement, and additional models for phase change. Key changes include defining CO2's equation of state, setting appropriate boundary conditions for phase change and jet dynamics, and refining the mesh around the nozzle. The simulation process involves mesh generation, solving with rhoReactingTwoPhaseEulerFoam, and post-processing with ParaView to visualize results.

Uploaded by

Xiaowen QIN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views7 pages

Modified Chatgpt Code

The document outlines modifications needed for the OpenFOAM solver to simulate high-pressure liquid CO2 jets interacting with solid propellant, focusing on thermophysical properties, boundary conditions, mesh refinement, and additional models for phase change. Key changes include defining CO2's equation of state, setting appropriate boundary conditions for phase change and jet dynamics, and refining the mesh around the nozzle. The simulation process involves mesh generation, solving with rhoReactingTwoPhaseEulerFoam, and post-processing with ParaView to visualize results.

Uploaded by

Xiaowen QIN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

To simulate the high-pressure liquid CO2 jet slicing a solid

propellant, incorporating phase change and cooling effects, we’ll


need to make several modifications to the existing OpenFOAM
solver (such as rhoReactingTwoPhaseEulerFoam) and customize
some components. Below is a detailed breakdown of the
modifications you need to make to capture the behavior of CO2 and
its cooling effects on the solid propellant.

Key Modifications

1. Custom Thermophysical Properties for CO2 (Equation of


State and Thermodynamics)
2. Boundary Conditions (for phase change, jet expansion, and
nozzle flow)
3. Mesh Refinement (to capture phase transition and nozzle
flow)
4. Additional Models (latent heat and CO2-specific phase
change models)

1. Custom Thermophysical Properties for CO2

To correctly model CO2's thermodynamic behavior, we need to


define the equation of state (EOS) and other properties such as
latent heat and the critical point behavior. We will modify the
constant/thermophysicalProperties file to include CO2's real gas
behavior.

constant/thermophysicalProperties

// constant/thermophysicalProperties

thermoType
{
type heRhoThermo;
transport simpleTransport;
thermodynamics perfectGas;
equationOfState rhotheta;
specie CO2;
}

CO2
{
molarMass 44.01; // g/mol
T_crit 304.13; // K
P_crit 7390.0; // kPa
Tc 31.98; // K
Pc 7390.0; // kPa
phaseChange true; // Enable phase change behavior
latentHeat 0.5; // Latent heat (in MJ/kg, example value)
capillaryLength 0.0002; // Example value for nozzle geometry
scaling
}

 latentHeat: This is a simplification of the latent heat of CO2


during phase change (liquid to gas). You can refine it by
researching or finding reliable values based on CO2's phase
transition characteristics.
 rhotheta: A specific equation of state (EOS) for compressible
fluids will model the density-temperature relationship.
OpenFOAM provides an option for real gas models, which is
crucial for CO2 near its critical point.

2. Boundary Conditions for Phase Change and Jet

Expansion

We will set boundary conditions on the velocity, pressure, and


temperature fields to ensure that the phase change, jet dynamics,
and expansion of CO2 are captured correctly. These settings
assume that CO2 enters as a high-pressure liquid, and the nozzle
expands into the ambient environment where it undergoes phase
change.

0/alpha1 (Phase Fraction Field)

This field defines the phase distribution (liquid vs gas) in the


domain. At the inlet, we set the liquid phase (alpha1 = 1) and at
the outlet, CO2 transitions to gas.

// 0/alpha1
internalField uniform 1; // Inlet: liquid CO2
boundaryField
{
inlet
{
type fixedValue;
value uniform 1; // Liquid CO2 at the nozzle inlet
}
outlet
{
type zeroGradient;
}
walls
{
type noSlip;
}
}

0/velocity (Velocity Field)

At the nozzle inlet, CO2 will be ejected at a high velocity. This


boundary condition is set with a uniform value. The velocity should
match the physical conditions for high-pressure CO2 flow.

// 0/velocity
internalField uniform (10 0 0); // Jet velocity (example: 10 m/s in
the x-direction)
boundaryField
{
inlet
{
type fixedValue;
value uniform (10 0 0); // Jet velocity at the nozzle inlet
}
outlet
{
type zeroGradient;
}
walls
{
type noSlip;
}
}

0/pressure (Pressure Field)

The pressure at the nozzle inlet will be very high (CO2 in liquid
state). After phase change, the pressure at the outlet will decrease
as the gas CO2 expands.
// 0/pressure
internalField uniform 50e5; // High pressure of CO2 at the nozzle
inlet (50 MPa)
boundaryField
{
inlet
{
type fixedValue;
value uniform 50e5; // Inlet pressure (50 MPa)
}
outlet
{
type zeroGradient;
}
walls
{
type noSlip;
}
}

0/temperature (Temperature Field)

For CO2 to undergo phase change, it must have an initial


temperature corresponding to its liquid state. The temperature
should match the conditions near CO2’s critical point.

// 0/temperature
internalField uniform 300; // Initial temperature (in Kelvin)
boundaryField
{
inlet
{
type fixedValue;
value uniform 300; // Inlet temperature
}
outlet
{
type zeroGradient;
}
walls
{
type noSlip;
}
}
3. Mesh Refinement

To capture the jet expansion, nozzle flow, and phase transition


accurately, we need to refine the mesh around the nozzle and within
the region where phase change occurs. Use blockMesh and/or
snappyHexMesh to generate a high-resolution mesh.

Here’s an example of how you might want to refine the mesh near
the nozzle using blockMesh:

// constant/polyMesh/blockMeshDict

convertToMeters 1;

vertices
(
(0 0 0) // 0: Bottom left corner
(10 0 0) // 1: Bottom right corner
(10 5 0) // 2: Top right corner
(0 5 0) // 3: Top left corner
(2 2 0) // 4: Nozzle start (center)
(3 2 0) // 5: Nozzle outlet (small opening)
(3 3 0) // 6: Nozzle outlet (expanded opening)
(2 3 0) // 7: Nozzle start (expanded opening)
);

blocks
(
hex (0 1 2 3 4 5 6 7) (100 50 1) simpleGrading (1 1 1)
);

boundary
{
inlet
{
type fixedValue;
value uniform 1;
faces
(
(0 4 7 3)
);
}
outlet
{
type zeroGradient;
faces
(
(1 2 6 5)
);
}
walls
{
type wall;
faces
(
(0 1 2 3)
(4 5 6 7)
);
}
}

mergePatchPairs ();

 Mesh refinement around the nozzle will ensure accurate


representation of the phase change dynamics and the sharp
pressure drop in the jet.

4. Additional Models for Latent Heat and Phase

Change

For accurate modeling of the latent heat of phase change and


cooling effects, you may need to adjust or implement specific phase
change models. This involves:

 Latent Heat: As CO2 transitions from liquid to gas, it absorbs


heat from the surrounding solid propellant. You can model this
heat transfer through the latent heat model (already
specified in the thermophysicalProperties file).
 Energy Equation: Ensure the energy equation is activated in
your solver to capture the heat exchange and cooling effects.

In OpenFOAM, the energy equation is typically enabled by default in


compressible solvers like rhoReactingTwoPhaseEulerFoam. If you
need a more sophisticated model, you may need to extend the
solver with custom terms to better capture the interaction between
CO2 and the propellant.

Running the Simulation

1. Mesh Generation: Run blockMesh (or snappyHexMesh for


more complex geometries) to generate the mesh.
2. blockMesh
3. Solving: Use rhoReactingTwoPhaseEulerFoam to solve the
simulation.
4. rhoReactingTwoPhaseEulerFoam
5. Post-Processing: Use ParaView to visualize the results,
focusing on the phase change region and the interaction
between the CO2 jet and the solid propellant.
6. paraFoam

Conclusion

By modifying the thermophysical properties of CO2, refining the


mesh near the nozzle, and defining the correct boundary conditions,
OpenFOAM can simulate the high-pressure CO2 jet slicing a solid
propellant, while accounting for the cooling effects and phase
change. These modifications should enable you to accurately model
the cooling behavior of CO2 compared to water, with minimal
changes needed to the existing solvers.

Let me know if you need any further assistance with the


implementation or

You might also like