Vous êtes sur la page 1sur 11

This article appeared in a journal published by Elsevier.

The attached
copy is furnished to the author for internal non-commercial research
and education use, including for instruction at the authors institution
and sharing with colleagues.
Other uses, including reproduction and distribution, or selling or
licensing copies, or posting to personal, institutional or third party
websites are prohibited.
In most cases authors are permitted to post their version of the
article (e.g. in Word or Tex form) to their personal website or
institutional repository. Authors requiring further information
regarding Elsevier’s archiving and manuscript policies are
encouraged to visit:
http://www.elsevier.com/authorsrights
Author's personal copy

Advances in Engineering Software 72 (2014) 8–17

Contents lists available at SciVerse ScienceDirect

Advances in Engineering Software


journal homepage: www.elsevier.com/locate/advengsoft

Code-coupling strategy for efficient development of computer software


in multiscale and multiphysics nonlinear evolution problems
in computational mechanics
Adnan Ibrahimbegovic a,⇑, Rainer Niekamp b, Christophe Kassiotis c, Damijan Markovic d,
Hermann G. Matthies b
a
Ecole Normale Supérieure, Laboratory of Mechanics and Technology, Cachan, France
b
TU-Braunschweig, Institute for Scientific Computing, Braunschweig, Germany
c
Ecole des Ponts, Laboratory St. Venant, Paris, France
d
EDF, SEPTEN, Lyon, France

a r t i c l e i n f o a b s t r a c t

Article history: In this work we seek to provide an efficient approach to development of software computational platform
Available online 18 July 2013 for the currently very active research domain of multiphysics and multiscale analysis in fully nonlinear
setting. The typical problem to be solved is nonlinear evolution problem, with different scales in space
Keywords: and time. We show here that a successful solution to such a problem requires gathering the sound the-
Software development oretical formulation, the most appropriate discrete approximation and the efficient numerical implemen-
Code coupling tation. We show in particular that the most efficient numerical implementation is obtained by reusing
Multiscale
the existing codes, in order to accelerate the code development and validation. The key element that
Multiphysics
Nonlinear evolution problem
makes such an approach possible is the Component Template Library (CTL), presented in this work.
Monolithic code at linkage time We show that the CTL allows to seamlessly merge the existing software products into a single code at
compilation time, regardless of their ‘heterogeneities’ in terms of programming language or redundancy
in use of local variables. A couple of illustrative problems of fluid–structure interaction and multiscale
nonlinear analysis are presented in order to confirm the advantage of the proposed approach.
Ó 2013 Elsevier Ltd. All rights reserved.

1. Introduction the currently most important challenges that has been addressed
in a number of recent works on multiscale modeling and compu-
From its early days and focus upon the finite element method tations (e.g. [18,26,22,24,34,44,20], among others).
development (e.g. [49,7]), the computational mechanics has However, the theoretical formulation of multiphysics and mul-
developed into a very broad area, much driven by various indus- tiscale problems is not the only challenge. We argue here that
trial applications (e.g. [43]). Very diverse problems are presently providing the corresponding computational tools, or computer
of interest for research and expertise of computational mechan- software, presents even a bigger challenge, with much more ben-
ics community, such as biomechanics, nanotechnology, and pre- efits for bringing this technology to bear upon the current engi-
dictive home security. Typical formulations of interest are very neering practice. Namely, as the problem complexity grows,
much interdisciplinary, and ought to be formulated in terms of many existing codes are found insufficient to meet the new
multiphysics problems: such as thermomechanical coupling, requirement or even completely obsolete. Thus, a number of
fluid–structure interaction, coupling of probability and mechan- new developments have sprung in starting the development of
ics. Moreover, in mathematical interpretation, the vast majority new codes for multiphysics and multiscale problems [35], where
of these problems are highly nonlinear evolution problems. Thus, higher level programming languages or existing libraries are used
in trying to provide the most efficient solution procedure for any to accelerate the software development; case in point are: code in
such problem, one is often prompted to exploit multiscale mod- Java (e.g. [15]), Smalltalk (e.g. [13,14]), or Comsol (e.g. see [8]).
eling and computations, which consider the most appropriate However, the software products of this kind are not necessarily
spatial and temporal evolution for each particular field. Providing the most efficient. In fact, although some tentative to increase
the best theoretical formulation for any such problem is one of the code efficiency are made, many such codes are mostly used
in academic research environment, very far from the industry
⇑ Corresponding author. applications.
E-mail address: ai@lmt.ens-cachan.fr (A. Ibrahimbegovic).

0965-9978/$ - see front matter Ó 2013 Elsevier Ltd. All rights reserved.
http://dx.doi.org/10.1016/j.advengsoft.2013.06.014
Author's personal copy

A. Ibrahimbegovic et al. / Advances in Engineering Software 72 (2014) 8–17 9

Thus we propose here very different software development 2. Theoretical formulation and discrete approximation of
strategy, where the final software product is capable to fully inte- multiscale and multiphysics nonlinear evolution problems with
grate existing computer codes. The proposed strategy not only interface
significantly accelerates the final code development, but even
more importantly allows to directly include the existing codes 2.1. Localized Lagrange multipliers
that have been extensively tested previously. Last but not least,
the proposed strategy can directly provide a very appealing inter- In this section we first introduce the notion of interface and cor-
face to user who are used to a particular software product making responding localized Lagrange multipliers, which allows reduction
them accept the new code release and other novelties much of the problem complexity. This is done in the simplest possible
faster. setting of domain decomposition where two domains are con-
We note in passing that the same strategies of coupling of exist- nected at the single point (see Fig. 1).
ing codes are currently used by interpreters, such as Python (e.g. The classical formulation of partitioned problem introduces the
see [33,19]) or Matlab (e.g. see [3]). However, contrary to such Lagrange multiplier imposing the equalities of field values in
an approach which sacrifices the efficiency in favor of flexibility points 1 and 2, which are now separated by the partition. This
while coupling typically the executable versions of existing codes, leads to a particular constraint:
we target here the code coupling that is done at the compilation ð1Þ ð2Þ
and linking time, and thus provide truly the single code as the final c12 :¼ uC  uC ¼ 0 ð1Þ
software product. Such a code, perhaps needless to say, will be In the solution method, this kind of constraint is handled by the
both more robust and more efficient than any other code-coupling Lagrange multiplier k(12), and the resulting set of equations can be
alternative. written as:
Last but not least, in seeking the optimal results we show in
this paper the need to focus upon the complete treatment of the dPtotal :¼ dPð1Þ þ dPð2Þ þ dpclassical
present problem, and not only the code-coupling. More pre-
h   i h   i
ð1Þ ð2Þ
¼ duð1ÞT A uð1Þ  f þ duð1ÞT A uð2Þ  f
cisely, the proposed strategy ought to reconsider the theoretical
h  i
formulation of multiphysics and multiscale problems, the opti- ð1Þ
þ d kð12ÞT uC  uC
ð2Þ
ð2Þ
mal discrete approximations both in space and in time, and
finally the most efficient software development based upon where dpclassical is the classical form of interface constraint, the oper-
the code-coupling strategy. This is illustrated upon two model ator A(u(a)) represents the response of the system corresponding to
problems. The first one concerns the multiscale analysis of system excitation f(a). We can see from (2) above that the two systems
inelastic behavior of heterogeneous materials (e.g. see [26], or are ‘visible’ to each other through the global Lagrange multiplier k(12),
[37]), where the same code FEAP (e.g. [50]) is used at both physically representing the conjugate action to difference in field val-
scales. The second pertains to fluid–structure interaction, where ues in two subsystems. The main disadvantage of such a formulation
FEAP is coupled with Open-FOAM (e.g. see [45]) in order to pro- is in keeping the partitioned systems tightly coupled, which thus
duce the final software product. Both chosen model problems leads to questionable gains of partitioned strategy.
allow us to illustrate the important concept of interface and However, an alternative to such a formulation is the use of
the use of localized Lagrange multipliers (e.g. [46,38]). In the localized Lagrange multipliers (e.g. [46,38]), which can introduce
multiscale problem the interface between the microscale and the notion of interface to separate the system into subsystems that
macroscale is defined in terms of macroelement boundaries. In will no longer be visible to each other. Namely, for the case illus-
the multiphysics problem the interface is the wetted structure trated in Fig. 1 where the system partitioning concerns only one
boundary. The key role in defining the interface very clearly is point, we will introduce an interface point that belongs to neither
played in choosing the original interpretation of theoretical for- system. If the value of the field at that point is denoted as uf, we
mulation for multiscale strategy and fluid–structure interaction. can then rewrite the constraint in (1) as follows:
The second important point of our strategy of using the local-
ð1Þ ð2Þ
ized Lagrange multiplier pertains to the optimal choice of dis- c1 :¼ uC  uf ¼ 0; c2 :¼ uC  uf ¼ 0 ð3Þ
crete approximation for each sub-problem. This is illustrated
The system in (2) can also be rewritten by replacing the last
in the case of multiphysics problem of fluid–structure interac-
term with a modified constraint equation:
tion, where the finite element method is used for structure    
and finite volume method is used for fluids in order to construct ð1Þ ð2Þ
dplocalized ¼ kð1ÞT uC  uf þ kð2ÞT uC  uf ð4Þ
optimal discrete approximations. The seamless connection of
these two approximations is again achieved by the localized We note that the interface degrees of freedom in this case will sep-
Lagrange multipliers and their corresponding interpolations in arate two subsystems, and would not allow either to see the other
terms of radial approximations. one. The advantage of the localized Lagrange multipliers, here k(1)
The outline of the paper is as follows. In the next section, we and k(2) is that they pertain only to a single sub-system. Thus, they
present the theoretical formulations of the multiscale problem can be handled in purely local computations, introducing the most
for inelastic behavior of heterogeneous materials, along with appropriate scaling to improve the system conditioning, etc.
the multiphysics problem of fluid–structure interaction. The dis-
crete approximation of the latter problem is also presented in 2.2. Multiscale evolution problem
detail in Section 2, along with the corresponding proofs of con-
vergence of sequential solution procedure and the illustrative We could extrapolate these concepts directly towards the mul-
examples showing what kind of results can readily be obtained tiscale analysis of nonlinear evolution problem. In order to illus-
in this manner. Section 3 provides a number of pertinent trate these ideas we refer to Fig. 2, showing the macro and micro
remarks on numerical implementation and the essence of scale representation of 3-point bending test (see [26]). The macro
proposed code-coupling procedure based upon the CTL – Compo- scale represents the structural level, with the discrete model con-
nent Template Library tool (e.g. see [41,42]). Concluding remarks structed with what looks like the standard finite element mesh
are given in Section 4. (‘black nodes’, with displacement denoted as dM).
Author's personal copy

10 A. Ibrahimbegovic et al. / Advances in Engineering Software 72 (2014) 8–17

Fig. 1. Partitioned solution by domain decomposition where two domains are connected through a single point.

Fig. 2. Macro and micro model for 3-point bending test: black nods denote the ‘macro’ scale and ‘white’ nodes the ‘micro’ scale nodal displacement; indicated possibilities to
constructed structured finite element mesh, or unstructured discrete element mesh.

However, there is another mesh of ‘micro’ nodes that can be to the finest possible scales at present in order to provide the best
placed inside each macro element. As illustrated in Fig. 2, this mesh interpretation of internal variables; e.g. see [36]:
can be constructed not only by finite elements (e.g. see [23,26]),
Pm ¼ S Xm Wðum ; fk Þdv ð7Þ
but also discrete elements (e.g. see [25]). The total energy of such
model can be decomposed in terms of macro energy, micro energy The interface term can be defined according to:
and the interface condition concerning the macro and micro inter- X
Mm
pC ¼ S CMm;E kT ðum  uM ÞdA ð8Þ
face boundaries CMm. More precisely, we can write:
E

Ptotal :¼ Pð1Þ þ Pð2Þ þ plocalized ! PðuM ; um ; k; fk Þ : where k is the Lagrange multiplier enforcing the equivalence be-
¼ PM þ Pm þ pMm ð5Þ tween micro and macro displacement fields over each particular
C
macro element boundary; the sum of all macro element boundaries
where um and uM are, respectively, micro and macro displacement is here playing the role of localized interface CMm = RECMm,E. The
fields. We note that the macro displacement field plays the role of coupling across interface is enforced in the weak sense, which pro-
the interface, which separates different sub-systems (micro dis- vides the most general framework that can accommodate the micro
placement field inside a particular macro element). The macro en- displacement field representation in terms of discrete models (e.g.
ergy contains the contribution of the external nodal loads, either [25,27]) or even finer scales with atomistic model (e.g. [36]). For
homogenized weight b or applied traction t, defined as: more clear illustration of these ideas, we will further use the stan-
dard finite element interpolations for both macro and micro dis-
PM ¼ S XM uMT bdV  S CMr uMT t  dA ð6Þ
placement field, which can be written as:
The micro energy is the term containing the corresponding inter- X M
pretation of inelastic mechanism at the origin of nonlinear evolu- uM
nþ1 ðxÞjC
Mm
¼ NM
a ðxÞda;nþ1 ; um
nþ1 ðxÞjX
m

Mm
a2C
tion process. Denoting the latter symbolically by a set of X m
(internal) variable fk, we can write the micro energy contribution ¼ Nm
a ðxÞda;nþ1 ð9Þ
m
in terms of the corresponding potential (we note that we can go a2X
Author's personal copy

A. Ibrahimbegovic et al. / Advances in Engineering Software 72 (2014) 8–17 11

By finally using the Dirac delta function for micro scale localized ous work [40].). The key idea that is exploited in order to define
multipliers centered on each micro node on the interface, we can the interface pertains to ALE formulation (e.g. see [21,12]). Namely,
obtain from (8) a set of algebraic equations connecting directly on one side we define the structural equations of motion in
the micro nodal displacement at the macro element interface with Lagrangian formulation (where domain Xs follows the structure
the macro element nodal displacements (see Fig. 3): motion):
Z Z
m M m
da;nþ1 ¼ N M
b ðxa Þdb;nþ1 ; 8ða; bÞ 2 CMm;E dnþ1 jCMm;E G s :¼ qs @ 2t uh  duh þ rh
E M;E Xs Xs
¼T dnþ1 ð10Þ Z Z
: rduh    duh 
b k  duh ¼ 0 ð12Þ
On the other hand, by choosing the interpolation for localized Xs @ Xs
Lagrange multipliers at the macro scale constructed by Dirac delta
The index ‘h’ on each field indicates the discrete approximation,
centered upon macro nodes, we simply obtain the standard finite
which is here constructed by using the finite element interpola-
element assembly procedure summing up the contributions from
tions (e.g. [50]). On the other hand, the fluid equations of motion
all macro elements attached to a particular macro node. The flow-
are set in Eulerian formulation (where domain Xf remains fixed
chart of the complete solution procedure can be written as:
in space):

Gf :
Z Z Z
 h   
¼ um  ExtðuÞ  duh þ @ t v h  dv h þ v h  u_ hm
Xf Xf Xf
Z
 
 v h  dv  r  vf D vh  dv h  dv h
Xf
Z Z !
1 1
þ rp  dv þ
h h
rv dp
h h
þ CL
Xf qf Xf qf
¼0 ð13Þ
The index ‘h’ on each field also indicates the discrete approxi-
mation, but this time constructed by using the finite volume inter-
polations (e.g. see [16]). The corresponding forms of structure and
fluid equations of motion are obtained in agreement with choice of
Lagrange multipliers. Namely, the Lagrange multiplier field on
structure side in (12) is interpolated in agreement with the partic-
ular choice of finite element mesh, representing physically the cor-
responding pressure loading induced by fluids. On the other hand,
the Lagrange multipliers on the fluid side are chosen with the Dirac
delta approximations centered on the finite element nodes, which
imposes the fluid mesh motion in strict agreement of the structure.
Moreover, in the dynamic setting considered herein, the interface
conditions ought to impose the continuity not only of displace-
ð11Þ
ment but also of velocities:
nM
where denotes the standard finite element assembly operator.
elem
AE¼1 
u ¼ uS continuity of displacements
The validation of our approach is provided first with respect to mul- ð14Þ
tiscale numerical simulation of 3-point bending test (see Fig. 4). v ¼ vS continuity of velocities
We also illustrated in Fig. 4 the quadratic convergence rate that As illustrated in Fig. 5, the constraints of this kind concern both
one can achieve at both macro and micro scale by using the New- the space and time approximations. The general development pro-
ton iterative method. It is also possible to employ other iterative posed recently (see [29,30]) allow the most general conditions for
methods (e.g. Jacobi, Gauss-Seidel . . .), but the convergence is not space approximations connecting the finite element approxima-
always guaranteed, especially for the stiff systems (e.g. [42]). tions for structure and finite volume approximations for fluid.
These two approximations do not share the same parameters (no-
2.3. Multiphysics nonlinear evolution problem of fluid–structure dal values for finite elements versus cell centers for finite volumes),
interaction and have to be connected by using the interface approximations in
terms of radial approximations (see [29,30] for details).
In this section we further extend the proposed approach to mul- Similarly, we can allow two different time steps to be used for
tiphysics problem, and in particular fluid–structure interaction structure on one side versus fluid on another (see Fig. 5 for
(For more general multiphysics framework, we refer to our previ- illustration). Yet, one can still provide the stability proof of the

Fig. 3. Interface between macro and micro scale in proposed multiscale model.
Author's personal copy

12 A. Ibrahimbegovic et al. / Advances in Engineering Software 72 (2014) 8–17

Fig. 4. Three point bending test, solution procedure and quadratic convergence rate in typical steps for Newton method used both at macro and micro scales.

Fig. 5. Fluid–structure interaction problem: space and time continuity constraints.

Fig. 6. 1D test example of vortex-excited disk oscillation: (left) problem definition, (right) result obtained by partitioned scheme, versus those in [11] Dettmar, Peric and [2]
Anagnostopoulos, Bearman.

Fig. 7. Fluid–structure interaction of thick beam placed in lateral flow: (left) flow streamlines, (right) pressure contours.

corresponding iterative scheme for geometrically nonlinear setting towards interface. We note that the stability condition in (15) is
(see [29,30] for details); the latter can be written as: rendered more stringent in the presence of the incompressibility
 
1 constraint Bf.
 1
1 T T
1 1
Ms Ds Df Mf 1  Bf Bf Mf Bf BTf M1
f DTf Ds 6 1 ð15Þ The numerical results for validation of the proposed solution

procedure for fluid–structure interaction problems with increasing
where Ms is structure mass, Mf is fluid mass, whereas Ds and Df de- model complexity are presented in Figs. 6 and 7. The former repre-
pend, respectively, upon the structure and fluid field transfer sents the well-known 1D benchmark of vortex-excited oscillation,
Author's personal copy

A. Ibrahimbegovic et al. / Advances in Engineering Software 72 (2014) 8–17 13

which is compared against the experimental results [2] and fully  Threaded shared library: Components are loaded at runtime
coupled solution procedure for fluid–structure interaction [11]. into the process and run in a separate thread. Calling a compo-
The second problem is the analysis of 3D case concerning the nent can be blocking or non-blocking.
vortex shedding induced vibrations of the thick beam structure  Socket daemon (TCP): Components are running as an operating-
placed in lateral fluid flow. The illustrative snap shots of flow system daemon listening on a predefined UNIX-port.
streamlines and pressure contours are presented in Fig. 7.  Just-in-time daemon (TCP/SSH): Components are instantiated
locally or remotely just-in-time of their use.
3. Software production issues and code-coupling with CTL  Static linkage: Early binding of normal C++-objects to Interfaces,
providing interface polymorphy in C++.
For the realization of the micro–macro-coupling the FORTRAN-  Message passing (MPI/PVM).
code FEAP was taken both at micro and at macro-scale, where for
the FSI-coupling FEAP, see e.g. FEAP [17], (via the coFeap-compo- The binding is performed just by a call to template function:
nent) was coupled with the C++-code OpenFoam, see e.g. Open- ctl::connect<IFace, Impl, Detail>() connecting an interface (IFace)
FOAM [45] (via the oFoam-component). This was done using the to an implementation (Impl) by using an optional specification of
component based software engineering. As the underlying middle- details (Detail) of this connection. This amounts to possibilities
ware the Component Template Library (CTL) [42,10] is used. Anal- and flexibility that is unique for a component framework.
ogously to the localized Lagrange multiplier technique separating Fig. 8 illustrates on the left side the dependence graph during
the physical components and decoupling the resulting systems of classical (monolithic) linkage creating the standard version of
equations from the physical interface, the component based soft- FEAP, and on the right side component linkage creating a client
ware engineering is formulated with independent software com- communicating with coFeap component. Here for each method
ponents whose functionality is hidden under software interfaces. with name ‘XXX’ declared in simu.ci, its FEAP-based implementa-
The CTL is a C++ template library, which uses template meta- tion can be found in simu_XXX_impl.f. The coFeap component (built
programming to hide as much as possible technical details of unfa- as shown in the central part in Fig. 8) is used for the structural part
miliar components from the programmer. It has been successfully in fluid–structure interaction problem, as well as for the micro-
applied in computational applications like multiphysics simulation structure computation in the multiscale problem. Here we want
[4,5,6,39,47,29,30], multiscale simulation [26,37,42], stochastic fi- to mention, that it was a job of one long day for Bob Taylor and
nite element analysis [31,32,28] and optimization [41]. one of the authors of this paper, to produce the prototype of the co-
The CTL provides an Interface Definition Language (IDL), which Feap component.
is embedded in C++ by using template meta-programming tech- While in the monolithic linkage case the application depends
niques [48,1] for generative programming. The CTL is invisible, directly on the used library (Feap7_5.a in Fig. 8), in the CTL-based
where other frameworks use external programs to generate so- linkage we can only see the interface (simu.ci). Consequently, the
called stubs and skeletons [9]. Instead, the CTL provides a concept proposed approach provides two important advantages:
called connect, which supports the binding of code to an interface.
The overhead of making a call to a component is thereby minimal,  The application does not have again to be recreated, if the mod-
implemented by the cost of a single virtual function-call. It allows ule is modified.
seamless use of a large number of communication concepts, which  At run-time the application can decide, which components and
implies that neither the code of the component nor the code of the how many instances of these components on which hardware is
used application would need to be changed. to be used.

 Shared libraries (UNIX)/dynamic-link library (Windows): Com- Furthermore, due to the fact that the macroscale elements are
ponents are loaded at runtime into the process. Calling a com- perfectly decoupled by the localized Lagrange multipliers, in the
ponent is always blocking, i.e. the calling component cannot multiscale computations we have optimal parallelization capabili-
continue until the called one has completed. ties. More precisely, we can just start as many coFeap instances as

Fig. 8. Dependencies and linkage of the coFeap-component.


Author's personal copy

14 A. Ibrahimbegovic et al. / Advances in Engineering Software 72 (2014) 8–17

CPU-cores that are simultaneously available by the –l tcp linkage. safe message passing. Therefore the interface is defined in such
Also on the machine where the macro-feap processes we can add structures like an array which aggregates the information about
reasonably (number of cores 1) many micro-instances by FEAP number, type of data and the data itself to be transmitted between
using the asynchrony –l thread linkage. different processes. Hence, a translation of these structures to fun-
Building the coFoam-component from OpenFOAM leads to a damental FORTRAN data types is needed.
very similar dependency structure as given in Fig. 8. In the fluid– Translation to FORTRAN/Ansi C-Types is carried out as pre-
structure interaction problem, the computational cost is strongly sented in Table 1.
dominated by the fluid part. Therefore the best parallel efficiency Any const modifier in the interface will be ignored. For example
can be yield by using the nested parallelization with parallelized the interface signature
implementation of OpenFOAM (see [29,30]).
int1/ret/ simu::solve (const real8/accuracy/, array<real8> /
3.1. FORTRAN and Ansi-C-Bindings of CTL x/)
corresponds to the FORTRAN subroutine
When the CTL is used with the programming language C++, CTL- subroutine simu_solve_impl (accuracy, size_x, x, ret)
interfaces are just C++-classes and can be used as classes. For exam- real8 accuracy
ple, in the fluid–structure interaction problem, both the control integer8 size_x
and client-code are written in C++. For fluid part, this is OpenFOAM real8 x(size_x)
code. However, the code fragment invoking the solver of the struc- character ret
tural part, implemented in FORTRAN for FEAP code, is given by: and to the C-function
void simu_solve_impl(double accuracy, long long size_x
simu Solid(‘‘inputfile’’); double x, char ret)
... The last argument ret corresponds to the return value
// set Neumann boundary specified in the interface signature.
Solid.set_load(f[solid]); The name simu_solve_impl is the composition of
Solid.solve(); <CI_Name>_<Method_Name>_impl.
// copy result into u [solid] A constructor defined in the interface must be implemented
Solid.get_state(u[solid]); by a subroutine named <CI_Name>_new<CtorID>_impl.

Only on the server side a CTL-interface has to be connected to


an implementation. For this purpose a connecting C++-source file,
here for binding the OpenFOAM simulation code, is needed: 3.1.2. Creation of FORTRAN and Ansi-C-services
For the microscale problems and the structural part of the fluid–
structure interaction problem, FEAP has to transformed into the co-
connectCoFoam.cpp:
Feap component. This is done by using the following:
#define CTL_Connect
#include <cfdsimu.ci>
#include <ofoam.hpp> connectcofeap.cpp:
... // FORTRAN binding
void ctl_connect() #define CTL_ConnectF
{ctl::connect<CFDSimuCI, Ofoam<>, detail>();} // FEAP is not multi-thread save
#define CTL_unSaveMT

// implementation function names start with simu_


This file has to be compiled and linked against the CTL-library (a #define CTL_ClassPrefix simu// or C-Binding
dynamic shared object) and the library containing the needed #include <simu.ci>
implementations declared by the interface (in this case with the
OpenFOAM libraries). void ctl_connect() // bind to external implementation
The CTL provides also language bindings for Ansi-C and FOR- {ctl::connect< simuCI, ctl::Extern::simuCI >;}
TRAN, e.g. it is possible to transform an existing FORTRAN library,
e.g. FEAP.a, into a remote accessible software component and to
use a CTL component by FORTRAN applications. Especially into
FORTRAN only a subset of the C++ features can be mapped. There- (In the case of C-binding #define CTL_ConnectF must be replaced
fore only a restricted set of interfaces can be used or implemented by #define CTL_ConnectC.)
by FORTRAN and Ansi-C. The particular restrictions are: In this case the implementation comes just via linkage (here of
the simu_XXX_impl.o’s together with the FEAP library) into the
 Only CI classes, no CI libraries. component. As an example we consider for the set_load method.
 Methods returning and accepting argument types listed in the simu.ci contains this method definition needed for control of the
following subsection. Neumann boundaries:

These restrictions are not essential and do not prevent an effi- #define CTL_Method6 void, set_load, (const array<double> /
cient implementation. load/), 1

3.1.1. Parameter conversion CTL ? FORTAN/Ansi-C


In the standard FORTRAN programing language no structured
types like string or array (=vector) of a type are expressible. On The corresponding implementation is given in simu_get_loa-
the other hand such structures are needed to implement a type d_impl.f according to:
Author's personal copy

A. Ibrahimbegovic et al. / Advances in Engineering Software 72 (2014) 8–17 15

Table 1 gfortran Gnu-compiler:


The mapping interface type to FORTRAN and Ansi-C, compiler dependend, e.g. gnu-C:
long long, VisualC: int64.
 CPPFLAGS =-fPIC -DCTL_FortranPostFix=_ -DCTL_FortranPost
Interface FORTRAN Ansi-C Fix_=_
type representation representation  FFLAGS =-fPIC
Fundamentals  LDLIBS =-lgfortran -gfortran3
int1 character char
int2 integer2 short 3.2. Hierarchical ordering of simulation interfaces
int4 integer4 long
int8 integer8 long long Since version 1.3, the CTL allows an interface to extend other
real4 real4 float
interfaces. This enables to organize the different facilities of differ-
real8 real8 double
ent simulation codes in a hierarchy of interfaces. If a code imple-
Structures ments an interface, it automatically implements all interfaces
String integer8, character long long, char
directly or indirectly extended. Therefore this ordering can be used
array<fund.> integer8, fund. long long, fund.
to optimize the interchangeability of simulation codes, e.g. in mul-
ti-physical simulation.
Example Dirichlet–Neumann coupling: (Instead of CTL-inter-
face syntax a more readable IDL is used.)
subroutine simu_set_load_impl(loadsize, loadval) Any useful simulation code should at least implement an inter-
implicite none face stationarySimulationCI like:
[. . .]
include ‘control.h’ interface stationarySimulationCI
integer8 loadsize {
real8 loadval(loadsize) stationarySimulationCI (const string /input-file/);
integer i,j,k void solve();
k=0 void get_state(array<real8>/state/) const;
[. . .] };
do i = 0,neq-1
j = mr(np(31)+i+k)
do while(j.lt.0)
Using (for a stationary problem) Gauss-Seidel- or Jacobi-type
k=k+1
solution schemes each Neumann controlled part of a coupled sim-
j = mr(np(31)+i+k)
ulation needs at least to implement the interface:
enddo
hr(np(27)+i+k) = loadval(i+1)
interface stationaryNeumannCI: extends stationarySimulationCI
enddo
{
void set_load(const array<real8> /load/);
};

3.1.3. Creation of FORTRAN and Ansi-C-clients


If a FORTRAN or C-program wants to use the CTL-interface si-
mu.ci a C++source like clientF.cpp/clientC.cpp must exist. In this case the part controlled by Dirichlet-conditions needs at
least to implement an interface stationaryDirichletCI like:
clientF.cpp/clientC.cpp:
// either FORTRAN binding interface stationaryDirichletCI: extends stationarySimulationCI
#define CTL_ClientF {
// or C-Binding void set_state(const array<real8> /state/);
//#define CTL_ClientC };
#include <simu.ci>

A nonstationary coupling solved by a Gauss-Seidel- or Jacobi-


This must be compiled and linked to FORTRAN/C-client. Now type scheme will be supported by defining and implementing the
the subroutines with the names simu_XXX are in the client interfaces:
available.
interface simulationCI: extends stationarySimulationCI
3.1.4. Compiler/platform dependent configuration of CTL {
For the successful linking of FORTRAN-code against the CTL-li- void time_step(const real8 /delta_t/);
brary on Unix- or Linux-systems the following compiler and linker };
flags must be set. The –fPIC (Position Independent Code) is only interface NeumannCI: extends stationaryNeumannCI,
needed on 64bit platforms. simulationCI
ifort Intel-compiler: {};
interface DirichletCI: extends stationaryDirichletCI, simulationCI
 CPPFLAGS =-fPIC -DCTL_FortranPostFix =-DCTL_FortranPost {};
Fix_=
 FFLAGS =-fPIC -names as_is The interfaces implemented by coFeap (simu.ci) and Open-
 LDLIBS =-lifcore FOAM (cfdsimu.ci) used in the numerical examples given in this
Author's personal copy

16 A. Ibrahimbegovic et al. / Advances in Engineering Software 72 (2014) 8–17

paper are extensions of these interfaces, adding some more special [10] CTL-homepage; 2005. <http://www.wire.tu-bs.de/forschung/projekte/ctl/
e_ctl.html>.
features offered by Feap and oFoam.
[11] Dettmer WG, Peric D. A fully implicit computational strategy for strongly
coupled fluid–solid interaction. Arch Comput Methods Eng
2007;14:205–2007.
4. Conclusions [12] Donea J, Huerta A, Ponthot J-P, Rodrıguez-Ferran A. Arbitrary Lagrangian–
Eulerian methods. In: Stein E et al., editors. Encyclopedia comp
The question addressed in this paper on software development mech. London: Wiley; 2003.
[13] Dubois-Pelerin Y, Zimmerman T, Bomme P. Object-oriented finite element
for efficient solution of multiscale and multiphysics problems is programming: II. Prototype programme in Smalltalk. Comput Methods Appl
perhaps the most important challenge of the present research. Mech Eng 1992;98:361–97.
While the paradigm advanced herein on code-coupling to achieve [14] Dubois-Pelerin Y, Pegon P. Object-oriented programming in nonlinear finite
element analysis. Comput Struct 1998;67:225–41.
this goal is not necessarily new, since a number of works have fo-
[15] Eyheramendy D, Gudin-Dardun F. Object-oriented finite elements: from
cused upon re-using existing codes as a part of a more complex Smalltalk to Java. In: Papadrakakis M, Topping BHV, editors. Trends in eng
platform, the manner in which it is done at linkage time resulting comp technology; 2008. p. 17–39.
[16] Eymard R, Gallouët T, Herbin R. Finite volume methods. In: Ciarlet PG, Lions JL,
with truly single code, rather than a wrapper around the execut-
editors. Handbook of numerical analysis, vol. 7. North-Holland; 2007. p.
able versions of other codes, is quite original. 713–1020.
We have shown that in order to achieve such a worthy goal, one [17] FEAP-homepage; 2011. <http://www.ce.berkeley.edu/projects/feap/>.
has to address all the aspects of the problem related not only to [18] Feyel F, Chaboche J-L. FE2 multiscale approach for modelling the
elastoviscoplastic behaviour of long fibre SiC/Ti composite materials.
software implementation, but also the theoretical formulation Comput Methods Appl Mech Eng 2000;183:309–30.
and discrete approximation of the multiscale and multiphysics [19] Gendre L, Allix O, Gosselet P, Comte F. Non-intrusive and exact global/local
problems. In particular, the crucial role in casting a suitable theo- techniques for structural problems with local plasticity. Comp Mech
2009;44:233–45.
retical formulation is played by the localized Lagrange multipliers. [20] Hautefeuille M, Colliat JB, Ibrahimbegovic A, Matthies H, Villon P. Multiscale
These ideas have been illustrated both for multiscale problems approach to modeling inelastic behavior with softening. Comput Struct
with strong coupling of computations in macroscale and micro- 2012;94(95):83–95.
[21] Hughes TJR, Liu WK, Zimmermann TK. Lagrangian–Eulerian finite element
scale finite elements and multiphysics problems with fluid–struc- formulation for incompressible viscous flows. Comput Methods Appl Mech
ture interaction. The proposed procedure for either case, here Eng 1981;29:329–49.
presented and discussed for computer code FEAP [50], can be ap- [22] Hughes TJR. Multiscale phenomena: Green’s functions, the Dirichlet-to-
Neumann formulation, subgrid scale models, bubbles and the origins of
plied to many other existing codes. In other words, the key ingre-
stabilized methods. Comput Methods Appl Mech Eng 2005;127:387–401.
dient is not as much the kind of code we are using, but rather the [23] Ibrahimbegovic A. Nonlinear solid mechanics: theoretical formulations and
ability to formulate the problem with a clear notion of the interface finite element solution methods. Berlin: Springer; 2009.
[24] Ibrahimbegovic A, Brank B, editors. Multi-physics and multi-scale computer
and to split the computations with localized Lagrange multipliers.
models in nonlinear analysis and optimal design of engineering structures
The ability to include a number of existing codes within the pro- under extreme conditions. Amsterdam: IOS Press; 2005.
posed approach is significantly extended by using special features [25] Ibrahimbegovic A, Delaplace A. Microscale and mesoscale discrete models for
of the CTL middleware to accept practically all the most often used dynamic fracture of structures built of brittle materials. Comput Struct
2003;81:1255–65.
programming languages in scientific computing, such as C++, Ansi- [26] Ibrahimbegovic A, Markovic D. Strong coupling methods in multi-phase and
C and FORTRAN. Moreover, an additional asset is the ability to ac- multi-scale modeling of inelastic behavior of heterogeneous structures.
cept different discrete approximation methods (e.g. finite volume Comput Methods Appl Mech Eng 2003;192:3089–107.
[27] Ibrahimbegovic A, Melnyk S. Embedded discontinuity finite element method
versus finite element), and different time step discretization, and for modeling of localized failure in heterogeneous materials with structured
still be able to ensure the stability of computations. mesh: an alternative to extended finite element method. Comput Mech
The proposed strategy should accelerate the code development 2007;40:149–55.
[28] Ibrahimbegovic A, Matthies HG. Probabilistic multiscale analysis of inelastic
and testing, since it relies on proven codes as the part of the new localized failure in solid mechanics. Comput Assist Methods Eng Sci
developments. However, an interesting question remains in partic- 2012;19:277–304.
ular with respect to multiphysics and multiscale simulations, what [29] Kassiotis C, Ibrahimbegovic A, Niekamp R, Matthies H. Partitioned solution to
nonlinear fluid–structure interaction problems. Part I: implicit coupling
will be the limit to a growing number of existing codes incorpo-
algorithms and stability proof. Comput Mech 2011;47:305–23.
rated together in this manner. For these future developments, the [30] Kassiotis C, Ibrahimbegovic A, Niekamp R, Matthies H. Partitioned solution to
hierarchical ordering of simulation codes defined by inheritance of nonlinear fluid–structure interaction problems. Part II: CTL based software
implementation with nested parallelization. Comput Mech 2011;47:335–57.
the interfaces they implement, will become interesting. This order-
[31] Krosche M, Hautefeuille M. Simulation and solution of stochastic systems with
ing should define exactly the interchangeability of codes, given by a component-based software design. PAMM 2007;7(1):2140001–02.
the functionality they offer. [32] Krosche M, Matthies HG. Component-based software realisations of Monte
Carlo and stochastic Galerkin methods. PAMM 2008;8(1):10765–6.
[33] Langtangen HP. Python scripting for computational science. Berlin: Springer;
References 2008.
[34] Ladeveze P. Multiscale computational damage modelling of laminate
[1] Alexandrescu A. Modern C++ design: generic programming and design composites. In: Sadowski T, editor. CISM courses. Springer; 2005. p. 171–212.
patterns applied. Boston, MA, USA: Addison-Wesley Longman Publishing Co., [35] Mackie RI. Finite element software design for today’s computers. In:
Inc.; 2001. Papadrakakis M, Topping BHV, editors. Trends in eng comp technology;
[2] Anagnostopoulos P, Bearman PW. Response characteristics of a vortex excited 1997. p. 41–60.
cylinder at low Reynolds numbers. J Fluids Struct 1992;6:39–50. [36] Marenic E, Soric J, Ibrahimbegovic A. Adaptive modelling in atomistic-to-
[3] Bindel D. MATFEAP; 2011. <http://www.cs.cornell.edu/~bindel/sw/matfeap/>. continuum multiscale methods. Int J Serbian Soc Comp Mech 2012;6:169–98.
[4] Birken P, Quint K, Hartmann S, Meister A. On coupling schemes for heat [37] Markovic D, Niekamp R, Ibrahimbegovic A, Matthies HG, Taylor RL. Multi-scale
transfer in fsi applications. In: Hartmann S, Meister A, Schafer M, Turek S, modeling of heterogeneous structures with inelastic constitutive behavior.
editors. Fluid–structure-interaction. Theory, numerics and applications. Kassel Part I: mathematical and physical aspects. Int J Eng Comput 2005;22:664–83.
University Press; 2009. p. 21–30. [38] Markovic D, Ibrahimbegovic A, Park KC. Model reduction strategy for transient
[5] Birken P, Quint K, Hartmann S, Meister A. Choosing norms in adaptive FSI analysis of large structures with inelastic behavior. Int J Eng Comput
calculations. PAMM 2010;10(1):555–6. 2009;26:45–68.
[6] Birken P, Quint K, Hartmann S, Meister A. A time-adaptive fluid–structure [39] Matthies HG, Niekamp R, Steindorf J. Algorithms for strong coupling
interaction method for thermal coupling. Comput Vis Sci 2010;13:331–40. procedures. Comput Methods Appl Mech Eng 2006;195(17–18):2028–49.
[7] Bittnar Z, Sejnoha J. Numerical methods in structural mechanics. ASCE [40] Matthies HG, Niekamp R, Hautefeuille M, Jurgens D, Kassiotis C,
Publications; 1998. Srisupattarawanit T, et al. Elements of a computational framework for
[8] Comsol – multiphysics simulations and CAD models; 2010. <http:// coupled simulations, GAMM-Mitt. Mech Math 2010;33:73–8.
www.comsol.com/>. [41] Niekamp R, Krosche M, Matthies HG. Platon: a problem solving environment
[9] Corba component model, O.M.G. OMG., v4.0 (formal/2006-04-01); 2006. for computational steering of evolutionary optimisation on the grid. In:
Author's personal copy

A. Ibrahimbegovic et al. / Advances in Engineering Software 72 (2014) 8–17 17

Bugeda G, Désidéri JA, Periaux J, Schoenauer M, Winter G, editors. EUROGEN; [46] Park KC, Felippa CA, Ohayon R. Reduced-order partitioned modeling of coupled
2003. systems: formulation and computational algorithms. In: Ibrahimbegovic A,
[42] Niekamp R, Markovic D, Ibrahimbegovic A, Matthies HG, Taylor RL. Multi-scale Brank B, editors. Multi-physics and multi-scale computer models in nonlinear
modeling of heterogeneous structures with inelastic constitutive behavior. analysis and optimal design of engineering structures under extreme
Part II: software coupling and implementation aspects. Int J Eng Comput conditions. Amsterdam: IOS Press; 2005.
2009;26:6–28. [47] Srisupattarawanit T, Niekamp R, Matthies HG. Simulation of nonlinear random
[43] Oden JT, Belytschko T, Babuska I, Hughes TJR. Research directions in finite depth waves coupled with an elastic structure. Comput Methods Appl
computational mechanics. Comput Methods Appl Mech Eng Mech Eng 2006;195:3072–86.
2003;192:913–22. [48] Vandevoorde D, Josuttis N. C++ templates: the complete guide. Addison-
[44] Oden JT, Prudhomme S, Bauman P. On the extension of goal-oriented error Wesley; 2003.
estimation and hierarchical modeling to discrete lattice models. Comput [49] Zienkiewicz OC. The finite element method in engineering science. McGraw-
Methods Appl Mech Eng 2005;194:3668–88. Hill; 1971.
[45] OpenFOAM. The open source CFD toolbox; 2006. <http://www.openfoam.com/>. [50] Zienkiewicz OC, Taylor RL. The finite element method. Elsevier; 2005.

Vous aimerez peut-être aussi