An intelligent sea-air nonlinear strong coupling assimilation method based on python-fortran hybrid programming

A smart ocean-atmosphere nonlinear strong coupling assimilation method using Python-Fortran hybrid programming and VAE models solves the problem of insufficient projection of cross-sphere observational information, achieves efficient ocean-atmosphere coupling assimilation, and improves the accuracy of weather and climate forecasts, especially in the monitoring and forecasting of extreme weather phenomena in ocean-atmosphere interactions.

CN121680857BActive Publication Date: 2026-06-19OCEAN UNIV OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
OCEAN UNIV OF CHINA
Filing Date
2026-01-12
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing assimilation methods are based on the principle of linear filtering, which cannot effectively project cross-sphere observation information, resulting in insufficient accuracy of weather and climate forecasts, especially in the case of air-sea interactions.

Method used

A smart, nonlinear, strongly coupled assimilation method for atmospheric and oceanic data is proposed, employing a Python-Fortran hybrid programming approach. This method integrates Python and Fortran code through the f2py protocol framework, combines CM2-CDA and AI technologies to achieve nonlinear, strongly coupled assimilation of atmospheric and oceanic observation data, and uses a VAE model for latent space transformation and minimization to realize the SCDA mechanism.

Benefits of technology

It improves the nonlinear strong coupling and assimilation capability between the ocean and the atmosphere, enhances the accuracy of climate monitoring and forecasting of extreme weather phenomena such as typhoons, and improves the accuracy of forecasts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121680857B_ABST
    Figure CN121680857B_ABST
Patent Text Reader

Abstract

This invention provides an intelligent air-sea nonlinear strong coupling assimilation method based on Python-Fortran hybrid programming. It constructs the Python-Fortran hybrid programming platform Hf2pMDA-CM2CDA, utilizes the f2py protocol to achieve bidirectional calling and efficient integration of Python and Fortran code, and then combines a variational autoencoder (VAE) to achieve nonlinear strong coupling data assimilation (SCDA) in the latent space. Specific steps include: building a hybrid computing environment; encapsulating the CM2-CDA Fortran module into a Python callable module; designing the Python main control program PMC; using the VAE for dimensionality reduction and reconstruction from the physical space to the latent space; introducing observation terms into the latent space and using a three-dimensional variational method for minimization optimization; and finally achieving cross-sphere collaborative assimilation of atmospheric and oceanic observation data. This method can quickly and efficiently achieve nonlinear strong coupling assimilation between the ocean and atmosphere, continuously improving the 3D monitoring and forecasting capabilities of extreme weather (such as typhoons) and climate phenomena (such as marine heat waves, atmospheric MJO, ENSO, etc.) related to air-sea interactions. It has broad application prospects and high practical value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to improving the accuracy of air-sea coupled weather (such as typhoon) climate (ENSO) forecasts and their application in the field of offshore wind power forecasting technology. In particular, it relates to an intelligent air-sea nonlinear strong coupling assimilation method based on Python-Fortran hybrid programming. Background Technology

[0002] For monitoring and forecasting weather and climate in the Earth's atmosphere and oceans, numerical simulation and assimilation techniques based on an understanding of physical mechanisms are commonly used. Numerical simulation discretizes the dynamic and thermodynamic equations controlling atmospheric changes onto a grid system, performing discrete calculations and time integration on the partial differential equations to obtain the environmental state evolution. However, due to incomplete understanding of complex physical processes and the approximation of the discrete process, the results of numerical simulations always deviate from the evolution of the real world. Assimilation techniques combine environmental observation information with numerical models to derive a more realistic environmental state evolution, forming a historical reconstruction and current monitoring of weather and climate evolution in the atmosphere and oceans. When the numerical model continues to integrate along the monitored state, passing through the current time point to the future, the state evolution formed in the future time domain is the forecast. Coupled assimilation uses multi-sphere coupled Earth system models to fuse observed information from the atmosphere and oceans, integrating observational information obtained from multi-sphere observation systems in a balanced and coordinated manner to reconstruct the overall historical evolution and current monitoring of Earth's fluids. Since coupled assimilation includes the interaction mechanisms between spheres, and many high-impact weather and climate phenomena are related to the interaction between spheres (such as air-sea interaction in typhoons and ocean heat waves), it is expected that the forecasts generated by coupled simulation assimilation will be more accurate.

[0003] However, existing assimilation methods typically project observation information onto the model state based on the principle of linear filtering (Jazinwinski, 1970) (Yu et al., 2029). Since different feature scales exist between spheres, the projection of observation information is usually within the same sphere. Observation information from different spheres can only be transmitted through incomplete flux exchange at the coupling interface, i.e., weak coupling assimilation. Weak coupling assimilation cannot project observation information across spheres to the coupled model, thus substantially affecting the assimilation quality and the final forecast accuracy. Researchers have been seeking nonlinear, strongly coupled assimilation methods that project observation information across spheres to the coupled model. Summary of the Invention

[0004] To overcome the shortcomings of existing technologies, this invention provides a smart ocean-atmosphere nonlinear strong coupling assimilation method based on Python-Fortran hybrid programming.

[0005] This invention is achieved through the following technical solution: a smart ocean-atmosphere nonlinear strong coupling assimilation method based on Python-Fortran hybrid programming, specifically including the following steps:

[0006] Step S1: General f2py protocol framework

[0007] The f2py protocol provides a basic framework for integrating Python and Fortran code to perform hybrid computing.

[0008] Step S2: CM2-CDA and AI based on f2py using a Python-Fortran hybrid computation process

[0009] Step S2.1, Environment Setup

[0010] Starting with the Python environment: Enter "conda create -n f2py python=3.11" to create the environment, then execute "conda activatef2py" to activate the environment and "conda install numpy=1.26.4" to install the required software; for non-standard environment variables, use the "source" command to supplement the configuration;

[0011] Step S1: General f2py protocol framework

[0012] The f2py protocol provides a basic framework for integrating Python and Fortran code to perform hybrid computing.

[0013] Step S2: CM2-CDA and AI based on f2py using a Python-Fortran hybrid computation process

[0014] Step S2.1, Environment Setup

[0015] Starting with the Python environment: Enter "conda create -n f2py python=3.11" to create the environment, then execute "conda activatef2py" to activate the environment and "conda install numpy=1.26.4" to install the required software; for non-standard environment variables, use the "source" command to supplement the configuration;

[0016] Step S2.2: Create a Python-callable CM2-CDA Fortran module PCF

[0017] After completing the environment configuration, add the "-fPIC" option to the compiler options used by the original CM2-CDA Fortran program to directly perform recompilation; once all the relatively independent CM2-CDA Fortran code has been compiled as DLL candidate files, it can be linked with the Python main controller PMC.

[0018] The CM2-CDA Fortran subroutine with plug-in functionality is packaged and encapsulated. Then, all PCF modules are integrated into this subroutine, and a signature file named cm2_cda.pyf containing a clear plug-in structure is generated by the command line.

[0019] The final result will be a complete DLL file; this file is a DDL "shared object" that can be called by Python, in which all subroutines and functions can be called by PMC; all information about the logical structure of cm2_cda.cpython-311-x86_64-linux-gnu.so will be recorded in the signature file cm2_cda.pyf;

[0020] Step S2.3: Create a Python function that can be called by Fortran for CM2-CDA.

[0021] An interface named callback_python.F90 is created to convert Python-encoded functions into public subroutines that can be called in Fortran. Simultaneously, the interface file cm2_plug.F90 contains the function definitions and the parameters passed from the PMC to the Fortran application via the plugin. The interface file callback_python.F90 and cm2_plug.F90 are compiled together in step S2.1 to generate the signature file cm2_cda.pyf.

[0022] Step S3, PMC Architecture

[0023] Import statements include importing predefined selected Fortran modules from cm2_cda or directly importing all modules in cm2_cda; import statements include various modules required by PMC.

[0024] Step S4: Implementation of Python-Fortran hybrid computation

[0025] The parallel computing characteristics of Python-Fortran hybrid computing are demonstrated by using the mpirun command. This run command line is inserted into the existing run_script file of the Fortran model, and the job is submitted to the background job queue using the qsub command to run on a large-scale MPI computing node. Ensure that the environment configuration described in step S2.1 has been completed before the mpirun command is executed.

[0026] Through the above steps, the basic platform for Python-Fortran hybrid modeling and data assimilation was constructed and named Hf2pMDA-CM2CDA.

[0027] Step S5, CM2 coupling mode and its weakly coupled assimilation WCDA system

[0028] Step S5-1, CM2 mode

[0029] The CM2 model consists of two components: an atmospheric model including land and an ocean model including sea ice. The atmospheric model AM2.1 and the land model AM2.1-LM2.1 are coupled with the modular ocean model MOM5 and the sea ice simulator SIS. The AM2.1 atmospheric model is based on a finite volume dynamics core, with a horizontal resolution of 2° latitude × 2.5° longitude, the same as LM2.1, and 24 vertical layers. MOM5 has 50 vertical layers: 22 layers in the first 220 meters, each 10 meters thick, with a horizontal B-grid resolution of 1° × 1°, gradually decreasing to a ⅓° longitude interval near the equator. SIS is a dynamic ice model with a three-layer vertical structure: one snow layer, two ice layers, and five ice thickness levels. The time steps for the ocean and atmospheric models are 2 hours and 30 minutes, respectively, and they interact with each other at a coupling frequency of 2 hours.

[0030] Step S5-2, Weakly Coupled Data Assimilation in CM2

[0031] The current version of CM2-CDA uses a sequential WCDA workflow, which integrates a single CM2 coupled model with atmospheric-oceanic observation data in real time and updates it dynamically based on the real-time availability of the observation data.

[0032] Step S6: Modular Hf2pMDA-CM2CDA Design

[0033] Step S6.1, Environmental Requirements

[0034] Hf2pMDA-CM2CDA uses OpenMPI for MPI application development; the specific steps include: first, recompiling the OpenMPI package with the "-fPIC" option and installing it using "make install"; then, obtaining the configuration file containing the instructions from the source code and adding the OpenMPI application to the f2py environment;

[0035] Step S6.2: Recompile all static libraries of CM2-CDA

[0036] The CM2 model features a clear modular design, with the atmospheric and oceanic components having relatively independent structures. Land serves as the atmospheric boundary process, while sea ice acts as the interface between the atmosphere and ocean. The main controller, coupler_main, organizes all interfaces between model components and performs time integration on the atmosphere every half hour and on the ocean and atmosphere-ocean coupling every two hours. CM2-CDA consists of four static libraries: libfms.a, libland.a, libecda.a, and libcoupler.a. To convert the Fortran modules in these static libraries into PCF modules, the main controller coupler_main.F90 is split into two parts: cm2_cda_mainsubs.F90 and cm2_cda_plugs.F90.

[0037] First, recompile the four static library files: libfms.a, libland.a, libecda.a, and libcoupler.a by adding the '-fPIC' option. Then, use the f2py tool to merge the cm2_cda_plugs.F90 file with these four static libraries, generating the signature file cm2_cda.pyf and the DLL cm2_cda.python-311-x86_64-linux-gnu.so. Finally, place the DLL cm2_cda.python-311-x86_64-linux-gnu.so file in the working directory to work with cm2_cda_main.py.

[0038] Step S6.3, PMC of Hf2pMDA-CM2CDA and its execution

[0039] Develop the Python main control program cm2_cda_main.py for Hf2pMDA-CM2CDA based on the PMC architecture; following the process described above, the system design and operation of Hf2pMDA-CM2CDA can be completed by running cm2_cda_main.py.

[0040] Step S7: Implicit Space VAE SCD Function under the Hf2pMDA-CM2CDA Framework

[0041] Step S7.1, VAE implicit space transformation

[0042] The transformation process between the physical space and latent space of the VAE model is employed, introducing a Gaussian distribution constraint into the latent space. This ensures that the minimized total loss includes the Kullback-Leibler (KL) loss, thus making the distribution of the induced tensor in the latent space approximate a Gaussian distribution. This model is called β-VAE. By minimizing the total loss L(x) composed of the reconstruction loss and the KL loss,

[0043]

[0044] Generate a low-order tensor, denoted as z, in the latent space, and set the parameter β to 10. -6 ;

[0045] Step S7.2, SCDA function in latent space minimization

[0046] Based on the VAE latent space transformation described in step S7.1, the latent space data assimilation LDA further introduces a minimization process in the latent space. By adding the observation term to the loss function to be minimized, and using the error covariance matrix B and R as scaling factors for the background term and the observation term, respectively, the loss function maintains its dimensionless characteristics during the minimization process. Minimization is performed using a three-dimensional variational method (3D-Var).

[0047]

[0048] Atmospheric and oceanic model variables are incorporated into the physical space vector x, and atmospheric and oceanic observation data are integrated at the air-sea interface. The final decoded physical space vector represents the updated model state that integrates atmospheric and oceanic observation data. LDA thus realizes the SCDA mechanism—atmospheric or oceanic observation data can be adjusted directly and instantly. Ocean or atmospheric conditions;

[0049] Step S7.3: Data Training and Latent Space Minimization of VAE

[0050] For the VAE training and SCDA latent space minimization method under the Hf2pMDA-CM2CDA framework, the encoder and decoder of VAE training successively include three steps: downsampling, adding constraints in the latent space, and upsampling.

[0051] The latent space minimization process employs the following steps: After the training of the VAE encoder ℇ and decoder D is completed, the trained ℇ and D achieve a bidirectional transformation between the joint atmospheric-oceanic state vector x and the latent space state vector z. Since the dimension of the state vector z in the dimensionless latent space is compressed to a minimum, the minimization process is completed. When the prior error criterion is satisfied, the assimilated solution is obtained. :

[0052] z 0=ε( x 0 )

[0053]

[0054] z a = arg min( J ( z ))

[0055] = D ( z a ) ;

[0056] Step S8, SCDA results of Hf2pMDA-CM2CDA

[0057] Step S8.1: VAE Reconstruction of Air-Sea Interface Physical Variables

[0058] In the Hf2pMDA-CM2CDA system, to generate SCDA results, the encoder and decoder of the VAE are first trained. The reduced-order state is reconstructed in the latent space using atmospheric and ocean state variables of the air-sea interface. The input vector x_0 is set to include atmospheric surface wind speed, temperature and pressure (Us, Vs, Ts, Ps) and ocean surface current speed, temperature and height (SSU, SSV, SST, SSH). The encoder and decoder are trained by downsampling and upsampling respectively.

[0059] First, the variables Us, Vs, Ts, Ps, SSU, SSV, SST, and SSH are standardized to construct the input vector x. Then, a training process is adopted, using a 50-year time series dataset containing 3-hour intervals for training, and finally the latent space vector z is obtained.

[0060] As a preferred option, several candidate DLL files are generated during the compilation process in step S2.2. The packaging and encapsulation commands will appear as a series of lines similar to the initial creation commands described above, as follows:

[0061] $FC="mpif90" CC="mpicc" CXX="mpicxx" ldshared="mpif90" ldflags="-no-ipo -Wl,-Wl,--export-dynamic" f2py -c cm2_cda.pyf cm2_plugs.F90 libapp1.alibapp2.a ...

[0062] -lincdf - L / ... / software / netcdf3 / lib - L / ... / openmpi / lib --backenddistutils

[0063] The option "-no-ipo" disables cross-module optimization to reduce potential uncertainties during optimization; while the option "-Wl" ensures that all functions associated with the DLL file are called correctly; in this case, the openmpi / lib file also needs to be recompiled using the "-fPIC" label.

[0064] As a preferred option, in step S4

[0065] The parallel computing characteristics of Python-Fortran hybrid computing are demonstrated using the `mpirun` command. The specific command is as follows:

[0066] $ mpirun -n xx python cm2_cda_main.py>cm2_cda.log

[0067] Where “xx” represents the number of parallel computing cores required by the program, and cm2_cda.log is the file that records the program's running log.

[0068] As a preferred embodiment, the instructions in step S6.1 include the following three lines of instructions:

[0069] export PATH=“... / openmpi / bin:$PATH”

[0070] export LIBRARY_PATH=“... / openmpi / lib:$LIBRARY_PATH”

[0071] export LD_LIBRARY_PATH=“... / openmpi / li:$LD_LIBRARY_PATH.”.

[0072] As a preferred embodiment, libfms.a in step S6.2 contains all the minimum shared information, such as MPI and remapping functions; libland.a is a relatively independent land model application package based on libfms.a; libecda.a contains all atmospheric and ocean model components as well as CDA subroutines except for the land model; libcoupler.a, as the highest-level infrastructure, connects all the above parts through coupler_main.

[0073] This invention, by employing the above technical solutions, offers the following advantages compared to existing technologies: This patent enables rapid and efficient nonlinear strong coupling assimilation between the ocean and atmosphere, continuously improving the 3D monitoring and forecasting capabilities for extreme weather phenomena (such as typhoons) and climate phenomena (such as marine heat waves, atmospheric MJO, ENSO, etc.) related to ocean-atmosphere interactions. It has broad application prospects and high practical value.

[0074] Additional aspects and advantages of the invention will become apparent in the following description or may be learned by practice of the invention. Attached Figure Description

[0075] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0076] Figure 1 A flowchart illustrating the design logic of the fusion modeling architecture for the multi-layer coupled simulation assimilation system CM2-CDA and AI on a Python-Fortran hybrid programming platform.

[0077] Figure 2 This diagram illustrates the principle of physical space to latent space transformation. The loss function includes reconstruction loss and a β-weighted Kullback-Leibler (KL) loss (referred to as β-VAE). The reconstruction loss measures the accuracy of the VAE reconstruction, while the KL loss measures the difference between the generated probability distribution and the Gaussian distribution. This algorithm is implemented through machine learning trained on data.

[0078] Figure 3 This diagram illustrates the principle of nonlinear strongly coupled data assimilation (SCDA), which performs observational correction on atmospheric and oceanic observational data through latent space minimization (i.e., 3D-Var). Here, B and R represent the error covariance matrices of the latent spatial state background and the observational data, respectively, and also serve as normalization (scaling) factors in the loss function minimization process. This SCDA algorithm is implemented through the efficient machine learning workflow described in the next section.

[0079] Figure 4This describes the implementation flow of VAE latent space data assimilation technology in Hf2pMDA-CM2CDA. a) General flowchart of the encoder and decoder for β-VAE physical space to latent space conversion (e.g.) Figure 2 (as shown). b) General flowchart of the latent space minimization algorithm.

[0080] Figure 5 The training process of the VAE encoder (left) and decoder (right) for physical-latent space transformation in Hf2pMDA-CM2CDA is shown below. Figure 4 Figure a shows the specific implementation of the general VAE logic. In this experiment, latent_dim is set to 20480, where "×N" in the lower right corner of the box indicates that the operation needs to be repeated N times;

[0081] Figure 6 This is a demonstration of the reconstruction accuracy of a typical VAE (Visual Augmentation Equipment) image of the Earth's surface below the atmosphere: a) temperature Ts, b) u component Us, c) v component Vs, and d) pressure Ps. The demonstration area is randomly selected from a five-year validation set. The leftmost panel (a, b, c, d) shows the original input x, and the middle panel (e, f, g, h) shows the reconstruction after decoding z. The rightmost panel (i, j, k, l) of the image shows the absolute value of the difference between the two values.

[0082] Figure 7 and Figure 6 The structures are the same, but the sea surface parameters are: aei) sea surface temperature SST, bfj) ocean current u component SSUs, cgk) ocean current v component SSV, dhl) sea surface height SSH;

[0083] Figure 8 The image shows the root mean square error (RMSE) time series of sea surface temperature (SST) and sea level pressure (Ps) generated by free-mode integral controlled simulation (CTL) (blue) and Hf2pMDA-CM2CDA, respectively. The WCDA model uses a multi-scale efficient approximation filter (MSHea-EnKF), while the SCDA model uses a different filter. Figure 4 The implicit space minimization method shown in b is implemented. Detailed Implementation

[0084] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0085] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.

[0086] The following is combined Figures 1 to 8 The embodiments of the present invention will be described in detail regarding the intelligent ocean-atmosphere nonlinear strong coupling assimilation method based on Python-Fortran hybrid programming.

[0087] This invention proposes a smart ocean-atmosphere nonlinear strong coupling assimilation method based on Python-Fortran hybrid programming, which specifically includes the following steps:

[0088] Step S1: General f2py protocol framework

[0089] The f2py protocol provides a basic framework for integrating Python and Fortran code for hybrid computing. Since Python is an interpreted language, its programs can run directly without pre-compilation, while compiled languages ​​such as Fortran require pre-compilation. The natural way to achieve hybrid computing of Python and Fortran is to import callable Fortran (PCF) modules into the Python master controller (PMC) as callable objects, while allowing Fortran programs in scientific computing to call artificial intelligence algorithms written in Python as subroutines or functions. To this end, the Python-Fortran hybrid modeling and data assimilation (Hf2pMDA) infrastructure designed in this study needs to solve three key problems: (1) The computing environment needs to support the running of both Python and Fortran languages; (2) The Fortran model code needs to be recompiled into PCF modules; (3) An application-oriented interface needs to be designed to connect the PCF modules with the PMC, so that Fortran programs in scientific computing can call artificial intelligence algorithms written in Python.

[0090] Step S2: Python-Fortran hybrid computation process based on f2py

[0091] Step S2.1, Environment Setup

[0092] f2py itself does not include specific environment variable settings. However, to minimize interference from other computational tasks on Python-Fortran modeling and development, we strongly recommend using environment configuration tools such as conda to create an independent runtime environment for hybrid Python-Fortran applications. This environment must include environment variables for both Fortran and Python. The specific steps can begin with the Python environment: enter "conda create -n f2py python=3.11" to create the environment, then execute "conda activatef2py" to activate the environment and "conda install numpy=1.26.4" to install the required software (corresponding to software version numbers 3.11 and 1.26.4 respectively). For non-standard environment variables that are only needed in specific applications, use the "source" command to supplement the configuration.

[0093] Step S2.2: Create a Python-callable CM2-CDA Fortran module PCF

[0094] To enable Python calls to existing CM2-CDA Fortran code, a new "-fPIC" option needs to be added during compilation, making the code a candidate dynamic link library (DLL) with "position-independent" characteristics. After completing the environment configuration, adding the "-fPIC" option to the compiler options used by the original CM2-CDA Fortran program will allow for direct recompilation. Once all relatively independent CM2-CDA Fortran code has been compiled as DLL candidates, it can be linked with the Python main controller PMC.

[0095] The CM2-CDA Fortran subroutine, which features plug-in functionality, is packaged and encapsulated. This subroutine effectively organizes PCF modules and provides several plug-ins for PMC. All PCF modules are then integrated into this subroutine, and a command-line signature file named cm2_cda.pyf containing a clear plug-in structure is generated.

[0096] "$f2py cm2_plugs.F90 -m cm2_cda -h -- overwrite-signature cm2_cda.pyf"

[0097] cm2_plugs.F90 consists of subroutines or functions that organize the PCF module, serving as a plugin for PMC. Assuming several candidate DLL files are generated during the compilation process (e.g., libapp1.a, libapp2.a, ... etc.), the packaging command will appear as a series of lines similar to the initial creation command, as follows:

[0098] $FC="mpif90" CC="mpicc" CXX="mpicxx" ldshared="mpif90" ldflags="-no-ipo -Wl,-Wl,--export-dynamic" f2py -c cm2_cda.pyf cm2_plugs.F90 libapp1.alibapp2.a ...

[0099] -lincdf - L / ... / software / netcdf3 / lib - L / ... / openmpi / lib --backenddistutils

[0100] The option "-no-ipo" disables cross-module optimization to reduce potential uncertainties during optimization; while the option "-Wl" ensures that all functions associated with the DLL file are called correctly. It's important to note that the openmpi / lib file also needs to be recompiled using the "-fPIC" option.

[0101] Ultimately, since the above commands typically do not display any error messages, they will complete the DLL file; this file is a DDL "shared object" that can be called by Python, in which all subroutines and functions can be called by PMC; all information about the logical structure of cm2_cda.cpython-311-x86_64-linux-gnu.so is recorded in the signature file cm2_cda.pyf, which is used not only as an import name in PMC, but also provides efficient guidance for building PMC;

[0102] Step S2.3: Create a Python function that can be called by Fortran for CM2-CDA.

[0103] To enable Fortran code to call algorithms written in Python, we need an interface (e.g., named callback_python.F90). This interface, named callback_python.F90, converts Python-encoded functions into public subroutines (e.g., python_algorithm1, python_algorithm2, etc.) that can be called by Fortran. Simultaneously, the interface file cm2_plug.F90 contains the function definitions and the parameters passed from the PMC to the Fortran application via the plugin. The interface file callback_python.F90 and cm2_plug.F90 are compiled together in step S2.1 to generate the signature file cm2_cda.pyf. Once the interface is successfully built, all subroutines representing Python algorithms can be called in any Fortran application using the regular "use" statement. Detailed information about the FCP application will be provided in the Hf2pMDA-CM2CDA application described in Section 4.

[0104] Step S3, PMC Architecture

[0105] Import statements include "from appname import module_list" (importing predefined selected Fortran modules from cm2_cda) or directly "import cm2_cda" (importing all modules in cm2_cda); import statements include various modules required by PMC, such as MPI modules that provide information such as process element identifiers (PE-id), and defined artificial intelligence algorithms; to minimize the need for Python recoding of existing CM2-CDA Fortran models, PMC usually keeps the code concise when performing model integration, because Fortran models can also easily call Python artificial intelligence algorithms.

[0106] Step S4: Implementation of Python-Fortran hybrid computation

[0107] We can still demonstrate the parallel computing characteristics of Python-Fortran hybrid computing using the mpirun command, as follows:

[0108] $ mpirun -n xx python cm2_cda_main.py>cm2_cda.log

[0109] Where "xx" represents the number of parallel computing cores required by the program, and cm2_cda.log is the file that records the program's execution log. We can insert this run command line into the existing run_script file of the Fortran model and submit the job to the background job queue using the qsub command, allowing it to run on a large-scale MPI computing node. However, it is necessary to ensure that the environment configuration described in the previous section has been completed before the mpirun command is executed.

[0110] Through the above steps of environment configuration, creating a Fortran module that can call Python, developing a Python algorithm that can call Fortran, and designing a simple Python main control program, we have completed the construction of a coupled simulation assimilation basic platform for the CM2-CDA system and AI to be integrated and modeled on a Python-Fortran hybrid programming platform, which is named Hf2pMDA-CM2CDA.

[0111] Step S5, CM2 coupling mode and its weakly coupled assimilation WCDA system

[0112] Step S5-1, CM2 mode

[0113] The CM2 coupled model is a second-generation coupled model developed by the National Oceanic and Atmospheric Administration (GFDL / NOAA) as a member of the Climate Model Initiative's fourth through sixth Coupled Model Intercomparison Programs (CMIP4-6 / IPCC). The CM2 model consists of two components: an atmospheric model including land and an ocean model including sea ice. The atmospheric model AM2.1 and the land model AM2.1-LM2.1 are coupled with the modular ocean model MOM5 and the sea ice simulator SIS. The AM2.1 atmospheric model is based on a finite volume dynamics core, with a horizontal resolution of 2° latitude × 2.5° longitude, the same as LM2.1, and 24 vertical layers. MOM5 has 50 vertical layers: 22 layers in the first 220 meters, each 10 meters thick, with a horizontal B-grid resolution of 1° × 1°, gradually decreasing to a ⅓° longitude interval near the equator. SIS is a dynamic ice model with a three-layer vertical structure: one snow layer, two ice layers, and five ice thickness levels. The time steps for the ocean and atmospheric models are 2 hours and 30 minutes, respectively, and they interact with each other at a coupling frequency of 2 hours.

[0114] Step S5-2, Weakly Coupled Data Assimilation in CM2

[0115] As the first CDA system for assimilating data from the coupled general circulation model CGCM, the initial version of CM2-CDA was developed based on the ensemble Kalman filter (EAKF) and was called the ensemble CDA (ECDA) system, employing a weakly coupled assimilation (WCDA) approach. However, CDA systems based on such ensemble Kalman filters (EnKF) are costly and have limitations in extracting low-frequency observation signals. To address this issue, a multi-scale efficient approximation EnKF (MSHea-EnKF) was designed based on the scale decomposition of long-term time series solutions from a single model and the EnKF framework, and integrated into CM2. Therefore, the current version of CM2-CDA used in this study employs a sequential WCDA workflow, which integrates a single CM2 coupled model with atmospheric-oceanic observation data in real time and updates it dynamically based on the real-time availability of the observation data.

[0116] In WCDA (Atmosphere-Ocean Coupling), atmospheric (ocean) observational data are only used to adjust their own states, and observational information is transferred between the atmosphere and ocean through flux exchanged via the coupling model. If there is a lack of direct observational adjustment between the atmosphere and ocean, imperfect coupling physical mechanisms may still introduce errors into the coupling model, resulting in imperfections in coupled atmosphere-ocean data assimilation. To achieve a fully balanced and coherent coupled state estimation in CDA, researchers have developed the strongly coupled atmosphere-ocean data assimilation (SCDA) method. However, this method still faces challenges from the linear regression limitations of traditional data assimilation algorithms. Given the inherent nonlinearity of machine deep learning AI algorithms, the SCDA method is feasible if introduced as an addendum into the WCDA system.

[0117] Next, we will explain how to apply the existing Hf2pMDA framework to CM2-CDA to build Hf2pMDA-CM2CDA, thereby achieving convenient integration of AI SCDA solutions.

[0118] Step S6: Modular Hf2pMDA-CM2CDA Design

[0119] Step S6.1, Environmental Requirements

[0120] In addition to the standard environment configuration described above, this Hf2pMDA-CM2CDA case also requires the use of OpenMPI for MPI application development. The specific steps include: first, recompiling the OpenMPI package with the "-fPIC" option and installing it using "make install"; then, obtaining the configuration file containing the instructions from the source code and adding the OpenMPI application to the f2py environment; the instructions include the following three lines:

[0121] export PATH=“... / openmpi / bin:$PATH”

[0122] export LIBRARY_PATH=“... / openmpi / lib:$LIBRARY_PATH”

[0123] export LD_LIBRARY_PATH=“... / openmpi / li:$LD_LIBRARY_PATH.”.

[0124] Similarly, the openmpi directory should be located in the specific application directory of Hf2pMDA-CM2CDA to ensure that this openmpi setting does not affect other applications;

[0125] Step S6.2: Recompile all static libraries of CM2-CDA

[0126] The CM2 model features a clear modular structure, with the atmospheric and oceanic components having relatively independent structures. Land serves as the atmospheric boundary process, while sea ice acts as the interface between the atmosphere and ocean. The main controller, `coupler_main`, organizes all interfaces between model components and performs time integration on the atmosphere every half hour and on the ocean and atmosphere-ocean coupling every two hours. The weakly coupled atmospheric dynamics CDA performs atmospheric or ocean dynamics calculations within the atmospheric or oceanic components, thus maintaining the basic logical structure of `coupler_main`. The entire CM2-CDA consists of four static libraries: `libfms.a`, `libland.a`, `libecda.a`, and `libcoupler.a`. To convert the Fortran modules in these static libraries into PCF modules, the main controller `coupler_main.F90` is split into two parts: `cm2_cda_mainsubs.F90` and `cm2_cda_plugs.F90`. `cm2_cda_mainsubs.F90` is essentially `coupler_main.F90`. An improved version, its core program is broken down into a series of subroutines (such as cm2_cda_maininit(), atmos_step(), and ocean_step()), which are responsible for module initialization and single-step model integration, respectively. cm2_cda_plugs.F90, on the other hand, integrates various single-step model components for PMC organization through plugins (such as tool_atmos_step() and tool_ocean_step()).

[0127] Following the previously described process, firstly, the four static library files—libfms.a, libland.a, libecda.a, and libcoupler.a—are recompiled with the '-fPIC' option. Next, the f2py tool is used to merge the cm2_cda_plugs.F90 file with these four static libraries, generating the signature file cm2_cda.pyf and the DLL cm2_cda.python-311-x86_64-linux-gnu.so. Finally, the DLL cm2_cda.python-311-x86_64-linux-gnu.so is placed in the working directory and used in conjunction with cm2_cda_main.py. libfms.a contains all the minimum shared information, such as MPI and remapping functions. libland.a is a relatively independent land model application package based on libfms.a. libecda.a contains all atmospheric and ocean model components, as well as CDA subroutines excluding the land model. libcoupler.a, as the highest-level infrastructure, connects all the above parts through coupler_main.

[0128] Step S6.3, PMC of Hf2pMDA-CM2CDA and its execution

[0129] Based on the PMC architecture design specifications described above, the Python main control program cm2_cda_main.py for Hf2pMDA-CM2CDA was developed. Regarding the time integration configuration of the coupled model, cm2_cda_main.py also handles the task of interfaceing the atmosphere-ocean interface with the AI ​​SCDA algorithm (based on a latent spatial variational autoencoder), which will be described in detail in the next section. Following the aforementioned process, running cm2_cda_main.py completes the system design and operation of Hf2pMDA-CM2CDA.

[0130] Step S7: Implicit Space VAE SCD Function under the Hf2pMDA-CM2CDA Framework

[0131] In Hf2pMDA-CM2CDA, since the PMC cm2_cda_main.py module is responsible for the time integration of the coupled model and can explicitly control the evolution of the atmospheric-ocean coupling interface, the SCDA algorithm can be conveniently integrated into the model integration stage. The following section will elaborate on an SCDA algorithm based on a Latent Spatial Variational Autoencoder (VAE), which integrates the two core mechanisms of latent spatial transformation and minimization optimization within the VAE.

[0132] Step S7.1, VAE implicit space transformation

[0133] VAE (Variational Autoencoder) is a class of deep generative models that integrate artificial neural networks and variational Bayesian methods. This patent uses a VAE model to... Figure 2 This demonstrates the transformation process between the physical space and the latent space. Unlike the basic autoencoder architecture, this version introduces a Gaussian distribution constraint in the latent space, ensuring that the minimized total loss includes the Kullback-Leibler (KL) loss. This guarantees that the distribution of the induced tensor in the latent space approximates a Gaussian distribution; this model is called β-VAE. The core principle of the algorithm is to minimize the total loss L(x) composed of the reconstruction loss and the KL loss (see...). Figure 2 (See image below)

[0134] Generate low-order tensors in the latent space. Figure 2 In the above figure, marked as z, the parameter β is set to 10. -6 The aim is to achieve a compact representation of the latent space while maintaining reconstruction accuracy. The specific data training process for converting between the physical space and the latent space will be described later.

[0135] Step S7.2, SCDA function in latent space minimization

[0136] Based on the VAE latent space transformation described in step S7.1, such as Figure 3 As shown, Latent Space Data Assimilation LDA further introduces a minimization process in the latent space by adding an observation term to the loss function to be minimized (see...). Figure 3 The second half (data assimilation) is implemented. It should be noted that the error covariance matrices B and R are used as scaling factors for the background and observation terms, respectively, ensuring the loss function maintains its dimensionless nature during minimization. The three-dimensional variational method 3D-Var is used for minimization.

[0137]

[0138] The explicit minimization process of LDA (described in detail below) runs extremely fast, thanks to its order reduction property, which significantly reduces the state dimension in the latent space. Atmospheric and oceanic model variables are incorporated into the physical space vector x ( Figure 3 (Input) and integrate atmospheric and oceanic observation data at the air-sea interface (see Input) Figure 3 The operation (as shown in the upper right corner) is very convenient; the final decoded physical space vector is the updated model state that integrates atmospheric and oceanic observation data; thus, Figure 3 The LDA shown implements the SCDA mechanism—atmospheric or oceanic observation data can be adjusted directly and instantly. Ocean or atmospheric conditions; because the encoding and decoding process uses a machine deep learning model that includes nonlinear activation functions, this SCDA mechanism, although it incorporates observational data into the latent space by minimizing the process, makes the most of the nonlinear relationships between variables.

[0139] Step S7.3: Data Training and Latent Space Minimization of VAE

[0140] This section provides specific programming guidance for VAE training and SCDA latent space minimization methods within the Hf2pMDA-CM2CDA framework. The VAE training process has a dual nature: on the one hand, as... Figure 4 As shown in Figure a, the basic process of VAE's encoder and decoder to transform between physical space and latent space is simple and standardized, typically involving only three steps: downsampling, adding constraints in the latent space, and upsampling, and sometimes even just two. On the other hand, the training process for specific application scenarios can vary greatly due to factors such as parameter selection, recurrent layers, and neural network architecture. Therefore, we will explain the specific operation process in detail when presenting the experimental results in the next section.

[0141] Unlike VAE training methods, the latent space minimization process in all applications employs, for example... Figure 4 The unified approach shown in b is as follows: After the training process of the VAE encoder ℇ and decoder D is completed, the trained ℇ and D can efficiently achieve bidirectional transformation between the joint atmospheric-oceanic state vector x and the latent space state vector z; since the dimension of the state vector z in the dimensionless latent space is compressed to a minimum, the minimization process can be completed quickly; when the prior error criterion is satisfied, the assimilated solution is obtained. :

[0142] z0 = ε(x0)

[0143]

[0144] za = arg min( J(z))

[0145] = D(za);

[0146] Step S8, SCDA results of Hf2pMDA-CM2CDA

[0147] Step S8.1: VAE Reconstruction of Air-Sea Interface Physical Variables

[0148] In the Hf2pMDA-CM2CDA system, to generate SCDA results, the VAE encoder and decoder are first trained. Atmospheric and oceanic state variables at the air-sea interface are used to reconstruct the reduced-order state in the latent space. Efficient and accurate latent space reconstruction is the core of this training scheme, which includes multiple aspects such as parameter selection, recurrent layer adjustment, and neural network design. For the requirements of SCDA, we set the input vector x_0 to include atmospheric surface wind speed, temperature, and pressure (Us, Vs, Ts, Ps) and ocean surface current velocity, temperature, and altitude (SSU, SSV, SST, SSH). For detailed training procedures, please refer to [link to training documentation]. Figure 5 .like Figure 5 As shown, the encoder and decoder perform downsampling and upsampling training, respectively. However, it's worth noting that unlike physical states that typically contain only information about a single component of multi-sphere Earth fluids, the physical states transformed in this SCDA case include atmospheric and oceanic information with different characteristic scales. Therefore, a cross-attention mechanism is specifically incorporated into the VAE training process, including information mixing and inverse separation steps. Otherwise, the VAE still follows the general training workflow of downsampling and upsampling.

[0149] First, the variables Us, Vs, Ts, Ps, SSU, SSV, SST, and SSH are standardized to construct the input vector x; then, the following is used... Figure 5 The training process shown uses a 50-year time-series dataset (a total of 14,600 time samples) with 3-hour intervals for training, ultimately obtaining the latent space vector z. The reconstruction accuracy of each variable is as follows: Figure 6 and Figure 7 As shown in the figure, the reconstructed field (sub-plots e, f, g, h) is visually almost identical to the original physical field (sub-plots a, b, c, d). The absolute error of the reconstruction remains within a certain range. Order of magnitude (subplots i, j, k, l). Although the reconstructed field is slightly smoother than the original physical field, its accuracy is sufficient to meet the practical application requirements of climate CM2 SCDA problems.

[0150] Step S8.2, SCDA Results

[0151] In Hf2pMDA-CM2CDA, we constructed a latent space originating from the air-sea interface space through VAE training, thereby efficiently achieving the fusion and optimization of atmospheric and ocean observation data in the model space. Specifically, the original dimension of the physical space coupled state vector was 343,296. After spatial transformation, the size of the latent space state vector was reduced to 20,480, achieving a 94% dimensionality reduction, which enables a fast and efficient optimization process. It is worth noting that although the latent space optimization only used 6% of the physical space vector, the reconstructed field still reasonably presents the background physical information, providing effective support for extracting observation data.

[0152] In this test case, we used surface pressure Ps at a horizontal resolution of 25 km and OISST (Ocean Oceanic and Atmospheric Administration 1 / 4° Daily Optimal Interpolated Sea Surface Temperature) provided by ERA5 (European Centre for Medium-Range Weather Forecasts, Generation 5 Atmospheric Reanalysis) as atmospheric and oceanic observation data, respectively. We ran the Hf2pMDA-CM2CDA system throughout 1982 and presented the validation results. Figure 8 As can be seen, due to the low-frequency and quasi-linear characteristics of ocean motion, both the WCDA and SCDA methods enable the model sea surface temperature to converge rapidly to the observed values, maintaining almost the same root mean square error (RMSE) for most of the time. Conversely, due to the drastic changes within the atmosphere, the Ps RMSE curves of WCDA and SCDA diverge rapidly after a few days, but SCDA fails to show an advantage for several months. After about 4-5 months, SCDA begins to show a slightly smaller RMSE. For the 6-month average from July to December, SCDA reduces the surface pressure error of WCDA by about 4%, with an RMSE of 4.62 for SCDA and 4.81 for WCDA.

[0153] It is worth noting that in the Hf2pMDA-CM2CDA case, the model resolution is quite low (approximately 200 km for the atmosphere and 100 km for the ocean). Under these conditions, the dynamics of the coupled model typically exhibit quasi-linear characteristics, which allows WCDA to effectively integrate most observational information into the coupled model. However, our preliminary results using Hf2pMDA-CM2CDA indicate that after sufficiently long simulations, SCDA can provide additional value to the CDA system. When tropical cyclones or mesoscale eddies pass through, the model needs to resolve fine-scale and frequently occurring air-sea coupling processes, making this characteristic of nonlinear SCDA crucial.

[0154] In the description of this invention, the term "a plurality of" refers to two or more. Unless otherwise explicitly defined, the terms "upper," "lower," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. The terms "connection," "installation," "fixing," etc., should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection or an indirect connection through an intermediate medium. For those skilled in the art, the specific meaning of the above terms in this invention can be understood according to the specific circumstances.

[0155] In the description of this specification, the terms "one embodiment," "some embodiments," "specific embodiment," etc., refer to a specific feature, structure, material, or characteristic described in connection with that embodiment or example, which is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0156] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An intelligent sea-air nonlinear strongly coupled assimilation method based on Python-Fortran hybrid programming, characterized in that Specifically, it includes the following steps: Step S1: General f2py protocol framework The f2py protocol provides a basic framework for integrating Python and Fortran code to perform hybrid computing. Step S2: CM2-CDA and AI based on f2py using a Python-Fortran hybrid computation process Step S2.1, Environment Setup Starting with the Python environment: Enter "conda create -n f2py python=3.11" to create the environment, then execute "conda activate f2py" to activate the environment and "conda install numpy=1.26.4" to install the required software; for non-standard environment variables, use the "source" command to supplement the configuration; Step S2.2: Create a Python-callable CM2-CDA Fortran module PCF After completing the environment configuration, add the "-fPIC" option to the compiler options used by the original CM2-CDA Fortran program to directly perform recompilation; once all the relatively independent CM2-CDA Fortran code has been compiled as DLL candidate files, it can be linked with the Python main controller PMC. The CM2-CDA Fortran subroutine with plug-in functionality is packaged and encapsulated. Then, all PCF modules are integrated into this subroutine, and a signature file named cm2_cda.pyf containing a clear plug-in structure is generated by the command line. The final result will be a complete DLL file; this file is a DDL "shared object" that can be called by Python, in which all subroutines and functions can be called by PMC; all information about the logical structure of cm2_cda.cpython-311-x86_64-linux-gnu.so will be recorded in the signature file cm2_cda.pyf; Step S2.3: Create a Python function that can be called by Fortran for CM2-CDA. An interface named callback_python.F90 is created to convert Python-encoded functions into public subroutines that can be called in Fortran. Simultaneously, the interface file cm2_plug.F90 contains the function definitions and the parameters passed from the PMC to the Fortran application via the plugin. The interface file callback_python.F90 and cm2_plug.F90 are compiled together in step S2.1 to generate the signature file cm2_cda.pyf. Step S3, PMC Architecture Import statements include importing predefined selected Fortran modules from cm2_cda or directly importing all modules in cm2_cda; import statements include various modules required by PMC. Step S4: Implementation of Python-Fortran hybrid computation The parallel computing characteristics of Python-Fortran hybrid computing are demonstrated by using the mpirun command. This run command line is inserted into the existing run_script file of the Fortran model, and the job is submitted to the background job queue using the qsub command to run on a large-scale MPI computing node. Ensure that the environment configuration described in step S2.1 has been completed before the mpirun command is executed. Through the above steps, the basic platform for Python-Fortran hybrid modeling and data assimilation was constructed and named Hf2pMDA-CM2CDA. Step S5, CM2 coupling mode and its weakly coupled assimilation WCDA system Step S5-1, CM2 mode The CM2 model consists of two components: an atmospheric model including land and an ocean model including sea ice. The atmospheric model AM2.1 and the land model AM2.1-LM2.1 are coupled with the modular ocean model MOM5 and the sea ice simulator SIS. The AM2.1 atmospheric model is based on a finite volume dynamics core, with a horizontal resolution of 2° latitude × 2.5° longitude, the same as LM2.1, and 24 vertical layers. MOM5 has 50 vertical layers: 22 layers in the first 220 meters, each 10 meters thick, with a horizontal B-grid resolution of 1° × 1°, gradually decreasing to a ⅓° longitude interval near the equator. SIS is a dynamic ice model with a three-layer vertical structure: one snow layer, two ice layers, and five ice thickness levels. The time steps for the ocean and atmospheric models are 2 hours and 30 minutes, respectively, and they interact with each other at a coupling frequency of 2 hours. Step S5-2, Weakly Coupled Data Assimilation in CM2 The current version of CM2-CDA uses a sequential WCDA workflow, which integrates a single CM2 coupled model with atmospheric-oceanic observation data in real time and updates it dynamically based on the real-time availability of the observation data. Step S6: Modular Hf2pMDA-CM2CDA Design Step S6.1, Environmental Requirements Hf2pMDA-CM2CDA uses OpenMPI for MPI application development; the specific steps include: first, recompiling the OpenMPI package with the "-fPIC" option and installing it using "make install"; then, obtaining the configuration file containing the instructions from the source code and adding the OpenMPI application to the f2py environment; Step S6.2: Recompile all static libraries of CM2-CDA The CM2 model features a clear modular design, with the atmospheric and oceanic components having relatively independent structures. Land serves as the atmospheric boundary process, while sea ice acts as the interface between the atmosphere and the ocean. The main controller, coupler_main, organizes all interfaces between model components and performs time integration on the atmosphere every half hour and on the ocean and atmosphere-ocean coupling every two hours. CM2-CDA consists of four static libraries: libfms.a, libland.a, libecda.a, and libcoupler.a. To convert the Fortran modules in these static libraries into PCF modules, the main controller coupler_main.F90 is split into two parts: cm2_cda_mainsubs.F90 and cm2_cda_plugs.F90. First, recompile the four static library files: libfms.a, libland.a, libecda.a, and libcoupler.a by adding the '-fPIC' option. Then, use the f2py tool to merge the cm2_cda_plugs.F90 file with these four static libraries, generating the signature file cm2_cda.pyf and the DLL cm2_cda.python-311-x86_64-linux-gnu.so. Finally, place the DLL cm2_cda.python-311-x86_64-linux-gnu.so file in the working directory to use in conjunction with cm2_cda_main.py. Step S6.3, PMC of Hf2pMDA-CM2CDA and its execution Develop the Python main control program cm2_cda_main.py for Hf2pMDA-CM2CDA based on the PMC architecture; following the process described above, the system design and operation of Hf2pMDA-CM2CDA can be completed by running cm2_cda_main.py. Step S7: Implicit Space VAE SCD Function under the Hf2pMDA-CM2CDA Framework Step S7.1, VAE implicit space transformation The transformation process between the physical space and latent space of the VAE model is employed, introducing a Gaussian distribution constraint into the latent space. This ensures that the minimized total loss includes the Kullback-Leibler loss, thus making the distribution of the induced tensor in the latent space approximately Gaussian. This model is called β-VAE. By minimizing the total loss L(x) composed of reconstruction loss and KL loss, , Generate a low-order tensor, denoted as z, in the latent space, and set the parameter β to 10. -6 ; Step S7.2, SCDA function in latent space minimization Based on the VAE latent space transformation described in step S7.1, the latent space data assimilation LDA further introduces a minimization process in the latent space. By adding the observation term to the loss function to be minimized, and using the error covariance matrix B and R as scaling factors for the background term and the observation term, respectively, the loss function maintains its dimensionless characteristics during the minimization process. The three-dimensional variational method 3D-Var is used for minimization. , Atmospheric and oceanic model variables are incorporated into the physical space vector x, and atmospheric and oceanic observation data are integrated at the air-sea interface. The final decoded physical space vector represents the updated model state that integrates atmospheric and oceanic observation data. LDA thus realizes the SCDA mechanism—atmospheric or oceanic observation data can be adjusted directly and instantly. Ocean or atmospheric conditions; Step S7.3: Data Training and Latent Space Minimization of VAE For the VAE training and SCDA latent space minimization method under the Hf2pMDA-CM2CDA framework, the encoder and decoder of VAE training successively include three steps: downsampling, adding constraints in the latent space, and upsampling. The latent space minimization process employs the following steps: After the training of the VAE encoder ℇ and decoder D is completed, the trained ℇ and D achieve a bidirectional transformation between the joint atmospheric-oceanic state vector x and the latent space state vector z. Since the dimension of the state vector z in the dimensionless latent space is compressed to a minimum, the minimization process is completed. When the prior error criterion is satisfied, the assimilated solution is obtained. : z 0 = ε( x 0 ), , z a = arg min( J ( z )), = D ( z a ) ; Step S8, SCDA results of Hf2pMDA-CM2CDA Step S8.1: VAE Reconstruction of Air-Sea Interface Physical Variables In the Hf2pMDA-CM2CDA system, to generate SCDA results, the encoder and decoder of the VAE are first trained. The atmospheric and ocean state variables of the air-sea interface are used to reconstruct the reduced-order state in the latent space. The input vector x_0 is set to include the u component Us of atmospheric surface wind speed, the v component Vs of atmospheric surface wind speed, atmospheric surface temperature Ts, atmospheric surface pressure Ps, and the u component SSU of ocean surface current velocity, the v component SSV of ocean surface current velocity, sea surface temperature SST, and sea surface height SSH. The encoder and decoder are trained by downsampling and upsampling respectively. First, the variables Us, Vs, Ts, Ps, SSU, SSV, SST, and SSH are standardized to construct the input vector x. Then, a training process is adopted, using a 50-year time series dataset containing 3-hour intervals for training, and finally the latent space vector z is obtained.

2. The intelligent sea-air nonlinear strongly coupled method based on Python-Fortran hybrid programming according to claim 1, characterized in that In step S2.2, several candidate DLL files are generated during the compilation process. The specific packaging and encapsulation commands are as follows: $FC="mpif90" CC="mpicc" CXX ="mpicxx" ldshared="mpif90" ldflags="-no-ipo-Wl,-Wl,--export-dynamic" f2py -c cm2_cda.pyf cm2_plugs.F90 libapp1.alibapp2.a ... -lincdf - L / ... / software / netcdf3 / lib - L / ... / openmpi / lib --backenddistutils The option "-no-ipo" disables cross-module optimization to reduce potential uncertainties during optimization; while the option "-Wl" ensures that all functions associated with the DLL file are called correctly; in this case, the openmpi / lib file also needs to be recompiled using the "-fPIC" tag.

3. The intelligent sea-air nonlinear strongly coupled data assimilation method based on Python-Fortran hybrid programming according to claim 1, characterized in that In step S4 The parallel computing characteristics of Python-Fortran hybrid computing are demonstrated using the `mpirun` command. The specific command is as follows: $ mpirun -n xx python cm2_cda_main.py >cm2_cda.log Where "xx" represents the number of parallel computing cores required by the program, and cm2_cda.log is the file that records the program's running log.

4. The intelligent sea-air nonlinear strongly coupled data assimilation method based on Python-Fortran hybrid programming according to claim 1, characterized in that The instructions in step S6.1 include the following three lines of instructions: export PATH="... / openmpi / bin:$PATH" export LIBRARY_PATH="... / openmpi / lib:$LIBRARY_PATH" export LD_LIBRARY_PATH="... / openmpi / li:$LD_LIBRARY_PATH.".

5. The Python-Fortran hybrid programming intelligent sea-air nonlinear strongly coupled method based on claim 1, characterized in that In step S6.2, libfms.a contains all the lowest shared information; libland.a is a relatively independent land model application package based on libfms.a; libecda.a contains all atmospheric and ocean model components as well as CDA subroutines except for the land model; libcoupler.a, as the highest level of infrastructure, connects all the above parts through coupler_main.

Citation Information

Patent Citations

  • Air-sea coupling data sampling method based on asynchronous cross iteration random sampling strategy

    CN119670585A

  • Regional refined sea wave coupling numerical forecasting method based on non-static mode

    CN120255023A