Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 447f92400a4cc51513d722df3f7f240af5f1af3e authored by Eh Tan on 23 August 2007, 20:15:50 UTC, committed by Eh Tan on 23 August 2007, 20:15:50 UTC
Removed unused var. in struct advection
1 parent 80a070b
  • Files
  • Changes
  • a32b4d0
  • /
  • CitcomS
  • /
  • Solver
  • /
  • CoupledSolver.py
Raw File Download
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:447f92400a4cc51513d722df3f7f240af5f1af3e
directory badge Iframe embedding
swh:1:dir:25e7b26f85bb519b18991f7a4c9f887457eb895e
content badge Iframe embedding
swh:1:cnt:7aa73843135628bd0f8022ba671fe2caeae417fc
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
CoupledSolver.py
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
#<LicenseText>
#
# CitcomS.py by Eh Tan, Eun-seo Choi, and Pururav Thoutireddy.
# Copyright (C) 2002-2005, California Institute of Technology.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#</LicenseText>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#

from CitcomSLib import output, output_time
from Solver import Solver
import journal



class CoupledSolver(Solver):

    def __init__(self, name, facility="solver"):
        Solver.__init__(self, name, facility)

        self.coupler = None
        self.myPlus = []
        self.remotePlus = []
        return


    def initialize(self, application):
        Solver.initialize(self, application)

        self.coupler = application.coupler
        self.myPlus = application.myPlus
        self.remotePlus = application.remotePlus

        self.restart = self.inventory.ic.inventory.restart
        self.ic_initTemperature = self.inventory.ic.initTemperature

        self.coupler.initialize(self)
        return


    def launch(self, application):

        #TODO: checkpoint doesn't contain coupler information yet
        if self.restart:
            pass

        self.coupler.launch(self)

        ic = self.inventory.ic
        if not (ic.inventory.restart or ic.inventory.post_p):
            # switch the default initTemperature to coupled version
            ic.initTemperature = self.coupler.initTemperature

        # initial conditions
        ic.launch()

        self.solveVelocities()
        return



    def solveVelocities(self):
        # sync boundary conditions before/after vsolver
        vsolver = self.inventory.vsolver
        self.coupler.preVSolverRun()
        vsolver.run()
        self.coupler.postVSolverRun()
        return



    def advectTracers(self):
        # override Solver.advectTracers, since tracer module
        # doesn't work in coupled run
        return



    def newStep(self):
        Solver.newStep(self)

        # sync the temperature field
        self.coupler.newStep()
        return



    def stableTimestep(self):
        dt = Solver.stableTimestep(self)

        # negotiate with other solver(s)
        dt = self.coupler.stableTimestep(dt)
        print "solver received dt = %g" %dt
        return dt


    def endTimestep(self, done):
        done = Solver.endTimestep(self, done)

        # check with other solver, are we done?
        done = self.coupler.endTimestep(self.step, done)
        return done


    def endSimulation(self):
        self._avgCPUTime()
        # write even if not sync'd
        output(self.all_variables, self.step)
        self.finalize()
        return



    def save(self, monitoringFrequency):
        step = self.step

        # for coupled run, output spacing is determined by coupled_steps
        if (not (step % monitoringFrequency)) or (
            not (self.coupler.coupled_steps % monitoringFrequency)):
            output(self.all_variables, step)

        output_time(self.all_variables, step)
        return


    def checkpoint(self, checkpointFrequency):
        Solver.checkpoint(self, checkpointFrequency)

        if not (self.step % checkpointFrequency):
            #TODO: checkpoint for coupler
            pass
        return



# version
__id__ = "$Id$"

# End of file
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API