Пример #1
0
def main():
    
    # --- Workspace set up --- #
    withMPI = False
    comm = None
    myid = 0
    numberPart = 0
    rootProcess = 0
    
    cupyutil.load(fileName, withMPI, comm, myid, numberPart)
    
    # --- Initialize the solid solver --- #
    solid = None
    if myid == rootProcess:
        import cupydoInterfaces.MtfInterface
        solid = cupydoInterfaces.MtfInterface.MtfSolver('beam', 'unsteady')
    cupyutil.mpiBarrier(comm)
    
    # --- Initialize the FSI algorithm --- #
    fsi_algo = cupyalgo.FsiSolidTestAlgorithm(solid)
    
    # --- Launch the FSI computation --- #
    fsi_algo.run()
    
    # --- Exit the solid solver --- #
    if myid == rootProcess:
        solid.exit()
    
    # --- Exit computation --- #
    cupyutil.mpiBarrier(comm)
    return 0
Пример #2
0
def main():

    raise Exception(
        'Test is not working (free(): invalid pointer after Metafor sucessfull run). AFAIK, it was not tested anymore when I started with CUPyDO.\n'
    )

    # --- Set up MPI --- #
    withMPI, comm, myid, numberPart = cupyutil.getMpi()
    rootProcess = 0

    # --- Initialize the solid solver --- #
    solid = None
    if myid == rootProcess:
        import cupydo.interfaces.Metafor as sItf
        solid = sItf.Metafor('beam', 'unsteady')
    cupyutil.mpiBarrier(comm)

    # --- Initialize the FSI algorithm --- #
    fsi_algo = cupyalgo.FsiSolidTestAlgorithm(solid)

    # --- Launch the FSI computation --- #
    fsi_algo.run()

    # --- Exit the solid solver --- #
    if myid == rootProcess:
        solid.exit()

    # --- Exit computation --- #
    cupyutil.mpiBarrier(comm)
    return 0
Пример #3
0
    def __init__(self, p):
        # --- Set up MPI --- #
        withMPI, comm, myId, numberPart = cupyutil.getMpi()
        rootProcess = 0

        # --- Initialize the fluid and solid solvers --- #
        fluidSolver = self.__initFluid(p, withMPI, comm)
        cupyutil.mpiBarrier(comm)
        solidSolver = self.__initSolid(p, myId)
        cupyutil.mpiBarrier(comm)

        # --- Initialize the FSI manager --- #
        manager = cupyman.Manager(fluidSolver, solidSolver, p['nDim'], p['compType'], comm)
        cupyutil.mpiBarrier()

        # --- Initialize the interpolator --- #
        if p['interpolator'] == 'Matching':
            interpolator = cupyinterp.MatchingMeshesInterpolator(manager, fluidSolver, solidSolver, comm)
        elif p['interpolator'] == 'RBF':
            interpolator = cupyinterp.RBFInterpolator(manager, fluidSolver, solidSolver, p['rbfRadius'], comm)
        elif p['interpolator'] == 'TPS':
            interpolator = cupyinterp.TPSInterpolator(manager, fluidSolver, solidSolver, comm)
        else:
            raise RuntimeError(p['interpolator'], 'not available! (avail: "Matching", "RBF" or "TPS").\n')
        # if petsc is used, then some options can be set
        if withMPI and 'interpOpts' in p:
            for linSolver in interpolator.getLinearSolvers():
                linSolver.setMaxNumberIterations(p['interpOpts'][0])
                linSolver.setPreconditioner(p['interpOpts'][1])

        # --- Initialize the FSI criterion --- #
        if p['algorithm'] == 'Explicit':
            print 'Explicit simulations requested, criterion redefined to None.'
        if p['criterion'] == 'Displacements':
            criterion = cupycrit.DispNormCriterion(p['tol'])
        else:
            raise RuntimeError(p['criterion'], 'not available! (avail: "Displacements").\n')
        cupyutil.mpiBarrier()

        # --- Initialize the FSI algorithm --- #
        if p['algorithm'] == 'Explicit':
            self.algorithm = cupyalgo.AlgorithmExplicit(manager, fluidSolver, solidSolver, interpolator,
                p['dt'], p['tTot'], p['timeItTresh'], comm)
        elif p['algorithm'] == 'StaticBGS':
            self.algorithm = cupyalgo.AlgorithmBGSStaticRelax(manager, fluidSolver, solidSolver, interpolator, criterion,
                p['maxIt'], p['dt'], p['tTot'], p['timeItTresh'], p['omega'], comm)
        elif p['algorithm'] == 'AitkenBGS':
            self.algorithm = cupyalgo.AlgorithmBGSAitkenRelax(manager, fluidSolver, solidSolver, interpolator, criterion,
                p['maxIt'], p['dt'], p['tTot'], p['timeItTresh'], p['omega'], comm)
        elif p ['algorithm'] == 'IQN_ILS':
            self.algorithm = cupyalgo.AlgorithmIQN_ILS(manager, fluidSolver, solidSolver, interpolator, criterion,
                p['maxIt'], p['dt'], p['tTot'], p['timeItTresh'], p['omega'], p['nSteps'], p['firstItTgtMat'], comm)
        else:
            raise RuntimeError(p['algorithm'], 'not available! (avail: "Explicit", "StaticBGS", "AitkenBGS" or "IQN_ILS").\n')
        cupyutil.mpiBarrier()
def main(_p, nogui): # NB, the argument 'nogui' is specific to PFEM only!
    
    p = getParameters(_p)

    # --- Workspace set up --- #
    withMPI = False
    comm = None
    myid = 0
    numberPart = 0
    rootProcess = 0
    
    cupyutil.load(fileName, withMPI, comm, myid, numberPart)
    
    # --- Input parameters --- #
    cfd_file = 'waterColoumnFallWithFlexibleObstacle_water_Pfem_NotMatching'
    csd_file = 'waterColoumnFallWithFlexibleObstacle_obstacle_Mtf_E_1_0e6_NotMatching'
    
    # --- Initialize the fluid solver --- #
    import cupydoInterfaces.PfemInterface
    fluidSolver = cupydoInterfaces.PfemInterface.PfemSolver(cfd_file, 17, p['dt'])
    
    # --- This part is specific to PFEM ---
    fluidSolver.pfem.scheme.nthreads = p['nthreads']
    fluidSolver.pfem.scheme.savefreq = p['saveFreqPFEM']
    if nogui:
        fluidSolver.pfem.gui = None
    # ---
    
    cupyutil.mpiBarrier(comm)
    
    # --- Initialize the solid solver --- #
    solidSolver = None
    if myid == rootProcess:
        import cupydoInterfaces.MtfInterface
        solidSolver = cupydoInterfaces.MtfInterface.MtfSolver(csd_file, p['computationType'])
        
        # --- This part is specific to Metafor ---
        solidSolver.saveAllFacs = p['mtfSaveAllFacs']
        
    cupyutil.mpiBarrier(comm)
        
    # --- Initialize the FSI manager --- #
    manager = cupyman.Manager(fluidSolver, solidSolver, p['nDim'], p['computationType'], comm)
    cupyutil.mpiBarrier()

    # --- Initialize the interpolator --- #
    #interpolator = cupyinterp.MatchingMeshesInterpolator(manager, fluidSolver, solidSolver, comm)
    interpolator = cupyinterp.RBFInterpolator(manager, fluidSolver, solidSolver, p['rbfRadius'], comm)
    #interpolator = cupyinterp.TPSInterpolator(manager, fluidSolver, solidSolver, comm)
    
    # --- Initialize the FSI criterion --- #
    criterion = cupycrit.DispNormCriterion(p['tollFSI'])
    cupyutil.mpiBarrier()
    
    # --- Initialize the FSI algorithm --- #
    algorithm = cupyalgo.AlgorithmBGSAitkenRelax(manager, fluidSolver, solidSolver, interpolator, criterion, p['nFSIIterMax'], p['dt'], p['tTot'], p['timeIterTreshold'], p['omegaMax'], comm)
    
    # --- Launch the FSI computation --- #
    algorithm.run()
def main(_p, nogui): # NB, the argument 'nogui' is specific to PFEM only!
    
    p = getParameters(_p)
    
    # --- Workspace set up --- #
    withMPI = False
    comm = None
    myid = 0
    numberPart = 0
    rootProcess = 0
    
    cupyutil.load(p['testName'], withMPI, comm, myid, numberPart)
    
    # --- Input parameters --- #
    cfd_file = p['cfdFile']
    csd_file = p['csdFile']
    
    # --- Initialize the fluid solver --- #
    import cupydo.interfaces.Pfem as fItf
    fluidSolver = fItf.Pfem(cfd_file, 14, p['dt'])
    fluidSolver.pfem.pbl.betaFSI = p['betaFSI']
    
    # --- This part is specific to PFEM ---
    fluidSolver.pfem.scheme.nthreads = p['nthreads']
    fluidSolver.pfem.scheme.savefreq = p['saveFreqPFEM']
    if nogui:
        fluidSolver.pfem.gui = None
    # ---
    
    cupyutil.mpiBarrier(comm)
    
    # --- Initialize the solid solver --- #
    solidSolver = None
    if myid == rootProcess:
        import cupydo.interfaces.Metafor as sItf
        solidSolver = sItf.Metafor(csd_file, p['computationType'])
        
        # --- This part is specific to Metafor ---
        solidSolver.saveAllFacs = p['mtfSaveAllFacs']
        
    cupyutil.mpiBarrier(comm)
        
    # --- Initialize the FSI manager --- #
    manager = cupyman.Manager(fluidSolver, solidSolver, p['nDim'], p['computationType'], comm)
    cupyutil.mpiBarrier()

    # --- Initialize the interpolator --- #
    interpolator = cupyinterp.MatchingMeshesInterpolator(manager, fluidSolver, solidSolver, comm)
    
    # --- Initialize the FSI criterion --- #
    criterion = cupycrit.DispNormCriterion(p['tollFSI'])
    cupyutil.mpiBarrier()
    
    # --- Initialize the FSI algorithm --- #
    algorithm = cupyalgo.AlgorithmBGSAitkenRelax(manager, fluidSolver, solidSolver, interpolator, criterion, p['nFSIIterMax'], p['dt'], p['tTot'], p['timeIterTreshold'], p['omegaMax'], comm)
    algorithm.atikenCrit = p['aitkenCrit']
    
    # --- Launch the FSI computation --- #
    algorithm.run()
Пример #6
0
def main(_p, nogui): # NB, the argument 'nogui' is specific to PFEM only!
    
    p = getParameters(_p)

    # --- Workspace set up --- #
    withMPI = False
    comm = None
    myid = 0
    numberPart = 0
    rootProcess = 0
    
    
    
    # --- Input parameters --- #
    cfd_file = 'waterColoumnWithElasticGate_water_Pfem'
    csd_file = 'waterColoumnWithElasticGate_gate_Mtf_rho_1100'
    
    # --- Initialize the fluid solver --- #
    import cupydo.interfaces.Pfem as fItf
    fluidSolver = fItf.Pfem(cfd_file, 17, p['dt'])
    
    # --- This part is specific to PFEM ---
    fluidSolver.pfem.scheme.nthreads = p['nthreads']
    fluidSolver.pfem.scheme.savefreq = p['saveFreqPFEM']
    if nogui:
        fluidSolver.pfem.gui = None
    # ---
    
    cupyutil.mpiBarrier(comm)
    
    # --- Initialize the solid solver --- #
    solidSolver = None
    if myid == rootProcess:
        import cupydo.interfaces.Metafor as sItf
        solidSolver = sItf.Metafor(csd_file, p['computationType'])
        
        # --- This part is specific to Metafor ---
        solidSolver.saveAllFacs = p['mtfSaveAllFacs']
        
    cupyutil.mpiBarrier(comm)
        
    # --- Initialize the FSI manager --- #
    manager = cupyman.Manager(fluidSolver, solidSolver, p['nDim'], p['computationType'], comm)
    cupyutil.mpiBarrier()

    # --- Initialize the interpolator --- #
    interpolator = cupyinterp.MatchingMeshesInterpolator(manager, fluidSolver, solidSolver, comm)
    
    # --- Initialize the FSI criterion --- #
    criterion = cupycrit.DispNormCriterion(p['tollFSI'])
    cupyutil.mpiBarrier()
    
    # --- Initialize the FSI algorithm --- #
    algorithm = cupyalgo.AlgorithmIQN_ILS(manager, fluidSolver, solidSolver, interpolator, criterion, p['nFSIIterMax'], p['dt'], p['tTot'], p['timeIterTreshold'], p['omegaMax'], p['nbTimeToKeep'], p['computeTangentMatrixBasedOnFirstIt'], comm)
    algorithm.useQR = True
    
    # --- Launch the FSI computation --- #
    algorithm.run()
def main(_p, nogui):
    
    p = getParameters(_p)
    
    # --- Workspace set up --- #
    withMPI = False
    comm = None
    myid = 0
    numberPart = 0
    rootProcess = 0
    
    
    
    cfd_file = 'birdImpact_deformable_panel_bird_Pfem'
    csd_file = 'birdImpact_deformable_panel_panel_alu_Mtf'
    
    # --- Initialize the fluid solver --- #
    import cupydo.interfaces.Pfem as fItf
    fluidSolver = fItf.Pfem(cfd_file, 13, p['dt'])
    
    # --- This part is specific to PFEM ---
    fluidSolver.pfem.scheme.nthreads = p['nthreads']
    fluidSolver.pfem.scheme.savefreq = p['saveFreqPFEM']
    if nogui:
        fluidSolver.pfem.gui = None
    # ---
    
    cupyutil.mpiBarrier(comm)
    
    # --- Initialize the solid solver --- #
    solidSolver = None
    if myid == rootProcess:
        import cupydo.interfaces.Metafor as sItf
        solidSolver = sItf.Metafor(csd_file, p['computationType'])
        
        # --- This part is specific to Metafor ---
        solidSolver.saveAllFacs = p['mtfSaveAllFacs']
        
    cupyutil.mpiBarrier(comm)
        
    # --- Initialize the FSI manager --- #
    manager = cupyman.Manager(fluidSolver, solidSolver, p['nDim'], p['computationType'], comm)
    cupyutil.mpiBarrier()

    # --- Initialize the interpolator --- #
    interpolator = cupyinterp.MatchingMeshesInterpolator(manager, fluidSolver, solidSolver, comm)
    
    # --- Initialize the FSI criterion --- #
    criterion = cupycrit.DispNormCriterion(p['tollFSI'])
    cupyutil.mpiBarrier()
    
    # --- Initialize the FSI algorithm --- #
    algorithm = cupyalgo.AlgorithmBGSAitkenRelax(manager, fluidSolver, solidSolver, interpolator, criterion, p['nFSIIterMax'], p['dt'], p['tTot'], p['timeIterTreshold'], p['omegaMax'], comm)
    
    # --- Launch the FSI computation --- #
    algorithm.run()
Пример #8
0
def main(_p, nogui):
    # --- Get FSI parameters ---#
    p = getParameters(_p)

    raise Exception(
        'Test should work but is NOT validated (no reference data). Remove this exception when ready.\n'
    )

    # --- Set up MPI --- #
    withMPI, comm, myid, numberPart = cupyutil.getMpi()
    rootProcess = 0

    # --- Input parameters --- #
    cfd_file = os.path.join(filePath, 'agard_dynamic_fluid.cfg')
    csd_file = 'agard_solid'

    # --- Initialize the fluid solver --- #
    import cupydo.interfaces.SU2 as fItf
    if comm != None:
        fluidSolver = fItf.SU2(cfd_file, p['nZones_SU2'], p['nDim'],
                               p['computationType'], p['nodalLoadsType'],
                               withMPI, comm)
    else:
        fluidSolver = fItf.SU2(cfd_file, p['nZones_SU2'], p['nDim'],
                               p['computationType'], p['nodalLoadsType'],
                               withMPI, 0)
    cupyutil.mpiBarrier(comm)

    # --- Initialize modal interpreter --- #
    solidSolver = None
    if myid == rootProcess:
        import cupydo.interfaces.Modal as sItf
        solidSolver = sItf.ModalInterface(csd_file, p['computationType'])
    cupyutil.mpiBarrier(comm)

    # --- Initialize the FSI manager --- #
    manager = cupyman.Manager(fluidSolver, solidSolver, p['nDim'],
                              p['computationType'], comm)
    cupyutil.mpiBarrier()

    # --- Initialize the interpolator --- #
    interpolator = cupyinterp.RBFInterpolator(manager, fluidSolver,
                                              solidSolver, p['rbfRadius'],
                                              comm)

    # --- Initialize the FSI criterion --- #
    criterion = cupycrit.DispNormCriterion(p['tollFSI'])
    cupyutil.mpiBarrier()

    # --- Initialize the FSI algorithm --- #
    #algorithm = cupyalgo.AlgorithmBGSStaticRelax(manager, fluidSolver, solidSolver, interpolator, criterion, p['nFSIIterMax'], p['dt'], p['tTot'], p['timeIterTreshold'], p['omegaMax'], comm)
    algorithm = cupyalgo.AlgorithmExplicit(manager, fluidSolver, solidSolver,
                                           interpolator, p['dt'], p['tTot'],
                                           p['timeIterTreshold'], comm)

    # --- Launch the FSI computation --- #
    algorithm.run()

    # --- Check the results --- #
    test(algorithm.errValue, p['tollFSI'])

    # --- Exit computation --- #
    del manager
    del criterion
    del fluidSolver
    del solidSolver
    del interpolator
    del algorithm
    cupyutil.mpiBarrier(comm)

    # eof
    print ''
def main(_p, nogui):  # NB, the argument 'nogui' is specific to PFEM only!

    p = getParameters(_p)

    comm = None
    myid = 0
    numberPart = 0
    rootProcess = 0

    cupyutil.load(fileName, p['withMPI'], comm, myid, numberPart)

    if p['withMPI']:
        from mpi4py import MPI
        comm = MPI.COMM_WORLD
        myid = comm.Get_rank()
        numberPart = comm.Get_size()
    else:
        comm = None
        myid = 0
        numberPart = 1

    cfd_file = '../../../tests/SU2_Metafor/CantileverSquareChannel_BGS_parallel_SU2Conf.cfg'
    csd_file = 'CantileverSquareChannel_BGS_parallel_MetaforConf'

    # --- Initialize the fluid solver --- #
    import cupydoInterfaces.SU2Interface
    if comm != None:
        fluidSolver = cupydoInterfaces.SU2Interface.SU2Solver(
            cfd_file, p['nZones_SU2'], p['nDim'], p['computationType'],
            p['nodalLoadsType'], p['withMPI'], comm)
    else:
        fluidSolver = cupydoInterfaces.SU2Interface.SU2Solver(
            cfd_file, p['nZones_SU2'], p['nDim'], p['computationType'],
            p['nodalLoadsType'], p['withMPI'], 0)

    cupyutil.mpiBarrier(comm)

    # --- Initialize the solid solver --- #
    solidSolver = None
    if myid == rootProcess:
        import cupydoInterfaces.MtfInterface
        solidSolver = cupydoInterfaces.MtfInterface.MtfSolver(
            csd_file, p['computationType'])

        # --- This part is specific to Metafor ---
        solidSolver.saveAllFacs = p['mtfSaveAllFacs']

    cupyutil.mpiBarrier(comm)

    # --- Initialize the FSI manager --- #
    manager = cupyman.Manager(fluidSolver, solidSolver, p['nDim'],
                              p['computationType'], comm)
    cupyutil.mpiBarrier()

    # --- Initialize the interpolator --- #
    interpolator = cupyinterp.MatchingMeshesInterpolator(
        manager, fluidSolver, solidSolver, comm)

    # --- Initialize the FSI criterion --- #
    criterion = cupycrit.DispNormCriterion(p['tollFSI'])
    cupyutil.mpiBarrier()

    # --- Initialize the FSI algorithm --- #
    algorithm = cupyalgo.AlgorithmIQN_ILS(
        manager, fluidSolver, solidSolver, interpolator, criterion,
        p['nFSIIterMax'], p['dt'], p['tTot'], p['timeIterTreshold'],
        p['omegaMax'], p['nbTimeToKeep'],
        p['computeTangentMatrixBasedOnFirstIt'], comm)

    # --- Launch the FSI computation --- #
    algorithm.run()

    # --- Exit computation --- #
    del manager
    del criterion
    del fluidSolver
    del solidSolver
    del interpolator
    del algorithm
    cupyutil.mpiBarrier(comm)
    return 0
Пример #10
0
def main(_p, nogui):

    p = getParameters(_p)

    comm = None
    myid = 0
    numberPart = 0
    rootProcess = 0

    cupyutil.load(fileName, p['withMPI'], comm, myid, numberPart)

    if p['withMPI']:
        from mpi4py import MPI
        comm = MPI.COMM_WORLD
        myid = comm.Get_rank()
        numberPart = comm.Get_size()
    else:
        comm = None
        myid = 0
        numberPart = 1

    # --- Input parameters --- #
    CFD_file = '../../../tests/SU2_Metafor/AGARD445_Static_SU2Conf.cfg'
    CSD_file = 'AGARD445_Static_MetaforConf'

    # --- Initialize the fluid solver --- #
    import cupydoInterfaces.SU2Interface
    if comm != None:
        FluidSolver = cupydoInterfaces.SU2Interface.SU2Solver(
            CFD_file, p['nZones_SU2'], p['nDim'], p['computationType'],
            p['nodalLoadsType'], p['withMPI'], comm)
    else:
        FluidSolver = cupydoInterfaces.SU2Interface.SU2Solver(
            CFD_file, p['nZones_SU2'], p['nDim'], p['computationType'],
            p['nodalLoadsType'], p['withMPI'], 0)
    cupyutil.mpiBarrier(comm)

    # --- Initialize the solid solver --- #
    SolidSolver = None
    if myid == rootProcess:
        import cupydoInterfaces.MtfInterface
        SolidSolver = cupydoInterfaces.MtfInterface.MtfSolver(
            CSD_file, p['computationType'])
        SolidSolver.saveAllFacs = p['mtfSaveAllFacs']
    cupyutil.mpiBarrier(comm)

    # --- Initialize the FSI manager --- #
    manager = cupyman.Manager(FluidSolver, SolidSolver, p['nDim'],
                              p['computationType'], comm)
    cupyutil.mpiBarrier()

    # --- Initialize the interpolator --- #
    interpolator = cupyinterp.TPSInterpolator(manager, FluidSolver,
                                              SolidSolver, comm)
    solverList = interpolator.getLinearSolvers()
    for ii in range(2):
        solverList[ii].setMaxNumberIterations(1000)
        solverList[ii].setPreconditioner("JACOBI")

    # --- Initialize the FSI criterion --- #
    criterion = cupycrit.DispNormCriterion(p['tollFSI'])
    cupyutil.mpiBarrier()

    # --- Initialize the FSI algorithm --- #
    algorithm = cupyalgo.AlgorithmBGSStaticRelax(manager, FluidSolver,
                                                 SolidSolver, interpolator,
                                                 criterion, p['nFSIIterMax'],
                                                 p['dt'], p['tTot'],
                                                 p['timeIterTreshold'],
                                                 p['omegaMax'], comm)

    # --- Launch the FSI computation --- #
    algorithm.run()

    # --- Exit computation --- #
    del manager
    del criterion
    del FluidSolver
    del SolidSolver
    del interpolator
    del algorithm
    cupyutil.mpiBarrier(comm)
    return 0
def main(_p, nogui):  # NB, the argument 'nogui' is specific to PFEM only!

    p = getParameters(_p)

    # --- Workspace set up --- #
    withMPI = False
    comm = None
    myid = 0
    numberPart = 0
    rootProcess = 0

    cfd_file = 'VIV_cantileverBeam_air_Pfem'
    csd_file = 'VIV_cantileverBeam_beam_Mtf'
    nDim = 2
    tollFSI = 1e-6
    dt = 0.0005
    tTot = 10.
    nFSIIterMax = 10
    omegaMax = 1.0
    computationType = 'unsteady'

    # --- Initialize the fluid solver --- #
    import cupydo.interfaces.Pfem as fItf
    fluidSolver = fItf.Pfem(cfd_file, 23, dt)

    # --- This part is specific to PFEM ---
    fluidSolver.pfem.scheme.nthreads = p['nthreads']
    if battery:
        fluidSolver.pfem.scheme.savefreq = int(tTot / dt)
    if nogui:
        fluidSolver.pfem.gui = None
    # ---

    cupyutil.mpiBarrier(comm)

    # --- Initialize the solid solver --- #
    solidSolver = None
    if myid == rootProcess:
        import cupydo.interfaces.Metafor as sItf
        solidSolver = sItf.Metafor(csd_file, computationType)

        # --- This part is specific to Metafor ---
        if battery:
            solidSolver.saveAllFacs = False
        # ---

    cupyutil.mpiBarrier(comm)

    # --- Initialize the FSI manager --- #
    manager = cupyman.Manager(fluidSolver, solidSolver, nDim, computationType,
                              comm)
    cupyutil.mpiBarrier()

    # --- Initialize the interpolator --- #
    interpolator = cupyinterp.MatchingMeshesInterpolator(
        manager, fluidSolver, solidSolver, comm)

    # --- Initialize the FSI criterion --- #
    criterion = cupycrit.DispNormCriterion(tollFSI)
    cupyutil.mpiBarrier()

    # --- Initialize the FSI algorithm --- #
    algorithm = cupyalgo.AlgorithmBGSAitkenRelax(manager, fluidSolver,
                                                 solidSolver, interpolator,
                                                 criterion, nFSIIterMax, dt,
                                                 tTot, 0, omegaMax, comm)

    # --- Launch the FSI computation --- #
    algorithm.run()
Пример #12
0
def main(_p, nogui):

    p = getParameters(_p)

    comm = None
    myid = 0
    numberPart = 0
    rootProcess = 0

    cupyutil.load(fileName, p['withMPI'], comm, myid, numberPart)

    if p['withMPI']:
        from mpi4py import MPI
        comm = MPI.COMM_WORLD
        myid = comm.Get_rank()
        numberPart = comm.Get_size()
    else:
        comm = None
        myid = 0
        numberPart = 1

    cfd_file = '../../../tests/SU2_RBM/PitchPlungeAirfoil_BGS_parallel_SU2Conf.cfg'
    csd_file = '../../../tests/SU2_RBM/PitchPlungeAirfoil_BGS_parallel_RBMConf.cfg'

    # --- Initialize the fluid solver --- #
    import cupydoInterfaces.SU2Interface
    if comm != None:
      fluidSolver = cupydoInterfaces.SU2Interface.SU2Solver(cfd_file, p['nZones_SU2'], p['nDim'], p['computationType'], p['nodalLoadsType'], p['withMPI'], comm)
    else:
      fluidSolver = cupydoInterfaces.SU2Interface.SU2Solver(cfd_file, p['nZones_SU2'], p['nDim'], p['computationType'], p['nodalLoadsType'], p['withMPI'], 0)
  
    cupyutil.mpiBarrier(comm)

    # --- Initialize the solid solver --- #
    solidSolver = None
    if myid == rootProcess:
      import cupydoInterfaces.RBMIntegratorInterface
      solidSolver = cupydoInterfaces.RBMIntegratorInterface.RBMIntegrator(csd_file, p['computationType'])

    cupyutil.mpiBarrier(comm)

    # --- Initialize the FSI manager --- #
    manager = cupyman.Manager(fluidSolver, solidSolver, p['nDim'], p['computationType'], comm)
    cupyutil.mpiBarrier()

    # --- Initialize the interpolator --- #
    interpolator = cupyinterp.MatchingMeshesInterpolator(manager, fluidSolver, solidSolver, comm)

    # --- Initialize the FSI criterion --- #
    criterion = cupycrit.DispNormCriterion(p['tollFSI'])
    cupyutil.mpiBarrier()

    # --- Initialize the FSI algorithm --- #
    algorithm = cupyalgo.AlgorithmBGSStaticRelax(manager, fluidSolver, solidSolver, interpolator, criterion, p['nFSIIterMax'], p['dt'], p['tTot'], p['timeIterTreshold'], p['omegaMax'], comm)

    # --- Launch the FSI computation --- #
    algorithm.run()
  
    # --- Exit computation --- #
    del manager
    del criterion
    del fluidSolver
    del solidSolver
    del interpolator
    del algorithm
    cupyutil.mpiBarrier(comm)
    return 0