@@ -771,42 +771,49 @@ atmos_ρ = cs.model_sims.atmos_sim.integrator.u.c.ρ
771
771
atmos_uₕ = cs. model_sims. atmos_sim. integrator. u. c. uₕ
772
772
atmos_u₃ = cs. model_sims. atmos_sim. integrator. u. f. u₃
773
773
774
- # # Write to text files
775
- # open(joinpath(COUPLER_ARTIFACTS_DIR, "atmos_state_center_tend_$device_suffix.txt"), "w") do io
776
- # DLM.writedlm(
777
- # io,
778
- # hcat(parent(atmos_ρe_tot)[:], parent(atmos_ρq_tot)[:], parent(atmos_ρ)[:], parent(atmos_uₕ)[:]),
779
- # ',',
780
- # )
781
- # end;
782
-
783
- # open(joinpath(COUPLER_ARTIFACTS_DIR, "atmos_state_face_tend_$device_suffix.txt"), "w") do io
784
- # DLM.writedlm(io, parent(atmos_u₃)[:], ',')
785
- # end;
786
-
787
- # # Extract land state variables
788
- # land_T = cs.model_sims.land_sim.integrator.u.bucket.T
789
- # land_W = cs.model_sims.land_sim.integrator.u.bucket.W
790
- # land_Ws = cs.model_sims.land_sim.integrator.u.bucket.Ws
791
- # land_σS = cs.model_sims.land_sim.integrator.u.bucket.σS
792
-
793
- # # Write to text files
794
- # open(joinpath(COUPLER_ARTIFACTS_DIR, "land_state_3d_tend_$device_suffix.txt"), "w") do io
795
- # DLM.writedlm(io, parent(land_T)[:], ',')
796
- # end;
797
- # open(joinpath(COUPLER_ARTIFACTS_DIR, "land_state_2d_tend_$device_suffix.txt"), "w") do io
798
- # DLM.writedlm(io, hcat(parent(land_W)[:], parent(land_Ws)[:], parent(land_σS)[:]), ',')
799
- # end;
800
-
801
- # # ocean state
802
- # if cs.mode.name != "amip"
803
- # ocean_T_sfc = cs.model_sims.ocean_sim.integrator.u.T_sfc
804
-
805
- # # Write to text files
806
- # open(joinpath(COUPLER_ARTIFACTS_DIR, "ocean_state_tend_$device_suffix.txt"), "w") do io
807
- # DLM.writedlm(io, parent(ocean_T_sfc)[:], ',')
808
- # end
809
- # end;
774
+ # Write to text files
775
+ open (joinpath (COUPLER_ARTIFACTS_DIR, " atmos_state_center_tend_$device_suffix .txt" ), " w" ) do io
776
+ # note: `atmos_uₕ` has two components that we have to index into
777
+ DLM. writedlm (
778
+ io,
779
+ hcat (
780
+ Array (parent (atmos_ρe_tot))[:],
781
+ Array (parent (atmos_ρq_tot))[:],
782
+ Array (parent (atmos_ρ))[:],
783
+ Array (parent (atmos_uₕ. components))[:, :, :, 1 , :][:],
784
+ Array (parent (atmos_uₕ. components))[:, :, :, 2 , :][:],
785
+ ),
786
+ ' ,' ,
787
+ )
788
+ end ;
789
+
790
+ open (joinpath (COUPLER_ARTIFACTS_DIR, " atmos_state_face_tend_$device_suffix .txt" ), " w" ) do io
791
+ DLM. writedlm (io, Array (parent (atmos_u₃))[:], ' ,' )
792
+ end ;
793
+
794
+ # Extract land state variables
795
+ land_T = cs. model_sims. land_sim. integrator. u. bucket. T
796
+ land_W = cs. model_sims. land_sim. integrator. u. bucket. W
797
+ land_Ws = cs. model_sims. land_sim. integrator. u. bucket. Ws
798
+ land_σS = cs. model_sims. land_sim. integrator. u. bucket. σS
799
+
800
+ # Write to text files
801
+ open (joinpath (COUPLER_ARTIFACTS_DIR, " land_state_3d_tend_$device_suffix .txt" ), " w" ) do io
802
+ DLM. writedlm (io, Array (parent (land_T))[:], ' ,' )
803
+ end ;
804
+ open (joinpath (COUPLER_ARTIFACTS_DIR, " land_state_2d_tend_$device_suffix .txt" ), " w" ) do io
805
+ DLM. writedlm (io, hcat (Array (parent (land_W))[:], Array (parent (land_Ws))[:], Array (parent (land_σS))[:]), ' ,' )
806
+ end ;
807
+
808
+ # ocean state
809
+ if cs. mode. name != " amip"
810
+ ocean_T_sfc = cs. model_sims. ocean_sim. integrator. u. T_sfc
811
+
812
+ # Write to text files
813
+ open (joinpath (COUPLER_ARTIFACTS_DIR, " ocean_state_tend_$device_suffix .txt" ), " w" ) do io
814
+ DLM. writedlm (io, Array (parent (ocean_T_sfc))[:], ' ,' )
815
+ end
816
+ end ;
810
817
811
818
#=
812
819
## Postprocessing
0 commit comments