Esempio n. 1
0
    def __init__(self, metaData={}):
        """
        Initializes the workflow.
        """
        MD = {
            'Name':
            'Thermo-mechanical stationary problem',
            'ID':
            'Thermo-mechanical-1',
            'Description':
            'stationary thermo-mechanical problem using finite elements on rectangular domain',
            'Model_refs_ID': [{
                'Name': 'NonStatThermo-1',
                'ID': 'ss',
                'Version_date': 'dd'
            }, {
                'Name': 'Mechanical-1',
                'ID': 'ss',
                'Version_date': 'dd'
            }],
            'Inputs': [],
            'Outputs': [{
                'Type': 'mupif.Field',
                'Type_ID': 'mupif.FieldID.FID_Temperature',
                'Name': 'Temperature field',
                'Description': 'Temperature field on 2D domain',
                'Units': 'degC'
            }, {
                'Type': 'mupif.Field',
                'Type_ID': 'mupif.FieldID.FID_Displacement',
                'Name': 'Displacement field',
                'Description': 'Displacement field on 2D domain',
                'Units': 'm'
            }]
        }
        super(Example06, self).__init__(metaData=MD)
        self.updateMetadata(metaData)

        self.thermalSolver = demoapp.thermal()
        self.mechanicalSolver = demoapp.mechanical()
Esempio n. 2
0
sys.path.append("../../..")
import demoapp
import meshgen
from mupif import FieldID
from mupif import Field
from mupif import ValueType
from mupif import TimeStep
from mupif import PropertyID
from mupif import Mesh
from mupif import Vertex
from mupif import Cell


if True:
    app = demoapp.thermal("inputT.in", ".")
    print(app.getApplicationSignature())

    sol = app.solveStep(TimeStep.TimeStep(0, 1))
    f = app.getField(FieldID.FID_Temperature, 0.0)
    data = f.field2VTKData().tofile("example2")

if True:
    app2 = demoapp.mechanical("inputM.in", ".")
    print(app2.getApplicationSignature())

    app2.setField(f)
    sol = app2.solveStep(TimeStep.TimeStep(0, 1))
    f = app2.getField(FieldID.FID_Displacement, 0.0)
    data = f.field2VTKData().tofile("example3")
Esempio n. 3
0
from __future__ import print_function
import sys
sys.path.append('../../..')
sys.path.append('../Example10')
import demoapp
import meshgen
from mupif import *

if True:
    app = demoapp.thermal('inputT11.in','.')
    print(app.getApplicationSignature())

    sol = app.solveStep(TimeStep.TimeStep(0,1)) 
    f = app.getField(FieldID.FID_Temperature, 1.0)
    f.field2VTKData().tofile('thermal11')
    f.field2Image2D(title='Thermal', fileName='thermal.png')

if True:
    app2 = demoapp.mechanical('inputM11.in', '.')
    print(app2.getApplicationSignature())

    app2.setField(f)
    sol = app2.solveStep(TimeStep.TimeStep(0,1)) 
    f = app2.getField(FieldID.FID_Displacement, 1.0)
    f.field2VTKData().tofile('mechanical11')
    f.field2Image2D(fieldComponent=1, title='Mechanical', fileName='mechanical.png')

#import time
#time.sleep(5)
Esempio n. 4
0
import sys
sys.path.append('../../..')
from mupif import *
from mupif import logger
#Import module Example10/demoapp.py
sys.path.append('../Example10')
import demoapp

#Read geometry and boundary condition for the microscale
thermalMicro = demoapp.thermal('thermalMicro.in','')
logger.info(thermalMicro.getApplicationSignature())
#Solve the microscale problem
thermalMicro.solveStep(None)
#Get effective conductivity from the microscale
effConductivity = thermalMicro.getProperty(PropertyID.PID_effective_conductivity,0.0)
logger.info('Computed effective conductivity from microscale: %f' % effConductivity.value)

#Dump microscale results to VTK files
thermalMicroField = thermalMicro.getField(FieldID.FID_Material_number, 0.0)
thermalMicroField.field2VTKData().tofile('thermalMicroMaterial')
thermalMicroField = thermalMicro.getField(FieldID.FID_Temperature, 0.0)
thermalMicroField.field2VTKData().tofile('thermalMicroT')

#Read geometry and boundary condition for the macroscale
thermalMacro = demoapp.thermal('thermalMacro.in','')
#Assign effective conductivity for the whole macroscale domain
thermalMacro.setProperty(effConductivity)
thermalMacro.solveStep(None)
thermalMacroField = thermalMacro.getField(FieldID.FID_Temperature, 0.0)

#Dump macroscale results to VTK files
Esempio n. 5
0
import sys
sys.path.extend(['../../..', '../Example10-stacTM-local'])
from mupif import *
import demoapp
import logging
log = logging.getLogger()
import mupif.Physics.PhysicalQuantities as PQ

try:
    #Read geometry and boundary condition for the microscale
    thermalMicro = demoapp.thermal()
    thermalMicro.initialize('thermalMicro.in', '')
    #Read geometry and boundary condition for the macroscale
    thermalMacro = demoapp.thermal()
    thermalMacro.initialize('thermalMacro.in', '')
    log.info(thermalMicro.getApplicationSignature())
    #Solve the microscale problem
    tstep = TimeStep.TimeStep(0., 1., 1., 's')
    thermalMicro.solveStep(tstep)
    #Get effective conductivity from the microscale
    effConductivity = thermalMicro.getProperty(
        PropertyID.PID_effective_conductivity,
        thermalMacro.getAssemblyTime(tstep))
    log.info('Computed effective conductivity from microscale: %f' %
             effConductivity.value)

    #Dump microscale results to VTK files
    thermalMicroField = thermalMicro.getField(FieldID.FID_Material_number,
                                              tstep.getTime())
    thermalMicroField.field2VTKData().tofile('thermalMicroMaterial')
    thermalMicroField = thermalMicro.getField(FieldID.FID_Temperature,
Esempio n. 6
0
from __future__ import print_function
import sys
sys.path.append('../../..')
import demoapp
import meshgen
from mupif import *
import time
import logging
log = logging.getLogger()

if True:
    app = demoapp.thermal('inputT10.in', '.')
    print(app.getApplicationSignature())

    tstep = TimeStep.TimeStep(1., 1., 10, 's')
    sol = app.solveStep(tstep)
    f = app.getField(FieldID.FID_Temperature, app.getAssemblyTime(tstep))
    f.field2VTKData().tofile('thermal10')
    f.field2Image2D(title='Thermal', fileName='thermal.png')
    time.sleep(1)
    valueT = f.evaluate((4.1, 0.9, 0.0))
    #print (valueT)

if True:
    app2 = demoapp.mechanical('inputM10.in', '.')
    print(app2.getApplicationSignature())

    app2.setField(f)
    sol = app2.solveStep(tstep)
    f = app2.getField(FieldID.FID_Displacement, tstep.getTargetTime())
    f.field2VTKData().tofile('mechanical10')
Esempio n. 7
0
 def __init__(self, targetTime=PQ.PhysicalQuantity(3., 's')):
     super(Demo15l, self).__init__(targetTime=targetTime)
     self.thermal = demoapp.thermal()
Esempio n. 8
0
    def __init__(self, targetTime=PQ.PhysicalQuantity(3., 's')):
        super(Demo15l, self).__init__(file='',
                                      workdir='',
                                      targetTime=targetTime)

        self.thermal = demoapp.thermal('inputT.in', '.')
Esempio n. 9
0
import sys
sys.path.extend(['../../..', '../Example10-stacTM-local'])
from mupif import *
import demoapp
import logging
log = logging.getLogger()
import mupif.Physics.PhysicalQuantities as PQ

try:
    #Read geometry and boundary condition for the microscale
    thermalMicro = demoapp.thermal('thermalMicro.in','')
    #Read geometry and boundary condition for the macroscale
    thermalMacro = demoapp.thermal('thermalMacro.in','')
    log.info(thermalMicro.getApplicationSignature())
    #Solve the microscale problem
    tstep = TimeStep.TimeStep(0., 1., 1., 's')
    thermalMicro.solveStep(tstep)
    #Get effective conductivity from the microscale
    effConductivity = thermalMicro.getProperty(PropertyID.PID_effective_conductivity,thermalMacro.getAssemblyTime(tstep))
    log.info('Computed effective conductivity from microscale: %f' % effConductivity.value)
    
    #Dump microscale results to VTK files
    thermalMicroField = thermalMicro.getField(FieldID.FID_Material_number, tstep.getTime())
    thermalMicroField.field2VTKData().tofile('thermalMicroMaterial')
    thermalMicroField = thermalMicro.getField(FieldID.FID_Temperature, tstep.getTime())
    thermalMicroField.field2VTKData().tofile('thermalMicroT')

    #Read geometry and boundary condition for the macroscale
    #Assign effective conductivity for the whole macroscale domain
    thermalMacro.setProperty(effConductivity)
    thermalMacro.solveStep(tstep)