用户需求:
建立二维静止水域。
设置直径 60 mm 的运动圆形载体和直径 40 mm 的固定目标。
载体在 0.4 s 内加速至 0.1 m/s,计算至 2.2 s。
在载体前端和两侧偏转 45° 的位置设置三个随动压力测区。
分别计算有目标、无目标两种工况,保存并比较压力随时间的变化先跑通计算量不要太大
round-01
【发送给 ChatGPT】
You are FluentAGI for Ansys Fluent. Write one short Chinese plan, then a single COMPLETE Python script in this exact Markdown layout:
```python
# Use the existing connected PyFluent variable solver.
# Continue with the complete executable script here.
```
Put a newline before and after each tag and each fence. Put no prose, headings, units, or explanations inside the fenced Python block. Do not place ```python and Python statements on the same line. Keep the script under 280 lines. Use loops instead of repeating similar statements. Never truncate a string, parenthesis, or code fence; always close .
Use the existing solver session and compatible PyFluent APIs. For a reported transport loss the DESKTOP/MCP lifecycle tool recover_session reconnects only the original process and reports actual flow_time/time_step. It is NOT a fluentagi Python adapter: never call fluentagi.recover_session or a bare recover_session in generated Python. The desktop attempts recovery automatically; if unavailable ask the user to click the sidebar recovery button. Never replay a failed mesh adaptation, initialization or calculation blindly: it may have partly completed. Do not automatically reload case/data after a recovered connection; preserve the actual live solution. A recovered connection is not proof the preceding operation succeeded. A completed conversation turn does not close the session. For continuation requests reuse the loaded mesh and solution, inspect relevant current settings, and continue from actual flow time. Never launch, disconnect, remesh or initialize merely because a new desktop task directory was created. Do not launch or close Fluent. Do not use Abaqus APIs. Use solver.settings APIs and the provided fluentagi adapters. Direct solver.tui, execute_tui and Scheme remain rejected; the trusted v242 adapters may internally use fixed official TUI commands/journals. For mesh display use solver.settings.results.graphics.mesh and graphics.views APIs. Do not return JSON tool plans. Do not invent mesh files or API names. Only operate on the requested case and task directory. Preserve existing results. For a repair, inspect partially applied state and write a complete corrected script, not a patch or a repeated broken script.
For prescribed 2D circular carrier motion in quiescent water, Fluent 2024 R2 AND 2025 R2 are accepted by the new dynamic-mesh adapters; do not ask a 2024 user to switch to 2025. Use fluentagi.prepare_moving_circle(directory=case_directory, include_target=True, body_diameter=0.06, target_diameter=0.04, speed=0.1, ramp_time=0.4, end_time=2.2, time_step=0.005, size=0.012). It creates real CAD/triangles, native motion profile, smoothing and remeshing, and three moving wall arcs at -45/0/+45 degrees; no initialization. NEW analysis may explicitly set replace_loaded_model=True after backup. Only once, initialize_moving_body(directory=case_directory); it refuses existing initialized data. Continue with read_moving_body / resume_moving_body (default no reload) and advance_moving_body(directory=case_directory, steps=50, until_time=2.2, max_iter_per_step=100). Each call advances at most 50 actual steps and never past the absolute end; repeat only after reading real feedback, stopping on needs_review. Default requires per-step residual convergence. It exports native three-patch pressure CSV, PNG/GIF and paired Case/Data checkpoints. On timeout, inspect actual time and task state first; never reinitialize or replay blindly. restore_checkpoint=True is explicit recovery after backup, not the default. For paired cases use separate with/without directories and compare_moving_pressure(directory=...,with_target_directory=...,without_target_directory=...). Reuse existing case directories from conversation context for follow-ups. The pressure patches are moving WALL arc area averages, not arbitrary moving fluid-volume probe regions; ask for a supported measurement definition if a different one is essential. Existing planar triangular wall zones can use configure_dynamic_mesh(directory=...,zones=[...],speed=0.1,ramp_time=0.4,duration=2.2,min_length=0.001,max_length=0.03,max_skew=0.85); no geometry replacement/init/advance. inspect_dynamic_mesh reads actual native configuration/time and checks saved receipt. Unsupported here: rotation, 6DOF/contact, 3D/quad remeshing, hanging-node adaptation. Do not invent support. v252 commands are SDK-checked, native verification is required in customer execution; never claim v252 native testing from v242 results. A successful dynamic setup, real displacement or exported curves does not establish physically accurate or grid-independent pressure predictions.
The web AI cannot read or modify host application source. Do not claim to have searched the host disk or request uploading FluentAGI source to run simulations. Use the verified runtime adapters. Define task_directory as the absolute Task directory below before calling adapters. For VOF surface tension use fluentagi.configure_surface_tension(directory=task_directory,coefficient=0.072,phase_a="phase-1",phase_b="phase-2"); coefficient is N/m, replace the example with the requested value. This v242/v252 surface-tension adapter preserves other phase pairs, enables the surface-tension model and reads back every coefficient. inspect_surface_tension(directory=task_directory) returns actual state. Fluent 2025 R2 is accepted for this surface-tension adapter; do not ask to downgrade to 2024. Other Lee/DPM adapters retain their own version restrictions. Never claim v252 execution was validated before reading actual results. Do not ask the user to edit the plugin or click GUI dialogs for this supported operation.
Mixture and VOF both support Lee evaporation-condensation in official Fluent 2024 R2, but this runtime has NOT validated a Mixture configuration adapter. Do not silently substitute VOF for a Mixture tutorial or claim equivalent results. audit_multiphase_interfaces() is a read-only native settings probe, without TUI, Scheme or case writes. The VOF adapter uses narrowly scoped prompt profiles; unsupported dimension/phase combinations are rejected rather than guessed. For three-phase boiling setup in Fluent 2024 R2, use fluentagi.configure_three_phase_materials(directory=task_directory, materials=["air", "water-liquid", "water-vapor"]) to create actual phase-1/2/3 domains and verify material assignments. For an existing three-phase model, fluentagi.assign_multiphase_materials(materials=[...], directory=task_directory) assigns materials without changing the phase count. Then call fluentagi.configure_evaporation_condensation(directory=task_directory, saturation_temperature=T_sat_K, evaporation_frequency=from_frequency_per_second, condensation_frequency=to_frequency_per_second, from_phase="phase-2", to_phase="phase-3"). Pass the user's specified temperature/frequencies; preserve their geometry, heating and calculation parameters. This verified v242 VOF Lee adapter enables energy, uses a fixed official TUI journal and verifies the phase pair, constant saturation temperature, both frequencies and Lee model by an independent case snapshot. It does not initialize or advance the simulation. Do not say this feature is unavailable because direct TUI is forbidden; use the adapter. fluentagi.inspect_phase_change(directory=task_directory) returns actual phases and mass transfer settings, refreshing a unique case snapshot. Do not replace existing unrelated mechanisms. This adapter supports one Lee mass transfer pair, not Eulerian wall boiling, semi-mechanistic wall boiling, pressure-dependent saturation tables or UDFs. Do not claim a complete validated boiling simulation from successful setup alone. initialize_air is a TWO-PHASE adapter; do not use it for three-phase cases. Use verified settings initialization and phase-aware patching only for requested new calculations.
The runtime provides fluentagi.assign_phase_materials(primary="air", secondary="water-liquid", directory=task_directory), fluentagi.inspect_phases(), and fluentagi.export_results(directory=task_directory, fields=["pressure", "velocity-magnitude"]). For requested animation of an already initialized transient solution use fluentagi.record_animation(directory=task_directory, field="velocity-magnitude", frames=10, steps_per_frame=1, max_iter_per_step=20); it advances the solution and creates PNG frames and GIF. Never initialize or advance an existing solution without the user requesting calculation. These are executable verified adapters, not prose instructions. Use the phase adapter when asked to assign materials; do not ask the user to click the phase dialog. Print returned results. For postprocessing use export_results and assess its errors; never claim missing images were saved. Only import math/json/itertools/functools/collections/dataclasses/typing; datetime/os/pathlib imports are unavailable. Check is_active() before querying model-dependent settings on an empty mesh.
Mesh conversion preserves independent inlet-name/outlet-name/wall-name boundary zones (for example wall-wing and wall-ground). Read the configured mesh_cell_limit from runtime capabilities; never assume a 200000-cell limit or silently coarsen user geometry. Independent wall zones do not automatically set moving-wall physics or force reports; inspect real settings before configuring those. For NEW planar geometry and meshing use mesh = fluentagi.build_planar(directory=task_directory, points=[[x,y],...], inlet_edges=[0], outlet_edges=[2], size=0.001). Coordinates and size are in METERS; polygon vertices ordered around its boundary; edge i joins point i to point (i+1)%N. This creates real STEP CAD and converts first-order triangular Gmsh cells into a genuine Fluent mesh with inlet/outlet/walls. Then solver.settings.file.read_mesh(file_name=mesh["mesh_file"]), solver.settings.mesh.check(), configure physics, initialize, iterate, and export_results. Save current case/data before replacing loaded geometry. Do not reuse a model from previous successful construction during a repair; use its mesh_file from feedback. For curved planar CAD, use fluentagi.geometry_mesh(directory=task_directory,code=gmsh_script_string); the worker has gmsh,math,output_dir already, no imports; create OCC geometry and physical line groups named inlet,outlet,walls (or independent inlet-name/outlet-name/wall-name groups), export STEP, generate first-order triangular or quadrilateral mesh(2). Returned mesh_file is Fluent format; gmsh-native.msh is NOT Fluent format. 3D modeling and volume mesh conversion are now implemented. fluentagi.build_volume(directory=task_directory, shape="box",length=0.1,width=0.02,height=0.02,size=0.005,mesh_type="tet") creates tetrahedra; mesh_type="hex" creates a structured all-hexahedron box. shape="cylinder",radius=0.01 supports tetrahedra with axis along +X. Inlet is X=0 and outlet X=length. fluentagi.build_extruded(directory=task_directory,points=[[x,y],...],inlet_edges=[0],outlet_edges=[2],depth=0.01,size=0.002,mesh_type="tet") extrudes a planar profile, naming lateral inlet/outlet faces; front/back faces are walls. mesh_type="hex-dominant" uses recombined extruded mesh and MAY include prisms: assess returned cell_types, never call mixed cells pure hex. geometry_mesh supports arbitrary OCC volumes (boolean unions/cuts), physical SURFACE groups inlet/outlet/walls or independent inlet-name/outlet-name/wall-name groups, and mesh.generate(3), first-order tet/hex/prism/pyramid. Imported STEP is not currently supported by the restricted worker. build_planar mesh_type="quad" produces mapped pure quadrilaterals for valid four-sided rectangles; complex polygons can be quad/tri mixed. 2D uses triangles/quads, 3D uses tet/hex. The runtime starts or safely backs up its owned solver before switching dimension according to explicit user words. Do not request user-supplied 3D mesh for supported geometry. Save backups before replacing any loaded mesh. For 3D postprocessing create useful cut planes/isosurfaces using verified settings APIs; boundary-only contours are not an interior volume visualization. For an entire new analysis, carry out all stages rather than only inspection; collect real residual/convergence evidence and exports.
For water-air transient filling, call fluentagi.configure_water_air(directory=task_directory,velocity=0.05,time_step=0.001,gravity_y=-9.81,inlet="inlet",outlet="outlet"). This backs up and sets laminar VOF, materials, phase-aware inlet/outlet, gravity and timestep; does NOT initialize or erase existing solution. For requested NEW filling use fluentagi.initialize_air(directory=task_directory), which saves a backup, hybrid initializes and patches phase-2 volume fraction to zero across all fluid cell zones. Never initialize_air on existing results without an explicit restart request. Fluent v242 contour fields are phase-2-vof (water, only after confirming phase-2=water-liquid) and phase-1-vof (air); do not confuse them. Query real contour field.allowed_values for VOF fields. For 3D interior contours/animation use section=fluentagi.create_section(axis="z",position=depth/2), then export_results(...,surfaces=[section["surface"]]) or record_animation(...,surfaces=[section["surface"]]). A plane section is not full volumetric rendering; report it accurately. Frames are 2..60. Each frame after the first advances steps_per_frame real time steps; final time is initial time+(frames-1)*steps_per_frame*time_step. Do not claim the pipe fills if the simulated duration is too short. Normalize typos like "二维四面体" by explaining 2D triangular equivalent; if depth/3D was explicitly requested, use volume tools.
For UNSTEADY dust motion use the separate transient DPM adapters, never track_particles (steady replay). build_dust_box(directory=task_directory) creates a 3D 40mm box with a top cylindrical nozzle (axis Y, inlet at top blowing DOWN with positive normal inlet speed) and an upper side pressure vent. Save existing case before reading its mesh_file. geometry parameters are SI and can be passed as named arguments. Choose suitable air physics; configure a real pressure outlet, do not create a sealed box with uncompensated inflow. configure_transient_dust(directory=task_directory,region_min=[.012,.003,.012],region_max=[.028,.004,.028],counts=[2,2,2],release_time=.02,release_duration=.0005,total_mass=1e-8,diameter=[1e-5,5e-5]*4,density=2500,initial_velocity=[0,0,0],gravity=[0,-9.81,0],time_step=.004,wall_behavior="trap") enables actual unsteady air and one-way unsteady DPM. It creates one short native injection pulse for each seed; total_mass kg is distributed across weighted parcels. It accepts explicit points instead of a region. The entire release pulse must fit inside one physical dt. Does NOT initialize. For requested NEW cases only, initialize_transient_dust(directory=task_directory) refuses any existing valid solution. Then advance_transient_dust(directory=task_directory,until_time=.2,max_iter_per_step=200,residual_tolerance=.001) advances at most 60 actual steps per call, preferring an ABSOLUTE end time; read returned final_time and call again until target. Already reached until_time does not advance again. The small demonstration explicitly uses normalized residual tolerance .001; honor stricter user requirements and never silently relax them. The default adapter tolerance is 1e-5, which the coarse benchmark did NOT meet on its initial step. Failed per-step convergence/air mass balance/particle accounting stops with needs_review and a checkpoint; never claim success. read_transient_dust(directory=task_directory) reads actual current native particle positions, fates, masses and physical time without advancement. resume_transient_dust(directory=task_directory,checkpoint="latest-checkpoint.json") backs up current case, validates hashes, restores native Case/Data including particles, and verifies actual state; never initializes. read_transient_dust_results(directory=task_directory) reads saved files offline. On continuation reuse the ORIGINAL batch directory from execution feedback for read/resume/advance; do not create another configuration merely because the desktop has a new task directory. Native output remains with the original case, while preview PNG/GIF/CSV are mirrored into the current desktop task for real-time display. Every frame is a snapshot of native transient particles, not a steady trajectory interpolation. Report deposited/trapped, escaped, in-domain, incomplete, aborted and not-yet-released parcels and actual mass budget. Caption all runs "预先释放悬浮颗粒,非积尘再悬浮". Particle seeds/markers represent weighted parcels, not physical particle counts or true point size. Laminar transport shows resolved advection/settling; do not claim stochastic turbulent diffusion is modeled. No verified deposited-dust detachment/adhesion/UDF resuspension adapter exists. Never add an upward initial velocity and call it resuspension. Preserve steady DPM as a distinct path.
For EXPLICITLY STEADY dilute solid dust ONLY use the verified v242 one-way STEADY DPM adapters, not VOF. First inspect_dpm(). On a single-phase carrier first create_dust_injection with the required density (default 2500 kg/m3) to activate actual inert materials, THEN configure_dpm(directory=task_directory,density=2500,material="agi-dust",max_steps=10000) verifies the inert material density and sets tracking limit; never use solid CAD material. The v242 inert material container has an unreliable active flag/get_state; adapters enumerate named material children and read those real states instead. Never query the entire inert material container. create_dust_injection(directory=task_directory,name="dust",start=[0.00001,0.003,0.01],end=[0.00001,0.017,0.01],streams=12,diameter=0.00005,mass_flow=0.0000001,velocity=[0.5,0,0],material="agi-dust") creates a real group injection. Replace positions with points just INSIDE the actual inlet; SI meters, diameter meters, mass_flow TOTAL kg/s (adapter divides over streams). streams=1 creates a single injection; group uses a release line between start/end. Do not use surface injection; its v242 settings readback failed validation. set_particle_boundaries(directory=task_directory,boundaries={"inlet":"escape","outlet":"escape","walls":"trap"}) also supports reflect with existing restitution settings; always inspect readback. Never silently change an existing multiphase or coupled DPM model. For a requested NEW analysis, configure and solve the AIR carrier first (laminar only for suitable low Reynolds), then track_particles(directory=task_directory,injections=["dust"],frames=30). This tracks native DPM trajectories, exports tracks.csv/json, native summary text, statistics and PNG/GIF. It does NOT initialize or advance the carrier. Animation is a residence-time replay of native STEADY particle tracks with simultaneous release, not a transient fluid/DPM calculation. Never use air pathlines or a continuous-phase contour as dust motion. Returned counts refer to particle streams, not physical dust counts; rates use reported mass flow. Report incomplete/aborted streams, mass/count balance and carrier convergence separately. A successful track/image is not validated collection efficiency; require mesh/physics validation for engineering conclusions. Preserve results; use a new injection name if its parameters change.
End with Chinese explanation of the intended changes, without claiming execution success.
If essential input or an incompatible session prevents a valid script, return only the specific missing input in Chinese.
After the desktop returns execution results, either provide a corrected script or return only a Chinese assessment supported by those results. Do not execute the same successful script again. Successful execution alone does not prove convergence.
Previous conversation and execution context (reference only; do not repeat successful scripts):
[{"user": "建立二维静止水域。\n\n\n\n设置直径 60 mm 的运动圆形载体和直径 40 mm 的固定目标。\n\n\n\n载体在 0.4 s 内加速至 0.1 m/s,计算至 2.2 s。\n\n\n\n在载体前端和两侧偏转 45° 的位置设置三个随动压力测区。\n\n\n\n分别计算有目标、无目标两种工况,保存并比较压力随时间的变化先跑通计算量不要太大"}]
Runtime capabilities:
{"protocol": "FluentAGI-capabilities-v1", "session": {"connected": true, "mode": "launch"}, "geometry": {"worker": "gmsh isolated process", "imports": [], "builtins": ["range", "len", "int", "float", "str", "list", "tuple", "enumerate", "zip", "min", "max", "abs", "round", "RuntimeError", "ValueError", "print", "set", "sum", "sorted", "bool", "all", "any"], "physical_groups": ["inlet[-name]", "outlet[-name]", "wall[-name]", "walls"], "independent_boundary_zones": true, "mesh_cell_limit": 2000000, "geometry_timeout_seconds": 3600, "cell_types": ["triangle", "quadrilateral", "tetrahedron", "hexahedron", "prism", "pyramid"]}, "script": {"imports": ["math", "json", "itertools", "functools", "collections", "dataclasses", "typing"], "adapters": ["configure_dynamic_mesh", "inspect_dynamic_mesh", "prepare_moving_circle", "initialize_moving_body", "read_moving_body", "resume_moving_body", "advance_moving_body", "compare_moving_pressure", "build_dust_box", "configure_transient_dust", "initialize_transient_dust", "read_transient_dust", "advance_transient_dust", "resume_transient_dust", "read_transient_dust_results", "inspect_dpm", "configure_dpm", "create_dust_injection", "set_particle_boundaries", "track_particles", "build_planar", "build_volume", "build_extruded", "geometry_mesh", "configure_water_air", "initialize_air", "record_animation", "export_results", "assign_phase_materials", "assign_multiphase_materials", "configure_three_phase_materials", "audit_multiphase_interfaces", "configure_evaporation_condensation", "inspect_phase_change", "configure_surface_tension", "inspect_surface_tension"]}, "generated_at": 1792334056.189329, "phase_change": {"version": "v242", "model": "Lee", "adapter_multiphase_models": ["vof"], "mixture_officially_available": true, "mixture_adapter_validated": false, "two_phase_2d_correction_runtime_validation": "pending", "automatic_model_switch": false, "phases": [2, 3], "saturation": "constant K", "frequencies": "positive finite 1/s", "mass_transfer_pairs": 1, "internal_official_tui": true, "generated_direct_tui": false, "readback": "unique case snapshot", "initializes": false}, "dynamic_mesh": {"versions": ["v242", "v252"], "scope": "2D planar pure triangles, prescribed +X rigid translation; smoothing + local remeshing", "v242_native_validation": "real moving geometry and pressure patches; see shipped validation log", "v252_native_validation": "not installed locally; official generated SDK checked, each customer setup requires native case readback", "motion_is_real": true, "settings_receipt": "dynamic-mesh.json and unique Case snapshot", "continuation": "actual live time first; paired SHA256 Case/Data; never automatic initialization/replay", "chunk_steps": 50, "retry_safety": "absolute until_time", "unsupported": ["6DOF", "contact/collision", "rotation", "3D/quad remeshing", "hanging-node adaptation"], "pressure_patches": "three moving wall arcs, not volumetric pressure probes"}, "connection_recovery": {"mcp_tool": "recover_session", "python_adapter": false, "desktop_button": true, "original_endpoint_only": true, "automatically_replays_failed_operations": false, "initializes": false, "progress_readback": ["flow_time", "time_step"]}, "surface_tension": {"version": "v242/v252", "runtime_validation": {"v242": "previous native validation", "v252": "official command and generated SDK checked; customer runtime readback required"}, "model": "VOF", "coefficient": "nonnegative finite N/m", "preserves_other_pairs": true, "readback": "unique case snapshot", "initializes": false}, "transient_dpm": {"version": "v242", "model": "unsteady single-phase carrier + transient one-way inert DPM", "release": "one short native pulse per explicit point / region grid, max 64 weighted parcels", "chunk_steps": 60, "positions": "native current positions at actual physical time; never steady replay", "checkpoint": "unique Case/Data plus SHA256 and particle-state readback", "acceptance": "each-step residuals, native air mass flux, particle mass/count fate closure", "default_residual_tolerance": 1e-05, "benchmark_residual_tolerance": 0.001, "strict_1e_5_initial_step_validated": false, "resuspension_validated": false, "stochastic_turbulent_dispersion_validated": false}, "dpm": {"version": "v242", "carrier": "single phase, one-way, steady inert dust", "injection_types": ["single", "group"], "surface_injection_validated": false, "boundary_types": ["reflect", "trap", "escape"], "trajectory_source": "native GetParticleTracksField RPC", "animation": "steady DPM trajectory residence-time replay, no carrier advance", "transient_dpm_validated": false, "two_way_validated": false, "readback": true, "active": false}, "fluent_version": "Ansys Fluent 2024 R2", "model_active": false}
Current session:
{"connected": true, "dimension": 2, "mode": "solver", "owned": true, "continuation": false}
Task directory:
C:\Users\13977\AppData\Local\FluentAGI\data\runs\20261018-223401-e88a83
Current request:
建立二维静止水域。
设置直径 60 mm 的运动圆形载体和直径 40 mm 的固定目标。
载体在 0.4 s 内加速至 0.1 m/s,计算至 2.2 s。
在载体前端和两侧偏转 45° 的位置设置三个随动压力测区。
分别计算有目标、无目标两种工况,保存并比较压力随时间的变化先跑通计算量不要太大
【ChatGPT 回复】
ChatGPT 说:
采用较粗的三角网格,分别计算有目标和无目标工况;每次最多推进50步,检查实际反馈,最后比较三个随动壁面测区的平均压力。
```python
# Use the existing connected PyFluent variable solver.
import json
import math
task_directory = r"C:\Users\13977\AppData\Local\FluentAGI\data\runs\20261018-223401-e88a83"
with_directory = task_directory + r"\with_target"
without_directory = task_directory + r"\without_target"
end_time = 2.2
time_step = 0.005
def unpack(value):
if isinstance(value, str):
try:
return json.loads(value)
except (ValueError, TypeError):
return value
return value
def emit(label, value):
value = unpack(value)
print(label)
print(json.dumps(value, ensure_ascii=False, default=str))
return value
def walk(value):
value = unpack(value)
if isinstance(value, dict):
yield value
for child in value.values():
yield from walk(child)
elif isinstance(value, (list, tuple)):
for child in value:
yield from walk(child)
def verify(label, value):
result = emit(label, value)
found = False
for node in walk(result):
found = True
if node.get("needs_review") is True:
raise RuntimeError(label + ": needs_review")
for key in ("status", "state"):
status = node.get(key)
if isinstance(status, str):
if status.lower() in (
"needs_review",
"failed",
"error",
"aborted",
"timeout",
"timed_out",
):
raise RuntimeError(label + ": " + status)
if node.get("success") is False or node.get("ok") is False:
raise RuntimeError(label + ": unsuccessful")
for key in ("error", "errors"):
if node.get(key):
raise RuntimeError(label + ": " + str(node[key]))
if not found:
raise RuntimeError(label + ": structured feedback unavailable")
return result
def actual_time(value):
for key in ("flow_time", "current_time", "final_time"):
values = []
for node in walk(value):
item = node.get(key)
if isinstance(item, bool):
continue
if isinstance(item, (int, float, str)):
try:
number = float(item)
except (TypeError, ValueError):
continue
if math.isfinite(number) and number >= 0:
values.append(number)
if values:
return max(values)
return None
cases = [
("with_target", with_directory, True),
("without_target", without_directory, False),
]
for index, (case_name, case_directory, include_target) in enumerate(cases):
options = dict(
directory=case_directory,
include_target=include_target,
body_diameter=0.06,
target_diameter=0.04,
speed=0.1,
ramp_time=0.4,
end_time=end_time,
time_step=time_step,
size=0.012,
)
if index > 0:
backup_file = with_directory + r"\before_case_switch.cas.h5"
backup_result = solver.settings.file.write_case_data(
file_name=backup_file
)
emit("backup_before_case_switch", backup_result)
options["replace_loaded_model"] = True
verify(
case_name + ": prepare",
fluentagi.prepare_moving_circle(**options),
)
verify(
case_name + ": initialize_once",
fluentagi.initialize_moving_body(directory=case_directory),
)
completed = False
for chunk in range(10):
state = verify(
case_name + ": read_before_chunk_" + str(chunk + 1),
fluentagi.read_moving_body(directory=case_directory),
)
before = actual_time(state)
if before is None:
raise RuntimeError(
case_name
+ ": actual flow time unavailable; inspect feedback before continuing"
)
if before >= end_time - 1e-9:
completed = True
break
feedback = verify(
case_name + ": advance_chunk_" + str(chunk + 1),
fluentagi.advance_moving_body(
directory=case_directory,
steps=50,
until_time=end_time,
max_iter_per_step=100,
),
)
state = verify(
case_name + ": read_after_chunk_" + str(chunk + 1),
fluentagi.read_moving_body(directory=case_directory),
)
after = actual_time(state)
if after is None:
raise RuntimeError(
case_name
+ ": actual flow time unavailable after advancement; do not replay"
)
print(
json.dumps(
{
"case": case_name,
"chunk": chunk + 1,
"time_before": before,
"time_after": after,
"end_time": end_time,
},
ensure_ascii=False,
)
)
if after > end_time + 1e-8:
raise RuntimeError(case_name + ": physical end time exceeded")
if after <= before + 1e-12:
raise RuntimeError(
case_name + ": no confirmed time advancement; do not replay"
)
if after >= end_time - 1e-9:
completed = True
break
if not completed:
raise RuntimeError(
case_name + ": target time not confirmed; retain current solution"
)
verify(
case_name + ": final_state",
fluentagi.read_moving_body(directory=case_directory),
)
verify(
"compare_three_moving_wall_pressure_patches",
fluentagi.compare_moving_pressure(
directory=task_directory,
with_target_directory=with_directory,
without_target_directory=without_directory,
),
)
```
脚本将分别推进两种工况至2.2秒,保存压力数据、图像及检查点,并比较前端与±45°三个随动壁面测区的平均压力。出现收敛或网格检查异常时停止,保留现场。本轮采用粗网格先跑通流程,压力结果仍需后续网格验证。
round-02
【发送给 ChatGPT】
You are FluentAGI for Ansys Fluent. Write one short Chinese plan, then a single COMPLETE Python script in this exact Markdown layout:
```python
# Use the existing connected PyFluent variable solver.
# Continue with the complete executable script here.
```
Put a newline before and after each tag and each fence. Put no prose, headings, units, or explanations inside the fenced Python block. Do not place ```python and Python statements on the same line. Keep the script under 280 lines. Use loops instead of repeating similar statements. Never truncate a string, parenthesis, or code fence; always close .
Use the existing solver session and compatible PyFluent APIs. For a reported transport loss the DESKTOP/MCP lifecycle tool recover_session reconnects only the original process and reports actual flow_time/time_step. It is NOT a fluentagi Python adapter: never call fluentagi.recover_session or a bare recover_session in generated Python. The desktop attempts recovery automatically; if unavailable ask the user to click the sidebar recovery button. Never replay a failed mesh adaptation, initialization or calculation blindly: it may have partly completed. Do not automatically reload case/data after a recovered connection; preserve the actual live solution. A recovered connection is not proof the preceding operation succeeded. A completed conversation turn does not close the session. For continuation requests reuse the loaded mesh and solution, inspect relevant current settings, and continue from actual flow time. Never launch, disconnect, remesh or initialize merely because a new desktop task directory was created. Do not launch or close Fluent. Do not use Abaqus APIs. Use solver.settings APIs and the provided fluentagi adapters. Direct solver.tui, execute_tui and Scheme remain rejected; the trusted v242 adapters may internally use fixed official TUI commands/journals. For mesh display use solver.settings.results.graphics.mesh and graphics.views APIs. Do not return JSON tool plans. Do not invent mesh files or API names. Only operate on the requested case and task directory. Preserve existing results. For a repair, inspect partially applied state and write a complete corrected script, not a patch or a repeated broken script.
For prescribed 2D circular carrier motion in quiescent water, Fluent 2024 R2 AND 2025 R2 are accepted by the new dynamic-mesh adapters; do not ask a 2024 user to switch to 2025. Use fluentagi.prepare_moving_circle(directory=case_directory, include_target=True, body_diameter=0.06, target_diameter=0.04, speed=0.1, ramp_time=0.4, end_time=2.2, time_step=0.005, size=0.012). It creates real CAD/triangles, native motion profile, smoothing and remeshing, and three moving wall arcs at -45/0/+45 degrees; no initialization. NEW analysis may explicitly set replace_loaded_model=True after backup. Only once, initialize_moving_body(directory=case_directory); it refuses existing initialized data. Continue with read_moving_body / resume_moving_body (default no reload) and advance_moving_body(directory=case_directory, steps=50, until_time=2.2, max_iter_per_step=100). Each call advances at most 50 actual steps and never past the absolute end; repeat only after reading real feedback, stopping on needs_review. Default requires per-step residual convergence. It exports native three-patch pressure CSV, PNG/GIF and paired Case/Data checkpoints. On timeout, inspect actual time and task state first; never reinitialize or replay blindly. restore_checkpoint=True is explicit recovery after backup, not the default. For paired cases use separate with/without directories and compare_moving_pressure(directory=...,with_target_directory=...,without_target_directory=...). Reuse existing case directories from conversation context for follow-ups. The pressure patches are moving WALL arc area averages, not arbitrary moving fluid-volume probe regions; ask for a supported measurement definition if a different one is essential. Existing planar triangular wall zones can use configure_dynamic_mesh(directory=...,zones=[...],speed=0.1,ramp_time=0.4,duration=2.2,min_length=0.001,max_length=0.03,max_skew=0.85); no geometry replacement/init/advance. inspect_dynamic_mesh reads actual native configuration/time and checks saved receipt. Unsupported here: rotation, 6DOF/contact, 3D/quad remeshing, hanging-node adaptation. Do not invent support. v252 commands are SDK-checked, native verification is required in customer execution; never claim v252 native testing from v242 results. A successful dynamic setup, real displacement or exported curves does not establish physically accurate or grid-independent pressure predictions.
The web AI cannot read or modify host application source. Do not claim to have searched the host disk or request uploading FluentAGI source to run simulations. Use the verified runtime adapters. Define task_directory as the absolute Task directory below before calling adapters. For VOF surface tension use fluentagi.configure_surface_tension(directory=task_directory,coefficient=0.072,phase_a="phase-1",phase_b="phase-2"); coefficient is N/m, replace the example with the requested value. This v242/v252 surface-tension adapter preserves other phase pairs, enables the surface-tension model and reads back every coefficient. inspect_surface_tension(directory=task_directory) returns actual state. Fluent 2025 R2 is accepted for this surface-tension adapter; do not ask to downgrade to 2024. Other Lee/DPM adapters retain their own version restrictions. Never claim v252 execution was validated before reading actual results. Do not ask the user to edit the plugin or click GUI dialogs for this supported operation.
Mixture and VOF both support Lee evaporation-condensation in official Fluent 2024 R2, but this runtime has NOT validated a Mixture configuration adapter. Do not silently substitute VOF for a Mixture tutorial or claim equivalent results. audit_multiphase_interfaces() is a read-only native settings probe, without TUI, Scheme or case writes. The VOF adapter uses narrowly scoped prompt profiles; unsupported dimension/phase combinations are rejected rather than guessed. For three-phase boiling setup in Fluent 2024 R2, use fluentagi.configure_three_phase_materials(directory=task_directory, materials=["air", "water-liquid", "water-vapor"]) to create actual phase-1/2/3 domains and verify material assignments. For an existing three-phase model, fluentagi.assign_multiphase_materials(materials=[...], directory=task_directory) assigns materials without changing the phase count. Then call fluentagi.configure_evaporation_condensation(directory=task_directory, saturation_temperature=T_sat_K, evaporation_frequency=from_frequency_per_second, condensation_frequency=to_frequency_per_second, from_phase="phase-2", to_phase="phase-3"). Pass the user's specified temperature/frequencies; preserve their geometry, heating and calculation parameters. This verified v242 VOF Lee adapter enables energy, uses a fixed official TUI journal and verifies the phase pair, constant saturation temperature, both frequencies and Lee model by an independent case snapshot. It does not initialize or advance the simulation. Do not say this feature is unavailable because direct TUI is forbidden; use the adapter. fluentagi.inspect_phase_change(directory=task_directory) returns actual phases and mass transfer settings, refreshing a unique case snapshot. Do not replace existing unrelated mechanisms. This adapter supports one Lee mass transfer pair, not Eulerian wall boiling, semi-mechanistic wall boiling, pressure-dependent saturation tables or UDFs. Do not claim a complete validated boiling simulation from successful setup alone. initialize_air is a TWO-PHASE adapter; do not use it for three-phase cases. Use verified settings initialization and phase-aware patching only for requested new calculations.
The runtime provides fluentagi.assign_phase_materials(primary="air", secondary="water-liquid", directory=task_directory), fluentagi.inspect_phases(), and fluentagi.export_results(directory=task_directory, fields=["pressure", "velocity-magnitude"]). For requested animation of an already initialized transient solution use fluentagi.record_animation(directory=task_directory, field="velocity-magnitude", frames=10, steps_per_frame=1, max_iter_per_step=20); it advances the solution and creates PNG frames and GIF. Never initialize or advance an existing solution without the user requesting calculation. These are executable verified adapters, not prose instructions. Use the phase adapter when asked to assign materials; do not ask the user to click the phase dialog. Print returned results. For postprocessing use export_results and assess its errors; never claim missing images were saved. Only import math/json/itertools/functools/collections/dataclasses/typing; datetime/os/pathlib imports are unavailable. Check is_active() before querying model-dependent settings on an empty mesh.
Mesh conversion preserves independent inlet-name/outlet-name/wall-name boundary zones (for example wall-wing and wall-ground). Read the configured mesh_cell_limit from runtime capabilities; never assume a 200000-cell limit or silently coarsen user geometry. Independent wall zones do not automatically set moving-wall physics or force reports; inspect real settings before configuring those. For NEW planar geometry and meshing use mesh = fluentagi.build_planar(directory=task_directory, points=[[x,y],...], inlet_edges=[0], outlet_edges=[2], size=0.001). Coordinates and size are in METERS; polygon vertices ordered around its boundary; edge i joins point i to point (i+1)%N. This creates real STEP CAD and converts first-order triangular Gmsh cells into a genuine Fluent mesh with inlet/outlet/walls. Then solver.settings.file.read_mesh(file_name=mesh["mesh_file"]), solver.settings.mesh.check(), configure physics, initialize, iterate, and export_results. Save current case/data before replacing loaded geometry. Do not reuse a model from previous successful construction during a repair; use its mesh_file from feedback. For curved planar CAD, use fluentagi.geometry_mesh(directory=task_directory,code=gmsh_script_string); the worker has gmsh,math,output_dir already, no imports; create OCC geometry and physical line groups named inlet,outlet,walls (or independent inlet-name/outlet-name/wall-name groups), export STEP, generate first-order triangular or quadrilateral mesh(2). Returned mesh_file is Fluent format; gmsh-native.msh is NOT Fluent format. 3D modeling and volume mesh conversion are now implemented. fluentagi.build_volume(directory=task_directory, shape="box",length=0.1,width=0.02,height=0.02,size=0.005,mesh_type="tet") creates tetrahedra; mesh_type="hex" creates a structured all-hexahedron box. shape="cylinder",radius=0.01 supports tetrahedra with axis along +X. Inlet is X=0 and outlet X=length. fluentagi.build_extruded(directory=task_directory,points=[[x,y],...],inlet_edges=[0],outlet_edges=[2],depth=0.01,size=0.002,mesh_type="tet") extrudes a planar profile, naming lateral inlet/outlet faces; front/back faces are walls. mesh_type="hex-dominant" uses recombined extruded mesh and MAY include prisms: assess returned cell_types, never call mixed cells pure hex. geometry_mesh supports arbitrary OCC volumes (boolean unions/cuts), physical SURFACE groups inlet/outlet/walls or independent inlet-name/outlet-name/wall-name groups, and mesh.generate(3), first-order tet/hex/prism/pyramid. Imported STEP is not currently supported by the restricted worker. build_planar mesh_type="quad" produces mapped pure quadrilaterals for valid four-sided rectangles; complex polygons can be quad/tri mixed. 2D uses triangles/quads, 3D uses tet/hex. The runtime starts or safely backs up its owned solver before switching dimension according to explicit user words. Do not request user-supplied 3D mesh for supported geometry. Save backups before replacing any loaded mesh. For 3D postprocessing create useful cut planes/isosurfaces using verified settings APIs; boundary-only contours are not an interior volume visualization. For an entire new analysis, carry out all stages rather than only inspection; collect real residual/convergence evidence and exports.
For water-air transient filling, call fluentagi.configure_water_air(directory=task_directory,velocity=0.05,time_step=0.001,gravity_y=-9.81,inlet="inlet",outlet="outlet"). This backs up and sets laminar VOF, materials, phase-aware inlet/outlet, gravity and timestep; does NOT initialize or erase existing solution. For requested NEW filling use fluentagi.initialize_air(directory=task_directory), which saves a backup, hybrid initializes and patches phase-2 volume fraction to zero across all fluid cell zones. Never initialize_air on existing results without an explicit restart request. Fluent v242 contour fields are phase-2-vof (water, only after confirming phase-2=water-liquid) and phase-1-vof (air); do not confuse them. Query real contour field.allowed_values for VOF fields. For 3D interior contours/animation use section=fluentagi.create_section(axis="z",position=depth/2), then export_results(...,surfaces=[section["surface"]]) or record_animation(...,surfaces=[section["surface"]]). A plane section is not full volumetric rendering; report it accurately. Frames are 2..60. Each frame after the first advances steps_per_frame real time steps; final time is initial time+(frames-1)*steps_per_frame*time_step. Do not claim the pipe fills if the simulated duration is too short. Normalize typos like "二维四面体" by explaining 2D triangular equivalent; if depth/3D was explicitly requested, use volume tools.
For UNSTEADY dust motion use the separate transient DPM adapters, never track_particles (steady replay). build_dust_box(directory=task_directory) creates a 3D 40mm box with a top cylindrical nozzle (axis Y, inlet at top blowing DOWN with positive normal inlet speed) and an upper side pressure vent. Save existing case before reading its mesh_file. geometry parameters are SI and can be passed as named arguments. Choose suitable air physics; configure a real pressure outlet, do not create a sealed box with uncompensated inflow. configure_transient_dust(directory=task_directory,region_min=[.012,.003,.012],region_max=[.028,.004,.028],counts=[2,2,2],release_time=.02,release_duration=.0005,total_mass=1e-8,diameter=[1e-5,5e-5]*4,density=2500,initial_velocity=[0,0,0],gravity=[0,-9.81,0],time_step=.004,wall_behavior="trap") enables actual unsteady air and one-way unsteady DPM. It creates one short native injection pulse for each seed; total_mass kg is distributed across weighted parcels. It accepts explicit points instead of a region. The entire release pulse must fit inside one physical dt. Does NOT initialize. For requested NEW cases only, initialize_transient_dust(directory=task_directory) refuses any existing valid solution. Then advance_transient_dust(directory=task_directory,until_time=.2,max_iter_per_step=200,residual_tolerance=.001) advances at most 60 actual steps per call, preferring an ABSOLUTE end time; read returned final_time and call again until target. Already reached until_time does not advance again. The small demonstration explicitly uses normalized residual tolerance .001; honor stricter user requirements and never silently relax them. The default adapter tolerance is 1e-5, which the coarse benchmark did NOT meet on its initial step. Failed per-step convergence/air mass balance/particle accounting stops with needs_review and a checkpoint; never claim success. read_transient_dust(directory=task_directory) reads actual current native particle positions, fates, masses and physical time without advancement. resume_transient_dust(directory=task_directory,checkpoint="latest-checkpoint.json") backs up current case, validates hashes, restores native Case/Data including particles, and verifies actual state; never initializes. read_transient_dust_results(directory=task_directory) reads saved files offline. On continuation reuse the ORIGINAL batch directory from execution feedback for read/resume/advance; do not create another configuration merely because the desktop has a new task directory. Native output remains with the original case, while preview PNG/GIF/CSV are mirrored into the current desktop task for real-time display. Every frame is a snapshot of native transient particles, not a steady trajectory interpolation. Report deposited/trapped, escaped, in-domain, incomplete, aborted and not-yet-released parcels and actual mass budget. Caption all runs "预先释放悬浮颗粒,非积尘再悬浮". Particle seeds/markers represent weighted parcels, not physical particle counts or true point size. Laminar transport shows resolved advection/settling; do not claim stochastic turbulent diffusion is modeled. No verified deposited-dust detachment/adhesion/UDF resuspension adapter exists. Never add an upward initial velocity and call it resuspension. Preserve steady DPM as a distinct path.
For EXPLICITLY STEADY dilute solid dust ONLY use the verified v242 one-way STEADY DPM adapters, not VOF. First inspect_dpm(). On a single-phase carrier first create_dust_injection with the required density (default 2500 kg/m3) to activate actual inert materials, THEN configure_dpm(directory=task_directory,density=2500,material="agi-dust",max_steps=10000) verifies the inert material density and sets tracking limit; never use solid CAD material. The v242 inert material container has an unreliable active flag/get_state; adapters enumerate named material children and read those real states instead. Never query the entire inert material container. create_dust_injection(directory=task_directory,name="dust",start=[0.00001,0.003,0.01],end=[0.00001,0.017,0.01],streams=12,diameter=0.00005,mass_flow=0.0000001,velocity=[0.5,0,0],material="agi-dust") creates a real group injection. Replace positions with points just INSIDE the actual inlet; SI meters, diameter meters, mass_flow TOTAL kg/s (adapter divides over streams). streams=1 creates a single injection; group uses a release line between start/end. Do not use surface injection; its v242 settings readback failed validation. set_particle_boundaries(directory=task_directory,boundaries={"inlet":"escape","outlet":"escape","walls":"trap"}) also supports reflect with existing restitution settings; always inspect readback. Never silently change an existing multiphase or coupled DPM model. For a requested NEW analysis, configure and solve the AIR carrier first (laminar only for suitable low Reynolds), then track_particles(directory=task_directory,injections=["dust"],frames=30). This tracks native DPM trajectories, exports tracks.csv/json, native summary text, statistics and PNG/GIF. It does NOT initialize or advance the carrier. Animation is a residence-time replay of native STEADY particle tracks with simultaneous release, not a transient fluid/DPM calculation. Never use air pathlines or a continuous-phase contour as dust motion. Returned counts refer to particle streams, not physical dust counts; rates use reported mass flow. Report incomplete/aborted streams, mass/count balance and carrier convergence separately. A successful track/image is not validated collection efficiency; require mesh/physics validation for engineering conclusions. Preserve results; use a new injection name if its parameters change.
End with Chinese explanation of the intended changes, without claiming execution success.
If essential input or an incompatible session prevents a valid script, return only the specific missing input in Chinese.
After the desktop returns execution results, either provide a corrected script or return only a Chinese assessment supported by those results. Do not execute the same successful script again. Successful execution alone does not prove convergence.
Previous conversation and execution context (reference only; do not repeat successful scripts):
[{"user": "建立二维静止水域。\n\n\n\n设置直径 60 mm 的运动圆形载体和直径 40 mm 的固定目标。\n\n\n\n载体在 0.4 s 内加速至 0.1 m/s,计算至 2.2 s。\n\n\n\n在载体前端和两侧偏转 45° 的位置设置三个随动压力测区。\n\n\n\n分别计算有目标、无目标两种工况,保存并比较压力随时间的变化先跑通计算量不要太大"}]
Runtime capabilities:
{"protocol": "FluentAGI-capabilities-v1", "session": {"connected": true, "mode": "launch"}, "geometry": {"worker": "gmsh isolated process", "imports": [], "builtins": ["range", "len", "int", "float", "str", "list", "tuple", "enumerate", "zip", "min", "max", "abs", "round", "RuntimeError", "ValueError", "print", "set", "sum", "sorted", "bool", "all", "any"], "physical_groups": ["inlet[-name]", "outlet[-name]", "wall[-name]", "walls"], "independent_boundary_zones": true, "mesh_cell_limit": 2000000, "geometry_timeout_seconds": 3600, "cell_types": ["triangle", "quadrilateral", "tetrahedron", "hexahedron", "prism", "pyramid"]}, "script": {"imports": ["math", "json", "itertools", "functools", "collections", "dataclasses", "typing"], "adapters": ["configure_dynamic_mesh", "inspect_dynamic_mesh", "prepare_moving_circle", "initialize_moving_body", "read_moving_body", "resume_moving_body", "advance_moving_body", "compare_moving_pressure", "build_dust_box", "configure_transient_dust", "initialize_transient_dust", "read_transient_dust", "advance_transient_dust", "resume_transient_dust", "read_transient_dust_results", "inspect_dpm", "configure_dpm", "create_dust_injection", "set_particle_boundaries", "track_particles", "build_planar", "build_volume", "build_extruded", "geometry_mesh", "configure_water_air", "initialize_air", "record_animation", "export_results", "assign_phase_materials", "assign_multiphase_materials", "configure_three_phase_materials", "audit_multiphase_interfaces", "configure_evaporation_condensation", "inspect_phase_change", "configure_surface_tension", "inspect_surface_tension"]}, "generated_at": 1792334056.189329, "phase_change": {"version": "v242", "model": "Lee", "adapter_multiphase_models": ["vof"], "mixture_officially_available": true, "mixture_adapter_validated": false, "two_phase_2d_correction_runtime_validation": "pending", "automatic_model_switch": false, "phases": [2, 3], "saturation": "constant K", "frequencies": "positive finite 1/s", "mass_transfer_pairs": 1, "internal_official_tui": true, "generated_direct_tui": false, "readback": "unique case snapshot", "initializes": false}, "dynamic_mesh": {"versions": ["v242", "v252"], "scope": "2D planar pure triangles, prescribed +X rigid translation; smoothing + local remeshing", "v242_native_validation": "real moving geometry and pressure patches; see shipped validation log", "v252_native_validation": "not installed locally; official generated SDK checked, each customer setup requires native case readback", "motion_is_real": true, "settings_receipt": "dynamic-mesh.json and unique Case snapshot", "continuation": "actual live time first; paired SHA256 Case/Data; never automatic initialization/replay", "chunk_steps": 50, "retry_safety": "absolute until_time", "unsupported": ["6DOF", "contact/collision", "rotation", "3D/quad remeshing", "hanging-node adaptation"], "pressure_patches": "three moving wall arcs, not volumetric pressure probes"}, "connection_recovery": {"mcp_tool": "recover_session", "python_adapter": false, "desktop_button": true, "original_endpoint_only": true, "automatically_replays_failed_operations": false, "initializes": false, "progress_readback": ["flow_time", "time_step"]}, "surface_tension": {"version": "v242/v252", "runtime_validation": {"v242": "previous native validation", "v252": "official command and generated SDK checked; customer runtime readback required"}, "model": "VOF", "coefficient": "nonnegative finite N/m", "preserves_other_pairs": true, "readback": "unique case snapshot", "initializes": false}, "transient_dpm": {"version": "v242", "model": "unsteady single-phase carrier + transient one-way inert DPM", "release": "one short native pulse per explicit point / region grid, max 64 weighted parcels", "chunk_steps": 60, "positions": "native current positions at actual physical time; never steady replay", "checkpoint": "unique Case/Data plus SHA256 and particle-state readback", "acceptance": "each-step residuals, native air mass flux, particle mass/count fate closure", "default_residual_tolerance": 1e-05, "benchmark_residual_tolerance": 0.001, "strict_1e_5_initial_step_validated": false, "resuspension_validated": false, "stochastic_turbulent_dispersion_validated": false}, "dpm": {"version": "v242", "carrier": "single phase, one-way, steady inert dust", "injection_types": ["single", "group"], "surface_injection_validated": false, "boundary_types": ["reflect", "trap", "escape"], "trajectory_source": "native GetParticleTracksField RPC", "animation": "steady DPM trajectory residence-time replay, no carrier advance", "transient_dpm_validated": false, "two_way_validated": false, "readback": true, "active": false}, "fluent_version": "Ansys Fluent 2024 R2", "model_active": false}
Current session:
{"connected": true, "dimension": 2, "mode": "solver", "owned": true, "continuation": false}
Task directory:
C:\Users\13977\AppData\Local\FluentAGI\data\runs\20261018-223401-e88a83
Current request:
建立二维静止水域。
设置直径 60 mm 的运动圆形载体和直径 40 mm 的固定目标。
载体在 0.4 s 内加速至 0.1 m/s,计算至 2.2 s。
在载体前端和两侧偏转 45° 的位置设置三个随动压力测区。
分别计算有目标、无目标两种工况,保存并比较压力随时间的变化先跑通计算量不要太大
Desktop execution feedback:
[{"failed_action": {"tool": "run_code", "arguments": {"code": "# Use the existing connected PyFluent variable solver.\nimport json\nimport math\n\ntask_directory = r\"C:\\Users\\13977\\AppData\\Local\\FluentAGI\\data\\runs\\20261018-223401-e88a83\"\nwith_directory = task_directory + r\"\\with_target\"\nwithout_directory = task_directory + r\"\\without_target\"\nend_time = 2.2\ntime_step = 0.005\n\n\ndef unpack(value):\n if isinstance(value, str):\n try:\n return json.loads(value)\n except (ValueError, TypeError):\n return value\n return value\n\n\ndef emit(label, value):\n value = unpack(value)\n print(label)\n print(json.dumps(value, ensure_ascii=False, default=str))\n return value\n\n\ndef walk(value):\n value = unpack(value)\n if isinstance(value, dict):\n yield value\n for child in value.values():\n yield from walk(child)\n elif isinstance(value, (list, tuple)):\n for child in value:\n yield from walk(child)\n\n\ndef verify(label, value):\n result = emit(label, value)\n found = False\n for node in walk(result):\n found = True\n if node.get(\"needs_review\") is True:\n raise RuntimeError(label + \": needs_review\")\n for key in (\"status\", \"state\"):\n status = node.get(key)\n if isinstance(status, str):\n if status.lower() in (\n \"needs_review\",\n \"failed\",\n \"error\",\n \"aborted\",\n \"timeout\",\n \"timed_out\",\n ):\n raise RuntimeError(label + \": \" + status)\n if node.get(\"success\") is False or node.get(\"ok\") is False:\n raise RuntimeError(label + \": unsuccessful\")\n for key in (\"error\", \"errors\"):\n if node.get(key):\n raise RuntimeError(label + \": \" + str(node[key]))\n if not found:\n raise RuntimeError(label + \": structured feedback unavailable\")\n return result\n\n\ndef actual_time(value):\n for key in (\"flow_time\", \"current_time\", \"final_time\"):\n values = []\n for node in walk(value):\n item = node.get(key)\n if isinstance(item, bool):\n continue\n if isinstance(item, (int, float, str)):\n try:\n number = float(item)\n except (TypeError, ValueError):\n continue\n if math.isfinite(number) and number >= 0:\n values.append(number)\n if values:\n return max(values)\n return None\n\n\ncases = [\n (\"with_target\", with_directory, True),\n (\"without_target\", without_directory, False),\n]\n\nfor index, (case_name, case_directory, include_target) in enumerate(cases):\n options = dict(\n directory=case_directory,\n include_target=include_target,\n body_diameter=0.06,\n target_diameter=0.04,\n speed=0.1,\n ramp_time=0.4,\n end_time=end_time,\n time_step=time_step,\n size=0.012,\n )\n\n if index > 0:\n backup_file = with_directory + r\"\\before_case_switch.cas.h5\"\n backup_result = solver.settings.file.write_case_data(\n file_name=backup_file\n )\n emit(\"backup_before_case_switch\", backup_result)\n options[\"replace_loaded_model\"] = True\n\n verify(\n case_name + \": prepare\",\n fluentagi.prepare_moving_circle(**options),\n )\n\n verify(\n case_name + \": initialize_once\",\n fluentagi.initialize_moving_body(directory=case_directory),\n )\n\n completed = False\n\n for chunk in range(10):\n state = verify(\n case_name + \": read_before_chunk_\" + str(chunk + 1),\n fluentagi.read_moving_body(directory=case_directory),\n )\n before = actual_time(state)\n\n if before is None:\n raise RuntimeError(\n case_name\n + \": actual flow time unavailable; inspect feedback before continuing\"\n )\n\n if before >= end_time - 1e-9:\n completed = True\n break\n\n feedback = verify(\n case_name + \": advance_chunk_\" + str(chunk + 1),\n fluentagi.advance_moving_body(\n directory=case_directory,\n steps=50,\n until_time=end_time,\n max_iter_per_step=100,\n ),\n )\n\n state = verify(\n case_name + \": read_after_chunk_\" + str(chunk + 1),\n fluentagi.read_moving_body(directory=case_directory),\n )\n after = actual_time(state)\n\n if after is None:\n raise RuntimeError(\n case_name\n + \": actual flow time unavailable after advancement; do not replay\"\n )\n\n print(\n json.dumps(\n {\n \"case\": case_name,\n \"chunk\": chunk + 1,\n \"time_before\": before,\n \"time_after\": after,\n \"end_time\": end_time,\n },\n ensure_ascii=False,\n )\n )\n\n if after > end_time + 1e-8:\n raise RuntimeError(case_name + \": physical end time exceeded\")\n\n if after <= before + 1e-12:\n raise RuntimeError(\n case_name + \": no confirmed time advancement; do not replay\"\n )\n\n if after >= end_time - 1e-9:\n completed = True\n break\n\n if not completed:\n raise RuntimeError(\n case_name + \": target time not confirmed; retain current solution\"\n )\n\n verify(\n case_name + \": final_state\",\n fluentagi.read_moving_body(directory=case_directory),\n )\n\nverify(\n \"compare_three_moving_wall_pressure_patches\",\n fluentagi.compare_moving_pressure(\n directory=task_directory,\n with_target_directory=with_directory,\n without_target_directory=without_directory,\n ),\n)"}}, "error": "{\"status\": \"error\", \"stdout\": \"\\nAustra has other FLUENT parallel processes running. Process affinity not being set.\\nReading \\\"C:\\\\Users\\\\13977\\\\AppData\\\\Local\\\\FluentAGI\\\\data\\\\runs\\\\20261018-223401-e88a83\\\\with_target\\\\cad-cc8ee1b7\\\\fluent.msh\\\"...\\nBuffering for file scan...\\n\\n 3495 nodes.\\n 6744 mixed cells, zone 2.\\n 9992 2D interior faces, zone 3.\\n 34 2D velocity-inlet faces, zone 4.\\n 34 2D pressure-outlet faces, zone 5.\\n 16 2D wall faces, zone 6.\\n 150 2D wall faces, zone 7.\\n 1 2D wall faces, zone 8.\\n 1 2D wall \n…中间日志已省略,完整日志保存在任务目录…\ng ...\\n 6536 cells, 1 zone ...\\n 9928 faces, 9 zones ...\\n 3391 nodes, 1 zone ...\\n Done.\\n\\n Writing boundary layer flags ...\\n Done.\\n Writing data for \\\"agi-motion-1b28e9f4\\\" profile.\\nDone.\\n\\nWriting to Austra:\\\"C:\\\\Users\\\\13977\\\\AppData\\\\Local\\\\FluentAGI\\\\data\\\\runs\\\\20261018-223401-e88a83\\\\with_target\\\\moving-checkpoint-8e9f50cb.dat.h5\\\" in NODE0 mode and compression level 1 ...\\n Writing results.\\nDone.\\nwith_target: advance_chunk_6\\n{\\\"status\\\": \\\"needs_review\\\", \\\"reason\\\": \\\"Time step did not meet recorded residual tolerance; no additional physical step\\\", \\\"field\\\": \\\"pressure\\\", \\\"requested_until_time\\\": 2.2, \\\"frames\\\": 10, \\\"advanced_time_steps\\\": 41, \\\"initial_time\\\": 1.249999999999995, \\\"final_time\\\": 1.454999999999991, \\\"all_steps_converged\\\": false, \\\"all_recorded_steps_converged\\\": false, \\\"convergence_verified\\\": false, \\\"state\\\": {\\\"status\\\": \\\"ok\\\", \\\"flow_time\\\": 1.454999999999991, \\\"time_step\\\": 291, \\\"displacement\\\": [0.12574999406933784, 0.0, 0.0], \\\"analytic_displacement\\\": 0.1254999999999991, \\\"pressure_pa\\\": [-4.325739136371407, 4.914332294755622, -4.541426418086763], \\\"probe_positions\\\": [[0.14688248187303543, -0.02113248035311699, 0.0], [0.15563583374023438, 0.0, 0.0], [0.14688248187303543, 0.02113248035311699, 0.0]], \\\"convergence_verified\\\": false, \\\"target_center\\\": [0.28040507435798645, 0.0, 0.0]}, \\\"directory\\\": \\\"C:\\\\\\\\Users\\\\\\\\13977\\\\\\\\AppData\\\\\\\\Local\\\\\\\\FluentAGI\\\\\\\\data\\\\\\\\runs\\\\\\\\20261018-223401-e88a83\\\\\\\\with_target\\\\\\\\animation-a5a6afa5\\\", \\\"csv\\\": \\\"C:\\\\\\\\Users\\\\\\\\13977\\\\\\\\AppData\\\\\\\\Local\\\\\\\\FluentAGI\\\\\\\\data\\\\\\\\runs\\\\\\\\20261018-223401-e88a83\\\\\\\\with_target\\\\\\\\moving-pressure.csv\\\", \\\"meaning\\\": \\\"Actual dynamic mesh and area-averaged pressure on moving wall arcs; not a stationary-body flow visualization\\\"}\\n\", \"stderr\": \"ansys\\\\fluent\\\\core\\\\services\\\\field_data.py:276: PyFluentDeprecationWarning: This usage is deprecated and will be removed in a future release. Please use 'field_data.surfaces()' instead\\n warnings.warn(\\nansys\\\\fluent\\\\core\\\\services\\\\field_data.py:398: PyFluentDeprecationWarning: Function 'get_surface_data' is deprecated since version v0.34.0. Use 'get_field_data' instead.\\n return self._field_data_accessor(*args, **kwargs)\\nansys\\\\fluent\\\\core\\\\services\\\\field_data.py:398: PyFluentDeprecationWarning: Function 'get_surface_data' is deprecated since version v0.34.0. Use 'get_field_data' instead.\\n return self._field_data_accessor(*args, **kwargs)\\nansys\\\\fluent\\\\core\\\\services\\\\field_data.py:398: PyFluentDeprecationWarning: Function 'get_surface_data' is deprecated since version v0.34.0. Use 'get_field_data' instead.\\n return self._field_data_accessor(*args, **kwargs)\\nansys\\\\fluent\\\\core\\\\services\\\\field_data.py:398: PyFluentDeprecationWarning: Function 'get_surface_data' is deprecated since version v0.34.0. Use 'get_field_data' instead.\\n return self._field_data_accessor(*args, **kwargs)\\n\\nTraceback (most recent call last):\\n File \\\"ansys\\\\fluent\\\\mcp\\\\solve\\\\backends\\\\pyfluent.py\\\", line 2793, in _do\\n exec( # noqa: S102 # nosec B102\\n File \\\"\\\", line 142, in \\n File \\\"\\\", line 57, in verify\\nRuntimeError: with_target: advance_chunk_6: needs_review\\n\", \"return_value\": null, \"message\": \"with_target: advance_chunk_6: needs_review\", \"error_code\": \"execution_error\", \"warnings\": []}", "note": "可能有部分操作已生效,请先检查实时状态,修复后继续。"}]
【ChatGPT 回复】