Start computation with arbitrary field data (not function-defined)
Hello,
I am working on the solution of coupled systems of equations through external coupling of partial systems by the boundary conditions (specifically, CHT coupling for aerothermics). This is typically performed at Onera with the solvers /elsA /for aerodynamics and Z-set for thermics, coupled through Dirichlet-Robin, Neumann-Robin or similar boundary conditions on temperature and flux at the solid boundaries.
For (possibly at-home) research purposes I am trying to create a simpler system, based on SfePy and Gmsh.
The solution by SfePy of the thermal problem on the solid domain works very well (NACA C3X turbine vane), as for the aerodynamics (in laminar flow in a periodic channel at low Reynolds number to reduce computational costs).
I am currently tackling the solution of the aerothermal problem in incompressible flow; again, the solution of the global problem (1:dynamics & 2:thermics combined in 1 system) by SfePy works very well.
I then proceeded to the separation of systems 1 & 2, which are uncoupled for incompressible flow and may be solved successively.
Again, I managedto chain initial computations on the two sets of equations, starting from constant or function-defined boundary conditions.
For CHT coupling, I will need to (re-)start computations from initial fields:
- velocity u
- pressure p
- temperature T
As a check,, I tried to solve the global set of all equations (1+2) from the previous (u, p, T) fields. This would also allow me to output a single file with all the fields for plotting.
I didn't find a way toset the initial fields through initial conditions, because apparently the icsdefinition is used bydiscrete.variables.FieldVariable.setup_initial_conditions()(see code below).
I also tried (last code snippet) using state.set_parts(), with init_fields=False, to no avail.
Please tell, what am I missing ? How can I initialise a field with arbitrary field-typed data:
- not defined by a function of the coordinates
- not read from a file ?
Best regards, Marc Lazareff
In my script:
# 1) solve the stationary incompressible dynamics state_dynamics = problem1.solve() ... # 2) solve the stationary thermics (decoupled heat advection) state_thermics = problem2.solve() ... # 3) gather all data u_part = state_dynamics.get_parts()['u’] p_part = state_dynamics.get_parts()['p'] T_part = state_thermics.get_parts()['T']
# initial conditions from fields: *bad, only uses 1 value from each field * ics = { 'icU' : ('Omega', u_part), 'icP' : ('Omega', p_part), 'icT' : ('Omega', T_part), } problem3 = Problem.from_conf(conf, init_equations=False) # , init_fields=False) problem3.setup_default_output() equations3 = {spam:equations0[spam] for spam in ['balance', 'incompressibility', 'neumannP', 'energy']} problem3.set_equations(equations3) variables3 = problem3.get_variables() # (re-)solve "coupled" problem state_all = problem3.solve() problem3.save_state(problem3.get_output_name(suffix='all'), state_all)
In SfePy: def setup_initial_conditions(self, ics, di, functions, warn=True): # ML warn=False): """ Setup of initial conditions. """ ics.canonize_dof_names(self.dofs) ics.sort() print(f"setup_initial_conditions: ics = {ics}")
self.initial_condition = nm.zeros((di.n_dof[self.name],), dtype=self.dtype) for ic in ics: region = ic.region dofs, val = ic.dofs print(f"setup_initial_conditions: val = {val}”) # !! only gathers a single value ...
# also tried: state = problem3.create_state() # not OK @ dictionary comprehension, using explicit loop for var in ('u', 'p', 'T'): state.set_parts({var: eval(f"{var}_part")})
-- *Marc Lazareff* Senior Research Engineer Département aérodynamique, aéroélasticité, acoustique NFLU Tél: +33 1 46 73 42 73
ONERA - The French Aerospace Lab - Centre de Châtillon 29, avenue de la Division Leclerc - BP 72 - 92322 CHATILLON CEDEX Avertissement/disclaimer https://www.onera.fr/en/emails-terms https://www.onera.fr/en/emails-terms
Protégeons nous les uns les autres, respectons les gestes barrières https://www.onera.fr/fr/centres
participants (2)
-
Marc Lazareff
-
Robert Cimrman