Esempio n. 1
0
def test_save_scalar_field_data():
    filename = 'file_scalar'
    functionspace = df.FunctionSpace(mesh, 'CG', 1)
    f = df.Function(functionspace)

    sd = Create(filename, functionspace)

    sd.save_mesh()

    for i in range(len(t_array)):
        f.assign(df.Constant(t_array[i]))
    
        sd.save_field(f, 'f', t_array[i])

    sd.close()
Esempio n. 2
0
import numpy as np
import dolfin as df

from savingdata import Create, Read

mesh = df.UnitSquareMesh(10, 10)
filename = 'file_mpi'
functionspace = df.VectorFunctionSpace(mesh, 'CG', 1, 3)
f = df.Function(functionspace)
t_array = np.linspace(0, 1, 5)

# Save data.
sd = Create(filename, functionspace)
sd.save_mesh()
for t in t_array:
    f.assign(df.Constant((1 + t, 2, 3)))
    sd.save_field(f, 'f', t)
sd.close()