Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

How to change solving order of equations during calculation without ''Circular variable dependency'' ?

Please login with a confirmed email address before reporting spam

Dear colleagues,

I have a question about COMSOL logic concerning circular variable dependency.

Let's say I have 6 simple equations (just variables definitions) and I want to change the order in which they are solved when a certain condition is met during simulation. How do I write this down without getting said error?

Context:
I have a particle that releases gas and thus decreases in density, but stays the same volume. When combustion starts (the condition), the density stays the same, but now the volume decreases. I have defined the volume and density everywhere in my model so I want to keep those names the same. But in the first situation, I know the volume so I calculate the density, while in the second situation I know the density, but I want the calculate the volume. I tried to use dummy variables, but COMSOL won't let me use it.

What I tried was I defined a switch as:

switch = if(condition,1,0)

dummy_rho_1 = calculation method 1
dummy_rho_2 = calculation method 2
rho = (method for situation 1)*switch + (method for situation 2)*(1-switch)

dummy_volume_1 = calculation method 1
dummy_volume_2 = calculation method 2
volume = (method for situation 1)*switch + (method for situation 2)*(1-switch)

But because parts of the dummy variables are dependent on each other (even though I separated them by the switch method), COMSOL states the circ. var. dep. So, does anyone have a good idea or hint or suggestion to tackle this? It would be much appreciated.

Thanks a lot and kind regards,

Ray

PS. I wanted to include the actual equations, but because the forum doesn't allow me to attach a text file, I will post them in the next reply box. Maybe they can help. :)

1 Reply Last Post 14.06.2012, 16:19 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14.06.2012, 16:19 GMT-4
Switch if(m_char_l_kg==Char_init_wtkg_zone,1,0)

dummy_rho_bulk_1 ((m_char_kg_zone+m_volatiles_kg_zone+m_moisture_kg_zone+m_ash_kg_zone)/V_zone)
dummy_rho_bulk_2 ((Ash_init_wtkg_zone+Char_init_wtkg_zone)/(V_zone)) 41.4172[kg/m^3]
rho_bulk dummy_rho_bulk_1*Switch+dummy_rho_bulk_2*(1-Switch)

dummy_rho_particle_1 ((m_char_kg_zone+m_volatiles_kg_zone+m_moisture_kg_zone+m_ash_kg_zone)/V_solid_zone)
dummy_rho_particle_2 ((Ash_init_wtkg_zone+Char_init_wtkg_zone)/(V_zone*(1-epsilon_init))) 101.0176[kg/m^3]
rho_particle dummy_rho_particle_1*Switch+dummy_rho_particle_2*(1-Switch)

dummy_V_particle_1 (pi/6)*dp_init^3
dummy_V_particle_2 V_solid_zone/np_zone_init
V_particle dummy_V_particle_1*Switch+dummy_V_particle_2*(1-Switch)

dummy_V_solid_zone_1 (1-epsilon_init)*V_zone
dummy_V_solid_zone_2 ((Ash_init_wtkg_zone+Char_init_wtkg_zone)/rho_particle)
V_solid_zone dummy_V_solid_zone_1*Switch+dummy_V_solid_zone_2*(1-Switch)

dummy_V_gas_zone_1 V_zone*epsilon_init
dummy_V_gas_zone_2 V_zone*epsilon
V_gas_zone dummy_V_gas_zone_1*Switch+dummy_V_gas_zone_2*(1-Switch)

dummy_dp_1 dp_init
dummy_dp_2 ((V_particle*6)/pi)^(1/3)
dp dummy_dp_1*Switch+dummy_dp_2*(1-Switch)

dummy_epsilon_1 epsilon_init
dummy_epsilon_2 1-(V_solid_zone/V_zone)
epsilon dummy_epsilon_1*Switch+dummy_epsilon_2*(1-Switch)
Switch if(m_char_l_kg==Char_init_wtkg_zone,1,0) dummy_rho_bulk_1 ((m_char_kg_zone+m_volatiles_kg_zone+m_moisture_kg_zone+m_ash_kg_zone)/V_zone) dummy_rho_bulk_2 ((Ash_init_wtkg_zone+Char_init_wtkg_zone)/(V_zone)) 41.4172[kg/m^3] rho_bulk dummy_rho_bulk_1*Switch+dummy_rho_bulk_2*(1-Switch) dummy_rho_particle_1 ((m_char_kg_zone+m_volatiles_kg_zone+m_moisture_kg_zone+m_ash_kg_zone)/V_solid_zone) dummy_rho_particle_2 ((Ash_init_wtkg_zone+Char_init_wtkg_zone)/(V_zone*(1-epsilon_init))) 101.0176[kg/m^3] rho_particle dummy_rho_particle_1*Switch+dummy_rho_particle_2*(1-Switch) dummy_V_particle_1 (pi/6)*dp_init^3 dummy_V_particle_2 V_solid_zone/np_zone_init V_particle dummy_V_particle_1*Switch+dummy_V_particle_2*(1-Switch) dummy_V_solid_zone_1 (1-epsilon_init)*V_zone dummy_V_solid_zone_2 ((Ash_init_wtkg_zone+Char_init_wtkg_zone)/rho_particle) V_solid_zone dummy_V_solid_zone_1*Switch+dummy_V_solid_zone_2*(1-Switch) dummy_V_gas_zone_1 V_zone*epsilon_init dummy_V_gas_zone_2 V_zone*epsilon V_gas_zone dummy_V_gas_zone_1*Switch+dummy_V_gas_zone_2*(1-Switch) dummy_dp_1 dp_init dummy_dp_2 ((V_particle*6)/pi)^(1/3) dp dummy_dp_1*Switch+dummy_dp_2*(1-Switch) dummy_epsilon_1 epsilon_init dummy_epsilon_2 1-(V_solid_zone/V_zone) epsilon dummy_epsilon_1*Switch+dummy_epsilon_2*(1-Switch)

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.