A Parametric Scan-to-FEM Framework for the Digital Twin Generation of Historic Masonry Structures

: Historic masonry buildings are characterised by uniqueness, which is intrinsically present in their building techniques, morphological features, architectural decorations, artworks, etc. From the modelling point of view, the degree of detail reached on transforming discrete digital representa-tions of historic buildings, e.g., point clouds, into 3D objects and elements strongly depends on the ﬁnal purpose of the project. For instance, structural engineers involved in the conservation process of built heritage aim to represent the structural system rigorously, neglecting architectural decorations and other details. Following this principle, the software industry is focusing on the deﬁnition of a parametric modelling approach, which allows performing the transition from half-raw survey data (point clouds) to geometrical entities in nearly no time. In this paper, a novel parametric Scan-to-FEM approach suitable for architectural heritage is presented. The proposed strategy uses the Generative Programming paradigm implementing a modelling framework into a visual programming environment. Such an approach starts from the 3D survey of the case-study structure and culminates with the deﬁnition of a detailed ﬁnite element model that can be exploited to predict future scenarios. This approach is appropriate for architectural heritage characterised by symmetries, repetition of modules and architectural orders, making the Scan-to-FEM transition fast and efﬁcient. A Portuguese monument is adopted as a pilot case to validate the proposed procedure. In order to obtain a proper digital twin of this structure, the generated parametric model is imported into an FE environment and then calibrated via an inverse dynamic problem, using as reference metrics the modal properties identiﬁed from ﬁeld acceleration data recorded before and after a retroﬁtting intervention. After assessing the effectiveness of the strengthening measures, the digital twin ability of reproducing past and future damage scenarios of the church is validated through nonlinear static analyses.


Introduction
Given its important role for economies and societies, the preventive conservation and maintenance of the built cultural heritage (BCH) continue to stand as major priorities of the overall political strategy at the European level. In this context, the earthquake protection of historic masonry structures (HMSs) assumes particular relevance because of the non-negligible seismic vulnerability of this type of ancient buildings whose tangible and intangible value is further enhanced by the artworks therein located, such as sculptures, paintings and frescos, among others. This means that when a disaster involves HMSs, it is likely that artworks are damaged, producing not only a physical loss of artistic and historical materials, but also an immaterial loss of memory and cultural identity for the people to whom that legacy "belongs".
In the last decade, impressive advancements have been made in the documentation and preservation of the BCH structural integrity. The possibilities offered by today's tools and workflows for digital representation, information and management, open new yet challenging perspectives in terms of geometry acquisition [1][2][3], and data dissemination. Given the framework above, the concept of Digital Twin (DT), originally defined as "A model of the physical object or system, which connects digital and physical assets, transmits data in at least one direction, and monitors the physical system in real-time" [4], has gradually attracted the attention of the building sector. As a result, the DT concept is becoming popular as a comprehensive approach to manage, plan, predict, and demonstrate building infrastructure or city assets [5][6][7]. Concerning the historic masonry structures, an early attempt involving the development of a comprehensive methodology to structure and integrate the significance of tangible and intangible elements into HBIM models was proposed by Angjeliu et al. (2020) [8]. However, applications to the HMS are very limited, and many technical challenges still need to be addressed to achieve the full utilisation of this powerful tool. Major pending issues include the rapid yet accurate collection and modelling of spatial and nonspatial data, the online monitoring of the structural health, the realistic numerical simulation of the system behaviour against plausible future scenarios, and the real-time assessment of the structural condition for fast decision making during emergency operations.
Thanks to the evolution of geomatics methodologies, several solutions are available nowadays for the generation of refined models of real-world structures, exploiting either automatic or semi-automatic meshing of the point clouds [9] and resorting to manual or parametric modelling approaches [10]. This phase of transition from half-raw survey data (point clouds) to realistic parametric models, typical of BIM projects, is known as Scan-to-FEM. Such a step may be rather demanding in case of BCH because of the irregular and complex shapes often characterising historic buildings. This step is typically carried out using remote sensing techniques, i.e., laser scanning and digital photogrammetry [11][12][13].
From the structural perspective, point clouds cannot be used for numerical analyses because they are formed by many discrete points defined by three-dimensional coordinates. In order to effectively use the geometric data derived by 3D laser scanning for structural purposes, it is necessary to perform operations that transform a point cloud into a continuum model. To handle these processes, several approaches have been recently proposed in the literature for the automatic mesh generation of HMS models from 3D point clouds. Barazzetti et al. [9] proposed a two-step methodology to convert the point cloud to a BIM model and then import the model into an FEM software. They demonstrated how the BIM approach could be applied to achieve structural analysis aims without creating ad hoc models only for the purpose of structural simulation. Castellazzi et al. [14] designed a new semi-automatic procedure to transform three-dimensional point clouds of complex objects to three-dimensional finite element models. The procedure aimed at solving the problems connected to the generation of FE models of complicated structures by constructing a fine discretised geometry with a reduced amount of time and ready to be employed for structural analyses. Similarly, Fortunato et al. [15] and Pepe et al. [16] developed Scan-to-FEM procedures suitable for historic masonry structures characterised by several geometrical irregularities. Although worthy of notice, none of the referred procedures employs algorithms able to provide a general solution to the problem; indeed, the development and the optimisation of Scan-to-FEM tools appropriate for BCH is still an ongoing process. Another key issue not to overlook concerns the crucial role that the generation of a three-dimensional model plays to improve the monument knowledge level, hence it cannot be considered totally user-independent.
The application of the DT concept to the protection and conservation of the BCH implies the possibility to accurately simulate the structural response over time in order to understand its behaviour and prevent future problems. To achieve this, the BCH must be instrumented by means of an appropriate sensor network for data-driven condition monitoring, ideally coupled with a detailed numerical model of the structure validated on the basis of acquired field data. In particular, the data collected through permanent vibration monitoring systems may be exploited to automatically calibrate and update the structural Sustainability 2021, 13, 11088 3 of 22 model characteristics through the use of internet of things (IoT) technology [17,18]. During this process, it is possible to quantify the degree of representativeness and accuracy of the digital model and, further on, to identify the necessary steps to be undertaken if the model is to be improved. In this framework, numerical simulations give a significant contribution to the prediction of possible future damage scenarios and, accordingly, to the definition of appropriate warning levels. In particular, in what concerns BCH, structural analyses against critical scenarios can be profitably used to uncover the weakest parts of the system and to identify in advance the most probable damage locations following adequate seismic scenarios of different magnitude. In the last decade, numerical models, either based on the Discrete Element Method (DEM) or FEM approaches, have been extensively used for dynamic analysis of the HMS [19]. DEM was found particularly suitable to model large displacement dynamics, typically associated with low-mortar strength masonry, which is a common characteristic of BCH [20,21]. However, FEM approach is still the most used strategy because of its suitability for simulating the structures' dynamic behaviour [3,22]. In particular, FEM models are useful to conduct classical modal analysis [23,24] that could be, in turn, compared and fitted to the actual one issued from SHM tools [2,25,26]. In this regard, several applications can be found in the literature, also referring to historical constructions [2,27].
In light of the above, it is worth remarking how generating digital replicas of historic masonry structures is a challenging and often burdensome task, which goes far beyond a slavish geometric representation. It is necessary to reconstruct the life of the monument, thus including any intervention or damage-induced change that occurred across centuries, also resulting from anthropogenic actions. Afterwards, historic analysis and experimental evidence must be combined to verify the initial hypotheses made on the model, and monitoring tools must be considered to track and keep up to date the response of the structure in order to promptly detect anomalous behaviours. Indeed, the development of a digital replica, able to monitor in real-time the evolution of the behaviour of existing structures, is in accordance with the state-of-art recommendations for the preservation of the BCH, inspired by the Venice Charter principles (1964) [28].
The present paper aims to define a parametric Scan-to-FEM framework for the DT generation of HMSs, which is straightforward and computationally efficient in case of massive buildings characterised by the repetition of architectural and structural modules and/or components. The proposed procedure exploits the flow-based programming paradigm, in which the user can interact with the code by modifying and/or implementing new capabilities. It also includes the definition of a Python script for the real-time interoperability between Rhino3D + Grasshopper [29,30] and Abaqus CAE [31]. The approach has been applied and validated through an emblematic case study: the Church of St. Torcato in Guimarães (Portugal).
This study aims at exploring the potential of Generative Programming, whose efficiency has been already demonstrated in the scientific literature with other aims [32][33][34][35], for the Scan-to-FEM purpose. As previously mentioned, the code relies on flow-based programming, having the point cloud of the structure as an input, whereas the outcome consists of proper script files for the real-time importing into an FEM software. To accomplish the latter, the framework described next has been followed:

1.
Acquisition of qualitative and quantitative data for the case study.

2.
Geometrical and formal analysis of the structure. In this context, the research question is this: Can the case study be discretised parametrically by identifying (i) entities, (ii) sub-entities, (iii) modules and repetitions, iv) symmetries? 3.
Implementation of instance-based parametric components for each structural module using Python programming languages. The so-created library of elements can be visualised in Rhino3D + Grasshopper [29,30] software.

4.
Integration of the geometrical asset along with the mechanical characteristics of the structural elements and parametrisation of the damage.  5. Development of a proper script for the real-time link between the parametric environment and the finite element software. 6.
Calibration of the numerical model.
The novelties of the study are threefold and are outlined next: 1.
Pioneering application of Generative Algorithm to historic masonry structures.

2.
Definition of a "real-time" bridge to couple geometrical asset and finite element model.

3.
Calibration of the digital copy of the analysed church through long-term monitoring data and simulation of its future response against likely adverse scenarios.
The paper is organised as follows. Section 2 presents the case of study from the historical, material and geometrical point of view; Section 3 describes the Generative Scan-to-FEM Algorithm; Section 4 focuses on the FE model calibration performed on both strengthened and unstrengthened configuration of the church. Section 5 demonstrates how the digital twin can be exploited to predict the structural behaviour in response to simulated critical scenarios. Finally, some remarkable conclusions are reported in Section 6.

Case Study Description and in Situ Investigations
Built across the 19th and the 20th century to treasure the body of the homonymous Saint, the Church of St. Torcato is a Neo-Manueline construction situated in Northern Portugal ( Figure 1a). The plan of the church features a typical Latin cross shape with a unique central nave of 58 m length, ending into an apse (North oriented), and a transept of about 37 m length, both covered with barrel vaults supported by a series of semi-circular arches arising from the bearing pillars of the lateral walls, see Figure 1b. A roofing system consisting of wooden trusses and tiles protects the vaults beneath, whereas the crossing between nave and transept, above the main altar, is covered with a dome that lays over an octagonal tambour supported by four semi-circular arches. The gabled façade is framed by two spired towers characterised by a rectangular plan of 7.5 m × 6.3 m and a total height of 58 m. Inner staircases running along the walls allow us to go up the towers and reach the level of the bells, the latter present only in the western side. Lateral chapels, accessible from the outside, extend between the transept and the towers along the longitudinal walls of the nave.
3. Implementation of instance-based parametric components for each structural module using Python programming languages. The so-created library of elements can be visualised in Rhino3D + Grasshopper [29,30] software. 4. Integration of the geometrical asset along with the mechanical characteristics of the structural elements and parametrisation of the damage. 5. Development of a proper script for the real-time link between the parametric environment and the finite element software. 6. Calibration of the numerical model. The novelties of the study are threefold and are outlined next: 1. Pioneering application of Generative Algorithm to historic masonry structures. 2. Definition of a "real-time" bridge to couple geometrical asset and finite element model. 3. Calibration of the digital copy of the analysed church through long-term monitoring data and simulation of its future response against likely adverse scenarios. The paper is organised as follows. Section 2 presents the case of study from the historical, material and geometrical point of view; Section 3 describes the Generative Scanto-FEM Algorithm; Section 4 focuses on the FE model calibration performed on both strengthened and unstrengthened configuration of the church. Section 5 demonstrates how the digital twin can be exploited to predict the structural behaviour in response to simulated critical scenarios. Finally, some remarkable conclusions are reported in Section 6.

Case Study Description and in Situ Investigations
Built across the 19 th and the 20 th century to treasure the body of the homonymous Saint, the Church of St. Torcato is a Neo-Manueline construction situated in Northern Portugal ( Figure 1 (a)). The plan of the church features a typical Latin cross shape with a unique central nave of 58 m length, ending into an apse (North oriented), and a transept of about 37 m length, both covered with barrel vaults supported by a series of semi-circular arches arising from the bearing pillars of the lateral walls, see Figure 1 (b). A roofing system consisting of wooden trusses and tiles protects the vaults beneath, whereas the crossing between nave and transept, above the main altar, is covered with a dome that lays over an octagonal tambour supported by four semi-circular arches. The gabled façade is framed by two spired towers characterised by a rectangular plan of 7.5 m × 6.3 m and a total height of 58 m. Inner staircases running along the walls allow us to go up the towers and reach the level of the bells, the latter present only in the western side. Lateral chapels, accessible from the outside, extend between the transept and the towers along the longitudinal walls of the nave.    In order to understand the origin of the severe damage exhibited by the structure since the 1970s, the church has been progressively the object of extensive in situ investigations, including regular visual inspections, long-term monitoring of case-specific state indicators as well as topographic and geotechnical surveys. Particularly, two large diagonal cracks following a V-shaped pattern that began at the keystone of the portal were crossing the entire thickness of the façade up to the tympanum, exceeding 50 mm width and showing an increasing opening rate of 0.1 mm/year [1]. Apart from that, towers were tilting, and other minor cracks were present on the outer wall of the gallery and along the weakest links of both nave and transept walls, at the level of the spandrels. The investigations allowed us to discover that the observed damage was caused by the differential settlements that originated below the front part of the church because of the poor mechanical characteristics of the soil. Such settlements progressively led the towers to lean and the façade to crack due to the increasing tensile stresses induced by the towers tilting. In this regard, the first 3D laser scanning conducted in 2014 [36] highlighted that the towers were leaning forward in a longitudinal direction and moving apart in a transversal direction, reading major tilting values for the western tower equal to 5 mm/m in west direction and to 3 mm/m in south direction [8]. This outcome, in accordance with the relative results provided by the tiltmeters installed on top of the towers, allowed us to infer about the acceptability of their rotation angles with respect to the threshold limits identified through subsequent stability analyses [1]. Still, the appearance of the monument resulted visibly compromised, making it necessary to intervene for removing the root causes of the damage and guaranteeing the stability of the structure for centuries to come. For an extensive description of the building pathology, the reader is referred to Masciotta et al. [1].

Structural Intervention
With the aim of reinstating the sound condition of the church, strengthening works were carried out between April 2014 and July 2015. The design of the structural intervention was conceived not only to contain the existent damage, but also to prevent its further occurrence and to meet both conservation and economic requirements.
The adopted measures, schematised in Figure 2, included the consolidation of the towers' foundation in order to eliminate the differential soil settlements; the insertion of post-stressed tie rods to restrain the towers; and the injection of passing cracks.
The underpinning system consisted of eight micro-piles (type M-80) evenly distributed along the front and lateral outer sides of each tower, and eight micro-piles placed along the inner perimeter of either tower. The micro-piles were filled with high resistance concrete and their length was calculated in order to reach the steady bedrock layer beneath. Reinforced concrete beams anchored by pre-stressed stainless-steel bars were constructed alongside the towers' footing in order to connect the outer micro-piles and better transfer the load of the superstructure to the ground. Given the different shape of the foundation, no beam underpinning was adopted for the interior of the towers: here the micro-piles were directly installed into the masonry basement, working for friction. The tie-rod anchoring system was conceived to restrain the towers' leaning and consequently attenuate the tensile stresses that caused the cracking of the façade. The system was designed according to the CINTEC®anchoring method and counted four couples of steel ties of 25-mm diameter, two at the choir level and two at the vault extrados, reasonably located in order to fulfil their function but also to minimise their impact on the fabric, avoiding any visible alteration. To prevent the transmission of torsional effects between the towers, the tie rods were placed symmetrically.
Finally, grout injections were used to fill in the cracks present in the walls with the purpose of restoring the material continuity and the original strength of the structure without causing physical or chemical alterations. A pozzolanic lime-based mortar appositely designed for historical masonry was employed; indeed, the hydraulic nature of the mortar is supposed not to affect the steam-water permeability characteristics of the building. without causing physical or chemical alterations. A pozzolanic lime-based mortar appositely designed for historical masonry was employed; indeed, the hydraulic nature of the mortar is supposed not to affect the steam-water permeability characteristics of the building.
The designed intervention was proven effective by the analysis of continuous vibration data [1], though permanent deformations resulting from the former settlements and cracks can still be observed in the choir above the entrance. Figure 2. Design of the structural intervention: front elevation view of towers anchoring system and foundation strengthening (above); technical details of the foundation underpinning (below).

Laser Scanner Acquisition
A few years after the structural intervention, the conservation state of the church was again documented in the framework of the HeritageCare project [37]. On that occasion, advanced digital tools were exploited to achieve a more detailed knowledge of the recently restored building and to keep track of its current condition for future comparative analysis. Particularly, in June 2019, a laser scanner survey was performed by means of a Leica ScanStation P20 aiming at obtaining high-resolution spatial data for both accurate geometrical representation and geo-referenced damage mapping. This laser scanner is based on the Wave Form Digitizer principle, which combines the time-of-flight and phase The designed intervention was proven effective by the analysis of continuous vibration data [1], though permanent deformations resulting from the former settlements and cracks can still be observed in the choir above the entrance.

Laser Scanner Acquisition
A few years after the structural intervention, the conservation state of the church was again documented in the framework of the HeritageCare project [37]. On that occasion, advanced digital tools were exploited to achieve a more detailed knowledge of the recently restored building and to keep track of its current condition for future comparative analysis. Particularly, in June 2019, a laser scanner survey was performed by means of a Leica ScanStation P20 aiming at obtaining high-resolution spatial data for both accurate geometrical representation and geo-referenced damage mapping. This laser scanner is based on the Wave Form Digitizer principle, which combines the time-of-flight and phase shift measurement technology to acquire the data. A total number of 174 scans and a maximum capture rate of 1,000,000 points per second were necessary to digitally capture the entire construction with millimetric accuracy. Thanks to this powerful digital tool, a valuable reference 3D model featuring 3 billion points (later reduced to 17 million) and carrying precise volumes of information about the exterior and interior of the church was obtained and herein exploited to build the geometry of its digital twin. Some representative views of the final point cloud are shown in Figure 3.
shift measurement technology to acquire the data. A total number of 174 scans and a m imum capture rate of 1,000,000 points per second were necessary to digitally capture entire construction with millimetric accuracy. Thanks to this powerful digital tool, a v uable reference 3D model featuring 3 billion points (later reduced to 17 million) and c rying precise volumes of information about the exterior and interior of the church w obtained and herein exploited to build the geometry of its digital twin. Some represen tive views of the final point cloud are shown in Figure 3.

Generative Scan-to-FEM Algorithm
The software industry is currently focusing on the definition of parametric-bas modelling approaches, which allow performing in no time the transition from half-r survey data (point clouds) to 3D geometrical entities, i.e., CAD or BIM elements. Su approaches may be widely applicable to heritage buildings because they are frequen characterised by architectural layouts consisting of regular modules and repetition of chitectural orders [38,39]. In this context, Generative Programming (GP) appears as a liable and efficient solution, being a programming paradigm based on the code-reuse c cepts, which imply the use of the coding knowledge following the reusability princip [40].
Because of its potential, GP has been widely employed for the design of new op mised buildings having exciting shapes, whereas only a few applications to historic m sonry buildings are present hitherto in the literature [41]. The main limitation is tha parametric approach may not be suitable for nonregular structures. In such cases, modelling must be performed manually or by blending other kinds of 3D modelling g eration, e.g., polygonal modelling [15].
In the following subsections, a GP paradigm is adopted for the Scan-to-FEM mig tion of St. Torcato Church. Figure 4 schematises the proposed methodology workflo whose steps are specified in the green box.

Generative Scan-to-FEM Algorithm
The software industry is currently focusing on the definition of parametric-based modelling approaches, which allow performing in no time the transition from half-raw survey data (point clouds) to 3D geometrical entities, i.e., CAD or BIM elements. Such approaches may be widely applicable to heritage buildings because they are frequently characterised by architectural layouts consisting of regular modules and repetition of architectural orders [38,39]. In this context, Generative Programming (GP) appears as a reliable and efficient solution, being a programming paradigm based on the code-reuse concepts, which imply the use of the coding knowledge following the reusability principles [40].
Because of its potential, GP has been widely employed for the design of new optimised buildings having exciting shapes, whereas only a few applications to historic masonry buildings are present hitherto in the literature [41]. The main limitation is that a parametric approach may not be suitable for nonregular structures. In such cases, the modelling must be performed manually or by blending other kinds of 3D modelling generation, e.g., polygonal modelling [15].
In the following subsections, a GP paradigm is adopted for the Scan-to-FEM migration of St. Torcato Church. Figure 4 schematises the proposed methodology workflow, whose steps are specified in the green box. Once the acquisition of the point cloud is performed, the geometry of the case study is analysed in order to discern whether it could be parametrically discretised by identifying i) entities, ii) sub-entities, iii) modules repetitions, and iv) symmetries. Afterwards, the geometry of the sub-entities is parametrised by means of a proper generative script. Next,  Once the acquisition of the point cloud is performed, the geometry of the case study is analysed in order to discern whether it could be parametrically discretised by identifying (i) entities, (ii) sub-entities, (iii) modules repetitions, and (iv) symmetries. Afterwards, the geometry of the sub-entities is parametrised by means of a proper generative script. Next, the sub-entities are assembled in the entities and allocated in specific positions following the architectural layout of the analysed structure. Finally, the geometry of the church and the elastic parameters of the materials are retrieved into an ad hoc pre-compiled Python script that runs within Abaqus program to assemble the FE model in no time.

Identifying, Coding and Assembling for Entities and Sub-Entities
The purpose of this study is not to perform a stone-by-stone digital representation of the analysed structure; metric and morphological values are both deemed important in global terms, but elements are represented by their overall ideal geometry without differentiating among the single constitutive materials (e.g., walls are represented as unique shapes and units are not distinguished). On the contrary, secondary elements such as windows, architectural decorations or furniture are not considered in the model due their structural irrelevance.
Hereafter, the library of entities defining the architectural layout of the monument is presented. This identification step (node 3 in Figure 4) is currently performed by hand, though future developments may include the adoption of other criteria to discretise the building in entities and sub-entities, e.g., considerations about the material homogeneity or the use of sophisticated segmentation algorithms for automatic recognition [42,43]. Table 1 shows some examples of architectural modules that repeat across the church. They represent the main entities of the model and are, in turn, discretised into sub-entities, namely into primary architectural elements, like columns, bases, etc.       Entity-9 Wall with Opening Top Tower In order to perform the Scan-to-FEM migration of each sub-entity (node 4 in Figure  4), the algorithm reported in Table 2 has been developed. It is worth stressing again that the goal of this study is to rigorously represent the structural system of the church in order to create a 3D digital mirror suitable for structural analyses; hence ornamental details are neglected on purpose. Entity-9 Wall with Opening Top Tower In order to perform the Scan-to-FEM migration of each sub-entity (node 4 in Figure  4), the algorithm reported in Table 2 has been developed. It is worth stressing again that the goal of this study is to rigorously represent the structural system of the church in order to create a 3D digital mirror suitable for structural analyses; hence ornamental details are neglected on purpose. Definition of the generative NURBS In order to perform the Scan-to-FEM migration of each sub-entity (node 4 in Figure 4), the algorithm reported in Table 2 has been developed. It is worth stressing again that the goal of this study is to rigorously represent the structural system of the church in order to create a 3D digital mirror suitable for structural analyses; hence ornamental details are neglected on purpose. Referring to Table 2, the first step consists of the identification of the primitive geometries which fit the sub-entities, e.g., hexahedra to represent masonry walls, cylinders to reproduce pillars, etc. To this purpose, the point cloud is analysed, carrying out some semi-automatic operations such as horizontal and vertical slicing to detect the NURBS curves that generate the 3D shape of each sub-entity. Hence some attributes are selected and adopted as input of the component, which gives the parametric model of the sub-entity as output. For the sake of clarity Table 3 represents the attribute adopted to discretise the sub-entity 4. Table 3. Attribute adopted to discretise the sub-entity 4.

Height
In order to perform the Scan-to-FEM migration of each sub-entity ( 4), the algorithm reported in Table 2 has been developed. It is worth stre the goal of this study is to rigorously represent the structural system of the to create a 3D digital mirror suitable for structural analyses; hence ornam neglected on purpose.  Table 2, the first step consists of the identification geometries which fit the sub-entities, e.g., hexahedra to represent cylinders to reproduce pillars, etc. To this purpose, the point cloud is an out some semi-automatic operations such as horizontal and vertical slic NURBS curves that generate the 3D shape of each sub-entity. Hence som selected and adopted as input of the component, which gives the parame sub-entity as output. For the sake of clarity Table 3 represents the attri discretise the sub-entity 4, Table 3. Attribute adopted to discretise the sub-entity 4.

Sub-entity 4 Height Segments Polygon
Radius -top Radius -bottom One can note that each sub-entity needs different attributes to perfor hence, a generative algorithm is coded for each sub-entity through component available in Grasshopper [30]. These components are then extensive library of objects used in turn to generate the assemblage of all Table 1 and node 5 in Figure 4). It is worth noting that the so-created subbe used for other projects just by adapting their dimensions, thanks to definition ensured by Grasshopper [30]. The concept behind the recu generated sub-entities is clearly explained in nodes 4 and 5 of Figu assembling of the entities is schematically represented. For the sake of represents the generative modelling of entity-1, which is formed by seven is assembled through a proper GH Python where RhinoScriptSyntax libra adopted [29,30].

Radius -bottom
One can note that each sub-entity needs different attributes to perform its 3D model; hence, a generative algorithm is coded for each sub-entity through the GHPython component available in Grasshopper [30]. These components are then included in an extensive library of objects used in turn to generate the assemblage of all the entities (see Table 1 and node 5 in Figure 4). It is worth noting that the so-created sub-entities may also be used for other projects just by adapting their dimensions, thanks to the parametric definition ensured by Grasshopper [30]. The concept behind the recursive use of the generated subentities is clearly explained in nodes 4 and 5 of Figure 4 where the assembling of the entities is schematically represented. For the sake of clarity, Figure 5 represents the generative modelling of entity-1, which is formed by seven sub-entities and is assembled through a proper GH Python where RhinoScriptSyntax library functions are adopted [29,30].
At this stage, the model generation passes through implementing the rationale rules that define the original layout of the case study (node 6 in Figure 4). Such a stage is also performed using a GHPython script. The entities constitute the input data, and the script provides them rotated, moved, and copied to match the point cloud model. One can note that the most time-consuming step consists of the "translation" of the original architectural layout into a set of coding rules to get the full geometry of the structure (Figure 6). A futuristic vision would be the use of artificial intelligence in order to automatise such a procedure. However, computer science is still far from achieving these results that would enormously decrease costs and processing times. As outputs, the entities are collected into a list that is used as an input for the next step, i.e., the importing process into the FE environment. Sustainability 2021, 13, x FOR PEER REVIEW 11 of 22 At this stage, the model generation passes through implementing the rationale rules that define the original layout of the case study (node 6 in Figure 4). Such a stage is also performed using a GHPython script. The entities constitute the input data, and the script provides them rotated, moved, and copied to match the point cloud model. One can note that the most time-consuming step consists of the "translation" of the original architectural layout into a set of coding rules to get the full geometry of the structure (Figure 6). A futuristic vision would be the use of artificial intelligence in order to automatise such a procedure. However, computer science is still far from achieving these results that would enormously decrease costs and processing times. As outputs, the entities are collected into a list that is used as an input for the next step, i.e., the importing process into the FE environment.   At this stage, the model generation passes through implementing the rationale rules that define the original layout of the case study (node 6 in Figure 4). Such a stage is also performed using a GHPython script. The entities constitute the input data, and the script provides them rotated, moved, and copied to match the point cloud model. One can note that the most time-consuming step consists of the "translation" of the original architectural layout into a set of coding rules to get the full geometry of the structure (Figure 6). A futuristic vision would be the use of artificial intelligence in order to automatise such a procedure. However, computer science is still far from achieving these results that would enormously decrease costs and processing times. As outputs, the entities are collected into a list that is used as an input for the next step, i.e., the importing process into the FE environment. Figure 6. Schematic representation of the assemblage of whole the entities through GHPython script. Figure 6. Schematic representation of the assemblage of whole the entities through GHPython script.

Importing Process in FE Environment
One of the main gaps still not covered in the literature is the definition of a proper tool for automatically importing the geometrical and mechanical features of three-dimensional digital assets into a finite element software. In the present work, the link between Grasshopper [30] and Abaqus CAE [34] is performed by using LunchBox [44] plugin for Grasshopper [30] along with a pre-compiled Python code, which enables a seamless connection of the parametric model to the FE environment for structural engineering purposes. Figure 7 schematises the proposed approach. LunchBox allows us to export the full geometry of the church in .stp file format within a specific path-as well as lists containing i) the elastic properties of the single entities (which are defined taking into account the damage state of each structural part by applying penalty values), ii) the coordinates that define the position of the constraints, iii) the computational mesh size that the user wants to apply for each entity, and iv) the loads that are saved in the same folder as .txt file format. The migrated files are automatically linked into an ad hoc pre-compiled Python script that runs within Abaqus program assembling the FE model (Figure 7).
Grasshopper [30] along with a pre-compiled Python code, which enables a seamless con-nection of the parametric model to the FE environment for structural engineering purposes. Figure 7 schematises the proposed approach. LunchBox allows us to export the full geometry of the church in .stp file format within a specific path-as well as lists containing i) the elastic properties of the single entities (which are defined taking into account the damage state of each structural part by applying penalty values), ii) the coordinates that define the position of the constraints, iii) the computational mesh size that the user wants to apply for each entity, and iv) the loads that are saved in the same folder as .txt file format. The migrated files are automatically linked into an ad hoc pre-compiled Python script that runs within Abaqus program assembling the FE model (Figure 7). Figure 7. Workflow of importing process in FE environment (node 8 of Figure 4) The last node in Figure 7 displays the assemblage of the FE model in Abaqus CAE. In this case, the time needed to run the script and obtain the assembled model is less than 2 seconds. The discretisation is achieved using Delaunay tetrahedral meshing due to its adaptability to complex geometries. Specifically, the so-called TETC3D4 elements of the Abaqus CAE library, based on a tetrahedral geometry with linear interpolation, are used. Altogether, the final numerical model results were composed of a total of 384,094 tetrahedral elements and, considering interelement continuity, a total of 91,818 nodes and 271,567 degrees of freedom.

FE Model Calibration
With the aim of reproducing the mechanical behaviour of the church and obtaining a reliable digital mirror, the unknown material parameters of the model are estimated by exploiting the solution of an inverse dynamic problem, namely using as reference metrics the modal properties identified from field acceleration data and calibrating the numerical model accordingly until its dynamic response matches the experimental counterpart. The Figure 7. Workflow of importing process in FE environment (node 8 of Figure 4). Figure 7 displays the assemblage of the FE model in Abaqus CAE. In this case, the time needed to run the script and obtain the assembled model is less than 2 seconds. The discretisation is achieved using Delaunay tetrahedral meshing due to its adaptability to complex geometries. Specifically, the so-called TETC3D4 elements of the Abaqus CAE library, based on a tetrahedral geometry with linear interpolation, are used. Altogether, the final numerical model results were composed of a total of 384,094 tetrahedral elements and, considering interelement continuity, a total of 91,818 nodes and 271,567 degrees of freedom.

FE Model Calibration
With the aim of reproducing the mechanical behaviour of the church and obtaining a reliable digital mirror, the unknown material parameters of the model are estimated by exploiting the solution of an inverse dynamic problem, namely using as reference metrics the modal properties identified from field acceleration data and calibrating the numerical model accordingly until its dynamic response matches the experimental counterpart. The results of the Operational Modal Analysis (OMA) carried out on the vibration signals collected between February 2014 and August 2015 by Masciotta et al. [1] are employed for this purpose. The dynamic data acquisition and associated modal feature extraction covered the entire period of the structural intervention (see Section 2 for details), thereby allowing us to assess both the effectiveness of the strengthening works and the influence of environmental fluctuations on the system's dynamics. A total number of 4743 programmed events were processed through an automatic algorithm based on the data-driven Stochastic Subspace Identification method (SSI-data) [1]. Details about the experimental campaign as well as the processing and analysis of field data are not discussed here for the sake of brevity, but the reader can refer to [1] for a thorough description of the monitoring results. For the scope of the present work, only the average frequency values of the first four vibration modes estimated before and after the retrofitting intervention will be considered. It is worth noting that the positive impact of the consolidation measures is reflected by all dominant modes of the church, reading frequency upshifts ranging from 3.7% (1st mode) to 0.7% (4th mode).
The calibration of the FE model of St. Torcato Church is performed for either structure manual modal-based updating procedure consisting in the controlled variation of the values assigned to the uncertain structural parameters till the errors between experimental (measured) and numerical (predicted) frequencies are minimised. In this context, the objective function adopted for the finite element model updating (FEMU) only accounts for the first four experimental frequencies, which equals the number of material unknowns to be estimated. Indeed, as detailed next, the major uncertainties of the numerical model lied in the identification of reasonable values for the Young's modulus of the masonry material in order to properly consider its variability in the damaged configuration of the church. The optimal mechanical parameters reported in Sánchez-Aparicio et al. [36], which indeed refer to the original structure (nonretrofitted configuration), are here adopted as initial values for the calibration procedure (Table 4).  Figure 8 compares the 3D model resulting from the proposed Scan-to-FEM procedure with the one obtained by Sánchez-Aparicio et al. [36].

Calibration of the Unstrengthened Model (USTR)
The geometrical differences between the proposed approach and that one developed by Sánchez-Aparicio et al. [36] have been reflected in the modal analysis results. Different elastic moduli and material densities values have been obtained at the end of the calibration (Table 4).
For the calibration of the unstrengthened configuration, based on the extensive information gathered from the past anamnesis and in situ investigations of the structure, the masonry elements of the FE model of the church are further grouped into four distinctive parts referred as M1, M2, M3 and M4 (Figure 9), each characterised by an isotropic linear elastic behaviour. The methodology proposed by Sánchez-Aparicio et al. [36] appears more articulated and complex with respect to the proposed one. Their procedure is detailed described in ref. [36], and it is summarised as follows: (i) hybrid point cloud registration, (ii) hybrid point cloud resampling and CAD conversion, (iii) crack recognition and characterisation, (iv) meshing algorithms usage to transform the geometrical model in a finite element discretisation.
Although ornamental details are not modelled in either case, the proposed approach provides significant improvements in terms of metrics and geometry characterisation as well as a huge amount of time needed for its generation, namely: (i) the thickness of the vaults and other structural entities is derived directly through the point clouds without resorting to any manual indirect measurements, resulting into a more realistic and consistent model; (ii) there are no morphological simplifications nor underestimated dimensions in the definition of the internal structural entities, e.g. pillars and arches, which is fundamental when aiming at a realistic model apt for structural analysis purposes. It is noted that metric issues have to be addressed upstream, i.e., when defining the acquisition protocol for the 3D digitisation of the heritage asset, as they are directly linked to the data capturing process and accuracy level. Further differences between the model herein discussed and the one present in the literature concern the approach adopted to simulate the damage of the structural elements. Sánchez-Aparicio et al. [36] assumed an explicit representation of the cracks, where the residual cohesion was simulated using a bed of linear springs having a finite stiffness. On the contrary, the proposed approach aims to parametrise the damage as a penalty factor of the elastic modulus, which is assigned to the part(s) of the structure showing increasing displacements or signs of distress.

Calibration of the Unstrengthened Model (USTR)
The geometrical differences between the proposed approach and that one developed by Sánchez-Aparicio et al. [36] have been reflected in the modal analysis results. Different elastic moduli and material densities values have been obtained at the end of the calibration (Table 4).
For the calibration of the unstrengthened configuration, based on the extensive information gathered from the past anamnesis and in situ investigations of the structure, the masonry elements of the FE model of the church are further grouped into four distinctive parts referred as M1, M2, M3 and M4 (Figure 9), each characterised by an isotropic linear elastic behaviour.

Calibration of the Unstrengthened Model (USTR)
The geometrical differences between the proposed approach and that one developed by Sánchez-Aparicio et al. [36] have been reflected in the modal analysis results. Different elastic moduli and material densities values have been obtained at the end of the calibration (Table 4).
For the calibration of the unstrengthened configuration, based on the extensive information gathered from the past anamnesis and in situ investigations of the structure, the masonry elements of the FE model of the church are further grouped into four distinctive parts referred as M1, M2, M3 and M4 (Figure 9), each characterised by an isotropic linear elastic behaviour.  Table 4 summarises the values of the mechanical parameters adopted for the USTR model: the optimal values of the Young's modulus and of the material density obtained  Table 4 summarises the values of the mechanical parameters adopted for the USTR model: the optimal values of the Young's modulus and of the material density obtained at the end of the calibration procedure; in regular font, the other elastic parameters-including the Poisson's ratio which is kept unvaried throughout the updating process. One can note that the density of the proposed model has been calibrated to a value of 2000 Kg/m 3 , which is more reasonable with respect to 2600 Kg/m 3 obtained in [36]. The stiffness of the Winkler springs adopted to simulate the soil underneath the "towers-façade" system as well as the interfaces between longitudinal body and transept features values of 0.65 and 50 GPa m -1 , respectively. The modal results of the calibrated numerical model are displayed in Figure 10 in terms of mode shapes and corresponding frequencies, whereas Table 5 reports the comparison between numerical and experimental outcomes along with the relative percentage errors. It is worth noting that a very good correlation is found between predicted and measured frequency values, especially for the first two modes, as the plots around the target diagonal fitting line demonstrate ( Figure 11). The greater scatter featured by the fourth mode is likely due to the absence of coordinate-dependent modal comparative metrics, which are pivotal to improve the degree of correlation of higher modes. Still, the estimated value falls within the statistical range resulting from the long-term monitoring campaign reported in [1].
plots around the target diagonal fitting line demonstrate ( Figure 11). The greater scatter featured by the fourth mode is likely due to the absence of coordinate-dependent modal comparative metrics, which are pivotal to improve the degree of correlation of higher modes. Still, the estimated value falls within the statistical range resulting from the longterm monitoring campaign reported in [1].  Figure 10. Mode shapes USTR model.    Kg/m 3 , which is more reasonable with respect to 2600 Kg/m 3 obtained in [36]. The stiffness of the Winkler springs adopted to simulate the soil underneath the "towers-façade" system as well as the interfaces between longitudinal body and transept features values of 0.65 and 50 GPa m -1 , respectively. The modal results of the calibrated numerical model are displayed in Figure 10 in terms of mode shapes and corresponding frequencies, whereas Table 5 reports the comparison between numerical and experimental outcomes along with the relative percentage errors. It is worth noting that a very good correlation is found between predicted and measured frequency values, especially for the first two modes, as the plots around the target diagonal fitting line demonstrate ( Figure 11). The greater scatter featured by the fourth mode is likely due to the absence of coordinate-dependent modal comparative metrics, which are pivotal to improve the degree of correlation of higher modes. Still, the estimated value falls within the statistical range resulting from the longterm monitoring campaign reported in [1].

Calibration of the Strengthened Model (STR)
The calibration of the strengthened configuration of the church is performed using the USTR model as baseline and adding the retrofitting measures executed during the structural intervention of 2014-2015. Particularly, the following strengthening systems are included in the model:

•
Anchoring system: the steel chains restraining the towers are explicitly modelled by using beam elements characterised by a circular cross-section of 25mm diameter and a modulus of elasticity equal to 210 GPa. • Micro-piles system: the micro-piles effect is implicitly simulated by increasing the value of the Winkler spring stiffness distributed below the towers and the façade. • Crack injections: the restored "material continuity" is simulated by rationally decreasing the penalty factors that affected the part of the structure where cracks were injected.
Given the aim to assess the church dynamic behaviour in its retrofitted condition, the model updating procedure is carried out by keeping unvaried the four-group ideal subdivision of the linear isotropic FE model and assuming as initial moduli of elasticity the optimal values estimated for the calibrated USTR model. With regard to the Winkler spring stiffness simulating the soil underneath the "towers-façade" system, an increase of 25% is applied, as previously mentioned. Similar to the USTR case, the objective function to be minimised does account for the residuals between numerical and experimental frequency values of the first four modes. It would have been desirable to include also the mode shapes information in the model updating process; however, reference experimental modal vectors were not available. Table 6 summarises the mechanical parameters of the masonry material of the STR model, including the optimal values of the Young's modulus obtained at the end of the calibration procedure. As for the modal results, Figure 12 illustrates the mode shape configurations of the first four vibration modes of the retrofitted church, while the direct comparison between numerical and experimental frequencies is given in Table 7, along with the relative percentage errors. The visual comparison with the unstrengthened counterpart clearly highlights the degree of similarity existing between mode shapes before and after the structural intervention, though frequencies increase with a percentage ranging from 3.7% to 0.7% (Table 8), which is in good agreement with the range estimated by Masciotta et al. [8] through SHM-data. In particular, the first two modes are mainly affected by the interventions, i.e., +3.7% and +2.7%, because the strengthening design was devoted to locally increasing the towers' stiffness and decrease their relative movement. Table 8 also represents the MAC values between the USTR and STR numerical models. For the sake of completeness, Figure 13 gives a visual insight into the frequency upshifts featured after the structural intervention by the first four modes of the church, both experimentally and numerically.      Figure 12. Mode shapes STR model.

Events Prediction and Simulation
Digital replicas of heritage structures should be able to simulate their actual behaviour accurately and estimate the most probable damage scenarios that might occur after a hazardous event. Therefore, in order to validate the real representativeness of the digital twin built via the procedure previously discussed, this section is devoted to assessing the

Events Prediction and Simulation
Digital replicas of heritage structures should be able to simulate their actual behaviour accurately and estimate the most probable damage scenarios that might occur after a hazardous event. Therefore, in order to validate the real representativeness of the digital twin built via the procedure previously discussed, this section is devoted to assessing the capability of St. Torcato model to replicate the structural response of the original church when subjected to foundation settlements and to catch the damage pattern featured by the building prior to the structural intervention [36].

Nonlinear Constitutive Behaviour for Masonry
In order to simulate the macroscopic mechanical behaviour of the masonry material, several constitutive models can be adopted in Abaqus CAE [31], e.g., the smeared crack concrete, the brittle crack concrete or the concrete damage plasticity (CDP). In the present study, the CDP model is employed. It is based on the assumption of scalar isotropic damage with different damage descriptions in tension and compression.
In the softening branch (post-peak behaviour) of both tension and compression stressstrain relationships, the damage variables d t and d c are adopted to reduce the initial (undamaged) elastic modulus E 0 of the material according to the following failure conditions, in which ε and ε pl represent the total and equivalent plastic strains, respectively: The damage parameter in tension (d t ) assumes a value between 0 and 1, simulating the masonry media progressive damage, while the damage parameter in compression (d c ) is not considered in the present study, assuming that failure mechanisms are exclusively due to tensile damage, which is a reasonable assumption for historic masonry constructions. CDP assumes a non-associated flow rule given as a Drucker-Prager hyperbolic function and requires the definition of several physically-based parameters. The Drucker-Prager strength domain criterion is modified through a parameter K c = 2/3 to approximate it with a Mohr-Coulomb criterion. The eccentricity parameter, ε, which expresses the rate at which the plastic flow potential approaches the Drucker-Prager function for high confining pressure levels, is set to the default value of 0.1 [45]. A dilation angle, ψ, of 10 degrees and a ratio between the bidirectional and unidirectional compressive strengths of masonry of 1.16 (default value [45]) are assumed. A viscosity parameter, µ, of 0.002 for the visco-plastic regularisation of the material constitutive equations is adopted. These complementary parameters are summarised in Table 9, and the reader is referred to [36] for further details on the CDP model. Table 9. Mechanical properties of the masonry adopted in the simulations. The initial elastic modules set for the masonry material are consistent with those obtained through the calibration phase (USTR model) except for M2, for which the exact value of the undamaged part of the façade is considered. For the reasons highlighted before, the compressive strength is purposely set to a very high value, whereas the nonlinear behaviour in tension and the associated values of the damage parameter are summarised in Table 10.

Foundation Settlement Simulation
At first, only vertical actions, including gravity loads, are considered. Subsequently, incremental differential displacements are applied at the foundation level of the church. The displacement values are calibrated according to the geotechnical tests performed in 1999. Basically, the displacement applied to each region is proportional to both Winkler stiffness and vertical axial stress at the foundation. Figure 14a displays the range of applied displacements, which are normalised with respect to the region subjected to the largest settlements (West tower).